SUMO - Simulation of Urban MObility

MSRouteHandler.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Parser and container for routes during their loading
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 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 
00045 
00046 // ===========================================================================
00047 // class definitions
00048 // ===========================================================================
00057 class MSRouteHandler : public SUMOSAXHandler {
00058 public:
00060     MSRouteHandler(const std::string& file,
00061                    bool addVehiclesDirectly);
00062 
00064     virtual ~MSRouteHandler() throw();
00065 
00067     SUMOTime getLastDepart() const;
00068 
00070     bool checkStopPos(SUMOReal& startPos, SUMOReal& endPos, const SUMOReal laneLength,
00071                       const SUMOReal minLength, const bool friendlyPos);
00072 
00073 protected:
00075 
00076 
00084     virtual void myStartElement(int element,
00085                                 const SUMOSAXAttributes& attrs) throw(ProcessError);
00086 
00087 
00094     virtual void myEndElement(int element) throw(ProcessError);
00096 
00097 
00099     void openVehicleTypeDistribution(const SUMOSAXAttributes& attrs);
00100 
00102     void closeVehicleTypeDistribution();
00103 
00105     void openRoute(const SUMOSAXAttributes& attrs);
00106 
00112     void closeRoute() throw(ProcessError);
00113 
00115     void openRouteDistribution(const SUMOSAXAttributes& attrs);
00116 
00118     void closeRouteDistribution();
00119 
00121     void closeVehicle() throw(ProcessError);
00122 
00124     void closePerson() throw(ProcessError);
00125 
00127     void closeFlow() throw(ProcessError);
00128 
00130     void addStop(const SUMOSAXAttributes& attrs) throw(ProcessError);
00131 
00132 protected:
00133     SUMOVehicleParameter* myVehicleParameter;
00134 
00136     SUMOTime myLastDepart;
00137 
00139     MSEdgeVector myActiveRoute;
00140 
00142     std::string myActiveRouteID;
00143 
00145     std::string myActiveRouteRefID;
00146 
00148     SUMOReal myActiveRouteProbability;
00149 
00151     RGBColor myActiveRouteColor;
00152 
00154     std::vector<SUMOVehicleParameter::Stop> myActiveRouteStops;
00155 
00157     MSPerson::MSPersonPlan* myActivePlan;
00158 
00160     bool myAddVehiclesDirectly;
00161 
00163     RandomDistributor<MSVehicleType*> *myCurrentVTypeDistribution;
00164 
00166     std::string myCurrentVTypeDistributionID;
00167 
00169     RandomDistributor<const MSRoute*> *myCurrentRouteDistribution;
00170 
00172     std::string myCurrentRouteDistributionID;
00173 
00175     SUMOReal myScale;
00176 
00178     SUMOVTypeParameter* myCurrentVType;
00179 
00180     bool myHaveWarnedAboutDeprecatedFriendlyPos, myHaveWarnedAboutDeprecatedBusStop;
00181     bool myHaveWarnedAboutDeprecatedVType, myHaveWarnedAboutDeprecatedVTypeDistribution;
00182     bool myHaveWarnedAboutDeprecatedVTypes, myHaveWarnedAboutDeprecatedRefID;
00183 
00184 private:
00186     bool checkLastDepart();
00187 
00189     MSRouteHandler(const MSRouteHandler& s);
00190 
00192     MSRouteHandler& operator=(const MSRouteHandler& s);
00193 
00194 };
00195 
00196 
00197 #endif
00198 
00199 /****************************************************************************/
00200 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines