PCLoaderOSM.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A reader of pois and polygons stored in OSM-format
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef PCLoaderOSM_h
00020 #define PCLoaderOSM_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <string>
00033 #include "PCPolyContainer.h"
00034 #include "PCTypeMap.h"
00035 #include <utils/xml/SUMOSAXHandler.h>
00036 
00037 
00038 // ===========================================================================
00039 // class definitions
00040 // ===========================================================================
00041 class OptionsCont;
00042 
00043 
00044 // ===========================================================================
00045 // class declarations
00046 // ===========================================================================
00053 class PCLoaderOSM : public SUMOSAXHandler {
00054 public:
00066     static void loadIfSet(OptionsCont &oc, PCPolyContainer &toFill,
00067                           PCTypeMap &tm) throw(ProcessError);
00068 
00069 
00070 protected:
00073     struct PCOSMNode {
00075         int id;
00077         SUMOReal lon;
00079         SUMOReal lat;
00081         std::string myType;
00083         bool myIsAdditional;
00084     };
00085 
00086 
00089     struct PCOSMEdge {
00091         std::string id;
00093         std::string myType;
00095         bool myIsClosed;
00097         std::vector<int> myCurrentNodes;
00099         bool myIsAdditional;
00100     };
00101 
00102 
00103 protected:
00108     class NodesHandler : public SUMOSAXHandler {
00109     public:
00113         NodesHandler(std::map<int, PCOSMNode*> &toFill) throw();
00114 
00115 
00117         ~NodesHandler() throw();
00118 
00119 
00120     protected:
00122 
00123 
00131         void myStartElement(SumoXMLTag element, const SUMOSAXAttributes &attrs) throw(ProcessError);
00132 
00133 
00140         void myEndElement(SumoXMLTag element) throw(ProcessError);
00142 
00143 
00144     private:
00146         std::map<int, PCOSMNode*> &myToFill;
00147 
00149         std::vector<SumoXMLTag> myParentElements;
00150 
00152         int myLastNodeID;
00153 
00154 
00155     private:
00157         NodesHandler(const NodesHandler &s);
00158 
00160         NodesHandler &operator=(const NodesHandler &s);
00161 
00162     };
00163 
00164 
00165 
00170     class EdgesHandler : public SUMOSAXHandler {
00171     public:
00177         EdgesHandler(const std::map<int, PCOSMNode*> &osmNodes,
00178                      std::map<std::string, PCOSMEdge*> &toFill) throw();
00179 
00180 
00182         ~EdgesHandler() throw();
00183 
00184 
00185     protected:
00187 
00188 
00196         void myStartElement(SumoXMLTag element, const SUMOSAXAttributes &attrs) throw(ProcessError);
00197 
00198 
00205         void myEndElement(SumoXMLTag element) throw(ProcessError);
00207 
00208 
00209     private:
00211         const std::map<int, PCOSMNode*> &myOSMNodes;
00212 
00214         std::map<std::string, PCOSMEdge*> &myEdgeMap;
00215 
00217         PCOSMEdge *myCurrentEdge;
00218 
00220         std::vector<SumoXMLTag> myParentElements;
00221 
00222 
00223     private:
00225         EdgesHandler(const EdgesHandler &s);
00226 
00228         EdgesHandler &operator=(const EdgesHandler &s);
00229 
00230     };
00231 
00232 
00233 };
00234 
00235 
00236 #endif
00237 
00238 /****************************************************************************/
00239 

Generated on Wed May 5 00:06:35 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6