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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // A MSVehicle extended by some values for usage within the gui
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <cmath>
27 #include <vector>
28 #include <string>
32 #include <utils/geom/GeomHelper.h>
39 #include <utils/gui/div/GLHelper.h>
42 #include <microsim/MSGlobals.h>
43 #include <microsim/MSVehicle.h>
44 #include <microsim/MSJunction.h>
45 #include <microsim/MSLane.h>
53 #include <gui/GUIGlobals.h>
54 #include "GUIVehicle.h"
55 #include "GUIPerson.h"
56 #include "GUIContainer.h"
57 #include "GUINet.h"
58 #include "GUIEdge.h"
59 #include "GUILane.h"
60 
61 //#define DEBUG_FOES
62 
63 // ===========================================================================
64 // FOX callback mapping
65 // ===========================================================================
66 
67 // Object implementation
68 
69 
70 /* -------------------------------------------------------------------------
71  * GUIVehicle - methods
72  * ----------------------------------------------------------------------- */
73 #ifdef _MSC_VER
74 #pragma warning(push)
75 #pragma warning(disable: 4355)
76 #endif
78  MSVehicleType* type, const double speedFactor) :
79  MSVehicle(pars, route, type, speedFactor),
80  GUIBaseVehicle((MSBaseVehicle&) * this) {
81 }
82 #ifdef _MSC_VER
83 #pragma warning(pop)
84 #endif
85 
86 
88 }
89 
90 
94  const int sublaneParams = MSGlobals::gLateralResolution > 0 ? 4 : 0;
96  new GUIParameterTableWindow(app, *this, 37 + sublaneParams + (int)getParameter().getParametersMap().size());
97  // add items
98  ret->mkItem("lane [id]", false, Named::getIDSecure(myLane, "n/a"));
100  const MSLane* shadowLane = getLaneChangeModel().getShadowLane();
101  ret->mkItem("shadow lane [id]", false, shadowLane == 0 ? "" : shadowLane->getID());
102  }
104  const MSLane* targetLane = getLaneChangeModel().getTargetLane();
105  ret->mkItem("target lane [id]", false, targetLane == 0 ? "" : targetLane->getID());
106  }
107  ret->mkItem("position [m]", true,
109  ret->mkItem("lateral offset [m]", true,
111  ret->mkItem("speed [m/s]", true,
113  ret->mkItem("lateral speed [m/s]", true,
115  ret->mkItem("acceleration [m/s^2]", true,
117  ret->mkItem("angle [degree]", true,
119  ret->mkItem("slope [degree]", true,
121  ret->mkItem("speed factor", false, getChosenSpeedFactor());
122  ret->mkItem("time gap on lane [s]", true,
124  ret->mkItem("waiting time [s]", true,
126  ret->mkItem(("waiting time (accumulated, " + time2string(MSGlobals::gWaitingTimeMemory) + "s) [s]").c_str(), true,
128  ret->mkItem("time loss [s]", true,
130  ret->mkItem("impatience", true,
132  ret->mkItem("last lane change [s]", true,
134  ret->mkItem("desired depart [s]", false, time2string(getParameter().depart));
135  ret->mkItem("depart delay [s]", false, time2string(getDepartDelay()));
136  if (getParameter().repetitionNumber < std::numeric_limits<int>::max()) {
137  ret->mkItem("remaining [#]", false, (int) getParameter().repetitionNumber - getParameter().repetitionsDone);
138  }
139  if (getParameter().repetitionOffset > 0) {
140  ret->mkItem("insertion period [s]", false, time2string(getParameter().repetitionOffset));
141  }
142  if (getParameter().repetitionProbability > 0) {
143  ret->mkItem("insertion probability", false, getParameter().repetitionProbability);
144  }
145  ret->mkItem("stop info", false, getStopInfo());
146  ret->mkItem("line", false, myParameter->line);
147  ret->mkItem("CO2 [mg/s]", true,
149  ret->mkItem("CO [mg/s]", true,
151  ret->mkItem("HC [mg/s]", true,
153  ret->mkItem("NOx [mg/s]", true,
155  ret->mkItem("PMx [mg/s]", true,
157  ret->mkItem("fuel [ml/s]", true,
159  ret->mkItem("electricity [Wh/s]", true,
161  ret->mkItem("noise (Harmonoise) [dB]", true,
163  std::ostringstream str;
164  for (std::vector<MSDevice*>::const_iterator i = myDevices.begin(); i != myDevices.end(); ++i) {
165  if (i != myDevices.begin()) {
166  str << ' ';
167  }
168  str << (*i)->getID().substr(0, (*i)->getID().find(getID()));
169  }
170  ret->mkItem("devices", false, str.str());
171  ret->mkItem("persons", true,
173  ret->mkItem("containers", true,
175  // close building
177  ret->mkItem("right side on edge [m]", true, new FunctionBinding<GUIVehicle, double>(this, &GUIVehicle::getRightSideOnEdge2));
178  ret->mkItem("left side on edge [m]", true, new FunctionBinding<GUIVehicle, double>(this, &GUIVehicle::getLeftSideOnEdge));
179  ret->mkItem("rightmost edge sublane [#]", true, new FunctionBinding<GUIVehicle, int>(this, &GUIVehicle::getRightSublaneOnEdge));
180  ret->mkItem("leftmost edge sublane [#]", true, new FunctionBinding<GUIVehicle, int>(this, &GUIVehicle::getLeftSublaneOnEdge));
181  ret->mkItem("lane change maneuver distance [m]", true, new FunctionBinding<GUIVehicle, double>(this, &GUIVehicle::getManeuverDist));
182  }
183  ret->closeBuilding(&getParameter());
184  return ret;
185 }
186 
187 
192  new GUIParameterTableWindow(app, *this, 25
193  + (int)myType->getParameter().getParametersMap().size()
194  + (int)myType->getParameter().lcParameter.size()
195  + (int)myType->getParameter().jmParameter.size());
196  // add items
197  ret->mkItem("Type Information:", false, "");
198  ret->mkItem("type [id]", false, myType->getID());
199  ret->mkItem("length", false, myType->getLength());
200  ret->mkItem("width", false, myType->getWidth());
201  ret->mkItem("height", false, myType->getHeight());
202  ret->mkItem("minGap", false, myType->getMinGap());
203  ret->mkItem("vehicle class", false, SumoVehicleClassStrings.getString(myType->getVehicleClass()));
204  ret->mkItem("emission class", false, PollutantsInterface::getName(myType->getEmissionClass()));
205  ret->mkItem("carFollowModel", false, SUMOXMLDefinitions::CarFollowModels.getString((SumoXMLTag)getCarFollowModel().getModelID()));
206  ret->mkItem("LaneChangeModel", false, SUMOXMLDefinitions::LaneChangeModels.getString(getLaneChangeModel().getModelID()));
207  ret->mkItem("maximum speed [m/s]", false, getMaxSpeed());
208  ret->mkItem("maximum acceleration [m/s^2]", false, getCarFollowModel().getMaxAccel());
209  ret->mkItem("maximum deceleration [m/s^2]", false, getCarFollowModel().getMaxDecel());
210  ret->mkItem("emergency deceleration [m/s^2]", false, getCarFollowModel().getEmergencyDecel());
211  ret->mkItem("apparent deceleration [m/s^2]", false, getCarFollowModel().getApparentDecel());
212  ret->mkItem("imperfection (sigma)", false, getCarFollowModel().getImperfection());
213  ret->mkItem("desired headway (tau)", false, getCarFollowModel().getHeadwayTime());
214  ret->mkItem("person capacity", false, myType->getPersonCapacity());
215  ret->mkItem("boarding time", false, STEPS2TIME(myType->getBoardingDuration()));
216  ret->mkItem("container capacity", false, myType->getContainerCapacity());
217  ret->mkItem("loading time", false, STEPS2TIME(myType->getLoadingDuration()));
219  ret->mkItem("minGapLat", false, myType->getMinGapLat());
220  ret->mkItem("maxSpeedLat", false, myType->getMaxSpeedLat());
221  ret->mkItem("latAlignment", false, toString(myType->getPreferredLateralAlignment()));
222  } else if (MSGlobals::gLaneChangeDuration > 0) {
223  ret->mkItem("maxSpeedLat", false, myType->getMaxSpeedLat());
224  }
225  for (auto item : myType->getParameter().lcParameter) {
226  ret->mkItem(toString(item.first).c_str(), false, toString(item.second));
227  }
228  for (auto item : myType->getParameter().jmParameter) {
229  ret->mkItem(toString(item.first).c_str(), false, toString(item.second));
230  }
231 
232  // close building
233  ret->closeBuilding(&(myType->getParameter()));
234  return ret;
235 }
236 
237 
238 
239 void
241  glTranslated(0, 0, getType() + .2); // draw on top of cars
242  for (DriveItemVector::const_iterator i = myLFLinkLanes.begin(); i != myLFLinkLanes.end(); ++i) {
243  if ((*i).myLink == 0) {
244  continue;
245  }
246  MSLink* link = (*i).myLink;
247  MSLane* via = link->getViaLaneOrLane();
248  if (via != 0) {
249  Position p = via->getShape()[0];
250  if ((*i).mySetRequest) {
251  glColor3d(0, .8, 0);
252  } else {
253  glColor3d(.8, 0, 0);
254  }
255  const SUMOTime leaveTime = (*i).myLink->getLeaveTime(
256  (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(), getVehicleType().getLength());
257  drawLinkItem(p, (*i).myArrivalTime, leaveTime, s.vehicleName.size / s.scale);
258  // the time slot that ego vehicle uses when checking opened may
259  // differ from the one it requests in setApproaching
260  MSLink::ApproachingVehicleInformation avi = (*i).myLink->getApproaching(this);
261  assert(avi.arrivalTime == (*i).myArrivalTime && avi.leavingTime == leaveTime);
262  UNUSED_PARAMETER(avi); // only used for assertion
263  }
264  }
265  glTranslated(0, 0, getType() - .2); // draw on top of cars
266 }
267 
268 
269 bool
271  switch (guiShape) {
272  case SVS_BUS_FLEXIBLE:
273  drawAction_drawRailCarriages(s, 8.25, 0, 0, asImage); // 16.5 overall, 2 modules http://de.wikipedia.org/wiki/Ikarus_180
274  break;
275  case SVS_RAIL:
276  drawAction_drawRailCarriages(s, 24.5, 1, 1, asImage); // http://de.wikipedia.org/wiki/UIC-Y-Wagen_%28DR%29
277  break;
278  case SVS_RAIL_CAR:
279  drawAction_drawRailCarriages(s, 16.85, 1, 0, asImage); // 67.4m overall, 4 carriages http://de.wikipedia.org/wiki/DB-Baureihe_423
280 // drawAction_drawRailCarriages(s, 5.71, 0, 0, asImage); // 40.0m overall, 7 modules http://de.wikipedia.org/wiki/Bombardier_Flexity_Berlin
281 // drawAction_drawRailCarriages(s, 9.44, 1, 1, asImage); // actually length of the locomotive http://de.wikipedia.org/wiki/KJI_Nr._20_und_21
282 // drawAction_drawRailCarriages(s, 24.775, 0, 0, asImage); // http://de.wikipedia.org/wiki/ICE_3
283  break;
284  case SVS_RAIL_CARGO:
285  drawAction_drawRailCarriages(s, 13.86, 1, 0, asImage); // UIC 571-1 http://de.wikipedia.org/wiki/Flachwagen
286  break;
287  default:
288  return false;
289  }
290  return true;
291 }
292 
293 #define BLINKER_POS_FRONT .5
294 #define BLINKER_POS_BACK .5
295 
296 inline void
297 drawAction_drawBlinker(double dir, double length) {
298  glColor3d(1.f, .8f, 0);
299  glPushMatrix();
300  glTranslated(dir, BLINKER_POS_FRONT, -0.1);
302  glPopMatrix();
303  glPushMatrix();
304  glTranslated(dir, length - BLINKER_POS_BACK, -0.1);
306  glPopMatrix();
307 }
308 
309 
310 void
313  return;
314  }
315  const double offset = MAX2(.5 * getVehicleType().getWidth(), .4);
317  drawAction_drawBlinker(-offset, length);
318  }
320  drawAction_drawBlinker(offset, length);;
321  }
323  drawAction_drawBlinker(-offset, length);
324  drawAction_drawBlinker(offset, length);
325  }
326 }
327 
328 
329 inline void
330 GUIVehicle::drawAction_drawVehicleBrakeLight(double length, bool onlyOne) const {
332  return;
333  }
334  glColor3f(1.f, .2f, 0);
335  glPushMatrix();
336  if (onlyOne) {
337  glTranslated(0, length, -0.1);
339  } else {
340  glTranslated(-getVehicleType().getWidth() * 0.5, length, -0.1);
342  glPopMatrix();
343  glPushMatrix();
344  glTranslated(getVehicleType().getWidth() * 0.5, length, -0.1);
346  }
347  glPopMatrix();
348 }
349 
350 inline void
353  glPushMatrix();
354  glTranslated(0, 2.5, .5);
355  glColor3f(0, 0, 1);
357  glPopMatrix();
358  }
359 }
360 
361 
362 double
363 GUIVehicle::getColorValue(int activeScheme) const {
364  switch (activeScheme) {
365  case 8:
366  return getSpeed();
367  case 9:
368  // color by action step
369  if (isActionStep(SIMSTEP)) {
370  // Upcoming simstep is actionstep (t was already increased before drawing)
371  return 1.;
372  } else if (isActive()) {
373  // Completed simstep was actionstep
374  return 2.;
375  } else {
376  // not active
377  return 0.;
378  }
379  case 10:
380  return getWaitingSeconds();
381  case 11:
383  case 12:
384  return getLastLaneChangeOffset();
385  case 13:
386  return getLane()->getVehicleMaxSpeed(this);
387  case 14:
388  return getCO2Emissions();
389  case 15:
390  return getCOEmissions();
391  case 16:
392  return getPMxEmissions();
393  case 17:
394  return getNOxEmissions();
395  case 18:
396  return getHCEmissions();
397  case 19:
398  return getFuelConsumption();
399  case 20:
401  case 21:
402  if (getNumberReroutes() == 0) {
403  return -1;
404  }
405  return getNumberReroutes();
406  case 22:
408  case 23:
409  return getLaneChangeModel().isOpposite() ? -100 : getBestLaneOffset();
410  case 24:
411  return getAcceleration();
412  case 25:
413  return getTimeGapOnLane();
414  case 26:
415  return STEPS2TIME(getDepartDelay());
416  case 27:
417  return getElectricityConsumption();
418  case 28:
419  return getTimeLossSeconds();
420  }
421  return 0;
422 }
423 
424 
425 void
427  myLock.lock();
428  std::vector<std::vector<MSVehicle::LaneQ> > bestLanes = myBestLanes;
429  myLock.unlock();
430  for (std::vector<std::vector<MSVehicle::LaneQ> >::iterator j = bestLanes.begin(); j != bestLanes.end(); ++j) {
431  std::vector<MSVehicle::LaneQ>& lanes = *j;
432  double gmax = -1;
433  double rmax = -1;
434  for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
435  gmax = MAX2((*i).length, gmax);
436  rmax = MAX2((*i).occupation, rmax);
437  }
438  for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
439  const PositionVector& shape = (*i).lane->getShape();
440  double g = (*i).length / gmax;
441  double r = (*i).occupation / rmax;
442  glColor3d(r, g, 0);
443  double width = 0.5 / (1 + abs((*i).bestLaneOffset));
444  GLHelper::drawBoxLines(shape, width);
445 
446  PositionVector s1 = shape;
447  s1.move2side((double) .1);
448  glColor3d(r, 0, 0);
449  GLHelper::drawLine(s1);
450  s1.move2side((double) - .2);
451  glColor3d(0, g, 0);
452  GLHelper::drawLine(s1);
453 
454  glColor3d(r, g, 0);
455  }
456  }
457 }
458 
459 
460 void
462  const double exaggeration = s.vehicleSize.getExaggeration(s);
463  MSRouteIterator i = r.begin();
464  const std::vector<MSLane*>& bestLaneConts = getBestLanesContinuation();
465  // draw continuation lanes when drawing the current route where available
466  int bestLaneIndex = (&r == myRoute ? 0 : (int)bestLaneConts.size());
467  for (; i != r.end(); ++i) {
468  const GUILane* lane;
469  if (bestLaneIndex < (int)bestLaneConts.size() && bestLaneConts[bestLaneIndex] != 0 && (*i) == &(bestLaneConts[bestLaneIndex]->getEdge())) {
470  lane = static_cast<GUILane*>(bestLaneConts[bestLaneIndex]);
471  ++bestLaneIndex;
472  } else {
473  const std::vector<MSLane*>* allowed = (*i)->allowedLanes(getVClass());
474  if (allowed != 0 && allowed->size() != 0) {
475  lane = static_cast<GUILane*>((*allowed)[0]);
476  } else {
477  lane = static_cast<GUILane*>((*i)->getLanes()[0]);
478  }
479  }
480  GLHelper::drawBoxLines(lane->getShape(), lane->getShapeRotations(), lane->getShapeLengths(), exaggeration);
481  }
482  int stopIndex = 0;
483  for (const Stop& stop : myStops) {
484  Position pos = stop.lane->geometryPositionAtOffset(stop.reached ? getPositionOnLane() : stop.getEndPos(*this));
485  GLHelper::drawBoxLines(stop.lane->getShape().getOrthogonal(pos, 10, true, stop.lane->getWidth()), 0.1);
486  std::string label = stop.reached ? "stopped" : "stop " + toString(stopIndex);
487  if (stop.pars.until >= 0) {
488  label += " until:" + time2string(stop.pars.until);
489  }
490  if (stop.duration >= 0) {
491  label += " duration:" + time2string(stop.duration);
492  }
493  GLHelper::drawText(label, pos, 1.0, s.vehicleName.size / s.scale, s.vehicleName.color);
494  stopIndex++;
495  }
496 }
497 
498 
499 
500 MSLane*
501 GUIVehicle::getPreviousLane(MSLane* current, int& furtherIndex) const {
502  if (furtherIndex < (int)myFurtherLanes.size()) {
503  return myFurtherLanes[furtherIndex++];
504  } else {
505  const int routeIndex = (int)(getCurrentRouteEdge() - myRoute->begin());
506  int backIndex = furtherIndex + 1;
507  for (MSLane* l : myFurtherLanes) {
508  if (l->isInternal()) {
509  backIndex--;
510  }
511  }
512  if (routeIndex >= backIndex) {
513  furtherIndex++;
514  // could also look for the first lane that allows this vehicle class
515  // but this is probably not an issue for trains
516  return (*(getCurrentRouteEdge() - backIndex))->getLanes()[0];
517  }
518  return current;
519  }
520 }
521 
522 
523 void
524 GUIVehicle::drawAction_drawRailCarriages(const GUIVisualizationSettings& s, double defaultLength, double carriageGap, int firstPassengerCarriage, bool asImage) const {
525  RGBColor current = GLHelper::getColor();
526  RGBColor darker = current.changedBrightness(-51);
527  const double exaggeration = s.vehicleSize.getExaggeration(s);
528  const double totalLength = getVType().getLength();
529  double upscaleLength = exaggeration;
530  if (exaggeration > 1 && totalLength > 5) {
531  // reduce the length/width ratio because this is not usefull at high zoom
532  upscaleLength = MAX2(1.0, upscaleLength * (5 + sqrt(totalLength - 5)) / totalLength);
533  }
534  defaultLength *= upscaleLength;
535  if (exaggeration == 0) {
536  return;
537  }
538  carriageGap *= upscaleLength;
539  const double length = totalLength * upscaleLength;
540  const double halfWidth = getVehicleType().getWidth() / 2.0 * exaggeration;
541  glPopMatrix(); // undo scaling and 90 degree rotation
542  glPopMatrix(); // undo initial translation and rotation
543  GLHelper::setColor(darker);
544  const double xCornerCut = 0.3 * exaggeration;
545  const double yCornerCut = 0.4 * exaggeration;
546  // round to closest integer
547  const int numCarriages = MAX2(1, (int)(length / (defaultLength + carriageGap) + 0.5));
548  assert(numCarriages > 0);
549  const double carriageLengthWithGap = length / numCarriages;
550  const double carriageLength = carriageLengthWithGap - carriageGap;
551  // lane on which the carriage front is situated
552  MSLane* lane = myLane;
553  int furtherIndex = 0;
554  // lane on which the carriage back is situated
555  MSLane* backLane = myLane;
556  int backFurtherIndex = furtherIndex;
557  // offsets of front and back
558  double carriageOffset = myState.pos();
559  double carriageBackOffset = myState.pos() - carriageLength;
560  // handle seats
561  int requiredSeats = getNumPassengers();
562  if (requiredSeats > 0) {
563  mySeatPositions.clear();
564  }
565  Position front, back;
566  double angle = 0.;
567  // draw individual carriages
568  for (int i = 0; i < numCarriages; ++i) {
569  while (carriageOffset < 0) {
570  MSLane* prev = getPreviousLane(lane, furtherIndex);
571  if (prev != lane) {
572  carriageOffset += prev->getLength();
573  } else {
574  // no lane available for drawing.
575  carriageOffset = 0;
576  }
577  lane = prev;
578  }
579  while (carriageBackOffset < 0) {
580  MSLane* prev = getPreviousLane(backLane, backFurtherIndex);
581  if (prev != backLane) {
582  carriageBackOffset += prev->getLength();
583  } else {
584  // no lane available for drawing.
585  carriageBackOffset = 0;
586  }
587  backLane = prev;
588  }
589  front = lane->geometryPositionAtOffset(carriageOffset);
590  back = backLane->geometryPositionAtOffset(carriageBackOffset);
591  if (front == back) {
592  // no place for drawing available
593  continue;
594  }
595  const double drawnCarriageLength = front.distanceTo2D(back);
596  angle = atan2((front.x() - back.x()), (back.y() - front.y())) * (double) 180.0 / (double) M_PI;
597  if (i >= firstPassengerCarriage) {
598  computeSeats(front, back, requiredSeats);
599  }
600  glPushMatrix();
601  glTranslated(front.x(), front.y(), getType());
602  glRotated(angle, 0, 0, 1);
603  if (!asImage || !drawAction_drawVehicleAsImage(s, carriageLength)) {
604  glBegin(GL_TRIANGLE_FAN);
605  glVertex2d(-halfWidth + xCornerCut, 0);
606  glVertex2d(-halfWidth, yCornerCut);
607  glVertex2d(-halfWidth, drawnCarriageLength - yCornerCut);
608  glVertex2d(-halfWidth + xCornerCut, drawnCarriageLength);
609  glVertex2d(halfWidth - xCornerCut, drawnCarriageLength);
610  glVertex2d(halfWidth, drawnCarriageLength - yCornerCut);
611  glVertex2d(halfWidth, yCornerCut);
612  glVertex2d(halfWidth - xCornerCut, 0);
613  glEnd();
614  }
615  glPopMatrix();
616  carriageOffset -= carriageLengthWithGap;
617  carriageBackOffset -= carriageLengthWithGap;
618  GLHelper::setColor(current);
619  }
620  if (getVType().getGuiShape() == SVS_RAIL_CAR) {
621  glPushMatrix();
622  glTranslated(front.x(), front.y(), getType());
623  glRotated(angle, 0, 0, 1);
624  drawAction_drawVehicleBlinker(carriageLength);
625  drawAction_drawVehicleBrakeLight(carriageLength);
626  glPopMatrix();
627  }
628  // restore matrices
629  glPushMatrix();
630  front = getPosition();
631  glTranslated(front.x(), front.y(), getType());
632  const double degAngle = RAD2DEG(getAngle() + M_PI / 2.);
633  glRotated(degAngle, 0, 0, 1);
634  glScaled(exaggeration, upscaleLength, 1);
635  glPushMatrix();
636 }
637 
638 
639 int
641  if (myPersonDevice != 0) {
642  return (int)myPersonDevice->size();
643  }
644  return 0;
645 }
646 
647 
648 void
649 GUIVehicle::computeSeats(const Position& front, const Position& back, int& requiredSeats) const {
650  if (requiredSeats <= 0) {
651  return; // save some work
652  }
653  const double length = front.distanceTo2D(back);
654  if (length < 4) {
655  // small vehicle, sit at the center
656  mySeatPositions.push_back(PositionVector::positionAtOffset2D(front, back, length / 2));
657  requiredSeats--;
658  } else {
659  for (double p = 2; p <= length - 1; p += 1) {
660  mySeatPositions.push_back(PositionVector::positionAtOffset2D(front, back, p));
661  requiredSeats--;
662  }
663  }
664 }
665 
666 
667 double
670 }
671 
672 
673 std::string
675  std::string result = "";
676  if (isParking()) {
677  result += "parking";
678  } else if (isStopped()) {
679  result += "stopped";
680  } else if (hasStops()) {
681  return "next: " + myStops.front().getDescription();
682  } else {
683  return "";
684  }
685  if (myStops.front().pars.triggered) {
686  result += ", triggered";
687  } else if (myStops.front().pars.containerTriggered) {
688  result += ", containerTriggered";
689  } else if (myStops.front().collision) {
690  result += ", collision";
691  } else if (myStops.front().pars.until != -1) {
692  result += ", until=" + time2string(myStops.front().pars.until);
693  } else {
694  result += ", duration=" + time2string(myStops.front().duration);
695  }
696  return result;
697 }
698 
699 
700 void
702  double dist = myLane->getLength() - getPositionOnLane();
703 #ifdef DEBUG_FOES
704  std::cout << SIMTIME << " selectBlockingFoes veh=" << getID() << " dist=" << dist << " numLinks=" << myLFLinkLanes.size() << "\n";
705 #endif
706  for (DriveItemVector::const_iterator i = myLFLinkLanes.begin(); i != myLFLinkLanes.end(); ++i) {
707  const DriveProcessItem& dpi = *i;
708  if (dpi.myLink == 0) {
710  continue;
711  }
712  std::vector<const SUMOVehicle*> blockingFoes;
713  std::vector<const MSPerson*> blockingPersons;
714 #ifdef DEBUG_FOES
715  std::cout << " foeLink=" << dpi.myLink->getViaLaneOrLane()->getID() << "\n";
716  const bool isOpen =
717 #endif
720 #ifdef DEBUG_FOES
721  if (!isOpen) {
722  std::cout << " closed due to:\n";
723  for (std::vector<const SUMOVehicle*>::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) {
724  std::cout << " " << (*it)->getID() << "\n";
725  }
726  }
727 #endif
728  if (getLaneChangeModel().getShadowLane() != 0) {
729  MSLink* parallelLink = dpi.myLink->getParallelLink(getLaneChangeModel().getShadowDirection());
730  if (parallelLink != 0) {
731  const double shadowLatPos = getLateralPositionOnLane() - getLaneChangeModel().getShadowDirection() * 0.5 * (
733 #ifdef DEBUG_FOES
734  const bool isShadowOpen =
735 #endif
736  parallelLink->opened(dpi.myArrivalTime, dpi.myArrivalSpeed, dpi.getLeaveSpeed(),
739  getWaitingTime(), shadowLatPos, &blockingFoes);
740 #ifdef DEBUG_FOES
741  if (!isShadowOpen) {
742  std::cout << " foes at shadow link=" << parallelLink->getViaLaneOrLane()->getID() << ":\n";
743  for (std::vector<const SUMOVehicle*>::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) {
744  std::cout << " " << (*it)->getID() << "\n";
745  }
746  }
747 #endif
748  }
749  }
750  for (std::vector<const SUMOVehicle*>::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) {
751  gSelected.select(static_cast<const GUIVehicle*>(*it)->getGlID());
752  }
753 #ifdef DEBUG_FOES
754  gDebugFlag1 = true;
755 #endif
756  const MSLink::LinkLeaders linkLeaders = (dpi.myLink)->getLeaderInfo(this, dist, &blockingPersons);
757 #ifdef DEBUG_FOES
758  gDebugFlag1 = false;
759 #endif
760  for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
761  // the vehicle to enter the junction first has priority
762  const GUIVehicle* leader = dynamic_cast<const GUIVehicle*>(it->vehAndGap.first);
763  if (leader != 0) {
764  if (dpi.myLink->isLeader(this, leader)) {
765  gSelected.select(leader->getGlID());
766 #ifdef DEBUG_FOES
767  std::cout << " linkLeader=" << leader->getID() << "\n";
768 #endif
769  }
770  } else {
771  for (std::vector<const MSPerson*>::iterator it_p = blockingPersons.begin(); it_p != blockingPersons.end(); ++it_p) {
772  const GUIPerson* foe = dynamic_cast<const GUIPerson*>(*it_p);
773  if (foe != 0) {
774  gSelected.select(foe->getGlID());
775  //std::cout << SIMTIME << " veh=" << getID() << " is blocked on link " << dpi.myLink->getRespondIndex() << " to " << dpi.myLink->getViaLaneOrLane()->getID() << " by pedestrian. dist=" << it->second << "\n";
776  }
777  }
778  }
779  }
780  dist += dpi.myLink->getViaLaneOrLane()->getLength();
781  }
782 }
783 
784 
785 void
788  GUISUMOAbstractView* view = mw->getActiveView();
789  if (view != 0) {
790  if (add) {
793  view->addAdditionalGLVisualisation(this);
794  }
795  } else {
798  }
799  }
800 }
801 
802 bool
805 }
806 
807 int
809  const double rightSide = getRightSideOnEdge();
810  const std::vector<double>& sublaneSides = myLane->getEdge().getSubLaneSides();
811  for (int i = 0; i < (int)sublaneSides.size(); ++i) {
812  if (sublaneSides[i] > rightSide) {
813  return MAX2(i - 1, 0);
814  }
815  }
816  return -1;
817 }
818 
819 int
821  const double leftSide = getLeftSideOnEdge();
822  const std::vector<double>& sublaneSides = myLane->getEdge().getSubLaneSides();
823  for (int i = (int)sublaneSides.size() - 1; i >= 0; --i) {
824  if (sublaneSides[i] < leftSide) {
825  return i;
826  }
827  }
828  return -1;
829 }
830 
831 double
834 }
835 
836 /****************************************************************************/
837 
bool gDebugFlag1
global utility flags for debugging
Definition: StdDefs.cpp:32
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
void drawAction_drawVehicleBlinker(double length) const
Definition: GUIVehicle.cpp:311
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:270
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:92
Drive process items represent bounds on the safe velocity corresponding to the upcoming links...
Definition: MSVehicle.h:1793
static double gLateralResolution
Definition: MSGlobals.h:85
double getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:4523
const std::vector< double > getSubLaneSides() const
Returns the right side offsets of this edge&#39;s sublanes.
Definition: MSEdge.h:546
int getContainerNumber() const
Returns the number of containers.
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs...
Definition: MSVehicle.h:667
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:485
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:4511
render as a rail
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:617
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
long long int SUMOTime
Definition: SUMOTime.h:36
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:4529
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:150
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:625
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: GUIVehicle.h:74
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:178
double getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:657
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1739
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1759
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1712
a vehicles
DriveItemVector myLFLinkLanes
Definition: MSVehicle.h:1848
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:561
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:135
int getNumPassengers() const
return the number of passengers
Definition: GUIVehicle.cpp:640
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:243
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
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:501
static bool haveLateralDynamics()
whether any kind of lateral dynamics is active
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:61
double getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:399
const SUMOVehicleParameter & getParameter() const
Returns the vehicle&#39;s parameter (including departure definition)
int getBestLaneOffset() const
Definition: MSVehicle.cpp:4409
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:67
GUIVisualizationTextSettings vehicleName
double x() const
Returns the x-position.
Definition: Position.h:56
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:363
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:611
double getLeaveSpeed() const
Definition: MSVehicle.h:1840
T MAX2(T a, T b)
Definition: StdDefs.h:76
SUMOTime getDepartDelay() const
Returns the depart delay.
double getLeftSideOnEdge() const
return left vehicle side on current edge
Definition: GUIVehicle.h:139
void drawOutsideNetwork(bool add)
register vehicle for drawing while outside the network
Definition: GUIVehicle.cpp:786
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:507
const PositionVector & getShape() const
Returns this lane&#39;s shape.
Definition: MSLane.h:449
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:62
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:426
bool addAdditionalGLVisualisation(const GUIGlObject *const which)
Adds an object to call its additional visualisation method.
#define RAD2DEG(x)
Definition: GeomHelper.h:39
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:69
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:50
int getLeftSublaneOnEdge() const
Definition: GUIVehicle.cpp:820
int size() const
Returns the number of edges to pass.
Definition: MSRoute.cpp:79
const std::vector< double > & getShapeRotations() const
Definition: GUILane.cpp:856
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:344
int getPersonCapacity() const
Get this vehicle type&#39;s person capacity.
void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=false) const
Definition: GUIVehicle.cpp:330
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:523
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:674
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:33
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:461
The car-following model and parameter.
Definition: MSVehicleType.h:66
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:4028
#define SIMTIME
Definition: SUMOTime.h:65
SUMOTime getBoardingDuration() const
Get this vehicle type&#39;s boarding duration.
Right blinker lights are switched on.
Definition: MSVehicle.h:1173
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:63
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:1251
bool isSelected() const
whether this vehicle is selected in the GUI
Definition: GUIVehicle.cpp:803
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:887
double getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:4493
Left blinker lights are switched on.
Definition: MSVehicle.h:1175
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:49
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:573
static GUIMainWindow * getInstance()
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
Definition: GUIVehicle.cpp:77
A list of positions.
double getTimeLossSeconds() const
Returns the time loss in seconds.
Definition: MSVehicle.h:673
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
Definition: MSVehicle.cpp:4380
SUMOTime getLoadingDuration() const
Get this vehicle type&#39;s loading duration.
#define SIMSTEP
Definition: SUMOTime.h:64
std::list< Stop > myStops
The vehicle&#39;s list of stops.
Definition: MSVehicle.h:1749
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:58
#define STEPS2TIME(x)
Definition: SUMOTime.h:58
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1727
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:1177
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:990
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:87
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Definition: MSVehicle.cpp:4535
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:850
The brake lights are on.
Definition: MSVehicle.h:1179
void drawAction_drawRailCarriages(const GUIVisualizationSettings &s, double defaultLength, double carriageGap, int firstPassengerCarriage, bool asImage) const
Definition: GUIVehicle.cpp:524
A blue emergency light is on.
Definition: MSVehicle.h:1195
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:294
double getMaxDecel() const
Get the vehicle type&#39;s maximal comfortable deceleration [m/s^2].
Definition: MSCFModel.h:218
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:270
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:240
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:701
const SUMOVTypeParameter & getParameter() const
void move2side(double amount)
move position vector to side using certain ammount
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:189
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:436
double getManeuverDist() const
return the lane-change maneuver distance
Definition: GUIVehicle.cpp:832
double getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:4499
int getRightSublaneOnEdge() const
return the righmost sublane on the edge occupied by the vehicle
Definition: GUIVehicle.cpp:808
render as a cargo train
void unlock()
release mutex lock
Definition: MFXMutex.cpp:87
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.
int getPersonNumber() const
Returns the number of persons.
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.
bool isActive() const
Returns whether the current simulation step is an action point for the vehicle.
Definition: MSVehicle.h:591
#define M_PI
Definition: odrSpiral.cpp:40
MSVehicleType * myType
This vehicle&#39;s type.
SubParams jmParameter
Junction-model parameter.
const std::vector< double > & getShapeLengths() const
Definition: GUILane.cpp:862
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:496
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:94
double getPMxEmissions() const
Returns PMx emission of the current state.
Definition: MSVehicle.cpp:4517
void computeSeats(const Position &front, const Position &back, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
Definition: GUIVehicle.cpp:649
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:471
double getLength() const
Get vehicle&#39;s length [m].
void lock()
lock mutex
Definition: MFXMutex.cpp:77
double getTimeGapOnLane() const
Returns the time gap in seconds to the leader of the vehicle on the same lane.
Definition: MSVehicle.cpp:4482
static SUMOTime gWaitingTimeMemory
length of memory for waiting times (in millisecs)
Definition: MSGlobals.h:109
MSLane * getTargetLane() const
Returns the lane the vehicle has committed to enter during a sublane lane change. ...
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
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:293
double getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:921
GUIVisualizationSizeSettings vehicleSize
void drawAction_drawBlinker(double dir, double length)
Definition: GUIVehicle.cpp:297
bool isActionStep(SUMOTime t) const
Returns whether the next simulation step will be an action point for the vehicle. ...
Definition: MSVehicle.h:598
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:4505
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:67
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:1386
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:4649
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:351
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:1428
double getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:479
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
static SUMOTime gLaneChangeDuration
Definition: MSGlobals.h:82
const std::string & getID() const
Returns the name of the vehicle.
GUISelectedStorage gSelected
A global holder of selected objects.
Representation of a lane in the micro simulation.
Definition: MSLane.h:71
std::vector< MSDevice * > myDevices
The devices this vehicle has.
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
SubParams lcParameter
Lane-changing parameter.
static StringBijection< LaneChangeModel > LaneChangeModels
lane change models
MSRouteIterator end() const
Returns the end of the list of edges to pass.
Definition: MSRoute.cpp:73
double getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:668
double getSpeedLat() const
return the lateral speed of the current lane change maneuver
double getAngle() const
Return current angle.
Definition: GUIVehicle.h:82
SUMOVehicleClass getVehicleClass() const
Get this vehicle type&#39;s vehicle class.
double getWidth() const
Returns the vehicle&#39;s width.
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:915
double pos() const
Position of this state.
Definition: MSVehicle.h:109
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:579
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:54