|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // Parser and container for routes during their loading 00010 /****************************************************************************/ 00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00013 /****************************************************************************/ 00014 // 00015 // This file is part of SUMO. 00016 // SUMO is free software: you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation, either version 3 of the License, or 00019 // (at your option) any later version. 00020 // 00021 /****************************************************************************/ 00022 #ifndef MSRouteHandler_h 00023 #define MSRouteHandler_h 00024 00025 00026 // =========================================================================== 00027 // included modules 00028 // =========================================================================== 00029 #ifdef _MSC_VER 00030 #include <windows_config.h> 00031 #else 00032 #include <config.h> 00033 #endif 00034 00035 #include <string> 00036 #include "MSPerson.h" 00037 #include "MSVehicle.h" 00038 #include <utils/xml/SUMOSAXHandler.h> 00039 #include <utils/common/SUMOTime.h> 00040 00041 00042 // =========================================================================== 00043 // class declarations 00044 // =========================================================================== 00045 class MSEdge; 00046 class MSVehicleType; 00047 00048 00049 // =========================================================================== 00050 // class definitions 00051 // =========================================================================== 00060 class MSRouteHandler : public SUMOSAXHandler { 00061 public: 00063 MSRouteHandler(const std::string& file, 00064 bool addVehiclesDirectly); 00065 00067 virtual ~MSRouteHandler() ; 00068 00070 SUMOTime getLastDepart() const; 00071 00073 bool checkStopPos(SUMOReal& startPos, SUMOReal& endPos, const SUMOReal laneLength, 00074 const SUMOReal minLength, const bool friendlyPos); 00075 00076 protected: 00078 00079 00087 virtual void myStartElement(int element, 00088 const SUMOSAXAttributes& attrs) ; 00089 00090 00097 virtual void myEndElement(int element) ; 00099 00100 00102 void openVehicleTypeDistribution(const SUMOSAXAttributes& attrs); 00103 00105 void closeVehicleTypeDistribution(); 00106 00108 void openRoute(const SUMOSAXAttributes& attrs); 00109 00115 void closeRoute() ; 00116 00118 void openRouteDistribution(const SUMOSAXAttributes& attrs); 00119 00121 void closeRouteDistribution(); 00122 00124 void closeVehicle() ; 00125 00127 void closePerson() ; 00128 00130 void closeFlow() ; 00131 00133 void addStop(const SUMOSAXAttributes& attrs) ; 00134 00135 protected: 00136 SUMOVehicleParameter* myVehicleParameter; 00137 00139 SUMOTime myLastDepart; 00140 00142 MSEdgeVector myActiveRoute; 00143 00145 std::string myActiveRouteID; 00146 00148 std::string myActiveRouteRefID; 00149 00151 SUMOReal myActiveRouteProbability; 00152 00154 RGBColor myActiveRouteColor; 00155 00157 std::vector<SUMOVehicleParameter::Stop> myActiveRouteStops; 00158 00160 MSPerson::MSPersonPlan* myActivePlan; 00161 00163 bool myAddVehiclesDirectly; 00164 00166 RandomDistributor<MSVehicleType*> *myCurrentVTypeDistribution; 00167 00169 std::string myCurrentVTypeDistributionID; 00170 00172 RandomDistributor<const MSRoute*> *myCurrentRouteDistribution; 00173 00175 std::string myCurrentRouteDistributionID; 00176 00178 SUMOReal myScale; 00179 00181 SUMOVTypeParameter* myCurrentVType; 00182 00183 bool myHaveWarnedAboutDeprecatedFriendlyPos, myHaveWarnedAboutDeprecatedBusStop; 00184 bool myHaveWarnedAboutDeprecatedVType, myHaveWarnedAboutDeprecatedVTypeDistribution; 00185 bool myHaveWarnedAboutDeprecatedVTypes, myHaveWarnedAboutDeprecatedRefID; 00186 00187 private: 00189 bool checkLastDepart(); 00190 00192 MSRouteHandler(const MSRouteHandler& s); 00193 00195 MSRouteHandler& operator=(const MSRouteHandler& s); 00196 00197 }; 00198 00199 00200 #endif 00201 00202 /****************************************************************************/ 00203