Eclipse 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-2019 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>
43 #include <microsim/MSGlobals.h>
44 #include <microsim/MSVehicle.h>
45 #include <microsim/MSJunction.h>
46 #include <microsim/MSLane.h>
56 #include <gui/GUIGlobals.h>
57 
58 #include "GUIVehicle.h"
59 #include "GUIPerson.h"
60 #include "GUIContainer.h"
61 #include "GUINet.h"
62 #include "GUIEdge.h"
63 #include "GUILane.h"
64 
65 //#define DEBUG_FOES
66 
67 // ===========================================================================
68 // FOX callback mapping
69 // ===========================================================================
70 
71 // Object implementation
72 
73 
74 /* -------------------------------------------------------------------------
75  * GUIVehicle - methods
76  * ----------------------------------------------------------------------- */
77 #ifdef _MSC_VER
78 #pragma warning(push)
79 #pragma warning(disable: 4355)
80 #endif
82  MSVehicleType* type, const double speedFactor) :
83  MSVehicle(pars, route, type, speedFactor),
84  GUIBaseVehicle((MSBaseVehicle&) * this) {
85 }
86 #ifdef _MSC_VER
87 #pragma warning(pop)
88 #endif
89 
90 
92 }
93 
94 
98  const int sublaneParams = MSGlobals::gLateralResolution > 0 ? 4 : 0;
100  new GUIParameterTableWindow(app, *this, 39 + sublaneParams + (int)getParameter().getParametersMap().size());
101  // add items
102  ret->mkItem("lane [id]", true, new FunctionBindingString<GUIVehicle>(this, &GUIVehicle::getLaneID));
104  ret->mkItem("shadow lane [id]", true, new FunctionBindingString<GUIVehicle>(this, &GUIVehicle::getShadowLaneID));
105  }
107  ret->mkItem("target lane [id]", true, new FunctionBindingString<GUIVehicle>(this, &GUIVehicle::getTargetLaneID));
108  }
109  ret->mkItem("position [m]", true,
111  ret->mkItem("lateral offset [m]", true,
113  ret->mkItem("speed [m/s]", true,
115  ret->mkItem("lateral speed [m/s]", true,
117  ret->mkItem("acceleration [m/s^2]", true,
119  ret->mkItem("angle [degree]", true,
121  ret->mkItem("slope [degree]", true,
123  ret->mkItem("speed factor", false, getChosenSpeedFactor());
124  ret->mkItem("time gap on lane [s]", true,
126  ret->mkItem("waiting time [s]", true,
128  ret->mkItem(("waiting time (accumulated, " + time2string(MSGlobals::gWaitingTimeMemory) + "s) [s]").c_str(), true,
130  ret->mkItem("time loss [s]", true,
132  ret->mkItem("impatience", true,
134  ret->mkItem("last lane change [s]", true,
136  ret->mkItem("desired depart [s]", false, time2string(getParameter().depart));
137  ret->mkItem("depart delay [s]", false, time2string(getDepartDelay()));
138  if (getParameter().repetitionNumber < std::numeric_limits<int>::max()) {
139  ret->mkItem("remaining [#]", false, (int) getParameter().repetitionNumber - getParameter().repetitionsDone);
140  }
141  if (getParameter().repetitionOffset > 0) {
142  ret->mkItem("insertion period [s]", false, time2string(getParameter().repetitionOffset));
143  }
144  if (getParameter().repetitionProbability > 0) {
145  ret->mkItem("insertion probability", false, getParameter().repetitionProbability);
146  }
147  ret->mkItem("stop info", true, new FunctionBindingString<GUIVehicle>(this, &GUIVehicle::getStopInfo));
148  ret->mkItem("line", false, myParameter->line);
149  ret->mkItem("CO2 [mg/s]", true,
151  ret->mkItem("CO [mg/s]", true,
153  ret->mkItem("HC [mg/s]", true,
155  ret->mkItem("NOx [mg/s]", true,
157  ret->mkItem("PMx [mg/s]", true,
159  ret->mkItem("fuel [ml/s]", true,
161  ret->mkItem("electricity [Wh/s]", true,
163  ret->mkItem("noise (Harmonoise) [dB]", true,
165  ret->mkItem("devices", false, toString(myDevices));
166  ret->mkItem("persons", true,
168  ret->mkItem("containers", true,
170 
171  ret->mkItem("lcState right", true, new FunctionBindingString<GUIVehicle>(this, &GUIVehicle::getLCStateRight));
172  ret->mkItem("lcState left", true, new FunctionBindingString<GUIVehicle>(this, &GUIVehicle::getLCStateLeft));
173  // close building
175  ret->mkItem("right side on edge [m]", true, new FunctionBinding<GUIVehicle, double>(this, &GUIVehicle::getRightSideOnEdge2));
176  ret->mkItem("left side on edge [m]", true, new FunctionBinding<GUIVehicle, double>(this, &GUIVehicle::getLeftSideOnEdge));
177  ret->mkItem("rightmost edge sublane [#]", true, new FunctionBinding<GUIVehicle, int>(this, &GUIVehicle::getRightSublaneOnEdge));
178  ret->mkItem("leftmost edge sublane [#]", true, new FunctionBinding<GUIVehicle, int>(this, &GUIVehicle::getLeftSublaneOnEdge));
179  ret->mkItem("lane change maneuver distance [m]", true, new FunctionBinding<GUIVehicle, double>(this, &GUIVehicle::getManeuverDist));
180  }
181  ret->closeBuilding(&getParameter());
182  return ret;
183 }
184 
185 
190  new GUIParameterTableWindow(app, *this, 26
191  + (int)myType->getParameter().getParametersMap().size()
192  + (int)myType->getParameter().lcParameter.size()
193  + (int)myType->getParameter().jmParameter.size());
194  // add items
195  ret->mkItem("Type Information:", false, "");
196  ret->mkItem("type [id]", false, myType->getID());
197  ret->mkItem("length", false, myType->getLength());
198  ret->mkItem("width", false, myType->getWidth());
199  ret->mkItem("height", false, myType->getHeight());
200  ret->mkItem("minGap", false, myType->getMinGap());
201  ret->mkItem("vehicle class", false, SumoVehicleClassStrings.getString(myType->getVehicleClass()));
202  ret->mkItem("emission class", false, PollutantsInterface::getName(myType->getEmissionClass()));
203  ret->mkItem("carFollowModel", false, SUMOXMLDefinitions::CarFollowModels.getString((SumoXMLTag)getCarFollowModel().getModelID()));
204  ret->mkItem("LaneChangeModel", false, SUMOXMLDefinitions::LaneChangeModels.getString(getLaneChangeModel().getModelID()));
205  ret->mkItem("guiShape", false, getVehicleShapeName(myType->getGuiShape()));
206  ret->mkItem("maximum speed [m/s]", false, getMaxSpeed());
207  ret->mkItem("maximum acceleration [m/s^2]", false, getCarFollowModel().getMaxAccel());
208  ret->mkItem("maximum deceleration [m/s^2]", false, getCarFollowModel().getMaxDecel());
209  ret->mkItem("emergency deceleration [m/s^2]", false, getCarFollowModel().getEmergencyDecel());
210  ret->mkItem("apparent deceleration [m/s^2]", false, getCarFollowModel().getApparentDecel());
211  ret->mkItem("imperfection (sigma)", false, getCarFollowModel().getImperfection());
212  ret->mkItem("desired headway (tau)", false, getCarFollowModel().getHeadwayTime());
213  ret->mkItem("person capacity", false, myType->getPersonCapacity());
214  ret->mkItem("boarding time", false, STEPS2TIME(myType->getBoardingDuration()));
215  ret->mkItem("container capacity", false, myType->getContainerCapacity());
216  ret->mkItem("loading time", false, STEPS2TIME(myType->getLoadingDuration()));
218  ret->mkItem("minGapLat", false, myType->getMinGapLat());
219  ret->mkItem("maxSpeedLat", false, myType->getMaxSpeedLat());
220  ret->mkItem("latAlignment", false, toString(myType->getPreferredLateralAlignment()));
221  } else if (MSGlobals::gLaneChangeDuration > 0) {
222  ret->mkItem("maxSpeedLat", false, myType->getMaxSpeedLat());
223  }
224  for (auto item : myType->getParameter().lcParameter) {
225  ret->mkItem(toString(item.first).c_str(), false, toString(item.second));
226  }
227  for (auto item : myType->getParameter().jmParameter) {
228  ret->mkItem(toString(item.first).c_str(), false, toString(item.second));
229  }
230 
231  // close building
232  ret->closeBuilding(&(myType->getParameter()));
233  return ret;
234 }
235 
236 
237 
238 void
240  glTranslated(0, 0, getType() + .2); // draw on top of cars
241  for (DriveItemVector::const_iterator i = myLFLinkLanes.begin(); i != myLFLinkLanes.end(); ++i) {
242  if ((*i).myLink == nullptr) {
243  continue;
244  }
245  MSLink* link = (*i).myLink;
246  MSLane* via = link->getViaLaneOrLane();
247  if (via != nullptr) {
248  Position p = via->getShape()[0];
249  if ((*i).mySetRequest) {
250  glColor3d(0, .8, 0);
251  } else {
252  glColor3d(.8, 0, 0);
253  }
254  const SUMOTime leaveTime = (*i).myLink->getLeaveTime(
255  (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(), getVehicleType().getLength());
256  drawLinkItem(p, (*i).myArrivalTime, leaveTime, s.vehicleName.size / s.scale);
257  // the time slot that ego vehicle uses when checking opened may
258  // differ from the one it requests in setApproaching
259  MSLink::ApproachingVehicleInformation avi = (*i).myLink->getApproaching(this);
260  assert(avi.arrivalTime == (*i).myArrivalTime && avi.leavingTime == leaveTime);
261  UNUSED_PARAMETER(avi); // only used for assertion
262  }
263  }
264  glTranslated(0, 0, getType() - .2); // draw on top of cars
265 }
266 
267 
268 void
270  RGBColor current = GLHelper::getColor();
271  RGBColor darker = current.changedBrightness(-51);
272  const double exaggeration = s.vehicleSize.getExaggeration(s, this);
273  const double totalLength = getVType().getLength();
274  double upscaleLength = exaggeration;
275  if (exaggeration > 1 && totalLength > 5) {
276  // reduce the length/width ratio because this is not usefull at high zoom
277  upscaleLength = MAX2(1.0, upscaleLength * (5 + sqrt(totalLength - 5)) / totalLength);
278  }
279  const double locomotiveLength = getVehicleType().getParameter().locomotiveLength * upscaleLength;
280  if (exaggeration == 0) {
281  return;
282  }
283  const double defaultLength = getVehicleType().getParameter().carriageLength * upscaleLength;
284  const double carriageGap = getVehicleType().getParameter().carriageGap * upscaleLength;
285  const double length = totalLength * upscaleLength;
286  const double halfWidth = getVehicleType().getWidth() / 2.0 * exaggeration;
287  glPopMatrix(); // undo initial translation and rotation
288  const double xCornerCut = 0.3 * exaggeration;
289  const double yCornerCut = 0.4 * exaggeration;
290  // round to closest integer
291  const int numCarriages = MAX2(1, 1 + (int)((length - locomotiveLength) / (defaultLength + carriageGap) + 0.5));
292  assert(numCarriages > 0);
293  double carriageLengthWithGap = length / numCarriages;
294  double carriageLength = carriageLengthWithGap - carriageGap;
295  double firstCarriageLength = carriageLength;
296  if (defaultLength != locomotiveLength && numCarriages > 1) {
297  firstCarriageLength = locomotiveLength;
298  carriageLengthWithGap = (length - locomotiveLength) / (numCarriages - 1);
299  carriageLength = carriageLengthWithGap - carriageGap;
300  }
301  const int firstPassengerCarriage = defaultLength == locomotiveLength || numCarriages == 1 ? 0 : 1;
302  const int totalSeats = getVType().getPersonCapacity() + getVType().getContainerCapacity();
303  const int seatsPerCarriage = (int)ceil(totalSeats / (numCarriages - firstPassengerCarriage));
304  // lane on which the carriage front is situated
305  MSLane* lane = myLane;
306  int routeIndex = getRoutePosition();
307  // lane on which the carriage back is situated
308  MSLane* backLane = myLane;
309  int backRouteIndex = routeIndex;
310  // offsets of front and back
311  double carriageOffset = myState.pos();
312  double carriageBackOffset = myState.pos() - firstCarriageLength;
313  // handle seats
314  int requiredSeats = getNumPassengers() + getNumContainers();
315  if (requiredSeats > 0) {
316  mySeatPositions.clear();
317  }
318  Position front, back;
319  double angle = 0.;
320  // draw individual carriages
321  double curCLength = firstCarriageLength;
322  //std::cout << SIMTIME << " veh=" << getID() << " curCLength=" << curCLength << " loc=" << locomotiveLength << " car=" << carriageLength << " tlen=" << totalLength << " len=" << length << "\n";
323  for (int i = 0; i < numCarriages; ++i) {
324  if (i > 0) {
325  curCLength = carriageLength;
326  }
327  while (carriageOffset < 0) {
328  MSLane* prev = getPreviousLane(lane, routeIndex);
329  if (prev != lane) {
330  carriageOffset += prev->getLength();
331  } else {
332  // no lane available for drawing.
333  carriageOffset = 0;
334  }
335  lane = prev;
336  }
337  while (carriageBackOffset < 0) {
338  MSLane* prev = getPreviousLane(backLane, backRouteIndex);
339  if (prev != backLane) {
340  carriageBackOffset += prev->getLength();
341  } else {
342  // no lane available for drawing.
343  carriageBackOffset = 0;
344  }
345  backLane = prev;
346  }
347  front = lane->geometryPositionAtOffset(carriageOffset);
348  back = backLane->geometryPositionAtOffset(carriageBackOffset);
349  if (front == back) {
350  // no place for drawing available
351  continue;
352  }
353  const double drawnCarriageLength = front.distanceTo2D(back);
354  angle = atan2((front.x() - back.x()), (back.y() - front.y())) * (double) 180.0 / (double) M_PI;
355  if (i >= firstPassengerCarriage) {
356  computeSeats(front, back, seatsPerCarriage, exaggeration, requiredSeats);
357  }
358  glPushMatrix();
359  glTranslated(front.x(), front.y(), getType());
360  glRotated(angle, 0, 0, 1);
361  if (!asImage || !GUIBaseVehicleHelper::drawAction_drawVehicleAsImage(s, getVType().getImgFile(), this, getVType().getWidth(), curCLength / exaggeration)) {
362  switch (getVType().getGuiShape()) {
364  case SVS_TRUCK_1TRAILER:
365  if (i == 0) {
366  GUIBaseVehicleHelper::drawAction_drawVehicleAsPoly(s, getVType().getGuiShape(), getVType().getWidth() * exaggeration, curCLength, i);
367  } else {
368  GLHelper::setColor(current);
369  GLHelper::drawBoxLine(Position(0, 0), 180, curCLength, halfWidth);
370  }
371  break;
372  default: {
373  if (i == 0) {
374  GLHelper::setColor(darker);
375  } else {
376  GLHelper::setColor(current);
377  }
378  // generic rail carriage
379  glBegin(GL_TRIANGLE_FAN);
380  glVertex2d(-halfWidth + xCornerCut, 0);
381  glVertex2d(-halfWidth, yCornerCut);
382  glVertex2d(-halfWidth, drawnCarriageLength - yCornerCut);
383  glVertex2d(-halfWidth + xCornerCut, drawnCarriageLength);
384  glVertex2d(halfWidth - xCornerCut, drawnCarriageLength);
385  glVertex2d(halfWidth, drawnCarriageLength - yCornerCut);
386  glVertex2d(halfWidth, yCornerCut);
387  glVertex2d(halfWidth - xCornerCut, 0);
388  glEnd();
389  }
390  }
391  }
392  glPopMatrix();
393  carriageOffset -= (curCLength + carriageGap);
394  carriageBackOffset -= carriageLengthWithGap;
395  }
396  if (getVType().getGuiShape() == SVS_RAIL_CAR) {
397  glPushMatrix();
398  glTranslated(front.x(), front.y(), getType());
399  glRotated(angle, 0, 0, 1);
400  drawAction_drawVehicleBlinker(curCLength);
402  glPopMatrix();
403  }
404  // restore matrix
405  glPushMatrix();
406  front = getPosition();
407  glTranslated(front.x(), front.y(), getType());
408  const double degAngle = RAD2DEG(getAngle() + M_PI / 2.);
409  glRotated(degAngle, 0, 0, 1);
410  glScaled(exaggeration, upscaleLength, 1);
411  if (mySeatPositions.size() == 0) {
412  mySeatPositions.push_back(back);
413  }
414 }
415 
416 #define BLINKER_POS_FRONT .5
417 #define BLINKER_POS_BACK .5
418 
419 inline void
420 drawAction_drawBlinker(double dir, double length) {
421  glColor3d(1.f, .8f, 0);
422  glPushMatrix();
423  glTranslated(dir, BLINKER_POS_FRONT, -0.1);
425  glPopMatrix();
426  glPushMatrix();
427  glTranslated(dir, length - BLINKER_POS_BACK, -0.1);
429  glPopMatrix();
430 }
431 
432 
433 void
436  return;
437  }
438  const double offset = MAX2(.5 * getVehicleType().getWidth(), .4);
440  drawAction_drawBlinker(-offset, length);
441  }
443  drawAction_drawBlinker(offset, length);;
444  }
446  drawAction_drawBlinker(-offset, length);
447  drawAction_drawBlinker(offset, length);
448  }
449 }
450 
451 
452 inline void
453 GUIVehicle::drawAction_drawVehicleBrakeLight(double length, bool onlyOne) const {
455  return;
456  }
457  glColor3f(1.f, .2f, 0);
458  glPushMatrix();
459  if (onlyOne) {
460  glTranslated(0, length, -0.1);
462  } else {
463  glTranslated(-getVehicleType().getWidth() * 0.5, length, -0.1);
465  glPopMatrix();
466  glPushMatrix();
467  glTranslated(getVehicleType().getWidth() * 0.5, length, -0.1);
469  }
470  glPopMatrix();
471 }
472 
473 inline void
476  glPushMatrix();
477  glTranslated(0, 2.5, .5);
478  glColor3f(0, 0, 1);
480  glPopMatrix();
481  }
482 }
483 
484 
485 double
486 GUIVehicle::getColorValue(const GUIVisualizationSettings& /* s */, int activeScheme) const {
487  switch (activeScheme) {
488  case 8:
489  return getSpeed();
490  case 9:
491  // color by action step
492  if (isActionStep(SIMSTEP)) {
493  // Upcoming simstep is actionstep (t was already increased before drawing)
494  return 1.;
495  } else if (isActive()) {
496  // Completed simstep was actionstep
497  return 2.;
498  } else {
499  // not active
500  return 0.;
501  }
502  case 10:
503  return getWaitingSeconds();
504  case 11:
506  case 12:
507  return getLastLaneChangeOffset();
508  case 13:
509  return getLane()->getVehicleMaxSpeed(this);
510  case 14:
511  return getCO2Emissions();
512  case 15:
513  return getCOEmissions();
514  case 16:
515  return getPMxEmissions();
516  case 17:
517  return getNOxEmissions();
518  case 18:
519  return getHCEmissions();
520  case 19:
521  return getFuelConsumption();
522  case 20:
524  case 21:
525  if (getNumberReroutes() == 0) {
526  return -1;
527  }
528  return getNumberReroutes();
529  case 22:
531  case 23:
532  return getLaneChangeModel().isOpposite() ? -100 : getBestLaneOffset();
533  case 24:
534  return getAcceleration();
535  case 25:
536  return getTimeGapOnLane();
537  case 26:
538  return STEPS2TIME(getDepartDelay());
539  case 27:
540  return getElectricityConsumption();
541  case 28:
542  return getTimeLossSeconds();
543  case 29:
544  return getLaneChangeModel().getSpeedLat();
545  }
546  return 0;
547 }
548 
549 
550 void
552  myLock.lock();
553  std::vector<std::vector<MSVehicle::LaneQ> > bestLanes = myBestLanes;
554  myLock.unlock();
555  for (std::vector<std::vector<MSVehicle::LaneQ> >::iterator j = bestLanes.begin(); j != bestLanes.end(); ++j) {
556  std::vector<MSVehicle::LaneQ>& lanes = *j;
557  double gmax = -1;
558  double rmax = -1;
559  for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
560  gmax = MAX2((*i).length, gmax);
561  rmax = MAX2((*i).occupation, rmax);
562  }
563  for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
564  const PositionVector& shape = (*i).lane->getShape();
565  double g = (*i).length / gmax;
566  double r = (*i).occupation / rmax;
567  glColor3d(r, g, 0);
568  double width = 0.5 / (1 + abs((*i).bestLaneOffset));
569  GLHelper::drawBoxLines(shape, width);
570 
571  PositionVector s1 = shape;
572  s1.move2side((double) .1);
573  glColor3d(r, 0, 0);
574  GLHelper::drawLine(s1);
575  s1.move2side((double) - .2);
576  glColor3d(0, g, 0);
577  GLHelper::drawLine(s1);
578 
579  glColor3d(r, g, 0);
580  }
581  }
582 }
583 
584 
585 void
586 GUIVehicle::drawRouteHelper(const GUIVisualizationSettings& s, const MSRoute& r, bool future) const {
587  const double exaggeration = s.vehicleSize.getExaggeration(s, this) * (s.gaming ? 0.5 : 1);
588  MSRouteIterator i = future ? myCurrEdge : r.begin();
589  const std::vector<MSLane*>& bestLaneConts = getBestLanesContinuation();
590  // draw continuation lanes when drawing the current route where available
591  int bestLaneIndex = (&r == myRoute ? 0 : (int)bestLaneConts.size());
592  for (; i != r.end(); ++i) {
593  const GUILane* lane;
594  if (bestLaneIndex < (int)bestLaneConts.size() && bestLaneConts[bestLaneIndex] != 0 && (*i) == &(bestLaneConts[bestLaneIndex]->getEdge())) {
595  lane = static_cast<GUILane*>(bestLaneConts[bestLaneIndex]);
596  ++bestLaneIndex;
597  } else {
598  const std::vector<MSLane*>* allowed = (*i)->allowedLanes(getVClass());
599  if (allowed != nullptr && allowed->size() != 0) {
600  lane = static_cast<GUILane*>((*allowed)[0]);
601  } else {
602  lane = static_cast<GUILane*>((*i)->getLanes()[0]);
603  }
604  }
605  GLHelper::drawBoxLines(lane->getShape(), lane->getShapeRotations(), lane->getShapeLengths(), exaggeration);
606  }
607  // draw stop labels
608  // (vertical shift for repeated stops at the same position
609  std::map<std::pair<const MSLane*, double>, int> repeat; // count repeated occurrences of the same position
610  int stopIndex = 0;
611  for (const Stop& stop : myStops) {
612  Position pos = stop.lane->geometryPositionAtOffset(stop.reached ? getPositionOnLane() : stop.getEndPos(*this));
613  GLHelper::drawBoxLines(stop.lane->getShape().getOrthogonal(pos, 10, true, stop.lane->getWidth()), 0.1);
614  std::string label = stop.reached ? "stopped" : "stop " + toString(stopIndex);
615 #ifdef _DEBUG
616  label += " (" + toString(stop.edge - myCurrEdge) + "e)";
617 #endif
618  if (stop.pars.until >= 0) {
619  label += " until:" + time2string(stop.pars.until);
620  }
621  if (stop.duration >= 0) {
622  if (STEPS2TIME(stop.duration) > 3600 * 24) {
623  label += " duration:1day+";
624  } else {
625  label += " duration:" + time2string(stop.duration);
626  }
627  }
628  std::pair<const MSLane*, double> stopPos = std::make_pair(stop.lane, stop.getEndPos(*this));
629  const double textSize = s.vehicleName.size / s.scale;
630  GLHelper::drawText(label, pos - Position(0, textSize * repeat[stopPos]), 1.0, textSize, s.vehicleName.color);
631  repeat[stopPos]++;
632  stopIndex++;
633  }
634 }
635 
636 
637 
638 MSLane*
639 GUIVehicle::getPreviousLane(MSLane* current, int& routeIndex) const {
640  if (current->isInternal()) {
641  return current->getIncomingLanes().front().lane;
642  }
643  if (routeIndex > 0) {
644  routeIndex--;
645  const MSEdge* prevNormal = myRoute->getEdges()[routeIndex];
646  for (MSLane* cand : prevNormal->getLanes()) {
647  for (MSLink* link : cand->getLinkCont()) {
648  if (link->getLane() == current) {
649  if (link->getViaLane() != nullptr) {
650  return link->getViaLane();
651  } else {
652  return const_cast<MSLane*>(link->getLaneBefore());
653  }
654  }
655  }
656  }
657  }
658  return current;
659 }
660 
661 
662 double
665 }
666 
667 
668 std::string
670  std::string result = "";
671  if (isParking()) {
672  result += "parking";
673  } else if (isStopped()) {
674  result += "stopped";
675  } else if (hasStops()) {
676  return "next: " + myStops.front().getDescription();
677  } else {
678  return "";
679  }
680  if (myStops.front().pars.triggered) {
681  result += ", triggered";
682  } else if (myStops.front().pars.containerTriggered) {
683  result += ", containerTriggered";
684  } else if (myStops.front().collision) {
685  result += ", collision";
686  } else if (myStops.front().pars.until != -1) {
687  result += ", until=" + time2string(myStops.front().pars.until);
688  } else {
689  result += ", duration=" + time2string(myStops.front().duration);
690  }
691  return result;
692 }
693 
694 
695 void
697  double dist = myLane->getLength() - getPositionOnLane();
698 #ifdef DEBUG_FOES
699  std::cout << SIMTIME << " selectBlockingFoes veh=" << getID() << " dist=" << dist << " numLinks=" << myLFLinkLanes.size() << "\n";
700 #endif
701  for (DriveItemVector::const_iterator i = myLFLinkLanes.begin(); i != myLFLinkLanes.end(); ++i) {
702  const DriveProcessItem& dpi = *i;
703  if (dpi.myLink == nullptr) {
705  continue;
706  }
707  std::vector<const SUMOVehicle*> blockingFoes;
708  std::vector<const MSPerson*> blockingPersons;
709 #ifdef DEBUG_FOES
710  std::cout << " foeLink=" << dpi.myLink->getViaLaneOrLane()->getID() << "\n";
711  const bool isOpen =
712 #endif
715 #ifdef DEBUG_FOES
716  if (!isOpen) {
717  std::cout << " closed due to:\n";
718  for (std::vector<const SUMOVehicle*>::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) {
719  std::cout << " " << (*it)->getID() << "\n";
720  }
721  }
722 #endif
723  if (getLaneChangeModel().getShadowLane() != nullptr) {
724  MSLink* parallelLink = dpi.myLink->getParallelLink(getLaneChangeModel().getShadowDirection());
725  if (parallelLink != nullptr) {
726  const double shadowLatPos = getLateralPositionOnLane() - getLaneChangeModel().getShadowDirection() * 0.5 * (
728 #ifdef DEBUG_FOES
729  const bool isShadowOpen =
730 #endif
731  parallelLink->opened(dpi.myArrivalTime, dpi.myArrivalSpeed, dpi.getLeaveSpeed(),
734  getWaitingTime(), shadowLatPos, &blockingFoes);
735 #ifdef DEBUG_FOES
736  if (!isShadowOpen) {
737  std::cout << " foes at shadow link=" << parallelLink->getViaLaneOrLane()->getID() << ":\n";
738  for (std::vector<const SUMOVehicle*>::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) {
739  std::cout << " " << (*it)->getID() << "\n";
740  }
741  }
742 #endif
743  }
744  }
745  for (std::vector<const SUMOVehicle*>::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) {
746  gSelected.select(static_cast<const GUIVehicle*>(*it)->getGlID());
747  }
748 #ifdef DEBUG_FOES
749  gDebugFlag1 = true;
750 #endif
751  const MSLink::LinkLeaders linkLeaders = (dpi.myLink)->getLeaderInfo(this, dist, &blockingPersons);
752 #ifdef DEBUG_FOES
753  gDebugFlag1 = false;
754 #endif
755  for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
756  // the vehicle to enter the junction first has priority
757  const GUIVehicle* leader = dynamic_cast<const GUIVehicle*>(it->vehAndGap.first);
758  if (leader != nullptr) {
759  if (isLeader(dpi.myLink, leader)) {
760  gSelected.select(leader->getGlID());
761 #ifdef DEBUG_FOES
762  std::cout << " linkLeader=" << leader->getID() << "\n";
763 #endif
764  }
765  } else {
766  for (std::vector<const MSPerson*>::iterator it_p = blockingPersons.begin(); it_p != blockingPersons.end(); ++it_p) {
767  const GUIPerson* foe = dynamic_cast<const GUIPerson*>(*it_p);
768  if (foe != nullptr) {
769  gSelected.select(foe->getGlID());
770  //std::cout << SIMTIME << " veh=" << getID() << " is blocked on link " << dpi.myLink->getRespondIndex() << " to " << dpi.myLink->getViaLaneOrLane()->getID() << " by pedestrian. dist=" << it->second << "\n";
771  }
772  }
773  }
774  }
775  dist += dpi.myLink->getViaLaneOrLane()->getLength();
776  }
777 }
778 
779 
780 void
783  GUISUMOAbstractView* view = mw->getActiveView();
784  if (view != nullptr) {
785  if (add) {
788  view->addAdditionalGLVisualisation(this);
789  }
790  } else {
793  }
794  }
795 }
796 
797 bool
800 }
801 
802 int
804  const double rightSide = getRightSideOnEdge();
805  const std::vector<double>& sublaneSides = myLane->getEdge().getSubLaneSides();
806  for (int i = 0; i < (int)sublaneSides.size(); ++i) {
807  if (sublaneSides[i] > rightSide) {
808  return MAX2(i - 1, 0);
809  }
810  }
811  return -1;
812 }
813 
814 int
816  const double leftSide = getLeftSideOnEdge();
817  const std::vector<double>& sublaneSides = myLane->getEdge().getSubLaneSides();
818  for (int i = (int)sublaneSides.size() - 1; i >= 0; --i) {
819  if (sublaneSides[i] < leftSide) {
820  return i;
821  }
822  }
823  return -1;
824 }
825 
826 
827 std::string
829  return toString((LaneChangeAction)getLaneChangeModel().getSavedState(-1).second);
830 }
831 
832 std::string
834  return toString((LaneChangeAction)getLaneChangeModel().getSavedState(1).second);
835 }
836 
837 std::string
839  return Named::getIDSecure(myLane, "n/a");
840 }
841 
842 std::string
844  return Named::getIDSecure(getLaneChangeModel().getShadowLane(), "");
845 }
846 
847 std::string
849  return Named::getIDSecure(getLaneChangeModel().getTargetLane(), "");
850 }
851 
852 double
855 }
856 
857 void
859  SUMOTime intermediateDuration = TIME2STEPS(20);
860  SUMOTime finalDuration = SUMOTime_MAX;
861  if (myParameter->stops.size() >= 2) {
862  // copy durations from the original stops
863  intermediateDuration = myParameter->stops.front().duration;
864  finalDuration = myParameter->stops.back().duration;
865  }
866  // if the stop is already in the list of stops, cancel all stops that come
867  // after it and set the stop duration
868  std::string line = "";
869  int destinations = 0;
870  bool add = true;
871  for (auto it = myStops.begin(); it != myStops.end(); it++) {
872  if (!it->reached && destinations < 2 && it->busstop != nullptr) {
873  line += it->busstop->getID();
874  destinations++;
875  }
876  if (it->busstop == busStop) {
877  it->duration = finalDuration;
878  myStops.erase(++it, myStops.end());
879  add = false;
880  break;
881  } else {
882  it->duration = MIN2(it->duration, intermediateDuration);
883  }
884  }
885  if (destinations < 2) {
886  line += busStop->getID();
887  }
888  if (add) {
889  // create new stop
891  stopPar.busstop = busStop->getID();
892  stopPar.lane = busStop->getLane().getID();
893  stopPar.startPos = busStop->getBeginLanePosition();
894  stopPar.endPos = busStop->getEndLanePosition();
895  stopPar.duration = finalDuration;
896  stopPar.until = -1;
897  stopPar.triggered = false;
898  stopPar.containerTriggered = false;
899  stopPar.parking = false;
900  stopPar.index = STOP_INDEX_FIT;
902  // clean up prior route to improve visualisation, ensure that the stop can be added immediately
904  edges.erase(edges.begin(), edges.begin() + getRoutePosition());
905  edges.push_back(&busStop->getLane().getEdge());
906  replaceRouteEdges(edges, -1, 0, "DRT.tmp", false, false, false);
907  std::string errorMsg;
908  // add stop
909  addStop(stopPar, errorMsg);
910  }
911  const bool hasReroutingDevice = getDevice(typeid(MSDevice_Routing)) != nullptr;
912  SUMOAbstractRouter<MSEdge, SUMOVehicle>& router = hasReroutingDevice
915  // reroute to ensure the new stop is reached
916  reroute(MSNet::getInstance()->getCurrentTimeStep(), "DRT", router);
917  myParameter->line = line;
918  assert(haveValidStopEdges());
919 }
920 
921 /****************************************************************************/
922 
std::vector< MSVehicleDevice * > myDevices
The devices this vehicle has.
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
Definition: MSLane.h:819
int getRoutePosition() const
Definition: MSVehicle.cpp:1180
bool gDebugFlag1
global utility flags for debugging
Definition: StdDefs.cpp:33
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
void drawAction_drawVehicleBlinker(double length) const
Definition: GUIVehicle.cpp:434
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:96
Drive process items represent bounds on the safe velocity corresponding to the upcoming links...
Definition: MSVehicle.h:1918
static double gLateralResolution
Definition: MSGlobals.h:85
double getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:5130
const std::vector< double > getSubLaneSides() const
Returns the right side offsets of this edge&#39;s sublanes.
Definition: MSEdge.h:558
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
void reroute(SUMOTime t, const std::string &info, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, const bool onInit=false, const bool withTaz=false, const bool silent=false)
Performs a rerouting using the given router.
static StringBijection< SumoXMLTag > CarFollowModels
car following models
SumoXMLTag
Numbers representing SUMO-XML - element names.
SUMOVehicleShape getGuiShape() const
Get this vehicle type&#39;s shape.
double getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:5118
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:670
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
std::string lane
The lane to stop at.
long long int SUMOTime
Definition: SUMOTime.h:35
double scale
information about a lane&#39;s width (temporary, used for a single view)
double getBeginLanePosition() const
Returns the begin position of this stop.
double getElectricityConsumption() const
Returns electricity consumption of the current state.
Definition: MSVehicle.cpp:5136
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:154
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:121
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:182
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:1859
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1833
bool haveValidStopEdges() const
check whether all stop.edge MSRouteIterators are valid and in order
Definition: MSVehicle.cpp:6081
A lane area vehicles can halt at.
DriveItemVector myLFLinkLanes
container for the planned speeds in the current step
Definition: MSVehicle.h:1975
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:561
const MSVehicleType & getVType() const
A shortcut to myVehicle.myType.
double getRightSideOnEdge2() const
return right vehicle side on current edge (without argument)
Definition: GUIVehicle.h:135
double carriageLength
the length of train carriages and locomotive
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:244
bool gaming
whether the application is in gaming mode or not
LateralAlignment getPreferredLateralAlignment() const
Get vehicle&#39;s preferred lateral alignment.
int getShadowDirection() const
return the direction in which the current shadow lane lies
std::string getLCStateRight() const
return the lanechange state
Definition: GUIVehicle.cpp:828
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.
std::string getShadowLaneID() const
Definition: GUIVehicle.cpp:843
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.
double y() const
Returns the y-position.
Definition: Position.h:62
double getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:397
void computeSeats(const Position &front, const Position &back, int maxSeats, double exaggeration, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
const SUMOVehicleParameter & getParameter() const
Returns the vehicle&#39;s parameter (including departure definition)
int getBestLaneOffset() const
Definition: MSVehicle.cpp:5016
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:65
GUIVisualizationTextSettings vehicleName
A device that performs vehicle rerouting based on current edge speeds.
double x() const
Returns the x-position.
Definition: Position.h:57
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:668
double getLeaveSpeed() const
Definition: MSVehicle.h:1965
std::string busstop
(Optional) bus stop if one is assigned to the stop
int parametersSet
Information for the output which parameter were set.
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:165
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:168
T MAX2(T a, T b)
Definition: StdDefs.h:80
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:781
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:541
const PositionVector & getShape() const
Returns this lane&#39;s shape.
Definition: MSLane.h:478
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:70
std::string getTargetLaneID() const
Definition: GUIVehicle.cpp:848
double getMinGapLat() const
Get the minimum lateral gap that vehicles of this type maintain.
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, bool collision=false, MSRouteIterator *searchStart=0)
Adds a stop.
Definition: MSVehicle.cpp:1524
const int STOP_INDEX_FIT
void drawBestLanes() const
Draws the vehicle&#39;s best lanes.
Definition: GUIVehicle.cpp:551
void rerouteDRTStop(MSStoppingPlace *busStop)
handle route to accomodate to given stop
Definition: GUIVehicle.cpp:858
bool addAdditionalGLVisualisation(const GUIGlObject *const which)
Adds an object to call its additional visualisation method.
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:73
#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:77
#define TIME2STEPS(x)
Definition: SUMOTime.h:59
static SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector())
return the router instance
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:52
int getLeftSublaneOnEdge() const
Definition: GUIVehicle.cpp:815
int size() const
Returns the number of edges to pass.
Definition: MSRoute.cpp:82
const std::vector< double > & getShapeRotations() const
Definition: GUILane.cpp:905
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:348
int getPersonCapacity() const
Get this vehicle type&#39;s person capacity.
void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=false) const
Definition: GUIVehicle.cpp:453
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:557
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:669
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
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.
The car-following model and parameter.
Definition: MSVehicleType.h:66
bool triggered
whether an arriving person lets the vehicle continue
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:4609
#define SIMTIME
Definition: SUMOTime.h:64
SUMOTime getBoardingDuration() const
Get this vehicle type&#39;s boarding duration.
bool isLeader(const MSLink *link, const MSVehicle *veh) const
whether the given vehicle must be followed at the given junction
Definition: MSVehicle.cpp:5944
Right blinker lights are switched on.
Definition: MSVehicle.h:1180
std::vector< Stop > stops
List of the stops the vehicle will make, TraCI may add entries here.
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
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:62
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:1258
bool isInternal() const
Definition: MSLane.cpp:1999
bool isSelected() const
whether this vehicle is selected in the GUI
Definition: GUIVehicle.cpp:798
A road/street connecting two junctions.
Definition: MSEdge.h:76
GUISUMOAbstractView * getActiveView() const
get the active view or 0
double getEndLanePosition() const
Returns the end position of this stop.
const MSCFModel & getCarFollowModel() const
Returns the vehicle&#39;s car following model definition.
Definition: MSVehicle.h:894
const int STOP_START_SET
double getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:5100
Left blinker lights are switched on.
Definition: MSVehicle.h:1182
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:48
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:616
bool replaceRouteEdges(ConstMSEdgeVector &edges, double cost, double savings, const std::string &info, bool onInit=false, bool check=false, bool removeStops=true)
Replaces the current route by the given edges.
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:81
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:4987
SUMOTime getLoadingDuration() const
Get this vehicle type&#39;s loading duration.
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:486
#define SIMSTEP
Definition: SUMOTime.h:63
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
SUMOTime until
The time at which the vehicle may continue its journey.
std::list< Stop > myStops
The vehicle&#39;s list of stops.
Definition: MSVehicle.h:1869
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:58
#define STEPS2TIME(x)
Definition: SUMOTime.h:57
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1847
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:1184
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:995
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:91
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Definition: MSVehicle.cpp:5142
render as a (city) rail without locomotive
T MIN2(T a, T b)
Definition: StdDefs.h:74
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:899
The brake lights are on.
Definition: MSVehicle.h:1186
A blue emergency light is on.
Definition: MSVehicle.h:1202
int getNumPassengers() const
return the number of passengers
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:417
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:274
double endPos
The stopping position end.
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:239
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:696
const SUMOVTypeParameter & getParameter() const
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:187
MSLane * getPreviousLane(MSLane *current, int &routeIndex) const
Definition: GUIVehicle.cpp:639
void drawAction_drawCarriageClass(const GUIVisualizationSettings &s, bool asImage) const
draws the given guiShape with distinct carriages/modules
Definition: GUIVehicle.cpp:269
std::string line
The vehicle&#39;s line (mainly for public transport)
std::string getLaneID() const
return vehicle lane id
Definition: GUIVehicle.cpp:838
double getLateralPositionOnLane() const
Get the vehicle&#39;s lateral position on the lane.
Definition: MSVehicle.h:434
Definition of vehicle stop (position and duration)
static void drawAction_drawVehicleAsPoly(const GUIVisualizationSettings &s, const SUMOVehicleShape shape, const double width, const double length, int carriageIndex=-1)
draw vehicle as a polygon
int index
at which position in the stops list
double getManeuverDist() const
return the lane-change maneuver distance
Definition: GUIVehicle.cpp:853
const int STOP_END_SET
double getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:5106
int getRightSublaneOnEdge() const
return the righmost sublane on the edge occupied by the vehicle
Definition: GUIVehicle.cpp:803
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.
double startPos
The stopping position start.
SUMOVehicleClass getVClass() const
Returns the vehicle&#39;s access class.
int getPersonNumber() const
Returns the number of persons.
LaneChangeAction
The state of a vehicle&#39;s lane-change behavior.
Structure representing possible vehicle parameter.
double length() const
Returns the length.
draw vehicle outside the road network
#define SUMOTime_MAX
Definition: SUMOTime.h:36
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
bool containerTriggered
whether an arriving container lets the vehicle continue
MSVehicleType * myType
This vehicle&#39;s type.
SubParams jmParameter
Junction-model parameter.
MSVehicleDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
const std::vector< double > & getShapeLengths() const
Definition: GUILane.cpp:911
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:494
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:5124
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:505
double getLength() const
Get vehicle&#39;s length [m].
double getTimeGapOnLane() const
Returns the time gap in seconds to the leader of the vehicle on the same lane.
Definition: MSVehicle.cpp:5089
static SUMOTime gWaitingTimeMemory
length of memory for waiting times (in millisecs)
Definition: MSGlobals.h:109
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.
static bool drawAction_drawVehicleAsImage(const GUIVisualizationSettings &s, const std::string &file, const GUIGlObject *o, const double width, double length)
try to draw vehicle as raster image and return true if sucessful
#define BLINKER_POS_FRONT
Definition: GUIVehicle.cpp:416
std::string getLCStateLeft() const
Definition: GUIVehicle.cpp:833
double getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:1269
GUIVisualizationSizeSettings vehicleSize
void drawAction_drawBlinker(double dir, double length)
Definition: GUIVehicle.cpp:420
MSRouteIterator myCurrEdge
Iterator to current route-edge.
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:5112
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:70
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:954
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:1751
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:136
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:5256
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:474
const MSLane & getLane() const
Returns the lane this stop is located at.
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:1793
void drawRouteHelper(const GUIVisualizationSettings &s, const MSRoute &r, bool future) const
Draws the route.
Definition: GUIVehicle.cpp:586
double getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:477
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
render as a transport vehicle with one trailer
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:83
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane&#39;s maximum speed, given a vehicle&#39;s speed limit adaptation.
Definition: MSLane.h:519
A window containing a gl-object&#39;s parameter.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type&#39;s emission class.
SUMOTime duration
The stopping duration.
render as a semi-trailer transport vehicle ("Sattelschlepper")
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:76
double getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:663
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.
bool parking
whether the vehicle is removed from the net while stopping
double getWidth() const
Returns the vehicle&#39;s width.
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:921
double pos() const
Position of this state.
Definition: MSVehicle.h:110
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:622
int getNumContainers() const
return the number of passengers
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:54