SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUILaneWrapper.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // A MSLane extended for visualisation purposes.
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2013 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 <iostream>
35 #include <utility>
36 #ifdef HAVE_OSG
37 #include <osg/Geometry>
38 #endif
39 #include <microsim/MSLane.h>
40 #include <microsim/MSEdge.h>
41 #include <microsim/MSGlobals.h>
45 #include <microsim/MSNet.h>
46 #include <gui/GUIGlobals.h>
48 #include "GUILaneWrapper.h"
49 #include "GUIEdge.h"
50 #include <utils/common/ToString.h>
51 #include <utils/geom/GeomHelper.h>
52 #include <guisim/GUINet.h>
61 #include <utils/gui/div/GLHelper.h>
62 #include <gui/GUIViewTraffic.h>
64 #include <guisim/GUIVehicle.h>
66 #include <utils/common/HelpersHarmonoise.h>
69 
70 #ifdef CHECK_MEMORY_LEAKS
71 #include <foreign/nvwa/debug_new.h>
72 #endif // CHECK_MEMORY_LEAKS
73 
74 
75 // ===========================================================================
76 // method definitions
77 // ===========================================================================
78 GUILaneWrapper::GUILaneWrapper(MSLane& lane, const PositionVector& shape, unsigned int index) :
79  GUIGlObject(GLO_LANE, lane.getID()),
80  myLane(lane),
81  myShape(shape),
82  myIndex(index)
83 #ifdef HAVE_OSG
84  , myGeom(0)
85 #endif
86 {
87  myShapeRotations.reserve(myShape.size() - 1);
88  myShapeLengths.reserve(myShape.size() - 1);
89  int e = (int) myShape.size() - 1;
90  for (int i = 0; i < e; ++i) {
91  const Position& f = myShape[i];
92  const Position& s = myShape[i + 1];
93  myShapeLengths.push_back(f.distanceTo2D(s));
94  myShapeRotations.push_back(RAD2DEG(atan2(s.x() - f.x(), f.y() - s.y())));
95  }
96  //
99 }
100 
101 
103 
104 
105 bool
106 GUILaneWrapper::forLane(const MSLane& lane) const {
107  return (&myLane) == (&lane);
108 }
109 
110 
111 
112 void
114  unsigned int noLinks = getLinkNumber();
115  if (noLinks == 0) {
116  return;
117  }
118  // draw all links
119  SUMOReal w = myLane.getWidth() / (SUMOReal) noLinks;
120  SUMOReal x1 = myLane.getWidth() / (SUMOReal) 2.;
121  glPushMatrix();
122  const PositionVector& g = getShape();
123  const Position& end = g.back();
124  const Position& f = g[-2];
125  const Position& s = end;
126  SUMOReal rot = (SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI;
127  glTranslated(end.x(), end.y(), 0);
128  glRotated(rot, 0, 0, 1);
129  for (int i = noLinks; --i >= 0;) {
130  SUMOReal x2 = x1 - (SUMOReal)(w / 2.);
131  GLHelper::drawText(toString(getLane().getLinkCont()[i]->getRespondIndex()),
132  Position(x2, 0), 0, .6, RGBColor(128, 128, 255, 255), 180);
133  x1 -= w;
134  }
135  glPopMatrix();
136 }
137 
138 
139 void
141  unsigned int noLinks = getLinkNumber();
142  if (noLinks == 0) {
143  return;
144  }
145  // draw all links
146  SUMOReal w = myLane.getWidth() / (SUMOReal) noLinks;
147  SUMOReal x1 = (SUMOReal)(myLane.getWidth() / 2.);
148  glPushMatrix();
149  const PositionVector& g = getShape();
150  const Position& end = g.back();
151  const Position& f = g[-2];
152  const Position& s = end;
153  SUMOReal rot = (SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI;
154  glTranslated(end.x(), end.y(), 0);
155  glRotated(rot, 0, 0, 1);
156  for (int i = noLinks; --i >= 0;) {
157  SUMOReal x2 = x1 - (SUMOReal)(w / 2.);
158  int linkNo = net.getLinkTLIndex(getLane().getLinkCont()[i]);
159  if (linkNo < 0) {
160  continue;
161  }
163  Position(x2, 0), 0, .6, RGBColor(128, 128, 255, 255), 180);
164  x1 -= w;
165  }
166  glPopMatrix();
167 }
168 
169 
170 void
172  unsigned int noLinks = getLinkNumber();
173  const PositionVector& g = getShape();
174  const Position& end = g.back();
175  const Position& f = g[-2];
176  const Position& s = end;
177  SUMOReal rot = (SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI;
178  if (noLinks == 0) {
179  glPushName(getGlID());
180  // draw a grey bar if no links are on the street
181  glColor3d(0.5, 0.5, 0.5);
182  glPushMatrix();
183  glTranslated(end.x(), end.y(), 0);
184  glRotated(rot, 0, 0, 1);
185  glBegin(GL_QUADS);
186  glVertex2d(-myHalfLaneWidth, 0.0);
187  glVertex2d(-myHalfLaneWidth, 0.5);
188  glVertex2d(myHalfLaneWidth, 0.5);
189  glVertex2d(myHalfLaneWidth, 0.0);
190  glEnd();
191  glPopMatrix();
192  glPopName();
193  return;
194  }
195  // draw all links
196  SUMOReal w = myLane.getWidth() / (SUMOReal) noLinks;
197  SUMOReal x1 = 0;
198  glPushMatrix();
199  glTranslated(end.x(), end.y(), 0);
200  glRotated(rot, 0, 0, 1);
201  for (unsigned int i = 0; i < noLinks; ++i) {
202  SUMOReal x2 = x1 + w;
203  MSLink* link = getLane().getLinkCont()[i];
204  // select glID
205  switch (link->getState()) {
208  case LINKSTATE_TL_RED:
212  glPushName(net.getLinkTLID(link));
213  break;
214  case LINKSTATE_MAJOR:
215  case LINKSTATE_MINOR:
216  case LINKSTATE_EQUAL:
218  default:
219  glPushName(getGlID());
220  break;
221  }
222  // select color
223  switch (link->getState()) {
226  glColor3d(0, 1, 0);
227  break;
228  case LINKSTATE_TL_RED:
229  glColor3d(1, 0, 0);
230  break;
233  glColor3d(1, 1, 0);
234  break;
236  glColor3d(.7, .7, 0);
237  break;
239  glColor3d(0, 1, 1);
240  break;
241  case LINKSTATE_MAJOR:
242  glColor3d(1, 1, 1);
243  break;
244  case LINKSTATE_MINOR:
245  glColor3d(.2, .2, .2);
246  break;
247  case LINKSTATE_EQUAL:
248  glColor3d(.5, .5, .5);
249  break;
250  case LINKSTATE_DEADEND:
251  glColor3d(0, 0, 0);
252  break;
253  }
254  glBegin(GL_QUADS);
255  glVertex2d(x1 - myHalfLaneWidth, 0.0);
256  glVertex2d(x1 - myHalfLaneWidth, 0.5);
257  glVertex2d(x2 - myHalfLaneWidth, 0.5);
258  glVertex2d(x2 - myHalfLaneWidth, 0.0);
259  glEnd();
260  glPopName();
261  x1 = x2;
262  x2 += w;
263  }
264  glPopMatrix();
265 }
266 
267 
268 void
270  unsigned int noLinks = getLinkNumber();
271  if (noLinks == 0) {
272  return;
273  }
274  // draw all links
275  const Position& end = getShape().back();
276  const Position& f = getShape()[-2];
277  SUMOReal rot = (SUMOReal) atan2((end.x() - f.x()), (f.y() - end.y())) * (SUMOReal) 180.0 / (SUMOReal) PI;
278  glPushMatrix();
279  glPushName(0);
280  glColor3d(1, 1, 1);
281  glTranslated(end.x(), end.y(), 0);
282  glRotated(rot, 0, 0, 1);
283  for (unsigned int i = 0; i < noLinks; ++i) {
284  LinkDirection dir = getLane().getLinkCont()[i]->getDirection();
285  LinkState state = getLane().getLinkCont()[i]->getState();
286  if (state == LINKSTATE_TL_OFF_NOSIGNAL || dir == LINKDIR_NODIR) {
287  continue;
288  }
289  switch (dir) {
290  case LINKDIR_STRAIGHT:
291  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
293  break;
294  case LINKDIR_TURN:
295  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
296  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
297  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
298  GLHelper::drawTriangleAtEnd(Line(Position(0.5, 2.5), Position(0.5, 4)), (SUMOReal) 1, (SUMOReal) .25);
299  break;
300  case LINKDIR_LEFT:
301  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
302  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
303  GLHelper::drawTriangleAtEnd(Line(Position(0, 2.5), Position(1.5, 2.5)), (SUMOReal) 1, (SUMOReal) .25);
304  break;
305  case LINKDIR_RIGHT:
306  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
307  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
308  GLHelper::drawTriangleAtEnd(Line(Position(0, 2.5), Position(-1.5, 2.5)), (SUMOReal) 1, (SUMOReal) .25);
309  break;
310  case LINKDIR_PARTLEFT:
311  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
312  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
313  GLHelper::drawTriangleAtEnd(Line(Position(0, 2.5), Position(1.2, 1.3)), (SUMOReal) 1, (SUMOReal) .25);
314  break;
315  case LINKDIR_PARTRIGHT:
316  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
317  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
318  GLHelper::drawTriangleAtEnd(Line(Position(0, 2.5), Position(-1.2, 1.3)), (SUMOReal) 1, (SUMOReal) .25);
319  break;
320  default:
321  break;
322  }
323  }
324  glPopMatrix();
325  glPopName();
326 }
327 
328 
329 void
331  unsigned int noLinks = getLinkNumber();
332  for (unsigned int i = 0; i < noLinks; ++i) {
333  LinkState state = getLane().getLinkCont()[i]->getState();
334  const MSLane* connected = getLane().getLinkCont()[i]->getLane();
335  if (connected == 0) {
336  continue;
337  }
338  switch (state) {
341  glColor3d(0, 1, 0);
342  break;
343  case LINKSTATE_TL_RED:
344  glColor3d(1, 0, 0);
345  break;
348  glColor3d(1, 1, 0);
349  break;
351  glColor3d(1, 1, 0);
352  break;
354  glColor3d(0, 1, 1);
355  break;
356  case LINKSTATE_MAJOR:
357  glColor3d(1, 1, 1);
358  break;
359  case LINKSTATE_MINOR:
360  glColor3d(.2, .2, .2);
361  break;
362  case LINKSTATE_EQUAL:
363  glColor3d(.5, .5, .5);
364  break;
365  case LINKSTATE_DEADEND:
366  glColor3d(0, 0, 0);
367  break;
368  }
369 
370  glBegin(GL_LINES);
371  const Position& p1 = getShape()[-1];
372  const Position& p2 = connected->getShape()[0];
373  glVertex2f(p1.x(), p1.y());
374  glVertex2f(p2.x(), p2.y());
375  glEnd();
376  GLHelper::drawTriangleAtEnd(Line(p1, p2), (SUMOReal) .4, (SUMOReal) .2);
377  }
378 }
379 
380 
381 void
383  glPushMatrix();
384  const bool isInternal = getLane().getEdge().getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL;
385  bool mustDrawMarkings = false;
386  const bool drawDetails = s.scale * s.laneWidthExaggeration > 5;
387  if (isInternal) {
388  // draw internal lanes on top of junctions
389  glTranslated(0, 0, GLO_JUNCTION + 0.1);
390  } else {
391  glTranslated(0, 0, getType());
392  }
393  // set lane color
394  if (!MSGlobals::gUseMesoSim) {
395  setColor(s);
396  glPushName(getGlID()); // do not register for clicks in MESOSIM
397  }
398  // draw lane
399  // check whether it is not too small
400  if (s.scale * s.laneWidthExaggeration < 1.) {
402  if (!MSGlobals::gUseMesoSim) {
403  glPopName();
404  }
405  glPopMatrix();
406  } else if (isRailway(getLane().getPermissions())) {
407  // draw as railway
408  const SUMOReal halfRailWidth = 0.725;
410  glColor3d(1, 1, 1);
411  glTranslated(0, 0, .1);
413  drawCrossties(s);
414  if (!MSGlobals::gUseMesoSim) {
415  glPopName();
416  }
417  glPopMatrix();
418  } else {
419  const SUMOReal laneWidth = isInternal ? myQuarterLaneWidth : myHalfLaneWidth;
420  mustDrawMarkings = !isInternal;
422  if (!MSGlobals::gUseMesoSim) {
423  glPopName();
424  }
425  glPopMatrix();
426  // draw ROWs (not for inner lanes)
427  if (!isInternal && drawDetails) {
428  glPushMatrix();
429  glTranslated(0, 0, GLO_JUNCTION); // must draw on top of junction shape
430  GUINet* net = (GUINet*) MSNet::getInstance();
431  glTranslated(0, 0, .2);
432  drawLinkRules(*net);
433  if (s.showLinkDecals) {
434  drawArrows();
435  }
436  if (s.showLane2Lane) {
437  // this should be independent to the geometry:
438  // draw from end of first to the begin of second
440  }
441  glTranslated(0, 0, .1);
442  if (s.drawLinkJunctionIndex) {
443  drawLinkNo();
444  }
445  if (s.drawLinkTLIndex) {
446  drawTLSLinkNo(*net);
447  }
448  glPopMatrix();
449  }
450  }
451  if (mustDrawMarkings && drawDetails) { // needs matrix reset
452  drawMarkings(s);
453  }
454  // draw vehicles
455  if (s.scale > s.minVehicleSize) {
456  // retrieve vehicles from lane; disallow simulation
457  const MSLane::VehCont& vehicles = myLane.getVehiclesSecure();
458  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
459  if ((*v)->getLane() == &myLane) {
460  static_cast<const GUIVehicle* const>(*v)->drawGL(s);
461  } // else: this is the shadow during a continuous lane change
462  }
463  // draw parking vehicles
464  const std::set<const MSVehicle*> parking = MSVehicleTransfer::getInstance()->getParkingVehicles(&myLane);
465  for (std::set<const MSVehicle*>::const_iterator v = parking.begin(); v != parking.end(); ++v) {
466  static_cast<const GUIVehicle* const>(*v)->drawGL(s);
467  }
468  // allow lane simulation
470  }
471 }
472 
473 
474 void
476  glPushMatrix();
477  glPushName(0);
478  glTranslated(0, 0, GLO_EDGE);
479 #ifdef HAVE_INTERNAL
481 #endif
482  setColor(s);
483  // optionally draw inverse markings
484  if (myIndex > 0) {
486  int e = (int) getShape().size() - 1;
487  for (int i = 0; i < e; ++i) {
488  glPushMatrix();
489  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
490  glRotated(myShapeRotations[i], 0, 0, 1);
491  for (SUMOReal t = 0; t < myShapeLengths[i]; t += 6) {
492  glBegin(GL_QUADS);
493  glVertex2d(-mw, -t);
494  glVertex2d(-mw, -t - 3.);
495  glVertex2d(myQuarterLaneWidth, -t - 3.);
496  glVertex2d(myQuarterLaneWidth, -t);
497  glEnd();
498  }
499  glPopMatrix();
500  }
501  }
502  // draw white boundings and white markings
503  glColor3d(1, 1, 1);
505  getShape(),
507  getShapeLengths(),
509  glPopMatrix();
510  glPopName();
511 }
512 
513 
514 void
516  glPushMatrix();
517  glPushName(0);
518  if (!MSGlobals::gUseMesoSim) {
519  setColor(s);
520  }
521  // draw on top of of the white area between the rails
522  glTranslated(0, 0, 0.1);
523  int e = (int) getShape().size() - 1;
524  for (int i = 0; i < e; ++i) {
525  glPushMatrix();
526  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
527  glRotated(myShapeRotations[i], 0, 0, 1);
528  for (SUMOReal t = 0; t < myShapeLengths[i]; t += 1) {
529  glBegin(GL_QUADS);
530  glVertex2d(-1, -t);
531  glVertex2d(-1, -t - 0.3);
532  glVertex2d(1.0, -t - 0.3);
533  glVertex2d(1.0, -t);
534  glEnd();
535  }
536  glPopMatrix();
537  }
538  glPopMatrix();
539  glPopName();
540 }
541 
544  GUISUMOAbstractView& parent) {
545  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
546  buildPopupHeader(ret, app);
548  //
551  //
552  buildShowParamsPopupEntry(ret, false);
555  new FXMenuCommand(ret, ("pos: " + toString(pos)).c_str(), 0, 0, 0);
556  new FXMenuSeparator(ret);
557  buildPositionCopyEntry(ret, false);
558  return ret;
559 }
560 
561 
566  new GUIParameterTableWindow(app, *this, 4);
567  // add items
568  ret->mkItem("maxspeed [m/s]", false, myLane.getSpeedLimit());
569  ret->mkItem("length [m]", false, myLane.getLength());
570  ret->mkItem("permissions", false, getAllowedVehicleClassNames(myLane.getPermissions()));
571  ret->mkItem("street name", false, myLane.getEdge().getStreetName());
572  ret->mkItem("stored traveltime [s]", true, new FunctionBinding<GUILaneWrapper, SUMOReal>(this, &GUILaneWrapper::getStoredEdgeTravelTime));
573  // close building
574  ret->closeBuilding();
575  return ret;
576 }
577 
578 
579 Boundary
581  Boundary b;
582  b.add(myShape[0]);
583  b.add(myShape[-1]);
584  b.grow(20);
585  return b;
586 }
587 
588 
589 
590 
591 const PositionVector&
593  return myShape;
594 }
595 
596 
597 unsigned int
599  return (unsigned int) myLane.getLinkCont().size();
600 }
601 
602 
603 const std::vector<SUMOReal>&
605  return myShapeRotations;
606 }
607 
608 
609 const std::vector<SUMOReal>&
611  return myShapeLengths;
612 }
613 
614 
615 SUMOReal
617  return myLane.myVehicles.size() == 0
618  ? 0
619  : (*(myLane.myVehicles.end() - 1))->getWaitingSeconds();
620 }
621 
622 
623 SUMOReal
625  return (SUMOReal) myLane.getEdge().getLanes().size();
626 }
627 
628 
629 // ------------ Current state retrieval
630 SUMOReal
632  return myLane.getHBEFA_CO2Emissions() / myLane.getLength();
633 }
634 
635 
636 SUMOReal
638  return myLane.getHBEFA_COEmissions() / myLane.getLength();
639 }
640 
641 
642 SUMOReal
644  return myLane.getHBEFA_PMxEmissions() / myLane.getLength();
645 }
646 
647 
648 SUMOReal
650  return myLane.getHBEFA_NOxEmissions() / myLane.getLength();
651 }
652 
653 
654 SUMOReal
656  return myLane.getHBEFA_HCEmissions() / myLane.getLength();
657 }
658 
659 
660 SUMOReal
662  return myLane.getHBEFA_FuelConsumption() / myLane.getLength();
663 }
664 
665 
666 SUMOReal
668  return myLane.getPHEMlight_CO2Emissions() / myLane.getLength();
669 }
670 
671 
672 SUMOReal
674  return myLane.getPHEMlight_COEmissions() / myLane.getLength();
675 }
676 
677 
678 SUMOReal
680  return myLane.getPHEMlight_PMxEmissions() / myLane.getLength();
681 }
682 
683 
684 SUMOReal
686  return myLane.getPHEMlight_NOxEmissions() / myLane.getLength();
687 }
688 
689 
690 SUMOReal
692  return myLane.getPHEMlight_HCEmissions() / myLane.getLength();
693 }
694 
695 
696 SUMOReal
698  return myLane.getPHEMlight_FuelConsumption() / myLane.getLength();
699 }
700 
701 
702 // ------------
703 void
706 }
707 
708 
709 SUMOReal
712  MSEdge& e = getLane().getEdge();
713  if (!ews.knowsTravelTime(&e)) {
714  return -1;
715  } else {
716  SUMOReal value(0);
717  ews.retrieveExistingTravelTime(&e, 0, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value);
718  return value;
719  }
720 }
721 
722 SUMOReal
723 GUILaneWrapper::getColorValue(size_t activeScheme) const {
724  switch (activeScheme) {
725  case 1:
726  return (gSelected.isSelected(getType(), getGlID()) ||
727  gSelected.isSelected(GLO_EDGE, dynamic_cast<GUIEdge*>(&(getLane().getEdge()))->getGlID()));
728  case 2: {
730  return 0;
731  } else {
732  return 1;
733  }
734  }
735  case 3:
736  return getLane().getSpeedLimit();
737  case 4:
738  return getLane().getOccupancy();
739  case 5:
740  return firstWaitingTime();
741  case 6:
742  return getEdgeLaneNumber();
743  case 7:
745  case 8:
747  case 9:
749  case 10:
751  case 11:
753  case 12:
755  case 13:
757  case 14:
759  case 15:
761  case 16:
763  case 17:
765  case 18:
767  case 19:
769  case 20: {
770  return getStoredEdgeTravelTime();
771  }
772  case 21: {
774  MSEdge& e = getLane().getEdge();
775  if (!ews.knowsTravelTime(&e)) {
776  return -1;
777  } else {
778  SUMOReal value(0);
779  ews.retrieveExistingTravelTime(&e, 0, 0, value);
780  return 100 * getLane().getLength() / value / getLane().getSpeedLimit();
781  }
782  }
783  }
784  return 0;
785 }
786 
787 #ifdef HAVE_OSG
788 void
789 GUILaneWrapper::updateColor(const GUIVisualizationSettings& s) {
791  osg::Vec4ubArray* colors = dynamic_cast<osg::Vec4ubArray*>(myGeom->getColorArray());
792  (*colors)[0].set(col.red(), col.green(), col.blue(), col.alpha());
793  myGeom->setColorArray(colors);
794 }
795 #endif
796 
797 
798 /****************************************************************************/
799 
The link is a partial left direction.
SUMOReal myHalfLaneWidth
Half of lane width, for speed-up.
The link has green light, may pass.
VehCont myVehicles
The lane&#39;s vehicles. The entering vehicles are inserted at the front of this container and the leavin...
Definition: MSLane.h:773
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:452
float laneWidthExaggeration
The lane exaggeration (upscale thickness)
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.
SUMOReal getNormedHBEFA_CO2Emissions() const
Returns the sum of last step CO2 emissions normed by the lane&#39;s length.
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: MSLane.h:303
void drawLinkRules(const GUINet &net) const
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool drawLinkTLIndex
Information whether a link&#39;s tls index shall be drawn.
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;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.
SUMOReal getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:370
MSLane & myLane
The assigned lane.
std::string getAllowedVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a &#39; &#39;.
The link is a 180 degree turn.
GUILaneWrapper(MSLane &lane, const PositionVector &shape, unsigned int index)
Constructor.
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:88
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.
unsigned int myIndex
The lane index.
SUMOReal getNormedHBEFA_HCEmissions() const
Returns the sum of last step HC emissions normed by the lane&#39;s length.
SUMOReal getWidth() const
Returns the lane&#39;s width.
Definition: MSLane.h:386
This is a dead end link.
SUMOReal getNormedPHEMlight_NOxEmissions() const
Returns the sum of last step NOx emissions normed by the lane&#39;s length.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:154
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
bool forLane(const MSLane &lane) const
Returns true if the given lane id the lane this wrapper wraps the geometry of.
SUMOReal getNormedPHEMlight_CO2Emissions() const
Returns the sum of last step CO2 emissions normed by the lane&#39;s length.
This is an uncontrolled, right-before-left link.
#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
SUMOReal getNormedPHEMlight_PMxEmissions() const
Returns the sum of last step PMx emissions normed by the lane&#39;s length.
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
SUMOReal getEdgeLaneNumber() const
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
A storage for edge travel times and efforts.
The link is controlled by a tls which is off, not blinking, may pass.
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
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.
SUMOReal getNormedHBEFA_NOxEmissions() const
Returns the sum of last step NOx emissions normed by the lane&#39;s length.
const MSLane & getLane() const
Returns the represented lane.
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:115
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.
SUMOReal getNormedHBEFA_PMxEmissions() const
Returns the sum of last step PMx emissions normed by the lane&#39;s length.
SUMOReal scale
information about a lane&#39;s width (temporary, used for a single view)
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: MSLane.h:296
const PositionVector & myShape
The shape of the lane.
size_t getActive() const
Definition: GUIColorer.h:72
virtual ~GUILaneWrapper()
Destructor.
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
unsigned char blue() const
Returns the blue-amount of the color.
Definition: RGBColor.h:91
The link is a straight direction.
A road/street connecting two junctions.
Definition: MSEdge.h:73
unsigned int getLinkNumber() const
Returns the number of links.
SUMOReal getNormedPHEMlight_FuelConsumption() const
Returns the sum of last step fuel comsumption normed by the lane&#39;s length.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:159
#define PI
Definition: polyfonts.c:57
void drawCrossties(const GUIVisualizationSettings &s) const
draw crossties for railroads
bool allowsVehicleClass(SUMOVehicleClass vclass) const
Definition: MSLane.h:566
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
SUMOReal myQuarterLaneWidth
Quarter of lane width, for speed-up.
void drawLinkNo() const
helper methods
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:352
SUMOReal getNormedPHEMlight_HCEmissions() const
Returns the sum of last step HC emissions normed by the lane&#39;s length.
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.
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.
void drawLane2LaneConnections() const
#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
The link is a (hard) right direction.
SUMOReal getSpeedLimit() const
Returns the lane&#39;s maximum allowed speed.
Definition: MSLane.h:362
SUMOReal getNormedHBEFA_FuelConsumption() const
Returns the sum of last step fuel comsumption normed by the lane&#39;s length.
void drawTLSLinkNo(const GUINet &net) const
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition: MSLane.h:378
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
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:52
SUMOReal firstWaitingTime() const
std::vector< SUMOReal > myShapeRotations
The rotations of the shape parts.
The link is a partial right direction.
vehicle is a passenger car (a &quot;normal&quot; car)
const std::vector< SUMOReal > & getShapeRotations() const
void drawMarkings(const GUIVisualizationSettings &s) const
draw lane borders and white markings
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
static void drawBoxLine(const Position &beg, SUMOReal rot, SUMOReal visLength, SUMOReal width)
Draws a thick line.
Definition: GLHelper.cpp:124
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
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
Definition: MSEdge.h:204
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIVehicle.cpp:936
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.
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 y() const
Returns the y-position.
Definition: Position.h:68
The link has red light (must brake)
The popup menu of a globject.
an edge
bool drawLinkJunctionIndex
Information whether a link&#39;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.
const std::vector< SUMOReal > & getShapeLengths() const
unsigned int getLinkTLID(MSLink *link) const
Definition: GUINet.cpp:187
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: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.
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
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
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:998
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.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
SUMOReal getNormedPHEMlight_COEmissions() const
Returns the sum of last step CO emissions normed by the lane&#39;s length.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
Definition: MSLane.cpp:1404
Position getPositionInformation() const
Returns the cursor&#39;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
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
const PositionVector & getShape() const
A window containing a gl-object&#39;s parameter.
void drawArrows() const
SUMOReal getHalfWidth() const
SUMOReal getNormedHBEFA_COEmissions() const
Returns the sum of last step CO emissions normed by the lane&#39;s length.
SUMOReal getStoredEdgeTravelTime() const
Returns the stored traveltime for the edge of this lane.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
The link has no direction (is a dead end link)
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net&#39;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