49 myVehicleParameter(nullptr),
51 myActiveRouteColor(nullptr),
53 myCurrentVType(nullptr),
57 myInsertStopEdgesAt(-1) {
207 WRITE_WARNING(
"Defining car following parameters in a nested element is deprecated in vType '" +
myCurrentVType->
id +
"', use attributes instead!");
291 const double minLength,
const bool friendlyPos) {
292 if (minLength > laneLength) {
296 startPos += laneLength;
299 endPos += laneLength;
301 if (endPos < minLength || endPos > laneLength) {
305 if (endPos < minLength) {
308 if (endPos > laneLength) {
312 if (startPos < 0 || startPos > endPos - minLength) {
319 if (startPos > endPos - minLength) {
320 startPos = endPos - minLength;
392 errorSuffix =
" at '" + stop.
busstop +
"'" + errorSuffix;
396 errorSuffix =
" at '" + stop.
containerstop +
"'" + errorSuffix;
398 errorSuffix =
" at '" + stop.
parkingarea +
"'" + errorSuffix;
400 errorSuffix =
" on lane '" + stop.
lane +
"'" + errorSuffix;
417 errorOutput->
inform(
"Invalid duration or end time is given for a stop" + errorSuffix);
425 WRITE_WARNING(
"Stop at parkingarea overrides attribute 'parking' for stop" + errorSuffix);
429 errorOutput->
inform(
"Invalid bool for 'triggered', 'containerTriggered' or 'parking' for stop" + errorSuffix);
445 stop.
awaitedContainers.insert(expectedContainers.begin(), expectedContainers.end());
459 }
else if (idx ==
"fit") {
463 if (!ok || stop.
index < 0) {
464 errorOutput->
inform(
"Invalid 'index' for stop" + errorSuffix);
const int STOP_CONTAINER_TRIGGER_SET
virtual void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs)=0
opens a type distribution for reading
virtual void addPersonTrip(const SUMOSAXAttributes &attrs)=0
add a routing request for a walking or intermodal person
SumoXMLTag
Numbers representing SUMO-XML - element names.
virtual void myEndElement(int element)
Called when a closing tag occurs.
std::string lane
The lane to stop at.
const int VEHPARS_FORCE_REROUTE
description of a vehicle type
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
virtual void closeVType()=0
Ends the processing of a vehicle type.
SUMOTime myFirstDepart
the first read departure time
a flow definitio nusing a from-to edges instead of a route (used by router)
SUMOVehicleParameter * myVehicleParameter
Parameter of the current vehicle, trip, person, container or flow.
SUMOTime myEndDefault
The default value for flow ends.
static SUMOVTypeParameter * beginVTypeParsing(const SUMOSAXAttributes &attrs, const bool hardFail, const std::string &file)
Starts to parse a vehicle type.
virtual void addStop(const SUMOSAXAttributes &attrs)=0
Processing of a stop.
const std::string & getFileName() const
returns the current file name
std::string line
the new line id of the trip within a cyclical public transport route
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, const bool hardFail, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false)
Parses a vehicle's attributes.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
SUMOVTypeParameter * myCurrentVType
The currently parsed vehicle type.
virtual void addContainer(const SUMOSAXAttributes &attrs)=0
Processing of a container.
virtual void closeTrip()=0
Ends the processing of a trip.
virtual void openTrip(const SUMOSAXAttributes &attrs)=0
opens a trip for reading
weights: time range begin
std::string busstop
(Optional) bus stop if one is assigned to the stop
int parametersSet
Information for the output which parameter were set.
virtual void openRouteDistribution(const SUMOSAXAttributes &attrs)=0
opens a route distribution for reading
void registerLastDepart()
save last depart (only to be used if vehicle is not discarded)
std::string myActiveRouteID
The id of the current route.
virtual void addTranship(const SUMOSAXAttributes &attrs)=0
Processing of a tranship.
SAX-handler base for SUMO-files.
int myInsertStopEdgesAt
where stop edges can be inserted into the current route (-1 means no insertion)
std::string parkingarea
(Optional) parking area if one is assigned to the stop
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.
begin/end of the description of a route
SUMOTime getLastDepart() const
Returns the last loaded depart time.
#define WRITE_WARNING(msg)
bool triggered
whether an arriving person lets the vehicle continue
static OptionsCont & getOptions()
Retrieves the options.
std::string tripId
id of the trip within a cyclical public transport route
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMOTime getFirstDepart() const
returns the first departure time that was ever read
virtual void addRide(const SUMOSAXAttributes &attrs)=0
Processing of a ride.
SUMOTime myBeginDefault
The default value for flow begins.
virtual void closePersonFlow()=0
Ends the processing of a person.
virtual void closeVehicle()=0
Ends the processing of a vehicle.
virtual void addTransport(const SUMOSAXAttributes &attrs)=0
Processing of a transport.
virtual void closeContainer()=0
Ends the processing of a container.
Encapsulated SAX-Attributes.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
parameter associated to a certain key
void addParam(const SUMOSAXAttributes &attrs)
assign arbitrary vehicle parameters
virtual ~SUMORouteHandler()
standard destructor
SUMOTime until
The time at which the vehicle may continue its journey.
static SUMOVehicleParameter * parseFlowAttributes(const SUMOSAXAttributes &attrs, const bool hardFail, const SUMOTime beginDefault, const SUMOTime endDefault, bool isPerson=false)
Parses a flow's attributes.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime string2time(const std::string &r)
const int STOP_TRIP_ID_SET
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
const int STOP_EXPECTED_SET
const std::vector< std::string > getOptStringVector(int attr, const char *objectid, bool &ok, bool report=true) const
convenience function to avoid the default argument and the template stuff at getOpt<> ...
std::string line
The vehicle's line (mainly for public transport)
Definition of vehicle stop (position and duration)
int index
at which position in the stops list
virtual void closeRoute(const bool mayBeDisconnected=false)=0
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.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
virtual void closeVehicleTypeDistribution()=0
closes (ends) the building of a distribution
const int STOP_EXPECTED_CONTAINERS_SET
bool containerTriggered
whether an arriving container lets the vehicle continue
SUMOTime myLastDepart
The insertion time of the vehicle read last.
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.
bool parseStop(SUMOVehicleParameter::Stop &stop, const SUMOSAXAttributes &attrs, std::string errorSuffix, MsgHandler *const errorOutput)
parses attributes common to all stops
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
Utility methods for initialising, closing and using the XML-subsystem.
virtual void closeRouteDistribution()=0
closes (ends) the building of a distribution
std::string id
The vehicle type's id.
Parameterised myLoadedParameterised
Parameterised used for saving loaded generic parameters that aren't saved in Vehicles or Vehicle Type...
virtual void closeFlow()=0
Ends the processing of a flow.
an aggreagated-output interval
virtual void closePerson()=0
Ends the processing of a person.
const bool myHardFail
flag to enable or disable hard fails
a single trip definition (used by router)
std::string chargingStation
(Optional) charging station if one is assigned to the stop
std::string containerstop
(Optional) container stop if one is assigned to the stop
virtual void addPerson(const SUMOSAXAttributes &attrs)=0
Processing of a person.
distribution of a vehicle type
virtual void addWalk(const SUMOSAXAttributes &attrs)=0
add a fully specified walk
bool checkLastDepart()
Checks whether the route file is sorted by departure time if needed.
SUMOTime duration
The stopping duration.
bool parking
whether the vehicle is removed from the net while stopping
std::string id
The vehicle's id.
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
virtual void openRoute(const SUMOSAXAttributes &attrs)=0
opens a route for reading
SUMORouteHandler(const std::string &file, const std::string &expectedRoot, const bool hardFail)
standard constructor
static bool parseVTypeEmbedded(SUMOVTypeParameter &into, const SumoXMLTag element, const SUMOSAXAttributes &attrs, const bool hardFail, const bool fromVType=false)
Parses an element embedded in vtype definition.