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-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>
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>
61 #include <gui/GUIGlobals.h>
62 #include "GUIVehicle.h"
63 #include "GUIPerson.h"
64 #include "GUIContainer.h"
65 #include "GUINet.h"
66 #include "GUIEdge.h"
67 #include "GUILane.h"
68 
69 #ifdef CHECK_MEMORY_LEAKS
70 #include <foreign/nvwa/debug_new.h>
71 #endif // CHECK_MEMORY_LEAKS
72 
73 
74 // ===========================================================================
75 // FOX callback mapping
76 // ===========================================================================
77 
78 // Object implementation
79 
80 
81 /* -------------------------------------------------------------------------
82  * GUIVehicle - methods
83  * ----------------------------------------------------------------------- */
84 #ifdef _MSC_VER
85 #pragma warning(disable: 4355)
86 #endif
88  const MSVehicleType* type, const SUMOReal speedFactor) :
89  MSVehicle(pars, route, type, speedFactor),
90  GUIBaseVehicle((MSBaseVehicle&)*this) {
91 }
92 #ifdef _MSC_VER
93 #pragma warning(default: 4355)
94 #endif
95 
96 
98 }
99 
100 
105  new GUIParameterTableWindow(app, *this, 40);
106  // add items
107  ret->mkItem("lane [id]", false, myLane->getID());
108  ret->mkItem("position [m]", true,
110  ret->mkItem("speed [m/s]", true,
112  ret->mkItem("angle [degree]", true,
114  if (getChosenSpeedFactor() != 1) {
115  ret->mkItem("speed factor", false, getChosenSpeedFactor());
116  }
117  ret->mkItem("time gap [s]", true,
119  ret->mkItem("waiting time [s]", true,
121  ret->mkItem("impatience", true,
123  ret->mkItem("last lane change [s]", true,
125  ret->mkItem("desired depart [s]", false, time2string(getParameter().depart));
126  ret->mkItem("depart delay [s]", false, time2string(getDepartDelay()));
127  if (getParameter().repetitionNumber < INT_MAX) {
128  ret->mkItem("remaining [#]", false, (unsigned int) getParameter().repetitionNumber - getParameter().repetitionsDone);
129  }
130  if (getParameter().repetitionOffset > 0) {
131  ret->mkItem("insertion period [s]", false, time2string(getParameter().repetitionOffset));
132  }
133  if (getParameter().repetitionProbability > 0) {
134  ret->mkItem("insertion probability", false, getParameter().repetitionProbability);
135  }
136  ret->mkItem("stop info", false, getStopInfo());
137  ret->mkItem("line", false, myParameter->line);
138  ret->mkItem("CO2 [mg/s]", true,
140  ret->mkItem("CO [mg/s]", true,
142  ret->mkItem("HC [mg/s]", true,
144  ret->mkItem("NOx [mg/s]", true,
146  ret->mkItem("PMx [mg/s]", true,
148  ret->mkItem("fuel [ml/s]", true,
150  ret->mkItem("noise (Harmonoise) [dB]", true,
152  std::ostringstream str;
153  for (std::vector<MSDevice*>::const_iterator i = myDevices.begin(); i != myDevices.end(); ++i) {
154  if (i != myDevices.begin()) {
155  str << ' ';
156  }
157  str << (*i)->getID().substr(0, (*i)->getID().find(getID()));
158  }
159  ret->mkItem("devices", false, str.str());
160  ret->mkItem("persons", true,
162  ret->mkItem("containers", true,
164 
165  ret->mkItem("parameters [key:val]", false, toString(getParameter().getMap()));
166  ret->mkItem("", false, "");
167  ret->mkItem("Type Information:", false, "");
168  ret->mkItem("type [id]", false, myType->getID());
169  ret->mkItem("length", false, myType->getLength());
170  ret->mkItem("minGap", false, myType->getMinGap());
171  ret->mkItem("vehicle class", false, SumoVehicleClassStrings.getString(myType->getVehicleClass()));
172  ret->mkItem("emission class", false, PollutantsInterface::getName(myType->getEmissionClass()));
173  ret->mkItem("maximum speed [m/s]", false, getMaxSpeed());
174  ret->mkItem("maximum acceleration [m/s^2]", false, getCarFollowModel().getMaxAccel());
175  ret->mkItem("maximum deceleration [m/s^2]", false, getCarFollowModel().getMaxDecel());
176  ret->mkItem("imperfection (sigma)", false, getCarFollowModel().getImperfection());
177  ret->mkItem("reaction time (tau)", false, getCarFollowModel().getHeadwayTime());
178  ret->mkItem("person capacity", false, myType->getPersonCapacity());
179  ret->mkItem("container capacity", false, myType->getContainerCapacity());
180 
181  ret->mkItem("type parameters [key:val]", false, toString(myType->getParameter().getMap()));
182  // close building
183  ret->closeBuilding();
184  return ret;
185 }
186 
187 
188 void
190  if (myPersonDevice != 0) {
191  const std::vector<MSTransportable*>& ps = myPersonDevice->getPersons();
192  size_t personIndex = 0;
193  for (std::vector<MSTransportable*>::const_iterator i = ps.begin(); i != ps.end(); ++i) {
194  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
195  assert(person != 0);
196  person->setPositionInVehicle(getSeatPosition(personIndex++));
197  person->drawGL(s);
198  }
199  }
200  if (myContainerDevice != 0) {
201  const std::vector<MSTransportable*>& cs = myContainerDevice->getContainers();
202  size_t containerIndex = 0;
203  for (std::vector<MSTransportable*>::const_iterator i = cs.begin(); i != cs.end(); ++i) {
204  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
205  assert(container != 0);
206  container->setPositionInVehicle(getSeatPosition(containerIndex++));
207  container->drawGL(s);
208  }
209  }
210 }
211 
212 
213 void
215  for (DriveItemVector::const_iterator i = myLFLinkLanes.begin(); i != myLFLinkLanes.end(); ++i) {
216  if ((*i).myLink == 0) {
217  continue;
218  }
219  MSLink* link = (*i).myLink;
220  MSLane* via = link->getViaLaneOrLane();
221  if (via != 0) {
222  Position p = via->getShape()[0];
223  if ((*i).mySetRequest) {
224  glColor3d(0, .8, 0);
225  } else {
226  glColor3d(.8, 0, 0);
227  }
228  const SUMOTime leaveTime = (*i).myLink->getLeaveTime(
229  (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(), getVehicleType().getLengthWithGap());
230  drawLinkItem(p, (*i).myArrivalTime, leaveTime, s.vehicleName.size / s.scale);
231  // the time slot that ego vehicle uses when checking opened may
232  // differ from the one it requests in setApproaching
233  MSLink::ApproachingVehicleInformation avi = (*i).myLink->getApproaching(this);
234  assert(avi.arrivalTime == (*i).myArrivalTime && avi.leavingTime == leaveTime);
235  UNUSED_PARAMETER(avi); // only used for assertion
236  }
237  }
238 }
239 
240 
241 bool
243  switch (guiShape) {
244  case SVS_BUS_FLEXIBLE:
245  drawAction_drawRailCarriages(s, 8.25, 0, 0, asImage); // 16.5 overall, 2 modules http://de.wikipedia.org/wiki/Ikarus_180
246  break;
247  case SVS_RAIL:
248  drawAction_drawRailCarriages(s, 24.5, 1, 1, asImage); // http://de.wikipedia.org/wiki/UIC-Y-Wagen_%28DR%29
249  break;
250  case SVS_RAIL_CAR:
251  drawAction_drawRailCarriages(s, 16.85, 1, 0, asImage); // 67.4m overall, 4 carriages http://de.wikipedia.org/wiki/DB-Baureihe_423
252 // drawAction_drawRailCarriages(s, 5.71, 0, 0, asImage); // 40.0m overall, 7 modules http://de.wikipedia.org/wiki/Bombardier_Flexity_Berlin
253 // drawAction_drawRailCarriages(s, 9.44, 1, 1, asImage); // actually length of the locomotive http://de.wikipedia.org/wiki/KJI_Nr._20_und_21
254 // drawAction_drawRailCarriages(s, 24.775, 0, 0, asImage); // http://de.wikipedia.org/wiki/ICE_3
255  break;
256  case SVS_RAIL_CARGO:
257  drawAction_drawRailCarriages(s, 13.86, 1, 0, asImage); // UIC 571-1 http://de.wikipedia.org/wiki/Flachwagen
258  break;
259  default:
260  return false;
261  }
262  return true;
263 }
264 
265 #define BLINKER_POS_FRONT .5
266 #define BLINKER_POS_BACK .5
267 
268 inline void
269 drawAction_drawBlinker(double dir, SUMOReal length) {
270  glColor3d(1.f, .8f, 0);
271  glPushMatrix();
272  glTranslated(dir, BLINKER_POS_FRONT, -0.1);
274  glPopMatrix();
275  glPushMatrix();
276  glTranslated(dir, length - BLINKER_POS_BACK, -0.1);
278  glPopMatrix();
279 }
280 
281 
282 void
285  return;
286  }
287  const double offset = MAX2(.5 * getVehicleType().getWidth(), .4);
289  drawAction_drawBlinker(-offset, length);
290  }
292  drawAction_drawBlinker(offset, length);;
293  }
295  drawAction_drawBlinker(-offset, length);
296  drawAction_drawBlinker(offset, length);
297  }
298 }
299 
300 
301 inline void
304  return;
305  }
306  glColor3f(1.f, .2f, 0);
307  glPushMatrix();
308  glTranslated(-getVehicleType().getWidth() * 0.5, length, -0.1);
310  glPopMatrix();
311  glPushMatrix();
312  glTranslated(getVehicleType().getWidth() * 0.5, length, -0.1);
314  glPopMatrix();
315 }
316 
317 inline void
320  glPushMatrix();
321  glTranslated(0, 2.5, .5);
322  glColor3f(0, 0, 1);
324  glPopMatrix();
325  }
326 }
327 
328 
329 SUMOReal
330 GUIVehicle::getColorValue(size_t activeScheme) const {
331  switch (activeScheme) {
332  case 8:
333  return getSpeed();
334  case 9:
335  return getWaitingSeconds();
336  case 10:
337  return getLastLaneChangeOffset();
338  case 11:
339  return getLane()->getVehicleMaxSpeed(this);
340  case 12:
341  return getCO2Emissions();
342  case 13:
343  return getCOEmissions();
344  case 14:
345  return getPMxEmissions();
346  case 15:
347  return getNOxEmissions();
348  case 16:
349  return getHCEmissions();
350  case 17:
351  return getFuelConsumption();
352  case 18:
354  case 19: // !!! unused!?
355  if (getNumberReroutes() == 0) {
356  return -1;
357  }
358  return getNumberReroutes();
359  case 20:
361  case 21:
362  return getBestLaneOffset();
363  case 22:
364  return getAcceleration();
365  case 23:
366  return getTimeGap();
367  case 24:
368  return STEPS2TIME(getDepartDelay());
369  }
370  return 0;
371 }
372 
373 
374 void
376  myLock.lock();
377  std::vector<std::vector<MSVehicle::LaneQ> > bestLanes = myBestLanes;
378  myLock.unlock();
379  SUMOReal width = 0.5;
380  for (std::vector<std::vector<MSVehicle::LaneQ> >::iterator j = bestLanes.begin(); j != bestLanes.end(); ++j) {
381  std::vector<MSVehicle::LaneQ>& lanes = *j;
382  SUMOReal gmax = -1;
383  SUMOReal rmax = -1;
384  for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
385  gmax = MAX2((*i).length, gmax);
386  rmax = MAX2((*i).occupation, rmax);
387  }
388  for (std::vector<MSVehicle::LaneQ>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
389  const PositionVector& shape = (*i).lane->getShape();
390  SUMOReal g = (*i).length / gmax;
391  SUMOReal r = (*i).occupation / rmax;
392  glColor3d(r, g, 0);
393  GLHelper::drawBoxLines(shape, width);
394 
395  PositionVector s1 = shape;
396  s1.move2side((SUMOReal) .1);
397  glColor3d(r, 0, 0);
398  GLHelper::drawLine(s1);
399  s1.move2side((SUMOReal) - .2);
400  glColor3d(0, g, 0);
401  GLHelper::drawLine(s1);
402 
403  glColor3d(r, g, 0);
404  Position lastPos = shape[-1];
405  }
406  width = .2;
407  }
408 }
409 
410 
411 void
412 GUIVehicle::drawRouteHelper(const MSRoute& r, SUMOReal exaggeration) const {
413  MSRouteIterator i = r.begin();
414  const std::vector<MSLane*>& bestLaneConts = getBestLanesContinuation();
415  // draw continuation lanes when drawing the current route where available
416  size_t bestLaneIndex = (&r == myRoute ? 0 : bestLaneConts.size());
417  for (; i != r.end(); ++i) {
418  const GUILane* lane;
419  if (bestLaneIndex < bestLaneConts.size() && bestLaneConts[bestLaneIndex] != 0 && (*i) == &(bestLaneConts[bestLaneIndex]->getEdge())) {
420  lane = static_cast<GUILane*>(bestLaneConts[bestLaneIndex]);
421  ++bestLaneIndex;
422  } else {
423  lane = static_cast<GUILane*>((*i)->getLanes()[0]);
424  }
425  GLHelper::drawBoxLines(lane->getShape(), lane->getShapeRotations(), lane->getShapeLengths(), exaggeration);
426  }
427 }
428 
429 
430 
431 MSLane*
432 GUIVehicle::getPreviousLane(MSLane* current, int& furtherIndex) const {
433  if (furtherIndex < (int)myFurtherLanes.size()) {
434  return myFurtherLanes[furtherIndex++];
435  } else {
436  return current;
437  }
438 }
439 
440 
441 void
442 GUIVehicle::drawAction_drawRailCarriages(const GUIVisualizationSettings& s, SUMOReal defaultLength, SUMOReal carriageGap, int firstPassengerCarriage, bool asImage) const {
443  RGBColor current = GLHelper::getColor();
444  RGBColor darker = current.changedBrightness(-51);
445  const SUMOReal exaggeration = s.vehicleSize.getExaggeration(s);
446  defaultLength *= exaggeration;
447  if (exaggeration == 0) {
448  return;
449  }
450  carriageGap *= exaggeration;
451  const SUMOReal length = getVehicleType().getLength() * exaggeration;
452  const SUMOReal halfWidth = getVehicleType().getWidth() / 2.0 * exaggeration;
453  glPopMatrix(); // undo scaling and 90 degree rotation
454  glPopMatrix(); // undo initial translation and rotation
455  GLHelper::setColor(darker);
456  const SUMOReal xCornerCut = 0.3 * exaggeration;
457  const SUMOReal yCornerCut = 0.4 * exaggeration;
458  // round to closest integer
459  const int numCarriages = floor(length / (defaultLength + carriageGap) + 0.5);
460  assert(numCarriages > 0);
461  const SUMOReal carriageLengthWithGap = length / numCarriages;
462  const SUMOReal carriageLength = carriageLengthWithGap - carriageGap;
463  // lane on which the carriage front is situated
464  MSLane* lane = myLane;
465  int furtherIndex = 0;
466  // lane on which the carriage back is situated
467  MSLane* backLane = myLane;
468  int backFurtherIndex = furtherIndex;
469  // offsets of front and back
470  SUMOReal carriageOffset = myState.pos();
471  SUMOReal carriageBackOffset = myState.pos() - carriageLength;
472  // handle seats
473  int requiredSeats = getNumPassengers();
474  if (requiredSeats > 0) {
475  mySeatPositions.clear();
476  }
477  Position front, back;
478  SUMOReal angle = 0.;
479  // draw individual carriages
480  for (int i = 0; i < numCarriages; ++i) {
481  while (carriageOffset < 0) {
482  MSLane* prev = getPreviousLane(lane, furtherIndex);
483  if (prev != lane) {
484  carriageOffset += prev->getLength();
485  } else {
486  // no lane available for drawing.
487  carriageOffset = 0;
488  }
489  lane = prev;
490  }
491  while (carriageBackOffset < 0) {
492  MSLane* prev = getPreviousLane(backLane, backFurtherIndex);
493  if (prev != backLane) {
494  carriageBackOffset += prev->getLength();
495  } else {
496  // no lane available for drawing.
497  carriageBackOffset = 0;
498  }
499  backLane = prev;
500  }
501  front = lane->getShape().positionAtOffset2D(carriageOffset);
502  back = backLane->getShape().positionAtOffset2D(carriageBackOffset);
503  if (front == back) {
504  // no place for drawing available
505  continue;
506  }
507  angle = atan2((front.x() - back.x()), (back.y() - front.y())) * (SUMOReal) 180.0 / (SUMOReal) PI;
508  if (i >= firstPassengerCarriage) {
509  computeSeats(front, back, requiredSeats);
510  }
511  glPushMatrix();
512  glTranslated(front.x(), front.y(), getType());
513  glRotated(angle, 0, 0, 1);
514  if (!asImage || !drawAction_drawVehicleAsImage(s, carriageLength)) {
515  glBegin(GL_TRIANGLE_FAN);
516  glVertex2d(-halfWidth + xCornerCut, 0);
517  glVertex2d(-halfWidth, yCornerCut);
518  glVertex2d(-halfWidth, carriageLength - yCornerCut);
519  glVertex2d(-halfWidth + xCornerCut, carriageLength);
520  glVertex2d(halfWidth - xCornerCut, carriageLength);
521  glVertex2d(halfWidth, carriageLength - yCornerCut);
522  glVertex2d(halfWidth, yCornerCut);
523  glVertex2d(halfWidth - xCornerCut, 0);
524  glEnd();
525  }
526  glPopMatrix();
527  carriageOffset -= carriageLengthWithGap;
528  carriageBackOffset -= carriageLengthWithGap;
529  GLHelper::setColor(current);
530  }
531  myCarriageLength = front.distanceTo2D(back);
532  // restore matrices
533  glPushMatrix();
534  glTranslated(front.x(), front.y(), getType());
535  glRotated(angle, 0, 0, 1);
536  glPushMatrix();
537 }
538 
539 
540 SUMOReal
543 }
544 
545 
546 int
548  if (myPersonDevice != 0) {
549  return (int)myPersonDevice->getPersons().size();
550  }
551  return 0;
552 }
553 
554 
555 void
556 GUIVehicle::computeSeats(const Position& front, const Position& back, int& requiredSeats) const {
557  if (requiredSeats <= 0) {
558  return; // save some work
559  }
560  const SUMOReal length = front.distanceTo2D(back);
561  if (length < 4) {
562  // small vehicle, sit at the center
563  mySeatPositions.push_back(PositionVector::positionAtOffset2D(front, back, length / 2));
564  requiredSeats--;
565  } else {
566  for (SUMOReal p = 2; p <= length - 1; p += 1) {
567  mySeatPositions.push_back(PositionVector::positionAtOffset2D(front, back, p));
568  requiredSeats--;
569  }
570  }
571 }
572 
573 
574 SUMOReal
577 }
578 
579 
580 std::string
582  std::string result = "";
583  if (isParking()) {
584  result += "parking";
585  } else if (isStopped()) {
586  result += "stopped";
587  } else {
588  return "";
589  }
590  if (myStops.front().triggered) {
591  result += ", triggered";
592  } else if (myStops.front().containerTriggered) {
593  result += ", containerTriggered";
594  } else {
595  result += ", duration=" + time2string(myStops.front().duration);
596  }
597  return result;
598 }
599 
600 
601 void
604  for (DriveItemVector::const_iterator i = myLFLinkLanes.begin(); i != myLFLinkLanes.end(); ++i) {
605  const DriveProcessItem& dpi = *i;
606  if (dpi.myLink == 0) {
607  continue;
608  }
609  std::vector<const SUMOVehicle*> blockingFoes;
610  std::vector<const MSPerson*> blockingPersons;
612  getImpatience(), getCarFollowModel().getMaxDecel(), getWaitingTime(), &blockingFoes);
613  for (std::vector<const SUMOVehicle*>::const_iterator it = blockingFoes.begin(); it != blockingFoes.end(); ++it) {
614  gSelected.select(static_cast<const GUIVehicle*>(*it)->getGlID());
615  }
616 #ifdef HAVE_INTERNAL_LANES
617  const MSLink::LinkLeaders linkLeaders = (dpi.myLink)->getLeaderInfo(dist, getVehicleType().getMinGap(), &blockingPersons);
618  for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
619  // the vehicle to enter the junction first has priority
620  const GUIVehicle* leader = dynamic_cast<const GUIVehicle*>(it->vehAndGap.first);
621  if (leader != 0) {
622  if (dpi.myLink->isLeader(this, leader)) {
623  gSelected.select(leader->getGlID());
624  }
625  } else {
626  for (std::vector<const MSPerson*>::iterator it_p = blockingPersons.begin(); it_p != blockingPersons.end(); ++it_p) {
627  const GUIPerson* foe = dynamic_cast<const GUIPerson*>(*it_p);
628  if (foe != 0) {
629  gSelected.select(foe->getGlID());
630  //std::cout << SIMTIME << " veh=" << getID() << " is blocked on link " << dpi.myLink->getRespondIndex() << " to " << dpi.myLink->getViaLaneOrLane()->getID() << " by pedestrian. dist=" << it->second << "\n";
631  }
632  }
633  }
634  }
635 #endif
636  dist += dpi.myLink->getViaLaneOrLane()->getLength();
637  }
638 }
639 
640 /****************************************************************************/
641 
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:844
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:102
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:602
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:330
const std::vector< SUMOReal > & getShapeRotations() const
Definition: GUILane.cpp:732
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:242
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:1193
const MSCFModel & getCarFollowModel() const
Returns the vehicle&#39;s car following model definition.
Definition: MSVehicle.h:544
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1210
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1183
a vehicles
SUMOReal getMaxSpeed() const
Returns the maximum speed.
DriveItemVector myLFLinkLanes
Container for used Links/visited Lanes during lookForward.
Definition: MSVehicle.h:1283
SUMOReal pos() const
Position of this state.
Definition: MSVehicle.cpp:134
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
SUMOReal getLengthWithGap() const
Get vehicle&#39;s length including the minimum gap [m].
SUMOReal getImpatience() const
Returns this vehicles impatience.
void drawBestLanes() const
Draws the vehicle&#39;s best lanes.
Definition: GUIVehicle.cpp:375
SUMOReal getLeaveSpeed() const
Definition: MSVehicle.h:1275
void drawAction_drawVehicleBrakeLight(SUMOReal length) const
Definition: GUIVehicle.cpp:302
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:359
Stores the information about how to visualize structures.
SUMOReal getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:376
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:189
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:61
GUIVisualizationTextSettings vehicleName
SUMOReal getLength() const
Get vehicle&#39;s length [m].
SUMOReal getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:575
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:2308
T MAX2(T a, T b)
Definition: StdDefs.h:79
SUMOReal getNaviDegree() const
return the current angle in navigational degrees
Definition: GUIVehicle.cpp:541
unsigned int getPersonNumber() const
Returns the number of persons.
Definition: MSVehicle.cpp:2380
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:2296
const std::map< std::string, std::string > & getMap() const
Returns the inner key/value map.
const std::vector< SUMOReal > & getShapeLengths() const
Definition: GUILane.cpp:738
SUMOReal getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:286
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:283
The car-following model and parameter.
Definition: MSVehicleType.h:74
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:1904
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:581
Right blinker lights are switched on.
Definition: MSVehicle.h:766
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
const std::vector< MSTransportable * > & getPersons() const
Returns the list of persons using this vehicle.
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:167
bool drawAction_drawVehicleAsImage(const GUIVisualizationSettings &s, SUMOReal length=-1) const
Left blinker lights are switched on.
Definition: MSVehicle.h:768
unsigned int getContainerNumber() const
Returns the number of containers.
Definition: MSVehicle.cpp:2386
#define PI
Definition: polyfonts.c:61
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, const SUMOReal speedFactor)
Constructor.
Definition: GUIVehicle.cpp:87
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:2188
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:1198
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:61
MSLane * getPreviousLane(MSLane *current, int &furtherIndex) const
Definition: GUIVehicle.cpp:432
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:827
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1186
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:770
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:97
void setPositionInVehicle(const Position &pos)
Definition: GUIPerson.h:120
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:772
A blue emergency light is on.
Definition: MSVehicle.h:788
int getNumPassengers() const
return the number of passengers
Definition: GUIVehicle.cpp:547
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:184
#define BLINKER_POS_BACK
Definition: GUIVehicle.cpp:266
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SUMOReal myCarriageLength
Variable to set with the length of the last drawn carriage or the vehicle length. ...
const std::vector< MSTransportable * > & getContainers() const
Returns the list of containers using this vehicle.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:53
unsigned int getPersonCapacity() const
Get this vehicle type&#39;s person capacity.
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:833
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Definition: MSVehicle.cpp:2332
static SUMOReal naviDegree(const SUMOReal angle)
Definition: GeomHelper.cpp:191
std::string line
The vehicle&#39;s line (mainly for public transport)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:250
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:2314
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:2320
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:2302
void computeSeats(const Position &front, const Position &back, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
Definition: GUIVehicle.cpp:556
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:81
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
SUMOReal getAcceleration() const
Returns the vehicle&#39;s acceleration in m/s.
Definition: MSVehicle.h:302
static void drawLinkItem(const Position &pos, SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal exagerate)
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:214
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:2326
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:269
SUMOReal getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:294
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:370
const Position & getSeatPosition(size_t personIndex) const
returns the seat position for the person with the given index
unsigned size() const
Returns the number of edges to pass.
Definition: MSRoute.cpp:87
const PositionVector & getShape() const
Returns this lane&#39;s shape.
Definition: MSLane.h:323
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:442
void move2side(SUMOReal amount)
#define BLINKER_POS_FRONT
Definition: GUIVehicle.cpp:265
unsigned int getContainerCapacity() const
Get this vehicle type&#39;s container capacity.
#define SUMOReal
Definition: config.h:214
GUIVisualizationSizeSettings vehicleSize
void drawRouteHelper(const MSRoute &r, SUMOReal exaggeration) const
Draws the route.
Definition: GUIVehicle.cpp:412
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:354
SUMOEmissionClass getEmissionClass() const
Get this vehicle type&#39;s emission class.
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:331
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
Definition: MSVehicle.cpp:2286
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
MSDevice_Container * myContainerDevice
The containers this vehicle may have.
Definition: MSVehicle.h:1204
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:318
SUMOReal getExaggeration(const GUIVisualizationSettings &s) const
return the drawing size including exaggeration and constantSize values
MSDevice_Person * myPersonDevice
The passengers this vehicle may have.
Definition: MSVehicle.h:1201
int getBestLaneOffset() const
returns the current offset from the best lane
Definition: MSVehicle.cpp:2216
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:75
const std::string & getID() const
Returns the name of the vehicle.
const PositionVector & getShape() const
Definition: GUILane.cpp:726
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