Eclipse SUMO - Simulation of Urban MObility
MSJunction.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // The base class for an intersection
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include "MSVehicle.h"
27 #include "MSEdge.h"
28 #include "MSJunction.h"
29 
30 
31 
32 
33 
34 
35 // ===========================================================================
36 // debug constants
37 // ===========================================================================
38 //#define DEBUG_LINKLEADER
39 //#define DEBUG_COND (ego->isSelected())
40 //#define DEBUG_COND (true)
41 
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
47 class MSLink;
48 
49 // ===========================================================================
50 // static member definitions
51 // ===========================================================================
52 
53 // ===========================================================================
54 // member method definition
55 // ===========================================================================
56 MSJunction::MSJunction(const std::string& id, SumoXMLNodeType type, const Position& position,
57  const PositionVector& shape) :
58  Named(id),
59  myType(type),
60  myPosition(position),
61  myShape(shape) {
62 }
63 
64 
66 
67 
68 const Position&
70  return myPosition;
71 }
72 
73 
74 void
76 
77 
78 int
80  int nr = 0;
81  for (const MSEdge* e : myIncoming) {
82  nr += (int)e->getLanes().size();
83  }
84  return nr;
85 }
86 
87 /****************************************************************************/
88 
virtual ~MSJunction()
Destructor.
Definition: MSJunction.cpp:65
A road/street connecting two junctions.
Definition: MSEdge.h:76
ConstMSEdgeVector myIncoming
incoming edges
Definition: MSJunction.h:154
Position myPosition
The position of the junction.
Definition: MSJunction.h:144
MSJunction(const std::string &id, SumoXMLNodeType type, const Position &position, const PositionVector &shape)
Constructor.
Definition: MSJunction.cpp:56
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
A list of positions.
const Position & getPosition() const
Definition: MSJunction.cpp:69
Base class for objects which have an id.
Definition: Named.h:57
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
int getNrOfIncomingLanes() const
Definition: MSJunction.cpp:79
virtual void postloadInit()
Definition: MSJunction.cpp:75