SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PCLoaderOSM.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A reader of pois and polygons stored in OSM-format
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 PCLoaderOSM_h
23 #define PCLoaderOSM_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 
35 #include <string>
36 #include "PCPolyContainer.h"
37 #include "PCTypeMap.h"
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
44 class OptionsCont;
45 
46 
47 // ===========================================================================
48 // class declarations
49 // ===========================================================================
56 class PCLoaderOSM : public SUMOSAXHandler {
57 public:
69  static void loadIfSet(OptionsCont& oc, PCPolyContainer& toFill,
70  PCTypeMap& tm);
71 
72 
73 protected:
76  struct PCOSMNode {
84  std::string myType;
87  };
88 
89 
92  struct PCOSMEdge {
94  std::string id;
96  std::string name;
98  std::string myType;
102  std::vector<SUMOLong> myCurrentNodes;
105  };
106 
107 
108 protected:
113  class NodesHandler : public SUMOSAXHandler {
114  public:
118  NodesHandler(std::map<SUMOLong, PCOSMNode*>& toFill);
119 
120 
122  ~NodesHandler();
123 
124 
125  protected:
127 
128 
136  void myStartElement(int element, const SUMOSAXAttributes& attrs);
137 
138 
145  void myEndElement(int element);
147 
148 
149  private:
151  std::map<SUMOLong, PCOSMNode*>& myToFill;
152 
154  std::vector<int> myParentElements;
155 
158 
159 
160  private:
162  NodesHandler(const NodesHandler& s);
163 
166 
167  };
168 
169 
170 
175  class EdgesHandler : public SUMOSAXHandler {
176  public:
182  EdgesHandler(const std::map<SUMOLong, PCOSMNode*>& osmNodes,
183  std::map<std::string, PCOSMEdge*>& toFill);
184 
185 
187  ~EdgesHandler();
188 
189 
190  protected:
192 
193 
201  void myStartElement(int element, const SUMOSAXAttributes& attrs);
202 
203 
210  void myEndElement(int element);
212 
213 
214  private:
216  const std::map<SUMOLong, PCOSMNode*>& myOSMNodes;
217 
219  std::map<std::string, PCOSMEdge*>& myEdgeMap;
220 
223 
225  std::vector<int> myParentElements;
226 
227 
228  private:
230  EdgesHandler(const EdgesHandler& s);
231 
234 
235  };
236 
237 
238 };
239 
240 
241 #endif
242 
243 /****************************************************************************/
244