SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00010 // Changes the speed allowed on a set of lanes 00011 /****************************************************************************/ 00012 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00013 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00014 /****************************************************************************/ 00015 // 00016 // This file is part of SUMO. 00017 // SUMO is free software: you can redistribute it and/or modify 00018 // it under the terms of the GNU General Public License as published by 00019 // the Free Software Foundation, either version 3 of the License, or 00020 // (at your option) any later version. 00021 // 00022 /****************************************************************************/ 00023 #ifndef MSLaneSpeedTrigger_h 00024 #define MSLaneSpeedTrigger_h 00025 00026 00027 // =========================================================================== 00028 // included modules 00029 // =========================================================================== 00030 #ifdef _MSC_VER 00031 #include <windows_config.h> 00032 #else 00033 #include <config.h> 00034 #endif 00035 00036 #include <string> 00037 #include <vector> 00038 #include <utils/common/Command.h> 00039 #include <utils/common/UtilExceptions.h> 00040 #include <utils/xml/SUMOSAXHandler.h> 00041 #include "MSTrigger.h" 00042 00043 00044 // =========================================================================== 00045 // class declarations 00046 // =========================================================================== 00047 class MSLane; 00048 00049 00050 // =========================================================================== 00051 // class definitions 00052 // =========================================================================== 00061 class MSLaneSpeedTrigger : public MSTrigger, public SUMOSAXHandler, public Command { 00062 public: 00070 MSLaneSpeedTrigger(const std::string& id, 00071 const std::vector<MSLane*> &destLanes, 00072 const std::string& file); 00073 00074 00076 virtual ~MSLaneSpeedTrigger(); 00077 00078 00086 SUMOTime execute(SUMOTime currentTime); 00087 00088 00089 SUMOTime processCommand(bool move2next, SUMOTime currentTime); 00090 00091 SUMOReal getDefaultSpeed() const; 00092 00093 void setOverriding(bool val); 00094 00095 void setOverridingValue(SUMOReal val); 00096 00097 SUMOReal getLoadedSpeed(); 00098 00100 SUMOReal getCurrentSpeed() const; 00101 00102 protected: 00104 00105 00113 virtual void myStartElement(int element, 00114 const SUMOSAXAttributes& attrs); 00115 00122 virtual void myEndElement(int element); 00124 00125 00126 protected: 00128 std::vector<MSLane*> myDestLanes; 00129 00131 SUMOReal myCurrentSpeed; 00132 00134 SUMOReal myDefaultSpeed; 00135 00137 bool myAmOverriding; 00138 00140 SUMOReal mySpeedOverrideValue; 00141 00142 std::vector<std::pair<SUMOTime, SUMOReal> > myLoadedSpeeds; 00143 std::vector<std::pair<SUMOTime, SUMOReal> >::iterator myCurrentEntry; 00144 00145 private: 00147 MSLaneSpeedTrigger(const MSLaneSpeedTrigger&); 00148 00150 MSLaneSpeedTrigger& operator=(const MSLaneSpeedTrigger&); 00151 00152 void init(); 00153 00154 00155 private: 00157 bool myDidInit; 00158 00159 }; 00160 00161 00162 #endif 00163 00164 /****************************************************************************/ 00165