Eclipse SUMO - Simulation of Urban MObility
MSTransportable.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-2022 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 /****************************************************************************/
20 // The common superclass for modelling transportable objects like persons and containers
21 /****************************************************************************/
22 #include <config.h>
23 
25 #include <utils/geom/GeomHelper.h>
29 #include <microsim/MSEdge.h>
30 #include <microsim/MSLane.h>
31 #include <microsim/MSNet.h>
39 
40 
41 //#define DEBUG_PARKING
42 
43 // ===========================================================================
44 // method definitions
45 // ===========================================================================
47  SUMOTrafficObject(pars->id),
48  myParameter(pars), myVType(vtype), myPlan(plan), myAmPerson(isPerson) {
49  myStep = myPlan->begin();
50  // init devices
52 }
53 
54 
56  if (myStep != myPlan->end() && getCurrentStageType() == MSStageType::DRIVING) {
57  MSStageDriving* const stage = dynamic_cast<MSStageDriving*>(*myStep);
58  if (stage->getVehicle() != nullptr) {
59  stage->getVehicle()->removeTransportable(this);
60  }
61  }
62  if (myPlan != nullptr) {
63  for (MSTransportablePlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
64  delete *i;
65  }
66  delete myPlan;
67  myPlan = nullptr;
68  }
69  for (MSTransportableDevice* dev : myDevices) {
70  delete dev;
71  }
72  delete myParameter;
73  if (myVType->isVehicleSpecific()) {
75  }
76 }
77 
78 SumoRNG*
80  return getEdge()->getLanes()[0]->getRNG();
81 }
82 
83 bool
84 MSTransportable::proceed(MSNet* net, SUMOTime time, const bool vehicleArrived) {
85  MSStage* prior = *myStep;
86  const std::string& error = prior->setArrived(net, this, time, vehicleArrived);
87  // must be done before increasing myStep to avoid invalid state for rendering
88  if (myAmPerson) {
89  prior->getEdge()->removePerson(this);
90  } else {
91  prior->getEdge()->removeContainer(this);
92  }
93  myStep++;
94  if (error != "") {
95  throw ProcessError(error);
96  }
97  bool accessToStop = false;
98  if (prior->getStageType() == MSStageType::WALKING) {
99  accessToStop = checkAccess(prior);
100  }
101  if (!accessToStop && (myStep == myPlan->end()
102  || ((*myStep)->getStageType() != MSStageType::DRIVING
103  && (*myStep)->getStageType() != MSStageType::TRIP))) {
104  MSStoppingPlace* priorStop = prior->getStageType() == MSStageType::TRIP ? prior->getOriginStop() : prior->getDestinationStop();
105  // a trip might resolve to DRIVING so we would have to stay at the stop
106  // if a trip resolves to something else, this step will do stop removal
107  if (priorStop != nullptr) {
108  priorStop->removeTransportable(this);
109  }
110  }
111  if (myStep != myPlan->end()) {
112  if ((*myStep)->getStageType() == MSStageType::WALKING && (prior->getStageType() != MSStageType::ACCESS || prior->getDestination() != (*myStep)->getFromEdge())) {
113  checkAccess(prior, false);
114  }
115  (*myStep)->proceed(net, this, time, prior);
116  return true;
117  } else {
119  return false;
120  }
121 }
122 
123 
124 void
125 MSTransportable::setID(const std::string& /*newID*/) {
126  throw ProcessError("Changing a transportable ID is not permitted");
127 }
128 
129 SUMOTime
131  return myParameter->depart;
132 }
133 
134 void
136  (*myStep)->setDeparted(now);
137 }
138 
139 SUMOTime
141  if (myPlan->size() > 1 && (*myPlan)[1]->getDeparted() >= 0) {
142  return (*myPlan)[1]->getDeparted();
143  }
144  return -1;
145 }
146 
147 
148 double
150  return (*myStep)->getEdgePos(MSNet::getInstance()->getCurrentTimeStep());
151 }
152 
153 double
155  return getEdgePos() - getVehicleType().getLength();
156 }
157 
158 int
160  return (*myStep)->getDirection();
161 }
162 
163 Position
165  return (*myStep)->getPosition(MSNet::getInstance()->getCurrentTimeStep());
166 }
167 
168 double
170  return (*myStep)->getAngle(MSNet::getInstance()->getCurrentTimeStep());
171 }
172 
173 double
175  return STEPS2TIME((*myStep)->getWaitingTime(MSNet::getInstance()->getCurrentTimeStep()));
176 }
177 
178 double
180  return (*myStep)->getSpeed();
181 }
182 
183 
184 int
186  return (int)(myPlan->end() - myStep);
187 }
188 
189 
190 int
192  return (int)myPlan->size();
193 }
194 
195 
196 void
198  os.openTag(isPerson() ? "personinfo" : "containerinfo");
199  os.writeAttr("id", getID());
200  os.writeAttr("depart", time2string(getDesiredDepart()));
201  os.writeAttr("type", getVehicleType().getID());
202  for (MSStage* const i : *myPlan) {
203  i->tripInfoOutput(os, this);
204  }
205  os.closeTag();
206 }
207 
208 
209 void
210 MSTransportable::routeOutput(OutputDevice& os, const bool withRouteLength) const {
211  const std::string typeID = (
215  if (hasArrived()) {
216  os.writeAttr("arrival", time2string(MSNet::getInstance()->getCurrentTimeStep()));
217  }
218  const MSStage* previous = nullptr;
219  for (const MSStage* const stage : *myPlan) {
220  stage->routeOutput(myAmPerson, os, withRouteLength, previous);
221  previous = stage;
222  }
224  os.closeTag();
225  os.lf();
226 }
227 
228 
229 void
231  // myStep is invalidated upon modifying myPlan
232  const int stepIndex = (int)(myStep - myPlan->begin());
233  if (next < 0) {
234  myPlan->push_back(stage);
235  } else {
236  if (stepIndex + next > (int)myPlan->size()) {
237  throw ProcessError("invalid index '" + toString(next) + "' for inserting new stage into plan of '" + getID() + "'");
238  }
239  myPlan->insert(myPlan->begin() + stepIndex + next, stage);
240  }
241  myStep = myPlan->begin() + stepIndex;
242 }
243 
244 
245 void
246 MSTransportable::removeStage(int next, bool stayInSim) {
247  assert(myStep + next < myPlan->end());
248  assert(next >= 0);
249  if (next > 0) {
250  // myStep is invalidated upon modifying myPlan
251  int stepIndex = (int)(myStep - myPlan->begin());
252  delete *(myStep + next);
253  myPlan->erase(myStep + next);
254  myStep = myPlan->begin() + stepIndex;
255  } else {
256  if (myStep + 1 == myPlan->end() && stayInSim) {
257  // stay in the simulation until the start of simStep to allow appending new stages (at the correct position)
258  appendStage(new MSStageWaiting(getEdge(), nullptr, 0, 0, getEdgePos(), "last stage removed", false));
259  }
260  (*myStep)->abort(this);
261  if (!proceed(MSNet::getInstance(), MSNet::getInstance()->getCurrentTimeStep())) {
263  };
264  }
265 }
266 
267 
268 void
270  for (MSTransportablePlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
271  (*i)->setSpeed(speed);
272  }
273 }
274 
275 
276 void
278  if (myVType->isVehicleSpecific()) {
280  }
281  if (isPerson()
282  && type->getVehicleClass() != myVType->getVehicleClass()
283  && type->getVehicleClass() != SVC_PEDESTRIAN
285  WRITE_WARNINGF("Person '%' receives type '%' which implicitly uses unsuitable vClass '%'.", getID(), type->getID(), toString(type->getVehicleClass()));
286  }
287  myVType = type;
288 }
289 
290 
293  if (myVType->isVehicleSpecific()) {
294  return *myVType;
295  }
296  MSVehicleType* type = myVType->buildSingularType(myVType->getID() + "@" + getID());
297  replaceVehicleType(type);
298  return *type;
299 }
300 
301 
304  PositionVector centerLine;
305  const Position p = getPosition();
306  const double angle = getAngle();
307  const double length = getVehicleType().getLength();
308  const Position back = p + Position(-cos(angle) * length, -sin(angle) * length);
309  centerLine.push_back(p);
310  centerLine.push_back(back);
311  centerLine.move2side(0.5 * getVehicleType().getWidth());
312  PositionVector result = centerLine;
313  centerLine.move2side(-getVehicleType().getWidth());
314  result.append(centerLine.reverse(), POSITION_EPS);
315  //std::cout << " transp=" << getID() << " p=" << p << " angle=" << GeomHelper::naviDegree(angle) << " back=" << back << " result=" << result << "\n";
316  return result;
317 }
318 
319 
320 std::string
321 MSTransportable::getStageSummary(int stageIndex) const {
322  assert(stageIndex < (int)myPlan->size());
323  assert(stageIndex >= 0);
324  return (*myPlan)[stageIndex]->getStageSummary(myAmPerson);
325 }
326 
327 
328 bool
330  return myStep == myPlan->end();
331 }
332 
333 bool
335  return myPlan->size() > 0 && myPlan->front()->getDeparted() >= 0;
336 }
337 
338 
339 void
341  // check whether the transportable was riding to the orignal stop
342  // @note: parkingArea can currently not be set as myDestinationStop so we
343  // check for stops on the edge instead
344 #ifdef DEBUG_PARKING
345  std::cout << SIMTIME << " person=" << getID() << " rerouteParkingArea orig=" << orig->getID() << " replacement=" << replacement->getID() << "\n";
346 #endif
348  if (!myAmPerson) {
349  WRITE_WARNING("parkingAreaReroute not support for containers");
350  return;
351  }
352  if (getDestination() == &orig->getLane().getEdge()) {
353  MSStageDriving* const stage = dynamic_cast<MSStageDriving*>(*myStep);
354  assert(stage != 0);
355  assert(stage->getVehicle() != 0);
356  // adapt plan
357  stage->setDestination(&replacement->getLane().getEdge(), replacement);
358  stage->setArrivalPos((replacement->getBeginLanePosition() + replacement->getEndLanePosition()) / 2);
359 #ifdef DEBUG_PARKING
360  std::cout << " set ride destination\n";
361 #endif
362  if (myStep + 1 == myPlan->end()) {
363  return;
364  }
365  // if the next step is a walk, adapt the route
366  MSStage* nextStage = *(myStep + 1);
367  if (nextStage->getStageType() == MSStageType::TRIP) {
368  dynamic_cast<MSStageTrip*>(nextStage)->setOrigin(stage->getDestination());
369 #ifdef DEBUG_PARKING
370  std::cout << " set subsequent trip origin\n";
371 #endif
372  } else if (nextStage->getStageType() == MSStageType::WALKING) {
373 #ifdef DEBUG_PARKING
374  std::cout << " replace subsequent walk with a trip\n";
375 #endif
376  MSStageTrip* newStage = new MSStageTrip(stage->getDestination(), nullptr, nextStage->getDestination(),
377  nextStage->getDestinationStop(), -1, 0, "", -1, 1, getID(), 0, true, nextStage->getArrivalPos());
378  removeStage(1);
379  appendStage(newStage, 1);
380  } else if (nextStage->getStageType() == MSStageType::WAITING) {
381 #ifdef DEBUG_PARKING
382  std::cout << " add subsequent walk to reach stop\n";
383  std::cout << " arrivalPos=" << nextStage->getArrivalPos() << "\n";
384 #endif
385  MSStageTrip* newStage = new MSStageTrip(stage->getDestination(), nullptr, nextStage->getDestination(),
386  nextStage->getDestinationStop(), -1, 0, "", -1, 1, getID(), 0, true, nextStage->getArrivalPos());
387  appendStage(newStage, 1);
388  }
389  // if the plan contains another ride with the same vehicle from the same
390  // parking area, adapt the preceeding walk to end at the replacement
391  for (auto it = myStep + 2; it != myPlan->end(); it++) {
392  MSStage* const futureStage = *it;
393  MSStage* const prevStage = *(it - 1);
394  if (futureStage->getStageType() == MSStageType::DRIVING) {
395  MSStageDriving* const ds = static_cast<MSStageDriving*>(futureStage);
396  // ride origin is set implicitly from the walk destination
397  ds->setOrigin(nullptr);
398  if (ds->getLines() == stage->getLines()
399  && prevStage->getDestination() == &orig->getLane().getEdge()) {
400  if (prevStage->getStageType() == MSStageType::TRIP) {
401  dynamic_cast<MSStageTrip*>(prevStage)->setDestination(stage->getDestination(), replacement);
402 #ifdef DEBUG_PARKING
403  std::cout << " replace later trip before ride (" << (it - myPlan->begin()) << ")\n";
404 #endif
405  } else if (prevStage->getStageType() == MSStageType::WALKING) {
406 #ifdef DEBUG_PARKING
407  std::cout << " replace later walk before ride (" << (it - myPlan->begin()) << ")\n";
408 #endif
409  MSStageTrip* newStage = new MSStageTrip(prevStage->getFromEdge(), nullptr, stage->getDestination(),
410  replacement, -1, 0, "", -1, 1, getID(), 0, true, stage->getArrivalPos());
411  int prevStageRelIndex = (int)(it - 1 - myStep);
412  removeStage(prevStageRelIndex);
413  appendStage(newStage, prevStageRelIndex);
414  }
415  break;
416  }
417  }
418  }
419  }
420 }
421 
422 
424 MSTransportable::getDevice(const std::type_info& type) const {
425  for (MSTransportableDevice* const dev : myDevices) {
426  if (typeid(*dev) == type) {
427  return dev;
428  }
429  }
430  return nullptr;
431 }
432 
433 double
435  const MSEdge* edge = getEdge();
436  const double ep = getEdgePos();
437  const double gp = edge->getLanes()[0]->interpolateLanePosToGeometryPos(ep);
438  return edge->getLanes()[0]->getShape().slopeDegreeAtOffset(gp);
439 }
440 
441 SUMOTime
443  return (*myStep)->getWaitingTime(MSNet::getInstance()->getCurrentTimeStep());
444 }
445 
446 double
449 }
450 
453  return getVehicleType().getVehicleClass();
454 }
455 
456 
457 void
459  // this saves lots of departParameters which are only needed for transportables that did not yet depart
460  // the parameters may hold the name of a vTypeDistribution but we are interested in the actual type
462  std::ostringstream state;
463  int stepIdx = (int)(myStep - myPlan->begin());
464  for (auto it = myPlan->begin(); it != myStep; ++it) {
465  if ((*it)->getStageType() == MSStageType::TRIP) {
466  stepIdx--;
467  }
468  }
469  state << myParameter->parametersSet << " " << stepIdx;
470  (*myStep)->saveState(state);
471  out.writeAttr(SUMO_ATTR_STATE, state.str());
472  const MSStage* previous = nullptr;
473  for (const MSStage* const stage : *myPlan) {
474  stage->routeOutput(myAmPerson, out, false, previous);
475  previous = stage;
476  }
477  out.closeTag();
478 }
479 
480 
481 void
482 MSTransportable::loadState(const std::string& state) {
483  std::istringstream iss(state);
484  int step;
485  iss >> myParameter->parametersSet >> step;
486  myStep = myPlan->begin() + step;
487  (*myStep)->loadState(this, iss);
488 }
489 
490 
491 /****************************************************************************/
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:281
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
#define STEPS2TIME(x)
Definition: SUMOTime.h:53
#define SIMTIME
Definition: SUMOTime.h:60
long long int SUMOTime
Definition: SUMOTime.h:32
const int VTYPEPARS_VEHICLECLASS_SET
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PEDESTRIAN
pedestrian
const std::string DEFAULT_PEDTYPE_ID
const std::string DEFAULT_CONTAINERTYPE_ID
@ SUMO_TAG_CONTAINER
@ SUMO_TAG_PERSON
@ SUMO_ATTR_STATE
The state of a link.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
static void buildTransportableDevices(MSTransportable &p, std::vector< MSTransportableDevice * > &into)
Build devices for the given person, if needed.
Definition: MSDevice.cpp:122
A road/street connecting two junctions.
Definition: MSEdge.h:77
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
Definition: MSEdge.h:678
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:168
virtual void removePerson(MSTransportable *p) const
Definition: MSEdge.cpp:1024
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:674
The simulated network and simulation perfomer.
Definition: MSNet.h:88
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:174
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:376
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:318
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:1059
const std::set< std::string > & getLines() const
SUMOVehicle * getVehicle() const
Current vehicle in which the transportable is driving (or nullptr)
double getArrivalPos() const
return default value for undefined arrivalPos
void setOrigin(const MSEdge *origin)
change origin for parking area rerouting
virtual MSStoppingPlace * getOriginStop() const
returns the origin stop (if any). only needed for MSStageTrip
Definition: MSStage.h:85
const MSEdge * getDestination() const
returns the destination edge
Definition: MSStage.cpp:70
virtual const MSEdge * getFromEdge() const
Definition: MSStage.cpp:82
virtual double getArrivalPos() const
Definition: MSStage.h:89
virtual const std::string setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now, const bool vehicleArrived)
logs end of the step
Definition: MSStage.cpp:136
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
Definition: MSStage.h:80
MSStageType getStageType() const
Definition: MSStage.h:117
void setArrivalPos(double arrivalPos)
Definition: MSStage.h:93
void setDestination(const MSEdge *newDestination, MSStoppingPlace *newDestStop)
Definition: MSStage.cpp:164
virtual void routeOutput(const bool isPerson, OutputDevice &os, const bool withRouteLength, const MSStage *const previous) const =0
Called on writing vehroute output.
virtual const MSEdge * getEdge() const
Returns the current edge.
Definition: MSStage.cpp:76
A lane area vehicles can halt at.
double getBeginLanePosition() const
Returns the begin position of this stop.
double getEndLanePosition() const
Returns the end position of this stop.
void removeTransportable(const MSTransportable *p)
Removes a transportable from this stop.
const MSLane & getLane() const
Returns the lane this stop is located at.
virtual void erase(MSTransportable *transportable)
removes a single transportable
Abstract in-person device.
virtual double getEdgePos() const
Return the position on the edge.
bool hasDeparted() const
return whether the transportable has started it's plan
SUMOVehicleClass getVClass() const
Returns the object's access class.
SUMOTime getWaitingTime() const
SUMOTime getDeparture() const
logs depart time of the current stage
double getBackPositionOnLane(const MSLane *lane) const
Get the object's back position along the given lane.
virtual double getAngle() const
return the current angle of the transportable
void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
virtual double getSpeed() const
the current speed of the transportable
PositionVector getBoundingBox() const
return the bounding box of the person
const bool myAmPerson
virtual bool checkAccess(const MSStage *const prior, const bool waitAtStop=true)
std::string getStageSummary(int stageIndex) const
return textual summary for the given stage
MSTransportableDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
void setDeparted(SUMOTime now)
logs depart time of the current stage
void setSpeed(double speed)
sets the walking speed (ignored in other stages)
virtual bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false)
MSTransportablePlan::iterator myStep
the iterator over the route
MSTransportablePlan * myPlan
the plan of the transportable
void removeStage(int next, bool stayInSim=true)
removes the nth next stage
MSVehicleType * myVType
This transportable's type. (mainly used for drawing related information Note sure if it is really nec...
const MSVehicleType & getVehicleType() const
Returns the object's "vehicle" type.
bool isPerson() const
Whether it is a person.
virtual Position getPosition() const
Return the Network coordinate of the transportable.
const SUMOVehicleParameter * myParameter
the plan of the transportable
void saveState(OutputDevice &out)
Saves the current state into the given stream.
bool isContainer() const
Whether it is a container.
virtual ~MSTransportable()
destructor
int getNumStages() const
Return the total number stages in this persons plan.
MSStageType getCurrentStageType() const
the current stage type of the transportable
void rerouteParkingArea(MSStoppingPlace *orig, MSStoppingPlace *replacement)
adapt plan when the vehicle reroutes and now stops at replacement instead of orig
const MSEdge * getEdge() const
Returns the current edge.
void loadState(const std::string &state)
Reconstructs the current state.
std::vector< MSTransportableDevice * > myDevices
The devices this transportable has.
virtual double getWaitingSeconds() const
the time this transportable spent waiting in seconds
MSTransportable(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportablePlan *plan, const bool isPerson)
constructor
bool hasArrived() const
return whether the person has reached the end of its plan
double getSlope() const
Returns the slope of the road at object's position in degrees.
void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
void appendStage(MSStage *stage, int next=-1)
Appends the given stage to the current plan.
SumoRNG * getRNG() const
returns the associated RNG
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
virtual int getDirection() const
Return the movement directon on the edge.
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
const MSEdge * getDestination() const
Returns the current destination.
void setID(const std::string &newID)
set the id (inherited from Named but forbidden for transportables)
virtual double getSpeedFactor() const
the current speed factor of the transportable (where applicable)
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
SUMOTime getDesiredDepart() const
Returns the desired departure time.
double getMaxSpeed() const
Returns the object's maximum speed.
void removeVType(const MSVehicleType *vehType)
The car-following model and parameter.
Definition: MSVehicleType.h:62
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
bool isVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:90
double getLength() const
Get vehicle's length [m].
const SUMOVTypeParameter & getParameter() const
MSVehicleType * buildSingularType(const std::string &id) const
Duplicates the microsim vehicle type giving the newly created type the given id, marking it as vehicl...
const std::string & getID() const
Returns the id.
Definition: Named.h:74
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
void lf()
writes a line feed if applicable
Definition: OutputDevice.h:236
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:248
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.
void append(const PositionVector &v, double sameThreshold=2.0)
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
PositionVector reverse() const
reverse position vector
Representation of a vehicle, person, or container.
bool wasSet(int what) const
Returns whether the given parameter was set.
virtual void removeTransportable(MSTransportable *t)=0
removes a person or container
Structure representing possible vehicle parameter.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag altTag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.