00001 /****************************************************************************/ 00007 // Parser and container for routes during their loading 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 MSRouteHandler_h 00020 #define MSRouteHandler_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 "MSPerson.h" 00034 #include "MSVehicle.h" 00035 #include <utils/xml/SUMOSAXHandler.h> 00036 #include <utils/common/SUMOTime.h> 00037 00038 00039 // =========================================================================== 00040 // class declarations 00041 // =========================================================================== 00042 class MSEdge; 00043 class MSVehicleType; 00044 class MSEmitControl; 00045 00046 00047 // =========================================================================== 00048 // class definitions 00049 // =========================================================================== 00058 class MSRouteHandler : public SUMOSAXHandler { 00059 public: 00061 MSRouteHandler(const std::string &file, 00062 bool addVehiclesDirectly); 00063 00065 virtual ~MSRouteHandler() throw(); 00066 00068 SUMOTime getLastDepart() const; 00069 00071 void retrieveLastReadVehicle(MSEmitControl* into); 00072 00073 protected: 00075 00076 00084 virtual void myStartElement(SumoXMLTag element, 00085 const SUMOSAXAttributes &attrs) throw(ProcessError); 00086 00087 00095 virtual void myCharacters(SumoXMLTag element, 00096 const std::string &chars) throw(ProcessError); 00097 00098 00105 virtual void myEndElement(SumoXMLTag element) throw(ProcessError); 00107 00108 00110 void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs); 00111 00113 void closeVehicleTypeDistribution(); 00114 00116 void openRoute(const SUMOSAXAttributes &attrs); 00117 00123 void closeRoute() throw(ProcessError); 00124 00126 void openRouteDistribution(const SUMOSAXAttributes &attrs); 00127 00129 void closeRouteDistribution(); 00130 00132 void closeVehicle() throw(ProcessError); 00133 00135 void closePerson() throw(ProcessError); 00136 00138 void closeFlow() throw(ProcessError); 00139 00140 protected: 00141 SUMOVehicleParameter *myVehicleParameter; 00142 00144 SUMOTime myLastDepart; 00145 00147 MSVehicle *myLastReadVehicle; 00148 00149 00151 MSEdgeVector myActiveRoute; 00152 00154 std::string myActiveRouteID; 00155 00157 SUMOReal myActiveRouteProbability; 00158 00160 RGBColor myActiveRouteColor; 00161 00163 std::vector<SUMOVehicleParameter::Stop> myActiveRouteStops; 00164 00166 MSPerson::MSPersonPlan *myActivePlan; 00167 00170 bool myAddVehiclesDirectly; 00171 00173 RandomDistributor<MSVehicleType*> *myCurrentVTypeDistribution; 00174 00176 std::string myCurrentVTypeDistributionID; 00177 00179 RandomDistributor<const MSRoute*> *myCurrentRouteDistribution; 00180 00182 std::string myCurrentRouteDistributionID; 00183 00185 bool myAmUsingIncrementalDUA; 00186 00188 unsigned int myRunningVehicleNumber; 00189 00191 int myIncrementalBase; 00192 00194 int myIncrementalStage; 00195 00197 bool myHaveWarned; 00198 00200 SUMOVTypeParameter *myCurrentVType; 00201 00202 private: 00204 MSRouteHandler(const MSRouteHandler &s); 00205 00207 MSRouteHandler &operator=(const MSRouteHandler &s); 00208 00209 }; 00210 00211 00212 #endif 00213 00214 /****************************************************************************/ 00215
1.5.6