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-2018 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 /****************************************************************************/
18 // Importer for network edges stored in XML
19 /****************************************************************************/
20 #ifndef NIXMLEdgesHandler_h
21 #define NIXMLEdgesHandler_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
32 #include <netbuild/NBEdge.h>
33 #include <netbuild/NBEdgeCont.h>
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class OptionsCont;
40 class NBNode;
41 class NBEdge;
42 class NBNodeCont;
43 class NBTypeCont;
44 class NBDistrictCont;
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
66 public:
75  NBTypeCont& tc, NBDistrictCont& dc,
77  OptionsCont& options);
78 
79 
82 
83 protected:
85 
86 
94  void myStartElement(int element,
95  const SUMOSAXAttributes& attrs);
96 
97 
104  void myEndElement(int element);
106 
107 
108 private:
117 
118 
122 
123 
131  bool setNodes(const SUMOSAXAttributes& attrs);
132 
133 
134 private:
137 
138 
141 
143  std::string myCurrentID;
144 
147 
150 
153 
156 
159 
161  std::string myCurrentStreetName;
162 
164  std::string myCurrentType;
165 
168 
170  double myLength;
171 
174 
177 
180 
183 
186 
189 
191 
192 
195 
196 
199 
202 
205 
208 
211 
216 
217 
220 
223 
225  std::vector<NBEdgeCont::Split> mySplits;
226 
231  public:
233  explicit split_by_pos_finder(double pos)
234  : myPosition(pos) { }
235 
237  bool operator()(const NBEdgeCont::Split& e) {
238  return e.pos == myPosition;
239  }
240 
241  private:
243  double myPosition;
244 
245  };
246 
247 
250 
253 
255 
257  const bool myKeepEdgeShape;
258 
260  std::vector<Parameterised*> myLastParameterised;
261 
262 private:
263 
267  void addEdge(const SUMOSAXAttributes& attrs);
268 
272  void deleteEdge(const SUMOSAXAttributes& attrs);
273 
278  void addLane(const SUMOSAXAttributes& attrs);
279 
284  void addSplit(const SUMOSAXAttributes& attrs);
285 
289  void addRoundabout(const SUMOSAXAttributes& attrs);
290 
291 
292 private:
295 
298 
299 };
300 
301 
302 #endif
303 
304 /****************************************************************************/
305 
Importer for network edges stored in XML.
LaneSpreadFunction myLanesSpread
Information about how to spread the lanes.
Finds a split at the given position.
A structure which describes changes of lane number or speed along the road.
Definition: NBEdgeCont.h:206
std::string myCurrentID
The current edge&#39;s id.
PositionVector myShape
The shape of the edge.
A container for traffic light definitions and built programs.
void addRoundabout(const SUMOSAXAttributes &attrs)
Parses a roundabout and stores it in myEdgeCont.
bool setNodes(const SUMOSAXAttributes &attrs)
Sets from/to node information of the currently parsed edge.
double myCurrentSpeed
The current edge&#39;s maximum speed.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
The representation of a single edge during network building.
Definition: NBEdge.h:65
NBNode * myFromNode
The nodes the edge starts and ends at.
A container for districts.
NIXMLEdgesHandler(NBNodeCont &nc, NBEdgeCont &ec, NBTypeCont &tc, NBDistrictCont &dc, NBTrafficLightLogicCont &tlc, OptionsCont &options)
Constructor.
bool myHaveReportedAboutOverwriting
Information whether at least one edge&#39;s attributes were overwritten.
NBDistrictCont & myDistrictCont
The districts container (needed if an edge must be split)
SAX-handler base for SUMO-files.
std::vector< Parameterised * > myLastParameterised
element to receive parameters
NIXMLEdgesHandler & operator=(const NIXMLEdgesHandler &s)
invalid assignment operator
const bool myKeepEdgeShape
Whether the edge shape shall be kept generally.
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".
~NIXMLEdgesHandler()
Destructor.
double pos
The position of this change.
Definition: NBEdgeCont.h:211
bool myHaveWarnedAboutDeprecatedLaneId
Encapsulated SAX-Attributes.
void deleteEdge(const SUMOSAXAttributes &attrs)
parses delete tag and deletes the specified edge or lane
A list of positions.
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&#39;s type.
double myLength
The current edge&#39;s length.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
double myCurrentEndOffset
The current edge&#39;s offset till the destination node.
NBNodeCont & myNodeCont
The nodes container (for retrieval of referenced nodes)
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to (when invalidating tls because of splits) ...
LaneSpreadFunction tryGetLaneSpread(const SUMOSAXAttributes &attrs)
Tries to parse the spread type.
int myCurrentLaneIndex
The currently processed lane index.
double myBikeLaneWidth
The width of the bike lane that shall be added to the current edge.
double myPosition
The position to search for.
SVCPermissions myPermissions
Information about lane permissions.
bool myIsUpdate
Whether this edge definition is an update of a previously inserted edge.
void myEndElement(int element)
Called when a closing tag occurs.
A storage for options typed value containers)
Definition: OptionsCont.h:92
NBEdge * myCurrentEdge
The currently processed edge.
OptionsCont & myOptions
A reference to the program&#39;s options.
bool operator()(const NBEdgeCont::Split &e)
Comparing operator.
double myCurrentWidth
The current edge&#39;s lane width.
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge&#39;s lateral offset shal...
NBTypeCont & myTypeCont
The types container (for retrieval of type defaults)
Represents a single node (junction) during network building.
Definition: NBNode.h:68
bool myHaveReportedAboutTypeOverride
Information whether at least one edge&#39;s type was changed.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NBEdgeCont & myEdgeCont
The edges container (for insertion of build edges)
int myCurrentLaneNo
The current edge&#39;s number of lanes.
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
std::string myCurrentStreetName
The current edge&#39;s street name.
double mySidewalkWidth
The width of the sidewalk that shall be added to the current edge.
void addLane(const SUMOSAXAttributes &attrs)
Parses a lane and modifies myCurrentEdge according to the given attribures.
int myCurrentPriority
The current edge&#39;s priority.
std::vector< NBEdgeCont::Split > mySplits
The list of this edge&#39;s splits.
split_by_pos_finder(double pos)
Constructor.
A storage for available types of edges.
Definition: NBTypeCont.h:55
PositionVector tryGetShape(const SUMOSAXAttributes &attrs)
Tries to parse the shape definition.