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