Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSJunction.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// The base class for an intersection
22/****************************************************************************/
23#pragma once
24#include <config.h>
25
26#include <string>
27#include <vector>
28#include <map>
29#include <utils/geom/Position.h>
31#include <utils/common/Named.h>
36
37
38// ===========================================================================
39// class declarations
40// ===========================================================================
41class MSVehicle;
42class MSLink;
43class MSLane;
44class MSEdge;
45class MSJunctionLogic;
46
47typedef std::vector<MSEdge*> MSEdgeVector;
48typedef std::vector<const MSEdge*> ConstMSEdgeVector;
49
50
51// ===========================================================================
52// class definitions
53// ===========================================================================
58class MSJunction : public Named, public Parameterised {
59public:
65 MSJunction(const std::string& id,
66 SumoXMLNodeType type,
67 const Position& position,
68 const PositionVector& shape,
69 const std::string& name);
70
71
73 virtual ~MSJunction();
74
75
78 virtual void postloadInit();
79
81 void addSecondaryPosition(const Position& pos) {
82 myPosition2 = pos;
83 }
84
86 const Position& getPosition(bool secondaryShape = false) const;
87
91 const PositionVector& getShape() const {
92 return myShape;
93 }
94
96 const std::string& getName() const {
97 return myName;
98 }
99
100 virtual const std::vector<MSLink*>& getFoeLinks(const MSLink* const /*srcLink*/) const {
101 return myEmptyLinks;
102 }
103
104 virtual const std::vector<MSLane*>& getFoeInternalLanes(const MSLink* const /*srcLink*/) const {
105 return myEmptyLanes;
106 }
107
108 inline const ConstMSEdgeVector& getIncoming() const {
109 return myIncoming;
110 }
111
112 int getNrOfIncomingLanes() const;
113
114 inline const ConstMSEdgeVector& getOutgoing() const {
115 return myOutgoing;
116 }
117
120 virtual const std::vector<MSLane*> getInternalLanes() const {
121 return myEmptyLanes;
122 }
123
124 void addIncoming(MSEdge* edge) {
125 myIncoming.push_back(edge);
126 }
127
128 void addOutgoing(MSEdge* edge) {
129 myOutgoing.push_back(edge);
130 }
131
134 return myType;
135 }
136
138 void passedJunction(const MSVehicle* vehicle);
139
140 // @brief return the underlying right-of-way and conflict matrix
141 virtual const MSJunctionLogic* getLogic() const {
142 return nullptr;
143 }
144
145protected:
148
151
154
157
159 std::string myName;
160
161 std::vector<MSLink*> myEmptyLinks;
162 std::vector<MSLane*> myEmptyLanes;
163
164
169
170private:
172 MSJunction(const MSJunction&) = delete;
173
175 MSJunction& operator=(const MSJunction&) = delete;
176
177};
std::vector< const MSEdge * > ConstMSEdgeVector
Definition MSJunction.h:48
std::vector< MSEdge * > MSEdgeVector
Definition MSJunction.h:47
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
A road/street connecting two junctions.
Definition MSEdge.h:77
The base class for an intersection.
Definition MSJunction.h:58
virtual const std::vector< MSLane * > & getFoeInternalLanes(const MSLink *const) const
Definition MSJunction.h:104
SumoXMLNodeType getType() const
return the type of this Junction
Definition MSJunction.h:133
virtual const MSJunctionLogic * getLogic() const
Definition MSJunction.h:141
MSJunction(const MSJunction &)=delete
Invalidated copy constructor.
Position myPosition2
The secondary position of the junction.
Definition MSJunction.h:153
std::vector< MSLane * > myEmptyLanes
Definition MSJunction.h:162
virtual ~MSJunction()
Destructor.
PositionVector myShape
The shape of the junction.
Definition MSJunction.h:156
ConstMSEdgeVector myOutgoing
outgoing edges
Definition MSJunction.h:168
MSJunction & operator=(const MSJunction &)=delete
Invalidated assignment operator.
void addSecondaryPosition(const Position &pos)
used by the gui
Definition MSJunction.h:81
std::vector< MSLink * > myEmptyLinks
Definition MSJunction.h:161
Position myPosition
The position of the junction.
Definition MSJunction.h:150
virtual const std::vector< MSLane * > getInternalLanes() const
Returns all internal lanes on the junction.
Definition MSJunction.h:120
std::string myName
@briefh The (optional) junction name
Definition MSJunction.h:159
int getNrOfIncomingLanes() const
void addOutgoing(MSEdge *edge)
Definition MSJunction.h:128
ConstMSEdgeVector myIncoming
incoming edges
Definition MSJunction.h:166
void addIncoming(MSEdge *edge)
Definition MSJunction.h:124
virtual const std::vector< MSLink * > & getFoeLinks(const MSLink *const) const
Definition MSJunction.h:100
const ConstMSEdgeVector & getOutgoing() const
Definition MSJunction.h:114
const std::string & getName() const
return the junction name
Definition MSJunction.h:96
void passedJunction(const MSVehicle *vehicle)
erase vehicle from myLinkLeaders
SumoXMLNodeType myType
Tye type of this junction.
Definition MSJunction.h:147
const Position & getPosition(bool secondaryShape=false) const
const PositionVector & getShape() const
Returns this junction's shape.
Definition MSJunction.h:91
virtual void postloadInit()
const ConstMSEdgeVector & getIncoming() const
Definition MSJunction.h:108
Representation of a lane in the micro simulation.
Definition MSLane.h:84
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
Base class for objects which have an id.
Definition Named.h:54
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.