SUMO - Simulation of Urban MObility

NIImporter_MATSim.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Importer for networks stored in MATSim format
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2011 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 NIImporter_MATSim_h
00020 #define NIImporter_MATSim_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 <map>
00034 #include <netbuild/NBCapacity2Lanes.h>
00035 #include <utils/xml/SUMOSAXHandler.h>
00036 #include <utils/common/UtilExceptions.h>
00037 
00038 
00039 // ===========================================================================
00040 // class declarations
00041 // ===========================================================================
00042 class NBEdge;
00043 class NBEdgeCont;
00044 class NBNetBuilder;
00045 class NBNode;
00046 class NBNodeCont;
00047 class NBTrafficLightLogicCont;
00048 class NBTypeCont;
00049 class OptionsCont;
00050 
00051 
00052 // ===========================================================================
00053 // class definitions
00054 // ===========================================================================
00060 class NIImporter_MATSim {
00061 public:
00073     static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
00074 
00075 
00076 private:
00081     class NodesHandler : public GenericSAXHandler {
00082     public:
00086         NodesHandler(NBNodeCont& toFill) throw();
00087 
00088 
00090         ~NodesHandler() throw();
00091 
00092 
00093     protected:
00095 
00096 
00104         void myStartElement(int element, const SUMOSAXAttributes& attrs) throw(ProcessError);
00106 
00107 
00108     private:
00110         NBNodeCont& myNodeCont;
00111 
00112 
00113     private:
00115         NodesHandler(const NodesHandler& s);
00116 
00118         NodesHandler& operator=(const NodesHandler& s);
00119 
00120     };
00121 
00122 
00123 
00128     class EdgesHandler : public GenericSAXHandler {
00129     public:
00138         EdgesHandler(const NBNodeCont& nc, NBEdgeCont& toFill,
00139                      bool keepEdgeLengths, bool lanesFromCapacity,
00140                      NBCapacity2Lanes capacity2Lanes) throw();
00141 
00142 
00144         ~EdgesHandler() throw();
00145 
00146 
00147     protected:
00149 
00150 
00158         void myStartElement(int element, const SUMOSAXAttributes& attrs) throw(ProcessError);
00160 
00161 
00162     private:
00164         const NBNodeCont& myNodeCont;
00165 
00167         NBEdgeCont& myEdgeCont;
00168 
00170         SUMOReal myCapacityNorm;
00171 
00173         bool myKeepEdgeLengths;
00174 
00176         bool myLanesFromCapacity;
00177 
00179         NBCapacity2Lanes myCapacity2Lanes;
00180 
00181 
00182     private:
00184         EdgesHandler(const EdgesHandler& s);
00185 
00187         EdgesHandler& operator=(const EdgesHandler& s);
00188 
00189     };
00190 
00191 
00197     enum MatsimXMLTag {
00198         MATSIM_TAG_NOTHING = 0,
00199         MATSIM_TAG_NETWORK,
00200         MATSIM_TAG_NODE,
00201         MATSIM_TAG_LINK,
00202         MATSIM_TAG_LINKS
00203     };
00204 
00205 
00211     enum MatsimXMLAttr {
00212         MATSIM_ATTR_NOTHING = 0,
00213         MATSIM_ATTR_ID,
00214         MATSIM_ATTR_X,
00215         MATSIM_ATTR_Y,
00216         MATSIM_ATTR_FROM,
00217         MATSIM_ATTR_TO,
00218         MATSIM_ATTR_LENGTH,
00219         MATSIM_ATTR_FREESPEED,
00220         MATSIM_ATTR_CAPACITY,
00221         MATSIM_ATTR_PERMLANES,
00222         MATSIM_ATTR_ONEWAY,
00223         MATSIM_ATTR_MODES,
00224         MATSIM_ATTR_ORIGID,
00225         MATSIM_ATTR_CAPPERIOD,
00226         MATSIM_ATTR_CAPDIVIDER
00227     };
00228 
00230     static StringBijection<int>::Entry matsimTags[];
00231 
00233     static StringBijection<int>::Entry matsimAttrs[];
00234 
00235 
00236 };
00237 
00238 
00239 #endif
00240 
00241 /****************************************************************************/
00242 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines