Eclipse SUMO - Simulation of Urban MObility
SUMORouteHandler.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
21 // Parser for routes during their loading
22 /****************************************************************************/
23 #include <config.h>
24 
29 #include <utils/xml/XMLSubSys.h>
30 
31 #include "SUMORouteHandler.h"
32 
33 
34 // ===========================================================================
35 // method definitions
36 // ===========================================================================
37 
38 SUMORouteHandler::SUMORouteHandler(const std::string& file, const std::string& expectedRoot, const bool hardFail) :
39  SUMOSAXHandler(file, expectedRoot),
40  myHardFail(hardFail),
41  myVehicleParameter(nullptr),
42  myLastDepart(-1),
43  myActiveRouteColor(nullptr),
44  myCurrentCosts(0.),
45  myCurrentVType(nullptr),
46  myBeginDefault(string2time(OptionsCont::getOptions().getString("begin"))),
47  myEndDefault(string2time(OptionsCont::getOptions().getString("end"))),
48  myFirstDepart(-1),
49  myInsertStopEdgesAt(-1) {
50 }
51 
52 
54  delete myCurrentVType;
55 }
56 
57 
58 bool
62  WRITE_WARNING("Route file should be sorted by departure time, ignoring '" + myVehicleParameter->id + "'!");
63  return false;
64  }
65  }
66  return true;
67 }
68 
69 
70 void
72  // register only non public transport to parse all public transport lines in advance
75  if (myFirstDepart == -1) {
77  }
78  }
79  // else: we don't know when this vehicle will depart. keep the previous known depart time
80 }
81 
82 
83 void
85  switch (element) {
86  case SUMO_TAG_VEHICLE:
87  // delete if myVehicleParameter isn't null
88  if (myVehicleParameter) {
89  delete myVehicleParameter;
90  }
91  // create a new vehicle
93  break;
94  case SUMO_TAG_PERSON:
95  // delete if myVehicleParameter isn't null
96  if (myVehicleParameter) {
97  delete myVehicleParameter;
98  }
99  // create a new person
101  addPerson(attrs);
102  break;
103  case SUMO_TAG_CONTAINER:
104  // delete if myVehicleParameter isn't null
105  if (myVehicleParameter) {
106  delete myVehicleParameter;
107  }
108  // create a new container
110  addContainer(attrs);
111  break;
112  case SUMO_TAG_FLOW:
113  // delete if myVehicleParameter isn't null
114  if (myVehicleParameter) {
115  delete myVehicleParameter;
116  }
117  // parse vehicle parameters
119  // check if myVehicleParameter was sucesfully created
120  if (myVehicleParameter) {
121  // check tag
122  if (myVehicleParameter->routeid.empty()) {
123  // open a route flow (It could be a flow with embebbed route)
124  openFlow(attrs);
125  } else {
126  // open a route flow
127  openRouteFlow(attrs);
128  }
129  }
130  break;
131  case SUMO_TAG_PERSONFLOW:
132  // delete if myVehicleParameter isn't null
133  if (myVehicleParameter) {
134  delete myVehicleParameter;
135  }
136  // create a new flow
138  break;
139  case SUMO_TAG_VTYPE:
140  // delete if myCurrentVType isn't null
141  if (myCurrentVType != nullptr) {
142  delete myCurrentVType;
143  myCurrentVType = nullptr;
144  }
145  // create a new vType
147  break;
150  break;
151  case SUMO_TAG_ROUTE:
152  openRoute(attrs);
153  break;
155  openRouteDistribution(attrs);
156  break;
157  case SUMO_TAG_STOP:
158  addStop(attrs);
159  break;
160  case SUMO_TAG_TRIP: {
161  // delete if myVehicleParameter isn't null
162  if (myVehicleParameter) {
163  delete myVehicleParameter;
164  }
165  // parse vehicle parameters
167  // check if myVehicleParameter was sucesfully created
168  if (myVehicleParameter) {
171  // open trip
172  openTrip(attrs);
173  }
174  break;
175  }
176  case SUMO_TAG_PERSONTRIP:
177  addPersonTrip(attrs);
178  break;
179  case SUMO_TAG_WALK:
180  addWalk(attrs);
181  break;
182  case SUMO_TAG_INTERVAL: {
183  bool ok;
185  myEndDefault = attrs.getSUMOTimeReporting(SUMO_ATTR_END, nullptr, ok);
186  break;
187  }
188  case SUMO_TAG_RIDE:
189  addRide(attrs);
190  break;
191  case SUMO_TAG_TRANSPORT:
192  addTransport(attrs);
193  break;
194  case SUMO_TAG_TRANSHIP:
195  addTranship(attrs);
196  break;
197  case SUMO_TAG_PARAM:
198  addParam(attrs);
199  break;
200  default:
201  // parse embedded car following model information
202  if (myCurrentVType != nullptr) {
203  WRITE_WARNING("Defining car following parameters in a nested element is deprecated in vType '" + myCurrentVType->id + "', use attributes instead!");
205  if (myHardFail) {
206  throw ProcessError("Invalid parsing embedded VType");
207  } else {
208  WRITE_ERROR("Invalid parsing embedded VType");
209  }
210  }
211  }
212  break;
213  }
214 }
215 
216 
217 void
219  switch (element) {
220  case SUMO_TAG_ROUTE:
221  closeRoute();
222  break;
223  case SUMO_TAG_VTYPE:
224  closeVType();
225  delete myCurrentVType;
226  myCurrentVType = nullptr;
227  break;
228  case SUMO_TAG_PERSON:
229  closePerson();
230  delete myVehicleParameter;
231  myVehicleParameter = nullptr;
232  break;
233  case SUMO_TAG_PERSONFLOW:
234  closePersonFlow();
235  delete myVehicleParameter;
236  myVehicleParameter = nullptr;
237  break;
238  case SUMO_TAG_CONTAINER:
239  closeContainer();
240  delete myVehicleParameter;
241  myVehicleParameter = nullptr;
242  break;
243  case SUMO_TAG_VEHICLE:
244  if (myVehicleParameter == nullptr) {
245  break;
246  }
248  myVehicleParameter->repetitionNumber++; // for backwards compatibility
249  // it is a flow, thus no break here
250  FALLTHROUGH;
251  } else {
252  closeVehicle();
253  delete myVehicleParameter;
254  myVehicleParameter = nullptr;
255  break;
256  }
257  case SUMO_TAG_FLOW:
258  closeFlow();
259  delete myVehicleParameter;
260  myVehicleParameter = nullptr;
261  myInsertStopEdgesAt = -1;
262  break;
263  case SUMO_TAG_TRIP:
264  closeTrip();
265  delete myVehicleParameter;
266  myVehicleParameter = nullptr;
267  myInsertStopEdgesAt = -1;
268  break;
271  break;
274  break;
275  case SUMO_TAG_INTERVAL:
276  myBeginDefault = string2time(OptionsCont::getOptions().getString("begin"));
277  myEndDefault = string2time(OptionsCont::getOptions().getString("end"));
278  break;
279  default:
280  break;
281  }
282 }
283 
284 
286 SUMORouteHandler::checkStopPos(double& startPos, double& endPos, const double laneLength, const double minLength, const bool friendlyPos) {
287  if (minLength > laneLength) {
289  }
290  if (startPos < 0) {
291  startPos += laneLength;
292  }
293  if (endPos < 0) {
294  endPos += laneLength;
295  }
296  if ((endPos < minLength) || (endPos > laneLength)) {
297  if (!friendlyPos) {
298  return STOPPOS_INVALID_ENDPOS;
299  }
300  if (endPos < minLength) {
301  endPos = minLength;
302  }
303  if (endPos > laneLength) {
304  endPos = laneLength;
305  }
306  }
307  if ((startPos < 0) || (startPos > (endPos - minLength))) {
308  if (!friendlyPos) {
310  }
311  if (startPos < 0) {
312  startPos = 0;
313  }
314  if (startPos > (endPos - minLength)) {
315  startPos = endPos - minLength;
316  }
317  }
318  return STOPPOS_VALID;
319 }
320 
321 
322 bool
323 SUMORouteHandler::isStopPosValid(const double startPos, const double endPos, const double laneLength, const double minLength, const bool friendlyPos) {
324  // declare dummy start and end positions
325  double dummyStartPos = startPos;
326  double dummyEndPos = endPos;
327  // return checkStopPos
328  return (checkStopPos(dummyStartPos, dummyEndPos, laneLength, minLength, friendlyPos) == STOPPOS_VALID);
329 }
330 
331 
332 SUMOTime
334  return myFirstDepart;
335 }
336 
337 
338 SUMOTime
340  return myLastDepart;
341 }
342 
343 
344 void
346  bool ok = true;
347  const std::string key = attrs.get<std::string>(SUMO_ATTR_KEY, nullptr, ok);
348  // only continue if key isn't empty
349  if (ok && (key.size() > 0)) {
350  // circumventing empty string test
351  const std::string val = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : "";
352  // add parameter in current created element, or in myLoadedParameterised
353  if (myVehicleParameter != nullptr) {
354  myVehicleParameter->setParameter(key, val);
355  } else if (myCurrentVType != nullptr) {
356  myCurrentVType->setParameter(key, val);
357  } else {
359  }
360  }
361 }
362 
363 
364 bool
365 SUMORouteHandler::parseStop(SUMOVehicleParameter::Stop& stop, const SUMOSAXAttributes& attrs, std::string errorSuffix, MsgHandler* const errorOutput) {
366  stop.parametersSet = 0;
367  if (attrs.hasAttribute(SUMO_ATTR_ARRIVAL)) {
369  }
370  if (attrs.hasAttribute(SUMO_ATTR_DURATION)) {
372  }
373  if (attrs.hasAttribute(SUMO_ATTR_UNTIL)) {
375  }
376  if (attrs.hasAttribute(SUMO_ATTR_EXTENSION)) {
378  }
379  if (attrs.hasAttribute(SUMO_ATTR_ENDPOS)) {
380  stop.parametersSet |= STOP_END_SET;
381  }
382  if (attrs.hasAttribute(SUMO_ATTR_STARTPOS)) {
384  }
385  if (attrs.hasAttribute(SUMO_ATTR_TRIGGERED)) {
387  }
388  // legacy attribute
391  }
392  if (attrs.hasAttribute(SUMO_ATTR_PARKING)) {
394  }
395  if (attrs.hasAttribute(SUMO_ATTR_EXPECTED)) {
397  }
400  }
401  if (attrs.hasAttribute(SUMO_ATTR_TRIP_ID)) {
403  }
404  if (attrs.hasAttribute(SUMO_ATTR_SPLIT)) {
406  }
407  if (attrs.hasAttribute(SUMO_ATTR_JOIN)) {
409  }
410  if (attrs.hasAttribute(SUMO_ATTR_LINE)) {
412  }
413  if (attrs.hasAttribute(SUMO_ATTR_SPEED)) {
415  }
416  bool ok = true;
417  stop.busstop = attrs.getOpt<std::string>(SUMO_ATTR_BUS_STOP, nullptr, ok, "");
418  stop.chargingStation = attrs.getOpt<std::string>(SUMO_ATTR_CHARGING_STATION, nullptr, ok, "");
419  stop.overheadWireSegment = attrs.getOpt<std::string>(SUMO_ATTR_OVERHEAD_WIRE_SEGMENT, nullptr, ok, "");
420  stop.containerstop = attrs.getOpt<std::string>(SUMO_ATTR_CONTAINER_STOP, nullptr, ok, "");
421  stop.parkingarea = attrs.getOpt<std::string>(SUMO_ATTR_PARKING_AREA, nullptr, ok, "");
422  if (stop.busstop != "") {
423  errorSuffix = " at '" + stop.busstop + "'" + errorSuffix;
424  } else if (stop.chargingStation != "") {
425  errorSuffix = " at '" + stop.chargingStation + "'" + errorSuffix;
426  } else if (stop.overheadWireSegment != "") {
427  errorSuffix = " at '" + stop.overheadWireSegment + "'" + errorSuffix;
428  } else if (stop.containerstop != "") {
429  errorSuffix = " at '" + stop.containerstop + "'" + errorSuffix;
430  } else if (stop.parkingarea != "") {
431  errorSuffix = " at '" + stop.parkingarea + "'" + errorSuffix;
432  } else {
433  errorSuffix = " on lane '" + stop.lane + "'" + errorSuffix;
434  }
435  // speed for counting as stopped
436  stop.speed = attrs.getOpt<double>(SUMO_ATTR_SPEED, nullptr, ok, 0);
437  if (stop.speed < 0) {
438  errorOutput->inform("Speed cannot be negative for stop" + errorSuffix);
439  return false;
440  }
441 
442  // get the standing duration
443  bool expectTrigger = !attrs.hasAttribute(SUMO_ATTR_DURATION) && !attrs.hasAttribute(SUMO_ATTR_UNTIL) && !attrs.hasAttribute(SUMO_ATTR_SPEED);
444  std::vector<std::string> triggers = attrs.getOptStringVector(SUMO_ATTR_TRIGGERED, nullptr, ok);
445  // legacy
446  if (attrs.getOpt<bool>(SUMO_ATTR_CONTAINER_TRIGGERED, nullptr, ok, false)) {
447  triggers.push_back(toString(SUMO_TAG_CONTAINER));
448  };
449  SUMOVehicleParameter::parseStopTriggers(triggers, expectTrigger, stop);
450  stop.arrival = attrs.getOptSUMOTimeReporting(SUMO_ATTR_ARRIVAL, nullptr, ok, -1);
451  stop.duration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_DURATION, nullptr, ok, -1);
452  stop.until = attrs.getOptSUMOTimeReporting(SUMO_ATTR_UNTIL, nullptr, ok, -1);
453  if (!expectTrigger && (!ok || (stop.duration < 0 && stop.until < 0 && stop.speed == 0))) {
454  errorOutput->inform("Invalid duration or end time is given for a stop" + errorSuffix);
455  return false;
456  }
457  stop.extension = attrs.getOptSUMOTimeReporting(SUMO_ATTR_EXTENSION, nullptr, ok, -1);
458  stop.parking = attrs.getOpt<bool>(SUMO_ATTR_PARKING, nullptr, ok, stop.triggered || stop.containerTriggered || stop.parkingarea != "");
459  if (stop.parkingarea != "" && !stop.parking) {
460  WRITE_WARNING("Stop at parkingarea overrides attribute 'parking' for stop" + errorSuffix);
461  stop.parking = true;
462  }
463  if (!ok) {
464  errorOutput->inform("Invalid bool for 'triggered', 'containerTriggered' or 'parking' for stop" + errorSuffix);
465  return false;
466  }
467 
468  // expected persons
469  const std::vector<std::string>& expected = attrs.getOptStringVector(SUMO_ATTR_EXPECTED, nullptr, ok);
470  stop.awaitedPersons.insert(expected.begin(), expected.end());
471  if (stop.awaitedPersons.size() > 0 && (stop.parametersSet & STOP_TRIGGER_SET) == 0) {
472  stop.triggered = true;
473  if ((stop.parametersSet & STOP_PARKING_SET) == 0) {
474  stop.parking = true;
475  }
476  }
477 
478  // expected containers
479  const std::vector<std::string>& expectedContainers = attrs.getOptStringVector(SUMO_ATTR_EXPECTED_CONTAINERS, nullptr, ok);
480  stop.awaitedContainers.insert(expectedContainers.begin(), expectedContainers.end());
481  if (stop.awaitedContainers.size() > 0 && (stop.parametersSet & STOP_CONTAINER_TRIGGER_SET) == 0) {
482  stop.containerTriggered = true;
483  if ((stop.parametersSet & STOP_PARKING_SET) == 0) {
484  stop.parking = true;
485  }
486  }
487  // public transport trip id
488  stop.tripId = attrs.getOpt<std::string>(SUMO_ATTR_TRIP_ID, nullptr, ok, "");
489  stop.split = attrs.getOpt<std::string>(SUMO_ATTR_SPLIT, nullptr, ok, "");
490  stop.join = attrs.getOpt<std::string>(SUMO_ATTR_JOIN, nullptr, ok, "");
491  stop.line = attrs.getOpt<std::string>(SUMO_ATTR_LINE, nullptr, ok, "");
492 
493  const std::string idx = attrs.getOpt<std::string>(SUMO_ATTR_INDEX, nullptr, ok, "end");
494  if (idx == "end") {
495  stop.index = STOP_INDEX_END;
496  } else if (idx == "fit") {
497  stop.index = STOP_INDEX_FIT;
498  } else {
499  stop.index = attrs.get<int>(SUMO_ATTR_INDEX, nullptr, ok);
500  if (!ok || stop.index < 0) {
501  errorOutput->inform("Invalid 'index' for stop" + errorSuffix);
502  return false;
503  }
504  }
505  stop.depart = attrs.getOptSUMOTimeReporting(SUMO_ATTR_DEPART, nullptr, ok, -1);
506  stop.actualArrival = attrs.getOptSUMOTimeReporting(SUMO_ATTR_ACTUALARRIVAL, nullptr, ok, -1);
507  return true;
508 }
509 
510 
511 /****************************************************************************/
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:284
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:276
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
long long int SUMOTime
Definition: SUMOTime.h:31
const int STOP_ARRIVAL_SET
const int STOP_DURATION_SET
const int STOP_INDEX_END
const int STOP_EXPECTED_SET
const int STOP_SPEED_SET
const int STOP_UNTIL_SET
const int STOP_LINE_SET
const int STOP_PARKING_SET
const int STOP_TRIP_ID_SET
const int STOP_SPLIT_SET
const int STOP_START_SET
const int STOP_JOIN_SET
const int STOP_CONTAINER_TRIGGER_SET
const int STOP_EXTENSION_SET
const int VEHPARS_FORCE_REROUTE
const int STOP_INDEX_FIT
const int STOP_TRIGGER_SET
const int STOP_END_SET
const int STOP_EXPECTED_CONTAINERS_SET
@ DEPART_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 type
@ SUMO_TAG_WALK
@ SUMO_TAG_TRANSHIP
@ 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 definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_TRANSPORT
@ SUMO_TAG_CONTAINER
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_RIDE
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_TAG_PERSON
@ SUMO_TAG_PERSONTRIP
@ SUMO_TAG_PERSONFLOW
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_ATTR_CONTAINER_TRIGGERED
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_PARKING
@ SUMO_ATTR_EXTENSION
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_VALUE
@ SUMO_ATTR_CONTAINER_STOP
@ SUMO_ATTR_PARKING_AREA
@ SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_ENDPOS
@ SUMO_ATTR_SPLIT
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_EXPECTED
@ SUMO_ATTR_LINE
@ SUMO_ATTR_CHARGING_STATION
@ SUMO_ATTR_OVERHEAD_WIRE_SEGMENT
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_ARRIVAL
@ SUMO_ATTR_TRIP_ID
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_JOIN
@ SUMO_ATTR_ACTUALARRIVAL
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_UNTIL
@ SUMO_ATTR_TRIGGERED
@ SUMO_ATTR_DURATION
@ SUMO_ATTR_KEY
#define FALLTHROUGH
Definition: StdDefs.h:34
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
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
Definition: MsgHandler.cpp:117
A storage for options typed value containers)
Definition: OptionsCont.h:89
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
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
enum for stops
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
std::string myActiveRouteID
The id of the current route.
virtual void addPerson(const SUMOSAXAttributes &attrs)=0
Processing of a person.
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.
Parameterised myLoadedParameterised
Parameterised used for saving loaded generic parameters that aren't saved in Vehicles or Vehicle Type...
virtual void closePersonFlow()=0
Ends the processing of a person.
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
virtual void addContainer(const SUMOSAXAttributes &attrs)=0
Processing of a container.
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 addStop(const SUMOSAXAttributes &attrs)=0
Processing 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 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 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
bool checkLastDepart()
Checks whether the route file is sorted by departure time if needed.
Encapsulated SAX-Attributes.
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.
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 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.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
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)
std::string lane
The lane to stop at.
SUMOTime extension
The maximum time extension for boarding / loading.
SUMOTime depart
the time at which this stop was ended
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
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
int parametersSet
Information for the output which parameter were set.
int index
at which position in the stops list
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
SUMOTime actualArrival
the time at which this stop was reached
SUMOTime until
The time at which the vehicle may continue its journey.
bool triggered
whether an arriving person lets the vehicle continue
bool parking
whether the vehicle is removed from the net while stopping
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
SUMOTime arrival
The (expected) time at which the vehicle reaches the stop.
SUMOTime duration
The stopping duration.
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 parseVTypeEmbedded(SUMOVTypeParameter &into, const SumoXMLTag element, const SUMOSAXAttributes &attrs, const bool hardFail, const bool fromVType=false)
Parses an element embedded in vtype definition.
static SUMOVehicleParameter * parseFlowAttributes(SumoXMLTag tag, const SUMOSAXAttributes &attrs, const bool hardFail, const SUMOTime beginDefault, const SUMOTime endDefault, bool isPerson=false)
Parses a flow's attributes.
static SUMOVehicleParameter * parseVehicleAttributes(int element, const SUMOSAXAttributes &attrs, const bool hardFail, const bool optionalID=false, const bool skipDepart=false)
Parses a vehicle's attributes.