50 #include <mesosim/MELoop.h>
51 #include <mesosim/MESegment.h>
54 #ifdef CHECK_MEMORY_LEAKS
56 #endif // CHECK_MEMORY_LEAKS
63 const std::vector<MSLane*>& destLanes,
64 const std::string& file) :
67 myDestLanes(destLanes),
68 myCurrentSpeed(destLanes[0]->getSpeedLimit()),
69 myDefaultSpeed(destLanes[0]->getSpeedLimit()),
70 myAmOverriding(false),
71 mySpeedOverrideValue(destLanes[0]->getSpeedLimit()),
118 std::vector<MSLane*>::iterator i;
123 MESegment* first = MSGlobals::gMesoNet->getSegmentForEdge((*i)->getEdge());
125 first->setSpeed(speed, currentTime, -1);
126 first = first->getNextSegment();
131 (*i)->setMaxSpeed(speed);
141 return ((*myCurrentEntry).first) - ((*(
myCurrentEntry - 1)).first);
210 return (*myCurrentEntry).second;
227 return (*myCurrentEntry).second;
void setOverridingValue(SUMOReal val)
std::vector< MSLane * > myDestLanes
std::string time2string(SUMOTime t)
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
SUMOTime execute(SUMOTime currentTime)
Executes a switch command.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SAX-handler base for SUMO-files.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
#define UNUSED_PARAMETER(x)
#define WRITE_WARNING(msg)
SUMOReal getLoadedSpeed()
SUMOReal getCurrentSpeed() const
Returns the current speed.
const std::string & getID() const
Returns the id.
SUMOReal myDefaultSpeed
The original speed allowed on the lanes.
An abstract device that changes the state of the micro simulation.
Encapsulated SAX-Attributes.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
A wrapper for a Command function.
SUMOReal getDefaultSpeed() const
bool myAmOverriding
The information whether the read speed shall be overridden.
std::vector< std::pair< SUMOTime, SUMOReal > >::iterator myCurrentEntry
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
void setOverriding(bool val)
virtual SUMOTime addEvent(Command *operation, SUMOTime execTimeStep, AdaptType type)
Adds an Event.
MSLaneSpeedTrigger(const std::string &id, const std::vector< MSLane * > &destLanes, const std::string &file)
Constructor.
SUMOReal mySpeedOverrideValue
The speed to use if overriding the read speed.
SUMOTime processCommand(bool move2next, SUMOTime currentTime)
virtual ~MSLaneSpeedTrigger()
Destructor.
std::vector< std::pair< SUMOTime, SUMOReal > > myLoadedSpeeds
bool myDidInit
The information whether init was called.
static const bool gUseMesoSim
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual void myEndElement(int element)
Called on the closing of a tag;.