SUMO - Simulation of Urban MObility
GUIVehicle.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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // A MSVehicle extended by some values for usage within the gui
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <cmath>
33 #include <vector>
34 #include <string>
38 #include <utils/geom/GeomHelper.h>
45 #include <utils/gui/div/GLHelper.h>
48 #include <microsim/MSGlobals.h>
49 #include <microsim/MSVehicle.h>
50 #include <microsim/MSJunction.h>
51 #include <microsim/MSLane.h>
59 #include <gui/GUIGlobals.h>
60 #include "GUIVehicle.h"
61 #include "GUIPerson.h"
62 #include "GUIContainer.h"
63 #include "GUINet.h"
64 #include "GUIEdge.h"
65 #include "GUILane.h"
66 
67 //#define DRAW_BOUNDING_BOX
68 //#define DEBUG_FOES
69 
70 // ===========================================================================
71 // FOX callback mapping
72 // ===========================================================================
73 
74 // Object implementation
75 
76 
77 /* -------------------------------------------------------------------------
78  * GUIVehicle - methods
79  * ----------------------------------------------------------------------- */
80 #ifdef _MSC_VER
81 #pragma warning(push)
82 #pragma warning(disable: 4355)
83 #endif
85  MSVehicleType* type, const double speedFactor) :
86  MSVehicle(pars, route, type, speedFactor),
87  GUIBaseVehicle((MSBaseVehicle&) * this) {
88 }
89 #ifdef _MSC_VER
90 #pragma warning(pop)
91 #endif
92 
93 
95 }
96 
97 
101  const int sublaneParams = MSGlobals::gLateralResolution > 0 ? 4 : 0;
103  new GUIParameterTableWindow(app, *this, 37 + sublaneParams + (int)getParameter().getMap().size());
104  // add items
105  ret->mkItem("lane [id]", false, Named::getIDSecure(myLane, "n/a"));
107  const MSLane* shadowLane = getLaneChangeModel().getShadowLane();
108  ret->mkItem("shadow lane [id]", false, shadowLane == 0 ? "" : shadowLane->getID());
109  }
111  const MSLane* targetLane = getLaneChangeModel().getTargetLane();
112  ret->mkItem("target lane [id]", false, targetLane == 0 ? "" : targetLane->getID());
113  }
114  ret->mkItem("position [m]", true,
116  ret->mkItem("lateral offset [m]", true,
118  ret->mkItem("speed [m/s]", true,
120  ret->mkItem("lateral speed [m/s]", true,
122  ret->mkItem("acceleration [m/s^2]", true,
124  ret->mkItem("angle [degree]", true,
126  ret->mkItem("slope [degree]", true,
128  ret->mkItem("speed factor", false, getChosenSpeedFactor());
129  ret->mkItem("time gap on lane [s]", true,
131  ret->mkItem("waiting time [s]", true,
133  ret->mkItem(("waiting time (accumulated, " + time2string(MSGlobals::gWaitingTimeMemory) + "s) [s]").c_str(), true,
135  ret->mkItem("time loss [s]", true,
137  ret->mkItem("impatience", true,
139  ret->mkItem("last lane change [s]", true,
141  ret->mkItem("desired depart [s]", false, time2string(getParameter().depart));
142  ret->mkItem("depart delay [s]", false, time2string(getDepartDelay()));
143  if (getParameter().repetitionNumber < std::numeric_limits<int>::max()) {
144  ret->mkItem("remaining [#]", false, (int) getParameter().repetitionNumber - getParameter().repetitionsDone);
145  }
146  if (getParameter().repetitionOffset > 0) {
147  ret->mkItem("insertion period [s]", false, time2string(getParameter().repetitionOffset));
148  }
149  if (getParameter().repetitionProbability > 0) {
150  ret->mkItem("insertion probability", false, getParameter().repetitionProbability);
151  }
152  ret->mkItem("stop info", false, getStopInfo());
153  ret->mkItem("line", false, myParameter->line);
154  ret->mkItem("CO2 [mg/s]", true,
156  ret->mkItem("CO [mg/s]", true,
158  ret->mkItem("HC [mg/s]", true,
160  ret->mkItem("NOx [mg/s]", true,
162  ret->mkItem("PMx [mg/s]", true,
164  ret->mkItem("fuel [ml/s]", true,
166  ret->mkItem("electricity [Wh/s]", true,
168  ret->mkItem("noise (Harmonoise) [dB]", true,
170  std::ostringstream str;
171  for (std::vector<MSDevice*>::const_iterator i = myDevices.begin(); i != myDevices.end(); ++i) {
172  if (i != myDevices.begin()) {
173  str << ' ';
174  }
175  str << (*i)->getID().substr(0, (*i)->getID().find(getID()));
176  }
177  ret->mkItem("devices", false, str.str());
178  ret->mkItem("persons", true,
180  ret->mkItem("containers", true,
182  // close building
184  ret->mkItem("right side on edge [m]", true, new FunctionBinding<GUIVehicle, double>(this, &GUIVehicle::getRightSideOnEdge2));
185  ret->mkItem("left side on edge [m]", true, new FunctionBinding<GUIVehicle, double>(this, &GUIVehicle::getLeftSideOnEdge));
186  ret->mkItem("rightmost edge sublane [#]", true, new FunctionBinding<GUIVehicle, int>(this, &GUIVehicle::getRightSublaneOnEdge));
187  ret->mkItem("leftmost edge sublane [#]", true, new FunctionBinding<GUIVehicle, int>(this, &GUIVehicle::getLeftSublaneOnEdge));
188  ret->mkItem("lane change maneuver distance [m]", true, new FunctionBinding<GUIVehicle, double>(this, &GUIVehicle::getManeuverDist));
189  }
190  ret->closeBuilding(&getParameter());
191  return ret;
192 }
193 
194 
199  new GUIParameterTableWindow(app, *this, 24 + (int)myType->getParameter().getMap().size());
200  // add items
201  ret->mkItem("Type Information:", false, "");
202  ret->mkItem("type [id]", false, myType->getID());
203  ret->mkItem("length", false, myType->getLength());
204  ret->mkItem("width", false, myType->getWidth());
205  ret->mkItem("height", false, myType->getHeight());
206  ret->mkItem("minGap", false, myType->getMinGap());
207  ret->mkItem("vehicle class", false, SumoVehicleClassStrings.getString(myType->getVehicleClass()));
208  ret->mkItem("emission class", false, PollutantsInterface::getName(myType->getEmissionClass()));
209  ret->mkItem("car follow model", false, SUMOXMLDefinitions::CarFollowModels.getString((SumoXMLTag)getCarFollowModel().getModelID()));
210  ret->mkItem("maximum speed [m/s]", false, getMaxSpeed());
211  ret->mkItem("maximum acceleration [m/s^2]", false, getCarFollowModel().getMaxAccel());
212  ret->mkItem("maximum deceleration [m/s^2]", false, getCarFollowModel().getMaxDecel());
213  ret->mkItem("emergency deceleration [m/s^2]", false, getCarFollowModel().getEmergencyDecel());
214  ret->mkItem("apparent deceleration [m/s^2]", false, getCarFollowModel().getApparentDecel());
215  ret->mkItem("imperfection (sigma)", false, getCarFollowModel().getImperfection());
216  ret->mkItem("desired headway (tau)", false, getCarFollowModel().getHeadwayTime());
217  ret->mkItem("person capacity", false, myType->getPersonCapacity());
218  ret->mkItem("boarding time", false, STEPS2TIME(myType->getBoardingDuration()));
219  ret->mkItem("container capacity", false, myType->getContainerCapacity());
220  ret->mkItem("loading time", false, STEPS2TIME(myType->getLoadingDuration()));
222  ret->mkItem("minGapLat", false, myType->getMinGapLat());
223  ret->mkItem("maxSpeedLat", false, myType->getMaxSpeedLat());
224  ret->mkItem("latAlignment", false, toString(myType->getPreferredLateralAlignment()));
225  }
226 
227  // close building
228  ret->closeBuilding(&(myType->getParameter()));
229  return ret;
230 }
231 
232 
233 
234 
235 void
237  if (myPersonDevice != 0) {
238  const std::vector<MSTransportable*>& ps = myPersonDevice->getTransportables();
239  int personIndex = 0;
240  for (std::vector<MSTransportable*>::const_iterator i = ps.begin(); i != ps.end(); ++i) {
241  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
242  assert(person != 0);
243  person->setPositionInVehicle(getSeatPosition(personIndex++));
244  person->drawGL(s);
245  }
246  }
247  if (myContainerDevice != 0) {
248  const std::vector<MSTransportable*>& cs = myContainerDevice->getTransportables();
249  int containerIndex = 0;
250  for (std::vector<MSTransportable*>::const_iterator i = cs.begin(); i != cs.end(); ++i) {
251  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
252  assert(container != 0);
253  container->setPositionInVehicle(getSeatPosition(containerIndex++));
254  container->drawGL(s);
255  }
256  }
257 #ifdef DRAW_BOUNDING_BOX
258  glPushName(getGlID());
259  glPushMatrix();
260  glTranslated(0, 0, getType());
261  PositionVector boundingBox = getBoundingBox();
262  boundingBox.push_back(boundingBox.front());
263  PositionVector smallBB = getBoundingPoly();
264  glColor3d(0, .8, 0);
265  GLHelper::drawLine(boundingBox);
266  glColor3d(0.5, .8, 0);
267  GLHelper::drawLine(smallBB);
268  //GLHelper::drawBoxLines(getBoundingBox(), 0.5);
269  glPopMatrix();
270  glPopName();
271 #endif
272 }
273 
274 
275 void
277  glTranslated(0, 0, getType() + .2); // draw on top of cars
278  for (DriveItemVector::const_iterator i = myLFLinkLanes.begin(); i != myLFLinkLanes.end(); ++i) {
279  if ((*i).myLink == 0) {
280  continue;
281  }
282  MSLink* link = (*i).myLink;
283  MSLane* via = link->getViaLaneOrLane();
284  if (via != 0) {
285  Position p = via->getShape()[0];
286  if ((*i).mySetRequest) {
287  glColor3d(0, .8, 0);
288  } else {
289  glColor3d(.8, 0, 0);
290  }
291  const SUMOTime leaveTime = (*i).myLink->getLeaveTime(
292  (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(), getVehicleType().getLength());
293  drawLinkItem(p, (*i).myArrivalTime, leaveTime, s.vehicleName.size / s.scale);
294  // the time slot that ego vehicle uses when checking opened may
295  // differ from the one it requests in setApproaching
296  MSLink::ApproachingVehicleInformation avi = (*i).myLink->getApproaching(this);
297  assert(avi.arrivalTime == (*i).myArrivalTime && avi.leavingTime == leaveTime);
298  UNUSED_PARAMETER(avi); // only used for assertion
299  }
300  }
301  glTranslated(0, 0, getType() - .2); // draw on top of cars
302 }
303 
304 
305 bool
307  switch (guiShape) {
308  case SVS_BUS_FLEXIBLE:
309  drawAction_drawRailCarriages(s, 8.25, 0, 0, asImage); // 16.5 overall, 2 modules http://de.wikipedia.org/wiki/Ikarus_180
310  break;
311  case SVS_RAIL:
312  drawAction_drawRailCarriages(s, 24.5, 1, 1, asImage); // http://de.wikipedia.org/wiki/UIC-Y-Wagen_%28DR%29
313  break;
314  case SVS_RAIL_CAR:
315  drawAction_drawRailCarriages(s, 16.85, 1, 0, asImage); // 67.4m overall, 4 carriages http://de.wikipedia.org/wiki/DB-Baureihe_423
316 // drawAction_drawRailCarriages(s, 5.71, 0, 0, asImage); // 40.0m overall, 7 modules http://de.wikipedia.org/wiki/Bombardier_Flexity_Berlin
317 // drawAction_drawRailCarriages(s, 9.44, 1, 1, asImage); // actually length of the locomotive http://de.wikipedia.org/wiki/KJI_Nr._20_und_21
318 // drawAction_drawRailCarriages(s, 24.775, 0, 0, asImage); // http://de.wikipedia.org/wiki/ICE_3
319  break;
320  case SVS_RAIL_CARGO:
321  drawAction_drawRailCarriages(s, 13.86, 1, 0, asImage); // UIC 571-1 http://de.wikipedia.org/wiki/Flachwagen
322  break;
323  default:
324  return false;
325  }
326  return true;
327 }
328 
329 #define BLINKER_POS_FRONT .5
330 #define BLINKER_POS_BACK .5
331 
332 inline void
333 drawAction_drawBlinker(double dir, double length) {
334  glColor3d(1.f, .8f, 0);
335  glPushMatrix();
336  glTranslated(dir, BLINKER_POS_FRONT, -0.1);
338  glPopMatrix();
339  glPushMatrix();
340  glTranslated(dir, length - BLINKER_POS_BACK, -0.1);
342  glPopMatrix();
343 }
344 
345 
346 void
349  return;
350  }
351  const double offset = MAX2(.5 * getVehicleType().getWidth(), .4);
353  drawAction_drawBlinker(-offset, length);
354  }
356  drawAction_drawBlinker(offset, length);;
357  }
359  drawAction_drawBlinker(-offset, length);
360  drawAction_drawBlinker(offset, length);
361  }
362 }
363 
364 
365 inline void
366 GUIVehicle::drawAction_drawVehicleBrakeLight(double length, bool onlyOne) const {
368  return;
369  }
370  glColor3f(1.f, .2f, 0);
371  glPushMatrix();
372  if (onlyOne) {
373  glTranslated(0, length, -0.1);
375  } else {
376  glTranslated(-getVehicleType().getWidth() * 0.5, length, -0.1);
378  glPopMatrix();
379  glPushMatrix();
380  glTranslated(getVehicleType().getWidth() * 0.5, length, -0.1);
382  }
383  glPopMatrix();
384 }
385 
386 inline void
389  glPushMatrix();
390  glTranslated(0, 2.5, .5);
391  glColor3f(0, 0, 1);
393  glPopMatrix();
394  }
395 }
396 
397 
398 double
399 GUIVehicle::getColorValue(int activeScheme) const {
400  switch (activeScheme) {
401  case 8:
402  return getSpeed();
403  case 9:
404  // color by action step
405  if (isActionStep(SIMSTEP)) {
406  // Upcoming simstep is actionstep (t was already increased before drawing)
407  return 1.;
408  } else if (isActive()) {
409  // Completed simstep was actionstep
410  return 2.;
411  } else {
412  // not active
413  return 0.;
414  }
415  case 10:
416  return getWaitingSeconds();
417  case 11:
419  case 12:
420  return getLastLaneChangeOffset();
421  case 13:
422  return getLane()->getVehicleMaxSpeed(this);
423  case 14:
424  return getCO2Emissions();
425  case 15:
426  return getCOEmissions();
427  case 16:
428  return getPMxEmissions();
429  case 17:
430  return getNOxEmissions();
431  case 18:
432  return getHCEmissions();
433  case 19:
434  return getFuelConsumption();
435  case 20:
437  case 21:
438  if (getNumberReroutes() == 0) {
439  return -1;
440  }
441  return getNumberReroutes();
442  case 22:
444  case 23:
445  return getBestLaneOffset();
446  case 24:
447  return getAcceleration();
448  case 25:
449  return getTimeGapOnLane();
450  case 26:
451  return STEPS2TIME(getDepartDelay());
452  case 27:
453  return getElectricityConsumption();
454  case 28:
455  return getTimeLossSeconds();
456  }
457  return 0;
458 }
459 
460 
461 void
463  myLock.lock();
464  std::vector<std::vector<MSVehicle::LaneQ> > bestLanes = myBestLanes;
465  myLock.unlock();
466  for (std::vector<std::vector<MSVehicle::LaneQ> >::iterator j = bestLanes.begin(); j != bestLanes.end(); ++j) {
467  std::vector<MSVehicle::LaneQ>& lanes = *j;
468  double gmax = -1;
469  double rmax = -1;
470  for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
471  gmax = MAX2((*i).length, gmax);
472  rmax = MAX2((*i).occupation, rmax);
473  }
474  for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
475  const PositionVector& shape = (*i).lane->getShape();
476  double g = (*i).length / gmax;
477  double r = (*i).occupation / rmax;
478  glColor3d(r, g, 0);
479  double width = 0.5 / (1 + abs((*i).bestLaneOffset));
480  GLHelper::drawBoxLines(shape, width);
481 
482  PositionVector s1 = shape;
483  s1.move2side((double) .1);
484  glColor3d(r, 0, 0);
485  GLHelper::drawLine(s1);
486  s1.move2side((double) - .2);
487  glColor3d(0, g, 0);
488  GLHelper::drawLine(s1);
489 
490  glColor3d(r, g, 0);
491  }
492  }
493 }
494 
495 
496 void
498  const double exaggeration = s.vehicleSize.getExaggeration(s);
499  MSRouteIterator i = r.begin();
500  const std::vector<MSLane*>& bestLaneConts = getBestLanesContinuation();
501  // draw continuation lanes when drawing the current route where available
502  int bestLaneIndex = (&r == myRoute ? 0 : (int)bestLaneConts.size());
503  for (; i != r.end(); ++i) {
504  const GUILane* lane;
505  if (bestLaneIndex < (int)bestLaneConts.size() && bestLaneConts[bestLaneIndex] != 0 && (*i) == &(bestLaneConts[bestLaneIndex]->getEdge())) {
506  lane = static_cast<GUILane*>(bestLaneConts[bestLaneIndex]);
507  ++bestLaneIndex;
508  } else {
509  const std::vector<MSLane*>* allowed = (*i)->allowedLanes(getVClass());
510  if (allowed != 0 && allowed->size() != 0) {
511  lane = static_cast<GUILane*>((*allowed)[0]);
512  } else {
513  lane = static_cast<GUILane*>((*i)->getLanes()[0]);
514  }
515  }
516  GLHelper::drawBoxLines(lane->getShape(), lane->getShapeRotations(), lane->getShapeLengths(), exaggeration);
517  }
518  int stopIndex = 0;
519  for (const Stop& stop : myStops) {
520  Position pos = stop.lane->geometryPositionAtOffset(stop.getEndPos(*this));
521  GLHelper::drawBoxLines(stop.lane->getShape().getOrthogonal(pos, 10, true, stop.lane->getWidth()), 0.1);
522  std::string label = "stop " + toString(stopIndex);
523  if (stop.pars.until >= 0) {
524  label += " until:" + time2string(stop.pars.until);
525  }
526  if (stop.duration >= 0) {
527  label += " duration:" + time2string(stop.duration);
528  }
529  GLHelper::drawText(label, pos, 1.0, s.vehicleName.size / s.scale, s.vehicleName.color);
530  stopIndex++;
531  }
532 }
533 
534 
535 
536 MSLane*
537 GUIVehicle::getPreviousLane(MSLane* current, int& furtherIndex) const {
538  if (furtherIndex < (int)myFurtherLanes.size()) {
539  return myFurtherLanes[furtherIndex++];
540  } else {
541  return current;
542  }
543 }
544 
545 
546 void
547 GUIVehicle::drawAction_drawRailCarriages(const GUIVisualizationSettings& s, double defaultLength, double carriageGap, int firstPassengerCarriage, bool asImage) const {
548  RGBColor current = GLHelper::getColor();
549  RGBColor darker = current.changedBrightness(-51);
550  const double exaggeration = s.vehicleSize.getExaggeration(s);
551  defaultLength *= exaggeration;
552  if (exaggeration == 0) {
553  return;
554  }
555  carriageGap *= exaggeration;
556  const double length = getVehicleType().getLength() * exaggeration;
557  const double halfWidth = getVehicleType().getWidth() / 2.0 * exaggeration;
558  glPopMatrix(); // undo scaling and 90 degree rotation
559  glPopMatrix(); // undo initial translation and rotation
560  GLHelper::setColor(darker);
561  const double xCornerCut = 0.3 * exaggeration;
562  const double yCornerCut = 0.4 * exaggeration;
563  // round to closest integer
564  const int numCarriages = (int)(length / (defaultLength + carriageGap) + 0.5);
565  assert(numCarriages > 0);
566  const double carriageLengthWithGap = length / numCarriages;
567  const double carriageLength = carriageLengthWithGap - carriageGap;
568  // lane on which the carriage front is situated
569  MSLane* lane = myLane;
570  int furtherIndex = 0;
571  // lane on which the carriage back is situated
572  MSLane* backLane = myLane;
573  int backFurtherIndex = furtherIndex;
574  // offsets of front and back
575  double carriageOffset = myState.pos();
576  double carriageBackOffset = myState.pos() - carriageLength;
577  // handle seats
578  int requiredSeats = getNumPassengers();
579  if (requiredSeats > 0) {
580  mySeatPositions.clear();
581  }
582  Position front, back;
583  double angle = 0.;
584  // draw individual carriages
585  for (int i = 0; i < numCarriages; ++i) {
586  while (carriageOffset < 0) {
587  MSLane* prev = getPreviousLane(lane, furtherIndex);
588  if (prev != lane) {
589  carriageOffset += prev->getLength();
590  } else {
591  // no lane available for drawing.
592  carriageOffset = 0;
593  }
594  lane = prev;
595  }
596  while (carriageBackOffset < 0) {
597  MSLane* prev = getPreviousLane(backLane, backFurtherIndex);
598  if (prev != backLane) {
599  carriageBackOffset += prev->getLength();
600  } else {
601  // no lane available for drawing.
602  carriageBackOffset = 0;
603  }
604  backLane = prev;
605  }
606  front = lane->geometryPositionAtOffset(carriageOffset);
607  back = backLane->geometryPositionAtOffset(carriageBackOffset);
608  if (front == back) {
609  // no place for drawing available
610  continue;
611  }
612  const double drawnCarriageLength = front.distanceTo2D(back);
613  angle = atan2((front.x() - back.x()), (back.y() - front.y())) * (double) 180.0 / (double) M_PI;
614  if (i >= firstPassengerCarriage) {
615  computeSeats(front, back, requiredSeats);
616  }
617  glPushMatrix();
618  glTranslated(front.x(), front.y(), getType());
619  glRotated(angle, 0, 0, 1);
620  if (!asImage || !drawAction_drawVehicleAsImage(s, carriageLength)) {
621  glBegin(GL_TRIANGLE_FAN);
622  glVertex2d(-halfWidth + xCornerCut, 0);
623  glVertex2d(-halfWidth, yCornerCut);
624  glVertex2d(-halfWidth, drawnCarriageLength - yCornerCut);
625  glVertex2d(-halfWidth + xCornerCut, drawnCarriageLength);
626  glVertex2d(halfWidth - xCornerCut, drawnCarriageLength);
627  glVertex2d(halfWidth, drawnCarriageLength - yCornerCut);
628  glVertex2d(halfWidth, yCornerCut);
629  glVertex2d(halfWidth - xCornerCut, 0);
630  glEnd();
631  }
632  glPopMatrix();
633  carriageOffset -= carriageLengthWithGap;
634  carriageBackOffset -= carriageLengthWithGap;
635  GLHelper::setColor(current);
636  }
637  if (getVType().getGuiShape() == SVS_RAIL_CAR) {
638  glPushMatrix();
639  glTranslated(front.x(), front.y(), getType());
640  glRotated(angle, 0, 0, 1);
641  drawAction_drawVehicleBlinker(carriageLength);
642  drawAction_drawVehicleBrakeLight(carriageLength);
643  glPopMatrix();
644  }
645  // restore matrices
646  glPushMatrix();
647  front = getPosition();
648  glTranslated(front.x(), front.y(), getType());
649  glRotated(angle, 0, 0, 1);
650  const double upscale = s.vehicleSize.getExaggeration(s);
651  glScaled(upscale, upscale, 1);
652  glPushMatrix();
653 }
654 
655 
656 int
658  if (myPersonDevice != 0) {
659  return (int)myPersonDevice->size();
660  }
661  return 0;
662 }
663 
664 
665 void
666 GUIVehicle::computeSeats(const Position& front, const Position& back, int& requiredSeats) const {
667  if (requiredSeats <= 0) {
668  return; // save some work
669  }
670  const double length = front.distanceTo2D(back);
671  if (length < 4) {
672  // small vehicle, sit at the center
673  mySeatPositions.push_back(PositionVector::positionAtOffset2D(front, back, length / 2));
674  requiredSeats--;
675  } else {
676  for (double p = 2; p <= length - 1; p += 1) {
677  mySeatPositions.push_back(PositionVector::positionAtOffset2D(front, back, p));
678  requiredSeats--;
679  }
680  }
681 }
682 
683 
684 double
687 }
688 
689 
690 std::string
692  std::string result = "";
693  if (isParking()) {
694  result += "parking";
695  } else if (isStopped()) {
696  result += "stopped";
697  } else if (hasStops()) {
698  return "next: " + myStops.front().getDescription();
699  } else {
700  return "";
701  }
702  if (myStops.front().pars.triggered) {
703  result += ", triggered";
704  } else if (myStops.front().pars.containerTriggered) {
705  result += ", containerTriggered";
706  } else if (myStops.front().collision) {
707  result += ", collision";
708  } else {
709  result += ", duration=" + time2string(myStops.front().duration);
710  }
711  return result;
712 }
713 
714 
715 void
717  double dist = myLane->getLength() - getPositionOnLane();
718  for (DriveItemVector::const_iterator i = myLFLinkLanes.begin(); i != myLFLinkLanes.end(); ++i) {
719  const DriveProcessItem& dpi = *i;
720  if (dpi.myLink == 0) {
721  continue;
722  }
723  std::vector<const SUMOVehicle*> blockingFoes;
724  std::vector<const MSPerson*> blockingPersons;
725 #ifdef DEBUG_FOES
726  const bool isOpen =
727 #endif
730 #ifdef DEBUG_FOES
731  if (!isOpen) {
732  std::cout << SIMTIME << " veh=" << getID() << " foes at link=" << dpi.myLink->getViaLaneOrLane()->getID() << ":\n";
733  for (std::vector<const SUMOVehicle*>::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) {
734  std::cout << " " << (*it)->getID() << "\n";
735  }
736  }
737 #endif
738  if (getLaneChangeModel().getShadowLane() != 0) {
739  MSLink* parallelLink = dpi.myLink->getParallelLink(getLaneChangeModel().getShadowDirection());
740  if (parallelLink != 0) {
741  const double shadowLatPos = getLateralPositionOnLane() - getLaneChangeModel().getShadowDirection() * 0.5 * (
743 #ifdef DEBUG_FOES
744  const bool isShadowOpen =
745 #endif
746  parallelLink->opened(dpi.myArrivalTime, dpi.myArrivalSpeed, dpi.getLeaveSpeed(),
749  getWaitingTime(), shadowLatPos, &blockingFoes);
750 #ifdef DEBUG_FOES
751  if (!isShadowOpen) {
752  std::cout << SIMTIME << " veh=" << getID() << " foes at shadow link=" << parallelLink->getViaLaneOrLane()->getID() << ":\n";
753  for (std::vector<const SUMOVehicle*>::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) {
754  std::cout << " " << (*it)->getID() << "\n";
755  }
756  }
757 #endif
758  }
759  }
760  for (std::vector<const SUMOVehicle*>::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) {
761  gSelected.select(static_cast<const GUIVehicle*>(*it)->getGlID());
762  }
763  const MSLink::LinkLeaders linkLeaders = (dpi.myLink)->getLeaderInfo(this, dist, &blockingPersons);
764  for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
765  // the vehicle to enter the junction first has priority
766  const GUIVehicle* leader = dynamic_cast<const GUIVehicle*>(it->vehAndGap.first);
767  if (leader != 0) {
768  if (dpi.myLink->isLeader(this, leader)) {
769  gSelected.select(leader->getGlID());
770 #ifdef DEBUG_FOES
771  std::cout << SIMTIME << " veh=" << getID() << " linkLeader at link=" << dpi.myLink->getViaLaneOrLane()->getID() << " foe=" << leader->getID() << "\n";
772 #endif
773  }
774  } else {
775  for (std::vector<const MSPerson*>::iterator it_p = blockingPersons.begin(); it_p != blockingPersons.end(); ++it_p) {
776  const GUIPerson* foe = dynamic_cast<const GUIPerson*>(*it_p);
777  if (foe != 0) {
778  gSelected.select(foe->getGlID());
779  //std::cout << SIMTIME << " veh=" << getID() << " is blocked on link " << dpi.myLink->getRespondIndex() << " to " << dpi.myLink->getViaLaneOrLane()->getID() << " by pedestrian. dist=" << it->second << "\n";
780  }
781  }
782  }
783  }
784  dist += dpi.myLink->getViaLaneOrLane()->getLength();
785  }
786 }
787 
788 
789 void
792  GUISUMOAbstractView* view = mw->getActiveView();
793  if (view != 0) {
794  if (add) {
797  view->addAdditionalGLVisualisation(this);
798  }
799  } else {
802  }
803  }
804 }
805 
806 bool
809 }
810 
811 int
813  const double rightSide = getRightSideOnEdge();
814  const std::vector<double>& sublaneSides = myLane->getEdge().getSubLaneSides();
815  for (int i = 0; i < (int)sublaneSides.size(); ++i) {
816  if (sublaneSides[i] > rightSide) {
817  return MAX2(i - 1, 0);
818  }
819  }
820  return -1;
821 }
822 
823 int
825  const double leftSide = getLeftSideOnEdge();
826  const std::vector<double>& sublaneSides = myLane->getEdge().getSubLaneSides();
827  for (int i = (int)sublaneSides.size() - 1; i >= 0; --i) {
828  if (sublaneSides[i] < leftSide) {
829  return i;
830  }
831  }
832  return -1;
833 }
834 
835 double
838 }
839 
840 /****************************************************************************/
841 
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
void drawAction_drawVehicleBlinker(double length) const
Definition: GUIVehicle.cpp:347
bool drawAction_drawCarriageClass(const GUIVisualizationSettings &s, SUMOVehicleShape guiShape, bool asImage) const
draws the given guiShape if it has distinct carriages/modules and returns true if so ...
Definition: GUIVehicle.cpp:306
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:99
const std::vector< MSTransportable * > & getTransportables() const
Returns the list of transportables using this vehicle.
Drive process items represent bounds on the safe velocity corresponding to the upcoming links...
Definition: MSVehicle.h:1759
static double gLateralResolution
Definition: MSGlobals.h:91
double getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:4168
const std::vector< double > getSubLaneSides() const
Returns the right side offsets of this edge&#39;s sublanes.
Definition: MSEdge.h:552
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs...
Definition: MSVehicle.h:670
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane&#39;s maximum speed, given a vehicle&#39;s speed limit adaptation.
Definition: MSLane.h:475
static StringBijection< SumoXMLTag > CarFollowModels
car following models
SumoXMLTag
Numbers representing SUMO-XML - element names.
double getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:4156
render as a rail
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:607
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
double scale
information about a lane&#39;s width (temporary, used for a single view)
int size() const
Return the number of passengers / containers.
double getElectricityConsumption() const
Returns electricity consumption of the current state.
Definition: MSVehicle.cpp:4174
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:156
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
PositionVector getBoundingPoly() const
get bounding polygon
Definition: MSVehicle.cpp:4578
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:628
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: GUIVehicle.h:80
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:183
double getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:660
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1702
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1725
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1679
a vehicles
DriveItemVector myLFLinkLanes
Definition: MSVehicle.h:1814
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:564
const MSVehicleType & getVType() const
A shortcut to myVehicle.myType.
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
double getRightSideOnEdge2() const
return right vehicle side on current edge (without argument)
Definition: GUIVehicle.h:142
int getNumPassengers() const
return the number of passengers
Definition: GUIVehicle.cpp:657
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:249
LateralAlignment getPreferredLateralAlignment() const
Get vehicle&#39;s preferred lateral alignment.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
int getShadowDirection() const
return the direction in which the current shadow lane lies
int getPersonNumber() const
Returns the number of persons.
Definition: MSVehicle.cpp:4247
double getManeuverDist() const
Returns the remaining unblocked distance for the current maneuver. (only used by sublane model) ...
Stores the information about how to visualize structures.
MSLane * getPreviousLane(MSLane *current, int &furtherIndex) const
Definition: GUIVehicle.cpp:537
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
render as a flexible city bus
double y() const
Returns the y-position.
Definition: Position.h:67
double getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:402
const SUMOVehicleParameter & getParameter() const
Returns the vehicle&#39;s parameter (including departure definition)
int getBestLaneOffset() const
Definition: MSVehicle.cpp:4055
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:59
GUIVisualizationTextSettings vehicleName
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
Definition: MSVehicle.h:1716
double x() const
Returns the x-position.
Definition: Position.h:62
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:399
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, int align=0, double width=-1)
Definition: GLHelper.cpp:487
double getLeaveSpeed() const
Definition: MSVehicle.h:1806
T MAX2(T a, T b)
Definition: StdDefs.h:73
SUMOTime getDepartDelay() const
Returns the depart delay.
double getLeftSideOnEdge() const
return left vehicle side on current edge
Definition: GUIVehicle.h:146
void drawOutsideNetwork(bool add)
register vehicle for drawing while outside the network
Definition: GUIVehicle.cpp:790
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
double getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:497
const PositionVector & getShape() const
Returns this lane&#39;s shape.
Definition: MSLane.h:439
const MSRoute * myRoute
This vehicle&#39;s route.
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
Definition: Named.h:67
PositionVector getBoundingBox() const
get bounding rectangle
Definition: MSVehicle.cpp:4565
double getMinGapLat() const
Get the minimum lateral gap that vehicles of this type maintain.
void drawBestLanes() const
Draws the vehicle&#39;s best lanes.
Definition: GUIVehicle.cpp:462
bool addAdditionalGLVisualisation(const GUIGlObject *const which)
Adds an object to call its additional visualisation method.
static void drawLinkItem(const Position &pos, SUMOTime arrivalTime, SUMOTime leaveTime, double exagerate)
const SUMOVehicleParameter * myParameter
This vehicle&#39;s parameter.
const std::string & getID() const
Returns the id.
Definition: Named.h:74
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:55
int getLeftSublaneOnEdge() const
Definition: GUIVehicle.cpp:824
int size() const
Returns the number of edges to pass.
Definition: MSRoute.cpp:85
const std::vector< double > & getShapeRotations() const
Definition: GUILane.cpp:830
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:350
int getPersonCapacity() const
Get this vehicle type&#39;s person capacity.
void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=false) const
Definition: GUIVehicle.cpp:366
double getNaviDegree() const
return the current angle in navigational degrees
int getNumberReroutes() const
Returns the number of new routes this vehicle got.
double getWidth() const
Returns the lane&#39;s width.
Definition: MSLane.h:513
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:691
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
int getContainerCapacity() const
Get this vehicle type&#39;s container capacity.
bool removeAdditionalGLVisualisation(const GUIGlObject *const which)
Removes an object from the list of objects that show additional things.
void drawRouteHelper(const GUIVisualizationSettings &s, const MSRoute &r) const
Draws the route.
Definition: GUIVehicle.cpp:497
The car-following model and parameter.
Definition: MSVehicleType.h:72
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:3674
#define SIMTIME
Definition: SUMOTime.h:71
SUMOTime getBoardingDuration() const
Get this vehicle type&#39;s boarding duration.
Right blinker lights are switched on.
Definition: MSVehicle.h:1162
PositionVector mySeatPositions
positions of seats in the vehicle (updated at every drawing step)
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:69
double getChosenSpeedFactor() const
Returns the precomputed factor by which the driver wants to be faster than the speed limit...
double getMaxSpeed() const
Returns the maximum speed.
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:1240
bool isSelected() const
whether this vehicle is selected in the GUI
Definition: GUIVehicle.cpp:807
GUISUMOAbstractView * getActiveView() const
get the active view or 0
const MSCFModel & getCarFollowModel() const
Returns the vehicle&#39;s car following model definition.
Definition: MSVehicle.h:882
double getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:4138
Left blinker lights are switched on.
Definition: MSVehicle.h:1164
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:449
static GUIMainWindow * getInstance()
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
Definition: GUIVehicle.cpp:84
A list of positions.
double getTimeLossSeconds() const
Returns the time loss in seconds.
Definition: MSVehicle.h:676
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
Definition: MSVehicle.cpp:4026
SUMOTime getLoadingDuration() const
Get this vehicle type&#39;s loading duration.
#define SIMSTEP
Definition: SUMOTime.h:70
std::list< Stop > myStops
The vehicle&#39;s list of stops.
Definition: MSVehicle.h:1713
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:64
#define STEPS2TIME(x)
Definition: SUMOTime.h:64
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1690
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:1166
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:973
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:94
void setPositionInVehicle(const Position &pos)
Definition: GUIPerson.h:125
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Definition: MSVehicle.cpp:4180
render as a (city) rail without locomotive
double getImpatience() const
Returns this vehicles impatience.
A MSVehicle extended by some values for usage within the gui.
const PositionVector & getShape() const
Definition: GUILane.cpp:824
The brake lights are on.
Definition: MSVehicle.h:1168
void drawAction_drawRailCarriages(const GUIVisualizationSettings &s, double defaultLength, double carriageGap, int firstPassengerCarriage, bool asImage) const
Definition: GUIVehicle.cpp:547
A blue emergency light is on.
Definition: MSVehicle.h:1184
double getMinGap() const
Get the free space in front of vehicles of this class.
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
#define BLINKER_POS_BACK
Definition: GUIVehicle.cpp:330
double getMaxDecel() const
Get the vehicle type&#39;s maximal comfortable deceleration [m/s^2].
Definition: MSCFModel.h:211
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:276
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:276
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:716
const SUMOVTypeParameter & getParameter() const
void move2side(double amount)
move position vector to side using certain ammount
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:257
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:196
std::string line
The vehicle&#39;s line (mainly for public transport)
double getLateralPositionOnLane() const
Get the vehicle&#39;s lateral position on the lane.
Definition: MSVehicle.h:439
double getManeuverDist() const
return the lane-change maneuver distance
Definition: GUIVehicle.cpp:836
void setPositionInVehicle(const Position &pos)
Definition: GUIContainer.h:124
double getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:4144
int getRightSublaneOnEdge() const
return the righmost sublane on the edge occupied by the vehicle
Definition: GUIVehicle.cpp:812
render as a cargo train
void unlock()
release mutex lock
Definition: MFXMutex.cpp:93
double getMaxSpeedLat() const
Get vehicle&#39;s maximum lateral speed [m/s].
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
double getHeight() const
Get the height which vehicles of this class shall have when being drawn.
SUMOVehicleClass getVClass() const
Returns the vehicle&#39;s access class.
Structure representing possible vehicle parameter.
double length() const
Returns the length.
draw vehicle outside the road network
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
const Position & getSeatPosition(int personIndex) const
returns the seat position for the person with the given index
bool isActive() const
Returns whether the current simulation step is an action point for the vehicle.
Definition: MSVehicle.h:594
#define M_PI
Definition: odrSpiral.cpp:40
MSVehicleType * myType
This vehicle&#39;s type.
const std::map< std::string, std::string > & getMap() const
Returns the inner key/value map.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
const std::vector< double > & getShapeLengths() const
Definition: GUILane.cpp:836
double getAcceleration() const
Returns the vehicle&#39;s acceleration in m/s (this is computed as the last step&#39;s mean acceleration in c...
Definition: MSVehicle.h:499
const std::string & getID() const
Returns the name of the vehicle type.
double getPMxEmissions() const
Returns PMx emission of the current state.
Definition: MSVehicle.cpp:4162
void computeSeats(const Position &front, const Position &back, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
Definition: GUIVehicle.cpp:666
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:461
int getContainerNumber() const
Returns the number of containers.
Definition: MSVehicle.cpp:4253
double getLength() const
Get vehicle&#39;s length [m].
void lock()
lock mutex
Definition: MFXMutex.cpp:83
double getTimeGapOnLane() const
Returns the time gap in seconds to the leader of the vehicle on the same lane.
Definition: MSVehicle.cpp:4127
static SUMOTime gWaitingTimeMemory
length of memory for waiting times (in millisecs)
Definition: MSGlobals.h:115
MSLane * getTargetLane() const
Returns the lane the vehicle has committed to enter during a sublane lane change. ...
GUIGlID getGlID() const
Returns the numerical id of the object.
double getExaggeration(const GUIVisualizationSettings &s, double factor=20) const
return the drawing size including exaggeration and constantSize values
#define BLINKER_POS_FRONT
Definition: GUIVehicle.cpp:329
double getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:890
GUIVisualizationSizeSettings vehicleSize
void drawAction_drawBlinker(double dir, double length)
Definition: GUIVehicle.cpp:333
long long int SUMOTime
Definition: TraCIDefs.h:51
bool isActionStep(SUMOTime t) const
Returns whether the next simulation step will be an action point for the vehicle. ...
Definition: MSVehicle.h:601
MSLane * getShadowLane() const
Returns the lane the vehicle&#39;s shadow is on during continuous/sublane lane change.
double getHCEmissions() const
Returns HC emission of the current state.
Definition: MSVehicle.cpp:4150
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:73
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:1332
double getRightSideOnEdge(const MSLane *lane=0) const
Get the vehicle&#39;s lateral position on the edge of the given lane (or its current edge if lane == 0) ...
Definition: MSVehicle.cpp:4337
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:387
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:1358
double getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:482
static SUMOTime gLaneChangeDuration
Definition: MSGlobals.h:88
const std::string & getID() const
Returns the name of the vehicle.
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
GUISelectedStorage gSelected
A global holder of selected objects.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
std::vector< MSDevice * > myDevices
The devices this vehicle has.
void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:236
A window containing a gl-object&#39;s parameter.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type&#39;s emission class.
bool drawAction_drawVehicleAsImage(const GUIVisualizationSettings &s, double length=-1) const
MSRouteIterator end() const
Returns the end of the list of edges to pass.
Definition: MSRoute.cpp:79
double getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:685
double getSpeedLat() const
return the lateral speed of the current lane change maneuver
SUMOVehicleClass getVehicleClass() const
Get this vehicle type&#39;s vehicle class.
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
Definition: MSVehicle.h:1719
double getWidth() const
Returns the vehicle&#39;s width.
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:901
double pos() const
Position of this state.
Definition: MSVehicle.h:113
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:455
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:60