SUMO - Simulation of Urban MObility
NIImporter_ITSUMO.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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // Importer for networks stored in ITSUMO format
18 /****************************************************************************/
19 #ifndef NIImporter_ITSUMO_h
20 #define NIImporter_ITSUMO_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <string>
33 #include <map>
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
42 class NBEdge;
43 class NBEdgeCont;
44 class NBNetBuilder;
45 class NBNode;
46 class NBNodeCont;
48 class NBTypeCont;
49 class OptionsCont;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
61 public:
73  static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
74 
75 
76 private:
81  class Handler : public GenericSAXHandler {
82  public:
86  Handler(NBNetBuilder& toFill);
87 
88 
90  ~Handler();
91 
92 
93  protected:
95 
96 
104  void myStartElement(int element, const SUMOSAXAttributes& attrs);
105 
106 
115  void myCharacters(int element, const std::string& chars);
116 
117 
124  void myEndElement(int element);
126 
127 
128  private:
131 
133  std::map<std::string, std::string> myParameter;
134 
135 
136  struct Lane {
137  public:
138  Lane(const std::string& _id, int _idx, double _v)
139  : id(_id), index(_idx), v(_v) {}
140  std::string id;
141  int index;
142  double v;
143  };
144 
145  std::vector<Lane> myCurrentLanes;
146 
147  struct LaneSet {
148  public:
149  LaneSet(const std::string& _id, const std::vector<Lane>& _lanes, double _v, int _pos, NBNode* _from, NBNode* _to)
150  : id(_id), lanes(_lanes), v(_v), position(_pos), from(_from), to(_to) {}
151  std::string id;
152  std::vector<Lane> lanes;
153  double v;
154  int position;
157  };
158 
159  std::map<std::string, LaneSet*> myLaneSets;
160  std::vector<LaneSet*> myCurrentLaneSets;
161 
162  struct Section {
163  public:
164  Section(const std::string& _id, const std::vector<LaneSet*>& _laneSets)
165  : id(_id), laneSets(_laneSets) {}
166  std::string id;
167  std::vector<LaneSet*> laneSets;
168  };
169 
170  std::vector<Section*> mySections;
171 
172 
173  private:
175  Handler(const Handler& s);
176 
178  Handler& operator=(const Handler& s);
179 
180  };
181 
182 
183 
229  };
230 
231 
239  };
240 
243 
246 
247 
248 };
249 
250 
251 #endif
252 
253 /****************************************************************************/
254 
Lane(const std::string &_id, int _idx, double _v)
std::vector< Section * > mySections
A container for traffic light definitions and built programs.
std::vector< Lane > myCurrentLanes
The representation of a single edge during network building.
Definition: NBEdge.h:70
Handler & operator=(const Handler &s)
invalidated assignment operator
LaneSet(const std::string &_id, const std::vector< Lane > &_lanes, double _v, int _pos, NBNode *_from, NBNode *_to)
std::vector< LaneSet * > myCurrentLaneSets
static StringBijection< int >::Entry itsumoAttrs[]
The names of MATSIM-XML attributes (for passing to GenericSAXHandler)
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
A handler which converts occuring elements and attributes into enums.
ItsumoXMLTag
Numbers representing ITSUMO-XML - element names.
static StringBijection< int >::Entry itsumoTags[]
The names of MATSIM-XML elements (for passing to GenericSAXHandler)
Section(const std::string &_id, const std::vector< LaneSet *> &_laneSets)
Encapsulated SAX-Attributes.
void myCharacters(int element, const std::string &chars)
Callback method for characters to implement by derived classes.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
std::map< std::string, std::string > myParameter
A temporary parameter map.
Importer for networks stored in ITSUMO format.
Instance responsible for building networks.
Definition: NBNetBuilder.h:115
A storage for options typed value containers)
Definition: OptionsCont.h:98
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given ITSUMO network files.
Represents a single node (junction) during network building.
Definition: NBNode.h:74
ItsumoXMLAttr
Numbers representing MATSIM-XML - attributes.
NBNetBuilder & myNetBuilder
The container to fill.
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:66
std::map< std::string, LaneSet * > myLaneSets
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Handler(NBNetBuilder &toFill)
Contructor.
A storage for available types of edges.
Definition: NBTypeCont.h:61