SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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.sourceforge.net/
10 // Copyright (C) 2001-2012 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  : myID(id), myIndex(idx), myV(v) {}
141  std::string myID;
142  unsigned int myIndex;
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  : myID(id), myLanes(lanes), myV(v), myPosition(pos), myFrom(from), myTo(to) {}
152  std::string myID;
153  std::vector<Lane> myLanes;
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  : myID(id), myLaneSets(laneSets) {}
167  std::string myID;
168  std::vector<LaneSet*> myLaneSets;
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