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-2019 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 
NIXMLEdgesHandler::addSplit
void addSplit(const SUMOSAXAttributes &attrs)
Parses a split and stores it in mySplits. Splits are executed Upon reading the end tag of an edge.
Definition: NIXMLEdgesHandler.cpp:401
NIXMLEdgesHandler
Importer for network edges stored in XML.
Definition: NIXMLEdgesHandler.h:65
NIXMLEdgesHandler::myEndElement
void myEndElement(int element)
Called when a closing tag occurs.
Definition: NIXMLEdgesHandler.cpp:561
NIXMLEdgesHandler::operator=
NIXMLEdgesHandler & operator=(const NIXMLEdgesHandler &s)
invalid assignment operator
NIXMLEdgesHandler::myIsUpdate
bool myIsUpdate
Whether this edge definition is an update of a previously inserted edge.
Definition: NIXMLEdgesHandler.h:194
NBEdgeCont
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
SUMOSAXHandler
SAX-handler base for SUMO-files.
Definition: SUMOSAXHandler.h:42
NIXMLEdgesHandler::myLastParameterised
std::vector< Parameterised * > myLastParameterised
element to receive parameters
Definition: NIXMLEdgesHandler.h:260
NBTrafficLightLogicCont
A container for traffic light definitions and built programs.
Definition: NBTrafficLightLogicCont.h:58
NIXMLEdgesHandler::split_by_pos_finder::split_by_pos_finder
split_by_pos_finder(double pos)
Constructor.
Definition: NIXMLEdgesHandler.h:233
NIXMLEdgesHandler::myEdgeCont
NBEdgeCont & myEdgeCont
The edges container (for insertion of build edges)
Definition: NIXMLEdgesHandler.h:204
NIXMLEdgesHandler::myCurrentSpeed
double myCurrentSpeed
The current edge's maximum speed.
Definition: NIXMLEdgesHandler.h:146
SUMOSAXHandler.h
NIXMLEdgesHandler::myOptions
OptionsCont & myOptions
A reference to the program's options.
Definition: NIXMLEdgesHandler.h:136
NBEdgeCont.h
NIXMLEdgesHandler::NIXMLEdgesHandler
NIXMLEdgesHandler(NBNodeCont &nc, NBEdgeCont &ec, NBTypeCont &tc, NBDistrictCont &dc, NBTrafficLightLogicCont &tlc, OptionsCont &options)
Constructor.
Definition: NIXMLEdgesHandler.cpp:56
NIXMLEdgesHandler::myTypeCont
NBTypeCont & myTypeCont
The types container (for retrieval of type defaults)
Definition: NIXMLEdgesHandler.h:207
NIXMLEdgesHandler::addEdge
void addEdge(const SUMOSAXAttributes &attrs)
Parses an edge and stores the values in "myCurrentEdge".
Definition: NIXMLEdgesHandler.cpp:156
PositionVector
A list of positions.
Definition: PositionVector.h:46
NBDistrictCont
A container for districts.
Definition: NBDistrictCont.h:53
NIXMLEdgesHandler::myReinitKeepEdgeShape
bool myReinitKeepEdgeShape
Whether the edge shape shall be kept at reinitilization.
Definition: NIXMLEdgesHandler.h:182
NBNodeCont
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:86
NIXMLEdgesHandler::split_by_pos_finder
Finds a split at the given position.
Definition: NIXMLEdgesHandler.h:230
NIXMLEdgesHandler::myCurrentEndOffset
double myCurrentEndOffset
The current edge's offset till the destination node.
Definition: NIXMLEdgesHandler.h:158
NIXMLEdgesHandler::myCurrentType
std::string myCurrentType
The current edge's type.
Definition: NIXMLEdgesHandler.h:164
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:219
SUMOVehicleClass.h
NIXMLEdgesHandler::myBikeLaneWidth
double myBikeLaneWidth
The width of the bike lane that shall be added to the current edge.
Definition: NIXMLEdgesHandler.h:188
NIXMLEdgesHandler::mySidewalkWidth
double mySidewalkWidth
The width of the sidewalk that shall be added to the current edge.
Definition: NIXMLEdgesHandler.h:185
NIXMLEdgesHandler::myShape
PositionVector myShape
The shape of the edge.
Definition: NIXMLEdgesHandler.h:173
NIXMLEdgesHandler::myHaveReportedAboutOverwriting
bool myHaveReportedAboutOverwriting
Information whether at least one edge's attributes were overwritten.
Definition: NIXMLEdgesHandler.h:249
NIXMLEdgesHandler::myNodeCont
NBNodeCont & myNodeCont
The nodes container (for retrieval of referenced nodes)
Definition: NIXMLEdgesHandler.h:201
NIXMLEdgesHandler::myTLLogicCont
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to (when invalidating tls because of splits)
Definition: NIXMLEdgesHandler.h:214
NIXMLEdgesHandler::myFromNode
NBNode * myFromNode
The nodes the edge starts and ends at.
Definition: NIXMLEdgesHandler.h:167
NIXMLEdgesHandler::split_by_pos_finder::myPosition
double myPosition
The position to search for.
Definition: NIXMLEdgesHandler.h:243
NIXMLEdgesHandler::myLength
double myLength
The current edge's length.
Definition: NIXMLEdgesHandler.h:170
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:90
NIXMLEdgesHandler::myCurrentEdge
NBEdge * myCurrentEdge
The currently processed edge.
Definition: NIXMLEdgesHandler.h:219
NIXMLEdgesHandler::~NIXMLEdgesHandler
~NIXMLEdgesHandler()
Destructor.
Definition: NIXMLEdgesHandler.cpp:78
NBEdgeCont::Split::pos
double pos
The position of this change.
Definition: NBEdgeCont.h:211
NIXMLEdgesHandler::split_by_pos_finder::operator()
bool operator()(const NBEdgeCont::Split &e)
Comparing operator.
Definition: NIXMLEdgesHandler.h:237
NIXMLEdgesHandler::myHaveWarnedAboutDeprecatedLaneId
bool myHaveWarnedAboutDeprecatedLaneId
Definition: NIXMLEdgesHandler.h:254
NIXMLEdgesHandler::myDistrictCont
NBDistrictCont & myDistrictCont
The districts container (needed if an edge must be split)
Definition: NIXMLEdgesHandler.h:210
NIXMLEdgesHandler::addLane
void addLane(const SUMOSAXAttributes &attrs)
Parses a lane and modifies myCurrentEdge according to the given attribures.
Definition: NIXMLEdgesHandler.cpp:331
NIXMLEdgesHandler::myToNode
NBNode * myToNode
Definition: NIXMLEdgesHandler.h:167
NIXMLEdgesHandler::setNodes
bool setNodes(const SUMOSAXAttributes &attrs)
Sets from/to node information of the currently parsed edge.
Definition: NIXMLEdgesHandler.cpp:468
NIXMLEdgesHandler::mySplits
std::vector< NBEdgeCont::Split > mySplits
The list of this edge's splits.
Definition: NIXMLEdgesHandler.h:225
NIXMLEdgesHandler::myCurrentWidth
double myCurrentWidth
The current edge's lane width.
Definition: NIXMLEdgesHandler.h:155
NIXMLEdgesHandler::myLanesSpread
LaneSpreadFunction myLanesSpread
Information about how to spread the lanes.
Definition: NIXMLEdgesHandler.h:176
NIXMLEdgesHandler::myPermissions
SVCPermissions myPermissions
Information about lane permissions.
Definition: NIXMLEdgesHandler.h:179
NIXMLEdgesHandler::deleteEdge
void deleteEdge(const SUMOSAXAttributes &attrs)
parses delete tag and deletes the specified edge or lane
Definition: NIXMLEdgesHandler.cpp:539
NBTypeCont
A storage for available types of edges.
Definition: NBTypeCont.h:55
NIXMLEdgesHandler::myKeepEdgeShape
const bool myKeepEdgeShape
Whether the edge shape shall be kept generally.
Definition: NIXMLEdgesHandler.h:257
NIXMLEdgesHandler::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: NIXMLEdgesHandler.cpp:82
NIXMLEdgesHandler::myCurrentLaneIndex
int myCurrentLaneIndex
The currently processed lane index.
Definition: NIXMLEdgesHandler.h:222
NIXMLEdgesHandler::myHaveReportedAboutTypeOverride
bool myHaveReportedAboutTypeOverride
Information whether at least one edge's type was changed.
Definition: NIXMLEdgesHandler.h:252
LaneSpreadFunction
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
Definition: SUMOXMLDefinitions.h:1092
NIXMLEdgesHandler::myCurrentStreetName
std::string myCurrentStreetName
The current edge's street name.
Definition: NIXMLEdgesHandler.h:161
config.h
NIXMLEdgesHandler::addRoundabout
void addRoundabout(const SUMOSAXAttributes &attrs)
Parses a roundabout and stores it in myEdgeCont.
Definition: NIXMLEdgesHandler.cpp:605
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:68
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:57
NBEdgeCont::Split
A structure which describes changes of lane number or speed along the road.
Definition: NBEdgeCont.h:206
NIXMLEdgesHandler::myCurrentLaneNo
int myCurrentLaneNo
The current edge's number of lanes.
Definition: NIXMLEdgesHandler.h:152
NIXMLEdgesHandler::tryGetShape
PositionVector tryGetShape(const SUMOSAXAttributes &attrs)
Tries to parse the shape definition.
Definition: NIXMLEdgesHandler.cpp:504
PositionVector.h
NIXMLEdgesHandler::myCurrentPriority
int myCurrentPriority
The current edge's priority.
Definition: NIXMLEdgesHandler.h:149
NIXMLEdgesHandler::tryGetLaneSpread
LaneSpreadFunction tryGetLaneSpread(const SUMOSAXAttributes &attrs)
Tries to parse the spread type.
Definition: NIXMLEdgesHandler.cpp:524
NBEdge.h
NIXMLEdgesHandler::myCurrentID
std::string myCurrentID
The current edge's id.
Definition: NIXMLEdgesHandler.h:143