Eclipse SUMO - Simulation of Urban MObility
GUIBaseVehicleHelper.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // Functions used in GUIBaseVehicleHelper and GNEVehicle
19 /****************************************************************************/
20 #include <config.h>
22 
27 #include "GLHelper.h"
28 #include "GUIBaseVehicleHelper.h"
29 
30 
31 // ===========================================================================
32 // data definitions
33 // ===========================================================================
34 /* -------------------------------------------------------------------------
35  * drawed shapes
36  * ----------------------------------------------------------------------- */
37 static const 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 };
38 static const 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 };
39 static const 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 };
40 static const double vehiclePoly_PassengerSedanRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.77, -.47, 0.67, -.37, 0.45, -.37, 0.34, -.47, -10000 };
41 static const double vehiclePoly_PassengerSedanLeftGlass[] = { 0.36, .43, 0.34, .47, 0.77, .47, 0.67, .37, 0.45, .37, 0.34, .47, -10000 };
42 static const 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 };
43 static const double vehiclePoly_PassengerHatchbackRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.94, -.47, 0.80, -.37, 0.45, -.37, 0.34, -.47, -10000 };
44 static const double vehiclePoly_PassengerHatchbackLeftGlass[] = { 0.36, .43, 0.34, .47, 0.94, .47, 0.80, .37, 0.45, .37, 0.34, .47, -10000 };
45 static const 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 };
46 static const double vehiclePoly_PassengerWagonRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.94, -.47, 0.87, -.37, 0.45, -.37, 0.34, -.47, -10000 };
47 static const double vehiclePoly_PassengerWagonLeftGlass[] = { 0.36, .43, 0.34, .47, 0.94, .47, 0.87, .37, 0.45, .37, 0.34, .47, -10000 };
48 static const 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 };
49 
50 static const 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 };
51 static const 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 };
52 static const 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 };
53 static const double vehiclePoly_PassengerVanRightGlass[] = { 0.36, -.43, 0.20, -.47, 0.98, -.47, 0.91, -.37, 0.31, -.37, 0.20, -.47, -10000 };
54 static const double vehiclePoly_PassengerVanLeftGlass[] = { 0.36, .43, 0.20, .47, 0.98, .47, 0.91, .37, 0.31, .37, 0.20, .47, -10000 };
55 static const 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 };
56 
57 static const double vehiclePoly_DeliveryMediumRightGlass[] = { 0.21, -.43, 0.20, -.47, 0.38, -.47, 0.38, -.37, 0.31, -.37, 0.20, -.47, -10000 };
58 static const double vehiclePoly_DeliveryMediumLeftGlass[] = { 0.21, .43, 0.20, .47, 0.38, .47, 0.38, .37, 0.31, .37, 0.20, .47, -10000 };
59 
60 static const 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 };
61 static const 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 };
62 static const double vehiclePoly_TransportRightGlass[] = { 0.36, -.47, 0.10, -.48, 1.25, -.48, 1.25, -.4, 0.3, -.4, 0.10, -.48, -10000 };
63 static const double vehiclePoly_TransportLeftGlass[] = { 0.36, .47, 0.10, .48, 1.25, .48, 1.25, .4, 0.3, .4, 0.10, .48, -10000 };
64 
65 static const 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 };
66 static const 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 };
67 //static const 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 };
68 //static const 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 };
69 
70 static const 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 };
71 static const 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 };
72 static const 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 };
73 
74 static const 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 };
75 
76 static const double vehiclePoly_EmergencySign[] = { .2, .5, -.2, .5, -.2, -.5, .2, -.5, -10000 };
77 static const double vehiclePoly_Emergency[] = { .1, .1, -.1, .1, -.1, -.1, .1, -.1, -10000 };
78 static const double vehiclePoly_Emergency2[] = { .04, .3, -.04, .3, -.04, -.3, .04, -.3, -10000 };
79 
80 static const double vehiclePoly_EmergencyLadder[] = { -.5, .3, .5, .3, .5, .2, -.5, .2, -10000 };
81 static const double vehiclePoly_EmergencyLadder2[] = { -.5, -.3, .5, -.3, .5, -.2, -.5, -.2, -10000 };
82 static const double vehiclePoly_EmergencyLadder3[] = { -.45, .3, -.4, .3, -.4, -.3, -.45, -.3, -10000 };
83 static const double vehiclePoly_EmergencyLadder4[] = { .45, .3, .4, .3, .4, -.3, .45, -.3, -10000 };
84 static const double vehiclePoly_EmergencyLadder5[] = { .05, .3, .0, .3, .0, -.3, .05, -.3, -10000 };
85 static const double vehiclePoly_EmergencyLadder6[] = { -.25, .3, -.2, .3, -.2, -.3, -.25, -.3, -10000 };
86 static const double vehiclePoly_EmergencyLadder7[] = { .25, .3, .2, .3, .2, -.3, .25, -.3, -10000 };
87 
88 static const double vehiclePoly_scooterBase[] = { -.17, .3, -.2, .3, -.2, -.3, -.17, -.3, -10000 };
89 static const double vehiclePoly_scooterBase2[] = { .27, .03, .28, .03, .28, -.03, .27, -.03, -10000 };
90 static const double vehiclePoly_scooterBase3[] = { -.5, .6, .5, .6, .5, -.6, -.5, -.6, -10000 };
91 
92 //static const double vehiclePoly_Rickshaw[] = { 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 };
93 
94 // ===========================================================================
95 // method definitions
96 // ===========================================================================
97 
98 void
99 GUIBaseVehicleHelper::drawPoly(const double* poses, const double offset) {
101  glTranslated(0, 0, offset * .1);
102  glPolygonOffset(0, (GLfloat) - offset);
103  glBegin(GL_TRIANGLE_FAN);
104  int i = 0;
105  while (poses[i] > -999) {
106  glVertex2d(poses[i], poses[i + 1]);
107  i = i + 2;
108  }
109  glEnd();
111 }
112 
113 void
114 GUIBaseVehicleHelper::drawAction_drawVehicleAsBoxPlus(const double width, const double length) {
116  glScaled(width, length, 1.);
117  glBegin(GL_TRIANGLE_STRIP);
118  glVertex2d(0., 0.);
119  glVertex2d(-.5, .15);
120  glVertex2d(.5, .15);
121  glVertex2d(-.5, 1.);
122  glVertex2d(.5, 1.);
123  glEnd();
125 }
126 
127 
128 void
129 GUIBaseVehicleHelper::drawAction_drawVehicleAsTrianglePlus(const double width, const double length) {
130  if (length >= 8.) {
131  drawAction_drawVehicleAsBoxPlus(width, length);
132  return;
133  }
135  glScaled(width, length, 1.);
136  glBegin(GL_TRIANGLES);
137  glVertex2d(0., 0.);
138  glVertex2d(-.5, 1.);
139  glVertex2d(.5, 1.);
140  glEnd();
142 }
143 
144 
145 void
146 GUIBaseVehicleHelper::drawAction_drawVehicleAsCircle(const double width, const double length, double detail) {
147  const double maxDim = MAX2(MIN2(4 * width, length), width);
148  const int steps = MIN2(MAX2(16, int(detail / 5)), 64);
149  GLHelper::drawFilledCircle(maxDim / 5, steps);
150 }
151 
152 void
153 GUIBaseVehicleHelper::drawAction_drawVehicleAsPoly(const GUIVisualizationSettings& s, const SUMOVehicleShape shape, const double width, const double length,
154  int carriageIndex) {
155  UNUSED_PARAMETER(s);
156  RGBColor current = GLHelper::getColor();
157  RGBColor lighter = current.changedBrightness(51);
158  RGBColor darker = current.changedBrightness(-51);
160  glRotated(90, 0, 0, 1);
161  glScaled(length, width, 1.);
162 
163  // draw main body
164  switch (shape) {
167  GLHelper::setColor(lighter);
169  glColor3d(0, 0, 0);
171  break;
173  glTranslated(0, 0, .045);
175  glTranslated(0, 0, -.045);
176  glScaled(.7, 2, 1);
177  glTranslated(0, 0, .04);
178  GLHelper::setColor(lighter);
180  glTranslated(0, 0, -.04);
181  break;
185  darker = current.changedBrightness(-50);
186  // body
188  // head
190  glTranslated(0.4, 0, .5);
191  glScaled(0.1, 0.2, 1);
192  GLHelper::setColor(darker);
195  // bike frame
198  glTranslated(0.5, 0, .3);
199  glScaled(0.5, 0.05, 1);
202  // handle bar
204  glTranslated(0.25, 0, .3);
205  glScaled(0.02, 0.5, 1);
208  }
209  break;
215  GLHelper::setColor(lighter);
217  glColor3d(0, 0, 0);
219  break;
222  GLHelper::setColor(lighter);
224  glColor3d(0, 0, 0);
229  break;
232  GLHelper::setColor(lighter);
234  glColor3d(0, 0, 0);
238  break;
242  if (carriageIndex < 1) {
243  glScaled(1. / (length), 1, 1.);
245  glColor3d(0, 0, 0);
249  }
250  break;
254  double ml = length;
255  glScaled(1. / (length), 1, 1.);
256  glTranslated(0, 0, .04);
257  glBegin(GL_TRIANGLE_FAN);
258  glVertex2d(ml / 2., 0);
259  glVertex2d(0, 0);
260  glVertex2d(0, -.45);
261  glVertex2d(0 + .05, -.5);
262  glVertex2d(ml - .05, -.5);
263  glVertex2d(ml, -.45);
264  glVertex2d(ml, .45);
265  glVertex2d(ml - .05, .5);
266  glVertex2d(0 + .05, .5);
267  glVertex2d(0, .45);
268  glVertex2d(0, 0);
269  glEnd();
270  glTranslated(0, 0, -.04);
271 
272  glTranslated(0, 0, .045);
273  glColor3d(0, 0, 0);
274  glBegin(GL_QUADS);
275  glVertex2d(0 + .05, .48);
276  glVertex2d(0 + .05, -.48);
277  glVertex2d(0 + .15, -.48);
278  glVertex2d(0 + .15, .48);
279 
280  glVertex2d(ml - .1, .45);
281  glVertex2d(ml - .1, -.45);
282  glVertex2d(ml - .05, -.45);
283  glVertex2d(ml - .05, .45);
284 
285  glVertex2d(0 + .20, .49);
286  glVertex2d(0 + .20, .45);
287  glVertex2d(ml - .20, .45);
288  glVertex2d(ml - .20, .49);
289 
290  glVertex2d(0 + .20, -.49);
291  glVertex2d(0 + .20, -.45);
292  glVertex2d(ml - .20, -.45);
293  glVertex2d(ml - .20, -.49);
294 
295  glEnd();
296  glTranslated(0, 0, -.045);
297  }
298  break;
305  glColor3d(0, 0, 0);
307  glTranslated(0, 0, .048);
308  GLHelper::setColor(current);
309  glBegin(GL_QUADS);
310  glVertex2d(.3, .5);
311  glVertex2d(.35, .5);
312  glVertex2d(.35, -.5);
313  glVertex2d(.3, -.5);
314 
315  glVertex2d(.3, -.05);
316  glVertex2d(.7, -.05);
317  glVertex2d(.7, .05);
318  glVertex2d(.3, .05);
319 
320  glVertex2d(.7, .5);
321  glVertex2d(.65, .5);
322  glVertex2d(.65, -.5);
323  glVertex2d(.7, -.5);
324  glEnd();
325  glTranslated(0, 0, -.048);
326  //drawPoly(vehiclePoly_EVehicleBackGlass, 4.5);
327  break;
330  // ant is stretched via vehicle length
331  GLHelper::setColor(darker);
332  // draw left side
333  GLHelper::drawBoxLine(Position(-0.2, -.10), 350, 0.5, .02);
334  GLHelper::drawBoxLine(Position(-0.3, -.50), 240, 0.4, .03);
335  GLHelper::drawBoxLine(Position(0.3, -.10), 340, 0.8, .03);
336  GLHelper::drawBoxLine(Position(0.05, -.80), 290, 0.6, .04);
337  GLHelper::drawBoxLine(Position(0.4, -.10), 20, 0.8, .03);
338  GLHelper::drawBoxLine(Position(0.65, -.80), 75, 0.6, .04);
339  GLHelper::drawBoxLine(Position(0.5, -.10), 55, 0.8, .04);
340  GLHelper::drawBoxLine(Position(1.1, -.55), 90, 0.6, .04);
341  // draw right side
342  GLHelper::drawBoxLine(Position(-0.2, .10), 190, 0.5, .02);
343  GLHelper::drawBoxLine(Position(-0.3, .50), 300, 0.4, .03);
344  GLHelper::drawBoxLine(Position(0.3, .10), 200, 0.8, .03);
345  GLHelper::drawBoxLine(Position(0.05, .80), 250, 0.6, .04);
346  GLHelper::drawBoxLine(Position(0.4, .10), 160, 0.8, .03);
347  GLHelper::drawBoxLine(Position(0.65, .80), 105, 0.6, .04);
348  GLHelper::drawBoxLine(Position(0.5, .10), 125, 0.8, .04);
349  GLHelper::drawBoxLine(Position(1.1, .55), 90, 0.6, .04);
350  // draw body
351  GLHelper::setColor(current);
352  glTranslated(0, 0, 0.1);
354  glTranslated(.4, 0, 0);
356  glTranslated(.4, 0, 0);
359  break;
360  case SUMOVehicleShape::SHIP: {
366  break;
367  }
368  case SUMOVehicleShape::EMERGENCY: // similar to delivery
370  GLHelper::setColor(darker);
372  glColor3d(0, 0, 0);
376  // first aid sign
377  glTranslated(0.7, 0, 0);
378  glColor3d(.18, .55, .34);
380  glColor3d(1, 1, 1);
383  break;
384  case SUMOVehicleShape::FIREBRIGADE: // similar to delivery in red orange
386  GLHelper::setColor(lighter);
388  glColor3d(0, 0, 0);
392  // draw ladder
393  glTranslated(0.7, 0, 0);
394  glColor3d(1, .5, 0);
396  glColor3d(.5, .5, .5);
404  break;
405  case SUMOVehicleShape::POLICE: // similar to passenger grey with blue
407  GLHelper::setColor(lighter);
409  glColor3d(0, 0, 0);
411  // first aid sign
412  glTranslated(0.7, 0, 0);
413  glColor3d(.5, .5, .5);
415  glColor3d(0, 0, 1);
418  break;
419  case SUMOVehicleShape::RICKSHAW: // Rickshaw
421  // wheels
422  GLHelper::setColor(darker);
424  glTranslated(.5, .5, -0.1);
427  //other wheel
429  glTranslated(.5, -.5, -0.1);
432  break;
434  RGBColor darker2 = current.changedBrightness(-25);
436  // front small oval
437  GLHelper::setColor(darker);
438  glTranslated(-0.20, 0, 0.15);
439  glScaled(0.04, 0.06, 0.7);
442  // handlebar
444  glTranslated(0.0, 0, 0.1);
445  glColor3d(0.3, 0.3, 0.3);
448  // front oval
450  GLHelper::setColor(darker2);
451  glTranslated(-0.21, 0, 0.1);
452  glScaled(0.07, 0.08, 0.9);
455  // tail rectangle
457  glColor3d(0.3, 0.3, 0.3);
459  // tail oval
460  GLHelper::setColor(darker2);
461  glTranslated(0.21, 0, 0.1);
462  glScaled(0.07, 0.08, 0.9);
465  // base oval
467  GLHelper::setColor(lighter);
468  glScaled(0.28, 0.14, 0.9);
470  // center rectangle
471  glTranslated(0, 0, 0.1);
472  GLHelper::setColor(current);
475  break;
476  }
477  default: // same as passenger
479  glColor3d(1, 1, 1);
481  glColor3d(0, 0, 0);
483  break;
484  }
485 
486  // draw decorations
487  switch (shape) {
489  break;
491  //glScaled(length, 1, 1.);
492  glBegin(GL_TRIANGLE_FAN);
493  glVertex2d(1 / 2., 0);
494  glVertex2d(0, 0);
495  glVertex2d(0, -.03);
496  glVertex2d(0 + .05, -.05);
497  glVertex2d(1 - .05, -.05);
498  glVertex2d(1, -.03);
499  glVertex2d(1, .03);
500  glVertex2d(1 - .05, .05);
501  glVertex2d(0 + .05, .05);
502  glVertex2d(0, .03);
503  glVertex2d(0, 0);
504  glEnd();
505  break;
508  //glScaled(length, 1, 1.);
509  glBegin(GL_TRIANGLE_FAN);
510  glVertex2d(1 / 2., 0);
511  glVertex2d(0, 0);
512  glVertex2d(0, -.03);
513  glVertex2d(0 + .05, -.2);
514  glVertex2d(1 - .05, -.2);
515  glVertex2d(1, -.03);
516  glVertex2d(1, .03);
517  glVertex2d(1 - .05, .2);
518  glVertex2d(0 + .05, .2);
519  glVertex2d(0, .03);
520  glVertex2d(0, 0);
521  glEnd();
522  break;
528  break;
533  break;
538  break;
541  break;
543  GLHelper::setColor(current);
544  GLHelper::drawBoxLine(Position(2.3, 0), 90., length - 2.3, .5);
545  break;
547  if (carriageIndex < 0) {
548  GLHelper::setColor(current);
549  GLHelper::drawBoxLine(Position(2.8, 0), 90., length - 2.8, .5);
550  }
551  break;
553  GLHelper::setColor(current);
554  double l = length - 2.3;
555  if (carriageIndex != 0) {
556  l = l / 2.;
557  GLHelper::drawBoxLine(Position(2.3, 0), 90., l, .5);
558  GLHelper::drawBoxLine(Position(2.3 + l + .5, 0), 90., l - .5, .5);
559  } else {
560  GLHelper::drawBoxLine(Position(2.3, 0), 90., l, .5);
561  }
562  break;
563  }
566  glTranslated(0, 0, .1);
567  GLHelper::setColor(darker);
568  GLHelper::drawBoxLine(Position(3.8, 0), 90., 1, .3);
569  glTranslated(0, 0, .1);
570  glColor3d(0, 0, 0);
571  GLHelper::drawBoxLine(Position(4.3, .2), 90., 1, .06);
572  GLHelper::drawBoxLine(Position(4.3, -.2), 90., 1, .06);
573  GLHelper::drawBoxLine(Position(5.3, .2), 90., 3, .03);
574  GLHelper::drawBoxLine(Position(5.3, -.2), 90., 3, .03);
576  break;
591  break;
592  default: // same as passenger/sedan
596  break;
597  }
598  /*
599  glBegin(GL_TRIANGLE_FAN);
600  glVertex2d(.5,.5); // center - strip begin
601  glVertex2d(0, .5); // center, front
602  glVertex2d(0, .8); // ... clockwise ... (vehicle right side)
603  glVertex2d(0.08, .94);
604  glVertex2d(0.25, 1.);
605  glVertex2d(0.95, 1.);
606  glVertex2d(1., .9);
607  glVertex2d(1., .1); // (vehicle left side)
608  glVertex2d(0.95, 0.);
609  glVertex2d(0.25, 0.);
610  glVertex2d(0.08, .06);
611  glVertex2d(0, .2); //
612  glVertex2d(0, .5); // center, front (close)
613  glEnd();
614 
615  glPolygonOffset(0, -4.5);
616  glColor3d(1, 1, 1); // front
617  glBegin(GL_TRIANGLE_FAN);
618  glVertex2d(0.1,0.5);
619  glVertex2d(0.025,0.5);
620  glVertex2d(0.025,0.75);
621  glVertex2d(0.27,0.9);
622  glVertex2d(0.27,0.1);
623  glVertex2d(0.025,0.25);
624  glVertex2d(0.025,0.5);
625  glEnd();
626 
627  glColor3d(0, 0, 0); // front glass
628  glBegin(GL_TRIANGLE_FAN);
629  glVertex2d(0.35,0.5);
630  glVertex2d(0.3,0.5);
631  glVertex2d(0.3,0.9);
632  glVertex2d(0.43,0.8);
633  glVertex2d(0.43,0.2);
634  glVertex2d(0.3,0.1);
635  glVertex2d(0.3,0.5);
636  glEnd();
637 
638  glBegin(GL_TRIANGLE_FAN); // back glass
639  glVertex2d(0.92,0.5);
640  glVertex2d(0.90,0.5);
641  glVertex2d(0.90,0.8);
642  glVertex2d(0.95,0.9);
643  glVertex2d(0.95,0.1);
644  glVertex2d(0.90,0.2);
645  glVertex2d(0.90,0.5);
646  glEnd();
647 
648  glBegin(GL_TRIANGLE_FAN); // right glass
649  glVertex2d(0.36,0.07);
650  glVertex2d(0.34,0.03);
651  glVertex2d(0.94,0.03);
652  glVertex2d(0.87,0.13);
653  glVertex2d(0.45,0.13);
654  glVertex2d(0.34,0.03);
655  glEnd();
656 
657  glBegin(GL_TRIANGLE_FAN); // left glass
658  glVertex2d(0.36,1.-0.07);
659  glVertex2d(0.34,1.-0.03);
660  glVertex2d(0.94,1.-0.03);
661  glVertex2d(0.87,1.-0.13);
662  glVertex2d(0.45,1.-0.13);
663  glVertex2d(0.34,1.-0.03);
664  glEnd();
665  */
666 
668 }
669 
670 
671 bool
672 GUIBaseVehicleHelper::drawAction_drawVehicleAsImage(const GUIVisualizationSettings& s, const std::string& file, const GUIGlObject* o, const double width, double length) {
673  if (file != "") {
674  int textureID = GUITexturesHelper::getTextureID(file);
675  if (textureID > 0) {
676  const double exaggeration = s.vehicleSize.getExaggeration(s, o);
677  const double halfWidth = width / 2.0 * exaggeration;
678  GUITexturesHelper::drawTexturedBox(textureID, -halfWidth, 0, halfWidth, length * exaggeration);
679  return true;
680  }
681  }
682  return false;
683 }
684 
685 
686 /****************************************************************************/
static const double vehiclePoly_PassengerVanRightGlass[]
static const double vehiclePoly_EmergencyLadder3[]
static const double vehiclePoly_PassengerVanBodyFront[]
static const double vehiclePoly_EVehicleFrontGlass[]
static const double vehiclePoly_ShipSuperStructure[]
static const double vehiclePoly_scooterBase[]
static const double vehiclePoly_PassengerVanBody[]
static const double vehiclePoly_PassengerWagonLeftGlass[]
static const double vehiclePoly_TransportFrontGlass[]
static const double vehiclePoly_PassengerHatchbackRightGlass[]
static const double vehiclePoly_DeliveryMediumRightGlass[]
static const double vehiclePoly_PassengerHatchbackLeftGlass[]
static const double vehiclePoly_Ship[]
static const double vehiclePoly_EmergencyLadder6[]
static const double vehiclePoly_PassengerSedanLeftGlass[]
static const double vehiclePoly_Emergency2[]
static const double vehiclePoly_PassengerVanBackGlass[]
static const double vehiclePoly_EmergencyLadder7[]
static const double vehiclePoly_PassengerHatchbackBackGlass[]
static const double vehiclePoly_EmergencyLadder4[]
static const double vehiclePoly_PassengerFrontGlass[]
static const double vehiclePoly_EmergencyLadder2[]
static const double vehiclePoly_TransportLeftGlass[]
static const double vehiclePoly_PassengerVanLeftGlass[]
static const double vehiclePoly_Cyclist[]
static const double vehiclePoly_PassengerWagonBackGlass[]
static const double vehiclePoly_PassengerSedanRightGlass[]
static const double vehiclePoly_PassengerCarBodyFront[]
static const double vehiclePoly_scooterBase2[]
static const double vehiclePoly_scooterBase3[]
static const double vehiclePoly_EmergencySign[]
static const double vehiclePoly_TransportBody[]
static const double vehiclePoly_EmergencyLadder[]
static const double vehiclePoly_PassengerWagonRightGlass[]
static const double vehiclePoly_DeliveryMediumLeftGlass[]
static const double vehiclePoly_TransportRightGlass[]
static const double vehiclePoly_PassengerSedanBackGlass[]
static const double vehiclePoly_Emergency[]
static const double vehiclePoly_PassengerVanFrontGlass[]
static const double vehiclePoly_ShipDeck[]
static const double vehiclePoly_PassengerCarBody[]
static const double vehiclePoly_EVehicleBody[]
static const double vehiclePoly_EmergencyLadder5[]
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
@ RICKSHAW
render as a rickshaw
@ BUS
render as a bus
@ RAIL_CARGO
render as a cargo train
@ EMERGENCY
render as an emergency vehicle
@ RAIL
render as a rail
@ PASSENGER_VAN
render as a van
@ PASSENGER
render as a passenger vehicle
@ SCOOTER
render as a scooter
@ RAIL_CAR
render as a (city) rail without locomotive
@ SHIP
render as a arbitrary ship
@ DELIVERY
automated car (with cruise controllers)
@ BICYCLE
render as a bicycle
@ MOTORCYCLE
render as a motorcycle
@ UNKNOWN
not defined
@ BUS_TROLLEY
render as a trolley bus
@ E_VEHICLE
render as a (futuristic) e-vehicle
@ ANT
render as a giant ant
@ TRUCK
render as a transport vehicle
@ FIREBRIGADE
render as a fire brigade
@ PASSENGER_HATCHBACK
render as a hatchback passenger vehicle ("Fliessheck")
@ MOPED
render as a moped
@ BUS_FLEXIBLE
render as a flexible city bus
@ TRUCK_1TRAILER
render as a transport vehicle with one trailer
@ PASSENGER_SEDAN
render as a sedan passenger vehicle ("Stufenheck")
@ BUS_COACH
render as a coach
@ POLICE
render as a police car
@ PASSENGER_WAGON
render as a wagon passenger vehicle ("Combi")
@ TRUCK_SEMITRAILER
render as a semi-trailer transport vehicle ("Sattelschlepper")
@ PEDESTRIAN
render as a pedestrian
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:30
T MIN2(T a, T b)
Definition: StdDefs.h:74
T MAX2(T a, T b)
Definition: StdDefs.h:80
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:507
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:431
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:513
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:231
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
static void drawAction_drawVehicleAsCircle(const double width, const double length, double detail)
draw vehicle as a circle
static void drawAction_drawVehicleAsPoly(const GUIVisualizationSettings &s, const SUMOVehicleShape shape, const double width, const double length, int carriageIndex=-1)
draw vehicle as a polygon
static void drawAction_drawVehicleAsTrianglePlus(const double width, const double length)
draw vehicle as a triangle
static bool drawAction_drawVehicleAsImage(const GUIVisualizationSettings &s, const std::string &file, const GUIGlObject *o, const double width, double length)
try to draw vehicle as raster image and return true if sucessful
static void drawPoly(const double *poses, const double offset)
draw poly
static void drawAction_drawVehicleAsBoxPlus(const double width, const double length)
draw vehicle as a Box
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings vehicleSize
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
static const RGBColor GREY
Definition: RGBColor.h:194
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:197
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values