46 #ifdef CHECK_MEMORY_LEAKS
48 #endif // CHECK_MEMORY_LEAKS
56 myVehicleParameter(0),
58 myActiveRouteColor(0),
62 myFirstDepart(-1), myInsertStopEdgesAt(-1) {
210 const SUMOReal minLength,
const bool friendlyPos) {
211 if (minLength > laneLength) {
215 startPos += laneLength;
218 endPos += laneLength;
220 if (endPos < minLength || endPos > laneLength) {
224 if (endPos < minLength) {
227 if (endPos > laneLength) {
231 if (startPos < 0 || startPos > endPos - minLength) {
238 if (startPos > endPos - minLength) {
239 startPos = endPos - minLength;
287 errorSuffix =
" at '" + stop.
busstop +
"'" + errorSuffix;
289 errorSuffix =
" at '" + stop.
containerstop +
"'" + errorSuffix;
291 errorSuffix =
" on lane '" + stop.
lane +
"'" + errorSuffix;
308 errorOutput->
inform(
"Invalid duration or end time is given for a stop" + errorSuffix);
316 errorOutput->
inform(
"Invalid bool for 'triggered', 'containerTriggered' or 'parking' for stop" + errorSuffix);
322 std::set<std::string> personIDs;
328 std::set<std::string> containerIDs;
335 }
else if (idx ==
"fit") {
339 if (!ok || stop.
index < 0) {
340 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.
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
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.
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false)
Parses a vehicle's attributes.
static bool checkStopPos(SUMOReal &startPos, SUMOReal &endPos, const SUMOReal laneLength, const SUMOReal minLength, const bool friendlyPos)
check start and end position of a stop
SUMOVTypeParameter * myCurrentVType
The currently parsed vehicle type.
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...
#define WRITE_WARNING(msg)
IDSupplier myIdSupplier
generates numerical ids
static OptionsCont & getOptions()
Retrieves the options.
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.
std::string busstop
(Optional) bus stop if one is assigned to the stop
SUMOTime myBeginDefault
The default value for flow begins.
const std::string & getFileName() const
returns the current file name
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.
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
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
bool containerTriggered
whether an arriving container lets the vehicle continue
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
const int STOP_TRIGGER_SET
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.
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.
virtual void closePerson()=0
Ends the processing of a person.
SUMOTime getLastDepart() const
Returns the last loaded depart time.
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.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
static SUMOVTypeParameter * beginVTypeParsing(const SUMOSAXAttributes &attrs, const std::string &file)
Starts to parse 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