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