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.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>
29 #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>
55 #include <gui/GUIGlobals.h>
56 
57 #include "GUIBaseVehicle.h"
58 #include "GUIPerson.h"
59 #include "GUIContainer.h"
60 #include "GUINet.h"
61 #include "GUIEdge.h"
62 #include "GUILane.h"
63 
64 //#define DRAW_BOUNDING_BOX
65 
66 // ===========================================================================
67 // FOX callback mapping
68 // ===========================================================================
69 FXDEFMAP(GUIBaseVehicle::GUIBaseVehiclePopupMenu) GUIBaseVehiclePopupMenuMap[] = {
84 };
85 
86 // Object implementation
87 FXIMPLEMENT(GUIBaseVehicle::GUIBaseVehiclePopupMenu, GUIGLObjectPopupMenu, GUIBaseVehiclePopupMenuMap, ARRAYNUMBER(GUIBaseVehiclePopupMenuMap))
88 
89 // ===========================================================================
90 // method definitions
91 // ===========================================================================
92 /* -------------------------------------------------------------------------
93  * GUIBaseVehicle::GUIBaseVehiclePopupMenu - methods
94  * ----------------------------------------------------------------------- */
97  : GUIGLObjectPopupMenu(app, parent, o) {
98 }
99 
100 
102 
103 
104 long
106  assert(myObject->getType() == GLO_VEHICLE);
107  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_ALL_ROUTES)) {
108  static_cast<GUIBaseVehicle*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_ALL_ROUTES);
109  }
110  return 1;
111 }
112 
113 long
115  assert(myObject->getType() == GLO_VEHICLE);
116  static_cast<GUIBaseVehicle*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_ALL_ROUTES);
117  return 1;
118 }
119 
120 
121 long
123  assert(myObject->getType() == GLO_VEHICLE);
124  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_ROUTE)) {
125  static_cast<GUIBaseVehicle*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_ROUTE);
126  }
127  return 1;
128 }
129 
130 long
132  assert(myObject->getType() == GLO_VEHICLE);
133  static_cast<GUIBaseVehicle*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_ROUTE);
134  return 1;
135 }
136 
137 
138 long
140  assert(myObject->getType() == GLO_VEHICLE);
141  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_FUTURE_ROUTE)) {
142  static_cast<GUIBaseVehicle*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_FUTURE_ROUTE);
143  }
144  return 1;
145 }
146 
147 long
149  assert(myObject->getType() == GLO_VEHICLE);
150  static_cast<GUIBaseVehicle*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_FUTURE_ROUTE);
151  return 1;
152 }
153 
154 
155 long
157  assert(myObject->getType() == GLO_VEHICLE);
158  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_BEST_LANES)) {
159  static_cast<GUIBaseVehicle*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_BEST_LANES);
160  }
161  return 1;
162 }
163 
164 long
166  assert(myObject->getType() == GLO_VEHICLE);
167  static_cast<GUIBaseVehicle*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_BEST_LANES);
168  return 1;
169 }
170 
171 
172 long
174  assert(myObject->getType() == GLO_VEHICLE);
175  if (myParent->getTrackedID() != static_cast<GUIBaseVehicle*>(myObject)->getGlID()) {
176  myParent->startTrack(static_cast<GUIBaseVehicle*>(myObject)->getGlID());
177  }
178  return 1;
179 }
180 
181 long
183  assert(myObject->getType() == GLO_VEHICLE);
184  myParent->stopTrack();
185  return 1;
186 }
187 
188 
189 long
191  assert(myObject->getType() == GLO_VEHICLE);
192  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_LFLINKITEMS)) {
193  static_cast<GUIBaseVehicle*>(myObject)->addActiveAddVisualisation(myParent, VO_SHOW_LFLINKITEMS);
194  }
195  return 1;
196 }
197 
198 long
200  assert(myObject->getType() == GLO_VEHICLE);
201  static_cast<GUIBaseVehicle*>(myObject)->removeActiveAddVisualisation(myParent, VO_SHOW_LFLINKITEMS);
202  return 1;
203 }
204 
205 long
207  assert(myObject->getType() == GLO_VEHICLE);
208  static_cast<GUIBaseVehicle*>(myObject)->selectBlockingFoes();
209  myParent->update();
210  return 1;
211 }
212 
213 
214 long
216  GUIBaseVehicle* baseVeh = static_cast<GUIBaseVehicle*>(myObject);
217  MSVehicle* microVeh = dynamic_cast<MSVehicle*>(&baseVeh->myVehicle);
218  if (microVeh != nullptr) {
220  if (microVeh->getLane() != nullptr) {
222  }
223  } else {
224  MEVehicle* mesoVeh = dynamic_cast<MEVehicle*>(&baseVeh->myVehicle);
226  }
228  myParent->update();
229  return 1;
230 }
231 
232 
233 /* -------------------------------------------------------------------------
234  * GUIBaseVehicle - methods
235  * ----------------------------------------------------------------------- */
236 
238  GUIGlObject(GLO_VEHICLE, vehicle.getID()),
239  myVehicle(vehicle),
240  myPopup(nullptr) {
241  // as it is possible to show all vehicle routes, we have to store them... (bug [ 2519761 ])
243  myVehicle.myMoveReminders.push_back(std::make_pair(myRoutes, 0.));
244  mySeatPositions.push_back(Position(0, 0)); // ensure length 1
245 }
246 
247 
249  myLock.lock();
250  for (std::map<GUISUMOAbstractView*, int>::iterator i = myAdditionalVisualizations.begin(); i != myAdditionalVisualizations.end(); ++i) {
251  if (i->first->getTrackedID() == getGlID()) {
252  i->first->stopTrack();
253  }
254  while (i->first->removeAdditionalGLVisualisation(this));
255  }
256  myLock.unlock();
257  delete myRoutes;
258  if (myPopup != nullptr) {
260  }
261 }
262 
263 
266  GUISUMOAbstractView& parent) {
267  GUIGLObjectPopupMenu* ret = new GUIBaseVehiclePopupMenu(app, parent, *this);
268  buildPopupHeader(ret, app);
272  //
274  new FXMenuCommand(ret, "Hide Current Route", nullptr, ret, MID_HIDE_CURRENTROUTE);
275  } else {
276  new FXMenuCommand(ret, "Show Current Route", nullptr, ret, MID_SHOW_CURRENTROUTE);
277  }
279  new FXMenuCommand(ret, "Hide Future Route", nullptr, ret, MID_HIDE_FUTUREROUTE);
280  } else {
281  new FXMenuCommand(ret, "Show Future Route", nullptr, ret, MID_SHOW_FUTUREROUTE);
282  }
284  new FXMenuCommand(ret, "Hide All Routes", nullptr, ret, MID_HIDE_ALLROUTES);
285  } else {
286  new FXMenuCommand(ret, "Show All Routes", nullptr, ret, MID_SHOW_ALLROUTES);
287  }
289  new FXMenuCommand(ret, "Hide Best Lanes", nullptr, ret, MID_HIDE_BEST_LANES);
290  } else {
291  new FXMenuCommand(ret, "Show Best Lanes", nullptr, ret, MID_SHOW_BEST_LANES);
292  }
294  new FXMenuCommand(ret, "Hide Link Items", nullptr, ret, MID_HIDE_LFLINKITEMS);
295  } else {
296  new FXMenuCommand(ret, "Show Link Items", nullptr, ret, MID_SHOW_LFLINKITEMS);
297  }
298  new FXMenuSeparator(ret);
299  if (parent.getTrackedID() != getGlID()) {
300  new FXMenuCommand(ret, "Start Tracking", nullptr, ret, MID_START_TRACK);
301  } else {
302  new FXMenuCommand(ret, "Stop Tracking", nullptr, ret, MID_STOP_TRACK);
303  }
304  new FXMenuCommand(ret, "Select Foes", nullptr, ret, MID_SHOW_FOES);
305 
306 
307  new FXMenuCommand(ret, "Remove", nullptr, ret, MID_REMOVE_OBJECT);
308 
309  new FXMenuSeparator(ret);
310  //
311  buildShowParamsPopupEntry(ret, false);
313  buildPositionCopyEntry(ret, false);
314  myPopup = ret;
315  return ret;
316 }
317 
318 void
320  myPopup = nullptr;
321 }
322 
323 Boundary
325  Boundary b;
326  b.add(getPosition());
328  return b;
329 }
330 
331 
332 const std::string
334  return myVehicle.getParameter().getParameter("name", "");
335 }
336 
337 
338 void
339 GUIBaseVehicle::drawOnPos(const GUIVisualizationSettings& s, const Position& pos, const double angle) const {
340  glPushName(getGlID());
341  glPushMatrix();
342  Position p1 = pos;
343  const double degAngle = RAD2DEG(angle + M_PI / 2.);
344  const double length = getVType().getLength();
345  glTranslated(p1.x(), p1.y(), getType());
346  glRotated(degAngle, 0, 0, 1);
347  // set lane color
348  setColor(s);
349  // scale
350  const double upscale = s.vehicleSize.getExaggeration(s, this);
351  double upscaleLength = upscale;
352  if (upscale > 1 && length > 5) {
353  // reduce the length/width ratio because this is not usefull at high zoom
354  upscaleLength = MAX2(1.0, upscaleLength * (5 + sqrt(length - 5)) / length);
355  }
356  glScaled(upscale, upscaleLength, 1);
357  /*
358  MSLCM_DK2004 &m2 = static_cast<MSLCM_DK2004&>(veh->getLaneChangeModel());
359  if((m2.getState()&LCA_URGENT)!=0) {
360  glColor3d(1, .4, .4);
361  } else if((m2.getState()&LCA_SPEEDGAIN)!=0) {
362  glColor3d(.4, .4, 1);
363  } else {
364  glColor3d(.4, 1, .4);
365  }
366  */
367  // draw the vehicle
368  bool drawCarriages = false;
369  switch (s.vehicleQuality) {
370  case 0:
372  break;
373  case 1:
375  break;
376  case 2:
378  // draw flashing blue light for emergency vehicles
379  if (getVType().getGuiShape() == SVS_EMERGENCY) {
380  glTranslated(0, 0, .1);
382  }
383  break;
384  case 3:
385  default:
386  drawCarriages = drawAction_drawVehicleAsPolyWithCarriagges(s, true);
387  break;
388  }
389  if (s.drawMinGap) {
390  const double minGap = -getVType().getMinGap();
391  glColor3d(0., 1., 0.);
392  glBegin(GL_LINES);
393  glVertex2d(0., 0);
394  glVertex2d(0., minGap);
395  glVertex2d(-.5, minGap);
396  glVertex2d(.5, minGap);
397  glEnd();
398  }
400  const double brakeGap = -static_cast<MSVehicle&>(myVehicle).getCarFollowModel().brakeGap(myVehicle.getSpeed());
401  glColor3d(1., 0., 0.);
402  glBegin(GL_LINES);
403  glVertex2d(0., 0);
404  glVertex2d(0., brakeGap);
405  glVertex2d(-.5, brakeGap);
406  glVertex2d(.5, brakeGap);
407  glEnd();
408  }
409  MSDevice_BTreceiver* dev = static_cast<MSDevice_BTreceiver*>(myVehicle.getDevice(typeid(MSDevice_BTreceiver)));
410  if (dev != nullptr && s.showBTRange) {
411  glColor3d(1., 0., 0.);
412  GLHelper::drawOutlineCircle(dev->getRange(), dev->getRange() - .2, 32);
413  }
414  // draw the blinker and brakelights if wished
415  if (s.showBlinker) {
416  glTranslated(0, 0, .1);
417  switch (getVType().getGuiShape()) {
418  case SVS_PEDESTRIAN:
419  case SVS_BICYCLE:
420  case SVS_ANT:
421  case SVS_SHIP:
422  case SVS_RAIL:
423  case SVS_RAIL_CARGO:
424  case SVS_RAIL_CAR:
425  break;
426  case SVS_MOTORCYCLE:
427  case SVS_MOPED:
429  drawAction_drawVehicleBrakeLight(length, true);
430  break;
431  default:
432  // only SVS_RAIL_CAR has blinkers and brake lights but they are drawn along with the carriages
433  if (!drawCarriages) {
436  }
437  break;
438  }
439  }
440  // draw the wish to change the lane
441  if (s.drawLaneChangePreference) {
442  /*
443  if(gSelected.isSelected(GLO_VEHICLE, veh->getGlID())) {
444  MSLCM_DK2004 &m = static_cast<MSLCM_DK2004&>(veh->getLaneChangeModel());
445  glColor3d(.5, .5, 1);
446  glBegin(GL_LINES);
447  glVertex2f(0, 0);
448  glVertex2f(m.getChangeProbability(), .5);
449  glEnd();
450 
451  glColor3d(1, 0, 0);
452  glBegin(GL_LINES);
453  glVertex2f(0.1, 0);
454  glVertex2f(0.1, m.myMaxJam1);
455  glEnd();
456 
457  glColor3d(0, 1, 0);
458  glBegin(GL_LINES);
459  glVertex2f(-0.1, 0);
460  glVertex2f(-0.1, m.myTDist);
461  glEnd();
462  }
463  */
464  }
465  // draw best lanes
466  /*
467  if (true) {
468  const MSLane &l = veh->getLane();
469  double r1 = veh->allowedContinuationsLength(&l, 0);
470  double r2 = l.getLeftLane()!=0 ? veh->allowedContinuationsLength(l.getLeftLane(), 0) : 0;
471  double r3 = l.getRightLane()!=0 ? veh->allowedContinuationsLength(l.getRightLane(), 0) : 0;
472  double mmax = MAX3(r1, r2, r3);
473  glBegin(GL_LINES);
474  glVertex2f(0, 0);
475  glVertex2f(0, r1/mmax/2.);
476  glEnd();
477  glBegin(GL_LINES);
478  glVertex2f(.4, 0);
479  glVertex2f(.4, r2/mmax/2.);
480  glEnd();
481  glBegin(GL_LINES);
482  glVertex2f(-.4, 0);
483  glVertex2f(-.4, r3/mmax/2.);
484  glEnd();
485  }
486  */
487  glTranslated(0, MIN2(length / 2, double(5)), -getType()); // drawing name at GLO_MAX fails unless translating z
488  glScaled(1 / upscale, 1 / upscaleLength, 1);
489  glRotated(-degAngle, 0, 0, 1);
490  drawName(Position(0, 0), s.scale, s.vehicleName, s.angle);
491  if (s.vehicleName.show && myVehicle.getParameter().line != "") {
492  glRotated(-s.angle, 0, 0, 1);
493  glTranslated(0, 0.7 * s.vehicleName.scaledSize(s.scale), 0);
494  glRotated(s.angle, 0, 0, 1);
496  }
497  if (s.vehicleValue.show) {
498  glRotated(-s.angle, 0, 0, 1);
499  glTranslated(0, 0.7 * s.vehicleName.scaledSize(s.scale), 0);
500  glRotated(s.angle, 0, 0, 1);
501  const double value = getColorValue(s, s.vehicleColorer.getActive());
503  }
504  if (s.vehicleText.show) {
505  const std::string& value = myVehicle.getParameter().getParameter(s.vehicleTextParam, "");
506  if (value != "") {
507  auto lines = StringTokenizer(value, StringTokenizer::NEWLINE).getVector();
508  glRotated(-s.angle, 0, 0, 1);
509  glTranslated(0, 0.7 * s.vehicleText.scaledSize(s.scale) * lines.size(), 0);
510  glRotated(s.angle, 0, 0, 1);
511  for (std::string& line : lines) {
513  glRotated(-s.angle, 0, 0, 1);
514  glTranslated(0, -0.7 * s.vehicleText.scaledSize(s.scale), 0);
515  glRotated(s.angle, 0, 0, 1);
516  }
517  }
518  }
519 
520  if (!drawCarriages) {
521  mySeatPositions.clear();
522  int requiredSeats = getNumPassengers() + getNumContainers();
523  const int totalSeats = getVType().getPersonCapacity() + getVType().getContainerCapacity();
524  const Position back = (p1 + Position(-length * upscaleLength, 0)).rotateAround2D(angle, p1);
525  computeSeats(p1, back, totalSeats, upscale, requiredSeats);
526  }
527 
528  glPopMatrix();
529  glPopName();
531 }
532 
533 
534 void
536  drawOnPos(s, getPosition(), getAngle());
537 }
538 
539 
540 void
542  if (!myVehicle.isOnRoad()) {
543  drawGL(s);
544  }
545  glPushName(getGlID());
546  glPushMatrix();
547  glTranslated(0, 0, getType() - .1); // don't draw on top of other cars
549  drawBestLanes();
550  }
552  drawRoute(s, 0, 0.25, false);
553  }
555  drawRoute(s, 0, 0.25, true);
556  }
558  if (myVehicle.getNumberReroutes() > 0) {
559  const int noReroutePlus1 = myVehicle.getNumberReroutes() + 1;
560  for (int i = noReroutePlus1 - 1; i >= 0; i--) {
561  double darken = double(0.4) / double(noReroutePlus1) * double(i);
562  drawRoute(s, i, darken);
563  }
564  } else {
565  drawRoute(s, 0, 0.25);
566  }
567  }
570  }
571  glPopMatrix();
572  glPopName();
573 }
574 
575 
576 void
577 GUIBaseVehicle::drawLinkItem(const Position& pos, SUMOTime arrivalTime, SUMOTime leaveTime, double exagerate) {
578  glTranslated(pos.x(), pos.y(), -.1);
580  std::string times = toString(STEPS2TIME(arrivalTime)) + "/" + toString(STEPS2TIME(leaveTime));
581  GLHelper::drawText(times.c_str(), Position(), .1, 1.6 * exagerate, RGBColor::GREEN, 0);
582  glTranslated(-pos.x(), -pos.y(), .1);
583 }
584 
585 
586 RGBColor
588  RGBColor col;
589  const GUIColorer& c = s.vehicleColorer;
590  if (!setFunctionalColor(c.getActive(), &myVehicle, col)) {
591  col = c.getScheme().getColor(getColorValue(s, c.getActive()));
592  }
593  GLHelper::setColor(col);
594  return col;
595 }
596 
597 
598 bool
599 GUIBaseVehicle::setFunctionalColor(int activeScheme, const MSBaseVehicle* veh, RGBColor& col) {
600  switch (activeScheme) {
601  case 0: {
602  //test for emergency vehicle
603  if (veh->getVehicleType().getGuiShape() == SVS_EMERGENCY) {
604  col = RGBColor::WHITE;
605  return true;
606  }
607  //test for firebrigade
608  if (veh->getVehicleType().getGuiShape() == SVS_FIREBRIGADE) {
609  col = RGBColor::RED;
610  return true;
611  }
612  //test for police car
613  if (veh->getVehicleType().getGuiShape() == SVS_POLICE) {
614  col = RGBColor::BLUE;
615  return true;
616  }
617  if (veh->getParameter().wasSet(VEHPARS_COLOR_SET)) {
618  col = veh->getParameter().color;
619  return true;
620  }
622  col = veh->getVehicleType().getColor();
623  return true;
624  }
625  if (&(veh->getRoute().getColor()) != &RGBColor::DEFAULT_COLOR) {
626  col = veh->getRoute().getColor();
627  return true;
628  }
629  return false;
630  }
631  case 2: {
632  if (veh->getParameter().wasSet(VEHPARS_COLOR_SET)) {
633  col = veh->getParameter().color;
634  return true;
635  }
636  return false;
637  }
638  case 3: {
640  col = veh->getVehicleType().getColor();
641  return true;
642  }
643  return false;
644  }
645  case 4: {
646  if (&(veh->getRoute().getColor()) != &RGBColor::DEFAULT_COLOR) {
647  col = veh->getRoute().getColor();
648  return true;
649  }
650  return false;
651  }
652  case 5: {
653  Position p = veh->getRoute().getEdges()[0]->getLanes()[0]->getShape()[0];
654  const Boundary& b = ((GUINet*) MSNet::getInstance())->getBoundary();
655  Position center = b.getCenter();
656  double hue = 180. + atan2(center.x() - p.x(), center.y() - p.y()) * 180. / M_PI;
657  double sat = p.distanceTo(center) / center.distanceTo(Position(b.xmin(), b.ymin()));
658  col = RGBColor::fromHSV(hue, sat, 1.);
659  return true;
660  }
661  case 6: {
662  Position p = veh->getRoute().getEdges().back()->getLanes()[0]->getShape()[-1];
663  const Boundary& b = ((GUINet*) MSNet::getInstance())->getBoundary();
664  Position center = b.getCenter();
665  double hue = 180. + atan2(center.x() - p.x(), center.y() - p.y()) * 180. / M_PI;
666  double sat = p.distanceTo(center) / center.distanceTo(Position(b.xmin(), b.ymin()));
667  col = RGBColor::fromHSV(hue, sat, 1.);
668  return true;
669  }
670  case 7: {
671  Position pb = veh->getRoute().getEdges()[0]->getLanes()[0]->getShape()[0];
672  Position pe = veh->getRoute().getEdges().back()->getLanes()[0]->getShape()[-1];
673  const Boundary& b = ((GUINet*) MSNet::getInstance())->getBoundary();
674  double hue = 180. + atan2(pb.x() - pe.x(), pb.y() - pe.y()) * 180. / M_PI;
675  Position minp(b.xmin(), b.ymin());
676  Position maxp(b.xmax(), b.ymax());
677  double sat = pb.distanceTo(pe) / minp.distanceTo(maxp);
678  col = RGBColor::fromHSV(hue, sat, 1.);
679  return true;
680  }
681  case 30: { // color randomly (by pointer hash)
682  std::hash<const MSBaseVehicle*> ptr_hash;
683  const double hue = (double)(ptr_hash(veh) % 360); // [0-360]
684  const double sat = ((ptr_hash(veh) / 360) % 67) / 100.0 + 0.33; // [0.33-1]
685  col = RGBColor::fromHSV(hue, sat, 1.);
686  return true;
687  }
688  }
689  return false;
690 }
691 
692 
693 // ------------ Additional visualisations
694 bool
696  return myAdditionalVisualizations.find(parent) != myAdditionalVisualizations.end() && (myAdditionalVisualizations.find(parent)->second & which) != 0;
697 }
698 
699 
700 void
702  if (myAdditionalVisualizations.find(parent) == myAdditionalVisualizations.end()) {
703  myAdditionalVisualizations[parent] = 0;
704  }
705  myAdditionalVisualizations[parent] |= which;
706  parent->addAdditionalGLVisualisation(this);
707 }
708 
709 
710 void
712  myAdditionalVisualizations[parent] &= ~which;
713  if (myAdditionalVisualizations[parent] == 0) {
714  myAdditionalVisualizations.erase(parent);
715  }
716  parent->removeAdditionalGLVisualisation(this);
717 }
718 
719 
720 void
721 GUIBaseVehicle::drawRoute(const GUIVisualizationSettings& s, int routeNo, double darken, bool future) const {
722  RGBColor darker = setColor(s).changedBrightness((int)(darken * -255));
723  GLHelper::setColor(darker);
724  if (routeNo == 0) {
725  drawRouteHelper(s, myVehicle.getRoute(), future, darker);
726  return;
727  }
728  const MSRoute* route = myRoutes->getRoute(routeNo - 1); // only prior routes are stored
729  if (route != nullptr) {
730  drawRouteHelper(s, *route, future, darker);
731  }
732 }
733 
734 
735 const Position&
736 GUIBaseVehicle::getSeatPosition(int personIndex) const {
738  return mySeatPositions[MIN2(personIndex, (int)mySeatPositions.size() - 1)];
739 }
740 
741 
742 void
744  if (myVehicle.myPersonDevice != nullptr) {
745  const std::vector<MSTransportable*>& ps = myVehicle.myPersonDevice->getTransportables();
746  int personIndex = 0;
747  for (std::vector<MSTransportable*>::const_iterator i = ps.begin(); i != ps.end(); ++i) {
748  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
749  assert(person != 0);
750  person->setPositionInVehicle(getSeatPosition(personIndex++));
751  person->drawGL(s);
752  }
753  }
754  if (myVehicle.myContainerDevice != nullptr) {
755  const std::vector<MSTransportable*>& cs = myVehicle.myContainerDevice->getTransportables();
756  int containerIndex = 0;
757  for (std::vector<MSTransportable*>::const_iterator i = cs.begin(); i != cs.end(); ++i) {
758  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
759  assert(container != 0);
760  container->setPositionInVehicle(getSeatPosition(containerIndex++));
761  container->drawGL(s);
762  }
763  }
764 #ifdef DRAW_BOUNDING_BOX
765  glPushName(getGlID());
766  glPushMatrix();
767  glTranslated(0, 0, getType());
768  PositionVector boundingBox = getBoundingBox();
769  boundingBox.push_back(boundingBox.front());
770  PositionVector smallBB = getBoundingPoly();
771  glColor3d(0, .8, 0);
772  GLHelper::drawLine(boundingBox);
773  glColor3d(0.5, .8, 0);
774  GLHelper::drawLine(smallBB);
775  //GLHelper::drawBoxLines(getBoundingBox(), 0.5);
776  glPopMatrix();
777  glPopName();
778 #endif
779 }
780 
781 
782 bool
784  if (getVType().getParameter().carriageLength > 0) {
785  drawAction_drawCarriageClass(s, asImage);
786  return true;
787  } else {
789  s, getVType().getImgFile(), this, getVType().getWidth(), getVType().getLength())) {
790  return false;
791  }
792  GUIBaseVehicleHelper::drawAction_drawVehicleAsPoly(s, getVType().getGuiShape(), getVType().getWidth(), getVType().getLength());
793  return false;
794  }
795 }
796 
797 
798 int
800  if (myVehicle.getPersonDevice() != nullptr) {
801  return (int)myVehicle.getPersonDevice()->size();
802  }
803  return 0;
804 }
805 
806 
807 int
809  if (myVehicle.getContainerDevice() != nullptr) {
810  return (int)myVehicle.getContainerDevice()->size();
811  }
812  return 0;
813 }
814 
815 
816 void
817 GUIBaseVehicle::computeSeats(const Position& front, const Position& back, int maxSeats, double exaggeration, int& requiredSeats) const {
818  if (requiredSeats <= 0) {
819  return; // save some work
820  }
821  const double vehWidth = getVType().getWidth() * exaggeration;
822  const double length = front.distanceTo2D(back);
823  const double seatOffset = SUMO_const_waitingPersonWidth * exaggeration;
824  const int rowSize = MAX2(1, (int)floor(vehWidth / seatOffset));
825  const double rowOffset = (length - 1) / ceil((double)maxSeats / rowSize);
826  const double sideOffset = (rowSize - 1) / 2 * seatOffset;
827  double rowPos = 1 - rowOffset;
828  for (int i = 0; requiredSeats > 0 && i < maxSeats; i++) {
829  int seat = (i % rowSize);
830  if (seat == 0) {
831  rowPos += rowOffset;
832  }
833  mySeatPositions.push_back(PositionVector::positionAtOffset2D(front, back, rowPos,
834  seat * seatOffset - sideOffset));
835  requiredSeats--;
836  }
837 }
838 
839 
840 
841 /****************************************************************************/
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:180
MID_SHOW_LFLINKITEMS
Definition: GUIAppEnum.h:437
MEVehicle
A vehicle from the mesoscopic point of view.
Definition: MEVehicle.h:44
RGBColor::DEFAULT_COLOR
static const RGBColor DEFAULT_COLOR
The default color (for vehicle types and vehicles)
Definition: RGBColor.h:203
MSDevice_Vehroutes::getRoute
const MSRoute * getRoute(int index) const
Called on route retrieval.
Definition: MSDevice_Vehroutes.cpp:367
MID_HIDE_FUTUREROUTE
Hide vehicle's future route.
Definition: GUIAppEnum.h:422
MSDevice_Transportable::getTransportables
const std::vector< MSTransportable * > & getTransportables() const
Returns the list of transportables using this vehicle.
Definition: MSDevice_Transportable.h:134
MSBaseVehicle::getParameter
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
Definition: MSBaseVehicle.cpp:144
SUMOVehicleParameter::wasSet
bool wasSet(int what) const
Returns whether the given parameter was set.
Definition: SUMOVehicleParameter.h:312
GLHelper::drawTextSettings
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048)
Definition: GLHelper.cpp:706
MIN2
T MIN2(T a, T b)
Definition: StdDefs.h:73
GUIBaseVehicle::setFunctionalColor
static bool setFunctionalColor(int activeScheme, const MSBaseVehicle *veh, RGBColor &col)
sets the color according to the current scheme index and some vehicle function
Definition: GUIBaseVehicle.cpp:599
GUIBaseVehicle::removedPopupMenu
void removedPopupMenu()
notify object about popup menu removal
Definition: GUIBaseVehicle.cpp:319
GUIBaseVehicle
A MSVehicle extended by some values for usage within the gui.
Definition: GUIBaseVehicle.h:61
MSDevice_BTreceiver
A BT receiver.
Definition: MSDevice_BTreceiver.h:49
GUIBaseVehicle::getNumPassengers
int getNumPassengers() const
return the number of passengers
Definition: GUIBaseVehicle.cpp:799
GUIContainer.h
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
SVS_MOTORCYCLE
render as a motorcycle
Definition: SUMOVehicleClass.h:60
GUIBaseVehicle::drawRoute
void drawRoute(const GUIVisualizationSettings &s, int routeNo, double darken, bool future=false) const
Chooses the route to draw and draws it, darkening it as given.
Definition: GUIBaseVehicle.cpp:721
GUIVisualizationSettings::vehicleValue
GUIVisualizationTextSettings vehicleValue
Definition: GUIVisualizationSettings.h:523
GUIBaseVehicleHelper::drawAction_drawVehicleAsImage
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
Definition: GUIBaseVehicleHelper.cpp:619
SUMOVehicleParameter::color
RGBColor color
The vehicle's color, TraCI may change this.
Definition: SUMOVehicleParameter.h:477
Boundary::ymin
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:130
GUIGlObject::drawName
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
Definition: GUIGlObject.cpp:354
MSVehicleType::getGuiShape
SUMOVehicleShape getGuiShape() const
Get this vehicle type's shape.
Definition: MSVehicleType.h:261
GUIBaseVehicle::getNumContainers
int getNumContainers() const
return the number of passengers
Definition: GUIBaseVehicle.cpp:808
GUIVisualizationSettings::angle
double angle
The current view rotation angle.
Definition: GUIVisualizationSettings.h:405
GUIBaseVehicle::drawAction_drawVehicleAsPolyWithCarriagges
bool drawAction_drawVehicleAsPolyWithCarriagges(const GUIVisualizationSettings &s, bool asImage=false) const
draw vehicle body and return whether carriages are being drawn
Definition: GUIBaseVehicle.cpp:783
GUIGlObject::buildSelectionPopupEntry
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
Definition: GUIGlObject.cpp:235
MID_SHOW_CURRENTROUTE
Show vehicle's current route.
Definition: GUIAppEnum.h:416
GUIBaseVehicleHelper::drawAction_drawVehicleAsPoly
static void drawAction_drawVehicleAsPoly(const GUIVisualizationSettings &s, const SUMOVehicleShape shape, const double width, const double length, int carriageIndex=-1)
draw vehicle as a polygon
Definition: GUIBaseVehicleHelper.cpp:143
GUIPerson.h
MSDevice_Transportable.h
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdHideAllRoutes
long onCmdHideAllRoutes(FXObject *, FXSelector, void *)
Called if all routes of the vehicle shall be hidden.
Definition: GUIBaseVehicle.cpp:114
MSBaseVehicle::myDevices
std::vector< MSVehicleDevice * > myDevices
The devices this vehicle has.
Definition: MSBaseVehicle.h:542
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdHideFutureRoute
long onCmdHideFutureRoute(FXObject *, FXSelector, void *)
Called if the current route of the vehicle shall be hidden.
Definition: GUIBaseVehicle.cpp:148
MID_START_TRACK
Start to track a vehicle.
Definition: GUIAppEnum.h:432
GUIPerson::setPositionInVehicle
void setPositionInVehicle(const Position &pos)
Definition: GUIPerson.cpp:364
MSBaseVehicle::getNumberReroutes
int getNumberReroutes() const
Returns the number of new routes this vehicle got.
Definition: MSBaseVehicle.h:315
GUIGlobalSelection.h
GUIBaseVehicle::setColor
RGBColor setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIBaseVehicle.cpp:587
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdShowLFLinkItems
long onCmdShowLFLinkItems(FXObject *, FXSelector, void *)
Called if all routes of the vehicle shall be shown.
Definition: GUIBaseVehicle.cpp:190
GUIBaseVehicle::VO_SHOW_LFLINKITEMS
LFLinkItems.
Definition: GUIBaseVehicle.h:295
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
MSBaseVehicle::getRoute
const MSRoute & getRoute() const
Returns the current route.
Definition: MSBaseVehicle.h:115
Boundary::xmax
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:124
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdStopTrack
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the current shall not be tracked any longer.
Definition: GUIBaseVehicle.cpp:182
GUIBaseVehicle::~GUIBaseVehicle
~GUIBaseVehicle()
destructor
Definition: GUIBaseVehicle.cpp:248
MSBaseVehicle::getPersonDevice
const MSDevice_Transportable * getPersonDevice() const
Definition: MSBaseVehicle.h:493
GUIBaseVehicle::getSeatPosition
const Position & getSeatPosition(int personIndex) const
returns the seat position for the person with the given index
Definition: GUIBaseVehicle.cpp:736
MSGlobals::gUseMesoSim
static bool gUseMesoSim
Definition: MSGlobals.h:90
MSVehicle::onRemovalFromNet
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:1060
RAD2DEG
#define RAD2DEG(x)
Definition: GeomHelper.h:38
MSRoute::getEdges
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:120
GUIBaseVehicle::mySeatPositions
PositionVector mySeatPositions
positions of seats in the vehicle (updated at every drawing step)
Definition: GUIBaseVehicle.h:345
GUIBaseVehicle::getVType
const MSVehicleType & getVType() const
A shortcut to myVehicle.myType.
Definition: GUIBaseVehicle.h:329
GLO_VEHICLE
Definition: GUIGlObjectTypes.h:141
GLHelper.h
MID_STOP_TRACK
Stop to track a vehicle.
Definition: GUIAppEnum.h:434
GUIVisualizationSettings::vehicleSize
GUIVisualizationSizeSettings vehicleSize
Definition: GUIVisualizationSettings.h:520
GUIVisualizationSettings::vehicleColorer
GUIColorer vehicleColorer
The vehicle colorer.
Definition: GUIVisualizationSettings.h:496
GUIBaseVehicle::hasActiveAddVisualisation
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIBaseVehicle.cpp:695
MSVehicleControl::scheduleVehicleRemoval
void scheduleVehicleRemoval(SUMOVehicle *veh, bool checkDuplicate=false)
Removes a vehicle after it has ended.
Definition: MSVehicleControl.cpp:117
GUINet.h
MSRoute::getColor
const RGBColor & getColor() const
Returns the color.
Definition: MSRoute.cpp:367
GUIContainer::setPositionInVehicle
void setPositionInVehicle(const Position &pos)
Definition: GUIContainer.h:117
PositionVector
A list of positions.
Definition: PositionVector.h:45
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdShowAllRoutes
long onCmdShowAllRoutes(FXObject *, FXSelector, void *)
Called if all routes of the vehicle shall be shown.
Definition: GUIBaseVehicle.cpp:105
GUIGLObjectPopupMenu::getParentView
GUISUMOAbstractView * getParentView()
return the real owner of this popup
Definition: GUIGLObjectPopupMenu.h:66
MSVehicleType::getPersonCapacity
int getPersonCapacity() const
Get this vehicle type's person capacity.
Definition: MSVehicleType.h:284
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdShowFutureRoute
long onCmdShowFutureRoute(FXObject *, FXSelector, void *)
Called if the current route of the vehicle shall be shown.
Definition: GUIBaseVehicle.cpp:139
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:621
MSRoute
Definition: MSRoute.h:66
GUIVisualizationSettings::drawMinGap
bool drawMinGap
Information whether the minimum gap shall be drawn.
Definition: GUIVisualizationSettings.h:508
GUIBaseVehicle::drawRouteHelper
virtual void drawRouteHelper(const GUIVisualizationSettings &s, const MSRoute &r, bool future, const RGBColor &col) const =0
Draws the route.
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdHideBestLanes
long onCmdHideBestLanes(FXObject *, FXSelector, void *)
Called if the vehicle's best lanes shall be hidden.
Definition: GUIBaseVehicle.cpp:165
GUIVisualizationTextSettings::scaledSize
double scaledSize(double scale, double constFactor=0.1) const
get scale size
Definition: GUIVisualizationSettings.cpp:195
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdRemoveObject
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the vehicle.
Definition: GUIBaseVehicle.cpp:215
Parameterised::getParameter
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
Definition: Parameterised.cpp:72
MSVehicle.h
MSMoveReminder::NOTIFICATION_VAPORIZED
The vehicle got vaporized.
Definition: MSMoveReminder.h:109
GUIAppEnum.h
SUMOVehicleParameter.h
GUIBaseVehicle::drawBestLanes
virtual void drawBestLanes() const
Draws the vehicle's best lanes.
Definition: GUIBaseVehicle.h:137
GUIBaseVehicle::VO_SHOW_ALL_ROUTES
show all vehicle's routes
Definition: GUIBaseVehicle.h:293
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
SVS_BICYCLE
render as a bicycle
Definition: SUMOVehicleClass.h:56
SUMOVehicleParameter::line
std::string line
The vehicle's line (mainly for public transport)
Definition: SUMOVehicleParameter.h:561
GUISUMOAbstractView.h
GUIBaseVehicle::GUIBaseVehiclePopupMenu
Definition: GUIBaseVehicle.h:234
GLHelper::drawFilledCircle
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:348
GUIBaseVehicle::drawOnPos
void drawOnPos(const GUIVisualizationSettings &s, const Position &pos, const double angle) const
Draws the object on the specified position with the specified angle.
Definition: GUIBaseVehicle.cpp:339
StringTokenizer::NEWLINE
static const int NEWLINE
identifier for splitting the given string at all newline characters
Definition: StringTokenizer.h:64
GLHelper::drawText
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:673
RGBColor
Definition: RGBColor.h:39
GUIBaseVehicle::drawAction_drawVehicleBlueLight
virtual void drawAction_drawVehicleBlueLight() const
Definition: GUIBaseVehicle.h:138
GUIBaseVehicle::removeActiveAddVisualisation
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIBaseVehicle.cpp:711
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdStartTrack
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the vehicle shall be tracked.
Definition: GUIBaseVehicle.cpp:173
SUMO_const_waitingPersonWidth
const double SUMO_const_waitingPersonWidth
Definition: StdDefs.h:56
MSBaseVehicle::myPersonDevice
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
Definition: MSBaseVehicle.h:545
GUIContainer::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIContainer.cpp:213
GLHelper::drawOutlineCircle
static void drawOutlineCircle(double width, double iwidth, int steps=8)
Draws an unfilled circle around (0,0)
Definition: GLHelper.cpp:393
Boundary::xmin
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:118
MSVehicleType::getWidth
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
Definition: MSVehicleType.h:246
PollutantsInterface.h
MID_SHOW_BEST_LANES
Show vehicle's best lanes.
Definition: GUIAppEnum.h:424
GUIGlObject::buildNameCopyPopupEntry
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
Definition: GUIGlObject.cpp:225
GUIContainer
Definition: GUIContainer.h:51
GUIPropertySchemeStorage::getScheme
T & getScheme()
Definition: GUIPropertySchemeStorage.h:79
MSDevice_Vehroutes::buildVehicleDevices
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.
Definition: MSDevice_Vehroutes.cpp:83
MID_HIDE_LFLINKITEMS
Definition: GUIAppEnum.h:438
GUILane.h
Position::distanceTo
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:233
VEHPARS_COLOR_SET
const int VEHPARS_COLOR_SET
Definition: SUMOVehicleParameter.h:45
GUITexturesHelper.h
StringTokenizer
Definition: StringTokenizer.h:61
GUIVisualizationSettings::vehicleQuality
int vehicleQuality
The quality of vehicle drawing.
Definition: GUIVisualizationSettings.h:499
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdHideLFLinkItems
long onCmdHideLFLinkItems(FXObject *, FXSelector, void *)
Called if all routes of the vehicle shall be hidden.
Definition: GUIBaseVehicle.cpp:199
GUIGlobals.h
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:56
GUIBaseVehicle::computeSeats
void computeSeats(const Position &front, const Position &back, int maxSeats, double exaggeration, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
Definition: GUIBaseVehicle.cpp:817
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:149
GUIBaseVehicle::getColorValue
virtual double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const =0
gets the color value according to the current scheme index
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
MSVehicleType::getColor
const RGBColor & getColor() const
Returns this type's color.
Definition: MSVehicleType.h:201
RGBColor::BLUE
static const RGBColor BLUE
Definition: RGBColor.h:191
CastingFunctionBinding.h
GUIVisualizationSettings::scale
double scale
information about a lane's width (temporary, used for a single view)
Definition: GUIVisualizationSettings.h:632
SVS_RAIL_CARGO
render as a cargo train
Definition: SUMOVehicleClass.h:94
GUIBaseVehicle::myAdditionalVisualizations
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIBaseVehicle.h:303
GUIApplicationWindow.h
MSDevice_BTreceiver::getRange
static double getRange()
Returns the configured range.
Definition: MSDevice_BTreceiver.h:73
GUIVisualizationSettings::vehicleName
GUIVisualizationTextSettings vehicleName
Definition: GUIVisualizationSettings.h:523
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
MELoop::vaporizeCar
void vaporizeCar(MEVehicle *v)
remove the given car and clean up the relevant data structures
Definition: MELoop.cpp:223
Position::x
double x() const
Returns the x-position.
Definition: Position.h:56
GUIBaseVehicle::drawAction_drawLinkItems
virtual void drawAction_drawLinkItems(const GUIVisualizationSettings &) const
Definition: GUIBaseVehicle.h:134
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
SVS_MOPED
render as a moped
Definition: SUMOVehicleClass.h:58
GUIVisualizationSettings::vehicleTextParam
std::string vehicleTextParam
key for rendering textual parameter
Definition: GUIVisualizationSettings.h:486
GLHelper::drawLine
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:274
MID_SHOW_ALLROUTES
Show all vehicle's routes.
Definition: GUIAppEnum.h:428
MSVehicleType::getMinGap
double getMinGap() const
Get the free space in front of vehicles of this class.
Definition: MSVehicleType.h:125
RGBColor::RED
static const RGBColor RED
named colors
Definition: RGBColor.h:189
GUIBaseVehicle::GUIBaseVehicle
GUIBaseVehicle(MSBaseVehicle &vehicle)
Definition: GUIBaseVehicle.cpp:237
MSLane::removeVehicle
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
Definition: MSLane.cpp:2180
SVS_POLICE
render as a police car
Definition: SUMOVehicleClass.h:106
GUIBaseVehicleHelper.h
GUIBaseVehicle::myLock
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIBaseVehicle.h:342
RGBColor::fromHSV
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:298
MSBaseVehicle::isOnRoad
virtual bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSBaseVehicle.h:160
GUIVisualizationTextSettings::show
bool show
flag show
Definition: GUIVisualizationSettings.h:68
GUIGlObject
Definition: GUIGlObject.h:65
MSBaseVehicle::getVehicleType
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Definition: MSBaseVehicle.h:123
GUIBaseVehicleHelper::drawAction_drawVehicleAsBoxPlus
static void drawAction_drawVehicleAsBoxPlus(const double width, const double length)
draw vehicle as a Box
Definition: GUIBaseVehicleHelper.cpp:111
GUIBaseVehicle::VO_SHOW_ROUTE
show vehicle's current route
Definition: GUIBaseVehicle.h:291
GUIBaseVehicle::myVehicle
MSBaseVehicle & myVehicle
The vehicle to which all calls should be delegated.
Definition: GUIBaseVehicle.h:349
SVS_RAIL_CAR
render as a (city) rail without locomotive
Definition: SUMOVehicleClass.h:92
GUIBaseVehicle::drawAction_drawCarriageClass
virtual void drawAction_drawCarriageClass(const GUIVisualizationSettings &s, bool asImage) const =0
draws the given guiShape with distinct carriages/modules
MID_HIDE_ALLROUTES
Hide all vehicle's routes.
Definition: GUIAppEnum.h:430
MSDevice_BTreceiver.h
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:207
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdShowBestLanes
long onCmdShowBestLanes(FXObject *, FXSelector, void *)
Called if the vehicle's best lanes shall be shown.
Definition: GUIBaseVehicle.cpp:156
MSVehicle::getLane
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:560
SVS_PEDESTRIAN
render as a pedestrian
Definition: SUMOVehicleClass.h:54
Position::distanceTo2D
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:243
GUIVisualizationSettings::vehicleText
GUIVisualizationTextSettings vehicleText
Definition: GUIVisualizationSettings.h:523
GUIBaseVehicle::VO_SHOW_BEST_LANES
show vehicle's best lanes
Definition: GUIBaseVehicle.h:289
GUIBaseVehicle::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIBaseVehicle.cpp:324
GUIBaseVehicle::getPosition
virtual Position getPosition(const double offset=0) const =0
Return current position (x/y, cartesian)
GLIncludes.h
GUIBaseVehicle::VO_SHOW_FUTURE_ROUTE
show vehicle's current continued from the current position
Definition: GUIBaseVehicle.h:299
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
MID_SHOW_FUTUREROUTE
Show vehicle's future route.
Definition: GUIAppEnum.h:420
StringUtils.h
GUIBaseVehicle::getAngle
virtual double getAngle() const =0
Returns the vehicle's direction in radians.
MSBaseVehicle::getContainerDevice
const MSDevice_Transportable * getContainerDevice() const
Definition: MSBaseVehicle.h:497
FunctionBinding.h
GUISUMOAbstractView::removeAdditionalGLVisualisation
bool removeAdditionalGLVisualisation(GUIGlObject *const which)
Removes an object from the list of objects that show additional things.
Definition: GUISUMOAbstractView.cpp:1595
GUIBaseVehicle::getOptionalName
const std::string getOptionalName() const
Returns the value for generic parameter 'name' or ''.
Definition: GUIBaseVehicle.cpp:333
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
GUIMainWindow
Definition: GUIMainWindow.h:46
Position::y
double y() const
Returns the y-position.
Definition: Position.h:61
MSGlobals::gMesoNet
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:105
GUISUMOAbstractView::addAdditionalGLVisualisation
bool addAdditionalGLVisualisation(GUIGlObject *const which)
Adds an object to call its additional visualisation method.
Definition: GUISUMOAbstractView.cpp:1583
GUIVisualizationSettings::drawLaneChangePreference
bool drawLaneChangePreference
Information whether the lane change preference shall be drawn.
Definition: GUIVisualizationSettings.h:505
Boundary::getCenter
Position getCenter() const
Returns the center of the boundary.
Definition: Boundary.cpp:112
PositionVector::positionAtOffset2D
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
Definition: PositionVector.cpp:273
M_PI
#define M_PI
Definition: odrSpiral.cpp:40
GUIBaseVehicle::drawAction_drawPersonsAndContainers
virtual void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &s) const
Definition: GUIBaseVehicle.cpp:743
MSDevice_Transportable::size
int size() const
Return the number of passengers / containers.
Definition: MSDevice_Transportable.h:126
FXDEFMAP
FXDEFMAP(GUIBaseVehicle::GUIBaseVehiclePopupMenu) GUIBaseVehiclePopupMenuMap[]
GUIPerson::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:274
MSVehicleType::getLength
double getLength() const
Get vehicle's length [m].
Definition: MSVehicleType.h:109
GUIBaseVehicle::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIBaseVehicle.cpp:265
GUIVisualizationSettings::showBlinker
bool showBlinker
Information whether vehicle blinkers shall be drawn.
Definition: GUIVisualizationSettings.h:502
MSVehicleType::wasSet
bool wasSet(int what) const
Returns whether the given parameter was set.
Definition: MSVehicleType.h:82
GUIPerson
Definition: GUIPerson.h:53
GUIEdge.h
GUIGlObject::buildShowTypeParamsPopupEntry
void buildShowTypeParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the type parameter window.
Definition: GUIGlObject.cpp:257
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:248
SVS_EMERGENCY
render as an emergency vehicle
Definition: SUMOVehicleClass.h:102
MSBaseVehicle
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:51
GUIBaseVehicle::drawLinkItem
static void drawLinkItem(const Position &pos, SUMOTime arrivalTime, SUMOTime leaveTime, double exagerate)
Definition: GUIBaseVehicle.cpp:577
SVS_SHIP
render as a arbitrary ship
Definition: SUMOVehicleClass.h:100
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:216
GUIGlObject::buildPositionCopyEntry
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
Definition: GUIGlObject.cpp:266
MEVehicle.h
MSDevice_Vehroutes.h
GUIBaseVehicle.h
GUIBaseVehicle::drawAction_drawVehicleBrakeLight
virtual void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=false) const
Definition: GUIBaseVehicle.h:130
MID_SHOW_FOES
select foes of a vehicle
Definition: GUIAppEnum.h:436
StringTokenizer::getVector
std::vector< std::string > getVector()
return vector of strings
Definition: StringTokenizer.cpp:191
config.h
SVS_FIREBRIGADE
render as a fire brigade
Definition: SUMOVehicleClass.h:104
GUIBaseVehicle::myPopup
GUIGLObjectPopupMenu * myPopup
current popup (to clean up in destructor). GUIBaseVehicle is not responsible for removal
Definition: GUIBaseVehicle.h:354
MSVehicleType::getContainerCapacity
int getContainerCapacity() const
Get this vehicle type's container capacity.
Definition: MSVehicleType.h:292
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdHideCurrentRoute
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the vehicle shall be hidden.
Definition: GUIBaseVehicle.cpp:131
GeomHelper.h
GUIBaseVehicle::drawGLAdditional
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Definition: GUIBaseVehicle.cpp:541
StringTokenizer.h
MID_HIDE_CURRENTROUTE
Hide vehicle's current route.
Definition: GUIAppEnum.h:418
SVS_ANT
render as a giant ant
Definition: SUMOVehicleClass.h:98
Boundary::grow
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
GUIBaseVehicle::drawAction_drawVehicleBlinker
virtual void drawAction_drawVehicleBlinker(double) const
Definition: GUIBaseVehicle.h:129
MELoop.h
RGBColor::GREEN
static const RGBColor GREEN
Definition: RGBColor.h:190
GUIVisualizationSettings::drawBrakeGap
bool drawBrakeGap
Information whether the brake gap shall be drawn.
Definition: GUIVisualizationSettings.h:511
MSLane.h
GUIBaseVehicle::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIBaseVehicle.cpp:535
GUIBaseVehicle::myRoutes
MSDevice_Vehroutes * myRoutes
Definition: GUIBaseVehicle.h:351
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
VTYPEPARS_COLOR_SET
const int VTYPEPARS_COLOR_SET
Definition: SUMOVTypeParameter.h:51
GUISUMOAbstractView::destroyPopup
void destroyPopup()
destoys the popup
Definition: GUISUMOAbstractView.cpp:884
GUINet
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:82
RGBColor::changedBrightness
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:153
MSBaseVehicle::getDevice
MSVehicleDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
Definition: MSBaseVehicle.cpp:564
MSBaseVehicle::myContainerDevice
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
Definition: MSBaseVehicle.h:548
MSBaseVehicle::myMoveReminders
MoveReminderCont myMoveReminders
Currently relevant move reminders.
Definition: MSBaseVehicle.h:538
MID_HIDE_BEST_LANES
Hide vehicle's best lanes.
Definition: GUIAppEnum.h:426
MSVehicleControl.h
GUIPropertyScheme::getColor
const T getColor(const double value) const
Definition: GUIPropertyScheme.h:110
GUIBaseVehicle::GUIBaseVehiclePopupMenu::~GUIBaseVehiclePopupMenu
~GUIBaseVehiclePopupMenu()
Destructor.
Definition: GUIBaseVehicle.cpp:101
MSNet::getVehicleControl
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:336
GUISUMOAbstractView::getTrackedID
virtual GUIGlID getTrackedID() const
get tracked id
Definition: GUISUMOAbstractView.cpp:1435
GUIBaseVehicleHelper::drawAction_drawVehicleAsTrianglePlus
static void drawAction_drawVehicleAsTrianglePlus(const double width, const double length)
draw vehicle as a triangle
Definition: GUIBaseVehicleHelper.cpp:126
GUIPropertySchemeStorage::getActive
int getActive() const
Definition: GUIPropertySchemeStorage.h:75
GUIVisualizationSettings::showBTRange
bool showBTRange
Information whether the communication range shall be drawn.
Definition: GUIVisualizationSettings.h:514
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdShowCurrentRoute
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the vehicle shall be shown.
Definition: GUIBaseVehicle.cpp:122
GUIVisualizationSizeSettings::getExaggeration
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
Definition: GUIVisualizationSettings.cpp:212
GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdShowFoes
long onCmdShowFoes(FXObject *, FXSelector, void *)
Called when show a vehicles foes.
Definition: GUIBaseVehicle.cpp:206
MID_REMOVE_OBJECT
remove a vehice or person
Definition: GUIAppEnum.h:440
SUMOTrafficObject::getSpeed
virtual double getSpeed() const =0
Returns the vehicle's current speed.
MSAbstractLaneChangeModel.h
RGBColor::WHITE
static const RGBColor WHITE
Definition: RGBColor.h:196
Boundary::ymax
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:136
GUIPropertySchemeStorage< GUIColorScheme >
SVS_RAIL
render as a rail
Definition: SUMOVehicleClass.h:90
GUIBaseVehicle::addActiveAddVisualisation
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIBaseVehicle.cpp:701
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79