SUMO - Simulation of Urban MObility
NIImporter_ITSUMO.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // Importer for networks stored in ITSUMO format
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef NIImporter_ITSUMO_h
21 #define NIImporter_ITSUMO_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <map>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class NBEdge;
44 class NBEdgeCont;
45 class NBNetBuilder;
46 class NBNode;
47 class NBNodeCont;
49 class NBTypeCont;
50 class OptionsCont;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
62 public:
74  static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
75 
76 
77 private:
82  class Handler : public GenericSAXHandler {
83  public:
87  Handler(NBNetBuilder& toFill);
88 
89 
91  ~Handler();
92 
93 
94  protected:
96 
97 
105  void myStartElement(int element, const SUMOSAXAttributes& attrs);
106 
107 
116  void myCharacters(int element, const std::string& chars);
117 
118 
125  void myEndElement(int element);
127 
128 
129  private:
132 
134  std::map<std::string, std::string> myParameter;
135 
136 
137  struct Lane {
138  public:
139  Lane(const std::string& _id, unsigned int _idx, SUMOReal _v)
140  : id(_id), index(_idx), v(_v) {}
141  std::string id;
142  unsigned int index;
144  };
145 
146  std::vector<Lane> myCurrentLanes;
147 
148  struct LaneSet {
149  public:
150  LaneSet(const std::string& _id, const std::vector<Lane>& _lanes, SUMOReal _v, int _pos, NBNode* _from, NBNode* _to)
151  : id(_id), lanes(_lanes), v(_v), position(_pos), from(_from), to(_to) {}
152  std::string id;
153  std::vector<Lane> lanes;
155  int position;
158  };
159 
160  std::map<std::string, LaneSet*> myLaneSets;
161  std::vector<LaneSet*> myCurrentLaneSets;
162 
163  struct Section {
164  public:
165  Section(const std::string& _id, const std::vector<LaneSet*>& _laneSets)
166  : id(_id), laneSets(_laneSets) {}
167  std::string id;
168  std::vector<LaneSet*> laneSets;
169  };
170 
171  std::vector<Section*> mySections;
172 
173 
174  private:
176  Handler(const Handler& s);
177 
179  Handler& operator=(const Handler& s);
180 
181  };
182 
183 
184 
230  };
231 
232 
240  };
241 
244 
247 
248 
249 };
250 
251 
252 #endif
253 
254 /****************************************************************************/
255 
Lane(const std::string &_id, unsigned int _idx, SUMOReal _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:71
Handler & operator=(const Handler &s)
invalidated assignment operator
std::vector< LaneSet * > myCurrentLaneSets
static StringBijection< int >::Entry itsumoAttrs[]
The names of MATSIM-XML attributes (for passing to GenericSAXHandler)
Section(const std::string &_id, const std::vector< LaneSet * > &_laneSets)
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)
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.
LaneSet(const std::string &_id, const std::vector< Lane > &_lanes, SUMOReal _v, int _pos, NBNode *_from, NBNode *_to)
Instance responsible for building networks.
Definition: NBNetBuilder.h:113
A storage for options typed value containers)
Definition: OptionsCont.h:108
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:75
ItsumoXMLAttr
Numbers representing MATSIM-XML - attributes.
#define SUMOReal
Definition: config.h:218
NBNetBuilder & myNetBuilder
The container to fill.
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:64
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:56