SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NIXMLEdgesHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Importer for network edges stored in XML
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef NIXMLEdgesHandler_h
23 #define NIXMLEdgesHandler_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
38 #include <netbuild/NBEdge.h>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class OptionsCont;
45 class NBNode;
46 class NBEdge;
47 class NBNodeCont;
48 class NBEdgeCont;
49 class NBTypeCont;
50 class NBDistrictCont;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
72 public:
81  NBTypeCont& tc, NBDistrictCont& dc, OptionsCont& options) ;
82 
83 
86 
87 
88 protected:
90 
91 
99  void myStartElement(int element,
100  const SUMOSAXAttributes& attrs) ;
101 
102 
109  void myEndElement(int element) ;
111 
112 
113 private:
122 
123 
127 
128 
136  bool setNodes(const SUMOSAXAttributes& attrs) ;
137 
138 
142  const std::string& attrName);
143 
144 
145  NBNode* insertNodeChecking(const Position& pos,
146  const std::string& name, const std::string& dir);
147 
148 
149 private:
152 
153 
156 
158  std::string myCurrentID;
159 
162 
165 
168 
171 
174 
176  std::string myCurrentStreetName;
177 
179  std::string myCurrentType;
180 
183 
186 
189 
192 
195 
197 
198 
201 
204 
205 
208 
211 
214 
217 
221 
222 
226  struct Split {
228  std::vector<int> lanes;
232  int nameid;
235  };
236 
238  std::vector<Split> mySplits;
239 
240 
244  class split_sorter {
245  public:
247  explicit split_sorter() { }
248 
250  int operator()(const Split& e1, const Split& e2) const {
251  return e1.pos < e2.pos;
252  }
253  };
254 
255 
260  public:
263  : myPosition(pos) { }
264 
266  bool operator()(const Split& e) {
267  return e.pos == myPosition;
268  }
269 
270  private:
273 
274  };
275 
276 
279 
282 
283 
284 private:
285 
289  void addEdge(const SUMOSAXAttributes& attrs);
290 
294  void deleteEdge(const SUMOSAXAttributes& attrs);
295 
300  void addLane(const SUMOSAXAttributes& attrs);
301 
306  void addSplit(const SUMOSAXAttributes& attrs);
307 
308 private:
311 
314 
315 };
316 
317 
318 #endif
319 
320 /****************************************************************************/
321