SUMO - Simulation of Urban MObility
SUMORouteHandler.h
Go to the documentation of this file.
00001 /****************************************************************************/
00009 // Parser 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 SUMORouteHandler_h
00023 #define SUMORouteHandler_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 <utils/xml/SUMOSAXHandler.h>
00037 #include <utils/common/SUMOTime.h>
00038 
00039 
00040 // ===========================================================================
00041 // class definitions
00042 // ===========================================================================
00050 class SUMORouteHandler : public SUMOSAXHandler {
00051 public:
00053     SUMORouteHandler(const std::string& file);
00054 
00056     virtual ~SUMORouteHandler() ;
00057 
00059     SUMOTime getLastDepart() const;
00060 
00062     bool checkStopPos(SUMOReal& startPos, SUMOReal& endPos, const SUMOReal laneLength,
00063                       const SUMOReal minLength, const bool friendlyPos);
00064 
00065 protected:
00067 
00068 
00076     virtual void myStartElement(int element,
00077                                 const SUMOSAXAttributes& attrs) ;
00078 
00079 
00086     virtual void myEndElement(int element) ;
00088 
00089 
00091     virtual void openVehicleTypeDistribution(const SUMOSAXAttributes& attrs) = 0;
00092 
00094     virtual void closeVehicleTypeDistribution() = 0;
00095 
00097     virtual void openRoute(const SUMOSAXAttributes& attrs) = 0;
00098 
00104     virtual void closeRoute() = 0;
00105 
00107     virtual void openRouteDistribution(const SUMOSAXAttributes& attrs) = 0;
00108 
00110     virtual void closeRouteDistribution() = 0;
00111 
00113     virtual void closeVehicle() = 0;
00114 
00116     virtual void closePerson() = 0;
00117 
00119     virtual void closeFlow() = 0;
00120 
00122     virtual void addStop(const SUMOSAXAttributes& attrs) = 0;
00123 
00125     bool checkLastDepart();
00126 
00128     void registerLastDepart();
00129 
00130 protected:
00132     SUMOVehicleParameter* myVehicleParameter;
00133 
00135     SUMOTime myLastDepart;
00136 
00138     std::string myActiveRouteID;
00139 
00141     std::string myActiveRouteRefID;
00142 
00144     SUMOReal myActiveRouteProbability;
00145 
00147     RGBColor myActiveRouteColor;
00148 
00150     std::vector<SUMOVehicleParameter::Stop> myActiveRouteStops;
00151 
00153     SUMOVTypeParameter* myCurrentVType;
00154 
00155 private:
00157     SUMORouteHandler(const SUMORouteHandler& s);
00158 
00160     SUMORouteHandler& operator=(const SUMORouteHandler& s);
00161 
00162 };
00163 
00164 
00165 #endif
00166 
00167 /****************************************************************************/
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines