41 myVehicleParameter(nullptr),
43 myActiveRouteColor(nullptr),
45 myCurrentVType(nullptr),
49 myInsertStopEdgesAt(-1),
50 myAllowInternalRoutes(false) {
317 if (minLength > laneLength) {
321 startPos += laneLength;
324 endPos += laneLength;
326 if ((endPos < minLength) || (endPos > laneLength)) {
330 if (endPos < minLength) {
333 if (endPos > laneLength) {
337 if ((startPos < 0) || (startPos > (endPos - minLength))) {
344 if (startPos > (endPos - minLength)) {
345 startPos = endPos - minLength;
355 double dummyStartPos = startPos;
356 double dummyEndPos = endPos;
379 if (ok && (key.size() > 0)) {
468 errorSuffix =
" at '" + stop.
busstop +
"'" + errorSuffix;
474 errorSuffix =
" at '" + stop.
containerstop +
"'" + errorSuffix;
476 errorSuffix =
" at '" + stop.
parkingarea +
"'" + errorSuffix;
478 errorSuffix =
" on lane '" + attrs.
get<std::string>(
SUMO_ATTR_LANE,
nullptr, ok) +
"'" + errorSuffix;
480 errorSuffix =
" on edge '" + attrs.
get<std::string>(
SUMO_ATTR_EDGE,
nullptr, ok) +
"'" + errorSuffix;
482 errorSuffix =
" at undefined location" + errorSuffix;
486 if (stop.
speed < 0) {
487 errorOutput->
inform(
TLF(
"Speed cannot be negative for stop%.", errorSuffix));
502 if (!expectTrigger && (!ok || (stop.
duration < 0 && stop.
until < 0 && stop.
speed == 0))) {
503 errorOutput->
inform(
TLF(
"Invalid duration or end time is given for a stop%.", errorSuffix));
506 if (triggers.size() > 0 && stop.
speed > 0) {
507 errorOutput->
inform(
TLF(
"Triggers and waypoints cannot be combined%.", errorSuffix));
514 WRITE_WARNINGF(
TL(
"Stop at parkingArea overrides attribute 'parking' for stop%."), errorSuffix);
519 const std::vector<std::string>& expected = attrs.
getOpt<std::vector<std::string> >(
SUMO_ATTR_EXPECTED,
nullptr, ok);
530 stop.
permitted.insert(permitted.begin(), permitted.end());
534 stop.
awaitedContainers.insert(expectedContainers.begin(), expectedContainers.end());
550 }
else if (idx ==
"fit") {
554 if (!ok || stop.
index < 0) {
555 errorOutput->
inform(
TLF(
"Invalid 'index' for stop%.", errorSuffix));
#define WRITE_WARNINGF(...)
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
const int STOP_ARRIVAL_SET
const int STOP_DURATION_SET
const int STOP_POSLAT_SET
const int STOP_EXPECTED_SET
const long long int VEHPARS_FORCE_REROUTE
const int STOP_PARKING_SET
const int STOP_TRIP_ID_SET
const int STOP_PERMITTED_SET
const int STOP_EXTENSION_SET
const int STOP_TRIGGER_SET
const int STOP_ONDEMAND_SET
const int STOP_STARTED_SET
const int STOP_EXPECTED_CONTAINERS_SET
@ GIVEN
The time is given.
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_STOP
stop for vehicles
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_TAG_ROUTE_DISTRIBUTION
distribution of a route
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
@ SUMO_TAG_TRIP
a single trip definition (used by router)
ParkingType
Numbers representing special SUMO-XML-attribute values Information on whether a car is parking on the...
@ SUMO_ATTR_CONTAINER_TRIGGERED
@ SUMO_ATTR_CONTAINER_STOP
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_CHARGING_STATION
@ SUMO_ATTR_OVERHEAD_WIRE_SEGMENT
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_EXPECTED_CONTAINERS
const double INVALID_DOUBLE
invalid double
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const std::string & getFileName() const
returns the current file name
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
static OptionsCont & getOptions()
Retrieves the options.
bool parseStop(SUMOVehicleParameter::Stop &stop, const SUMOSAXAttributes &attrs, std::string errorSuffix, MsgHandler *const errorOutput)
parses attributes common to all stops
virtual void openTrip(const SUMOSAXAttributes &attrs)=0
opens a trip for reading
@ STOPPOS_INVALID_LANELENGTH
@ STOPPOS_INVALID_STARTPOS
void registerLastDepart()
save last depart (only to be used if vehicle is not discarded)
virtual void openFlow(const SUMOSAXAttributes &attrs)=0
opens a flow for reading
virtual void closeContainer()=0
Ends the processing of a container.
SUMOTime myFirstDepart
the first read departure time
virtual void addWalk(const SUMOSAXAttributes &attrs)=0
add a fully specified walk
static bool isStopPosValid(const double startPos, const double endPos, const double laneLength, const double minLength, const bool friendlyPos)
check if start and end position of a stop is valid
SUMOTime myBeginDefault
The default value for flow begins.
SUMORouteHandler(const std::string &file, const std::string &expectedRoot, const bool hardFail)
standard constructor
virtual void openRouteDistribution(const SUMOSAXAttributes &attrs)=0
opens a route distribution for reading
bool myAllowInternalRoutes
whether references to internal routes are allowed in this context
std::string myActiveRouteID
The id of the current route.
virtual void openRoute(const SUMOSAXAttributes &attrs)=0
opens a route for reading
virtual void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs)=0
opens a type distribution for reading
virtual ~SUMORouteHandler()
standard destructor
virtual void closeVehicle()=0
Ends the processing of a vehicle.
virtual void closeFlow()=0
Ends the processing of a flow.
virtual void closePersonFlow()=0
Ends the processing of a person flow.
std::vector< Parameterised * > myParamStack
The stack of currently parsed parameterised objects.
SUMOVehicleParameter * myVehicleParameter
Parameter of the current vehicle, trip, person, container or flow.
virtual void addRide(const SUMOSAXAttributes &attrs)=0
Processing of a ride.
virtual void addTranship(const SUMOSAXAttributes &attrs)=0
Processing of a tranship.
SUMOTime getLastDepart() const
Returns the last loaded depart time.
const bool myHardFail
flag to enable or disable hard fails
std::vector< int > myElementStack
hierarchy of elements being parsed
SUMOVTypeParameter * myCurrentVType
The currently parsed vehicle type.
virtual void addTransport(const SUMOSAXAttributes &attrs)=0
Processing of a transport.
virtual void closeRoute(const bool mayBeDisconnected=false)=0
virtual void closePerson()=0
Ends the processing of a person.
SUMOTime myLastDepart
The insertion time of the vehicle read last.
SUMOTime myEndDefault
The default value for flow ends.
virtual void closeVehicleTypeDistribution()=0
closes (ends) the building of a distribution
static StopPos checkStopPos(double &startPos, double &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check start and end position of a stop
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
void addParam(const SUMOSAXAttributes &attrs)
assign arbitrary vehicle parameters
virtual void closeContainerFlow()=0
Ends the processing of a container flow.
virtual Parameterised * addStop(const SUMOSAXAttributes &attrs)=0
Processing of a stop.
virtual void closeTrip()=0
Ends the processing of a trip.
SUMOTime getFirstDepart() const
returns the first departure time that was ever read
virtual void openRouteFlow(const SUMOSAXAttributes &attrs)=0
opens a route flow for reading
int myInsertStopEdgesAt
where stop edges can be inserted into the current route (-1 means no insertion)
virtual void addTransportable(const SUMOSAXAttributes &attrs, const bool isPerson)
Processing of a person or container.
virtual void addPersonTrip(const SUMOSAXAttributes &attrs)=0
add a routing request for a walking or intermodal person
virtual void myEndElement(int element)
Called when a closing tag occurs.
virtual void closeVType()=0
Ends the processing of a vehicle type.
virtual void closeRouteDistribution()=0
closes (ends) the building of a distribution
virtual bool checkLastDepart()
Checks whether the route file is sorted by departure time if needed.
Encapsulated SAX-Attributes.
virtual std::string getString(int id, bool *isPresent=nullptr) const =0
Returns the string-value of the named (by its enum-value) attribute.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue=T(), bool report=true) const
Tries to read given attribute assuming it is an int.
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.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
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.
SAX-handler base for SUMO-files.
std::string id
The vehicle type's id.
Definition of vehicle stop (position and duration)
SUMOTime started
the time at which this stop was reached
ParkingType parking
whether the vehicle is removed from the net while stopping
SUMOTime extension
The maximum time extension for boarding / loading.
double speed
the speed at which this stop counts as reached (waypoint mode)
std::string parkingarea
(Optional) parking area if one is assigned to the stop
std::string split
the id of the vehicle (train portion) that splits of upon reaching this stop
std::string line
the new line id of the trip within a cyclical public transport route
double posLat
the lateral offset when stopping
bool onDemand
whether the stop may be skipped
std::string chargingStation
(Optional) charging station if one is assigned to the stop
std::string overheadWireSegment
(Optional) overhead line segment if one is assigned to the stop
std::set< std::string > permitted
IDs of persons or containers that may board/load at this stop.
int parametersSet
Information for the output which parameter were set.
int index
at which position in the stops list
SUMOTime jump
transfer time if there shall be a jump from this stop to the next route edge
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
SUMOTime until
The time at which the vehicle may continue its journey.
std::string actType
act Type (only used by Persons) (used by netedit)
bool triggered
whether an arriving person lets the vehicle continue
SUMOTime ended
the time at which this stop was ended
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
std::string busstop
(Optional) bus stop if one is assigned to the stop
std::string tripId
id of the trip within a cyclical public transport route
std::string containerstop
(Optional) container stop if one is assigned to the stop
bool containerTriggered
whether an arriving container lets the vehicle continue
bool collision
Whether this stop was triggered by a collision.
SUMOTime arrival
The (expected) time at which the vehicle reaches the stop.
SUMOTime duration
The stopping duration.
long long int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
std::string routeid
The vehicle's route id.
std::string id
The vehicle's id.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
std::string line
The vehicle's line (mainly for public transport)
static void parseStopTriggers(const std::vector< std::string > &triggers, bool expectTrigger, Stop &stop)
parses stop trigger values
static SUMOVTypeParameter * beginVTypeParsing(const SUMOSAXAttributes &attrs, const bool hardFail, const std::string &file)
Starts to parse a vehicle type.
static bool parseCFMParams(SUMOVTypeParameter *into, const SumoXMLTag element, const SUMOSAXAttributes &attrs, const bool nestedCFM)
Parses Car Following Mode params.
static SUMOVehicleParameter * parseVehicleAttributes(int element, const SUMOSAXAttributes &attrs, const bool hardFail, const bool optionalID=false, const bool skipDepart=false, const bool allowInternalRoutes=false)
Parses a vehicle's attributes.
static SUMOVehicleParameter * parseFlowAttributes(SumoXMLTag tag, const SUMOSAXAttributes &attrs, const bool hardFail, const bool needID, const SUMOTime beginDefault, const SUMOTime endDefault, const bool allowInternalRoutes=false)
Parses a flow's attributes.