52 myVehicleParameter(0),
54 myActiveRouteColor(0),
58 myFirstDepart(-1), myInsertStopEdgesAt(-1) {
208 const double minLength,
const bool friendlyPos) {
209 if (minLength > laneLength) {
213 startPos += laneLength;
216 endPos += laneLength;
218 if (endPos < minLength || endPos > laneLength) {
222 if (endPos < minLength) {
225 if (endPos > laneLength) {
229 if (startPos < 0 || startPos > endPos - minLength) {
236 if (startPos > endPos - minLength) {
237 startPos = endPos - minLength;
288 errorSuffix =
" at '" + stop.
busstop +
"'" + errorSuffix;
292 errorSuffix =
" at '" + stop.
containerstop +
"'" + errorSuffix;
294 errorSuffix =
" at '" + stop.
parkingarea +
"'" + errorSuffix;
296 errorSuffix =
" on lane '" + stop.
lane +
"'" + errorSuffix;
313 errorOutput->
inform(
"Invalid duration or end time is given for a stop" + errorSuffix);
324 errorOutput->
inform(
"Invalid bool for 'triggered', 'containerTriggered' or 'parking' for stop" + errorSuffix);
330 std::set<std::string> personIDs;
336 std::set<std::string> containerIDs;
343 }
else if (idx ==
"fit") {
347 if (!ok || stop.
index < 0) {
348 errorOutput->
inform(
"Invalid 'index' for stop" + errorSuffix);
const int STOP_CONTAINER_TRIGGER_SET
virtual void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs)=0
virtual void myEndElement(int element)
Called when a closing tag occurs.
const int VEHPARS_FORCE_REROUTE
static void parseStringSet(const std::string &def, std::set< std::string > &into)
Splits the given string, stores it in a set.
description of a vehicle type
std::string containerstop
(Optional) container stop if one is assigned to the stop
int repetitionNumber
The number of times the vehicle shall be repeatedly inserted.
bool parking
whether the vehicle is removed from the net while stopping
SUMOTime myFirstDepart
the first read departure time
a flow definition (used by router)
SUMOTime duration
The stopping duration.
SUMOVehicleParameter * myVehicleParameter
Parameter of the current vehicle, trip, person, container or flow.
SUMOTime myEndDefault
The default value for flow ends.
virtual void addStop(const SUMOSAXAttributes &attrs)=0
Processing of a stop.
const std::string & getFileName() const
returns the current file name
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false)
Parses a vehicle's attributes.
SUMOVTypeParameter * myCurrentVType
The currently parsed vehicle type.
weights: time range begin
SUMOTime until
The time at which the vehicle may continue its journey.
virtual void openRouteDistribution(const SUMOSAXAttributes &attrs)=0
void registerLastDepart()
save last depart (only to be used if vehicle is not discarded)
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
std::string myActiveRouteID
The id of the current route.
SAX-handler base for SUMO-files.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
std::string parkingarea
(Optional) parking area if one is assigned to the stop
begin/end of the description of a route
SUMOTime getLastDepart() const
Returns the last loaded depart time.
#define WRITE_WARNING(msg)
IDSupplier myIdSupplier
generates numerical ids
static OptionsCont & getOptions()
Retrieves the options.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
std::string busstop
(Optional) bus stop if one is assigned to the stop
SUMOTime myBeginDefault
The default value for flow begins.
std::string getNext()
Returns the next id.
virtual void closeVehicle()=0
Ends the processing of a vehicle.
virtual void closeContainer()=0
Ends the processing of a container.
Encapsulated SAX-Attributes.
static SUMOVehicleParameter * parseFlowAttributes(const SUMOSAXAttributes &attrs, const SUMOTime beginDefault, const SUMOTime endDefault)
Parses a flow's attributes.
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
std::string chargingStation
(Optional) charging station if one is assigned to the stop
parameter associated to a certain key
void addParam(const SUMOSAXAttributes &attrs)
assign arbitrary vehicle parameters
bool triggered
whether an arriving person lets the vehicle continue
virtual ~SUMORouteHandler()
standard destructor
SUMOTime depart
The vehicle's departure time.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime string2time(const std::string &r)
const int STOP_EXPECTED_SET
SUMORouteHandler(const std::string &file)
standard constructor
bool containerTriggered
whether an arriving container lets the vehicle continue
std::string line
The vehicle's line (mainly for public transport)
std::string lane
The lane to stop at.
virtual void closeRoute(const bool mayBeDisconnected=false)=0
void addParameter(const std::string &key, const std::string &value)
Adds a parameter.
const int STOP_PARKING_SET
static bool checkStopPos(double &startPos, double &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check start and end position of a stop
const int STOP_TRIGGER_SET
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.
static void closeVTypeParsing(SUMOVTypeParameter &vtype)
Closes parsing of the vehicle type.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
virtual void closeVehicleTypeDistribution()=0
const int STOP_EXPECTED_CONTAINERS_SET
SUMOTime myLastDepart
The insertion time of the vehicle read last.
int setParameter
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
SUMOTime getOptSUMOTimeReporting(int attr, const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
Definition of vehicle stop (position and duration)
bool parseStop(SUMOVehicleParameter::Stop &stop, const SUMOSAXAttributes &attrs, std::string errorSuffix, MsgHandler *const errorOutput)
parses attributes common to all stops
void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
int index
at which position in the stops list
virtual void closeRouteDistribution()=0
int setParameter
Information for the output which parameter were set.
virtual void closeFlow()=0
Ends the processing of a flow.
an aggreagated-output interval
virtual void closePerson()=0
Ends the processing of a person.
a single trip definition (used by router)
static SUMOVTypeParameter * beginVTypeParsing(const SUMOSAXAttributes &attrs, const std::string &file)
Starts to parse a vehicle type.
distribution of a vehicle type
bool checkLastDepart()
Checks whether the route file is sorted by departure time if needed.
std::string id
The vehicle's id.
virtual void openRoute(const SUMOSAXAttributes &attrs)=0