Eclipse SUMO - Simulation of Urban MObility
NIXMLEdgesHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 // Importer for network edges stored in XML
22 /****************************************************************************/
23 #pragma once
24 #include <config.h>
25 
29 #include <netbuild/NBEdge.h>
30 #include <netbuild/NBEdgeCont.h>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class OptionsCont;
37 class NBNode;
38 class NBEdge;
39 class NBNodeCont;
40 class NBTypeCont;
41 class NBDistrictCont;
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
63 public:
72  NBTypeCont& tc, NBDistrictCont& dc,
74  OptionsCont& options);
75 
76 
79 
80 protected:
82 
83 
91  void myStartElement(int element,
92  const SUMOSAXAttributes& attrs);
93 
94 
101  void myEndElement(int element);
103 
104 
105 private:
114 
115 
119 
120 
128  bool setNodes(const SUMOSAXAttributes& attrs);
129 
130 
131 private:
134 
135 
138 
140  std::string myCurrentID;
141 
144 
147 
150 
153 
156 
158  std::string myCurrentStreetName;
159 
161  std::string myCurrentType;
162 
165 
167  double myLength;
168 
171 
174 
177 
180 
183 
186 
188 
189 
192 
193 
196 
199 
202 
205 
208 
213 
214 
217 
220 
222  std::vector<NBEdgeCont::Split> mySplits;
223 
228  public:
230  explicit split_by_pos_finder(double pos)
231  : myPosition(pos) { }
232 
234  bool operator()(const NBEdgeCont::Split& e) {
235  return e.pos == myPosition;
236  }
237 
238  private:
240  double myPosition;
241 
242  };
243 
244 
247 
250 
252 
254  const bool myKeepEdgeShape;
255 
257  std::vector<Parameterised*> myLastParameterised;
258 
259 private:
260 
264  void addEdge(const SUMOSAXAttributes& attrs);
265 
269  void deleteEdge(const SUMOSAXAttributes& attrs);
270 
275  void addLane(const SUMOSAXAttributes& attrs);
276 
281  void addSplit(const SUMOSAXAttributes& attrs);
282 
286  void addRoundabout(const SUMOSAXAttributes& attrs);
287 
288 
289 private:
292 
295 
296 };
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
A container for districts.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:59
The representation of a single edge during network building.
Definition: NBEdge.h:91
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:58
Represents a single node (junction) during network building.
Definition: NBNode.h:66
A container for traffic light definitions and built programs.
A storage for available edgeTypes of edges.
Definition: NBTypeCont.h:52
Finds a split at the given position.
bool operator()(const NBEdgeCont::Split &e)
Comparing operator.
double myPosition
The position to search for.
split_by_pos_finder(double pos)
Constructor.
Importer for network edges stored in XML.
std::string myCurrentID
The current edge's id.
SVCPermissions myPermissions
Information about lane permissions.
bool setNodes(const SUMOSAXAttributes &attrs)
Sets from/to node information of the currently parsed edge.
PositionVector myShape
The shape of the edge.
std::string myCurrentStreetName
The current edge's street name.
LaneSpreadFunction tryGetLaneSpread(const SUMOSAXAttributes &attrs)
Tries to parse the spread type.
double myCurrentSpeed
The current edge's maximum speed.
double myBikeLaneWidth
The width of the bike lane that shall be added to the current edge.
~NIXMLEdgesHandler()
Destructor.
int myCurrentLaneNo
The current edge's number of lanes.
OptionsCont & myOptions
A reference to the program's options.
void addRoundabout(const SUMOSAXAttributes &attrs)
Parses a roundabout and stores it in myEdgeCont.
double myCurrentWidth
The current edge's lane width.
NIXMLEdgesHandler(NBNodeCont &nc, NBEdgeCont &ec, NBTypeCont &tc, NBDistrictCont &dc, NBTrafficLightLogicCont &tlc, OptionsCont &options)
Constructor.
NBTypeCont & myTypeCont
The types container (for retrieval of type defaults)
double myCurrentEndOffset
The current edge's offset till the destination node.
double myLength
The current edge's length.
int myCurrentPriority
The current edge's priority.
NBNodeCont & myNodeCont
The nodes container (for retrieval of referenced nodes)
PositionVector tryGetShape(const SUMOSAXAttributes &attrs)
Tries to parse the shape definition.
bool myIsUpdate
Whether this edge definition is an update of a previously inserted edge.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
LaneSpreadFunction myLanesSpread
Information about how to spread the lanes.
NBDistrictCont & myDistrictCont
The districts container (needed if an edge must be split)
std::vector< Parameterised * > myLastParameterised
element to receive parameters
NBEdgeCont & myEdgeCont
The edges container (for insertion of build edges)
double mySidewalkWidth
The width of the sidewalk that shall be added to the current edge.
bool myHaveWarnedAboutDeprecatedLaneId
void addSplit(const SUMOSAXAttributes &attrs)
Parses a split and stores it in mySplits. Splits are executed Upon reading the end tag of an edge.
std::string myCurrentType
The current edge's type.
NBEdge * myCurrentEdge
The currently processed edge.
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to (when invalidating tls because of splits)
std::vector< NBEdgeCont::Split > mySplits
The list of this edge's splits.
int myCurrentLaneIndex
The currently processed lane index.
bool myHaveReportedAboutTypeOverride
Information whether at least one edge's type was changed.
NIXMLEdgesHandler(const NIXMLEdgesHandler &s)
invalid copy constructor
NBNode * myFromNode
The nodes the edge starts and ends at.
NIXMLEdgesHandler & operator=(const NIXMLEdgesHandler &s)
invalid assignment operator
void addLane(const SUMOSAXAttributes &attrs)
Parses a lane and modifies myCurrentEdge according to the given attribures.
void myEndElement(int element)
Called when a closing tag occurs.
const bool myKeepEdgeShape
Whether the edge shape shall be kept generally.
bool myHaveReportedAboutOverwriting
Information whether at least one edge's attributes were overwritten.
void deleteEdge(const SUMOSAXAttributes &attrs)
parses delete tag and deletes the specified edge or lane
bool myReinitKeepEdgeShape
Whether the edge shape shall be kept at reinitilization.
void addEdge(const SUMOSAXAttributes &attrs)
Parses an edge and stores the values in "myCurrentEdge".
A storage for options typed value containers)
Definition: OptionsCont.h:89
A list of positions.
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.
A structure which describes changes of lane number or speed along the road.
Definition: NBEdgeCont.h:204
double pos
The position of this change.
Definition: NBEdgeCont.h:208