SUMO - Simulation of Urban MObility
NIImporter_MATSim.h
Go to the documentation of this file.
00001 /****************************************************************************/
00008 // Importer for networks stored in MATSim format
00009 /****************************************************************************/
00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00012 /****************************************************************************/
00013 //
00014 //   This file is part of SUMO.
00015 //   SUMO is free software: you can redistribute it and/or modify
00016 //   it under the terms of the GNU General Public License as published by
00017 //   the Free Software Foundation, either version 3 of the License, or
00018 //   (at your option) any later version.
00019 //
00020 /****************************************************************************/
00021 #ifndef NIImporter_MATSim_h
00022 #define NIImporter_MATSim_h
00023 
00024 
00025 // ===========================================================================
00026 // included modules
00027 // ===========================================================================
00028 #ifdef _MSC_VER
00029 #include <windows_config.h>
00030 #else
00031 #include <config.h>
00032 #endif
00033 
00034 #include <string>
00035 #include <map>
00036 #include <netbuild/NBCapacity2Lanes.h>
00037 #include <utils/xml/SUMOSAXHandler.h>
00038 #include <utils/common/UtilExceptions.h>
00039 
00040 
00041 // ===========================================================================
00042 // class declarations
00043 // ===========================================================================
00044 class NBEdge;
00045 class NBEdgeCont;
00046 class NBNetBuilder;
00047 class NBNode;
00048 class NBNodeCont;
00049 class NBTrafficLightLogicCont;
00050 class NBTypeCont;
00051 class OptionsCont;
00052 
00053 
00054 // ===========================================================================
00055 // class definitions
00056 // ===========================================================================
00062 class NIImporter_MATSim {
00063 public:
00075     static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
00076 
00077 
00078 private:
00083     class NodesHandler : public GenericSAXHandler {
00084     public:
00088         NodesHandler(NBNodeCont& toFill) ;
00089 
00090 
00092         ~NodesHandler() ;
00093 
00094 
00095     protected:
00097 
00098 
00106         void myStartElement(int element, const SUMOSAXAttributes& attrs) ;
00108 
00109 
00110     private:
00112         NBNodeCont& myNodeCont;
00113 
00114 
00115     private:
00117         NodesHandler(const NodesHandler& s);
00118 
00120         NodesHandler& operator=(const NodesHandler& s);
00121 
00122     };
00123 
00124 
00125 
00130     class EdgesHandler : public GenericSAXHandler {
00131     public:
00140         EdgesHandler(const NBNodeCont& nc, NBEdgeCont& toFill,
00141                      bool keepEdgeLengths, bool lanesFromCapacity,
00142                      NBCapacity2Lanes capacity2Lanes) ;
00143 
00144 
00146         ~EdgesHandler() ;
00147 
00148 
00149     protected:
00151 
00152 
00160         void myStartElement(int element, const SUMOSAXAttributes& attrs) ;
00162 
00163 
00164     private:
00166         const NBNodeCont& myNodeCont;
00167 
00169         NBEdgeCont& myEdgeCont;
00170 
00172         SUMOReal myCapacityNorm;
00173 
00175         bool myKeepEdgeLengths;
00176 
00178         bool myLanesFromCapacity;
00179 
00181         NBCapacity2Lanes myCapacity2Lanes;
00182 
00183 
00184     private:
00186         EdgesHandler(const EdgesHandler& s);
00187 
00189         EdgesHandler& operator=(const EdgesHandler& s);
00190 
00191     };
00192 
00193 
00199     enum MatsimXMLTag {
00200         MATSIM_TAG_NOTHING = 0,
00201         MATSIM_TAG_NETWORK,
00202         MATSIM_TAG_NODE,
00203         MATSIM_TAG_LINK,
00204         MATSIM_TAG_LINKS
00205     };
00206 
00207 
00213     enum MatsimXMLAttr {
00214         MATSIM_ATTR_NOTHING = 0,
00215         MATSIM_ATTR_ID,
00216         MATSIM_ATTR_X,
00217         MATSIM_ATTR_Y,
00218         MATSIM_ATTR_FROM,
00219         MATSIM_ATTR_TO,
00220         MATSIM_ATTR_LENGTH,
00221         MATSIM_ATTR_FREESPEED,
00222         MATSIM_ATTR_CAPACITY,
00223         MATSIM_ATTR_PERMLANES,
00224         MATSIM_ATTR_ONEWAY,
00225         MATSIM_ATTR_MODES,
00226         MATSIM_ATTR_ORIGID,
00227         MATSIM_ATTR_CAPPERIOD,
00228         MATSIM_ATTR_CAPDIVIDER
00229     };
00230 
00232     static StringBijection<int>::Entry matsimTags[];
00233 
00235     static StringBijection<int>::Entry matsimAttrs[];
00236 
00237 
00238 };
00239 
00240 
00241 #endif
00242 
00243 /****************************************************************************/
00244 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines