62 #ifdef CHECK_MEMORY_LEAKS
64 #endif // CHECK_MEMORY_LEAKS
94 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 };
95 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 };
96 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 };
97 double vehiclePoly_PassengerSedanRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.77, -.47, 0.67, -.37, 0.45, -.37, 0.34, -.47, -10000 };
98 double vehiclePoly_PassengerSedanLeftGlass[] = { 0.36, .43, 0.34, .47, 0.77, .47, 0.67, .37, 0.45, .37, 0.34, .47, -10000 };
99 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 };
100 double vehiclePoly_PassengerHatchbackRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.94, -.47, 0.80, -.37, 0.45, -.37, 0.34, -.47, -10000 };
101 double vehiclePoly_PassengerHatchbackLeftGlass[] = { 0.36, .43, 0.34, .47, 0.94, .47, 0.80, .37, 0.45, .37, 0.34, .47, -10000 };
102 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 };
103 double vehiclePoly_PassengerWagonRightGlass[] = { 0.36, -.43, 0.34, -.47, 0.94, -.47, 0.87, -.37, 0.45, -.37, 0.34, -.47, -10000 };
104 double vehiclePoly_PassengerWagonLeftGlass[] = { 0.36, .43, 0.34, .47, 0.94, .47, 0.87, .37, 0.45, .37, 0.34, .47, -10000 };
105 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 };
107 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 };
108 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 };
109 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 };
110 double vehiclePoly_PassengerVanRightGlass[] = { 0.36, -.43, 0.20, -.47, 0.98, -.47, 0.91, -.37, 0.31, -.37, 0.20, -.47, -10000 };
111 double vehiclePoly_PassengerVanLeftGlass[] = { 0.36, .43, 0.20, .47, 0.98, .47, 0.91, .37, 0.31, .37, 0.20, .47, -10000 };
112 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 };
114 double vehiclePoly_DeliveryMediumRightGlass[] = { 0.21, -.43, 0.20, -.47, 0.38, -.47, 0.38, -.37, 0.31, -.37, 0.20, -.47, -10000 };
115 double vehiclePoly_DeliveryMediumLeftGlass[] = { 0.21, .43, 0.20, .47, 0.38, .47, 0.38, .37, 0.31, .37, 0.20, .47, -10000 };
117 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 };
118 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 };
119 double vehiclePoly_TransportRightGlass[] = { 0.36, -.47, 0.10, -.48, 1.25, -.48, 1.25, -.4, 0.3, -.4, 0.10, -.48, -10000 };
120 double vehiclePoly_TransportLeftGlass[] = { 0.36, .47, 0.10, .48, 1.25, .48, 1.25, .4, 0.3, .4, 0.10, .48, -10000 };
122 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 };
123 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 };
125 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 };
136 GUIGlObject& o, std::map<GUISUMOAbstractView*, int>& additionalVisualizations)
137 :
GUIGLObjectPopupMenu(app, parent, o), myVehiclesAdditionalVisualizations(additionalVisualizations) {
147 if (!static_cast<GUIVehicle*>(myObject)->hasActiveAddVisualisation(myParent,
VO_SHOW_ALL_ROUTES)) {
164 if (!static_cast<GUIVehicle*>(myObject)->hasActiveAddVisualisation(myParent,
VO_SHOW_ROUTE)) {
181 if (!static_cast<GUIVehicle*>(myObject)->hasActiveAddVisualisation(myParent,
VO_SHOW_BEST_LANES)) {
198 if (!static_cast<GUIVehicle*>(myObject)->hasActiveAddVisualisation(myParent,
VO_TRACKED)) {
199 myParent->startTrack(static_cast<GUIVehicle*>(myObject)->
getGlID());
209 myParent->stopTrack();
217 if (!static_cast<GUIVehicle*>(myObject)->hasActiveAddVisualisation(myParent,
VO_SHOW_LFLINKITEMS)) {
236 SUMOReal speedFactor,
int vehicleIndex) :
237 MSVehicle(pars, route, type, speedFactor, vehicleIndex),
249 while (i->first->removeAdditionalGLVisualisation(
this));
286 new FXMenuSeparator(ret);
288 if (trackedID < 0 || (
size_t)trackedID !=
getGlID()) {
293 new FXMenuSeparator(ret);
309 ret->
mkItem(
"left same route [#]",
false, (
unsigned int)
getParameter().repetitionNumber);
318 ret->
mkItem(
"waiting time [s]",
true,
320 ret->
mkItem(
"last lane change [s]",
true,
323 ret->
mkItem(
"position [m]",
true,
325 ret->
mkItem(
"speed [m/s]",
true,
327 ret->
mkItem(
"angle",
true,
329 ret->
mkItem(
"CO2 (HBEFA) [mg/s]",
true,
331 ret->
mkItem(
"CO (HBEFA) [mg/s]",
true,
333 ret->
mkItem(
"HC (HBEFA) [mg/s]",
true,
335 ret->
mkItem(
"NOx (HBEFA) [mg/s]",
true,
337 ret->
mkItem(
"PMx (HBEFA) [mg/s]",
true,
339 ret->
mkItem(
"fuel (HBEFA) [ml/s]",
true,
341 ret->
mkItem(
"noise (Harmonoise) [dB]",
true,
362 glBegin(GL_TRIANGLE_STRIP);
364 glVertex2d(-.5, .15);
382 glBegin(GL_TRIANGLES);
394 glTranslated(0, 0, offset * .1);
395 glPolygonOffset(0, offset * -1);
396 glBegin(GL_TRIANGLE_FAN);
398 while (poses[i] > -999) {
399 glVertex2d(poses[i], poses[i + 1]);
416 glRotated(90, 0, 0, 1);
417 glScaled(length, width, 1.);
425 drawPoly(vehiclePoly_PassengerCarBodyFront, 4.5);
427 drawPoly(vehiclePoly_PassengerFrontGlass, 4.5);
431 glTranslated(0, 0, .045);
433 glTranslated(0, 0, -.045);
435 glTranslated(0, 0, .04);
438 glTranslated(0, 0, -.04);
443 glTranslated(.5, 0, 0);
444 glScaled(.25 / (length), 1, 1.);
445 glTranslated(0, 0, .045);
448 glTranslated(0, 0, -.045);
449 glTranslated(0, 0, .04);
452 glTranslated(0, 0, -.04);
462 drawPoly(vehiclePoly_PassengerCarBodyFront, 4.5);
464 drawPoly(vehiclePoly_PassengerFrontGlass, 4.5);
467 drawPoly(vehiclePoly_PassengerVanBody, 4);
469 drawPoly(vehiclePoly_PassengerVanBodyFront, 4.5);
471 drawPoly(vehiclePoly_PassengerVanFrontGlass, 4.5);
472 drawPoly(vehiclePoly_PassengerVanRightGlass, 4.5);
473 drawPoly(vehiclePoly_PassengerVanLeftGlass, 4.5);
474 drawPoly(vehiclePoly_PassengerVanBackGlass, 4.5);
477 drawPoly(vehiclePoly_PassengerVanBody, 4);
479 drawPoly(vehiclePoly_PassengerVanBodyFront, 4.5);
481 drawPoly(vehiclePoly_PassengerVanFrontGlass, 4.5);
482 drawPoly(vehiclePoly_DeliveryMediumRightGlass, 4.5);
483 drawPoly(vehiclePoly_DeliveryMediumLeftGlass, 4.5);
488 glScaled(1. / (length), 1, 1.);
489 drawPoly(vehiclePoly_TransportBody, 4);
491 drawPoly(vehiclePoly_TransportFrontGlass, 4.5);
492 drawPoly(vehiclePoly_TransportRightGlass, 4.5);
493 drawPoly(vehiclePoly_TransportLeftGlass, 4.5);
500 glScaled(1. / (length), 1, 1.);
501 glTranslated(0, 0, .04);
502 glBegin(GL_TRIANGLE_FAN);
503 glVertex2d(ml / 2., 0);
506 glVertex2d(0 + .05, -.5);
507 glVertex2d(ml - .05, -.5);
508 glVertex2d(ml, -.45);
510 glVertex2d(ml - .05, .5);
511 glVertex2d(0 + .05, .5);
515 glTranslated(0, 0, -.04);
517 glTranslated(0, 0, .045);
520 glVertex2d(0 + .05, .48);
521 glVertex2d(0 + .05, -.48);
522 glVertex2d(0 + .15, -.48);
523 glVertex2d(0 + .15, .48);
525 glVertex2d(ml - .1, .45);
526 glVertex2d(ml - .1, -.45);
527 glVertex2d(ml - .05, -.45);
528 glVertex2d(ml - .05, .45);
530 glVertex2d(0 + .20, .49);
531 glVertex2d(0 + .20, .45);
532 glVertex2d(ml - .20, .45);
533 glVertex2d(ml - .20, .49);
535 glVertex2d(0 + .20, -.49);
536 glVertex2d(0 + .20, -.45);
537 glVertex2d(ml - .20, -.45);
538 glVertex2d(ml - .20, -.49);
541 glTranslated(0, 0, -.045);
564 drawPoly(vehiclePoly_EVehicleBody, 4);
566 drawPoly(vehiclePoly_EVehicleFrontGlass, 4.5);
567 glTranslated(0, 0, .048);
572 glVertex2d(.35, -.5);
575 glVertex2d(.3, -.05);
576 glVertex2d(.7, -.05);
582 glVertex2d(.65, -.5);
585 glTranslated(0, 0, -.048);
612 glTranslated(0, 0, 0.1);
614 glTranslated(.4, 0, 0);
616 glTranslated(.4, 0, 0);
623 drawPoly(vehiclePoly_PassengerCarBodyFront, 4.5);
625 drawPoly(vehiclePoly_PassengerFrontGlass, 4.5);
635 glBegin(GL_TRIANGLE_FAN);
636 glVertex2d(1 / 2., 0);
639 glVertex2d(0 + .05, -.05);
640 glVertex2d(1 - .05, -.05);
643 glVertex2d(1 - .05, .05);
644 glVertex2d(0 + .05, .05);
651 glBegin(GL_TRIANGLE_FAN);
652 glVertex2d(1 / 2., 0);
655 glVertex2d(0 + .05, -.2);
656 glVertex2d(1 - .05, -.2);
659 glVertex2d(1 - .05, .2);
660 glVertex2d(0 + .05, .2);
667 drawPoly(vehiclePoly_PassengerSedanRightGlass, 4.5);
668 drawPoly(vehiclePoly_PassengerSedanLeftGlass, 4.5);
669 drawPoly(vehiclePoly_PassengerSedanBackGlass, 4.5);
672 drawPoly(vehiclePoly_PassengerHatchbackRightGlass, 4.5);
673 drawPoly(vehiclePoly_PassengerHatchbackLeftGlass, 4.5);
674 drawPoly(vehiclePoly_PassengerHatchbackBackGlass, 4.5);
677 drawPoly(vehiclePoly_PassengerWagonRightGlass, 4.5);
678 drawPoly(vehiclePoly_PassengerWagonLeftGlass, 4.5);
679 drawPoly(vehiclePoly_PassengerWagonBackGlass, 4.5);
702 glTranslated(0, 0, .1);
705 glTranslated(0, 0, .1);
727 drawPoly(vehiclePoly_PassengerSedanRightGlass, 4.5);
728 drawPoly(vehiclePoly_PassengerSedanLeftGlass, 4.5);
729 drawPoly(vehiclePoly_PassengerSedanBackGlass, 4.5);
823 #define BLINKER_POS_FRONT .5
824 #define BLINKER_POS_BACK .5
828 glColor3d(1.f, .8f, 0);
864 glColor3f(1.f, .2f, 0);
892 glScaled(upscale, upscale, 1);
947 glColor3d(0., 1., 0.);
950 glVertex2d(0., minGap);
951 glVertex2d(-.5, minGap);
952 glVertex2d(.5, minGap);
957 glTranslated(0, 0, .1);
1030 size_t personIndex = 0;
1031 for (std::vector<MSPerson*>::const_iterator i = ps.begin(); i != ps.end(); ++i) {
1033 assert(person != 0);
1045 glTranslated(0, 0,
getType() - .1);
1055 for (
int i = noReroutePlus1 - 1; i >= 0; i--) {
1065 if ((*i).myLink == 0) {
1068 MSLink* link = (*i).myLink;
1072 if ((*i).mySetRequest) {
1073 glColor3d(0, .8, 0);
1075 glColor3d(.8, 0, 0);
1077 glTranslated(p.
x(), p.
y(), -.1);
1084 glTranslated(-p.
x(), -p.
y(), .1);
1093 const std::vector<MSVehicle::LaneQ>&
1113 switch (activeScheme) {
1154 SUMOReal hue = 180. + atan2(center.
x() - p.
x(), center.
y() - p.
y()) * 180. /
PI;
1163 SUMOReal hue = 180. + atan2(center.
x() - p.
x(), center.
y() - p.
y()) * 180. /
PI;
1172 SUMOReal hue = 180. + atan2(pb.
x() - pe.
x(), pb.
y() - pe.
y()) * 180. /
PI;
1186 switch (activeScheme) {
1247 glGetDoublev(GL_CURRENT_COLOR, colors);
1248 colors[0] -= darken;
1249 if (colors[0] < 0) {
1252 colors[1] -= darken;
1253 if (colors[1] < 0) {
1256 colors[2] -= darken;
1257 if (colors[2] < 0) {
1260 colors[3] -= darken;
1261 if (colors[3] < 0) {
1277 std::vector<std::vector<MSVehicle::LaneQ> > bestLanes =
myBestLanes;
1280 for (std::vector<std::vector<MSVehicle::LaneQ> >::iterator j = bestLanes.begin(); j != bestLanes.end(); ++j) {
1281 std::vector<MSVehicle::LaneQ>& lanes = *j;
1284 for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
1285 gmax =
MAX2((*i).length, gmax);
1286 rmax =
MAX2((*i).occupation, rmax);
1288 for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
1291 SUMOReal r = (*i).occupation / rmax;
1314 for (; i != r.
end(); ++i) {
1337 }
else if (routeIndex == 0) {
1344 #ifdef HAVE_INTERNAL_LANES
1345 const MSEdge* previousInternal = previous->getInternalFollowingEdge(¤t->
getEdge());
1347 const MSEdge* previousInternal = 0;
1349 if (previousInternal != 0) {
1350 return previousInternal->
getLanes()[0];
1374 const int numCarriages = floor(length / (defaultLength + carriageGap) + 0.5);
1375 assert(numCarriages > 0);
1376 const SUMOReal carriageLengthWithGap = length / numCarriages;
1377 const SUMOReal carriageLength = carriageLengthWithGap - carriageGap;
1383 int backRouteIndex = routeIndex;
1389 if (requiredSeats > 0) {
1393 for (
int i = 0; i < numCarriages; ++i) {
1394 while (carriageOffset < 0) {
1398 while (carriageBackOffset < 0) {
1400 carriageBackOffset += backLane->
getLength();
1405 if (i >= firstPassengerCarriage) {
1409 glTranslated(front.
x(), front.
y(),
getType());
1410 glRotated(angle, 0, 0, 1);
1412 glBegin(GL_TRIANGLE_FAN);
1413 glVertex2d(-halfWidth + xCornerCut, 0);
1414 glVertex2d(-halfWidth, yCornerCut);
1415 glVertex2d(-halfWidth, carriageLength - yCornerCut);
1416 glVertex2d(-halfWidth + xCornerCut, carriageLength);
1417 glVertex2d(halfWidth - xCornerCut, carriageLength);
1418 glVertex2d(halfWidth, carriageLength - yCornerCut);
1419 glVertex2d(halfWidth, yCornerCut);
1420 glVertex2d(halfWidth - xCornerCut, 0);
1424 carriageOffset -= carriageLengthWithGap;
1425 carriageBackOffset -= carriageLengthWithGap;
1449 if (requiredSeats <= 0) {
1452 const Line l(front, back);
1459 for (
SUMOReal p = 2; p <= length - 1; p += 1) {