Eclipse SUMO - Simulation of Urban MObility
GUIBaseVehicle.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
21 // A MSVehicle extended by some values for usage within the gui
22 /****************************************************************************/
23 #include <config.h>
24 
25 #include <cmath>
26 #include <vector>
27 #include <string>
28 #include <functional>
32 #include <utils/geom/GeomHelper.h>
40 #include <utils/gui/div/GLHelper.h>
43 #include <mesosim/MEVehicle.h>
44 #include <mesosim/MELoop.h>
45 #include <microsim/MSVehicle.h>
46 #include <microsim/MSLane.h>
50 #include <microsim/MSStop.h>
51 #include <microsim/MSTrainHelper.h>
57 #include <gui/GUIGlobals.h>
59 
60 #include "GUIBaseVehicle.h"
61 #include "GUIPerson.h"
62 #include "GUIContainer.h"
63 #include "GUINet.h"
64 #include "GUIEdge.h"
65 #include "GUILane.h"
66 #include "GUIParkingArea.h"
67 
68 //#define DRAW_BOUNDING_BOX
69 
70 // ===========================================================================
71 // FOX callback mapping
72 // ===========================================================================
73 FXDEFMAP(GUIBaseVehicle::GUIBaseVehiclePopupMenu) GUIBaseVehiclePopupMenuMap[] = {
92 };
93 
94 // Object implementation
95 FXIMPLEMENT(GUIBaseVehicle::GUIBaseVehiclePopupMenu, GUIGLObjectPopupMenu, GUIBaseVehiclePopupMenuMap, ARRAYNUMBER(GUIBaseVehiclePopupMenuMap))
96 
97 // ===========================================================================
98 // method definitions
99 // ===========================================================================
100 /* -------------------------------------------------------------------------
101  * GUIBaseVehicle::GUIBaseVehiclePopupMenu - methods
102  * ----------------------------------------------------------------------- */
105  : GUIGLObjectPopupMenu(app, parent, o) {
106 }
107 
108 
110 
111 
112 long
114  assert(myObject->getType() == GLO_VEHICLE);
115  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_ALL_ROUTES)) {
116  static_cast<GUIBaseVehicle*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_ALL_ROUTES);
117  }
118  return 1;
119 }
120 
121 long
123  assert(myObject->getType() == GLO_VEHICLE);
124  static_cast<GUIBaseVehicle*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_ALL_ROUTES);
125  return 1;
126 }
127 
128 
129 long
131  assert(myObject->getType() == GLO_VEHICLE);
132  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_ROUTE)) {
133  static_cast<GUIBaseVehicle*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_ROUTE);
134  }
135  return 1;
136 }
137 
138 long
140  assert(myObject->getType() == GLO_VEHICLE);
141  static_cast<GUIBaseVehicle*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_ROUTE);
142  return 1;
143 }
144 
145 
146 long
148  assert(myObject->getType() == GLO_VEHICLE);
149  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_FUTURE_ROUTE)) {
150  static_cast<GUIBaseVehicle*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_FUTURE_ROUTE);
151  }
152  return 1;
153 }
154 
155 long
157  assert(myObject->getType() == GLO_VEHICLE);
158  static_cast<GUIBaseVehicle*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_FUTURE_ROUTE);
159  return 1;
160 }
161 
162 
163 long
165  assert(myObject->getType() == GLO_VEHICLE);
166  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_ROUTE_NOLOOP)) {
167  static_cast<GUIBaseVehicle*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_ROUTE_NOLOOP);
168  }
169  return 1;
170 }
171 
172 long
174  assert(myObject->getType() == GLO_VEHICLE);
175  static_cast<GUIBaseVehicle*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_ROUTE_NOLOOP);
176  return 1;
177 }
178 
179 
180 long
182  assert(myObject->getType() == GLO_VEHICLE);
183  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_BEST_LANES)) {
184  static_cast<GUIBaseVehicle*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_BEST_LANES);
185  }
186  return 1;
187 }
188 
189 long
191  assert(myObject->getType() == GLO_VEHICLE);
192  static_cast<GUIBaseVehicle*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_BEST_LANES);
193  return 1;
194 }
195 
196 
197 long
199  assert(myObject->getType() == GLO_VEHICLE);
200  if (myParent->getTrackedID() != static_cast<GUIBaseVehicle*>(myObject)->getGlID()) {
201  myParent->startTrack(static_cast<GUIBaseVehicle*>(myObject)->getGlID());
202  }
203  return 1;
204 }
205 
206 long
208  assert(myObject->getType() == GLO_VEHICLE);
209  myParent->stopTrack();
210  return 1;
211 }
212 
213 
214 long
216  assert(myObject->getType() == GLO_VEHICLE);
217  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_LFLINKITEMS)) {
218  static_cast<GUIBaseVehicle*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_LFLINKITEMS);
219  }
220  return 1;
221 }
222 
223 long
225  assert(myObject->getType() == GLO_VEHICLE);
226  static_cast<GUIBaseVehicle*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_LFLINKITEMS);
227  return 1;
228 }
229 
230 long
232  assert(myObject->getType() == GLO_VEHICLE);
233  static_cast<GUIBaseVehicle*>(myObject)->selectBlockingFoes();
234  myParent->update();
235  return 1;
236 }
237 
238 
239 long
241  assert(myObject->getType() == GLO_VEHICLE);
242  const MSBaseVehicle& veh = static_cast<GUIBaseVehicle*>(myObject)->getVehicle();
243  for (const MSTransportable* t : veh.getPersons()) {
244  gSelected.select((static_cast<const GUIPerson*>(t))->getGlID());
245  }
246  for (MSTransportable* t : veh.getContainers()) {
247  gSelected.select((static_cast<const GUIContainer*>(t))->getGlID());
248  }
249  myParent->update();
250  return 1;
251 }
252 
253 long
255  GUIBaseVehicle* baseVeh = static_cast<GUIBaseVehicle*>(myObject);
256  MSVehicle* microVeh = dynamic_cast<MSVehicle*>(&baseVeh->myVehicle);
257  if (microVeh != nullptr) {
258  MSLane* lane = microVeh->getMutableLane();
259  if (lane != nullptr) {
260  lane->getVehiclesSecure();
262  }
264  if (lane != nullptr) {
265  lane->releaseVehicles();
266  }
267  } else {
268  MEVehicle* mesoVeh = dynamic_cast<MEVehicle*>(&baseVeh->myVehicle);
270  }
272  myParent->destroyPopup();
273  myParent->update();
274  return 1;
275 }
276 
277 
278 long
280  GUIBaseVehicle* baseVeh = static_cast<GUIBaseVehicle*>(myObject);
281  MSVehicle* microVeh = dynamic_cast<MSVehicle*>(&baseVeh->myVehicle);
282  if (microVeh != nullptr) {
283  if (microVeh->isStopped()) {
284  microVeh->resumeFromStopping();
285  } else {
286  std::string errorOut;
287  const double brakeGap = microVeh->getCarFollowModel().brakeGap(microVeh->getSpeed());
288  std::pair<const MSLane*, double> stopPos = microVeh->getLanePosAfterDist(brakeGap);
289  if (stopPos.first != nullptr) {
291  stop.lane = stopPos.first->getID();
292  stop.startPos = stopPos.second;
293  stop.endPos = stopPos.second + POSITION_EPS;
294  stop.duration = TIME2STEPS(3600);
295  microVeh->addTraciStop(stop, errorOut);
296  if (errorOut != "") {
297  WRITE_WARNING(errorOut);
298  }
299  }
300  }
301  } else {
302  WRITE_WARNING(TL("GUI-triggered stop not implemented for meso"));
303  }
304  myParent->update();
305  return 1;
306 }
307 
308 
309 /* -------------------------------------------------------------------------
310  * GUIBaseVehicle - methods
311  * ----------------------------------------------------------------------- */
312 
314  GUIGlObject(GLO_VEHICLE, vehicle.getID(), GUIIconSubSys::getIcon(GUIIcon::VEHICLE)),
315  myVehicle(vehicle),
316  myPopup(nullptr) {
317  // as it is possible to show all vehicle routes, we have to store them... (bug [ 2519761 ])
319  myVehicle.myMoveReminders.push_back(std::make_pair(myRoutes, 0.));
320  mySeatPositions.push_back(Seat()); // ensure length 1
321  myContainerPositions.push_back(Seat()); // ensure length 1
322 }
323 
324 
326  myLock.lock();
327  for (std::map<GUISUMOAbstractView*, int>::iterator i = myAdditionalVisualizations.begin(); i != myAdditionalVisualizations.end(); ++i) {
328  if (i->first->getTrackedID() == getGlID()) {
329  i->first->stopTrack();
330  }
331  while (i->first->removeAdditionalGLVisualisation(this));
332  }
333  myLock.unlock();
334  delete myRoutes;
335  if (myPopup != nullptr) {
337  }
338 }
339 
340 
343  GUISUMOAbstractView& parent) {
344  GUIGLObjectPopupMenu* ret = new GUIBaseVehiclePopupMenu(app, parent, *this);
345  buildPopupHeader(ret, app);
349  //
351  GUIDesigns::buildFXMenuCommand(ret, TL("Hide Current Route"), nullptr, ret, MID_HIDE_CURRENTROUTE);
352  } else {
353  GUIDesigns::buildFXMenuCommand(ret, TL("Show Current Route"), nullptr, ret, MID_SHOW_CURRENTROUTE);
354  }
356  GUIDesigns::buildFXMenuCommand(ret, TL("Hide Future Route"), nullptr, ret, MID_HIDE_FUTUREROUTE);
357  } else {
358  GUIDesigns::buildFXMenuCommand(ret, TL("Show Future Route"), nullptr, ret, MID_SHOW_FUTUREROUTE);
359  }
361  GUIDesigns::buildFXMenuCommand(ret, TL("Hide All Routes"), nullptr, ret, MID_HIDE_ALLROUTES);
362  } else {
363  GUIDesigns::buildFXMenuCommand(ret, TL("Show All Routes"), nullptr, ret, MID_SHOW_ALLROUTES);
364  }
366  FXMenuCheck* showLoops = new FXMenuCheck(ret, TL("Draw looped routes"), ret, MID_HIDE_ROUTE_NOLOOPS);
367  showLoops->setCheck(false);
368  } else {
369  FXMenuCheck* showLoops = new FXMenuCheck(ret, TL("Draw looped routes"), ret, MID_SHOW_ROUTE_NOLOOPS);
370  showLoops->setCheck(true);
371  }
373  GUIDesigns::buildFXMenuCommand(ret, TL("Hide Best Lanes"), nullptr, ret, MID_HIDE_BEST_LANES);
374  } else {
375  GUIDesigns::buildFXMenuCommand(ret, TL("Show Best Lanes"), nullptr, ret, MID_SHOW_BEST_LANES);
376  }
378  GUIDesigns::buildFXMenuCommand(ret, TL("Hide Link Items"), nullptr, ret, MID_HIDE_LFLINKITEMS);
379  } else {
380  GUIDesigns::buildFXMenuCommand(ret, TL("Show Link Items"), nullptr, ret, MID_SHOW_LFLINKITEMS);
381  }
382  new FXMenuSeparator(ret);
383  if (parent.getTrackedID() != getGlID()) {
384  GUIDesigns::buildFXMenuCommand(ret, TL("Start Tracking"), nullptr, ret, MID_START_TRACK);
385  } else {
386  GUIDesigns::buildFXMenuCommand(ret, TL("Stop Tracking"), nullptr, ret, MID_STOP_TRACK);
387  }
388  GUIDesigns::buildFXMenuCommand(ret, TL("Select Foes"), nullptr, ret, MID_SHOW_FOES);
389  if (myVehicle.getPersons().size() + myVehicle.getContainers().size() > 0) {
390  GUIDesigns::buildFXMenuCommand(ret, TL("Select transported"), nullptr, ret, MID_SELECT_TRANSPORTED);
391  }
392  GUIDesigns::buildFXMenuCommand(ret, myVehicle.isStopped() ? TL("Abort stop") : TL("Stop"), nullptr, ret, MID_TOGGLE_STOP);
393  GUIDesigns::buildFXMenuCommand(ret, TL("Remove"), nullptr, ret, MID_REMOVE_OBJECT);
394 
395  new FXMenuSeparator(ret);
396  //
397  buildShowParamsPopupEntry(ret, false);
399  buildPositionCopyEntry(ret, app);
400  myPopup = ret;
401  return ret;
402 }
403 
404 
405 void
407  myPopup = nullptr;
408 }
409 
410 
411 double
413  return (s.vehicleSize.getExaggeration(s, this) *
415 }
416 
417 
418 Boundary
420  Boundary b;
423  return b;
424 }
425 
426 
427 const std::string
429  return myVehicle.getParameter().getParameter("name", "");
430 }
431 
432 
433 void
434 GUIBaseVehicle::drawOnPos(const GUIVisualizationSettings& s, const Position& pos, const double angle) const {
437  Position p1 = pos;
438  const double degAngle = RAD2DEG(angle + M_PI / 2.);
439  const double length = getVType().getLength();
440  glTranslated(p1.x(), p1.y(), getType());
441  glRotated(degAngle, 0, 0, 1);
442  RGBColor col = setColor(s);
443  // scale
444  const double upscale = getExaggeration(s);
445  const bool s2 = s.secondaryShape;
446 
447  if (upscale > 1 && s.laneWidthExaggeration > 1 && myVehicle.isOnRoad()) {
448  // optionally shift according to edge exaggeration
449  double offsetFromLeftBorder = myVehicle.getCurrentEdge()->getWidth() - myVehicle.getRightSideOnEdge() - myVehicle.getVehicleType().getWidth() / 2;
450  glTranslated((s.laneWidthExaggeration - 1) * -offsetFromLeftBorder / 2, 0, 0);
451  }
452 
453  double upscaleLength = MSTrainHelper::getUpscaleLength(upscale, length, s.vehicleQuality);
454  glScaled(upscale, upscaleLength, 1);
455  /*
456  MSLaneChangeModel::DK2004 &m2 = static_cast<MSLaneChangeModel::DK2004&>(veh->getLaneChangeModel());
457  if((m2.getState()&LCA_URGENT)!=0) {
458  glColor3d(1, .4, .4);
459  } else if((m2.getState()&LCA_SPEEDGAIN)!=0) {
460  glColor3d(.4, .4, 1);
461  } else {
462  glColor3d(.4, 1, .4);
463  }
464  */
465  // draw the vehicle
466  bool drawCarriages = false;
467  const double geometryFactor = (s.scaleLength ?
468  ((myVehicle.getLane() != nullptr
470  : (myVehicle.getEdge()->getLanes().size() > 0 ? myVehicle.getEdge()->getLanes()[0]->getLengthGeometryFactor(s2) : 1)))
471  : 1);
472  double scaledLength = length * geometryFactor;
473  if (col.alpha() != 0) {
474  switch (s.vehicleQuality) {
475  case 0:
477  break;
478  case 1:
480  break;
481  case 2:
482  drawCarriages = drawAction_drawVehicleAsPolyWithCarriagges(s, scaledLength);
483  // draw flashing blue light for emergency vehicles
484  if (getVType().getGuiShape() == SUMOVehicleShape::EMERGENCY) {
485  glTranslated(0, 0, .1);
487  }
488  break;
489  case 3:
490  drawCarriages = drawAction_drawVehicleAsPolyWithCarriagges(s, scaledLength, true);
491  break;
492  case 4: {
493  // do not scale circle radius by lengthGeometryFactor nor length and reduce the effect of width
494  const double w = 1.8 * sqrt(getVType().getWidth() / 1.8);
496  // display text at circle center
497  scaledLength = 0;
498  break;
499  }
500  default:
501  break;
502  }
503  if (s.drawMinGap) {
504  const double minGap = -getVType().getMinGap();
505  glColor3d(0., 1., 0.);
506  glBegin(GL_LINES);
507  glVertex2d(0., 0);
508  glVertex2d(0., minGap);
509  glVertex2d(-.5, minGap);
510  glVertex2d(.5, minGap);
511  glEnd();
512  }
515  const double brakeGap = -static_cast<MSVehicle&>(myVehicle).getCarFollowModel().brakeGap(myVehicle.getSpeed());
516  glColor3d(1., 0., 0.);
517  glBegin(GL_LINES);
518  glVertex2d(0., 0);
519  glVertex2d(0., brakeGap);
520  glVertex2d(-.5, brakeGap);
521  glVertex2d(.5, brakeGap);
522  glEnd();
523  }
524  if (s.showBTRange) {
526  if (dev != nullptr) {
527  glColor3d(1., 0., 0.);
528  GLHelper::drawOutlineCircle(dev->getRange(), dev->getRange() - .2, 32);
529  }
530  }
531  // draw the blinker and brakelights if wished
532  if (s.showBlinker) {
533  glTranslated(0, 0, .1);
534  switch (getVType().getGuiShape()) {
544  break;
547  drawAction_drawVehicleBlinker(scaledLength);
548  drawAction_drawVehicleBrakeLight(scaledLength, true);
549  break;
550  default:
551  // only SUMOVehicleShape::RAIL_CAR has blinkers and brake lights but they are drawn along with the carriages
552  if (!drawCarriages) {
553  drawAction_drawVehicleBlinker(scaledLength);
554  drawAction_drawVehicleBrakeLight(scaledLength);
555  }
556  break;
557  }
558  }
559  // draw the wish to change the lane
560  if (s.drawLaneChangePreference) {
561  /*
562  if(gSelected.isSelected(GLO_VEHICLE, veh->getGlID())) {
563  MSLaneChangeModel::DK2004 &m = static_cast<MSLaneChangeModel::DK2004&>(veh->getLaneChangeModel());
564  glColor3d(.5, .5, 1);
565  glBegin(GL_LINES);
566  glVertex2f(0, 0);
567  glVertex2f(m.getChangeProbability(), .5);
568  glEnd();
569 
570  glColor3d(1, 0, 0);
571  glBegin(GL_LINES);
572  glVertex2f(0.1, 0);
573  glVertex2f(0.1, m.myMaxJam1);
574  glEnd();
575 
576  glColor3d(0, 1, 0);
577  glBegin(GL_LINES);
578  glVertex2f(-0.1, 0);
579  glVertex2f(-0.1, m.myTDist);
580  glEnd();
581  }
582  */
583  }
584  }
585  glTranslated(0, MIN2(scaledLength / 2, double(5)), -getType()); // drawing name at GLO_MAX fails unless translating z
586  glScaled(1 / upscale, 1 / upscaleLength, 1);
587  glRotated(-degAngle, 0, 0, 1);
588  drawName(Position(0, 0), s.scale, s.vehicleName, s.angle);
589  if (s.vehicleName.show(this) && myVehicle.getParameter().line != "") {
590  glRotated(-s.angle, 0, 0, 1);
591  glTranslated(0, 0.7 * s.vehicleName.scaledSize(s.scale), 0);
592  glRotated(s.angle, 0, 0, 1);
594  }
595  if (s.vehicleValue.show(this)) {
596  glRotated(-s.angle, 0, 0, 1);
597  glTranslated(0, 0.7 * s.vehicleName.scaledSize(s.scale), 0);
598  glRotated(s.angle, 0, 0, 1);
599  const double value = getColorValue(s, s.vehicleColorer.getActive());
601  }
602  if (s.vehicleScaleValue.show(this)) {
603  glRotated(-s.angle, 0, 0, 1);
604  glTranslated(0, 0.7 * s.vehicleName.scaledSize(s.scale), 0);
605  glRotated(s.angle, 0, 0, 1);
606  const double value = getScaleValue(s, s.vehicleScaler.getActive());
608  }
609  if (s.vehicleText.show(this)) {
610  std::string error;
611  std::string value = myVehicle.getPrefixedParameter(s.vehicleTextParam, error);
612  if (value != "") {
613  auto lines = StringTokenizer(value, StringTokenizer::NEWLINE).getVector();
614  glRotated(-s.angle, 0, 0, 1);
615  glTranslated(0, 0.7 * s.vehicleText.scaledSize(s.scale) * (double)lines.size(), 0);
616  glRotated(s.angle, 0, 0, 1);
617  for (std::string& line : lines) {
619  glRotated(-s.angle, 0, 0, 1);
620  glTranslated(0, -0.7 * s.vehicleText.scaledSize(s.scale), 0);
621  glRotated(s.angle, 0, 0, 1);
622  }
623  }
624  }
627  glRotated(-s.angle, 0, 0, 1);
628  glTranslated(0, 0.7 * s.vehicleName.scaledSize(s.scale), 0);
629  glRotated(s.angle, 0, 0, 1);
630  const double value = myVehicle.getNumberParkingReroutes();
632  }
633 
634  if (!drawCarriages) {
635  mySeatPositions.clear();
636  myContainerPositions.clear();
637  int requiredSeats = getNumPassengers();
638  int requiredContainerPositions = getNumContainers();
639  const Position back = (p1 + Position(-scaledLength * upscaleLength, 0)).rotateAround2D(angle, p1);
640  double extraOffset = scaledLength * 0.15;
641  computeSeats(p1, back, SUMO_const_waitingPersonWidth, getVType().getPersonCapacity(), upscale, requiredSeats, mySeatPositions, extraOffset);
642  computeSeats(p1, back, SUMO_const_waitingContainerWidth, getVType().getContainerCapacity(), upscale, requiredContainerPositions, myContainerPositions, extraOffset);
643  }
644 
648 }
649 
650 
651 void
654 }
655 
656 
657 void
659  if (!myVehicle.isOnRoad()) {
660  drawGL(s);
661  }
664  glTranslated(0, 0, getType() - .1); // don't draw on top of other cars
666  drawBestLanes();
667  }
668  bool noLoop = hasActiveAddVisualisation(parent, VO_SHOW_ROUTE_NOLOOP);
670  drawRoute(s, 0, 0.25, false, noLoop);
671  }
673  drawRoute(s, 0, 0.25, true, noLoop);
674  }
676  if (myVehicle.getNumberReroutes() > 0) {
677  const int noReroutePlus1 = myVehicle.getNumberReroutes() + 1;
678  for (int i = noReroutePlus1 - 1; i >= 0; i--) {
679  double darken = double(0.4) / double(noReroutePlus1) * double(i);
680  drawRoute(s, i, darken);
681  }
682  } else {
683  drawRoute(s, 0, 0.25, false, noLoop);
684  }
685  }
688  }
691 }
692 
693 
694 void
695 GUIBaseVehicle::drawLinkItem(const Position& pos, SUMOTime arrivalTime, SUMOTime leaveTime, double exagerate) {
696  glTranslated(pos.x(), pos.y(), -.1);
698  std::string times = toString(STEPS2TIME(arrivalTime)) + "/" + toString(STEPS2TIME(leaveTime));
699  GLHelper::drawText(times.c_str(), Position(), .1, 1.6 * exagerate, RGBColor::GREEN, 0);
700  glTranslated(-pos.x(), -pos.y(), .1);
701 }
702 
703 
704 RGBColor
706  RGBColor col;
707  const GUIColorer& c = s.vehicleColorer;
708  if (!setFunctionalColor(c.getActive(), &myVehicle, col)) {
709  col = c.getScheme().getColor(getColorValue(s, c.getActive()));
710  }
711  GLHelper::setColor(col);
712  return col;
713 }
714 
715 
716 bool
717 GUIBaseVehicle::setFunctionalColor(int activeScheme, const MSBaseVehicle* veh, RGBColor& col) {
718  switch (activeScheme) {
719  case 0: {
720  //test for emergency vehicle
722  col = RGBColor::WHITE;
723  return true;
724  }
725  //test for firebrigade
727  col = RGBColor::RED;
728  return true;
729  }
730  //test for police car
732  col = RGBColor::BLUE;
733  return true;
734  }
735  if (veh->getParameter().wasSet(VEHPARS_COLOR_SET)) {
736  col = veh->getParameter().color;
737  return true;
738  }
740  col = veh->getVehicleType().getColor();
741  return true;
742  }
743  if (&(veh->getRoute().getColor()) != &RGBColor::DEFAULT_COLOR) {
744  col = veh->getRoute().getColor();
745  return true;
746  }
747  return false;
748  }
749  case 2: {
750  if (veh->getParameter().wasSet(VEHPARS_COLOR_SET)) {
751  col = veh->getParameter().color;
752  return true;
753  }
754  return false;
755  }
756  case 3: {
758  col = veh->getVehicleType().getColor();
759  return true;
760  }
761  return false;
762  }
763  case 4: {
764  if (&(veh->getRoute().getColor()) != &RGBColor::DEFAULT_COLOR) {
765  col = veh->getRoute().getColor();
766  return true;
767  }
768  return false;
769  }
770  case 5: {
771  Position p = veh->getRoute().getEdges()[0]->getLanes()[0]->getShape()[0];
772  const Boundary& b = ((GUINet*) MSNet::getInstance())->getBoundary();
773  Position center = b.getCenter();
774  double hue = 180. + atan2(center.x() - p.x(), center.y() - p.y()) * 180. / M_PI;
775  double sat = p.distanceTo(center) / center.distanceTo(Position(b.xmin(), b.ymin()));
776  col = RGBColor::fromHSV(hue, sat, 1.);
777  return true;
778  }
779  case 6: {
780  Position p = veh->getRoute().getEdges().back()->getLanes()[0]->getShape()[-1];
781  const Boundary& b = ((GUINet*) MSNet::getInstance())->getBoundary();
782  Position center = b.getCenter();
783  double hue = 180. + atan2(center.x() - p.x(), center.y() - p.y()) * 180. / M_PI;
784  double sat = p.distanceTo(center) / center.distanceTo(Position(b.xmin(), b.ymin()));
785  col = RGBColor::fromHSV(hue, sat, 1.);
786  return true;
787  }
788  case 7: {
789  Position pb = veh->getRoute().getEdges()[0]->getLanes()[0]->getShape()[0];
790  Position pe = veh->getRoute().getEdges().back()->getLanes()[0]->getShape()[-1];
791  const Boundary& b = ((GUINet*) MSNet::getInstance())->getBoundary();
792  double hue = 180. + atan2(pb.x() - pe.x(), pb.y() - pe.y()) * 180. / M_PI;
793  Position minp(b.xmin(), b.ymin());
794  Position maxp(b.xmax(), b.ymax());
795  double sat = pb.distanceTo(pe) / minp.distanceTo(maxp);
796  col = RGBColor::fromHSV(hue, sat, 1.);
797  return true;
798  }
799  case 35: { // color randomly (by pointer hash)
800  std::hash<const MSBaseVehicle*> ptr_hash;
801  const double hue = (double)(ptr_hash(veh) % 360); // [0-360]
802  const double sat = (double)((ptr_hash(veh) / 360) % 67) / 100.0 + 0.33; // [0.33-1]
803  col = RGBColor::fromHSV(hue, sat, 1.);
804  return true;
805  }
806  case 36: { // color by angle
807  double hue = GeomHelper::naviDegree(veh->getAngle());
808  col = RGBColor::fromHSV(hue, 1., 1.);
809  return true;
810  }
811  }
812  return false;
813 }
814 
815 
816 double
817 GUIBaseVehicle::getScaleValue(const GUIVisualizationSettings& s, int activeScheme) const {
818  switch (activeScheme) {
819  case 0: // uniform
820  return 0;
821  case 1: // selection
822  return myVehicle.isSelected();
823  case 2: // by speed
824  if (myVehicle.isStopped()) {
825  return myVehicle.isParking() ? -2 : -1;
826  }
827  return myVehicle.getSpeed();
828  case 3:
829  return myVehicle.getWaitingSeconds();
830  case 4: {
831  MSVehicle* microVeh = dynamic_cast<MSVehicle*>(&myVehicle);
832  return (microVeh != nullptr ? microVeh->getAccumulatedWaitingSeconds() : 0);
833  }
834  case 5: {
835  MSVehicle* microVeh = dynamic_cast<MSVehicle*>(&myVehicle);
836  return (microVeh != nullptr ? microVeh->getLane()->getVehicleMaxSpeed(microVeh) : myVehicle.getEdge()->getVehicleMaxSpeed(&myVehicle));
837  }
838  case 6:
839  return myVehicle.getNumberReroutes();
840  case 7: {
841  MSVehicle* microVeh = dynamic_cast<MSVehicle*>(&myVehicle);
842  return (microVeh != nullptr
843  ? (microVeh->getLaneChangeModel().isOpposite() ? -100 : microVeh->getBestLaneOffset())
844  : 0);
845  }
846  case 8:
847  return myVehicle.getAcceleration();
848  case 9: {
849  MSVehicle* microVeh = dynamic_cast<MSVehicle*>(&myVehicle);
850  return (microVeh != nullptr ? microVeh->getTimeGapOnLane() : 0);
851  }
852  case 10:
854  case 11:
855  return myVehicle.getTimeLossSeconds();
856  case 12:
857  return myVehicle.getStopDelay();
858  case 13:
860  case 14: // by numerical param value
861  std::string error;
862  std::string val = myVehicle.getPrefixedParameter(s.vehicleScaleParam, error);
863  try {
864  if (val == "") {
865  return 0;
866  } else {
867  return StringUtils::toDouble(val);
868  }
869  } catch (NumberFormatException&) {
870  try {
871  return StringUtils::toBool(val);
872  } catch (BoolFormatException&) {
873  WRITE_WARNINGF(TL("Vehicle parameter '%' key '%' is not a number for vehicle '%'."),
875  return -1;
876  }
877  }
878  }
879  return 0;
880 }
881 
882 
883 // ------------ Additional visualisations
884 bool
886  return myAdditionalVisualizations.find(parent) != myAdditionalVisualizations.end() && (myAdditionalVisualizations.find(parent)->second & which) != 0;
887 }
888 
889 
890 void
892  if (myAdditionalVisualizations.find(parent) == myAdditionalVisualizations.end()) {
893  myAdditionalVisualizations[parent] = 0;
894  }
895  myAdditionalVisualizations[parent] |= which;
896  if (which != VO_TRACK) {
897  parent->addAdditionalGLVisualisation(this);
898  }
899 }
900 
901 
902 void
904  myAdditionalVisualizations[parent] &= ~which;
905  if (myAdditionalVisualizations[parent] == 0) {
906  myAdditionalVisualizations.erase(parent);
907  }
908  parent->removeAdditionalGLVisualisation(this);
909 }
910 
911 
912 void
913 GUIBaseVehicle::drawRoute(const GUIVisualizationSettings& s, int routeNo, double darken, bool future, bool noLoop) const {
914  RGBColor vehColor = setColor(s);
915  RGBColor darker = vehColor.changedBrightness((int)(darken * -255));
916  if (darker == RGBColor::BLACK) {
917  darker = vehColor.multiply(1 - darken);
918  }
919  GLHelper::setColor(darker);
920  if (routeNo == 0) {
921  drawRouteHelper(s, myVehicle.getRoutePtr(), future, noLoop, darker);
922  return;
923  }
924  ConstMSRoutePtr route = myRoutes->getRoute(routeNo - 1); // only prior routes are stored
925  if (route != nullptr) {
926  drawRouteHelper(s, route, future, noLoop, darker);
927  }
928 }
929 
930 
931 void
932 GUIBaseVehicle::drawStopLabels(const GUIVisualizationSettings& s, bool noLoop, const RGBColor& col) const {
933  // (vertical shift for repeated stops at the same position
934  std::map<const MSLane*, int> repeat; // count repeated occurrences of the same position
935  int stopIndex = 0;
936  for (const MSStop& stop : myVehicle.getStops()) {
937  double stopLanePos;
938  if (stop.getSpeed() > 0) {
939  stopLanePos = stop.reached ? stop.pars.endPos : stop.pars.startPos;
940  } else {
941  stopLanePos = stop.reached ? myVehicle.getPositionOnLane() : MAX2(0.0, stop.getEndPos(myVehicle));
942  }
943  if (stop.isOpposite && !stop.reached) {
944  stopLanePos = stop.lane->getLength() - stopLanePos;
945  }
946  Position pos = stop.lane->geometryPositionAtOffset(stopLanePos);
947  GLHelper::setColor(col);
948  GLHelper::drawBoxLines(stop.lane->getShape().getOrthogonal(pos, 10, true, stop.lane->getWidth()), 0.1);
949  std::string label = (stop.getSpeed() > 0
950  ? (stop.reached ? "passing waypoint" : "waypoint ")
951  : (stop.reached ? "stopped" : "stop "));
952  if (!stop.reached) {
953  label += toString(stopIndex);
954  }
955 
956  if (stop.isOpposite) {
957  label += " (opposite)";
958  }
959 #ifdef _DEBUG
960  label += " (" + toString(stop.edge - myVehicle.getCurrentRouteEdge()) + "e)";
961 #endif
963  label += " triggered:";
964  if (stop.triggered) {
965  label += "person";
966  if (stop.numExpectedPerson > 0) {
967  label += "(" + toString(stop.numExpectedPerson) + ")";
968  }
969  }
970  if (stop.containerTriggered) {
971  label += "container";
972  if (stop.numExpectedContainer > 0) {
973  label += "(" + toString(stop.numExpectedContainer) + ")";
974  }
975  }
976  if (stop.joinTriggered) {
977  label += "join";
978  if (stop.pars.join != "") {
979  label += "(" + stop.pars.join + ")";
980  }
981  }
982  }
983  if (stop.pars.ended >= 0 && MSGlobals::gUseStopEnded) {
984  label += " ended:" + time2string(stop.pars.ended);
985  } else if (stop.pars.until >= 0) {
986  label += " until:" + time2string(stop.pars.until);
987  }
988  if (stop.duration >= 0 || stop.pars.duration > 0) {
989  if (STEPS2TIME(stop.duration) > 3600 * 24) {
990  label += " duration:1day+";
991  } else {
992  label += " duration:" + time2string(stop.duration);
993  }
994  }
995  if (stop.getSpeed() > 0) {
996  if (stop.skipOnDemand) {
997  label += " onDemand (skipped)";
998  } else {
999  label += " speed:" + toString(stop.getSpeed());
1000  }
1001  }
1002  if (stop.pars.actType != "") {
1003  label += " actType:" + stop.pars.actType;
1004  }
1005  const double nameSize = s.vehicleName.size / s.scale;
1006  Position pos2 = pos - Position(0, nameSize * repeat[stop.lane]);
1007  if (noLoop && repeat[stop.lane] > 0) {
1008  break;
1009  }
1010  GLHelper::drawTextSettings(s.vehicleText, label, pos2, s.scale, s.angle, 1.0);
1011  repeat[stop.lane]++;
1012  stopIndex++;
1013  }
1014  // indicate arrivalPos if set
1016  const int arrivalEdge = myVehicle.getParameter().arrivalEdge >= 0
1018  : (int)myVehicle.getRoute().getEdges().size() - 1;
1019  const MSLane* arrivalLane = myVehicle.getRoute().getEdges()[arrivalEdge]->getLanes()[MAX2(0, myVehicle.getArrivalLane())];
1021  GLHelper::setColor(col);
1022  GLHelper::drawBoxLines(arrivalLane->getShape().getOrthogonal(pos, 10, true, arrivalLane->getWidth() * 0.5, 90), 0.1);
1023  GLHelper::drawBoxLines(arrivalLane->getShape().getOrthogonal(pos, 10, true, arrivalLane->getWidth() * 0.5, 270), 0.1);
1024  GLHelper::drawTextSettings(s.vehicleText, "arrival", pos, s.scale, s.angle, 1.0);
1025 
1026  }
1027 }
1028 
1029 void
1031  if (s.showParkingInfo) {
1033  if (pm != nullptr) {
1034  for (auto item : *pm) {
1035  const GUIParkingArea* pa = dynamic_cast<const GUIParkingArea*>(item.first);
1036  if (item.second.blockedAtTime >= 0) {
1037  std::string seenAgo = time2string(SIMSTEP - item.second.blockedAtTime);
1038  //if (item.second.blockedAtTime >= 0) {
1039  // seenAgo += ", " + time2string(SIMSTEP - item.second.blockedAtTimeLocal);
1040  //}
1041  GLHelper::drawTextSettings(s.vehicleValue, seenAgo, pa->getSignPos(), s.scale, s.angle, 1.0);
1042  }
1043  if (item.second.score != "") {
1044  const double dist = 0.4 * (s.vehicleText.scaledSize(s.scale) + s.vehicleValue.scaledSize(s.scale));
1045  Position shift(0, -dist);
1046  GLHelper::drawTextSettings(s.vehicleText, item.second.score, pa->getSignPos() + shift, s.scale, s.angle, 1.0);
1047  }
1048  }
1049  }
1050  }
1051 }
1052 
1053 const GUIBaseVehicle::Seat&
1054 GUIBaseVehicle::getSeatPosition(int personIndex) const {
1056  return mySeatPositions[MIN2(personIndex, (int)mySeatPositions.size() - 1)];
1057 }
1058 
1059 const GUIBaseVehicle::Seat&
1060 GUIBaseVehicle::getContainerPosition(int containerIndex) const {
1062  return myContainerPositions[MIN2(containerIndex, (int)myContainerPositions.size() - 1)];
1063 }
1064 
1065 
1066 void
1068  if (myVehicle.myPersonDevice != nullptr) {
1069  const std::vector<MSTransportable*>& ps = myVehicle.myPersonDevice->getTransportables();
1070  int personIndex = 0;
1071  for (std::vector<MSTransportable*>::const_iterator i = ps.begin(); i != ps.end(); ++i) {
1072  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
1073  assert(person != 0);
1074  person->setPositionInVehicle(getSeatPosition(personIndex++));
1075  person->drawGL(s);
1076  }
1077  }
1078  if (myVehicle.myContainerDevice != nullptr) {
1079  const std::vector<MSTransportable*>& cs = myVehicle.myContainerDevice->getTransportables();
1080  int containerIndex = 0;
1081  for (std::vector<MSTransportable*>::const_iterator i = cs.begin(); i != cs.end(); ++i) {
1082  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
1083  assert(container != 0);
1084  container->setPositionInVehicle(getContainerPosition(containerIndex++));
1085  container->drawGL(s);
1086  }
1087  }
1088 #ifdef DRAW_BOUNDING_BOX
1089  if (!MSGlobals::gUseMesoSim) {
1090  MSVehicle& microVeh = dynamic_cast<MSVehicle&>(myVehicle);
1093  glTranslated(0, 0, getType());
1094  PositionVector smallBB = microVeh.getBoundingPoly();
1095  glColor3d(0.5, .8, 0);
1096  GLHelper::drawBoxLines(smallBB, 0.3);
1097  glTranslated(0, 0, 0.1);
1098  PositionVector boundingBox = microVeh.getBoundingBox();
1099  boundingBox.push_back(boundingBox.front());
1100  glColor3d(1, 0, 0);
1101  GLHelper::drawBoxLines(boundingBox, 0.15);
1104  }
1105 #endif
1106 }
1107 
1108 bool
1110  return myVehicle.isReversed() && s.drawReversed;
1111 }
1112 
1113 bool
1115  if (getVType().getParameter().carriageLength > 0) {
1116  drawAction_drawCarriageClass(s, asImage);
1117  return true;
1118  } else {
1120  s, getVType().getImgFile(), this, getVType().getWidth(), scaledLength)) {
1121  return false;
1122  }
1123  GUIBaseVehicleHelper::drawAction_drawVehicleAsPoly(s, getVType().getGuiShape(), getVType().getWidth(), scaledLength, -1, myVehicle.isStopped(), drawReversed(s));
1124  return false;
1125  }
1126 }
1127 
1128 
1129 int
1131  if (myVehicle.getPersonDevice() != nullptr) {
1132  return (int)myVehicle.getPersonDevice()->size();
1133  }
1134  return 0;
1135 }
1136 
1137 
1138 int
1140  if (myVehicle.getContainerDevice() != nullptr) {
1141  return (int)myVehicle.getContainerDevice()->size();
1142  }
1143  return 0;
1144 }
1145 
1146 std::string
1148  std::vector<std::string> devs;
1149  for (MSDevice* d : myVehicle.getDevices()) {
1150  devs.push_back(d->deviceName());
1151  }
1152  return joinToString(devs, " ");
1153 }
1154 
1155 
1156 void
1157 GUIBaseVehicle::computeSeats(const Position& front, const Position& back, double seatOffset, int maxSeats, double exaggeration, int& requiredSeats, Seats& into, double extraOffset) const {
1158  if (requiredSeats <= 0) {
1159  return;
1160  }
1161  maxSeats = MAX2(maxSeats, 1); // compute at least one seat
1162  seatOffset *= exaggeration;
1163  const double vehWidth = getVType().getSeatingWidth() * exaggeration;
1164  const double length = front.distanceTo2D(back);
1165  const int rowSize = MAX2(1, (int)floor(vehWidth / seatOffset));
1166  const double frontSeatPos = getVType().getFrontSeatPos() + extraOffset;
1167  const double rowOffset = MAX2(1.0, (length - frontSeatPos - 1)) / ceil((double)maxSeats / rowSize);
1168  const double sideOffset = (rowSize - 1) / 2.0 * seatOffset;
1169  double rowPos = frontSeatPos - rowOffset;
1170  double angle = back.angleTo2D(front);
1171  const int fillDirection = MSGlobals::gLefthand ? -1 : 1;
1172  //if (myVehicle.getID() == "v0") std::cout << SIMTIME << " seatOffset=" << seatOffset << " max=" << maxSeats << " ex=" << exaggeration << " req=" << requiredSeats << " rowSize=" << rowSize << " sideOffset=" << sideOffset << " front=" << front << " back=" << back << " a=" << angle << " da=" << RAD2DEG(angle) << "\n";
1173  for (int i = 0; requiredSeats > 0 && i < maxSeats; i++) {
1174  int seat = (i % rowSize);
1175  if (seat == 0) {
1176  rowPos += rowOffset;
1177  }
1178  into.push_back(Seat(PositionVector::positionAtOffset2D(front, back, rowPos, (sideOffset - seat * seatOffset) * fillDirection), angle));
1179  requiredSeats--;
1180  }
1181 }
1182 
1183 
1184 /****************************************************************************/
long long int SUMOTime
Definition: GUI.h:35
@ MID_HIDE_ALLROUTES
Hide all vehicle's routes.
Definition: GUIAppEnum.h:507
@ MID_HIDE_BEST_LANES
Hide vehicle's best lanes.
Definition: GUIAppEnum.h:503
@ MID_HIDE_CURRENTROUTE
Hide vehicle's current route.
Definition: GUIAppEnum.h:491
@ MID_SHOW_FOES
select foes of a vehicle
Definition: GUIAppEnum.h:513
@ MID_SHOW_BEST_LANES
Show vehicle's best lanes.
Definition: GUIAppEnum.h:501
@ MID_START_TRACK
Start to track a vehicle.
Definition: GUIAppEnum.h:509
@ MID_SHOW_ALLROUTES
Show all vehicle's routes.
Definition: GUIAppEnum.h:505
@ MID_SHOW_LFLINKITEMS
Definition: GUIAppEnum.h:514
@ MID_SHOW_ROUTE_NOLOOPS
Show vehicle's future route (without loops)
Definition: GUIAppEnum.h:497
@ MID_HIDE_ROUTE_NOLOOPS
Hide vehicle's future route (without loops)
Definition: GUIAppEnum.h:499
@ MID_TOGGLE_STOP
toggle stop state of a vehicle or person
Definition: GUIAppEnum.h:519
@ MID_HIDE_LFLINKITEMS
Definition: GUIAppEnum.h:515
@ MID_REMOVE_OBJECT
remove a vehicle or person
Definition: GUIAppEnum.h:521
@ MID_SHOW_FUTUREROUTE
Show vehicle's future route.
Definition: GUIAppEnum.h:493
@ MID_HIDE_FUTUREROUTE
Hide vehicle's future route.
Definition: GUIAppEnum.h:495
@ MID_SHOW_CURRENTROUTE
Show vehicle's current route.
Definition: GUIAppEnum.h:489
@ MID_STOP_TRACK
Stop to track a vehicle.
Definition: GUIAppEnum.h:511
@ MID_SELECT_TRANSPORTED
select transportables of a vehicle
Definition: GUIAppEnum.h:517
FXDEFMAP(GUIBaseVehicle::GUIBaseVehiclePopupMenu) GUIBaseVehiclePopupMenuMap[]
@ GLO_VEHICLE
a vehicle
GUISelectedStorage gSelected
A global holder of selected objects.
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
#define RAD2DEG(x)
Definition: GeomHelper.h:36
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:296
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:295
#define TL(string)
Definition: MsgHandler.h:315
std::shared_ptr< const MSRoute > ConstMSRoutePtr
Definition: Route.h:31
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition: SUMOTime.cpp:69
#define STEPS2TIME(x)
Definition: SUMOTime.h:55
#define SIMSTEP
Definition: SUMOTime.h:61
#define TIME2STEPS(x)
Definition: SUMOTime.h:57
const long long int VTYPEPARS_COLOR_SET
@ RAIL_CARGO
render as a cargo train
@ EMERGENCY
render as an emergency vehicle
@ RAIL
render as a rail
@ SCOOTER
render as a scooter
@ RAIL_CAR
render as a (city) rail without locomotive
@ SHIP
render as a arbitrary ship
@ BICYCLE
render as a bicycle
@ MOTORCYCLE
render as a motorcycle
@ ANT
render as a giant ant
@ AIRCRAFT
render as aircraft
@ FIREBRIGADE
render as a fire brigade
@ MOPED
render as a moped
@ POLICE
render as a police car
@ PEDESTRIAN
render as a pedestrian
const int VEHPARS_COLOR_SET
const int VEHPARS_ARRIVALPOS_SET
T MIN2(T a, T b)
Definition: StdDefs.h:76
T MAX2(T a, T b)
Definition: StdDefs.h:82
const double SUMO_const_waitingContainerWidth
Definition: StdDefs.h:54
const double SUMO_const_waitingPersonWidth
Definition: StdDefs.h:52
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:283
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
Position getCenter() const
Returns the center of the boundary.
Definition: Boundary.cpp:112
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:130
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:118
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:319
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:136
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:124
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:655
static void drawOutlineCircle(double radius, double iRadius, int steps=8)
Draws an unfilled circle around (0,0)
Definition: GLHelper.cpp:597
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:139
static void drawFilledCircle(const double widradiusth, const int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:570
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
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:347
static void popName()
pop Name
Definition: GLHelper.cpp:148
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
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, const int align=0, double width=-1)
Definition: GLHelper.cpp:757
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
Definition: GLHelper.cpp:788
long onCmdHideFutureRoute(FXObject *, FXSelector, void *)
Called if the current route of the vehicle shall be hidden.
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the vehicle shall be tracked.
long onCmdHideBestLanes(FXObject *, FXSelector, void *)
Called if the vehicle's best lanes shall be hidden.
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the vehicle shall be hidden.
long onCmdShowBestLanes(FXObject *, FXSelector, void *)
Called if the vehicle's best lanes shall be shown.
long onCmdShowRouteNoLoops(FXObject *, FXSelector, void *)
Called if the current route of the vehicle shall be shown.
long onCmdShowLFLinkItems(FXObject *, FXSelector, void *)
Called if all routes of the vehicle shall be shown.
long onCmdShowFoes(FXObject *, FXSelector, void *)
Called to show (select) a vehicles foes.
long onCmdHideRouteNoLoops(FXObject *, FXSelector, void *)
Called if the current route of the vehicle shall be hidden.
long onCmdShowFutureRoute(FXObject *, FXSelector, void *)
Called if the current route of the vehicle shall be shown.
long onCmdShowAllRoutes(FXObject *, FXSelector, void *)
Called if all routes of the vehicle shall be shown.
long onCmdToggleStop(FXObject *, FXSelector, void *)
Called when toggling stop state.
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the current shall not be tracked any longer.
long onCmdSelectTransported(FXObject *, FXSelector, void *)
Called to select all riding persons and containers.
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the vehicle.
long onCmdHideAllRoutes(FXObject *, FXSelector, void *)
Called if all routes of the vehicle shall be hidden.
long onCmdHideLFLinkItems(FXObject *, FXSelector, void *)
Called if all routes of the vehicle shall be hidden.
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the vehicle shall be shown.
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 successful
static void drawAction_drawVehicleAsCircle(const double width, double detail)
draw vehicle as a circle
static void drawAction_drawVehicleAsTrianglePlus(const double width, const double length, bool amReversed=false)
draw vehicle as a triangle
static void drawAction_drawVehicleAsPoly(const GUIVisualizationSettings &s, const SUMOVehicleShape shape, const double width, const double length, int carriageIndex=-1, bool isStopped=false, bool amReversed=false)
draw vehicle as a polygon
static void drawAction_drawVehicleAsBoxPlus(const double width, const double length, bool amReversed=false)
draw vehicle as a Box
A MSVehicle extended by some values for usage within the gui.
void drawParkingInfo(const GUIVisualizationSettings &s, const RGBColor &col) const
const Seat & getContainerPosition(int containerIndex) const
static bool setFunctionalColor(int activeScheme, const MSBaseVehicle *veh, RGBColor &col)
sets the color according to the current scheme index and some vehicle function
const std::string getOptionalName() const
Returns the value for generic parameter 'name' or ''.
virtual void drawAction_drawLinkItems(const GUIVisualizationSettings &) const
const Seat & getSeatPosition(int personIndex) const
returns the seat position for the person with the given index
RGBColor setColor(const GUIVisualizationSettings &s) const
sets the color according to the current settings
int getNumContainers() const
return the number of passengers
void drawOnPos(const GUIVisualizationSettings &s, const Position &pos, const double angle) const
Draws the object on the specified position with the specified angle.
GUIGLObjectPopupMenu * myPopup
current popup (to clean up in destructor). GUIBaseVehicle is not responsible for removal
GUIBaseVehicle(MSBaseVehicle &vehicle)
const MSBaseVehicle & getVehicle()
MSDevice_Vehroutes * myRoutes
virtual void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &s) const
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
virtual void drawRouteHelper(const GUIVisualizationSettings &s, ConstMSRoutePtr r, bool future, bool noLoop, const RGBColor &col) const =0
Draws the route.
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
void drawRoute(const GUIVisualizationSettings &s, int routeNo, double darken, bool future=false, bool noLoop=false) const
Chooses the route to draw and draws it, darkening it as given.
virtual Position getVisualPosition(bool s2, const double offset=0) const =0
Return current position taking into account secondary shape.
std::vector< Seat > Seats
MSBaseVehicle & myVehicle
The vehicle to which all calls should be delegated.
virtual void drawAction_drawVehicleBlinker(double) const
void removedPopupMenu()
notify object about popup menu removal
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
static void drawLinkItem(const Position &pos, SUMOTime arrivalTime, SUMOTime leaveTime, double exagerate)
double getScaleValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the size multiplier value according to the current scheme index
virtual void drawBestLanes() const
Draws the vehicle's best lanes.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
virtual Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
@ VO_SHOW_LFLINKITEMS
LFLinkItems.
@ VO_SHOW_ALL_ROUTES
show all vehicle's routes
@ VO_TRACK
track the vehicle (only needed for cleaning up)
@ VO_SHOW_ROUTE_NOLOOP
show vehicle's routes without loops
@ VO_SHOW_FUTURE_ROUTE
show vehicle's current continued from the current position
@ VO_SHOW_ROUTE
show vehicle's current route
@ VO_SHOW_BEST_LANES
show vehicle's best lanes
virtual void drawAction_drawCarriageClass(const GUIVisualizationSettings &s, bool asImage) const =0
draws the given guiShape with distinct carriages/modules
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Seats myContainerPositions
bool drawReversed(const GUIVisualizationSettings &s) const
whether to reverse trains in their reversed state
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
virtual void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=false) const
void computeSeats(const Position &front, const Position &back, double seatOffset, int maxSeats, double exaggeration, int &requiredSeats, Seats &into, double extraOffset=0) const
add seats to mySeatPositions and update requiredSeats
virtual double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const =0
gets the color value according to the current scheme index
int getNumPassengers() const
return the number of passengers
bool drawAction_drawVehicleAsPolyWithCarriagges(const GUIVisualizationSettings &s, double scaledLength, bool asImage=false) const
draw vehicle body and return whether carriages are being drawn
~GUIBaseVehicle()
destructor
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
virtual void drawAction_drawVehicleBlueLight() const
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
virtual void selectBlockingFoes() const =0
adds the blocking foes to the current selection
void drawStopLabels(const GUIVisualizationSettings &s, bool noLoop, const RGBColor &col) const
Seats mySeatPositions
positions of seats in the vehicle (updated at every drawing step)
std::string getDeviceDescription()
lists equipped device (types) for the current vehicle
const MSVehicleType & getVType() const
A shortcut to myVehicle.myType.
virtual double getVisualAngle(bool s2) const =0
Returns the vehicle's direction in radians taking into account secondary shape.
void setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
Definition: GUIContainer.h:113
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
Definition: GUIDesigns.cpp:42
The popup menu of a globject.
GUISUMOAbstractView * getParentView()
return the real owner of this popup
void buildShowTypeParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the type parameter window.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:156
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:104
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
static bool gSecondaryShape
whether secondary shapes are currently being drawn
Definition: GUIGlobals.h:49
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:82
A lane area vehicles can halt at (gui-version)
const Position & getSignPos() const
void setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
Definition: GUIPerson.cpp:373
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition: GUIPerson.cpp:283
T getColor(const double value) const
bool removeAdditionalGLVisualisation(GUIGlObject *const which)
Removes an object from the list of objects that show additional things.
void destroyPopup()
destroys the popup
bool addAdditionalGLVisualisation(GUIGlObject *const which)
Adds an object to call its additional visualisation method.
virtual GUIGlID getTrackedID() const
get tracked id
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings vehicleName
GUIVisualizationSizeSettings vehicleSize
bool showBlinker
Information whether vehicle blinkers shall be drawn.
GUIColorer vehicleColorer
The vehicle colorer.
GUIVisualizationTextSettings vehicleScaleValue
std::string vehicleScaleParam
key for scaling by vehicle parameter
bool showParkingInfo
Set whether parking related information should be shown.
GUIVisualizationTextSettings vehicleValue
int vehicleQuality
The quality of vehicle drawing.
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
std::string vehicleTextParam
key for rendering vehicle textual parameter
bool scaleLength
Whether vehicle length shall be scaled with length/geometry factor.
GUIScaler vehicleScaler
The size scaling settings for vehicles.
double scale
information about a lane's width (temporary, used for a single view)
bool secondaryShape
whether secondary lane shape shall be drawn
bool drawMinGap
Information whether the minimum gap shall be drawn.
GUIVisualizationTextSettings vehicleText
bool showBTRange
Information whether the communication range shall be drawn.
bool drawReversed
Whether to draw reversed vehicles in their reversed state.
bool drawBrakeGap
Information whether the brake gap shall be drawn.
bool drawLaneChangePreference
Information whether the lane change preference shall be drawn.
double angle
The current view rotation angle.
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:191
void vaporizeCar(MEVehicle *v, MSMoveReminder::Notification reason)
remove the given car and clean up the relevant data structures
Definition: MELoop.cpp:251
A vehicle from the mesoscopic point of view.
Definition: MEVehicle.h:42
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:55
ConstMSRoutePtr getRoutePtr() const
Returns the current route.
virtual bool isSelected() const
whether this vehicle is selected in the GUI
const MSDevice_Transportable * getPersonDevice() const
const std::vector< MSTransportable * > & getPersons() const
retrieve riding persons
std::map< const MSParkingArea *, PaMemory, ComparatorIdLess > ParkingMemory
virtual double getArrivalPos() const
Returns this vehicle's desired arrivalPos for its current route (may change on reroute)
virtual double getStopDelay() const
Returns the estimated public transport stop (departure) delay in seconds.
MoveReminderCont myMoveReminders
Currently relevant move reminders.
const std::list< MSStop > & getStops() const
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
int getNumberParkingReroutes() const
std::vector< MSVehicleDevice * > myDevices
The devices this vehicle has.
bool isReversed() const
Returns whether the logical state of the vehicle is reversed - for drawing.
virtual double getTimeLossSeconds() const
Returns the time loss in seconds.
virtual const MSEdge * getCurrentEdge() const
Returns the edge the vehicle is currently at (possibly an internal edge)
bool isParking() const
Returns whether the vehicle is parking.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
virtual int getArrivalLane() const
const MSDevice_Transportable * getContainerDevice() const
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
double getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
const ParkingMemory * getParkingMemory() const
std::string getPrefixedParameter(const std::string &key, std::string &error) const
retrieve parameters of devices, models and the vehicle itself
virtual double getStopArrivalDelay() const
Returns the estimated public transport stop arrival delay in seconds.
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
const std::vector< MSVehicleDevice * > & getDevices() const
Returns this vehicle's devices.
virtual double getAcceleration() const
Returns the vehicle's acceleration.
virtual double getRightSideOnEdge(const MSLane *lane=0) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0)
SUMOTime getDepartDelay() const
Returns the depart delay.
int getNumberReroutes() const
Returns the number of new routes this vehicle got.
virtual bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
const std::vector< MSTransportable * > & getContainers() const
retrieve riding containers
const MSRoute & getRoute() const
Returns the current route.
bool isStopped() const
Returns whether the vehicle is at a stop.
MSDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists, nullptr otherwise.
double brakeGap(const double speed) const
Returns the distance the vehicle needs to halt including driver's reaction time tau (i....
Definition: MSCFModel.h:380
static double getRange()
Returns the configured range.
const std::vector< MSTransportable * > & getTransportables() const
Returns the list of transportables using this vehicle.
int size() const
Return the number of passengers / containers.
ConstMSRoutePtr getRoute(int index) const
Called on route retrieval.
static MSDevice_Vehroutes * buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into, int maxRoutes=std::numeric_limits< int >::max())
Build devices for the given vehicle, if needed.
Abstract in-vehicle / in-person device.
Definition: MSDevice.h:62
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:168
double getWidth() const
Returns the edges's width (sum over all lanes)
Definition: MSEdge.h:633
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the maximum speed the vehicle may use on this edge.
Definition: MSEdge.cpp:1106
static bool gUseMesoSim
Definition: MSGlobals.h:103
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:109
static bool gLefthand
Whether lefthand-drive is being simulated.
Definition: MSGlobals.h:169
static bool gUseStopEnded
whether the simulation should replay previous stop times
Definition: MSGlobals.h:130
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
Definition: MSLane.cpp:2696
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: MSLane.h:475
virtual double getLengthGeometryFactor(bool) const
Definition: MSLane.h:290
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition: MSLane.h:566
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: MSLane.h:505
double getWidth() const
Returns the lane's width.
Definition: MSLane.h:627
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:552
virtual const PositionVector & getShape(bool) const
Definition: MSLane.h:294
@ NOTIFICATION_VAPORIZED_GUI
The vehicle got removed via the GUI.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:182
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:378
const RGBColor & getColor() const
Returns the color.
Definition: MSRoute.cpp:395
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:124
Definition: MSStop.h:44
double getUpscaleLength() const
Definition: MSTrainHelper.h:63
void scheduleVehicleRemoval(SUMOVehicle *veh, bool checkDuplicate=false)
Removes a vehicle after it has ended.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
double getTimeGapOnLane() const
Returns the time gap in seconds to the leader of the vehicle on the same lane.
Definition: MSVehicle.cpp:6504
PositionVector getBoundingPoly(double offset=0) const
get bounding polygon
Definition: MSVehicle.cpp:6946
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs.
Definition: MSVehicle.h:713
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:5720
MSLane * getMutableLane() const
Returns the lane the vehicle is on Non const version indicates that something volatile is going on.
Definition: MSVehicle.h:592
bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string &errorMsg)
Definition: MSVehicle.cpp:7080
PositionVector getBoundingBox(double offset=0) const
get bounding rectangle
Definition: MSVehicle.cpp:6915
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:1043
bool resumeFromStopping()
Definition: MSVehicle.cpp:7118
int getBestLaneOffset() const
Definition: MSVehicle.cpp:6401
std::pair< const MSLane *, double > getLanePosAfterDist(double distance) const
return lane and position along bestlanes at the given distance
Definition: MSVehicle.cpp:6436
double getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:493
const MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:584
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
Definition: MSVehicle.h:974
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
double getSeatingWidth() const
Get the width of the passenger compartment when being drawn.
double getMinGap() const
Get the free space in front of vehicles of this class.
bool wasSet(long long int what) const
Returns whether the given parameter was set.
Definition: MSVehicleType.h:80
const RGBColor & getColor() const
Returns this type's color.
double getFrontSeatPos() const
Get offset of first seat from vehicle front.
double getLength() const
Get vehicle's length [m].
SUMOVehicleShape getGuiShape() const
Get this vehicle type's shape.
const std::string & getID() const
Returns the id.
Definition: Named.h:74
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:271
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:261
double x() const
Returns the x-position.
Definition: Position.h:55
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position (in radians bet...
Definition: Position.h:281
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
PositionVector getOrthogonal(const Position &p, double extend, bool before, double length=1.0, double deg=90) const
return orthogonal through p (extending this vector if necessary)
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor WHITE
Definition: RGBColor.h:192
static const RGBColor BLUE
Definition: RGBColor.h:187
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition: RGBColor.cpp:92
RGBColor multiply(double factor) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:230
static const RGBColor GREEN
Definition: RGBColor.h:186
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb....
Definition: RGBColor.cpp:371
static const RGBColor BLACK
Definition: RGBColor.h:193
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:200
static const RGBColor DEFAULT_COLOR
The default color (for vehicle types and vehicles)
Definition: RGBColor.h:199
static const RGBColor RED
named colors
Definition: RGBColor.h:185
virtual double getSpeed() const =0
Returns the object's current speed.
virtual const MSLane * getLane() const =0
Returns the lane the object is currently at.
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
virtual double getAngle() const =0
Get the vehicle's angle.
Definition of vehicle stop (position and duration)
std::string lane
The lane to stop at.
double startPos
The stopping position start.
double endPos
The stopping position end.
SUMOTime duration
The stopping duration.
RGBColor color
The vehicle's color, TraCI may change this.
bool wasSet(int what) const
Returns whether the given parameter was set.
int arrivalEdge
(optional) The final edge within the route of the vehicle
std::string line
The vehicle's line (mainly for public transport)
static const int NEWLINE
identifier for splitting the given string at all newline characters
std::vector< std::string > getVector()
return vector of strings
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
#define M_PI
Definition: odrSpiral.cpp:45
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool constantSizeSelected
whether only selected objects shall be drawn with constant
bool show(const GUIGlObject *o) const
whether to show the text
double scaledSize(double scale, double constFactor=0.1) const
get scale size