SUMO - Simulation of Urban MObility
|
Builds trigger objects for guisim. More...
#include <GUITriggerBuilder.h>
Public Member Functions | |
void | buildVaporizer (const SUMOSAXAttributes &attrs) |
Builds a vaporization. More... | |
GUITriggerBuilder () | |
Constructor. More... | |
void | setHandler (NLHandler *handler) |
Sets the parent handler to use for nested parsing. More... | |
~GUITriggerBuilder () | |
Destructor. More... | |
parsing methods | |
These methods parse the attributes for each of the described trigger and call the according methods to build the trigger | |
void | parseAndBuildLaneSpeedTrigger (MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base) |
Parses his values and builds a lane speed trigger. More... | |
void | parseAndBuildRerouter (MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base) |
Parses his values and builds a rerouter. More... | |
void | parseAndBuildStoppingPlace (MSNet &net, const SUMOSAXAttributes &attrs, const SumoXMLTag element) |
Parses the values and builds a stopping places for busses, trains or container vehicles. More... | |
void | addAccess (MSNet &net, const SUMOSAXAttributes &attrs) |
Parses the values and adds an access point to the currently parsed stopping place. More... | |
void | parseAndBuildChargingStation (MSNet &net, const SUMOSAXAttributes &attrs) |
Parses his values and builds a charging station. More... | |
void | parseAndBuildCalibrator (MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base) |
Parses his values and builds a mesoscopic or microscopic calibrator. More... | |
Protected Member Functions | |
building methods | |
Override NLTriggerBuilder-methods for building guisim-objects
| |
virtual MSLaneSpeedTrigger * | buildLaneSpeedTrigger (MSNet &net, const std::string &id, const std::vector< MSLane * > &destLanes, const std::string &file) |
Builds a lane speed trigger. More... | |
virtual MSTriggeredRerouter * | buildRerouter (MSNet &net, const std::string &id, MSEdgeVector &edges, SUMOReal prob, const std::string &file, bool off) |
builds an rerouter More... | |
virtual void | buildStoppingPlace (MSNet &net, const std::string &id, const std::vector< std::string > &lines, MSLane *lane, SUMOReal frompos, SUMOReal topos, const SumoXMLTag element) |
Builds a bus stop. More... | |
virtual void | buildChargingStation (MSNet &net, const std::string &id, MSLane *lane, SUMOReal frompos, SUMOReal topos, SUMOReal chargingPower, SUMOReal efficiency, bool chargeInTransit, int chargeDelay) |
Builds a charging station. More... | |
virtual MSCalibrator * | buildCalibrator (MSNet &net, const std::string &id, MSEdge *edge, SUMOReal pos, const std::string &file, const std::string &outfile, const SUMOTime freq, const MSRouteProbe *probe) |
builds a microscopic calibrator More... | |
building methods | |
Called with parsed values, these methods build the trigger. These methods should be overriden for the gui loader in order to build visualizable versions of the triggers. In most cases, these methods only call the constructor. | |
virtual METriggeredCalibrator * | buildMECalibrator (MSNet &net, const std::string &id, const MSEdge *edge, SUMOReal pos, const std::string &file, const std::string &outfile, const SUMOTime freq, MSRouteProbe *probe) |
builds a mesoscopic calibrator More... | |
helper method for obtaining and checking values | |
std::string | getFileName (const SUMOSAXAttributes &attrs, const std::string &base, const bool allowEmpty=false) |
Helper method to obtain the filename. More... | |
MSLane * | getLane (const SUMOSAXAttributes &attrs, const std::string &tt, const std::string &tid) |
Returns the lane defined by attribute "lane". More... | |
SUMOReal | getPosition (const SUMOSAXAttributes &attrs, MSLane *lane, const std::string &tt, const std::string &tid) |
returns the position on the lane checking it More... | |
Protected Attributes | |
MSStoppingPlace * | myCurrentStop |
The currently parsed stop to add access points to. More... | |
NLHandler * | myHandler |
The parent handler to set for subhandlers. More... | |
Builds trigger objects for guisim.
Definition at line 57 of file GUITriggerBuilder.h.
GUITriggerBuilder::GUITriggerBuilder | ( | ) |
Constructor.
Definition at line 53 of file GUITriggerBuilder.cpp.
GUITriggerBuilder::~GUITriggerBuilder | ( | ) |
Destructor.
Definition at line 56 of file GUITriggerBuilder.cpp.
|
inherited |
Parses the values and adds an access point to the currently parsed stopping place.
[in] | net | The network the stop belongs to |
[in] | attrs | SAX-attributes which define the access |
InvalidArgument | If a parameter (lane/position) is not valid |
Definition at line 216 of file NLTriggerBuilder.cpp.
References MSStoppingPlace::addAccess(), SUMORouteHandler::checkStopPos(), Named::getID(), NLTriggerBuilder::getLane(), MSLane::getLength(), SUMOSAXAttributes::getOpt(), NLTriggerBuilder::myCurrentStop, NLTriggerBuilder::myHandler, SUMO_ATTR_FRIENDLY_POS, SUMO_ATTR_POSITION, and SUMOReal.
Referenced by NLHandler::myStartElement().
|
protectedvirtual |
builds a microscopic calibrator
Simply calls the MSCalibrator constructor.
[in] | net | The net the calibrator belongs to |
[in] | id | The id of the calibrator |
[in] | edge | The edge the calibrator is placed at |
[in] | pos | The position on the edge the calibrator lies at |
[in] | file | The file to read the flows from |
Reimplemented from NLTriggerBuilder.
Definition at line 117 of file GUITriggerBuilder.cpp.
|
protectedvirtual |
Builds a charging station.
Simply calls the ChrgSTN constructor.
[in] | net | The net the charging station belongs to |
[in] | id | The id of the charging station |
[in] | lane | The lane the charging station is placed on |
[in] | frompos | Begin position of the charging station on the lane |
[in] | topos | End position of the charging station on the lane |
[in] | chargingPower | energy charged in every timeStep |
[in] | efficiency | efficiency of the charge |
[in] | chargeInTransit | enable or disable charge in transit |
[in] | chargeDelay | delay in the charge |
InvalidArgument | If the charging station can not be added to the net (is duplicate) |
Reimplemented from NLTriggerBuilder.
Definition at line 104 of file GUITriggerBuilder.cpp.
References MSNet::addChargingStation().
|
protectedvirtual |
Builds a lane speed trigger.
Simply calls the GUILaneSpeedTrigger constructor.
[in] | net | The net the lane speed trigger belongs to |
[in] | id | The id of the lane speed trigger |
[in] | destLanes | List of lanes affected by this speed trigger |
[in] | file | Name of the file to read the speeds to set from |
ProcessError | If the XML definition file is errornous |
Reimplemented from NLTriggerBuilder.
Definition at line 60 of file GUITriggerBuilder.cpp.
|
protectedvirtualinherited |
builds a mesoscopic calibrator
Simply calls the METriggeredCalibrator constructor.
[in] | net | The net the calibrator belongs to |
[in] | id | The id of the calibrator |
[in] | edge | The edge the calibrator is placed at |
[in] | pos | The position on the edge the calibrator lies at |
[in] | file | The file to read the flows from |
Definition at line 320 of file NLTriggerBuilder.cpp.
References MSGlobals::gMesoNet.
Referenced by NLTriggerBuilder::parseAndBuildCalibrator().
|
protectedvirtual |
builds an rerouter
Simply calls the GUITriggeredRerouter constructor.
[in] | net | The net the rerouter belongs to |
[in] | id | The id of the rerouter |
[in] | edges | The edges the rerouter is placed at |
[in] | prob | The probability the rerouter reoutes vehicles with |
[in] | file | The file to read the reroute definitions from |
Reimplemented from NLTriggerBuilder.
Definition at line 70 of file GUITriggerBuilder.cpp.
|
protectedvirtual |
Builds a bus stop.
Simply calls the GUIBusStop / GUIContainerStop constructor.
[in] | net | The net the stop belongs to |
[in] | id | The id of the stop |
[in] | lines | Names of the lines that halt on this stop |
[in] | lane | The lane the stop is placed on |
[in] | frompos | Begin position of the stop on the lane |
[in] | topos | End position of the stop on the lane |
[in] | element | which kind of stop is to be built |
InvalidArgument | If the stop can not be added to the net (is duplicate) |
Reimplemented from NLTriggerBuilder.
Definition at line 80 of file GUITriggerBuilder.cpp.
References MSNet::addBusStop(), MSNet::addContainerStop(), NLTriggerBuilder::myCurrentStop, SUMO_TAG_CONTAINER_STOP, and toString().
|
inherited |
Builds a vaporization.
Parses the attributes, reporting errors if the time values are false or the edge is not known. Instatiates events for enabling and disabling the vaporization otherwise.
[in] | attrs | SAX-attributes which define the vaporizer |
Definition at line 83 of file NLTriggerBuilder.cpp.
References MSEventControl::ADAPT_AFTER_EXECUTION, MSEventControl::addEvent(), MSEdge::decVaporization(), MSEdge::dictionary(), SUMOSAXAttributes::get(), MSNet::getBeginOfTimestepEvents(), MSNet::getInstance(), OptionsCont::getOptions(), SUMOSAXAttributes::getSUMOTimeReporting(), MSEdge::incVaporization(), string2time(), SUMO_ATTR_BEGIN, SUMO_ATTR_END, SUMO_ATTR_ID, and WRITE_ERROR.
Referenced by NLHandler::myStartElement().
|
protectedinherited |
Helper method to obtain the filename.
Retrieves "file" from attributes, checks whether it is absolute and extends it by the given base path if not. Returns this information.
[in] | attrs | The attributes to obtain the file name from |
[in] | base | The base path (the path the loaded additional file lies in) |
Definition at line 372 of file NLTriggerBuilder.cpp.
References FileHelpers::getConfigurationRelative(), SUMOSAXAttributes::getOpt(), FileHelpers::isAbsolute(), and SUMO_ATTR_FILE.
Referenced by NLTriggerBuilder::parseAndBuildCalibrator(), NLTriggerBuilder::parseAndBuildLaneSpeedTrigger(), and NLTriggerBuilder::parseAndBuildRerouter().
|
protectedinherited |
Returns the lane defined by attribute "lane".
Retrieves the lane id from the given attrs. Tries to retrieve the lane, throws an InvalidArgument if it does not exist.
[in] | attrs | The attributes to obtain the lane id from |
[in] | tt | The trigger type (for user output) |
[in] | tid | The trigger id (for user output) |
InvalidArgument | If the named lane does not exist or a lane is not named |
Definition at line 393 of file NLTriggerBuilder.cpp.
References MSLane::dictionary(), SUMOSAXAttributes::get(), and SUMO_ATTR_LANE.
Referenced by NLTriggerBuilder::addAccess(), NLTriggerBuilder::parseAndBuildCalibrator(), NLTriggerBuilder::parseAndBuildChargingStation(), and NLTriggerBuilder::parseAndBuildStoppingPlace().
|
protectedinherited |
returns the position on the lane checking it
This method extracts the position, checks whether it shall be mirrored and checks whether it is within the lane. If not, an error is reported and a InvalidArgument is thrown.
[in] | attrs | The attributes to obtain the position from |
[in] | lane | The lane the position shall be valid for |
[in] | tt | The trigger type (for user output) |
[in] | tid | The trigger id (for user output) |
InvalidArgument | If the position is beyond the lane |
Definition at line 407 of file NLTriggerBuilder.cpp.
References SUMOSAXAttributes::get(), Named::getID(), MSLane::getLength(), SUMOSAXAttributes::getOpt(), SUMO_ATTR_FRIENDLY_POS, SUMO_ATTR_POSITION, and SUMOReal.
Referenced by NLTriggerBuilder::parseAndBuildCalibrator().
|
inherited |
Parses his values and builds a mesoscopic or microscopic calibrator.
[in] | net | The network the calibrator belongs to |
[in] | attrs | SAX-attributes which define the trigger |
[in] | base | The base path |
InvalidArgument | If a parameter (edge/position) is not valid |
Definition at line 232 of file NLTriggerBuilder.cpp.
References NLTriggerBuilder::buildCalibrator(), NLTriggerBuilder::buildMECalibrator(), DELTA_T, SUMOSAXAttributes::get(), NamedObjectCont< T >::get(), MSNet::getDetectorControl(), MSLane::getEdge(), NLTriggerBuilder::getFileName(), NLTriggerBuilder::getLane(), SUMOSAXAttributes::getOpt(), SUMOSAXAttributes::getOptSUMOTimeReporting(), NLTriggerBuilder::getPosition(), MSDetectorControl::getTypedDetectors(), MSGlobals::gUseMesoSim, NLTriggerBuilder::myHandler, GenericSAXHandler::registerParent(), SUMO_ATTR_FREQUENCY, SUMO_ATTR_ID, SUMO_ATTR_OUTPUT, SUMO_ATTR_ROUTEPROBE, SUMO_TAG_CALIBRATOR, SUMO_TAG_ROUTEPROBE, and SUMOReal.
Referenced by NLHandler::myStartElement().
|
inherited |
Parses his values and builds a charging station.
[in] | net | The network the charging station belongs to |
[in] | attrs | SAXattributes which define the trigger |
InvalidArgument | If a parameter (lane/position) is not valid |
Definition at line 158 of file NLTriggerBuilder.cpp.
References NLTriggerBuilder::buildChargingStation(), SUMORouteHandler::checkStopPos(), SUMOSAXAttributes::get(), NLTriggerBuilder::getLane(), MSLane::getLength(), SUMOSAXAttributes::getOpt(), NLTriggerBuilder::myHandler, POSITION_EPS, SUMO_ATTR_CHARGEDELAY, SUMO_ATTR_CHARGEINTRANSIT, SUMO_ATTR_CHARGINGPOWER, SUMO_ATTR_EFFICIENCY, SUMO_ATTR_ENDPOS, SUMO_ATTR_FRIENDLY_POS, SUMO_ATTR_ID, SUMO_ATTR_STARTPOS, and SUMOReal.
Referenced by NLHandler::myStartElement().
|
inherited |
Parses his values and builds a lane speed trigger.
If one of the declaration values is errornous, an InvalidArgument is thrown.
If the XML-file parsed during initialisation is errornous, and the MSLaneSpeedTrigger-constructor throws a ProcessError due to this, this exception is catched and an InvalidArgument with the message given in the ProcessError is thrown.
[in] | net | The network the lane speed trigger belongs to |
[in] | attrs | SAX-attributes which define the trigger |
[in] | base | The base path |
InvalidArgument | If a parameter (lane/position) is not valid or the read definition is errornous |
Definition at line 119 of file NLTriggerBuilder.cpp.
References NLTriggerBuilder::buildLaneSpeedTrigger(), MSLane::dictionary(), SUMOSAXAttributes::get(), NLTriggerBuilder::getFileName(), NLTriggerBuilder::myHandler, SUMOSAXAttributes::parseStringVector(), GenericSAXHandler::registerParent(), SUMO_ATTR_ID, SUMO_ATTR_LANES, and SUMO_TAG_VSS.
Referenced by NLHandler::myStartElement().
|
inherited |
Parses his values and builds a rerouter.
[in] | net | The network the rerouter belongs to |
[in] | attrs | SAX-attributes which define the trigger |
[in] | base | The base path |
InvalidArgument | If a parameter (edge) is not valid |
Definition at line 266 of file NLTriggerBuilder.cpp.
References NLTriggerBuilder::buildRerouter(), MSEdge::dictionary(), SUMOSAXAttributes::get(), NLTriggerBuilder::getFileName(), SUMOSAXAttributes::getOpt(), NLTriggerBuilder::myHandler, SUMOSAXAttributes::parseStringVector(), GenericSAXHandler::registerParent(), XMLSubSys::runParser(), SUMO_ATTR_EDGES, SUMO_ATTR_ID, SUMO_ATTR_OFF, SUMO_ATTR_PROB, SUMO_TAG_REROUTER, and SUMOReal.
Referenced by NLHandler::myStartElement().
|
inherited |
Parses the values and builds a stopping places for busses, trains or container vehicles.
[in] | net | The network the stop belongs to |
[in] | attrs | SAX-attributes which define the stop |
[in] | element | which kind of stop is to be built |
InvalidArgument | If a parameter (lane/position) is not valid |
Definition at line 191 of file NLTriggerBuilder.cpp.
References NLTriggerBuilder::buildStoppingPlace(), SUMORouteHandler::checkStopPos(), SUMOSAXAttributes::get(), NLTriggerBuilder::getLane(), MSLane::getLength(), SUMOSAXAttributes::getOpt(), NLTriggerBuilder::myHandler, SUMOSAXAttributes::parseStringVector(), POSITION_EPS, SUMO_ATTR_ENDPOS, SUMO_ATTR_FRIENDLY_POS, SUMO_ATTR_ID, SUMO_ATTR_LINES, SUMO_ATTR_STARTPOS, SUMOReal, and toString().
Referenced by NLHandler::myStartElement().
|
inherited |
Sets the parent handler to use for nested parsing.
[in] | handler | The netload handler to set |
Definition at line 77 of file NLTriggerBuilder.cpp.
References NLTriggerBuilder::myHandler.
Referenced by load(), and GUILoadThread::run().
|
protectedinherited |
The currently parsed stop to add access points to.
Definition at line 340 of file NLTriggerBuilder.h.
Referenced by NLTriggerBuilder::addAccess(), buildStoppingPlace(), and NLTriggerBuilder::buildStoppingPlace().
|
protectedinherited |
The parent handler to set for subhandlers.
Definition at line 337 of file NLTriggerBuilder.h.
Referenced by NLTriggerBuilder::addAccess(), NLTriggerBuilder::parseAndBuildCalibrator(), NLTriggerBuilder::parseAndBuildChargingStation(), NLTriggerBuilder::parseAndBuildLaneSpeedTrigger(), NLTriggerBuilder::parseAndBuildRerouter(), NLTriggerBuilder::parseAndBuildStoppingPlace(), and NLTriggerBuilder::setHandler().