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 /****************************************************************************/
16 // The base class for an intersection
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include "MSVehicle.h"
26 #include "MSEdge.h"
27 #include "MSJunction.h"
28 
29 
30 
31 
32 
33 
34 // ===========================================================================
35 // debug constants
36 // ===========================================================================
37 //#define DEBUG_LINKLEADER
38 //#define DEBUG_COND (ego->isSelected())
39 //#define DEBUG_COND (true)
40 
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class MSLink;
47 
48 // ===========================================================================
49 // static member definitions
50 // ===========================================================================
51 
52 // ===========================================================================
53 // member method definition
54 // ===========================================================================
55 MSJunction::MSJunction(const std::string& id, SumoXMLNodeType type, const Position& position,
56  const PositionVector& shape) :
57  Named(id),
58  myType(type),
59  myPosition(position),
60  myShape(shape) {
61 }
62 
63 
65 
66 
67 const Position&
69  return myPosition;
70 }
71 
72 
73 void
75 
76 
77 int
79  int nr = 0;
80  for (const MSEdge* e : myIncoming) {
81  nr += (int)e->getLanes().size();
82  }
83  return nr;
84 }
85 
86 /****************************************************************************/
87 
Named
Base class for objects which have an id.
Definition: Named.h:56
MSEdge.h
MSJunction::postloadInit
virtual void postloadInit()
Definition: MSJunction.cpp:74
PositionVector
A list of positions.
Definition: PositionVector.h:45
MSVehicle.h
MSJunction::MSJunction
MSJunction(const std::string &id, SumoXMLNodeType type, const Position &position, const PositionVector &shape)
Constructor.
Definition: MSJunction.cpp:55
MSJunction.h
SumoXMLNodeType
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
Definition: SUMOXMLDefinitions.h:1054
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
MSJunction::myIncoming
ConstMSEdgeVector myIncoming
incoming edges
Definition: MSJunction.h:153
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
MSJunction::getPosition
const Position & getPosition() const
Definition: MSJunction.cpp:68
MSJunction::~MSJunction
virtual ~MSJunction()
Destructor.
Definition: MSJunction.cpp:64
config.h
MSJunction::getNrOfIncomingLanes
int getNrOfIncomingLanes() const
Definition: MSJunction.cpp:78
MSJunction::myPosition
Position myPosition
The position of the junction.
Definition: MSJunction.h:143