Eclipse SUMO - Simulation of Urban MObility
RONetHandler.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 /****************************************************************************/
20 // The handler that parses a SUMO-network for its usage in a router
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <string>
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class RONet;
35 class OptionsCont;
36 class ROEdge;
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
50 class RONetHandler : public SUMOSAXHandler {
51 public:
57  RONetHandler(RONet& net, ROAbstractEdgeBuilder& eb, const bool ignoreInternal, const double minorPenalty, double tlsPenalty);
58 
59 
61  virtual ~RONetHandler();
62 
64  const std::map<ROEdge*, std::string>& getBidiMap() const {
65  return myBidiEdges;
66  }
67 
68 protected:
70 
71 
79  virtual void myStartElement(int element, const SUMOSAXAttributes& attrs);
80 
87  virtual void myEndElement(int element);
89 
90 protected:
92 
93 
95  void addParam(const SUMOSAXAttributes& attrs);
96 
108  void parseEdge(const SUMOSAXAttributes& attrs);
109 
110 
119  virtual void parseLane(const SUMOSAXAttributes& attrs);
120 
121 
130  void parseJunction(const SUMOSAXAttributes& attrs);
131 
132 
137  void parseConnection(const SUMOSAXAttributes& attrs);
138 
139 
145  void parseStoppingPlace(const SUMOSAXAttributes& attrs, const SumoXMLTag element);
146 
147 
152  void parseAccess(const SUMOSAXAttributes& attrs);
153 
154 
164  void parseDistrict(const SUMOSAXAttributes& attrs);
165 
166 
178  void parseDistrictEdge(const SUMOSAXAttributes& attrs, bool isSource);
179 
181 
183  void setLocation(const SUMOSAXAttributes& attrs);
184 
185 protected:
188 
191 
194 
196  const bool myIgnoreInternal;
197 
199  std::string myCurrentName;
200 
202  std::string myCurrentTypeID;
203 
206 
209 
211  std::set<std::string> myUnseenNodeIDs;
212 
214  const double myMinorPenalty;
215  const double myTLSPenalty;
216 
218  std::map<ROEdge*, std::string> myBidiEdges;
219 
220 private:
223 
226 
227 };
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::pair< int, double > MMVersion
(M)ajor/(M)inor version for written networks and default version for loading
Definition: StdDefs.h:67
A storage for options typed value containers)
Definition: OptionsCont.h:89
Interface for building instances of router-edges.
A basic edge for routing applications.
Definition: ROEdge.h:70
The handler that parses a SUMO-network for its usage in a router.
Definition: RONetHandler.h:50
RONetHandler(const RONetHandler &src)
Invalidated copy constructor.
void parseAccess(const SUMOSAXAttributes &attrs)
const double myMinorPenalty
time penalty for passing a minor link
Definition: RONetHandler.h:214
virtual void myEndElement(int element)
Called when a closing tag occurs.
MMVersion myNetworkVersion
the loaded network version
Definition: RONetHandler.h:190
virtual ~RONetHandler()
Destructor.
void parseEdge(const SUMOSAXAttributes &attrs)
Parses and builds an edge.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
std::string myCurrentName
The name of the edge/node that is currently processed.
Definition: RONetHandler.h:199
const double myTLSPenalty
Definition: RONetHandler.h:215
void addParam(const SUMOSAXAttributes &attrs)
assign arbitrary vehicle parameters
ROEdge * myCurrentEdge
The currently built edge.
Definition: RONetHandler.h:205
RONetHandler & operator=(const RONetHandler &src)
Invalidated assignment operator.
std::string myCurrentTypeID
The id of the currently processed edge type.
Definition: RONetHandler.h:202
void parseStoppingPlace(const SUMOSAXAttributes &attrs, const SumoXMLTag element)
const bool myIgnoreInternal
whether to ignore junction internal edges
Definition: RONetHandler.h:196
void parseConnection(const SUMOSAXAttributes &attrs)
std::map< ROEdge *, std::string > myBidiEdges
temporary storage for bidi attributes (to be resolved after loading all edges)
Definition: RONetHandler.h:218
ROAbstractEdgeBuilder & myEdgeBuilder
The object used to build of edges of the desired type.
Definition: RONetHandler.h:193
virtual void parseLane(const SUMOSAXAttributes &attrs)
Parses and builds a lane.
SUMOVehicleParameter::Stop * myCurrentStoppingPlace
The currently built stopping place.
Definition: RONetHandler.h:208
RONet & myNet
The net to store the information into.
Definition: RONetHandler.h:187
RONetHandler(RONet &net, ROAbstractEdgeBuilder &eb, const bool ignoreInternal, const double minorPenalty, double tlsPenalty)
Constructor.
const std::map< ROEdge *, std::string > & getBidiMap() const
retrieve mapping of edges to bidi edges (must be resolved after loading network)
Definition: RONetHandler.h:64
void parseDistrict(const SUMOSAXAttributes &attrs)
void parseJunction(const SUMOSAXAttributes &attrs)
Parses a junction's position.
void parseDistrictEdge(const SUMOSAXAttributes &attrs, bool isSource)
std::set< std::string > myUnseenNodeIDs
temporary data for checking node initialisation after network parsing is finished
Definition: RONetHandler.h:211
void setLocation(const SUMOSAXAttributes &attrs)
Parses network location description.
The router's network representation.
Definition: RONet.h:62
Encapsulated SAX-Attributes.
SAX-handler base for SUMO-files.
Definition of vehicle stop (position and duration)