SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RORouteHandler.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // Parser and container for routes during their loading
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <string>
35 #include <map>
36 #include <vector>
37 #include <iostream>
47 #include <utils/xml/XMLSubSys.h>
49 #include "RONet.h"
50 #include "RORouteHandler.h"
51 
52 #ifdef CHECK_MEMORY_LEAKS
53 #include <foreign/nvwa/debug_new.h>
54 #endif // CHECK_MEMORY_LEAKS
55 
56 
57 // ===========================================================================
58 // method definitions
59 // ===========================================================================
60 RORouteHandler::RORouteHandler(RONet& net, const std::string& file,
61  const bool tryRepair,
62  const bool emptyDestinationsAllowed,
63  const bool ignoreErrors) :
64  SUMORouteHandler(file),
65  myNet(net),
66  myActivePlan(0),
67  myTryRepair(tryRepair),
68  myEmptyDestinationsAllowed(emptyDestinationsAllowed),
69  myErrorOutput(ignoreErrors ? MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()),
70  myCurrentVTypeDistribution(0),
71  myCurrentAlternatives(0) {
72  myActiveRoute.reserve(100);
73 }
74 
75 
77 }
78 
79 
80 void
81 RORouteHandler::parseFromTo(std::string element,
82  const SUMOSAXAttributes& attrs) {
83  bool useTaz = OptionsCont::getOptions().getBool("with-taz");
84  if (useTaz && !myVehicleParameter->wasSet(VEHPARS_TAZ_SET)) {
85  WRITE_WARNING("Taz usage was requested but no taz present in " + element + " '" + myVehicleParameter->id + "'!");
86  useTaz = false;
87  } else if (!useTaz && !attrs.hasAttribute(SUMO_ATTR_FROM) && myVehicleParameter->wasSet(VEHPARS_TAZ_SET)) {
88  WRITE_WARNING("'from' attribute missing using taz for " + element + " '" + myVehicleParameter->id + "'!");
89  useTaz = true;
90  }
91  if (useTaz) {
92  const ROEdge* fromTaz = myNet.getEdge(myVehicleParameter->fromTaz + "-source");
93  if (fromTaz == 0) {
94  myErrorOutput->inform("Source taz '" + myVehicleParameter->fromTaz + "' not known for " + element + " '" + myVehicleParameter->id + "'!");
95  } else if (fromTaz->getNoFollowing() == 0) {
96  myErrorOutput->inform("Source taz '" + myVehicleParameter->fromTaz + "' has no outgoing edges for " + element + " '" + myVehicleParameter->id + "'!");
97  } else {
98  myActiveRoute.push_back(fromTaz);
99  }
100  const ROEdge* toTaz = myNet.getEdge(myVehicleParameter->toTaz + "-sink");
101  if (toTaz == 0) {
102  myErrorOutput->inform("Sink taz '" + myVehicleParameter->toTaz + "' not known for " + element + " '" + myVehicleParameter->id + "'!");
103  } else {
104  myActiveRoute.push_back(toTaz);
105  }
106  } else {
107  bool ok = true;
108  parseEdges(attrs.get<std::string>(SUMO_ATTR_FROM, myVehicleParameter->id.c_str(), ok),
109  myActiveRoute, "for " + element + " '" + myVehicleParameter->id + "'");
110  parseEdges(attrs.get<std::string>(SUMO_ATTR_TO, myVehicleParameter->id.c_str(), ok, !myEmptyDestinationsAllowed),
111  myActiveRoute, "for " + element + " '" + myVehicleParameter->id + "'");
112  }
114  if (myVehicleParameter->routeid == "") {
116  }
117  closeRoute(true);
118 }
119 
120 
121 
122 void
124  const SUMOSAXAttributes& attrs) {
125  SUMORouteHandler::myStartElement(element, attrs);
126  switch (element) {
127  case SUMO_TAG_PERSON:
128  myActivePlan = new OutputDevice_String(false, 1);
130  (*myActivePlan) << attrs;
131  break;
132  case SUMO_TAG_RIDE: {
134  (*myActivePlan) << attrs;
136  break;
137  }
138  case SUMO_TAG_WALK: {
140  (*myActivePlan) << attrs;
142  break;
143  }
144  case SUMO_TAG_FLOW:
145  parseFromTo("flow", attrs);
146  break;
147  case SUMO_TAG_TRIP: {
148  parseFromTo("trip", attrs);
149  closeVehicle();
150  }
151  break;
152  default:
153  break;
154  }
155  // parse embedded vtype information
156  if (myCurrentVType != 0 && element != SUMO_TAG_VTYPE) {
158  return;
159  }
160 }
161 
162 
163 void
165  bool ok = true;
166  myCurrentVTypeDistributionID = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
167  if (ok) {
169  if (attrs.hasAttribute(SUMO_ATTR_VTYPES)) {
170  const std::string vTypes = attrs.get<std::string>(SUMO_ATTR_VTYPES, myCurrentVTypeDistributionID.c_str(), ok);
171  StringTokenizer st(vTypes);
172  while (st.hasNext()) {
173  SUMOVTypeParameter* type = myNet.getVehicleTypeSecure(st.next());
174  myCurrentVTypeDistribution->add(1., type);
175  }
176  }
177  }
178 }
179 
180 
181 void
183  if (myCurrentVTypeDistribution != 0) {
186  myErrorOutput->inform("Vehicle type distribution '" + myCurrentVTypeDistributionID + "' is empty.");
189  myErrorOutput->inform("Another vehicle type (or distribution) with the id '" + myCurrentVTypeDistributionID + "' exists.");
190  }
192  }
193 }
194 
195 
196 void
198  // check whether the id is really necessary
199  std::string rid;
200  if (myCurrentAlternatives != 0) {
202  rid = "distribution '" + myCurrentAlternatives->getID() + "'";
203  } else if (myVehicleParameter != 0) {
204  // ok, a vehicle is wrapping the route,
205  // we may use this vehicle's id as default
206  myVehicleParameter->routeid = myActiveRouteID = "!" + myVehicleParameter->id; // !!! document this
207  if (attrs.hasAttribute(SUMO_ATTR_ID)) {
208  WRITE_WARNING("Ids of internal routes are ignored (vehicle '" + myVehicleParameter->id + "').");
209  }
210  } else {
211  bool ok = true;
212  myActiveRouteID = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
213  if (!ok) {
214  return;
215  }
216  rid = "'" + myActiveRouteID + "'";
217  }
218  if (myVehicleParameter != 0) { // have to do this here for nested route distributions
219  rid = "for vehicle '" + myVehicleParameter->id + "'";
220  }
221  bool ok = true;
222  if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
223  parseEdges(attrs.get<std::string>(SUMO_ATTR_EDGES, myActiveRouteID.c_str(), ok), myActiveRoute, rid);
224  }
225  myActiveRouteRefID = attrs.getOpt<std::string>(SUMO_ATTR_REFID, myActiveRouteID.c_str(), ok, "");
227  myErrorOutput->inform("Invalid reference to route '" + myActiveRouteRefID + "' in route " + rid + ".");
228  }
229  if (myCurrentAlternatives != 0 && !attrs.hasAttribute(SUMO_ATTR_PROB)) {
230  WRITE_WARNING("No probability for a route in '" + rid + "', using default.");
231  }
233  if (ok && myActiveRouteProbability < 0) {
234  myErrorOutput->inform("Invalid probability for route '" + myActiveRouteID + "'.");
235  }
237  ok = true;
238  myCurrentCosts = attrs.getOpt<SUMOReal>(SUMO_ATTR_COST, myActiveRouteID.c_str(), ok, -1);
239  if (ok && myCurrentCosts != -1 && myCurrentCosts < 0) {
240  myErrorOutput->inform("Invalid cost for route '" + myActiveRouteID + "'.");
241  }
242 }
243 
244 
245 void
248  switch (element) {
249  case SUMO_TAG_VTYPE: {
251  if (myCurrentVTypeDistribution != 0) {
253  }
254  }
255  myCurrentVType = 0;
256  }
257  break;
258  default:
259  break;
260  }
261 }
262 
263 
264 void
265 RORouteHandler::closeRoute(const bool mayBeDisconnected) {
266  if (myActiveRoute.size() == 0) {
267  if (myActiveRouteRefID != "" && myCurrentAlternatives != 0) {
269  myActiveRouteID = "";
270  myActiveRouteRefID = "";
271  return;
272  }
273  if (myVehicleParameter != 0) {
274  myErrorOutput->inform("Vehicle's '" + myVehicleParameter->id + "' route has no edges.");
275  } else {
276  myErrorOutput->inform("Route '" + myActiveRouteID + "' has no edges.");
277  }
278  myActiveRouteID = "";
279  myActiveRouteStops.clear();
280  return;
281  }
284  myActiveRoute.clear();
285  if (myCurrentAlternatives == 0) {
286  if (myNet.getRouteDef(myActiveRouteID) != 0) {
287  delete route;
288  if (myVehicleParameter != 0) {
289  myErrorOutput->inform("Another route for vehicle '" + myVehicleParameter->id + "' exists.");
290  } else {
291  myErrorOutput->inform("Another route (or distribution) with the id '" + myActiveRouteID + "' exists.");
292  }
293  myActiveRouteID = "";
294  myActiveRouteStops.clear();
295  return;
296  } else {
297  myCurrentAlternatives = new RORouteDef(myActiveRouteID, 0, mayBeDisconnected || myTryRepair);
301  }
302  } else {
304  }
305  myActiveRouteID = "";
306  myActiveRouteStops.clear();
307 }
308 
309 
310 void
312  // check whether the id is really necessary
313  bool ok = true;
314  std::string id;
315  if (myVehicleParameter != 0) {
316  // ok, a vehicle is wrapping the route,
317  // we may use this vehicle's id as default
318  myVehicleParameter->routeid = id = "!" + myVehicleParameter->id; // !!! document this
319  if (attrs.hasAttribute(SUMO_ATTR_ID)) {
320  WRITE_WARNING("Ids of internal route distributions are ignored (vehicle '" + myVehicleParameter->id + "').");
321  }
322  } else {
323  id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
324  if (!ok) {
325  return;
326  }
327  }
328  // try to get the index of the last element
329  int index = attrs.get<int>(SUMO_ATTR_LAST, id.c_str(), ok);
330  if (ok && index < 0) {
331  myErrorOutput->inform("Negative index of a route alternative (id='" + id + "').");
332  return;
333  }
334  // build the alternative cont
335  myCurrentAlternatives = new RORouteDef(id, index, myTryRepair);
336  if (attrs.hasAttribute(SUMO_ATTR_ROUTES)) {
337  ok = true;
338  StringTokenizer st(attrs.get<std::string>(SUMO_ATTR_ROUTES, id.c_str(), ok));
339  while (st.hasNext()) {
340  const std::string routeID = st.next();
341  const RORouteDef* route = myNet.getRouteDef(routeID);
342  if (route == 0) {
343  myErrorOutput->inform("Unknown route '" + routeID + "' in distribution '" + id + "'.");
344  } else {
346  }
347  }
348  }
349 }
350 
351 
352 void
354  if (myCurrentAlternatives != 0) {
356  myErrorOutput->inform("Route distribution '" + myCurrentAlternatives->getID() + "' is empty.");
357  delete myCurrentAlternatives;
358  } else if (!myNet.addRouteDef(myCurrentAlternatives)) {
359  myErrorOutput->inform("Another route (or distribution) with the id '" + myCurrentAlternatives->getID() + "' exists.");
360  delete myCurrentAlternatives;
361  }
363  }
364 }
365 
366 
367 void
369  // get the vehicle id
371  return;
372  }
373  // get vehicle type
375  // get the route
377  if (route == 0) {
378  myErrorOutput->inform("The route of the vehicle '" + myVehicleParameter->id + "' is not known.");
379  return;
380  }
381  if (route->getID()[0] != '!') {
382  route = route->copy("!" + myVehicleParameter->id);
383  }
384  // build the vehicle
385  if (!MsgHandler::getErrorInstance()->wasInformed()) {
386  ROVehicle* veh = new ROVehicle(*myVehicleParameter, route, type);
389  }
390 }
391 
392 
393 void
398  delete myVehicleParameter;
399  myVehicleParameter = 0;
400  delete myActivePlan;
401  myActivePlan = 0;
402 }
403 
404 
405 void
407  // @todo: consider myScale?
408  // let's check whether vehicles had to depart before the simulation starts
410  SUMOTime offsetToBegin = string2time(OptionsCont::getOptions().getString("begin")) - myVehicleParameter->depart;
414  delete myVehicleParameter;
415  return;
416  }
417  }
420  if (type == 0) {
421  myErrorOutput->inform("The vehicle type '" + myVehicleParameter->vtypeid + "' for vehicle '" + myVehicleParameter->id + "' is not known.");
422  delete myVehicleParameter;
423  return;
424  }
425  if (route == 0) {
426  myErrorOutput->inform("Vehicle '" + myVehicleParameter->id + "' has no route.");
427  delete myVehicleParameter;
428  return;
429  }
430  myActiveRouteID = "";
431  myNet.addFlow(myVehicleParameter, OptionsCont::getOptions().getBool("randomize-flows"));
433  myVehicleParameter = 0;
434 }
435 
436 
437 void
439  if (myActivePlan) {
441  (*myActivePlan) << attrs;
443  return;
444  }
445  bool ok = true;
446  std::string errorSuffix;
447  if (myActiveRouteID != "") {
448  errorSuffix = " in route '" + myActiveRouteID + "'.";
449  } else {
450  errorSuffix = " in vehicle '" + myVehicleParameter->id + "'.";
451  }
454  // try to parse the assigned bus stop
455  stop.busstop = attrs.getOpt<std::string>(SUMO_ATTR_BUS_STOP, 0, ok, "");
456  if (stop.busstop == "") {
457  // no, the lane and the position should be given
458  stop.lane = attrs.getOpt<std::string>(SUMO_ATTR_LANE, 0, ok, "");
459  if (!ok || stop.lane == "") {
460  myErrorOutput->inform("A stop must be placed on a bus stop or a lane" + errorSuffix);
461  return;
462  }
463  ROEdge* edge = myNet.getEdge(stop.lane.substr(0, stop.lane.rfind('_')));
464  if (edge == 0) {
465  myErrorOutput->inform("The lane '" + stop.lane + "' for a stop is not known" + errorSuffix);
466  return;
467  }
468  stop.endPos = attrs.getOpt<SUMOReal>(SUMO_ATTR_ENDPOS, 0, ok, edge->getLength());
469  stop.startPos = attrs.getOpt<SUMOReal>(SUMO_ATTR_STARTPOS, 0, ok, stop.endPos - 2 * POSITION_EPS);
470  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, 0, ok, false);
471  if (!ok || !checkStopPos(stop.startPos, stop.endPos, edge->getLength(), POSITION_EPS, friendlyPos)) {
472  myErrorOutput->inform("Invalid start or end position for stop" + errorSuffix);
473  return;
474  }
475  }
476 
477  // get the standing duration
479  stop.triggered = attrs.getOpt<bool>(SUMO_ATTR_TRIGGERED, 0, ok, true);
480  stop.duration = -1;
481  stop.until = -1;
482  } else {
483  stop.duration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_DURATION, 0, ok, -1);
484  stop.until = attrs.getOptSUMOTimeReporting(SUMO_ATTR_UNTIL, 0, ok, -1);
485  if (!ok || (stop.duration < 0 && stop.until < 0)) {
486  myErrorOutput->inform("Invalid duration or end time is given for a stop" + errorSuffix);
487  return;
488  }
489  stop.triggered = attrs.getOpt<bool>(SUMO_ATTR_TRIGGERED, 0, ok, false);
490  }
491  stop.parking = attrs.getOpt<bool>(SUMO_ATTR_PARKING, 0, ok, stop.triggered);
492  if (!ok) {
493  myErrorOutput->inform("Invalid bool for 'triggered' or 'parking' for stop" + errorSuffix);
494  return;
495  }
496 
497  // expected persons
498  std::string expectedStr = attrs.getOpt<std::string>(SUMO_ATTR_EXPECTED, 0, ok, "");
499  std::set<std::string> personIDs;
500  SUMOSAXAttributes::parseStringSet(expectedStr, personIDs);
501  stop.awaitedPersons = personIDs;
502 
503  const std::string idx = attrs.getOpt<std::string>(SUMO_ATTR_INDEX, 0, ok, "end");
504  if (idx == "end") {
505  stop.index = STOP_INDEX_END;
506  } else if (idx == "fit") {
507  stop.index = STOP_INDEX_FIT;
508  } else {
509  stop.index = attrs.get<int>(SUMO_ATTR_INDEX, 0, ok);
510  if (!ok || stop.index < 0) {
511  myErrorOutput->inform("Invalid 'index' for stop" + errorSuffix);
512  return;
513  }
514  }
515  if (myVehicleParameter != 0) {
516  myVehicleParameter->stops.push_back(stop);
517  } else {
518  myActiveRouteStops.push_back(stop);
519  }
520 }
521 
522 
523 void
524 RORouteHandler::parseEdges(const std::string& desc, std::vector<const ROEdge*>& into,
525  const std::string& rid) {
526  if (desc[0] == BinaryFormatter::BF_ROUTE) {
527  std::istringstream in(desc, std::ios::binary);
528  char c;
529  in >> c;
530  FileHelpers::readEdgeVector(in, into, rid);
531  } else {
532  for (StringTokenizer st(desc); st.hasNext();) {
533  const std::string id = st.next();
534  const ROEdge* edge = myNet.getEdge(id);
535  if (edge == 0) {
536  myErrorOutput->inform("The edge '" + id + "' within the route " + rid + " is not known."
537  + "\n The route can not be build.");
538  } else {
539  into.push_back(edge);
540  }
541  }
542  }
543 }
544 
545 
546 /****************************************************************************/
RORouteDef * myCurrentAlternatives
The currently parsed route alternatives.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
Definition: MsgHandler.cpp:80
virtual void myEndElement(int element)
Called when a closing tag occurs.
static void parseStringSet(const std::string &def, std::set< std::string > &into)
Splits the given string, stores it in a set.
const bool myEmptyDestinationsAllowed
Information whether the &quot;to&quot; attribute is mandatory.
void closeVehicleTypeDistribution()
SUMOReal myCurrentCosts
The currently parsed route costs.
The time is given.
std::string next()
int repetitionNumber
The number of times the vehicle shall be repeatedly inserted.
std::vector< const ROEdge * > myActiveRoute
The current route.
void closePerson()
Ends the processing of a person.
std::string vtypeid
The vehicle&#39;s type id.
bool parking
whether the vehicle is removed from the net while stopping
void openRouteDistribution(const SUMOSAXAttributes &attrs)
static void parseVTypeEmbedded(SUMOVTypeParameter &into, int element, const SUMOSAXAttributes &attrs, bool fromVType=false)
Parses an element embedded in vtype definition.
SUMOTime duration
The stopping duration.
SUMOVehicleParameter * myVehicleParameter
Parameter of the current vehicle, trip, person, or flow.
Structure representing possible vehicle parameter.
void addAlternativeDef(const RORouteDef *alternative)
Adds an alternative loaded from the file.
Definition: RORouteDef.cpp:80
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
Definition: RONet.h:101
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
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.
int repetitionsDone
The number of times the vehicle was already inserted.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
MsgHandler *const myErrorOutput
Depending on the &quot;ignore-errors&quot; option different outputs are used.
const SUMOReal DEFAULT_VEH_PROB
SUMOReal myActiveRouteProbability
The id of the current route.
SUMOTime until
The time at which the vehicle may continue its journey.
virtual void myEndElement(int element)
Called when a closing tag occurs.
const int STOP_INDEX_FIT
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.
void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs)
std::string myActiveRouteID
The id of the current route.
SUMOReal repetitionOffset
The time offset between vehicle reinsertions.
void closeVehicle()
Ends the processing of a vehicle.
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)
Definition: MsgHandler.h:196
virtual bool addVehicleType(SUMOVTypeParameter *type)
Adds a read vehicle type definition to the network.
Definition: RONet.cpp:191
RandomDistributor< SUMOVTypeParameter * > * myCurrentVTypeDistribution
The currently parsed distribution of vehicle types (probability-&gt;vehicle type)
virtual bool addVehicle(const std::string &id, ROVehicle *veh)
Definition: RONet.cpp:214
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:67
std::string toTaz
The vehicle&#39;s destination zone (district)
std::vector< Stop > stops
List of the stops the vehicle will make.
RORouteHandler(RONet &net, const std::string &file, const bool tryRepair, const bool emptyDestinationsAllowed, const bool ignoreErrors)
standard constructor
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.
RONet & myNet
The current route.
std::string busstop
(Optional) bus stop if one is assigned to the stop
const std::string & getID() const
Returns the id.
Definition: Named.h:60
bool addVTypeDistribution(const std::string &id, RandomDistributor< SUMOVTypeParameter * > *vehTypeDistribution)
Adds a vehicle type distribution.
Definition: RONet.cpp:204
A vehicle as used by router.
Definition: ROVehicle.h:57
bool addRouteDef(RORouteDef *def)
Definition: RONet.cpp:100
SUMOReal startPos
The stopping position start.
the edges of a route
std::string routeid
The vehicle&#39;s route id.
Encapsulated SAX-Attributes.
bool wasSet(int what) const
Returns whether the given parameter was set.
SUMOReal endPos
The stopping position end.
bool triggered
whether an arriving person lets the vehicle continue
const int STOP_INDEX_END
SUMOTime depart
The vehicle&#39;s departure time.
void addPerson(const SUMOTime depart, const std::string desc)
Definition: RONet.cpp:240
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:48
void addStop(const SUMOSAXAttributes &attrs)
Processing of a stop.
std::string getString()
Returns the current content as a string.
#define POSITION_EPS
Definition: config.h:192
std::string fromTaz
The vehicle&#39;s origin zone (district)
A basic edge for routing applications.
Definition: ROEdge.h:67
void parseEdges(const std::string &desc, std::vector< const ROEdge * > &into, const std::string &rid)
Parse edges from strings.
std::string lane
The lane to stop at.
Parser for routes during their loading.
unsigned int getNoFollowing() const
Returns the number of edges this edge is connected to.
Definition: ROEdge.cpp:292
SUMOReal getOverallProb() const
Return the sum of the probabilites assigned to the members.
std::vector< SUMOVehicleParameter::Stop > myActiveRouteStops
List of the stops on the parsed route.
The router&#39;s network representation.
Definition: RONet.h:65
void openRoute(const SUMOSAXAttributes &attrs)
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
static void parseStop(SUMOVehicleParameter::Stop &stop, const SUMOSAXAttributes &attrs)
SUMOReal getLength() const
Returns the length of the edge.
Definition: ROEdge.h:158
RORouteDef * copy(const std::string &id) const
Returns a deep copy of the route definition.
Definition: RORouteDef.cpp:352
void parseFromTo(std::string element, const SUMOSAXAttributes &attrs)
Called for parsing from and to and the corresponding taz attributes.
SUMOReal defaultProbability
The probability when being added to a distribution without an explicit probability.
Definition of vehicle stop (position and duration)
const bool myTryRepair
Information whether routes shall be repaired.
void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:89
int index
at which position in the stops list
Base class for a vehicle&#39;s route definition.
Definition: RORouteDef.h:63
void addLoadedAlternative(RORoute *alternative)
Adds a single alternative loaded from the file An alternative may also be generated during DUA...
Definition: RORouteDef.cpp:74
void closeRoute(const bool mayBeDisconnected=false)
const int VEHPARS_TAZ_SET
OutputDevice_String * myActivePlan
The plan of the current person.
const RGBColor * myActiveRouteColor
The currently parsed route&#39;s color.
virtual ~RORouteHandler()
standard destructor
static void readEdgeVector(std::istream &in, std::vector< const E * > &edges, const std::string &rid)
Reads an edge vector binary.
Definition: FileHelpers.h:278
bool closeTag()
Closes the most recently opened tag.
#define SUMOReal
Definition: config.h:221
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
Definition: RONet.cpp:143
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.
void closeFlow()
Ends the processing of a flow.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
bool addFlow(SUMOVehicleParameter *flow, const bool randomize)
Definition: RONet.cpp:226
void add(SUMOReal prob, T val, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
std::string myActiveRouteRefID
The id of the route the current route references to.
A color information.
RORouteDef * getRouteDef(const std::string &name) const
Returns the named route definition.
Definition: RONet.h:205
SUMOReal getOverallProb() const
Returns the sum of the probablities of the contained routes.
Definition: RORouteDef.cpp:364
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
A complete router&#39;s route.
Definition: RORoute.h:58
An output device that encapsulates an ofstream.
void closeRouteDistribution()
std::string myCurrentVTypeDistributionID
The id of the currently parsed vehicle type distribution.
std::string id
The vehicle&#39;s id.