SUMO - Simulation of Urban MObility
GUIBaseVehicle.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // A MSVehicle extended by some values for usage within the gui
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <cmath>
34 #include <vector>
35 #include <string>
38 #include <utils/geom/GeomHelper.h>
46 #include <utils/gui/div/GLHelper.h>
49 #include <microsim/MSVehicle.h>
50 #include <microsim/MSLane.h>
58 #include <gui/GUIGlobals.h>
59 #include "GUIBaseVehicle.h"
60 #include "GUIPerson.h"
61 #include "GUIContainer.h"
62 #include "GUINet.h"
63 #include "GUIEdge.h"
64 #include "GUILane.h"
65 
66 #ifdef CHECK_MEMORY_LEAKS
67 #include <foreign/nvwa/debug_new.h>
68 #endif // CHECK_MEMORY_LEAKS
69 
70 
71 // ===========================================================================
72 // FOX callback mapping
73 // ===========================================================================
74 FXDEFMAP(GUIBaseVehicle::GUIBaseVehiclePopupMenu) GUIBaseVehiclePopupMenuMap[] = {
86 };
87 
88 // Object implementation
89 FXIMPLEMENT(GUIBaseVehicle::GUIBaseVehiclePopupMenu, GUIGLObjectPopupMenu, GUIBaseVehiclePopupMenuMap, ARRAYNUMBER(GUIBaseVehiclePopupMenuMap))
90 
91 
92 
93 // ===========================================================================
94 // data definitions
95 // ===========================================================================
96 /* -------------------------------------------------------------------------
97  * drawed shapes
98  * ----------------------------------------------------------------------- */
99 double vehiclePoly_PassengerCarBody[] = { .5, 0, 0, 0, 0, .3, 0.08, .44, 0.25, .5, 0.95, .5, 1., .4, 1., -.4, 0.95, -.5, 0.25, -.5, 0.08, -.44, 0, -.3, 0, 0, -10000 };
100 double vehiclePoly_PassengerCarBodyFront[] = { 0.1, 0, 0.025, 0, 0.025, 0.25, 0.27, 0.4, 0.27, -.4, 0.025, -0.25, 0.025, 0, -10000 };
101 double vehiclePoly_PassengerFrontGlass[] = { 0.35, 0, 0.3, 0, 0.3, 0.4, 0.43, 0.3, 0.43, -0.3, 0.3, -0.4, 0.3, 0, -10000 };
102 double vehiclePoly_PassengerSedanRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.77, -.47, 0.67, -.37, 0.45, -.37, 0.34, -.47, -10000 };
103 double vehiclePoly_PassengerSedanLeftGlass[] = { 0.36, .43, 0.34, .47, 0.77, .47, 0.67, .37, 0.45, .37, 0.34, .47, -10000 };
104 double vehiclePoly_PassengerSedanBackGlass[] = { 0.80, 0, 0.70, 0, 0.70, 0.3, 0.83, 0.4, 0.83, -.4, 0.70, -.3, 0.70, 0, -10000 };
105 double vehiclePoly_PassengerHatchbackRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.94, -.47, 0.80, -.37, 0.45, -.37, 0.34, -.47, -10000 };
106 double vehiclePoly_PassengerHatchbackLeftGlass[] = { 0.36, .43, 0.34, .47, 0.94, .47, 0.80, .37, 0.45, .37, 0.34, .47, -10000 };
107 double vehiclePoly_PassengerHatchbackBackGlass[] = { 0.92, 0, 0.80, 0, 0.80, 0.3, 0.95, 0.4, 0.95, -.4, 0.80, -.3, 0.80, 0, -10000 };
108 double vehiclePoly_PassengerWagonRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.94, -.47, 0.87, -.37, 0.45, -.37, 0.34, -.47, -10000 };
109 double vehiclePoly_PassengerWagonLeftGlass[] = { 0.36, .43, 0.34, .47, 0.94, .47, 0.87, .37, 0.45, .37, 0.34, .47, -10000 };
110 double vehiclePoly_PassengerWagonBackGlass[] = { 0.92, 0, 0.90, 0, 0.90, 0.3, 0.95, 0.4, 0.95, -.4, 0.90, -.3, 0.90, 0, -10000 };
111 
112 double vehiclePoly_PassengerVanBody[] = { .5, 0, 0, 0, 0, .4, 0.1, .5, 0.97, .5, 1., .47, 1., -.47, 0.97, -.5, 0.1, -.5, 0, -.4, 0, 0, -10000 };
113 double vehiclePoly_PassengerVanBodyFront[] = { 0.1, 0, 0.025, 0, 0.025, 0.25, 0.13, 0.4, 0.13, -.4, 0.025, -0.25, 0.025, 0, -10000 };
114 double vehiclePoly_PassengerVanFrontGlass[] = { 0.21, 0, 0.16, 0, 0.16, 0.4, 0.29, 0.3, 0.29, -0.3, 0.16, -0.4, 0.16, 0, -10000 };
115 double vehiclePoly_PassengerVanRightGlass[] = { 0.36, -.43, 0.20, -.47, 0.98, -.47, 0.91, -.37, 0.31, -.37, 0.20, -.47, -10000 };
116 double vehiclePoly_PassengerVanLeftGlass[] = { 0.36, .43, 0.20, .47, 0.98, .47, 0.91, .37, 0.31, .37, 0.20, .47, -10000 };
117 double vehiclePoly_PassengerVanBackGlass[] = { 0.95, 0, 0.94, 0, 0.94, 0.3, 0.98, 0.4, 0.98, -.4, 0.94, -.3, 0.94, 0, -10000 };
118 
119 double vehiclePoly_DeliveryMediumRightGlass[] = { 0.21, -.43, 0.20, -.47, 0.38, -.47, 0.38, -.37, 0.31, -.37, 0.20, -.47, -10000 };
120 double vehiclePoly_DeliveryMediumLeftGlass[] = { 0.21, .43, 0.20, .47, 0.38, .47, 0.38, .37, 0.31, .37, 0.20, .47, -10000 };
121 
122 double vehiclePoly_TransportBody[] = { .5, 0, 0, 0, 0, .45, 0.05, .5, 2.25, .5, 2.25, -.5, 0.05, -.5, 0, -.45, 0, 0, -10000 };
123 double vehiclePoly_TransportFrontGlass[] = { 0.1, 0, 0.05, 0, 0.05, 0.45, 0.25, 0.4, 0.25, -.4, 0.05, -0.45, 0.05, 0, -10000 };
124 double vehiclePoly_TransportRightGlass[] = { 0.36, -.47, 0.10, -.48, 1.25, -.48, 1.25, -.4, 0.3, -.4, 0.10, -.48, -10000 };
125 double vehiclePoly_TransportLeftGlass[] = { 0.36, .47, 0.10, .48, 1.25, .48, 1.25, .4, 0.3, .4, 0.10, .48, -10000 };
126 
127 double vehiclePoly_EVehicleBody[] = { .5, 0, 0, 0, 0, .3, 0.08, .44, 0.25, .5, 0.75, .5, .92, .44, 1, .3, 1, -.3, .92, -.44, .75, -.5, .25, -.5, 0.08, -.44, 0, -.3, 0, 0, -1000 };
128 double vehiclePoly_EVehicleFrontGlass[] = { .5, 0, 0.05, .05, 0.05, .25, 0.13, .39, 0.3, .45, 0.70, .45, .87, .39, .95, .25, .95, -.25, .87, -.39, .70, -.45, .3, -.45, 0.13, -.39, 0.05, -.25, 0.05, 0.05, -1000 };
129 //double vehiclePoly_EVehicleFrontGlass[] = { 0.35,0, 0.1,0, 0.1,0.4, 0.43,0.3, 0.43,-0.3, 0.1,-0.4, 0.1,0, -10000 };
130 double vehiclePoly_EVehicleBackGlass[] = { 0.65, 0, 0.9, 0, 0.9, 0.4, 0.57, 0.3, 0.57, -0.3, 0.9, -0.4, 0.9, 0, -10000 };
131 
132 double vehiclePoly_Ship[] = { 0.25, 0, 0, 0, 0.1, 0.25, 0.2, 0.45, 0.25, 0.5, 0.95, 0.5, 1.0, 0.45, 1.0, -0.45, 0.95, -0.5, 0.25, -0.5, 0.2, -0.45, 0.1, -0.25, 0, 0, -10000 };
133 double vehiclePoly_ShipDeck[] = { 0.5, 0, 0.25, 0.4, 0.95, 0.4, 0.95, -0.4, 0.25, -0.4, 0.25, 0.4, -10000 };
134 double vehiclePoly_ShipSuperStructure[] = { 0.8, 0, 0.5, 0.3, 0.85, 0.3, 0.85, -0.3, 0.5, -0.3, 0.5, 0.3, -10000 };
135 
136 double vehiclePoly_Cyclist[] = { 0.5, 0, 0.25, 0.45, 0.25, 0.5, 0.8, 0.15, 0.8, -0.15, 0.25, -0.5, 0.25, -0.45, -10000 };
137 
138 double vehiclePoly_EmergencySign[] = { .2, .5, -.2, .5, -.2, -.5, .2, -.5, -10000 };
139 double vehiclePoly_Emergency[] = { .1, .1, -.1, .1, -.1, -.1, .1, -.1, -10000 };
140 double vehiclePoly_Emergency2[] = { .04, .3, -.04, .3, -.04, -.3, .04, -.3, -10000 };
141 
142 // ===========================================================================
143 // method definitions
144 // ===========================================================================
145 /* -------------------------------------------------------------------------
146  * GUIBaseVehicle::GUIBaseVehiclePopupMenu - methods
147  * ----------------------------------------------------------------------- */
149  GUIMainWindow& app, GUISUMOAbstractView& parent,
150  GUIGlObject& o, std::map<GUISUMOAbstractView*, int>& additionalVisualizations)
151  : GUIGLObjectPopupMenu(app, parent, o), myVehiclesAdditionalVisualizations(additionalVisualizations) {
152 }
153 
154 
156 
157 
158 long
160  assert(myObject->getType() == GLO_VEHICLE);
161  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_ALL_ROUTES)) {
163  }
164  return 1;
165 }
166 
167 long
169  assert(myObject->getType() == GLO_VEHICLE);
171  return 1;
172 }
173 
174 
175 long
177  assert(myObject->getType() == GLO_VEHICLE);
178  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_ROUTE)) {
180  }
181  return 1;
182 }
183 
184 long
186  assert(myObject->getType() == GLO_VEHICLE);
188  return 1;
189 }
190 
191 
192 long
194  assert(myObject->getType() == GLO_VEHICLE);
195  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_BEST_LANES)) {
197  }
198  return 1;
199 }
200 
201 long
203  assert(myObject->getType() == GLO_VEHICLE);
205  return 1;
206 }
207 
208 
209 long
211  assert(myObject->getType() == GLO_VEHICLE);
212  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_TRACKED)) {
213  myParent->startTrack(static_cast<GUIBaseVehicle*>(myObject)->getGlID());
215  }
216  return 1;
217 }
218 
219 long
221  assert(myObject->getType() == GLO_VEHICLE);
223  myParent->stopTrack();
224  return 1;
225 }
226 
227 
228 long
230  assert(myObject->getType() == GLO_VEHICLE);
231  if (!static_cast<GUIBaseVehicle*>(myObject)->hasActiveAddVisualisation(myParent, VO_SHOW_LFLINKITEMS)) {
233  }
234  return 1;
235 }
236 
237 long
239  assert(myObject->getType() == GLO_VEHICLE);
241  return 1;
242 }
243 
244 long
246  assert(myObject->getType() == GLO_VEHICLE);
247  static_cast<GUIBaseVehicle*>(myObject)->selectBlockingFoes();
248  myParent->update();
249  return 1;
250 }
251 
252 
253 /* -------------------------------------------------------------------------
254  * GUIBaseVehicle - methods
255  * ----------------------------------------------------------------------- */
256 
258  GUIGlObject(GLO_VEHICLE, vehicle.getID()),
259  myVehicle(vehicle),
260  myVType(vehicle.getVehicleType()) {
261  // as it is possible to show all vehicle routes, we have to store them... (bug [ 2519761 ])
263  myVehicle.myMoveReminders.push_back(std::make_pair(myRoutes, 0.));
264  mySeatPositions.push_back(Position(0, 0)); // ensure length 1
265 }
266 
267 
269  myLock.lock();
270  for (std::map<GUISUMOAbstractView*, int>::iterator i = myAdditionalVisualizations.begin(); i != myAdditionalVisualizations.end(); ++i) {
271  while (i->first->removeAdditionalGLVisualisation(this));
272  }
273  myLock.unlock();
275  delete myRoutes;
276 }
277 
278 
281  GUISUMOAbstractView& parent) {
283  buildPopupHeader(ret, app);
287  //
289  new FXMenuCommand(ret, "Hide Current Route", 0, ret, MID_HIDE_CURRENTROUTE);
290  } else {
291  new FXMenuCommand(ret, "Show Current Route", 0, ret, MID_SHOW_CURRENTROUTE);
292  }
294  new FXMenuCommand(ret, "Hide All Routes", 0, ret, MID_HIDE_ALLROUTES);
295  } else {
296  new FXMenuCommand(ret, "Show All Routes", 0, ret, MID_SHOW_ALLROUTES);
297  }
299  new FXMenuCommand(ret, "Hide Best Lanes", 0, ret, MID_HIDE_BEST_LANES);
300  } else {
301  new FXMenuCommand(ret, "Show Best Lanes", 0, ret, MID_SHOW_BEST_LANES);
302  }
304  new FXMenuCommand(ret, "Hide Link Items", 0, ret, MID_HIDE_LFLINKITEMS);
305  } else {
306  new FXMenuCommand(ret, "Show Link Items", 0, ret, MID_SHOW_LFLINKITEMS);
307  }
308  new FXMenuSeparator(ret);
309  if (parent.getTrackedID() != getGlID()) {
310  new FXMenuCommand(ret, "Start Tracking", 0, ret, MID_START_TRACK);
311  } else {
312  new FXMenuCommand(ret, "Stop Tracking", 0, ret, MID_STOP_TRACK);
313  }
314  new FXMenuCommand(ret, "Select Foes", 0, ret, MID_SHOW_FOES);
315 
316  new FXMenuSeparator(ret);
317  //
318  buildShowParamsPopupEntry(ret, false);
320  buildPositionCopyEntry(ret, false);
321  return ret;
322 }
323 
324 
325 Boundary
327  Boundary b;
328  b.add(getPosition());
330  return b;
331 }
332 
333 
334 void
336  glPushMatrix();
337  glScaled(myVType.getWidth(), myVType.getLength(), 1.);
338  glBegin(GL_TRIANGLE_STRIP);
339  glVertex2d(0., 0.);
340  glVertex2d(-.5, .15);
341  glVertex2d(.5, .15);
342  glVertex2d(-.5, 1.);
343  glVertex2d(.5, 1.);
344  glEnd();
345  glPopMatrix();
346 }
347 
348 
349 void
351  const SUMOReal length = myVType.getLength();
352  if (length >= 8.) {
354  return;
355  }
356  glPushMatrix();
357  glScaled(myVType.getWidth(), length, 1.);
358  glBegin(GL_TRIANGLES);
359  glVertex2d(0., 0.);
360  glVertex2d(-.5, 1.);
361  glVertex2d(.5, 1.);
362  glEnd();
363  glPopMatrix();
364 }
365 
366 
367 void
368 GUIBaseVehicle::drawPoly(double* poses, SUMOReal offset) {
369  glPushMatrix();
370  glTranslated(0, 0, offset * .1);
371  glPolygonOffset(0, (GLfloat) - offset);
372  glBegin(GL_TRIANGLE_FAN);
373  int i = 0;
374  while (poses[i] > -999) {
375  glVertex2d(poses[i], poses[i + 1]);
376  i = i + 2;
377  }
378  glEnd();
379  glPopMatrix();
380 }
381 
382 
383 void
385  RGBColor current = GLHelper::getColor();
386  RGBColor lighter = current.changedBrightness(51);
387  RGBColor darker = current.changedBrightness(-51);
388 
389  const SUMOReal length = myVType.getLength();
390  const SUMOReal width = myVType.getWidth();
391  glPushMatrix();
392  glRotated(90, 0, 0, 1);
393  glScaled(length, width, 1.);
395 
396  // draw main body
397  switch (shape) {
398  case SVS_UNKNOWN:
400  GLHelper::setColor(lighter);
401  drawPoly(vehiclePoly_PassengerCarBodyFront, 4.5);
402  glColor3d(0, 0, 0);
403  drawPoly(vehiclePoly_PassengerFrontGlass, 4.5);
404  break;
405  case SVS_PEDESTRIAN:
406  glTranslated(0, 0, .045);
408  glTranslated(0, 0, -.045);
409  glScaled(.7, 2, 1);
410  glTranslated(0, 0, .04);
411  GLHelper::setColor(lighter);
413  glTranslated(0, 0, -.04);
414  break;
415  case SVS_BICYCLE:
416  case SVS_MOPED:
417  case SVS_MOTORCYCLE: {
418  RGBColor darker = current.changedBrightness(-50);
419  // body
420  drawPoly(vehiclePoly_Cyclist, 4);
421  // head
422  glPushMatrix();
423  glTranslated(0.4, 0, .5);
424  glScaled(0.1, 0.2, 1);
425  GLHelper::setColor(darker);
427  glPopMatrix();
428  // bike frame
430  glPushMatrix();
431  glTranslated(0.5, 0, .3);
432  glScaled(0.5, 0.05, 1);
434  glPopMatrix();
435  // handle bar
436  glPushMatrix();
437  glTranslated(0.25, 0, .3);
438  glScaled(0.02, 0.5, 1);
440  glPopMatrix();
441  }
442  break;
443  case SVS_PASSENGER:
444  case SVS_PASSENGER_SEDAN:
446  case SVS_PASSENGER_WAGON:
448  GLHelper::setColor(lighter);
449  drawPoly(vehiclePoly_PassengerCarBodyFront, 4.5);
450  glColor3d(0, 0, 0);
451  drawPoly(vehiclePoly_PassengerFrontGlass, 4.5);
452  break;
453  case SVS_PASSENGER_VAN:
454  drawPoly(vehiclePoly_PassengerVanBody, 4);
455  GLHelper::setColor(lighter);
456  drawPoly(vehiclePoly_PassengerVanBodyFront, 4.5);
457  glColor3d(0, 0, 0);
458  drawPoly(vehiclePoly_PassengerVanFrontGlass, 4.5);
459  drawPoly(vehiclePoly_PassengerVanRightGlass, 4.5);
460  drawPoly(vehiclePoly_PassengerVanLeftGlass, 4.5);
461  drawPoly(vehiclePoly_PassengerVanBackGlass, 4.5);
462  break;
463  case SVS_DELIVERY:
464  drawPoly(vehiclePoly_PassengerVanBody, 4);
465  GLHelper::setColor(lighter);
466  drawPoly(vehiclePoly_PassengerVanBodyFront, 4.5);
467  glColor3d(0, 0, 0);
468  drawPoly(vehiclePoly_PassengerVanFrontGlass, 4.5);
469  drawPoly(vehiclePoly_DeliveryMediumRightGlass, 4.5);
470  drawPoly(vehiclePoly_DeliveryMediumLeftGlass, 4.5);
471  break;
472  case SVS_TRUCK:
474  case SVS_TRUCK_1TRAILER:
475  glScaled(1. / (length), 1, 1.);
476  drawPoly(vehiclePoly_TransportBody, 4);
477  glColor3d(0, 0, 0);
478  drawPoly(vehiclePoly_TransportFrontGlass, 4.5);
479  drawPoly(vehiclePoly_TransportRightGlass, 4.5);
480  drawPoly(vehiclePoly_TransportLeftGlass, 4.5);
481  break;
482  case SVS_BUS:
483  case SVS_BUS_COACH:
484  case SVS_BUS_TROLLEY: {
485  SUMOReal ml = length;
486  glScaled(1. / (length), 1, 1.);
487  glTranslated(0, 0, .04);
488  glBegin(GL_TRIANGLE_FAN);
489  glVertex2d(ml / 2., 0);
490  glVertex2d(0, 0);
491  glVertex2d(0, -.45);
492  glVertex2d(0 + .05, -.5);
493  glVertex2d(ml - .05, -.5);
494  glVertex2d(ml, -.45);
495  glVertex2d(ml, .45);
496  glVertex2d(ml - .05, .5);
497  glVertex2d(0 + .05, .5);
498  glVertex2d(0, .45);
499  glVertex2d(0, 0);
500  glEnd();
501  glTranslated(0, 0, -.04);
502 
503  glTranslated(0, 0, .045);
504  glColor3d(0, 0, 0);
505  glBegin(GL_QUADS);
506  glVertex2d(0 + .05, .48);
507  glVertex2d(0 + .05, -.48);
508  glVertex2d(0 + .15, -.48);
509  glVertex2d(0 + .15, .48);
510 
511  glVertex2d(ml - .1, .45);
512  glVertex2d(ml - .1, -.45);
513  glVertex2d(ml - .05, -.45);
514  glVertex2d(ml - .05, .45);
515 
516  glVertex2d(0 + .20, .49);
517  glVertex2d(0 + .20, .45);
518  glVertex2d(ml - .20, .45);
519  glVertex2d(ml - .20, .49);
520 
521  glVertex2d(0 + .20, -.49);
522  glVertex2d(0 + .20, -.45);
523  glVertex2d(ml - .20, -.45);
524  glVertex2d(ml - .20, -.49);
525 
526  glEnd();
527  glTranslated(0, 0, -.045);
528  }
529  break;
530  case SVS_BUS_FLEXIBLE:
531  case SVS_RAIL:
532  case SVS_RAIL_CAR:
533  case SVS_RAIL_CARGO:
534  drawAction_drawCarriageClass(s, shape, false);
535  break;
536  case SVS_E_VEHICLE:
537  drawPoly(vehiclePoly_EVehicleBody, 4);
538  glColor3d(0, 0, 0);
539  drawPoly(vehiclePoly_EVehicleFrontGlass, 4.5);
540  glTranslated(0, 0, .048);
541  GLHelper::setColor(current);
542  glBegin(GL_QUADS);
543  glVertex2d(.3, .5);
544  glVertex2d(.35, .5);
545  glVertex2d(.35, -.5);
546  glVertex2d(.3, -.5);
547 
548  glVertex2d(.3, -.05);
549  glVertex2d(.7, -.05);
550  glVertex2d(.7, .05);
551  glVertex2d(.3, .05);
552 
553  glVertex2d(.7, .5);
554  glVertex2d(.65, .5);
555  glVertex2d(.65, -.5);
556  glVertex2d(.7, -.5);
557  glEnd();
558  glTranslated(0, 0, -.048);
559  //drawPoly(vehiclePoly_EVehicleBackGlass, 4.5);
560  break;
561  case SVS_ANT:
562  glPushMatrix();
563  // ant is stretched via vehicle length
564  GLHelper::setColor(darker);
565  // draw left side
566  GLHelper::drawBoxLine(Position(-0.2, -.10), 350, 0.5, .02);
567  GLHelper::drawBoxLine(Position(-0.3, -.50), 240, 0.4, .03);
568  GLHelper::drawBoxLine(Position(0.3, -.10), 340, 0.8, .03);
569  GLHelper::drawBoxLine(Position(0.05, -.80), 290, 0.6, .04);
570  GLHelper::drawBoxLine(Position(0.4, -.10), 20, 0.8, .03);
571  GLHelper::drawBoxLine(Position(0.65, -.80), 75, 0.6, .04);
572  GLHelper::drawBoxLine(Position(0.5, -.10), 55, 0.8, .04);
573  GLHelper::drawBoxLine(Position(1.1, -.55), 90, 0.6, .04);
574  // draw right side
575  GLHelper::drawBoxLine(Position(-0.2, .10), 190, 0.5, .02);
576  GLHelper::drawBoxLine(Position(-0.3, .50), 300, 0.4, .03);
577  GLHelper::drawBoxLine(Position(0.3, .10), 200, 0.8, .03);
578  GLHelper::drawBoxLine(Position(0.05, .80), 250, 0.6, .04);
579  GLHelper::drawBoxLine(Position(0.4, .10), 160, 0.8, .03);
580  GLHelper::drawBoxLine(Position(0.65, .80), 105, 0.6, .04);
581  GLHelper::drawBoxLine(Position(0.5, .10), 125, 0.8, .04);
582  GLHelper::drawBoxLine(Position(1.1, .55), 90, 0.6, .04);
583  // draw body
584  GLHelper::setColor(current);
585  glTranslated(0, 0, 0.1);
587  glTranslated(.4, 0, 0);
589  glTranslated(.4, 0, 0);
591  glPopMatrix();
592  break;
593  case SVS_SHIP: {
594  RGBColor darker = current.changedBrightness(-30);
595  RGBColor darker2 = current.changedBrightness(-70);
596  drawPoly(vehiclePoly_Ship, 4);
597  GLHelper::setColor(darker);
598  drawPoly(vehiclePoly_ShipDeck, 5);
599  GLHelper::setColor(darker2);
600  drawPoly(vehiclePoly_ShipSuperStructure, 6);
601  break;
602  }
603  case SVS_EMERGENCY: // similar to delivery
604  glColor3d(1, 1, 1);
605  drawPoly(vehiclePoly_PassengerVanBody, 4);
606  glColor3d(1, 0, 0);
607  drawPoly(vehiclePoly_PassengerVanBodyFront, 4.5);
608  glColor3d(0, 0, 0);
609  drawPoly(vehiclePoly_PassengerVanFrontGlass, 4.5);
610  drawPoly(vehiclePoly_DeliveryMediumRightGlass, 4.5);
611  drawPoly(vehiclePoly_DeliveryMediumLeftGlass, 4.5);
612  // first aid sign
613  glTranslated(0.7, 0, 0);
614  glColor3d(.18, .55, .34);
615  drawPoly(vehiclePoly_EmergencySign, 4.5);
616  glColor3d(1, 1, 1);
617  drawPoly(vehiclePoly_Emergency, 5);
618  drawPoly(vehiclePoly_Emergency2, 5);
619  break;
620  default: // same as passenger
622  glColor3d(1, 1, 1);
623  drawPoly(vehiclePoly_PassengerCarBodyFront, 4.5);
624  glColor3d(0, 0, 0);
625  drawPoly(vehiclePoly_PassengerFrontGlass, 4.5);
626  break;
627  }
628 
629  // draw decorations
630  switch (shape) {
631  case SVS_PEDESTRIAN:
632  break;
633  case SVS_BICYCLE:
634  //glScaled(length, 1, 1.);
635  glBegin(GL_TRIANGLE_FAN);
636  glVertex2d(1 / 2., 0);
637  glVertex2d(0, 0);
638  glVertex2d(0, -.03);
639  glVertex2d(0 + .05, -.05);
640  glVertex2d(1 - .05, -.05);
641  glVertex2d(1, -.03);
642  glVertex2d(1, .03);
643  glVertex2d(1 - .05, .05);
644  glVertex2d(0 + .05, .05);
645  glVertex2d(0, .03);
646  glVertex2d(0, 0);
647  glEnd();
648  break;
649  case SVS_MOPED:
650  case SVS_MOTORCYCLE:
651  //glScaled(length, 1, 1.);
652  glBegin(GL_TRIANGLE_FAN);
653  glVertex2d(1 / 2., 0);
654  glVertex2d(0, 0);
655  glVertex2d(0, -.03);
656  glVertex2d(0 + .05, -.2);
657  glVertex2d(1 - .05, -.2);
658  glVertex2d(1, -.03);
659  glVertex2d(1, .03);
660  glVertex2d(1 - .05, .2);
661  glVertex2d(0 + .05, .2);
662  glVertex2d(0, .03);
663  glVertex2d(0, 0);
664  glEnd();
665  break;
666  case SVS_PASSENGER:
667  case SVS_PASSENGER_SEDAN:
668  drawPoly(vehiclePoly_PassengerSedanRightGlass, 4.5);
669  drawPoly(vehiclePoly_PassengerSedanLeftGlass, 4.5);
670  drawPoly(vehiclePoly_PassengerSedanBackGlass, 4.5);
671  break;
673  drawPoly(vehiclePoly_PassengerHatchbackRightGlass, 4.5);
674  drawPoly(vehiclePoly_PassengerHatchbackLeftGlass, 4.5);
675  drawPoly(vehiclePoly_PassengerHatchbackBackGlass, 4.5);
676  break;
677  case SVS_PASSENGER_WAGON:
678  drawPoly(vehiclePoly_PassengerWagonRightGlass, 4.5);
679  drawPoly(vehiclePoly_PassengerWagonLeftGlass, 4.5);
680  drawPoly(vehiclePoly_PassengerWagonBackGlass, 4.5);
681  break;
682  case SVS_PASSENGER_VAN:
683  case SVS_DELIVERY:
684  break;
685  case SVS_TRUCK:
686  GLHelper::setColor(current);
687  GLHelper::drawBoxLine(Position(2.3, 0), 90., length - 2.3, .5);
688  break;
690  GLHelper::setColor(current);
691  GLHelper::drawBoxLine(Position(2.8, 0), 90., length - 2.8, .5);
692  break;
693  case SVS_TRUCK_1TRAILER: {
694  GLHelper::setColor(current);
695  SUMOReal l = length - 2.3;
696  l = l / 2.;
697  GLHelper::drawBoxLine(Position(2.3, 0), 90., l, .5);
698  GLHelper::drawBoxLine(Position(2.3 + l + .5, 0), 90., l - .5, .5);
699  break;
700  }
701  case SVS_BUS_TROLLEY:
702  glPushMatrix();
703  glTranslated(0, 0, .1);
704  GLHelper::setColor(darker);
705  GLHelper::drawBoxLine(Position(3.8, 0), 90., 1, .3);
706  glTranslated(0, 0, .1);
707  glColor3d(0, 0, 0);
708  GLHelper::drawBoxLine(Position(4.3, .2), 90., 1, .06);
709  GLHelper::drawBoxLine(Position(4.3, -.2), 90., 1, .06);
710  GLHelper::drawBoxLine(Position(5.3, .2), 90., 3, .03);
711  GLHelper::drawBoxLine(Position(5.3, -.2), 90., 3, .03);
712  glPopMatrix();
713  break;
714  case SVS_BUS:
715  case SVS_BUS_COACH:
716  case SVS_BUS_FLEXIBLE:
717  case SVS_RAIL:
718  case SVS_RAIL_CAR:
719  case SVS_RAIL_CARGO:
720  case SVS_E_VEHICLE:
721  case SVS_ANT:
722  case SVS_SHIP:
723  case SVS_EMERGENCY:
724  break;
725  default: // same as passenger/sedan
726  drawPoly(vehiclePoly_PassengerSedanRightGlass, 4.5);
727  drawPoly(vehiclePoly_PassengerSedanLeftGlass, 4.5);
728  drawPoly(vehiclePoly_PassengerSedanBackGlass, 4.5);
729  break;
730  }
731  /*
732  glBegin(GL_TRIANGLE_FAN);
733  glVertex2d(.5,.5); // center - strip begin
734  glVertex2d(0, .5); // center, front
735  glVertex2d(0, .8); // ... clockwise ... (vehicle right side)
736  glVertex2d(0.08, .94);
737  glVertex2d(0.25, 1.);
738  glVertex2d(0.95, 1.);
739  glVertex2d(1., .9);
740  glVertex2d(1., .1); // (vehicle left side)
741  glVertex2d(0.95, 0.);
742  glVertex2d(0.25, 0.);
743  glVertex2d(0.08, .06);
744  glVertex2d(0, .2); //
745  glVertex2d(0, .5); // center, front (close)
746  glEnd();
747 
748  glPolygonOffset(0, -4.5);
749  glColor3d(1, 1, 1); // front
750  glBegin(GL_TRIANGLE_FAN);
751  glVertex2d(0.1,0.5);
752  glVertex2d(0.025,0.5);
753  glVertex2d(0.025,0.75);
754  glVertex2d(0.27,0.9);
755  glVertex2d(0.27,0.1);
756  glVertex2d(0.025,0.25);
757  glVertex2d(0.025,0.5);
758  glEnd();
759 
760  glColor3d(0, 0, 0); // front glass
761  glBegin(GL_TRIANGLE_FAN);
762  glVertex2d(0.35,0.5);
763  glVertex2d(0.3,0.5);
764  glVertex2d(0.3,0.9);
765  glVertex2d(0.43,0.8);
766  glVertex2d(0.43,0.2);
767  glVertex2d(0.3,0.1);
768  glVertex2d(0.3,0.5);
769  glEnd();
770 
771  glBegin(GL_TRIANGLE_FAN); // back glass
772  glVertex2d(0.92,0.5);
773  glVertex2d(0.90,0.5);
774  glVertex2d(0.90,0.8);
775  glVertex2d(0.95,0.9);
776  glVertex2d(0.95,0.1);
777  glVertex2d(0.90,0.2);
778  glVertex2d(0.90,0.5);
779  glEnd();
780 
781  glBegin(GL_TRIANGLE_FAN); // right glass
782  glVertex2d(0.36,0.07);
783  glVertex2d(0.34,0.03);
784  glVertex2d(0.94,0.03);
785  glVertex2d(0.87,0.13);
786  glVertex2d(0.45,0.13);
787  glVertex2d(0.34,0.03);
788  glEnd();
789 
790  glBegin(GL_TRIANGLE_FAN); // left glass
791  glVertex2d(0.36,1.-0.07);
792  glVertex2d(0.34,1.-0.03);
793  glVertex2d(0.94,1.-0.03);
794  glVertex2d(0.87,1.-0.13);
795  glVertex2d(0.45,1.-0.13);
796  glVertex2d(0.34,1.-0.03);
797  glEnd();
798  */
799 
800  glPopMatrix();
801 }
802 
803 
804 bool
806  const std::string& file = myVType.getImgFile();
807  if (file != "") {
808  int textureID = GUITexturesHelper::getTextureID(file);
809  if (textureID > 0) {
810  const SUMOReal exaggeration = s.vehicleSize.getExaggeration(s);
811  if (length < 0) {
812  length = myVType.getLength() * exaggeration;
813  }
814  const SUMOReal halfWidth = myVType.getWidth() / 2.0 * exaggeration;
815  GUITexturesHelper::drawTexturedBox(textureID, -halfWidth, 0, halfWidth, length);
816  return true;
817  }
818  }
819  return false;
820 }
821 
822 
823 void
824 GUIBaseVehicle::drawOnPos(const GUIVisualizationSettings& s, const Position& pos, const SUMOReal angle) const {
825  glPushName(getGlID());
826  glPushMatrix();
827  Position p1 = pos;
828  const SUMOReal degAngle = RAD2DEG(angle + PI / 2.);
829  // one seat in the center of the vehicle by default
830  if (myVehicle.getLane() != 0) {
832  } else {
833  mySeatPositions[0] = p1;
834  }
835  glTranslated(p1.x(), p1.y(), getType());
836  glRotated(degAngle, 0, 0, 1);
837  // set lane color
838  setColor(s);
839  // scale
840  const SUMOReal upscale = s.vehicleSize.getExaggeration(s);
841  glScaled(upscale, upscale, 1);
842  /*
843  MSLCM_DK2004 &m2 = static_cast<MSLCM_DK2004&>(veh->getLaneChangeModel());
844  if((m2.getState()&LCA_URGENT)!=0) {
845  glColor3d(1, .4, .4);
846  } else if((m2.getState()&LCA_SPEEDGAIN)!=0) {
847  glColor3d(.4, .4, 1);
848  } else {
849  glColor3d(.4, 1, .4);
850  }
851  */
852  // draw the vehicle
854  switch (s.vehicleQuality) {
855  case 0:
857  break;
858  case 1:
860  break;
861  case 2:
863  // draw flashing blue light for emergency vehicles
864  if (myVType.getGuiShape() == SVS_EMERGENCY) {
865  glTranslated(0, 0, .1);
867  }
868  break;
869  case 3:
870  default:
871  // draw as image but take special care for drawing trains
872  // fallback to simple shapes
876  };
877  }
878  break;
879  }
880  if (s.drawMinGap) {
881  const SUMOReal minGap = -myVType.getMinGap();
882  glColor3d(0., 1., 0.);
883  glBegin(GL_LINES);
884  glVertex2d(0., 0);
885  glVertex2d(0., minGap);
886  glVertex2d(-.5, minGap);
887  glVertex2d(.5, minGap);
888  glEnd();
889  }
891  if (dev != 0 && s.showBTRange) {
892  glColor3d(1., 0., 0.);
893  GLHelper::drawOutlineCircle(dev->getRange(), dev->getRange() - .2, 32);
894  }
895  // draw the blinker and brakelights if wished
896  if (s.showBlinker) {
897  glTranslated(0, 0, .1);
898  switch (myVType.getGuiShape()) {
899  case SVS_PEDESTRIAN:
900  case SVS_BICYCLE:
901  case SVS_ANT:
902  case SVS_SHIP:
903  case SVS_RAIL:
904  case SVS_RAIL_CARGO:
905  // only SVS_RAIL_CAR has blinkers and brake lights
906  break;
907  case SVS_MOTORCYCLE:
908  case SVS_MOPED:
911  break;
912  default:
915  break;
916  }
917  }
918  // draw the wish to change the lane
919  if (s.drawLaneChangePreference) {
920  /*
921  if(gSelected.isSelected(GLO_VEHICLE, veh->getGlID())) {
922  MSLCM_DK2004 &m = static_cast<MSLCM_DK2004&>(veh->getLaneChangeModel());
923  glColor3d(.5, .5, 1);
924  glBegin(GL_LINES);
925  glVertex2f(0, 0);
926  glVertex2f(m.getChangeProbability(), .5);
927  glEnd();
928 
929  glColor3d(1, 0, 0);
930  glBegin(GL_LINES);
931  glVertex2f(0.1, 0);
932  glVertex2f(0.1, m.myMaxJam1);
933  glEnd();
934 
935  glColor3d(0, 1, 0);
936  glBegin(GL_LINES);
937  glVertex2f(-0.1, 0);
938  glVertex2f(-0.1, m.myTDist);
939  glEnd();
940  }
941  */
942  }
943  // draw best lanes
944  /*
945  if (true) {
946  const MSLane &l = veh->getLane();
947  SUMOReal r1 = veh->allowedContinuationsLength(&l, 0);
948  SUMOReal r2 = l.getLeftLane()!=0 ? veh->allowedContinuationsLength(l.getLeftLane(), 0) : 0;
949  SUMOReal r3 = l.getRightLane()!=0 ? veh->allowedContinuationsLength(l.getRightLane(), 0) : 0;
950  SUMOReal mmax = MAX3(r1, r2, r3);
951  glBegin(GL_LINES);
952  glVertex2f(0, 0);
953  glVertex2f(0, r1/mmax/2.);
954  glEnd();
955  glBegin(GL_LINES);
956  glVertex2f(.4, 0);
957  glVertex2f(.4, r2/mmax/2.);
958  glEnd();
959  glBegin(GL_LINES);
960  glVertex2f(-.4, 0);
961  glVertex2f(-.4, r3/mmax/2.);
962  glEnd();
963  }
964  */
965  glTranslated(0, MIN2(myVType.getLength() / 2, SUMOReal(5)), -getType()); // drawing name at GLO_MAX fails unless translating z
966  glRotated(-degAngle, 0, 0, 1);
967  glScaled(1 / upscale, 1 / upscale, 1);
968  drawName(Position(0, 0), s.scale,
970  if (s.vehicleName.show && myVehicle.getParameter().line != "") {
971  glTranslated(0, 0.6 * s.vehicleName.size / s.scale, 0);
974  }
975  glPopMatrix();
976  glPopName();
978 }
979 
980 
981 void
983  drawOnPos(s, getPosition(), getAngle());
984 }
985 
986 
987 void
989  if (!myVehicle.isOnRoad()) {
990  drawGL(s);
991  }
992  glPushName(getGlID());
993  glPushMatrix();
994  glTranslated(0, 0, getType() - .1); // don't draw on top of other cars
996  drawBestLanes();
997  }
999  drawRoute(s, 0, 0.25);
1000  }
1002  if (myVehicle.getNumberReroutes() > 0) {
1003  const int noReroutePlus1 = myVehicle.getNumberReroutes() + 1;
1004  for (int i = noReroutePlus1 - 1; i >= 0; i--) {
1005  SUMOReal darken = SUMOReal(0.4) / SUMOReal(noReroutePlus1) * SUMOReal(i);
1006  drawRoute(s, i, darken);
1007  }
1008  } else {
1009  drawRoute(s, 0, 0.25);
1010  }
1011  }
1014  }
1015  glPopMatrix();
1016  glPopName();
1017 }
1018 
1019 
1020 void
1021 GUIBaseVehicle::drawLinkItem(const Position& pos, SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal exagerate) {
1022  glTranslated(pos.x(), pos.y(), -.1);
1024  std::string times = toString(STEPS2TIME(arrivalTime)) + "/" + toString(STEPS2TIME(leaveTime));
1025  GLHelper::drawText(times.c_str(), Position(), .1, 1.6 * exagerate, RGBColor::GREEN, 0);
1026  glTranslated(-pos.x(), -pos.y(), .1);
1027 }
1028 
1029 
1030 void
1032  const GUIColorer& c = s.vehicleColorer;
1033  if (!setFunctionalColor(c.getActive(), &myVehicle)) {
1035  }
1036 }
1037 
1038 
1039 bool
1040 GUIBaseVehicle::setFunctionalColor(int activeScheme, const MSBaseVehicle* veh) {
1041  switch (activeScheme) {
1042  case 0: {
1043  if (veh->getParameter().wasSet(VEHPARS_COLOR_SET)) {
1045  return true;
1046  }
1049  return true;
1050  }
1051  if (&(veh->getRoute().getColor()) != &RGBColor::DEFAULT_COLOR) {
1053  return true;
1054  }
1055  return false;
1056  }
1057  case 2: {
1058  if (veh->getParameter().wasSet(VEHPARS_COLOR_SET)) {
1060  return true;
1061  }
1062  return false;
1063  }
1064  case 3: {
1067  return true;
1068  }
1069  return false;
1070  }
1071  case 4: {
1072  if (&(veh->getRoute().getColor()) != &RGBColor::DEFAULT_COLOR) {
1074  return true;
1075  }
1076  return false;
1077  }
1078  case 5: {
1079  Position p = veh->getRoute().getEdges()[0]->getLanes()[0]->getShape()[0];
1080  const Boundary& b = ((GUINet*) MSNet::getInstance())->getBoundary();
1081  Position center = b.getCenter();
1082  SUMOReal hue = 180. + atan2(center.x() - p.x(), center.y() - p.y()) * 180. / PI;
1083  SUMOReal sat = p.distanceTo(center) / center.distanceTo(Position(b.xmin(), b.ymin()));
1084  GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
1085  return true;
1086  }
1087  case 6: {
1088  Position p = veh->getRoute().getEdges().back()->getLanes()[0]->getShape()[-1];
1089  const Boundary& b = ((GUINet*) MSNet::getInstance())->getBoundary();
1090  Position center = b.getCenter();
1091  SUMOReal hue = 180. + atan2(center.x() - p.x(), center.y() - p.y()) * 180. / PI;
1092  SUMOReal sat = p.distanceTo(center) / center.distanceTo(Position(b.xmin(), b.ymin()));
1093  GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
1094  return true;
1095  }
1096  case 7: {
1097  Position pb = veh->getRoute().getEdges()[0]->getLanes()[0]->getShape()[0];
1098  Position pe = veh->getRoute().getEdges().back()->getLanes()[0]->getShape()[-1];
1099  const Boundary& b = ((GUINet*) MSNet::getInstance())->getBoundary();
1100  SUMOReal hue = 180. + atan2(pb.x() - pe.x(), pb.y() - pe.y()) * 180. / PI;
1101  Position minp(b.xmin(), b.ymin());
1102  Position maxp(b.xmax(), b.ymax());
1103  SUMOReal sat = pb.distanceTo(pe) / minp.distanceTo(maxp);
1104  GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
1105  return true;
1106  }
1107  case 27: { // color randomly (by pointer)
1108  const SUMOReal hue = (long)veh % 360; // [0-360]
1109  const SUMOReal sat = (((long)veh / 360) % 67) / 100.0 + 0.33; // [0.33-1]
1110  GLHelper::setColor(RGBColor::fromHSV(hue, sat, 1.));
1111  return true;
1112  }
1113  }
1114  return false;
1115 }
1116 
1117 
1118 // ------------ Additional visualisations
1119 bool
1121  return myAdditionalVisualizations.find(parent) != myAdditionalVisualizations.end() && (myAdditionalVisualizations.find(parent)->second & which) != 0;
1122 }
1123 
1124 
1125 void
1127  if (myAdditionalVisualizations.find(parent) == myAdditionalVisualizations.end()) {
1128  myAdditionalVisualizations[parent] = 0;
1129  }
1130  myAdditionalVisualizations[parent] |= which;
1131  parent->addAdditionalGLVisualisation(this);
1132 }
1133 
1134 
1135 void
1137  myAdditionalVisualizations[parent] &= ~which;
1138  parent->removeAdditionalGLVisualisation(this);
1139 }
1140 
1141 
1142 void
1143 GUIBaseVehicle::drawRoute(const GUIVisualizationSettings& s, int routeNo, SUMOReal darken) const {
1144  setColor(s);
1145  GLdouble colors[4];
1146  glGetDoublev(GL_CURRENT_COLOR, colors);
1147  colors[0] -= darken;
1148  if (colors[0] < 0) {
1149  colors[0] = 0;
1150  }
1151  colors[1] -= darken;
1152  if (colors[1] < 0) {
1153  colors[1] = 0;
1154  }
1155  colors[2] -= darken;
1156  if (colors[2] < 0) {
1157  colors[2] = 0;
1158  }
1159  colors[3] -= darken;
1160  if (colors[3] < 0) {
1161  colors[3] = 0;
1162  }
1163  glColor3dv(colors);
1164  const SUMOReal exaggeration = s.vehicleSize.getExaggeration(s);
1165  if (routeNo == 0) {
1166  drawRouteHelper(myVehicle.getRoute(), exaggeration);
1167  return;
1168  }
1169  --routeNo; // only prior routes are stored
1170  const MSRoute* route = myRoutes->getRoute(routeNo);
1171  if (route != 0) {
1172  drawRouteHelper(*route, exaggeration);
1173  }
1174 }
1175 
1176 
1177 const Position&
1178 GUIBaseVehicle::getSeatPosition(int personIndex) const {
1180  return mySeatPositions[MIN2(personIndex, (int)mySeatPositions.size() - 1)];
1181 }
1182 
1183 
1184 /****************************************************************************/
void drawName(const Position &pos, const SUMOReal scale, const GUIVisualizationTextSettings &settings, const SUMOReal angle=0) const
draw name of item
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the current shall not be tracked any longer.
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the vehicle shall be hidden.
double vehiclePoly_PassengerVanBody[]
SUMOVehicleShape getGuiShape() const
Get this vehicle type&#39;s shape.
render as a rail
double vehiclePoly_Emergency2[]
RGBColor color
The vehicle&#39;s color.
long long int SUMOTime
Definition: SUMOTime.h:43
virtual void drawAction_drawVehicleBlueLight() const
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:150
double vehiclePoly_PassengerVanRightGlass[]
MoveReminderCont myMoveReminders
Currently relevant move reminders.
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:128
static RGBColor fromHSV(SUMOReal h, SUMOReal s, SUMOReal v)
Converts the given hsv-triplet to rgb.
Definition: RGBColor.cpp:294
bool showBlinker
Information whether vehicle blinkers shall be drawn.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
double vehiclePoly_PassengerWagonLeftGlass[]
a vehicles
GUIVisualizationTextSettings personName
Show all vehicle&#39;s routes.
Definition: GUIAppEnum.h:267
double vehiclePoly_EVehicleFrontGlass[]
double vehiclePoly_PassengerSedanRightGlass[]
SUMOReal distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:221
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
render as a motorcycle
double vehiclePoly_PassengerVanFrontGlass[]
void drawAction_drawVehicleAsBoxPlus() const
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the vehicle shall be tracked.
double vehiclePoly_TransportLeftGlass[]
bool showBTRange
Information whether the communication range shall be drawn.
Stores the information about how to visualize structures.
render as a transport vehicle
render as a flexible city bus
virtual SUMOReal getPositionOnLane() const =0
Get the vehicle&#39;s position along the lane.
Start to track a vehicle.
Definition: GUIAppEnum.h:271
static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth, int steps=8)
Draws an unfilled circle around (0,0)
Definition: GLHelper.cpp:375
const SUMOVehicleParameter & getParameter() const
Returns the vehicle&#39;s parameter (including departure definition)
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
bool drawLaneChangePreference
Information whether the lane change preference shall be drawn.
show vehicle&#39;s best lanes
MSDevice_Vehroutes * myRoutes
GUIVisualizationTextSettings vehicleName
SUMOReal getLength() const
Get vehicle&#39;s length [m].
double vehiclePoly_EVehicleBody[]
std::string getImgFile() const
Get this vehicle type&#39;s raster model file name.
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
SUMOReal ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:142
virtual void drawAction_drawLinkItems(const GUIVisualizationSettings &) const
double vehiclePoly_PassengerFrontGlass[]
virtual void drawAction_drawVehicleBrakeLight(SUMOReal length, bool onlyOne=false) const
const RGBColor & getColor() const
Returns the color.
Definition: MSRoute.cpp:349
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:159
render as a delivery vehicle
static void drawBoxLine(const Position &beg, SUMOReal rot, SUMOReal visLength, SUMOReal width, SUMOReal offset=0)
Draws a thick line.
Definition: GLHelper.cpp:130
double vehiclePoly_Emergency[]
virtual Position getPosition(const SUMOReal offset=0) const =0
Return current position (x/y, cartesian)
const MSRoute & getRoute() const
Returns the current route.
Definition: MSBaseVehicle.h:97
double vehiclePoly_PassengerHatchbackLeftGlass[]
double vehiclePoly_PassengerVanBackGlass[]
virtual SUMOReal getAngle() const =0
Returns the vehicle&#39;s direction in radians.
GUISUMOAbstractView * myParent
The parent window.
render as a sedan passenger vehicle ("Stufenheck")
bool addAdditionalGLVisualisation(const GUIGlObject *const which)
Adds an object to call its additional visualisation method.
#define RAD2DEG(x)
Definition: GeomHelper.h:46
SUMOReal ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:148
static void drawText(const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &col=RGBColor::BLACK, const SUMOReal angle=0)
draw Text with given parameters
Definition: GLHelper.cpp:460
double vehiclePoly_PassengerSedanBackGlass[]
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:56
double vehiclePoly_PassengerVanLeftGlass[]
virtual void stopTrack()
stop track
virtual void selectBlockingFoes() const =0
adds the blocking foes to the current selection
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
void buildShowTypeParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the type parameter window.
int getNumberReroutes() const
Returns the number of new routes this vehicle got.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
SUMOReal xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:130
bool removeAdditionalGLVisualisation(const GUIGlObject *const which)
Removes an object from the list of objects that show additional things.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
SUMOReal scale
information about a lane&#39;s width (temporary, used for a single view)
long onCmdHideAllRoutes(FXObject *, FXSelector, void *)
Called if all routes of the vehicle shall be hidden.
bool wasSet(int what) const
Returns whether the given parameter was set.
Definition: MSVehicleType.h:91
PositionVector mySeatPositions
positions of seats in the vehicle (updated at every drawing step)
GUIColorer vehicleColorer
The vehicle colorer.
void drawRoute(const GUIVisualizationSettings &s, int routeNo, SUMOReal darken) const
Chooses the route to draw and draws it, darkening it as given.
double vehiclePoly_ShipDeck[]
static void drawFilledCircle(SUMOReal width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:344
static void drawPoly(double *poses, SUMOReal offset)
SUMOReal getWidth() const
Get the width which vehicles of this class shall have when being drawn.
double vehiclePoly_PassengerCarBody[]
virtual GUIGlID getTrackedID() const
get tracked id
virtual void startTrack(int)
star track
static const RGBColor GREEN
Definition: RGBColor.h:190
virtual void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &) const
static const RGBColor GREY
Definition: RGBColor.h:198
#define PI
Definition: polyfonts.c:61
virtual void drawAction_drawVehicleBlinker(SUMOReal) const
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
long onCmdShowBestLanes(FXObject *, FXSelector, void *)
Called if the vehicle&#39;s best lanes shall be shown.
long onCmdShowAllRoutes(FXObject *, FXSelector, void *)
Called if all routes of the vehicle shall be shown.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:443
render as a hatchback passenger vehicle ("Fliessheck")
render as a bus
double vehiclePoly_PassengerWagonRightGlass[]
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
double vehiclePoly_ShipSuperStructure[]
bool drawMinGap
Information whether the minimum gap shall be drawn.
static const RGBColor DEFAULT_COLOR
The default color (for vehicle types and vehicles)
Definition: RGBColor.h:200
not defined
render as a bicycle
Hide all vehicle&#39;s routes.
Definition: GUIAppEnum.h:269
long onCmdHideBestLanes(FXObject *, FXSelector, void *)
Called if the vehicle&#39;s best lanes shall be hidden.
double vehiclePoly_Ship[]
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
void drawAction_drawVehicleAsTrianglePlus() const
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
render as a (city) rail without locomotive
T MIN2(T a, T b)
Definition: StdDefs.h:69
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
static MSDevice_Vehroutes * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice *> &into, int maxRoutes=INT_MAX)
Build devices for the given vehicle, if needed.
A MSVehicle extended by some values for usage within the gui.
render as a van
double vehiclePoly_PassengerHatchbackRightGlass[]
const T getColor(const SUMOReal value) const
SUMOReal myCarriageLength
Variable to set with the length of the last drawn carriage or the vehicle length. ...
render as a passenger vehicle
double vehiclePoly_TransportBody[]
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
const int VEHPARS_COLOR_SET
std::string line
The vehicle&#39;s line (mainly for public transport)
const RGBColor & getColor() const
Returns this type&#39;s color.
long onCmdHideLFLinkItems(FXObject *, FXSelector, void *)
Called if all routes of the vehicle shall be hidden.
Show vehicle&#39;s best lanes.
Definition: GUIAppEnum.h:263
static void removeObject(GUIGlObject &o)
Removes all instances that pass values from the object with the given id.
double vehiclePoly_PassengerSedanLeftGlass[]
render as a cargo train
void unlock()
release mutex lock
Definition: MFXMutex.cpp:96
void drawAction_drawVehicleAsPoly(const GUIVisualizationSettings &s) const
double vehiclePoly_PassengerHatchbackBackGlass[]
GUIBaseVehicle(MSBaseVehicle &vehicle)
render as a giant ant
render as a pedestrian
render as a moped
double vehiclePoly_PassengerCarBodyFront[]
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
Definition: Boundary.cpp:232
Stop to track a vehicle.
Definition: GUIAppEnum.h:273
GUIBaseVehiclePopupMenu()
default constructor needed by FOX
~GUIBaseVehicle()
destructor
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
MSDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
render as a arbitrary ship
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:89
SUMOReal xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:136
bool drawAction_drawVehicleAsImage(const GUIVisualizationSettings &s, SUMOReal length=-1) const
Hide vehicle&#39;s current route.
Definition: GUIAppEnum.h:261
virtual bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
void add(SUMOReal x, SUMOReal y, SUMOReal z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:90
const Position & getSeatPosition(int personIndex) const
returns the seat position for the person with the given index
double vehiclePoly_EVehicleBackGlass[]
static void drawLinkItem(const Position &pos, SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal exagerate)
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the vehicle shall be shown.
double vehiclePoly_EmergencySign[]
virtual bool drawAction_drawCarriageClass(const GUIVisualizationSettings &s, SUMOVehicleShape guiShape, bool asImage) const =0
draws the given guiShape if it has distinc carriages/modules and eturns true if so ...
virtual void drawRouteHelper(const MSRoute &r, SUMOReal exaggeration) const =0
Draws the route.
The popup menu of a globject.
show all vehicle&#39;s routes
void drawOnPos(const GUIVisualizationSettings &s, const Position &pos, const SUMOReal angle) const
Draws the object on the specified position with the specified angle.
long onCmdShowFoes(FXObject *, FXSelector, void *)
Called when show a vehicles foes.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
void lock()
lock mutex
Definition: MFXMutex.cpp:86
Show vehicle&#39;s current route.
Definition: GUIAppEnum.h:259
double vehiclePoly_TransportFrontGlass[]
double vehiclePoly_PassengerWagonBackGlass[]
bool wasSet(int what) const
Returns whether the given parameter was set.
render as an emergency vehicle
GUIGlID getGlID() const
Returns the numerical id of the object.
Position getCenter() const
Returns the center of the boundary.
Definition: Boundary.cpp:124
SUMOReal getMinGap() const
Get the free space in front of vehicles of this class.
render as a (futuristic) e-vehicle
double vehiclePoly_DeliveryMediumRightGlass[]
#define SUMOReal
Definition: config.h:213
GUIVisualizationSizeSettings vehicleSize
SUMOReal getExaggeration(const GUIVisualizationSettings &s, SUMOReal factor=20) const
return the drawing size including exaggeration and constantSize values
virtual void drawBestLanes() const
Draws the vehicle&#39;s best lanes.
empty max
const MSRoute * getRoute(int index) const
Called on route retrieval.
int vehicleQuality
The quality of vehicle drawing.
static SUMOReal getRange()
Returns the configured range.
double vehiclePoly_TransportRightGlass[]
MSBaseVehicle & myVehicle
The vehicle to which all calls should be delegated.
virtual SUMOReal getColorValue(int activeScheme) const =0
gets the color value according to the current scheme index
FXDEFMAP(GUIBaseVehicle::GUIBaseVehiclePopupMenu) GUIBaseVehiclePopupMenuMap[]
Hide vehicle&#39;s best lanes.
Definition: GUIAppEnum.h:265
GUIGlObject * myObject
The object that belongs to this popup-menu.
render as a transport vehicle with one trailer
render as a wagon passenger vehicle ("Combi")
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
select foes of a vehicle
Definition: GUIAppEnum.h:275
static bool setFunctionalColor(int activeScheme, const MSBaseVehicle *veh)
sets the color according to the current scheme index and some vehicle function
double vehiclePoly_Cyclist[]
const MSVehicleType & myVType
A shortcut to myVehicle.myType.
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
render as a coach
std::vector< MSDevice * > myDevices
The devices this vehicle has.
show vehicle&#39;s current route
const int VTYPEPARS_COLOR_SET
render as a semi-trailer transport vehicle ("Sattelschlepper")
static void drawTexturedBox(int which, SUMOReal size)
Draws a named texture as a box with the given size.
long onCmdShowLFLinkItems(FXObject *, FXSelector, void *)
Called if all routes of the vehicle shall be shown.
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
double vehiclePoly_PassengerVanBodyFront[]
double vehiclePoly_DeliveryMediumLeftGlass[]
const Position geometryPositionAtOffset(SUMOReal offset, SUMOReal lateralOffset=0) const
Definition: MSLane.h:444
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
render as a trolley bus
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:449