SUMO - Simulation of Urban MObility
GUIVehicle.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>
40 #include <utils/geom/GeomHelper.h>
47 #include <utils/gui/div/GLHelper.h>
50 #include <microsim/MSVehicle.h>
51 #include <microsim/MSJunction.h>
52 #include <microsim/MSLane.h>
60 #include <gui/GUIGlobals.h>
61 #include "GUIVehicle.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 
77 // Object implementation
78 
79 
80 /* -------------------------------------------------------------------------
81  * GUIVehicle - methods
82  * ----------------------------------------------------------------------- */
83 #ifdef _MSC_VER
84 #pragma warning(disable: 4355)
85 #endif
87  const MSVehicleType* type, const SUMOReal speedFactor) :
88  MSVehicle(pars, route, type, speedFactor),
89  GUIBaseVehicle((MSBaseVehicle&) * this) {
90 }
91 #ifdef _MSC_VER
92 #pragma warning(default: 4355)
93 #endif
94 
95 
97 }
98 
99 
104  new GUIParameterTableWindow(app, *this, 33);
105  // add items
106  ret->mkItem("lane [id]", false, myLane->getID());
107  ret->mkItem("position [m]", true,
109  ret->mkItem("speed [m/s]", true,
111  ret->mkItem("angle [degree]", true,
113  ret->mkItem("slope [degree]", true,
115  if (getChosenSpeedFactor() != 1) {
116  ret->mkItem("speed factor", false, getChosenSpeedFactor());
117  }
118  ret->mkItem("time gap [s]", true,
120  ret->mkItem("waiting time [s]", true,
122  ret->mkItem(("waiting time (accumlated, " + time2string(MSGlobals::gWaitingTimeMemory) + "s) [s]").c_str(), true,
124  ret->mkItem("impatience", true,
126  ret->mkItem("last lane change [s]", true,
128  ret->mkItem("desired depart [s]", false, time2string(getParameter().depart));
129  ret->mkItem("depart delay [s]", false, time2string(getDepartDelay()));
130  if (getParameter().repetitionNumber < INT_MAX) {
131  ret->mkItem("remaining [#]", false, (unsigned int) getParameter().repetitionNumber - getParameter().repetitionsDone);
132  }
133  if (getParameter().repetitionOffset > 0) {
134  ret->mkItem("insertion period [s]", false, time2string(getParameter().repetitionOffset));
135  }
136  if (getParameter().repetitionProbability > 0) {
137  ret->mkItem("insertion probability", false, getParameter().repetitionProbability);
138  }
139  ret->mkItem("stop info", false, getStopInfo());
140  ret->mkItem("line", false, myParameter->line);
141  ret->mkItem("CO2 [mg/s]", true,
143  ret->mkItem("CO [mg/s]", true,
145  ret->mkItem("HC [mg/s]", true,
147  ret->mkItem("NOx [mg/s]", true,
149  ret->mkItem("PMx [mg/s]", true,
151  ret->mkItem("fuel [ml/s]", true,
153  ret->mkItem("electricity [Wh/s]", true,
155  ret->mkItem("noise (Harmonoise) [dB]", true,
157  std::ostringstream str;
158  for (std::vector<MSDevice*>::const_iterator i = myDevices.begin(); i != myDevices.end(); ++i) {
159  if (i != myDevices.begin()) {
160  str << ' ';
161  }
162  str << (*i)->getID().substr(0, (*i)->getID().find(getID()));
163  }
164  ret->mkItem("devices", false, str.str());
165  ret->mkItem("persons", true,
167  ret->mkItem("containers", true,
169 
170  ret->mkItem("parameters [key:val]", false, toString(getParameter().getMap()));
171  // close building
172  ret->closeBuilding();
173  return ret;
174 }
175 
176 
181  new GUIParameterTableWindow(app, *this, 14);
182  // add items
183  ret->mkItem("Type Information:", false, "");
184  ret->mkItem("type [id]", false, myType->getID());
185  ret->mkItem("length", false, myType->getLength());
186  ret->mkItem("minGap", false, myType->getMinGap());
187  ret->mkItem("vehicle class", false, SumoVehicleClassStrings.getString(myType->getVehicleClass()));
188  ret->mkItem("emission class", false, PollutantsInterface::getName(myType->getEmissionClass()));
189  ret->mkItem("maximum speed [m/s]", false, getMaxSpeed());
190  ret->mkItem("maximum acceleration [m/s^2]", false, getCarFollowModel().getMaxAccel());
191  ret->mkItem("maximum deceleration [m/s^2]", false, getCarFollowModel().getMaxDecel());
192  ret->mkItem("imperfection (sigma)", false, getCarFollowModel().getImperfection());
193  ret->mkItem("reaction time (tau)", false, getCarFollowModel().getHeadwayTime());
194  ret->mkItem("person capacity", false, myType->getPersonCapacity());
195  ret->mkItem("container capacity", false, myType->getContainerCapacity());
196 
197  ret->mkItem("type parameters [key:val]", false, toString(myType->getParameter().getMap()));
198  // close building
199  ret->closeBuilding();
200  return ret;
201 }
202 
203 
204 
205 
206 void
208  if (myPersonDevice != 0) {
209  const std::vector<MSTransportable*>& ps = myPersonDevice->getTransportables();
210  size_t personIndex = 0;
211  for (std::vector<MSTransportable*>::const_iterator i = ps.begin(); i != ps.end(); ++i) {
212  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
213  assert(person != 0);
214  person->setPositionInVehicle(getSeatPosition(personIndex++));
215  person->drawGL(s);
216  }
217  }
218  if (myContainerDevice != 0) {
219  const std::vector<MSTransportable*>& cs = myContainerDevice->getTransportables();
220  size_t containerIndex = 0;
221  for (std::vector<MSTransportable*>::const_iterator i = cs.begin(); i != cs.end(); ++i) {
222  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
223  assert(container != 0);
224  container->setPositionInVehicle(getSeatPosition(containerIndex++));
225  container->drawGL(s);
226  }
227  }
228 }
229 
230 
231 void
233  for (DriveItemVector::const_iterator i = myLFLinkLanes.begin(); i != myLFLinkLanes.end(); ++i) {
234  if ((*i).myLink == 0) {
235  continue;
236  }
237  MSLink* link = (*i).myLink;
238  MSLane* via = link->getViaLaneOrLane();
239  if (via != 0) {
240  Position p = via->getShape()[0];
241  if ((*i).mySetRequest) {
242  glColor3d(0, .8, 0);
243  } else {
244  glColor3d(.8, 0, 0);
245  }
246  const SUMOTime leaveTime = (*i).myLink->getLeaveTime(
247  (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(), getVehicleType().getLength());
248  drawLinkItem(p, (*i).myArrivalTime, leaveTime, s.vehicleName.size / s.scale);
249  // the time slot that ego vehicle uses when checking opened may
250  // differ from the one it requests in setApproaching
251  MSLink::ApproachingVehicleInformation avi = (*i).myLink->getApproaching(this);
252  assert(avi.arrivalTime == (*i).myArrivalTime && avi.leavingTime == leaveTime);
253  UNUSED_PARAMETER(avi); // only used for assertion
254  }
255  }
256 }
257 
258 
259 bool
261  switch (guiShape) {
262  case SVS_BUS_FLEXIBLE:
263  drawAction_drawRailCarriages(s, 8.25, 0, 0, asImage); // 16.5 overall, 2 modules http://de.wikipedia.org/wiki/Ikarus_180
264  break;
265  case SVS_RAIL:
266  drawAction_drawRailCarriages(s, 24.5, 1, 1, asImage); // http://de.wikipedia.org/wiki/UIC-Y-Wagen_%28DR%29
267  break;
268  case SVS_RAIL_CAR:
269  drawAction_drawRailCarriages(s, 16.85, 1, 0, asImage); // 67.4m overall, 4 carriages http://de.wikipedia.org/wiki/DB-Baureihe_423
270 // drawAction_drawRailCarriages(s, 5.71, 0, 0, asImage); // 40.0m overall, 7 modules http://de.wikipedia.org/wiki/Bombardier_Flexity_Berlin
271 // drawAction_drawRailCarriages(s, 9.44, 1, 1, asImage); // actually length of the locomotive http://de.wikipedia.org/wiki/KJI_Nr._20_und_21
272 // drawAction_drawRailCarriages(s, 24.775, 0, 0, asImage); // http://de.wikipedia.org/wiki/ICE_3
273  break;
274  case SVS_RAIL_CARGO:
275  drawAction_drawRailCarriages(s, 13.86, 1, 0, asImage); // UIC 571-1 http://de.wikipedia.org/wiki/Flachwagen
276  break;
277  default:
278  return false;
279  }
280  return true;
281 }
282 
283 #define BLINKER_POS_FRONT .5
284 #define BLINKER_POS_BACK .5
285 
286 inline void
287 drawAction_drawBlinker(double dir, SUMOReal length) {
288  glColor3d(1.f, .8f, 0);
289  glPushMatrix();
290  glTranslated(dir, BLINKER_POS_FRONT, -0.1);
292  glPopMatrix();
293  glPushMatrix();
294  glTranslated(dir, length - BLINKER_POS_BACK, -0.1);
296  glPopMatrix();
297 }
298 
299 
300 void
303  return;
304  }
305  const double offset = MAX2(.5 * getVehicleType().getWidth(), .4);
307  drawAction_drawBlinker(-offset, length);
308  }
310  drawAction_drawBlinker(offset, length);;
311  }
313  drawAction_drawBlinker(-offset, length);
314  drawAction_drawBlinker(offset, length);
315  }
316 }
317 
318 
319 inline void
322  return;
323  }
324  glColor3f(1.f, .2f, 0);
325  glPushMatrix();
326  glTranslated(-getVehicleType().getWidth() * 0.5, length, -0.1);
328  glPopMatrix();
329  glPushMatrix();
330  glTranslated(getVehicleType().getWidth() * 0.5, length, -0.1);
332  glPopMatrix();
333 }
334 
335 inline void
338  glPushMatrix();
339  glTranslated(0, 2.5, .5);
340  glColor3f(0, 0, 1);
342  glPopMatrix();
343  }
344 }
345 
346 
347 SUMOReal
348 GUIVehicle::getColorValue(size_t activeScheme) const {
349  switch (activeScheme) {
350  case 8:
351  return getSpeed();
352  case 9:
353  return getWaitingSeconds();
354  case 10:
356  case 11:
357  return getLastLaneChangeOffset();
358  case 12:
359  return getLane()->getVehicleMaxSpeed(this);
360  case 13:
361  return getCO2Emissions();
362  case 14:
363  return getCOEmissions();
364  case 15:
365  return getPMxEmissions();
366  case 16:
367  return getNOxEmissions();
368  case 17:
369  return getHCEmissions();
370  case 18:
371  return getFuelConsumption();
372  case 19:
374  case 20:
375  if (getNumberReroutes() == 0) {
376  return -1;
377  }
378  return getNumberReroutes();
379  case 21:
381  case 22:
382  return getBestLaneOffset();
383  case 23:
384  return getAcceleration();
385  case 24:
386  return getTimeGap();
387  case 25:
388  return STEPS2TIME(getDepartDelay());
389  case 26:
390  return getElectricityConsumption();
391  }
392  return 0;
393 }
394 
395 
396 void
398  myLock.lock();
399  std::vector<std::vector<MSVehicle::LaneQ> > bestLanes = myBestLanes;
400  myLock.unlock();
401  for (std::vector<std::vector<MSVehicle::LaneQ> >::iterator j = bestLanes.begin(); j != bestLanes.end(); ++j) {
402  std::vector<MSVehicle::LaneQ>& lanes = *j;
403  SUMOReal gmax = -1;
404  SUMOReal rmax = -1;
405  for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
406  gmax = MAX2((*i).length, gmax);
407  rmax = MAX2((*i).occupation, rmax);
408  }
409  for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
410  const PositionVector& shape = (*i).lane->getShape();
411  SUMOReal g = (*i).length / gmax;
412  SUMOReal r = (*i).occupation / rmax;
413  glColor3d(r, g, 0);
414  SUMOReal width = 0.5 / (1 + abs((*i).bestLaneOffset));
415  GLHelper::drawBoxLines(shape, width);
416 
417  PositionVector s1 = shape;
418  s1.move2side((SUMOReal) .1);
419  glColor3d(r, 0, 0);
420  GLHelper::drawLine(s1);
421  s1.move2side((SUMOReal) - .2);
422  glColor3d(0, g, 0);
423  GLHelper::drawLine(s1);
424 
425  glColor3d(r, g, 0);
426  }
427  }
428 }
429 
430 
431 void
432 GUIVehicle::drawRouteHelper(const MSRoute& r, SUMOReal exaggeration) const {
433  MSRouteIterator i = r.begin();
434  const std::vector<MSLane*>& bestLaneConts = getBestLanesContinuation();
435  // draw continuation lanes when drawing the current route where available
436  size_t bestLaneIndex = (&r == myRoute ? 0 : bestLaneConts.size());
437  for (; i != r.end(); ++i) {
438  const GUILane* lane;
439  if (bestLaneIndex < bestLaneConts.size() && bestLaneConts[bestLaneIndex] != 0 && (*i) == &(bestLaneConts[bestLaneIndex]->getEdge())) {
440  lane = static_cast<GUILane*>(bestLaneConts[bestLaneIndex]);
441  ++bestLaneIndex;
442  } else {
443  lane = static_cast<GUILane*>((*i)->getLanes()[0]);
444  }
445  GLHelper::drawBoxLines(lane->getShape(), lane->getShapeRotations(), lane->getShapeLengths(), exaggeration);
446  }
447 }
448 
449 
450 
451 MSLane*
452 GUIVehicle::getPreviousLane(MSLane* current, int& furtherIndex) const {
453  if (furtherIndex < (int)myFurtherLanes.size()) {
454  return myFurtherLanes[furtherIndex++];
455  } else {
456  return current;
457  }
458 }
459 
460 
461 void
462 GUIVehicle::drawAction_drawRailCarriages(const GUIVisualizationSettings& s, SUMOReal defaultLength, SUMOReal carriageGap, int firstPassengerCarriage, bool asImage) const {
463  RGBColor current = GLHelper::getColor();
464  RGBColor darker = current.changedBrightness(-51);
465  const SUMOReal exaggeration = s.vehicleSize.getExaggeration(s);
466  defaultLength *= exaggeration;
467  if (exaggeration == 0) {
468  return;
469  }
470  carriageGap *= exaggeration;
471  const SUMOReal length = getVehicleType().getLength() * exaggeration;
472  const SUMOReal halfWidth = getVehicleType().getWidth() / 2.0 * exaggeration;
473  glPopMatrix(); // undo scaling and 90 degree rotation
474  glPopMatrix(); // undo initial translation and rotation
475  GLHelper::setColor(darker);
476  const SUMOReal xCornerCut = 0.3 * exaggeration;
477  const SUMOReal yCornerCut = 0.4 * exaggeration;
478  // round to closest integer
479  const int numCarriages = floor(length / (defaultLength + carriageGap) + 0.5);
480  assert(numCarriages > 0);
481  const SUMOReal carriageLengthWithGap = length / numCarriages;
482  const SUMOReal carriageLength = carriageLengthWithGap - carriageGap;
483  // lane on which the carriage front is situated
484  MSLane* lane = myLane;
485  int furtherIndex = 0;
486  // lane on which the carriage back is situated
487  MSLane* backLane = myLane;
488  int backFurtherIndex = furtherIndex;
489  // offsets of front and back
490  SUMOReal carriageOffset = myState.pos();
491  SUMOReal carriageBackOffset = myState.pos() - carriageLength;
492  // handle seats
493  int requiredSeats = getNumPassengers();
494  if (requiredSeats > 0) {
495  mySeatPositions.clear();
496  }
497  Position front, back;
498  SUMOReal angle = 0.;
499  // draw individual carriages
500  for (int i = 0; i < numCarriages; ++i) {
501  while (carriageOffset < 0) {
502  MSLane* prev = getPreviousLane(lane, furtherIndex);
503  if (prev != lane) {
504  carriageOffset += prev->getLength();
505  } else {
506  // no lane available for drawing.
507  carriageOffset = 0;
508  }
509  lane = prev;
510  }
511  while (carriageBackOffset < 0) {
512  MSLane* prev = getPreviousLane(backLane, backFurtherIndex);
513  if (prev != backLane) {
514  carriageBackOffset += prev->getLength();
515  } else {
516  // no lane available for drawing.
517  carriageBackOffset = 0;
518  }
519  backLane = prev;
520  }
521  front = lane->geometryPositionAtOffset(carriageOffset);
522  back = backLane->geometryPositionAtOffset(carriageBackOffset);
523  if (front == back) {
524  // no place for drawing available
525  continue;
526  }
527  const SUMOReal drawnCarriageLength = front.distanceTo2D(back);
528  angle = atan2((front.x() - back.x()), (back.y() - front.y())) * (SUMOReal) 180.0 / (SUMOReal) PI;
529  if (i >= firstPassengerCarriage) {
530  computeSeats(front, back, requiredSeats);
531  }
532  glPushMatrix();
533  glTranslated(front.x(), front.y(), getType());
534  glRotated(angle, 0, 0, 1);
535  if (!asImage || !drawAction_drawVehicleAsImage(s, carriageLength)) {
536  glBegin(GL_TRIANGLE_FAN);
537  glVertex2d(-halfWidth + xCornerCut, 0);
538  glVertex2d(-halfWidth, yCornerCut);
539  glVertex2d(-halfWidth, drawnCarriageLength - yCornerCut);
540  glVertex2d(-halfWidth + xCornerCut, drawnCarriageLength);
541  glVertex2d(halfWidth - xCornerCut, drawnCarriageLength);
542  glVertex2d(halfWidth, drawnCarriageLength - yCornerCut);
543  glVertex2d(halfWidth, yCornerCut);
544  glVertex2d(halfWidth - xCornerCut, 0);
545  glEnd();
546  }
547  glPopMatrix();
548  carriageOffset -= carriageLengthWithGap;
549  carriageBackOffset -= carriageLengthWithGap;
550  GLHelper::setColor(current);
551  }
552  // restore matrices
553  glPushMatrix();
554  glTranslated(front.x(), front.y(), getType());
555  glRotated(angle, 0, 0, 1);
556  glPushMatrix();
557 }
558 
559 
560 SUMOReal
563 }
564 
565 
566 int
568  if (myPersonDevice != 0) {
569  return (int)myPersonDevice->size();
570  }
571  return 0;
572 }
573 
574 
575 void
576 GUIVehicle::computeSeats(const Position& front, const Position& back, int& requiredSeats) const {
577  if (requiredSeats <= 0) {
578  return; // save some work
579  }
580  const SUMOReal length = front.distanceTo2D(back);
581  if (length < 4) {
582  // small vehicle, sit at the center
583  mySeatPositions.push_back(PositionVector::positionAtOffset2D(front, back, length / 2));
584  requiredSeats--;
585  } else {
586  for (SUMOReal p = 2; p <= length - 1; p += 1) {
587  mySeatPositions.push_back(PositionVector::positionAtOffset2D(front, back, p));
588  requiredSeats--;
589  }
590  }
591 }
592 
593 
594 SUMOReal
597 }
598 
599 
600 std::string
602  std::string result = "";
603  if (isParking()) {
604  result += "parking";
605  } else if (isStopped()) {
606  result += "stopped";
607  } else {
608  return "";
609  }
610  if (myStops.front().triggered) {
611  result += ", triggered";
612  } else if (myStops.front().containerTriggered) {
613  result += ", containerTriggered";
614  } else {
615  result += ", duration=" + time2string(myStops.front().duration);
616  }
617  return result;
618 }
619 
620 
621 void
624  for (DriveItemVector::const_iterator i = myLFLinkLanes.begin(); i != myLFLinkLanes.end(); ++i) {
625  const DriveProcessItem& dpi = *i;
626  if (dpi.myLink == 0) {
627  continue;
628  }
629  std::vector<const SUMOVehicle*> blockingFoes;
630  std::vector<const MSPerson*> blockingPersons;
632  getImpatience(), getCarFollowModel().getMaxDecel(), getWaitingTime(), &blockingFoes);
633  for (std::vector<const SUMOVehicle*>::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) {
634  gSelected.select(static_cast<const GUIVehicle*>(*it)->getGlID());
635  }
636 #ifdef HAVE_INTERNAL_LANES
637  const MSLink::LinkLeaders linkLeaders = (dpi.myLink)->getLeaderInfo(dist, getVehicleType().getMinGap(), &blockingPersons);
638  for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
639  // the vehicle to enter the junction first has priority
640  const GUIVehicle* leader = dynamic_cast<const GUIVehicle*>(it->vehAndGap.first);
641  if (leader != 0) {
642  if (dpi.myLink->isLeader(this, leader)) {
643  gSelected.select(leader->getGlID());
644  }
645  } else {
646  for (std::vector<const MSPerson*>::iterator it_p = blockingPersons.begin(); it_p != blockingPersons.end(); ++it_p) {
647  const GUIPerson* foe = dynamic_cast<const GUIPerson*>(*it_p);
648  if (foe != 0) {
649  gSelected.select(foe->getGlID());
650  //std::cout << SIMTIME << " veh=" << getID() << " is blocked on link " << dpi.myLink->getRespondIndex() << " to " << dpi.myLink->getViaLaneOrLane()->getID() << " by pedestrian. dist=" << it->second << "\n";
651  }
652  }
653  }
654  }
655 #endif
656  dist += dpi.myLink->getViaLaneOrLane()->getLength();
657  }
658 }
659 
660 /****************************************************************************/
661 
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:938
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:101
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:622
const MSVehicleType * myType
This Vehicle&#39;s type.
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:348
const std::vector< SUMOReal > & getShapeRotations() const
Definition: GUILane.cpp:731
render as a rail
bool drawAction_drawCarriageClass(const GUIVisualizationSettings &s, SUMOVehicleShape guiShape, bool asImage) const
draws the given guiShape if it has distinct carriages/modules and returns true if so ...
Definition: GUIVehicle.cpp:260
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
long long int SUMOTime
Definition: SUMOTime.h:43
unsigned int getNumberReroutes() const
Returns the number of new routes this vehicle got.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type&#39;s vehicle class.
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1283
const MSCFModel & getCarFollowModel() const
Returns the vehicle&#39;s car following model definition.
Definition: MSVehicle.h:627
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1301
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1273
a vehicles
const Position geometryPositionAtOffset(SUMOReal offset) const
Definition: MSLane.h:339
SUMOReal getMaxSpeed() const
Returns the maximum speed.
DriveItemVector myLFLinkLanes
Container for used Links/visited Lanes during lookForward.
Definition: MSVehicle.h:1377
SUMOReal pos() const
Position of this state.
Definition: MSVehicle.cpp:128
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
SUMOReal getImpatience() const
Returns this vehicles impatience.
void drawBestLanes() const
Draws the vehicle&#39;s best lanes.
Definition: GUIVehicle.cpp:397
SUMOReal getLeaveSpeed() const
Definition: MSVehicle.h:1369
void drawAction_drawVehicleBrakeLight(SUMOReal length) const
Definition: GUIVehicle.cpp:320
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:413
Stores the information about how to visualize structures.
SUMOReal getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:375
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
render as a flexible city bus
void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:207
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:59
GUIVisualizationTextSettings vehicleName
SUMOReal getLength() const
Get vehicle&#39;s length [m].
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
Definition: MSVehicle.h:1292
SUMOReal getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:595
static void drawBoxLines(const PositionVector &geom, const std::vector< SUMOReal > &rots, const std::vector< SUMOReal > &lengths, SUMOReal width, int cornerDetail=0, SUMOReal offset=0)
Draws thick lines.
Definition: GLHelper.cpp:176
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
Definition: MSVehicle.cpp:2464
T MAX2(T a, T b)
Definition: StdDefs.h:75
SUMOReal getNaviDegree() const
return the current angle in navigational degrees
Definition: GUIVehicle.cpp:561
unsigned int getPersonNumber() const
Returns the number of persons.
Definition: MSVehicle.cpp:2562
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
const MSRoute * myRoute
This Vehicle&#39;s route.
SUMOReal getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:2452
const std::map< std::string, std::string > & getMap() const
Returns the inner key/value map.
const std::vector< SUMOReal > & getShapeLengths() const
Definition: GUILane.cpp:737
SUMOReal getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:340
const SUMOVehicleParameter * myParameter
This Vehicle&#39;s parameter.
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:52
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
Position positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:123
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
void drawAction_drawVehicleBlinker(SUMOReal length) const
Definition: GUIVehicle.cpp:301
#define abs(a)
Definition: polyfonts.c:67
The car-following model and parameter.
Definition: MSVehicleType.h:74
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:2025
SUMOReal scale
information about a lane&#39;s width (temporary, used for a single view)
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:601
Right blinker lights are switched on.
Definition: MSVehicle.h:860
PositionVector mySeatPositions
positions of seats in the vehicle (updated at every drawing step)
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:70
SUMOReal getElectricityConsumption() const
Returns electricity consumption of the current state.
Definition: MSVehicle.cpp:2488
static void drawFilledCircle(SUMOReal width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:344
const std::string & getID() const
Returns the id.
Definition: Named.h:65
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:180
bool drawAction_drawVehicleAsImage(const GUIVisualizationSettings &s, SUMOReal length=-1) const
Left blinker lights are switched on.
Definition: MSVehicle.h:862
unsigned int getContainerNumber() const
Returns the number of containers.
Definition: MSVehicle.cpp:2568
#define PI
Definition: polyfonts.c:61
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, const SUMOReal speedFactor)
Constructor.
Definition: GUIVehicle.cpp:86
const SUMOVTypeParameter & getParameter() const
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:443
SUMOReal getMinGap() const
Get the free space in front of vehicles of this class.
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the subpart of best lanes that describes the vehicle&#39;s current lane and their successors...
Definition: MSVehicle.cpp:2340
SUMOTime getDepartDelay() const
Returns the depart delay.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
A list of positions.
std::list< Stop > myStops
The vehicle&#39;s list of stops.
Definition: MSVehicle.h:1289
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:65
MSLane * getPreviousLane(MSLane *current, int &furtherIndex) const
Definition: GUIVehicle.cpp:452
const std::vector< MSTransportable * > & getTransportables() const
Returns the list of transportables using this vehicle.
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:933
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1276
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:864
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:96
void setPositionInVehicle(const Position &pos)
Definition: GUIPerson.h:119
render as a (city) rail without locomotive
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.
The brake lights are on.
Definition: MSVehicle.h:866
SUMOReal getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs...
Definition: MSVehicle.h:444
A blue emergency light is on.
Definition: MSVehicle.h:882
int getNumPassengers() const
return the number of passengers
Definition: GUIVehicle.cpp:567
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
SUMOReal getMaxDecel() const
Get the vehicle type&#39;s maximum deceleration [m/s^2].
Definition: MSCFModel.h:186
#define BLINKER_POS_BACK
Definition: GUIVehicle.cpp:284
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:54
unsigned int getPersonCapacity() const
Get this vehicle type&#39;s person capacity.
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:939
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Definition: MSVehicle.cpp:2494
static SUMOReal naviDegree(const SUMOReal angle)
Definition: GeomHelper.cpp:191
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:178
std::string line
The vehicle&#39;s line (mainly for public transport)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:246
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:2470
void setPositionInVehicle(const Position &pos)
Definition: GUIContainer.h:118
render as a cargo train
SUMOReal getPMxEmissions() const
Returns PMx emission of the current state.
Definition: MSVehicle.cpp:2476
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:2458
void computeSeats(const Position &front, const Position &back, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
Definition: GUIVehicle.cpp:576
void unlock()
release mutex lock
Definition: MFXMutex.cpp:96
SUMOReal getWidth() const
Get the width which vehicles of this class shall have when being drawn.
Structure representing possible vehicle parameter.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
Definition: MSRoute.cpp:84
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
SUMOReal getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:707
SUMOReal getAcceleration() const
Returns the vehicle&#39;s acceleration in m/s.
Definition: MSVehicle.h:356
static void drawLinkItem(const Position &pos, SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal exagerate)
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:232
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:2482
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
Definition: MSBaseVehicle.h:93
SUMOReal getChosenSpeedFactor() const
Returns the precomputed factor by which the driver wants to be faster than the speed limit...
const std::string & getID() const
Returns the name of the vehicle type.
void drawAction_drawBlinker(double dir, SUMOReal length)
Definition: GUIVehicle.cpp:287
SUMOReal getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:348
const SUMOVehicleParameter & getParameter() const
Returns the vehicle&#39;s parameter (including departure definition)
void lock()
lock mutex
Definition: MFXMutex.cpp:86
SUMOReal getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:434
const Position & getSeatPosition(size_t personIndex) const
returns the seat position for the person with the given index
static SUMOTime gWaitingTimeMemory
length of memory for waiting times (in millisecs)
Definition: MSGlobals.h:102
unsigned size() const
Returns the number of edges to pass.
Definition: MSRoute.cpp:90
const PositionVector & getShape() const
Returns this lane&#39;s shape.
Definition: MSLane.h:322
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:232
static void drawLine(const Position &beg, SUMOReal rot, SUMOReal visLength)
Draws a thin line.
Definition: GLHelper.cpp:269
void drawAction_drawRailCarriages(const GUIVisualizationSettings &s, SUMOReal defaultLength, SUMOReal carriageGap, int firstPassengerCarriage, bool asImage) const
Definition: GUIVehicle.cpp:462
void move2side(SUMOReal amount)
#define BLINKER_POS_FRONT
Definition: GUIVehicle.cpp:283
unsigned int getContainerCapacity() const
Get this vehicle type&#39;s container capacity.
#define SUMOReal
Definition: config.h:213
GUIVisualizationSizeSettings vehicleSize
void drawRouteHelper(const MSRoute &r, SUMOReal exaggeration) const
Draws the route.
Definition: GUIVehicle.cpp:432
unsigned int size() const
Return the number of passengers / containers.
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane&#39;s maximum speed, given a vehicle&#39;s speed limit adaptation.
Definition: MSLane.h:353
SUMOEmissionClass getEmissionClass() const
Get this vehicle type&#39;s emission class.
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:385
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
Definition: MSVehicle.cpp:2442
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
GUISelectedStorage gSelected
A global holder of selected objects.
void closeBuilding()
Closes the building of the table.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
std::vector< MSDevice * > myDevices
The devices this vehicle has.
A window containing a gl-object&#39;s parameter.
SUMOReal getAngle() const
Return current angle.
Definition: GUIVehicle.h:89
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:336
SUMOReal getExaggeration(const GUIVisualizationSettings &s) const
return the drawing size including exaggeration and constantSize values
int getBestLaneOffset() const
returns the current offset from the best lane
Definition: MSVehicle.cpp:2368
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:78
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
Definition: MSVehicle.h:1295
const std::string & getID() const
Returns the name of the vehicle.
const PositionVector & getShape() const
Definition: GUILane.cpp:725
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:449
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:61