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