SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUILane.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Representation of a lane in the micro simulation (gui-version)
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-2014 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 <string>
34 #include <utility>
36 #include <utils/geom/GeomHelper.h>
37 #include <utils/geom/Position.h>
40 #include <utils/common/StdDefs.h>
41 #include <utils/geom/GeomHelper.h>
42 #include <utils/gui/div/GLHelper.h>
47 #include <microsim/MSLane.h>
50 #include <microsim/MSNet.h>
52 #include "GUILane.h"
53 #include "GUIEdge.h"
54 #include "GUIVehicle.h"
55 #include "GUINet.h"
56 
57 #ifdef HAVE_OSG
58 #include <osg/Geometry>
59 #endif
60 
61 #ifdef CHECK_MEMORY_LEAKS
62 #include <foreign/nvwa/debug_new.h>
63 #endif // CHECK_MEMORY_LEAKS
64 
65 
66 // ===========================================================================
67 // method definitions
68 // ===========================================================================
69 GUILane::GUILane(const std::string& id, SUMOReal maxSpeed, SUMOReal length,
70  MSEdge* const edge, unsigned int numericalID,
71  const PositionVector& shape, SUMOReal width,
72  SVCPermissions permissions, unsigned int index)
73  : MSLane(id, maxSpeed, length, edge, numericalID, shape, width, permissions),
74  GUIGlObject(GLO_LANE, id) {
75  myShapeRotations.reserve(myShape.size() - 1);
76  myShapeLengths.reserve(myShape.size() - 1);
77  int e = (int) myShape.size() - 1;
78  for (int i = 0; i < e; ++i) {
79  const Position& f = myShape[i];
80  const Position& s = myShape[i + 1];
81  myShapeLengths.push_back(f.distanceTo2D(s));
82  myShapeRotations.push_back(RAD2DEG(atan2(s.x() - f.x(), f.y() - s.y())));
83  }
84  //
87  myIndex = index;
88 }
89 
90 
92  // just to quit cleanly on a failure
93  if (myLock.locked()) {
94  myLock.unlock();
95  }
96 }
97 
98 
99 // ------ Vehicle insertion ------
100 void
102  const MSLane::VehCont::iterator& at,
103  MSMoveReminder::Notification notification) {
105  MSLane::incorporateVehicle(veh, pos, speed, at, notification);
106 }
107 
108 
109 // ------ Access to vehicles ------
110 const MSLane::VehCont&
112  myLock.lock();
113  return myVehicles;
114 }
115 
116 
117 void
119  myLock.unlock();
120 }
121 
122 
123 void
127 }
128 
129 
130 bool
131 GUILane::executeMovements(SUMOTime t, std::vector<MSLane*>& into) {
133  return MSLane::executeMovements(t, into);
134 }
135 
136 
137 MSVehicle*
140  return MSLane::removeVehicle(remVehicle, notification);
141 }
142 
143 
144 void
148 }
149 
150 
151 bool
154  return MSLane::integrateNewVehicle(t);
155 }
156 
157 
158 void
159 GUILane::detectCollisions(SUMOTime timestep, const std::string& stage) {
161  MSLane::detectCollisions(timestep, stage);
162 }
163 
164 
165 // ------ Drawing methods ------
166 void
168  unsigned int noLinks = (unsigned int)myLinks.size();
169  if (noLinks == 0) {
170  return;
171  }
172  // draw all links
173  SUMOReal w = myWidth / (SUMOReal) noLinks;
175  glPushMatrix();
176  const PositionVector& g = getShape();
177  const Position& end = g.back();
178  const Position& f = g[-2];
179  const Position& s = end;
180  const SUMOReal rot = RAD2DEG(atan2((s.x() - f.x()), (f.y() - s.y())));
181  glTranslated(end.x(), end.y(), 0);
182  glRotated(rot, 0, 0, 1);
183  for (int i = noLinks; --i >= 0;) {
184  SUMOReal x2 = x1 - (SUMOReal)(w / 2.);
185  GLHelper::drawText(toString(myLinks[i]->getIndex()),
186  Position(x2, 0), 0, .6, RGBColor(128, 128, 255, 255), 180);
187  x1 -= w;
188  }
189  glPopMatrix();
190 }
191 
192 
193 void
194 GUILane::drawTLSLinkNo(const GUINet& net) const {
195  unsigned int noLinks = (unsigned int)myLinks.size();
196  if (noLinks == 0) {
197  return;
198  }
199  // draw all links
200  SUMOReal w = myWidth / (SUMOReal) noLinks;
202  glPushMatrix();
203  const PositionVector& g = getShape();
204  const Position& end = g.back();
205  const Position& f = g[-2];
206  const Position& s = end;
207  const SUMOReal rot = RAD2DEG(atan2((s.x() - f.x()), (f.y() - s.y())));
208  glTranslated(end.x(), end.y(), 0);
209  glRotated(rot, 0, 0, 1);
210  for (int i = noLinks; --i >= 0;) {
211  SUMOReal x2 = x1 - (SUMOReal)(w / 2.);
212  int linkNo = net.getLinkTLIndex(myLinks[i]);
213  if (linkNo < 0) {
214  continue;
215  }
217  Position(x2, 0), 0, .6, RGBColor(128, 128, 255, 255), 180);
218  x1 -= w;
219  }
220  glPopMatrix();
221 }
222 
223 
224 void
225 GUILane::drawLinkRules(const GUINet& net) const {
226  unsigned int noLinks = (unsigned int)myLinks.size();
227  const PositionVector& g = getShape();
228  const Position& end = g.back();
229  const Position& f = g[-2];
230  const Position& s = end;
231  const SUMOReal rot = RAD2DEG(atan2((s.x() - f.x()), (f.y() - s.y())));
232  if (noLinks == 0) {
233  glPushName(getGlID());
235  glPushMatrix();
236  glTranslated(end.x(), end.y(), 0);
237  glRotated(rot, 0, 0, 1);
238  glBegin(GL_QUADS);
239  glVertex2d(-myHalfLaneWidth, 0.0);
240  glVertex2d(-myHalfLaneWidth, 0.5);
241  glVertex2d(myHalfLaneWidth, 0.5);
242  glVertex2d(myHalfLaneWidth, 0.0);
243  glEnd();
244  glPopMatrix();
245  glPopName();
246  return;
247  }
248  // draw all links
249  const bool railway = isRailway(myPermissions);
250  SUMOReal w = myWidth / (SUMOReal) noLinks;
251  SUMOReal x1 = 0;
252  glPushMatrix();
253  glTranslated(end.x(), end.y(), 0);
254  glRotated(rot, 0, 0, 1);
255  for (unsigned int i = 0; i < noLinks; ++i) {
256  SUMOReal x2 = x1 + w;
257  MSLink* link = myLinks[i];
258  // select glID
259  switch (link->getState()) {
262  case LINKSTATE_TL_RED:
266  glPushName(net.getLinkTLID(link));
267  break;
268  case LINKSTATE_MAJOR:
269  case LINKSTATE_MINOR:
270  case LINKSTATE_EQUAL:
272  default:
273  glPushName(getGlID());
274  break;
275  }
277  if (!railway || link->getState() != LINKSTATE_MAJOR) {
278  // THE WHITE BAR SHOULD BE THE DEFAULT FOR MOST RAILWAY
279  // LINKS AND LOOKS UGLY SO WE DO NOT DRAW IT
280  glBegin(GL_QUADS);
281  glVertex2d(x1 - myHalfLaneWidth, 0.0);
282  glVertex2d(x1 - myHalfLaneWidth, 0.5);
283  glVertex2d(x2 - myHalfLaneWidth, 0.5);
284  glVertex2d(x2 - myHalfLaneWidth, 0.0);
285  glEnd();
286  }
287  glPopName();
288  x1 = x2;
289  x2 += w;
290  }
291  glPopMatrix();
292 }
293 
294 
295 void
297  if (myLinks.size() == 0) {
298  return;
299  }
300  // draw all links
301  const Position& end = getShape().back();
302  const Position& f = getShape()[-2];
303  const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
304  glPushMatrix();
305  glPushName(0);
306  glColor3d(1, 1, 1);
307  glTranslated(end.x(), end.y(), 0);
308  glRotated(rot, 0, 0, 1);
309  for (std::vector<MSLink*>::const_iterator i = myLinks.begin(); i != myLinks.end(); ++i) {
310  LinkDirection dir = (*i)->getDirection();
311  LinkState state = (*i)->getState();
312  if (state == LINKSTATE_TL_OFF_NOSIGNAL || dir == LINKDIR_NODIR) {
313  continue;
314  }
315  switch (dir) {
316  case LINKDIR_STRAIGHT:
317  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
319  break;
320  case LINKDIR_TURN:
321  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
322  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
323  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
324  GLHelper::drawTriangleAtEnd(Line(Position(0.5, 2.5), Position(0.5, 4)), (SUMOReal) 1, (SUMOReal) .25);
325  break;
326  case LINKDIR_LEFT:
327  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
328  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
329  GLHelper::drawTriangleAtEnd(Line(Position(0, 2.5), Position(1.5, 2.5)), (SUMOReal) 1, (SUMOReal) .25);
330  break;
331  case LINKDIR_RIGHT:
332  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
333  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
334  GLHelper::drawTriangleAtEnd(Line(Position(0, 2.5), Position(-1.5, 2.5)), (SUMOReal) 1, (SUMOReal) .25);
335  break;
336  case LINKDIR_PARTLEFT:
337  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
338  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
339  GLHelper::drawTriangleAtEnd(Line(Position(0, 2.5), Position(1.2, 1.3)), (SUMOReal) 1, (SUMOReal) .25);
340  break;
341  case LINKDIR_PARTRIGHT:
342  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
343  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
344  GLHelper::drawTriangleAtEnd(Line(Position(0, 2.5), Position(-1.2, 1.3)), (SUMOReal) 1, (SUMOReal) .25);
345  break;
346  default:
347  break;
348  }
349  }
350  glPopMatrix();
351  glPopName();
352 }
353 
354 
355 void
357  for (std::vector<MSLink*>::const_iterator i = myLinks.begin(); i != myLinks.end(); ++i) {
358  LinkState state = (*i)->getState();
359  const MSLane* connected = (*i)->getLane();
360  if (connected == 0) {
361  continue;
362  }
363  switch (state) {
366  glColor3d(0, 1, 0);
367  break;
368  case LINKSTATE_TL_RED:
369  glColor3d(1, 0, 0);
370  break;
373  glColor3d(1, 1, 0);
374  break;
376  glColor3d(1, 1, 0);
377  break;
379  glColor3d(0, 1, 1);
380  break;
381  case LINKSTATE_MAJOR:
382  glColor3d(1, 1, 1);
383  break;
384  case LINKSTATE_MINOR:
385  glColor3d(.2, .2, .2);
386  break;
387  case LINKSTATE_STOP:
388  glColor3d(.4, .2, .2);
389  break;
390  case LINKSTATE_EQUAL:
391  glColor3d(.5, .5, .5);
392  break;
394  glColor3d(.2, .2, .4);
395  break;
396  case LINKSTATE_DEADEND:
397  glColor3d(0, 0, 0);
398  break;
399  }
400 
401  glBegin(GL_LINES);
402  const Position& p1 = getShape()[-1];
403  const Position& p2 = connected->getShape()[0];
404  glVertex2f(p1.x(), p1.y());
405  glVertex2f(p2.x(), p2.y());
406  glEnd();
407  GLHelper::drawTriangleAtEnd(Line(p1, p2), (SUMOReal) .4, (SUMOReal) .2);
408  }
409 }
410 
411 
412 void
414  glPushMatrix();
415  const bool isInternal = myEdge->getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL;
416  bool mustDrawMarkings = false;
417  const bool drawDetails = s.scale * s.laneWidthExaggeration > 5;
418  if (isInternal) {
419  // draw internal lanes on top of junctions
420  glTranslated(0, 0, GLO_JUNCTION + 0.1);
421  } else {
422  glTranslated(0, 0, getType());
423  }
424  // set lane color
425  if (!MSGlobals::gUseMesoSim) {
426  setColor(s);
427  glPushName(getGlID()); // do not register for clicks in MESOSIM
428  }
429  // draw lane
430  // check whether it is not too small
431  if (s.scale * s.laneWidthExaggeration < 1.) {
433  if (!MSGlobals::gUseMesoSim) {
434  glPopName();
435  }
436  glPopMatrix();
437  } else {
438  if (isRailway(myPermissions)) {
439  // draw as railway
440  const SUMOReal halfRailWidth = 0.725 * s.laneWidthExaggeration;
442  glColor3d(1, 1, 1);
443  glTranslated(0, 0, .1);
446  } else {
447  const SUMOReal laneWidth = isInternal ? myQuarterLaneWidth : myHalfLaneWidth;
448  mustDrawMarkings = !isInternal;
450  }
451  if (!MSGlobals::gUseMesoSim) {
452  glPopName();
453  }
454  glPopMatrix();
455  // draw ROWs (not for inner lanes)
456  if (!isInternal && drawDetails) {
457  glPushMatrix();
458  glTranslated(0, 0, GLO_JUNCTION); // must draw on top of junction shape
459  GUINet* net = (GUINet*) MSNet::getInstance();
460  glTranslated(0, 0, .2);
461  drawLinkRules(*net);
463  drawArrows();
464  }
465  if (s.showLane2Lane) {
466  // this should be independent to the geometry:
467  // draw from end of first to the begin of second
469  }
470  glTranslated(0, 0, .1);
471  if (s.drawLinkJunctionIndex) {
472  drawLinkNo();
473  }
474  if (s.drawLinkTLIndex) {
475  drawTLSLinkNo(*net);
476  }
477  glPopMatrix();
478  }
479  }
480  if (mustDrawMarkings && drawDetails) { // needs matrix reset
482  }
483  // draw vehicles
484  if (s.scale > s.minVehicleSize) {
485  // retrieve vehicles from lane; disallow simulation
486  const MSLane::VehCont& vehicles = getVehiclesSecure();
487  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
488  if ((*v)->getLane() == this) {
489  static_cast<const GUIVehicle* const>(*v)->drawGL(s);
490  } // else: this is the shadow during a continuous lane change
491  }
492  // draw parking vehicles
493  const std::set<const MSVehicle*> parking = MSVehicleTransfer::getInstance()->getParkingVehicles(this);
494  for (std::set<const MSVehicle*>::const_iterator v = parking.begin(); v != parking.end(); ++v) {
495  static_cast<const GUIVehicle* const>(*v)->drawGL(s);
496  }
497  // allow lane simulation
498  releaseVehicles();
499  }
500 }
501 
502 
503 void
505  glPushMatrix();
506  glPushName(0);
507  glTranslated(0, 0, GLO_EDGE);
508 #ifdef HAVE_INTERNAL
510 #endif
511  setColor(s);
512  // optionally draw inverse markings
513  if (myIndex > 0) {
514  SUMOReal mw = (myHalfLaneWidth + SUMO_const_laneOffset + .01) * scale;
515  int e = (int) getShape().size() - 1;
516  for (int i = 0; i < e; ++i) {
517  glPushMatrix();
518  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
519  glRotated(myShapeRotations[i], 0, 0, 1);
520  for (SUMOReal t = 0; t < myShapeLengths[i]; t += 6) {
521  glBegin(GL_QUADS);
522  glVertex2d(-mw, -t);
523  glVertex2d(-mw, -t - 3.);
524  glVertex2d(myQuarterLaneWidth * scale, -t - 3.);
525  glVertex2d(myQuarterLaneWidth * scale, -t);
526  glEnd();
527  }
528  glPopMatrix();
529  }
530  }
531  // draw white boundings and white markings
532  glColor3d(1, 1, 1);
534  getShape(),
536  getShapeLengths(),
537  (getHalfWidth() + SUMO_const_laneOffset) * scale);
538  glPopMatrix();
539  glPopName();
540 }
541 
542 
543 void
545  glPushMatrix();
546  glPushName(0);
547  if (!MSGlobals::gUseMesoSim) {
548  setColor(s);
549  }
550  // draw on top of of the white area between the rails
551  glTranslated(0, 0, 0.1);
552  int e = (int) getShape().size() - 1;
553  for (int i = 0; i < e; ++i) {
554  glPushMatrix();
555  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
556  glRotated(myShapeRotations[i], 0, 0, 1);
557  for (SUMOReal t = 0; t < myShapeLengths[i]; t += 1) {
558  glBegin(GL_QUADS);
559  glVertex2d(-1 * scale, -t);
560  glVertex2d(-1 * scale, -t - 0.3);
561  glVertex2d(1.0 * scale, -t - 0.3);
562  glVertex2d(1.0 * scale, -t);
563  glEnd();
564  }
565  glPopMatrix();
566  }
567  glPopMatrix();
568  glPopName();
569 }
570 
571 // ------ inherited from GUIGlObject
574  GUISUMOAbstractView& parent) {
575  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
576  buildPopupHeader(ret, app);
578  //
581  //
582  buildShowParamsPopupEntry(ret, false);
584  new FXMenuCommand(ret, ("pos: " + toString(pos)).c_str(), 0, 0, 0);
585  new FXMenuSeparator(ret);
586  buildPositionCopyEntry(ret, false);
587  return ret;
588 }
589 
590 
595  new GUIParameterTableWindow(app, *this, 5);
596  // add items
597  ret->mkItem("maxspeed [m/s]", false, getSpeedLimit());
598  ret->mkItem("length [m]", false, myLength);
599  ret->mkItem("street name", false, myEdge->getStreetName());
600  ret->mkItem("stored traveltime [s]", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getStoredEdgeTravelTime));
601  ret->mkItem("allowed vehicle class", false, getAllowedVehicleClassNames(myPermissions));
602  ret->mkItem("disallowed vehicle class", false, getAllowedVehicleClassNames(~myPermissions));
603  // close building
604  ret->closeBuilding();
605  return ret;
606 }
607 
608 
609 Boundary
611  Boundary b;
612  b.add(myShape[0]);
613  b.add(myShape[-1]);
614  b.grow(20);
615  return b;
616 }
617 
618 
619 
620 
621 
622 
623 
624 const PositionVector&
626  return myShape;
627 }
628 
629 
630 const std::vector<SUMOReal>&
632  return myShapeRotations;
633 }
634 
635 
636 const std::vector<SUMOReal>&
638  return myShapeLengths;
639 }
640 
641 
642 SUMOReal
644  return myVehicles.size() == 0 ? 0 : myVehicles.back()->getWaitingSeconds();
645 }
646 
647 
648 SUMOReal
650  return (SUMOReal) myEdge->getLanes().size();
651 }
652 
653 
654 void
657 }
658 
659 
660 SUMOReal
663  if (!ews.knowsTravelTime(myEdge)) {
664  return -1;
665  } else {
666  SUMOReal value(0);
667  ews.retrieveExistingTravelTime(myEdge, 0, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value);
668  return value;
669  }
670 }
671 
672 SUMOReal
673 GUILane::getColorValue(size_t activeScheme) const {
674  switch (activeScheme) {
675  case 1:
676  return gSelected.isSelected(getType(), getGlID()) ||
677  gSelected.isSelected(GLO_EDGE, dynamic_cast<GUIEdge*>(myEdge)->getGlID());
678  case 2:
679  return (SUMOReal)myPermissions;
680  case 3:
681  return getSpeedLimit();
682  case 4:
683  return getBruttoOccupancy();
684  case 5:
685  return getNettoOccupancy();
686  case 6:
687  return firstWaitingTime();
688  case 7:
689  return getEdgeLaneNumber();
690  case 8:
691  return getCO2Emissions() / myLength;
692  case 9:
693  return getCOEmissions() / myLength;
694  case 10:
695  return getPMxEmissions() / myLength;
696  case 11:
697  return getNOxEmissions() / myLength;
698  case 12:
699  return getHCEmissions() / myLength;
700  case 13:
701  return getFuelConsumption() / myLength;
702  case 14:
704  case 15: {
705  return getStoredEdgeTravelTime();
706  }
707  case 16: {
709  if (!ews.knowsTravelTime(myEdge)) {
710  return -1;
711  } else {
712  SUMOReal value(0);
713  ews.retrieveExistingTravelTime(myEdge, 0, 0, value);
714  return 100 * myLength / value / getSpeedLimit();
715  }
716  }
717  case 17: {
718  return 1 / myLengthGeometryFactor;
719  }
720  }
721  return 0;
722 }
723 
724 #ifdef HAVE_OSG
725 void
726 GUILane::updateColor(const GUIVisualizationSettings& s) {
728  osg::Vec4ubArray* colors = dynamic_cast<osg::Vec4ubArray*>(myGeom->getColorArray());
729  (*colors)[0].set(col.red(), col.green(), col.blue(), col.alpha());
730  myGeom->setColorArray(colors);
731 }
732 #endif
733 
734 
735 
736 /****************************************************************************/
737 
The link is a partial left direction.
The link has green light, may pass.
SVCPermissions myPermissions
The vClass permissions for this lane.
Definition: MSLane.h:796
void drawLane2LaneConnections() const
Definition: GUILane.cpp:356
VehCont myVehicles
The lane's vehicles. The entering vehicles are inserted at the front of this container and the leavin...
Definition: MSLane.h:773
const std::vector< SUMOReal > & getShapeRotations() const
Definition: GUILane.cpp:631
SUMOReal myWidth
Lane width [m].
Definition: MSLane.h:779
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
float laneWidthExaggeration
The lane exaggeration (upscale thickness)
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUILane.cpp:655
const RGBColor getColor(const SUMOReal value) const
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
~GUILane()
Destructor.
Definition: GUILane.cpp:91
unsigned int myIndex
The lane index.
Definition: GUILane.h:270
bool drawLinkTLIndex
Information whether a link's tls index shall be drawn.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:168
bool retrieveExistingTravelTime(const MSEdge *const e, const SUMOVehicle *const v, SUMOReal t, SUMOReal &value) const
Returns a travel time for an edge and time if stored.
GUIColorer laneColorer
The lane colorer.
The link has green light, has to brake.
Stores the information about how to visualize structures.
This is an uncontrolled, minor link, has to stop.
virtual bool integrateNewVehicle(SUMOTime t)
Insert buffered vehicle into the real lane.
Definition: MSLane.cpp:905
std::string getAllowedVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
The link is a 180 degree turn.
const RGBColor & getLinkColor(const LinkState &ls)
Definition: StdDefs.cpp:49
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:88
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:413
Notification
Definition of a vehicle state.
SUMOReal getFuelConsumption() const
Returns the sum of last step fuel consumption.
Definition: MSLane.cpp:1392
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
Definition: MSLane.cpp:1011
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:219
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
virtual void incorporateVehicle(MSVehicle *veh, SUMOReal pos, SUMOReal speed, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
Definition: MSLane.cpp:123
void drawMarkings(const GUIVisualizationSettings &s, SUMOReal scale) const
draw lane borders and white markings
Definition: GUILane.cpp:504
This is a dead end link.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:154
SUMOReal getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
Definition: MSLane.cpp:1282
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
This is an uncontrolled, right-before-left link.
const std::vector< SUMOReal > & getShapeLengths() const
Definition: GUILane.cpp:637
#define RAD2DEG(x)
Definition: GeomHelper.h:46
static void drawText(const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &col=RGBColor::BLACK, const SUMOReal angle=0)
draw Text with given parameters
Definition: GLHelper.cpp:369
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
const SUMOReal SUMO_const_laneOffset
Definition: StdDefs.h:48
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
void drawArrows() const
Definition: GUILane.cpp:296
A storage for edge travel times and efforts.
The link is controlled by a tls which is off, not blinking, may pass.
void drawCrossties(const GUIVisualizationSettings &s, SUMOReal scale) const
draw crossties for railroads
Definition: GUILane.cpp:544
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
This is an uncontrolled, all-way stop link.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:115
bool integrateNewVehicle(SUMOTime t)
Definition: GUILane.cpp:152
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
const std::set< const MSVehicle * > & getParkingVehicles(const MSLane *lane) const
return parking vehicles on the given lane
The link is a (hard) left direction.
PositionVector myShape
The shape of the lane.
Definition: MSLane.h:547
SUMOReal getHCEmissions() const
Returns the sum of last step HC emissions.
Definition: MSLane.cpp:1380
SUMOReal scale
information about a lane's width (temporary, used for a single view)
size_t getActive() const
Definition: GUIColorer.h:72
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
virtual bool executeMovements(SUMOTime t, std::vector< MSLane * > &into)
Executes planned vehicle movements with regards to right-of-way.
Definition: MSLane.cpp:718
unsigned char blue() const
Returns the blue-amount of the color.
Definition: RGBColor.h:91
The link is a straight direction.
MSLinkCont myLinks
Definition: MSLane.h:817
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
Definition: MSLane.cpp:667
void drawLinkRules(const GUINet &net) const
Definition: GUILane.cpp:225
std::vector< SUMOReal > myShapeRotations
The rotations of the shape parts.
Definition: GUILane.h:258
A road/street connecting two junctions.
Definition: MSEdge.h:73
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:159
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUILane.cpp:592
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:352
bool executeMovements(SUMOTime t, std::vector< MSLane * > &into)
Definition: GUILane.cpp:131
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUILane.h:279
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUILane.cpp:610
This is an uncontrolled, minor link, has to brake.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void set(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
assigns new values
Definition: RGBColor.cpp:85
A list of positions.
void drawTLSLinkNo(const GUINet &net) const
Definition: GUILane.cpp:194
void planMovements(const SUMOTime t)
Definition: GUILane.cpp:124
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition: RGBColor.h:99
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
Definition: GUILane.h:261
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
int getLinkTLIndex(MSLink *link) const
Definition: GUINet.cpp:202
Definition: Line.h:51
SUMOReal firstWaitingTime() const
Definition: GUILane.cpp:643
void drawLinkNo() const
helper methods
Definition: GUILane.cpp:167
The link is a (hard) right direction.
SUMOReal getSpeedLimit() const
Returns the lane's maximum allowed speed.
Definition: MSLane.h:362
MSEdge * myEdge
The lane's edge, for routing only.
Definition: MSLane.h:782
GUILane(const std::string &id, SUMOReal maxSpeed, SUMOReal length, MSEdge *const edge, unsigned int numericalID, const PositionVector &shape, SUMOReal width, SVCPermissions permissions, unsigned int index)
Constructor.
Definition: GUILane.cpp:69
SUMOReal myLength
Lane length [m].
Definition: MSLane.h:776
virtual void incorporateVehicle(MSVehicle *veh, SUMOReal pos, SUMOReal speed, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
Definition: GUILane.cpp:101
static void drawBoxLines(const PositionVector &geom, const std::vector< SUMOReal > &rots, const std::vector< SUMOReal > &lengths, SUMOReal width)
Draws thick lines.
Definition: GLHelper.cpp:157
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: MSLane.cpp:1004
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:52
The link is a partial right direction.
SUMOReal getEdgeLaneNumber() const
Definition: GUILane.cpp:649
const SUMOReal myLengthGeometryFactor
Definition: MSLane.h:822
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
void unlock()
release mutex lock
Definition: MFXMutex.cpp:94
void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: GUILane.cpp:145
static void drawBoxLine(const Position &beg, SUMOReal rot, SUMOReal visLength, SUMOReal width)
Draws a thick line.
Definition: GLHelper.cpp:124
SUMOReal getNOxEmissions() const
Returns the sum of last step NOx emissions.
Definition: MSLane.cpp:1368
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:76
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
Definition: Boundary.cpp:200
SUMOReal getPMxEmissions() const
Returns the sum of last step PMx emissions.
Definition: MSLane.cpp:1356
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
Definition: MSEdge.h:204
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIVehicle.cpp:936
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
Definition: GUILane.cpp:673
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:90
GUIColorScheme & getScheme()
Definition: GUIColorer.h:76
The link has yellow light, may pass.
The link is controlled by a tls which is off and blinks, has to brake.
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
Definition: AbstractMutex.h:71
SUMOReal getStoredEdgeTravelTime() const
Returns the stored traveltime for the edge of this lane.
Definition: GUILane.cpp:661
SUMOReal getCO2Emissions() const
Returns the sum of last step CO2 emissions.
Definition: MSLane.cpp:1332
static void drawTriangleAtEnd(const Line &l, SUMOReal tLength, SUMOReal tWidth)
Draws a triangle at the end of the given line.
Definition: GLHelper.cpp:332
SUMOReal getCOEmissions() const
Returns the sum of last step CO emissions.
Definition: MSLane.cpp:1344
MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification)
Definition: GUILane.cpp:138
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
void detectCollisions(SUMOTime timestep, const std::string &stage)
Definition: GUILane.cpp:159
The link has red light (must brake)
SUMOReal getHalfWidth() const
Definition: GUILane.h:203
The popup menu of a globject.
an edge
SUMOReal myHalfLaneWidth
Half of lane width, for speed-up.
Definition: GUILane.h:264
bool drawLinkJunctionIndex
Information whether a link's junction index shall be drawn.
This is an uncontrolled, major link, may pass.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
void lock()
lock mutex
Definition: MFXMutex.cpp:84
unsigned int getLinkTLID(MSLink *link) const
Definition: GUINet.cpp:187
SUMOReal myQuarterLaneWidth
Quarter of lane width, for speed-up.
Definition: GUILane.h:267
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:323
const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: GUILane.cpp:111
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:230
static void drawLine(const Position &beg, SUMOReal rot, SUMOReal visLength)
Draws a thin line.
Definition: GLHelper.cpp:196
float minVehicleSize
The minimum size of vehicles to let them be drawn.
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
unsigned char green() const
Returns the green-amount of the color.
Definition: RGBColor.h:83
#define SUMOReal
Definition: config.h:215
static const bool gUseMesoSim
Definition: MSGlobals.h:98
FXbool locked()
Definition: MFXMutex.h:68
The link has yellow light, has to brake anyway.
bool knowsTravelTime(const MSEdge *const e) const
Returns the information whether any travel time is known for the given edge.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
Definition: MSLane.cpp:1404
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUILane.cpp:573
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
The edge is an internal edge.
Definition: MSEdge.h:90
SUMOReal interpolateGeometryPosToLanePos(SUMOReal geometryPos) const
Definition: MSLane.h:346
SUMOReal getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
Definition: MSLane.cpp:1267
unsigned char red() const
Returns the red-amount of the color.
Definition: RGBColor.h:75
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
A window containing a gl-object's parameter.
void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: GUILane.cpp:118
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
virtual void planMovements(const SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step...
Definition: MSLane.cpp:652
The link has no direction (is a dead end link)
const PositionVector & getShape() const
Definition: GUILane.cpp:625
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition: MSNet.cpp:620
a junction
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:74