Eclipse SUMO - Simulation of Urban MObility
NLEdgeControlBuilder.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 // Interface for building edges
22 /****************************************************************************/
23 #pragma once
24 #include <config.h>
25 
26 #include <string>
27 #include <vector>
28 #include <microsim/MSEdge.h>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class MSEdgeControl;
36 class MSLane;
37 class MSNet;
38 class OutputDevice;
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
56 
57 public:
60 
61 
63  virtual ~NLEdgeControlBuilder();
64 
65 
78  void beginEdgeParsing(const std::string& id, const SumoXMLEdgeFunc function,
79  const std::string& streetName, const std::string& edgeType,
80  int priority,
81  const std::string& bidi,
82  double distance);
83 
84 
98  virtual MSLane* addLane(const std::string& id, double maxSpeed, double friction,
99  double length, const PositionVector& shape,
100  double width,
101  SVCPermissions permissions,
102  SVCPermissions changeLeft, SVCPermissions changeRight,
103  int index, bool isRampAccel,
104  const std::string& type,
105  const PositionVector& outlineShape);
106 
109  void addStopOffsets(const StopOffset& stopOffsets);
110 
113  std::string reportCurrentEdgeOrLane() const;
114 
120  virtual void addNeigh(const std::string id);
121 
124  virtual MSEdge* closeEdge();
125 
128  void closeLane();
129 
131  MSEdgeControl* build(const MMVersion& networkVersion);
132 
133 
143  virtual MSEdge* buildEdge(const std::string& id, const SumoXMLEdgeFunc function,
144  const std::string& streetName, const std::string& edgeType, const int priority, const double distance);
145 
150  virtual void addCrossingEdges(const std::vector<std::string>&);
151 
152 protected:
155 
158 
161 
164 
167 
170 
172  std::vector<MSLane*>* myLaneStorage;
173 
175  std::map<MSEdge*, std::string, ComparatorNumericalIdLess> myBidiEdges;
176 
177  std::vector<std::pair<MSLane*, std::string> > myOppositeLanes;
178 
181  void updateCurrentLaneStopOffset(const StopOffset& stopOffset);
182 
185  void setDefaultStopOffset(const StopOffset& stopOffset);
186 
190 
191 private:
194 
197 
198 };
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:73
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
std::pair< int, double > MMVersion
(M)ajor/(M)inor version for written networks and default version for loading
Definition: StdDefs.h:67
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:78
A road/street connecting two junctions.
Definition: MSEdge.h:77
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
The simulated network and simulation perfomer.
Definition: MSNet.h:89
Interface for building edges.
virtual MSEdge * closeEdge()
Closes the building of an edge; The edge is completely described by now and may not be opened again.
NLEdgeControlBuilder & operator=(const NLEdgeControlBuilder &s)
invalidated assignment operator
virtual void addNeigh(const std::string id)
Adds a neighbor to the current lane.
MSEdgeVector myEdges
Temporary, internal storage for built edges.
MSEdge * myActiveEdge
pointer to the currently chosen edge
void updateCurrentLaneStopOffset(const StopOffset &stopOffset)
set the stopOffset for the last added lane.
NLEdgeControlBuilder(const NLEdgeControlBuilder &s)
invalidated copy constructor
void closeLane()
Closes the building of a lane; The edge is completely described by now and may not be opened again.
int myCurrentLaneIndex
The index of the currently active lane (-1 if none is active)
std::vector< std::pair< MSLane *, std::string > > myOppositeLanes
std::string reportCurrentEdgeOrLane() const
Return info about currently processed edge or lane.
int myCurrentNumericalLaneID
A running number for lane numbering.
void beginEdgeParsing(const std::string &id, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, int priority, const std::string &bidi, double distance)
Begins building of an MSEdge.
void setDefaultStopOffset(const StopOffset &stopOffset)
set the stopOffset for the last added lane.
virtual void addCrossingEdges(const std::vector< std::string > &)
add the crossingEdges in a crossing edge if present
void addStopOffsets(const StopOffset &stopOffsets)
process a stopOffset element (originates either from the active edge or lane).
virtual MSLane * addLane(const std::string &id, double maxSpeed, double friction, double length, const PositionVector &shape, double width, SVCPermissions permissions, SVCPermissions changeLeft, SVCPermissions changeRight, int index, bool isRampAccel, const std::string &type, const PositionVector &outlineShape)
Adds a lane to the current edge.
NLEdgeControlBuilder()
Constructor.
virtual MSEdge * buildEdge(const std::string &id, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, const int priority, const double distance)
Builds an edge instance (MSEdge in this case)
std::vector< MSLane * > * myLaneStorage
pointer to a temporary lane storage
int myCurrentNumericalEdgeID
A running number for edge numbering.
StopOffset myCurrentDefaultStopOffset
The default stop offset for all lanes belonging to the active edge (this is set if the edge was given...
virtual ~NLEdgeControlBuilder()
Destructor.
std::map< MSEdge *, std::string, ComparatorNumericalIdLess > myBidiEdges
temporary storage for bidi attributes (to be resolved after loading all edges)
MSEdgeControl * build(const MMVersion &networkVersion)
builds the MSEdgeControl-class which holds all edges
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
A list of positions.
stop offset