SUMO - Simulation of Urban MObility
NIXMLEdgesHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Importer for network edges stored in XML
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef NIXMLEdgesHandler_h
23 #define NIXMLEdgesHandler_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
38 #include <netbuild/NBEdge.h>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class OptionsCont;
45 class NBNode;
46 class NBEdge;
47 class NBNodeCont;
48 class NBEdgeCont;
49 class NBTypeCont;
50 class NBDistrictCont;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
72 public:
81  NBTypeCont& tc, NBDistrictCont& dc,
83  OptionsCont& options);
84 
85 
88 
89 protected:
91 
92 
100  void myStartElement(int element,
101  const SUMOSAXAttributes& attrs);
102 
103 
110  void myEndElement(int element);
112 
113 
114 private:
123 
124 
128 
129 
137  bool setNodes(const SUMOSAXAttributes& attrs);
138 
139 
140 private:
143 
144 
147 
149  std::string myCurrentID;
150 
153 
156 
159 
162 
165 
167  std::string myCurrentStreetName;
168 
170  std::string myCurrentType;
171 
174 
176  double myLength;
177 
180 
183 
186 
189 
192 
195 
197 
198 
201 
202 
205 
208 
211 
214 
217 
222 
223 
226 
230  struct Split {
232  std::vector<int> lanes;
234  double pos;
236  double speed;
240  std::string idBefore;
242  std::string idAfter;
243  };
244 
246  std::vector<Split> mySplits;
247 
248 
252  class split_sorter {
253  public:
255  explicit split_sorter() { }
256 
258  int operator()(const Split& e1, const Split& e2) const {
259  return e1.pos < e2.pos;
260  }
261  };
262 
263 
268  public:
270  explicit split_by_pos_finder(double pos)
271  : myPosition(pos) { }
272 
274  bool operator()(const Split& e) {
275  return e.pos == myPosition;
276  }
277 
278  private:
280  double myPosition;
281 
282  };
283 
284 
287 
290 
292 
294  const bool myKeepEdgeShape;
295 
296 
297 private:
298 
302  void addEdge(const SUMOSAXAttributes& attrs);
303 
307  void deleteEdge(const SUMOSAXAttributes& attrs);
308 
313  void addLane(const SUMOSAXAttributes& attrs);
314 
319  void addSplit(const SUMOSAXAttributes& attrs);
320 
324  void addRoundabout(const SUMOSAXAttributes& attrs);
325 
326 
327 private:
330 
333 
334 };
335 
336 
337 #endif
338 
339 /****************************************************************************/
340 
Importer for network edges stored in XML.
LaneSpreadFunction myLanesSpread
Information about how to spread the lanes.
Finds a split at the given position.
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:71
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.
int operator()(const Split &e1, const Split &e2) const
Comparing operator.
NIXMLEdgesHandler & operator=(const NIXMLEdgesHandler &s)
invalid assignment operator
bool operator()(const Split &e)
Comparing 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.
std::vector< Split > mySplits
The list of this edge&#39;s splits.
bool myHaveWarnedAboutDeprecatedLaneId
Encapsulated SAX-Attributes.
void deleteEdge(const SUMOSAXAttributes &attrs)
parses delete tag and deletes the specified edge or lane
A structure which describes changes of lane number or speed along the road.
A list of positions.
double pos
The position of this change.
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:66
std::vector< int > lanes
The lanes after this change.
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) ...
Sorts splits by their position (increasing)
LaneSpreadFunction tryGetLaneSpread(const SUMOSAXAttributes &attrs)
Tries to parse the spread type.
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.
std::string idAfter
The id for the edge after the split.
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:99
NBEdge * myCurrentEdge
The currently processed edge.
OptionsCont & myOptions
A reference to the program&#39;s options.
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...
double speed
The speed after this change.
NBTypeCont & myTypeCont
The types container (for retrieval of type defaults)
Represents a single node (junction) during network building.
Definition: NBNode.h:75
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:63
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.
std::string idBefore
The id for the edge before the split.
void addLane(const SUMOSAXAttributes &attrs)
Parses a lane and modifies myCurrentEdge according to the given attribures.
int myCurrentPriority
The current edge&#39;s priority.
NBNode * node
The new node that is created for this split.
split_by_pos_finder(double pos)
Constructor.
A storage for available types of edges.
Definition: NBTypeCont.h:62
PositionVector tryGetShape(const SUMOSAXAttributes &attrs)
Tries to parse the shape definition.