SUMO - Simulation of Urban MObility
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.dlr.de/
12 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <utility>
36 #include <utils/geom/GeomHelper.h>
37 #include <utils/geom/Position.h>
41 #include <utils/common/StdDefs.h>
42 #include <utils/geom/GeomHelper.h>
43 #include <utils/gui/div/GLHelper.h>
49 #include <microsim/MSGlobals.h>
50 #include <microsim/MSLane.h>
53 #include <microsim/MSNet.h>
56 #include <mesosim/MELoop.h>
57 #include <mesosim/MESegment.h>
58 #include "GUILane.h"
59 #include "GUIEdge.h"
60 #include "GUIVehicle.h"
61 #include "GUINet.h"
62 
63 #ifdef HAVE_OSG
64 #include <osg/Geometry>
65 #endif
66 
67 #ifdef CHECK_MEMORY_LEAKS
68 #include <foreign/nvwa/debug_new.h>
69 #endif // CHECK_MEMORY_LEAKS
70 
71 //#define GUILane_DEBUG_DRAW_WALKING_AREA_VERTICES
72 
73 // ===========================================================================
74 // method definitions
75 // ===========================================================================
76 GUILane::GUILane(const std::string& id, SUMOReal maxSpeed, SUMOReal length,
77  MSEdge* const edge, unsigned int numericalID,
78  const PositionVector& shape, SUMOReal width,
79  SVCPermissions permissions, unsigned int index) :
80  MSLane(id, maxSpeed, length, edge, numericalID, shape, width, permissions, index),
81  GUIGlObject(GLO_LANE, id),
82  myAmClosed(false) {
84  myShape = splitAtSegments(shape);
85  assert(fabs(myShape.length() - shape.length()) < POSITION_EPS);
86  assert(myShapeSegments.size() == myShape.size());
87  }
88  myShapeRotations.reserve(myShape.size() - 1);
89  myShapeLengths.reserve(myShape.size() - 1);
90  myShapeColors.reserve(myShape.size() - 1);
91  int e = (int) myShape.size() - 1;
92  for (int i = 0; i < e; ++i) {
93  const Position& f = myShape[i];
94  const Position& s = myShape[i + 1];
95  myShapeLengths.push_back(f.distanceTo2D(s));
96  myShapeRotations.push_back(RAD2DEG(atan2(s.x() - f.x(), f.y() - s.y())));
97  }
98  //
101 }
102 
103 
105  // just to quit cleanly on a failure
106  if (myLock.locked()) {
107  myLock.unlock();
108  }
109 }
110 
111 
112 // ------ Vehicle insertion ------
113 void
115  const MSLane::VehCont::iterator& at,
116  MSMoveReminder::Notification notification) {
118  MSLane::incorporateVehicle(veh, pos, speed, posLat, at, notification);
119 }
120 
121 
122 // ------ Access to vehicles ------
123 const MSLane::VehCont&
125  myLock.lock();
126  return myVehicles;
127 }
128 
129 
130 void
132  myLock.unlock();
133 }
134 
135 
136 void
140 }
141 
142 
143 bool
144 GUILane::executeMovements(SUMOTime t, std::vector<MSLane*>& into) {
146  return MSLane::executeMovements(t, into);
147 }
148 
149 
150 MSVehicle*
151 GUILane::removeVehicle(MSVehicle* remVehicle, MSMoveReminder::Notification notification, bool notify) {
153  return MSLane::removeVehicle(remVehicle, notification, notify);
154 }
155 
156 
157 void
161 }
162 
163 
164 bool
167  return MSLane::integrateNewVehicle(t);
168 }
169 
170 
171 void
172 GUILane::detectCollisions(SUMOTime timestep, const std::string& stage) {
174  MSLane::detectCollisions(timestep, stage);
175 }
176 
177 
178 SUMOReal
182 }
183 
184 
185 void
189 }
190 
191 
192 // ------ Drawing methods ------
193 void
195  unsigned int noLinks = (unsigned int)myLinks.size();
196  if (noLinks == 0) {
197  return;
198  }
199  // draw all links
200  if (getEdge().isCrossing()) {
201  // draw indices at the start and end of the crossing
203  PositionVector shape = getShape();
204  shape.extrapolate(0.5); // draw on top of the walking area
205  drawTextAtEnd(toString(link->getIndex()), shape, 0, s.drawLinkJunctionIndex);
207  return;
208  }
209  // draw all links
210  SUMOReal w = myWidth / (SUMOReal) noLinks;
212  const bool lefthand = MSNet::getInstance()->lefthand();
213  for (int i = noLinks; --i >= 0;) {
214  SUMOReal x2 = x1 - (SUMOReal)(w / 2.);
215  drawTextAtEnd(toString(myLinks[lefthand ? noLinks - 1 - i : i]->getIndex()), getShape(), x2, s.drawLinkJunctionIndex);
216  x1 -= w;
217  }
218 }
219 
220 
221 void
223  unsigned int noLinks = (unsigned int)myLinks.size();
224  if (noLinks == 0) {
225  return;
226  }
227  if (getEdge().isCrossing()) {
228  // draw indices at the start and end of the crossing
230  int linkNo = net.getLinkTLIndex(link);
231  if (linkNo >= 0) {
232  PositionVector shape = getShape();
233  shape.extrapolate(0.5); // draw on top of the walking area
234  drawTextAtEnd(toString(linkNo), shape, 0, s.drawLinkTLIndex);
235  drawTextAtEnd(toString(linkNo), shape.reverse(), 0, s.drawLinkTLIndex);
236  }
237  return;
238  }
239  // draw all links
240  SUMOReal w = myWidth / (SUMOReal) noLinks;
242  const bool lefthand = MSNet::getInstance()->lefthand();
243  for (int i = noLinks; --i >= 0;) {
244  SUMOReal x2 = x1 - (SUMOReal)(w / 2.);
245  int linkNo = net.getLinkTLIndex(myLinks[lefthand ? noLinks - 1 - i : i]);
246  if (linkNo < 0) {
247  continue;
248  }
249  drawTextAtEnd(toString(linkNo), getShape(), x2, s.drawLinkTLIndex);
250  x1 -= w;
251  }
252 }
253 
254 
255 void
256 GUILane::drawTextAtEnd(const std::string& text, const PositionVector& shape, SUMOReal x, const GUIVisualizationTextSettings& settings) const {
257  glPushMatrix();
258  const Position& end = shape.back();
259  const Position& f = shape[-2];
260  const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
261  glTranslated(end.x(), end.y(), 0);
262  glRotated(rot, 0, 0, 1);
263  GLHelper::drawText(text, Position(x, 0.26), 0, .6 * settings.size / 50, settings.color, 180);
264  glPopMatrix();
265 }
266 
267 
268 void
270  unsigned int noLinks = (unsigned int)myLinks.size();
271  if (noLinks == 0) {
272  drawLinkRule(s, net, 0, getShape(), 0, 0);
273  return;
274  }
275  if (getEdge().isCrossing()) {
276  // draw rules at the start and end of the crossing
278  PositionVector shape = getShape();
279  shape.extrapolate(0.5); // draw on top of the walking area
280  drawLinkRule(s, net, link, shape, 0, myWidth);
281  drawLinkRule(s, net, link, shape.reverse(), 0, myWidth);
282  return;
283  }
284  // draw all links
285  SUMOReal w = myWidth / (SUMOReal) noLinks;
286  SUMOReal x1 = 0;
287  const bool lefthand = MSNet::getInstance()->lefthand();
288  for (unsigned int i = 0; i < noLinks; ++i) {
289  SUMOReal x2 = x1 + w;
290  drawLinkRule(s, net, myLinks[lefthand ? noLinks - 1 - i : i], getShape(), x1, x2);
291  x1 = x2;
292  }
293 }
294 
295 
296 void
297 GUILane::drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, SUMOReal x1, SUMOReal x2) const {
298  const Position& end = shape.back();
299  const Position& f = shape[-2];
300  const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
301  if (link == 0) {
303  glPushMatrix();
304  glTranslated(end.x(), end.y(), 0);
305  glRotated(rot, 0, 0, 1);
306  glBegin(GL_QUADS);
307  glVertex2d(-myHalfLaneWidth, 0.0);
308  glVertex2d(-myHalfLaneWidth, 0.5);
309  glVertex2d(myHalfLaneWidth, 0.5);
310  glVertex2d(myHalfLaneWidth, 0.0);
311  glEnd();
312  glPopMatrix();
313  } else {
314  glPushMatrix();
315  glTranslated(end.x(), end.y(), 0);
316  glRotated(rot, 0, 0, 1);
317  // select glID
318  switch (link->getState()) {
321  case LINKSTATE_TL_RED:
326  glPushName(net.getLinkTLID(link));
327  break;
328  case LINKSTATE_MAJOR:
329  case LINKSTATE_MINOR:
330  case LINKSTATE_EQUAL:
332  default:
333  glPushName(getGlID());
334  break;
335  }
337  if (!(drawAsRailway(s) || drawAsWaterway(s)) || link->getState() != LINKSTATE_MAJOR) {
338  // the white bar should be the default for most railway
339  // links and looks ugly so we do not draw it
340  glBegin(GL_QUADS);
341  glVertex2d(x1 - myHalfLaneWidth, 0.0);
342  glVertex2d(x1 - myHalfLaneWidth, 0.5);
343  glVertex2d(x2 - myHalfLaneWidth, 0.5);
344  glVertex2d(x2 - myHalfLaneWidth, 0.0);
345  glEnd();
346  }
347  glPopName();
348  glPopMatrix();
349  }
350 }
351 
352 void
354  if (myLinks.size() == 0) {
355  return;
356  }
357  // draw all links
358  const Position& end = getShape().back();
359  const Position& f = getShape()[-2];
360  const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
361  glPushMatrix();
362  glColor3d(1, 1, 1);
363  glTranslated(end.x(), end.y(), 0);
364  glRotated(rot, 0, 0, 1);
366  glScaled(myWidth / SUMO_const_laneWidth, 1, 1);
367  }
368  for (std::vector<MSLink*>::const_iterator i = myLinks.begin(); i != myLinks.end(); ++i) {
369  LinkDirection dir = (*i)->getDirection();
370  LinkState state = (*i)->getState();
371  if (state == LINKSTATE_TL_OFF_NOSIGNAL || dir == LINKDIR_NODIR) {
372  continue;
373  }
374  switch (dir) {
375  case LINKDIR_STRAIGHT:
376  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
378  break;
379  case LINKDIR_TURN:
380  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
381  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
382  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
383  GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (SUMOReal) 1, (SUMOReal) .25);
384  break;
386  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
387  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
388  GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
389  GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (SUMOReal) 1, (SUMOReal) .25);
390  break;
391  case LINKDIR_LEFT:
392  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
393  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
394  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (SUMOReal) 1, (SUMOReal) .25);
395  break;
396  case LINKDIR_RIGHT:
397  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
398  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
399  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (SUMOReal) 1, (SUMOReal) .25);
400  break;
401  case LINKDIR_PARTLEFT:
402  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
403  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
404  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (SUMOReal) 1, (SUMOReal) .25);
405  break;
406  case LINKDIR_PARTRIGHT:
407  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
408  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
409  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (SUMOReal) 1, (SUMOReal) .25);
410  break;
411  default:
412  break;
413  }
414  }
415  glPopMatrix();
416 }
417 
418 
419 void
421  for (std::vector<MSLink*>::const_iterator i = myLinks.begin(); i != myLinks.end(); ++i) {
422  const MSLane* connected = (*i)->getLane();
423  if (connected == 0) {
424  continue;
425  }
426  GLHelper::setColor(getLinkColor((*i)->getState()));
427  glBegin(GL_LINES);
428  const Position& p1 = getShape()[-1];
429  const Position& p2 = connected->getShape()[0];
430  glVertex2f(p1.x(), p1.y());
431  glVertex2f(p2.x(), p2.y());
432  glEnd();
433  GLHelper::drawTriangleAtEnd(p1, p2, (SUMOReal) .4, (SUMOReal) .2);
434  }
435 }
436 
437 
438 void
440  glPushMatrix();
441  glPushName(getGlID());
442  const bool isCrossing = myEdge->getPurpose() == MSEdge::EDGEFUNCTION_CROSSING;
443  const bool isWalkingArea = myEdge->getPurpose() == MSEdge::EDGEFUNCTION_WALKINGAREA;
444  const bool isInternal = isCrossing || isWalkingArea || myEdge->getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL;
445  bool mustDrawMarkings = false;
446  SUMOReal exaggeration = s.laneWidthExaggeration;
448  GUIEdge* myGUIEdge = dynamic_cast<GUIEdge*>(myEdge);
449  exaggeration *= s.edgeScaler.getScheme().getColor(myGUIEdge->getScaleValue(s.edgeScaler.getActive()));
450  } else {
452  }
453  const bool drawDetails = s.scale * exaggeration > 5;
454  if (isCrossing || isWalkingArea) {
455  // draw internal lanes on top of junctions
456  glTranslated(0, 0, GLO_JUNCTION + 0.1);
457  } else if (isWaterway(myPermissions)) {
458  // draw waterways below normal roads
459  glTranslated(0, 0, getType() - 0.2);
460  } else {
461  glTranslated(0, 0, getType());
462  }
463  // set lane color
464  if (!MSGlobals::gUseMesoSim) {
465  setColor(s);
466  } else {
467  myShapeColors.clear();
468  const std::vector<RGBColor>& segmentColors = static_cast<const GUIEdge*>(myEdge)->getSegmentColors();
469  if (segmentColors.size() > 0) {
470  // apply segment specific shape colors
471  //std::cout << getID() << " shape=" << myShape << " shapeSegs=" << toString(myShapeSegments) << "\n";
472  for (int ii = 0; ii < (int)myShape.size() - 1; ++ii) {
473  myShapeColors.push_back(segmentColors[myShapeSegments[ii]]);
474  }
475  }
476  }
477  // recognize full transparency and simply don't draw
478  GLfloat color[4];
479  glGetFloatv(GL_CURRENT_COLOR, color);
480  if (color[3] != 0) {
481  // draw lane
482  // check whether it is not too small
483  if (s.scale * exaggeration < 1.) {
484  if (myShapeColors.size() > 0) {
486  } else {
488  }
489  glPopMatrix();
490  } else {
491  GUINet* net = (GUINet*) MSNet::getInstance();
492  if (drawAsRailway(s)) {
493  // draw as railway
494  const SUMOReal halfRailWidth = 0.725 * exaggeration;
495  if (myShapeColors.size() > 0) {
497  } else {
499  }
500  glColor3d(1, 1, 1);
501  glTranslated(0, 0, .1);
503  if (!MSGlobals::gUseMesoSim) {
504  setColor(s);
505  }
506  drawCrossties(0.3 * exaggeration, 1 * exaggeration, 1 * exaggeration);
507  } else if (isCrossing) {
509  // determine priority to decide color
511  if (link->havePriority() || net->getLinkTLIndex(link) > 0) {
512  glColor3d(0.9, 0.9, 0.9);
513  } else {
514  glColor3d(0.1, 0.1, 0.1);
515  }
516  glTranslated(0, 0, .2);
517  drawCrossties(0.5, 1.0, getWidth() * 0.5);
518  glTranslated(0, 0, -.2);
519  }
520  } else if (isWalkingArea) {
522  glTranslated(0, 0, .2);
523  if (s.scale * exaggeration < 20.) {
525  } else {
527  }
528  glTranslated(0, 0, -.2);
529 #ifdef GUILane_DEBUG_DRAW_WALKING_AREA_VERTICES
531 #endif
532  }
533  } else {
534  const SUMOReal halfWidth = isInternal ? myQuarterLaneWidth : myHalfLaneWidth;
535  mustDrawMarkings = !isInternal && myPermissions != 0 && myPermissions != SVC_PEDESTRIAN && exaggeration == 1.0 && !isWaterway(myPermissions);
536  const int cornerDetail = drawDetails && !isInternal ? s.scale * exaggeration : 0;
537  const SUMOReal offset = halfWidth * MAX2((SUMOReal)0, (exaggeration - 1));
538  if (myShapeColors.size() > 0) {
539  GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, myShapeColors, halfWidth * exaggeration, cornerDetail, offset);
540  } else {
541  GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, halfWidth * exaggeration, cornerDetail, offset);
542  }
543  }
544  glPopMatrix();
545  // draw ROWs (not for inner lanes)
546  if ((!isInternal || isCrossing) && drawDetails) {
547  glPushMatrix();
548  glTranslated(0, 0, GLO_JUNCTION); // must draw on top of junction shape
549  glTranslated(0, 0, .5);
551  // draw sublane-borders
552  // XXX make configurable
553  GLHelper::setColor(GLHelper::getColor().changedBrightness(51));
554  for (SUMOReal offset = -myHalfLaneWidth; offset < myHalfLaneWidth; offset += MSGlobals::gLateralResolution) {
556  }
557  }
558  drawLinkRules(s, *net);
560  drawArrows();
561  }
562  if (s.showLane2Lane) {
563  // this should be independent to the geometry:
564  // draw from end of first to the begin of second
566  }
567  glTranslated(0, 0, .1);
568  if (s.drawLinkJunctionIndex.show) {
569  drawLinkNo(s);
570  }
571  if (s.drawLinkTLIndex.show) {
572  drawTLSLinkNo(s, *net);
573  }
574  glPopMatrix();
575  }
576  }
577  if (mustDrawMarkings && drawDetails) { // needs matrix reset
578  drawMarkings(s, exaggeration);
579  }
580  if (drawDetails && isInternal && myPermissions == SVC_BICYCLE && exaggeration == 1.0 && s.showLinkDecals) {
582  }
583  } else {
584  glPopMatrix();
585  }
586  // draw vehicles
588  // retrieve vehicles from lane; disallow simulation
589  const MSLane::VehCont& vehicles = getVehiclesSecure();
590  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
591  if ((*v)->getLane() == this) {
592  static_cast<const GUIVehicle* const>(*v)->drawGL(s);
593  } // else: this is the shadow during a continuous lane change
594  }
595  // draw parking vehicles
596  const std::set<const MSVehicle*> parking = MSVehicleTransfer::getInstance()->getParkingVehicles(this);
597  for (std::set<const MSVehicle*>::const_iterator v = parking.begin(); v != parking.end(); ++v) {
598  static_cast<const GUIVehicle* const>(*v)->drawGL(s);
599  }
600  // allow lane simulation
601  releaseVehicles();
602  }
603  glPopName();
604 }
605 
606 
607 void
609  glPushMatrix();
610  glTranslated(0, 0, GLO_EDGE);
611  if (!MSGlobals::gUseMesoSim) {
612  setColor(s);
613  }
614  // optionally draw inverse markings
615  if (myIndex > 0 && (myEdge->getLanes()[myIndex - 1]->getPermissions() & myPermissions) != 0) {
616  SUMOReal mw = (myHalfLaneWidth + SUMO_const_laneOffset + .01) * scale * (MSNet::getInstance()->lefthand() ? -1 : 1);
617  int e = (int) getShape().size() - 1;
618  for (int i = 0; i < e; ++i) {
619  glPushMatrix();
620  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
621  glRotated(myShapeRotations[i], 0, 0, 1);
622  for (SUMOReal t = 0; t < myShapeLengths[i]; t += 6) {
623  const SUMOReal length = MIN2((SUMOReal)3, myShapeLengths[i] - t);
624  glBegin(GL_QUADS);
625  glVertex2d(-mw, -t);
626  glVertex2d(-mw, -t - length);
627  glVertex2d(myQuarterLaneWidth * scale, -t - length);
628  glVertex2d(myQuarterLaneWidth * scale, -t);
629  glEnd();
630  }
631  glPopMatrix();
632  }
633  }
634  // draw white boundings and white markings
635  glColor3d(1, 1, 1);
637  getShape(),
639  getShapeLengths(),
641  glPopMatrix();
642 }
643 
644 
645 void
647  // draw bike lane markings onto the intersection
648  glColor3d(1, 1, 1);
649  int e = (int) getShape().size() - 1;
651  for (int i = 0; i < e; ++i) {
652  glPushMatrix();
653  glTranslated(getShape()[i].x(), getShape()[i].y(), GLO_JUNCTION + 0.1);
654  glRotated(myShapeRotations[i], 0, 0, 1);
655  for (SUMOReal t = 0; t < myShapeLengths[i]; t += 0.5) {
656  // left and right marking
657  for (int side = -1; side <= 1; side += 2) {
658  glBegin(GL_QUADS);
659  glVertex2d(side * mw, -t);
660  glVertex2d(side * mw, -t - 0.35);
661  glVertex2d(side * (mw + SUMO_const_laneOffset), -t - 0.35);
662  glVertex2d(side * (mw + SUMO_const_laneOffset), -t);
663  glEnd();
664  }
665  }
666  glPopMatrix();
667  }
668 }
669 
670 void
671 GUILane::drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const {
672  glPushMatrix();
673  // draw on top of of the white area between the rails
674  glTranslated(0, 0, 0.1);
675  int e = (int) getShape().size() - 1;
676  for (int i = 0; i < e; ++i) {
677  glPushMatrix();
678  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.0);
679  glRotated(myShapeRotations[i], 0, 0, 1);
680  for (SUMOReal t = 0; t < myShapeLengths[i]; t += spacing) {
681  glBegin(GL_QUADS);
682  glVertex2d(-halfWidth, -t);
683  glVertex2d(-halfWidth, -t - length);
684  glVertex2d(halfWidth, -t - length);
685  glVertex2d(halfWidth, -t);
686  glEnd();
687  }
688  glPopMatrix();
689  }
690  glPopMatrix();
691 }
692 
693 // ------ inherited from GUIGlObject
696  GUISUMOAbstractView& parent) {
697  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
698  buildPopupHeader(ret, app);
700  //
701  new FXMenuCommand(ret, "Copy edge name to clipboard", 0, ret, MID_COPY_EDGE_NAME);
704  //
705  buildShowParamsPopupEntry(ret, false);
708  new FXMenuCommand(ret, ("pos: " + toString(pos) + " height: " + toString(height)).c_str(), 0, 0, 0);
709  new FXMenuSeparator(ret);
710  buildPositionCopyEntry(ret, false);
711  new FXMenuSeparator(ret);
712  if (myAmClosed) {
713  new FXMenuCommand(ret, "Reopen lane", 0, &parent, MID_CLOSE_LANE);
714  new FXMenuCommand(ret, "Reopen edge", 0, &parent, MID_CLOSE_EDGE);
715  } else {
716  new FXMenuCommand(ret, "Close lane", 0, &parent, MID_CLOSE_LANE);
717  new FXMenuCommand(ret, "Close edge", 0, &parent, MID_CLOSE_EDGE);
718  }
719  new FXMenuCommand(ret, "Add rerouter", 0, &parent, MID_ADD_REROUTER);
720  return ret;
721 }
722 
723 
727  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, 14);
728  // add items
729  ret->mkItem("maxspeed [m/s]", false, getSpeedLimit());
730  ret->mkItem("length [m]", false, myLength);
731  ret->mkItem("width [m]", false, myWidth);
732  ret->mkItem("street name", false, myEdge->getStreetName());
733  ret->mkItem("stored traveltime [s]", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getStoredEdgeTravelTime));
734  ret->mkItem("loaded weight", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getLoadedEdgeWeight));
735  ret->mkItem("routing speed [m/s]", true, new FunctionBinding<MSEdge, SUMOReal>(myEdge, &MSEdge::getRoutingSpeed));
736  ret->mkItem("brutto occupancy [%]", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getBruttoOccupancy, 100.));
737  ret->mkItem("netto occupancy [%]", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getNettoOccupancy, 100.));
738  ret->mkItem("edge type", false, myEdge->getEdgeType());
739  ret->mkItem("priority", false, myEdge->getPriority());
740  ret->mkItem("allowed vehicle class", false, getVehicleClassNames(myPermissions));
741  ret->mkItem("disallowed vehicle class", false, getVehicleClassNames(~myPermissions));
742  ret->mkItem("permission code", false, myPermissions);
743  // close building
744  ret->closeBuilding();
745  return ret;
746 }
747 
748 
749 Boundary
751  Boundary b;
752  b.add(myShape[0]);
753  b.add(myShape[-1]);
754  b.grow(10);
755  // ensure that vehicles and persons on the side are drawn even if the edge
756  // is outside the view
757  return b;
758 }
759 
760 
761 
762 
763 
764 
765 
766 const PositionVector&
768  return myShape;
769 }
770 
771 
772 const std::vector<SUMOReal>&
774  return myShapeRotations;
775 }
776 
777 
778 const std::vector<SUMOReal>&
780  return myShapeLengths;
781 }
782 
783 
784 SUMOReal
786  return myVehicles.size() == 0 ? 0 : myVehicles.back()->getWaitingSeconds();
787 }
788 
789 
790 SUMOReal
792  return (SUMOReal) myEdge->getLanes().size();
793 }
794 
795 
796 SUMOReal
799  if (!ews.knowsTravelTime(myEdge)) {
800  return -1;
801  } else {
802  SUMOReal value(0);
803  ews.retrieveExistingTravelTime(myEdge, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value);
804  return value;
805  }
806 }
807 
808 
809 SUMOReal
812  if (!ews.knowsEffort(myEdge)) {
813  return -1;
814  } else {
815  SUMOReal value(-1);
816  ews.retrieveExistingEffort(myEdge, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value);
817  return value;
818  }
819 }
820 
821 
822 void
824  const GUIColorer& c = s.laneColorer;
825  if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) {
827  }
828 }
829 
830 
831 bool
832 GUILane::setFunctionalColor(size_t activeScheme) const {
833  switch (activeScheme) {
834  case 18: {
837  return true;
838  }
839  default:
840  return false;
841  }
842 }
843 
844 
845 bool
847  const size_t activeScheme = c.getActive();
848  myShapeColors.clear();
849  switch (activeScheme) {
850  case 22: // color by height at segment start
851  for (PositionVector::const_iterator ii = myShape.begin(); ii != myShape.end() - 1; ++ii) {
852  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
853  }
854  return true;
855  case 24: // color by inclination at segment start
856  for (int ii = 1; ii < (int)myShape.size(); ++ii) {
857  const SUMOReal inc = (myShape[ii].z() - myShape[ii - 1].z()) / MAX2(POSITION_EPS, myShape[ii].distanceTo2D(myShape[ii - 1]));
858  myShapeColors.push_back(c.getScheme().getColor(inc));
859  }
860  return true;
861  default:
862  return false;
863  }
864 }
865 
866 
867 SUMOReal
868 GUILane::getColorValue(size_t activeScheme) const {
869  switch (activeScheme) {
870  case 0:
871  switch (myPermissions) {
872  case SVC_PEDESTRIAN:
873  return 1;
874  case SVC_BICYCLE:
875  return 2;
876  case 0:
877  return 3;
878  case SVC_SHIP:
879  return 4;
880  case SVC_AUTHORITY:
881  return 6;
882  default:
883  break;
884  }
886  return 0;
887  } else {
888  return 5;
889  }
890  case 1:
891  return gSelected.isSelected(getType(), getGlID()) ||
892  gSelected.isSelected(GLO_EDGE, dynamic_cast<GUIEdge*>(myEdge)->getGlID());
893  case 2:
894  return (SUMOReal)myPermissions;
895  case 3:
896  return getSpeedLimit();
897  case 4:
898  return getBruttoOccupancy();
899  case 5:
900  return getNettoOccupancy();
901  case 6:
902  return firstWaitingTime();
903  case 7:
904  return getEdgeLaneNumber();
905  case 8:
906  return getCO2Emissions() / myLength;
907  case 9:
908  return getCOEmissions() / myLength;
909  case 10:
910  return getPMxEmissions() / myLength;
911  case 11:
912  return getNOxEmissions() / myLength;
913  case 12:
914  return getHCEmissions() / myLength;
915  case 13:
916  return getFuelConsumption() / myLength;
917  case 14:
919  case 15: {
920  return getStoredEdgeTravelTime();
921  }
922  case 16: {
924  if (!ews.knowsTravelTime(myEdge)) {
925  return -1;
926  } else {
927  SUMOReal value(0);
928  ews.retrieveExistingTravelTime(myEdge, 0, value);
929  return 100 * myLength / value / getSpeedLimit();
930  }
931  }
932  case 17: {
933  return 1 / myLengthGeometryFactor;
934  }
935  case 19: {
936  return getLoadedEdgeWeight();
937  }
938  case 20: {
939  return myEdge->getPriority();
940  }
941  case 21: {
942  // color by z of first shape point
943  return getShape()[0].z();
944  }
945  case 23: {
946  // color by incline
947  return (getShape()[-1].z() - getShape()[0].z()) / getLength();
948  }
949  case 25: {
950  // color by average speed
951  return getMeanSpeed();
952  }
953  case 26: {
954  // color by average relative speed
955  return getMeanSpeed() / myMaxSpeed;
956  }
957  case 27: {
958  // color by routing device assumed speed
959  return myEdge->getRoutingSpeed();
960  }
961  case 28:
963  }
964  return 0;
965 }
966 
967 
968 SUMOReal
969 GUILane::getScaleValue(size_t activeScheme) const {
970  switch (activeScheme) {
971  case 0:
972  return 0;
973  case 1:
974  return gSelected.isSelected(getType(), getGlID()) ||
975  gSelected.isSelected(GLO_EDGE, dynamic_cast<GUIEdge*>(myEdge)->getGlID());
976  case 2:
977  return getSpeedLimit();
978  case 3:
979  return getBruttoOccupancy();
980  case 4:
981  return getNettoOccupancy();
982  case 5:
983  return firstWaitingTime();
984  case 6:
985  return getEdgeLaneNumber();
986  case 7:
987  return getCO2Emissions() / myLength;
988  case 8:
989  return getCOEmissions() / myLength;
990  case 9:
991  return getPMxEmissions() / myLength;
992  case 10:
993  return getNOxEmissions() / myLength;
994  case 11:
995  return getHCEmissions() / myLength;
996  case 12:
997  return getFuelConsumption() / myLength;
998  case 13:
1000  case 14: {
1001  return getStoredEdgeTravelTime();
1002  }
1003  case 15: {
1005  if (!ews.knowsTravelTime(myEdge)) {
1006  return -1;
1007  } else {
1008  SUMOReal value(0);
1009  ews.retrieveExistingTravelTime(myEdge, 0, value);
1010  return 100 * myLength / value / getSpeedLimit();
1011  }
1012  }
1013  case 16: {
1014  return 1 / myLengthGeometryFactor;
1015  }
1016  case 17: {
1017  return getLoadedEdgeWeight();
1018  }
1019  case 18: {
1020  return myEdge->getPriority();
1021  }
1022  case 19: {
1023  // scale by average speed
1024  return getMeanSpeed();
1025  }
1026  case 20: {
1027  // scale by average relative speed
1028  return getMeanSpeed() / myMaxSpeed;
1029  }
1030  case 21:
1032  }
1033  return 0;
1034 }
1035 
1036 
1037 bool
1039  return isRailway(myPermissions) && s.showRails;
1040 }
1041 
1042 
1043 bool
1045  return isWaterway(myPermissions) && s.showRails; // reusing the showRails setting
1046 }
1047 
1048 
1049 #ifdef HAVE_OSG
1050 void
1051 GUILane::updateColor(const GUIVisualizationSettings& s) {
1053  osg::Vec4ubArray* colors = dynamic_cast<osg::Vec4ubArray*>(myGeom->getColorArray());
1054  (*colors)[0].set(col.red(), col.green(), col.blue(), col.alpha());
1055  myGeom->setColorArray(colors);
1056 }
1057 #endif
1058 
1059 
1060 void
1061 GUILane::closeTraffic(bool rebuildAllowed) {
1062  MSGlobals::gCheckRoutes = false;
1063  if (myAmClosed) {
1065  } else {
1068  }
1070  if (rebuildAllowed) {
1072  }
1073 }
1074 
1075 
1078  assert(MSGlobals::gUseMesoSim);
1079  int no = MELoop::numSegmentsFor(myLength, OptionsCont::getOptions().getFloat("meso-edgelength"));
1080  const SUMOReal slength = myLength / no;
1081  PositionVector result = shape;
1082  SUMOReal offset = 0;
1083  for (int i = 0; i < no; ++i) {
1084  offset += slength;
1085  Position pos = shape.positionAtOffset(offset);
1086  int index = result.indexOfClosest(pos);
1087  if (pos.distanceTo(result[index]) > POSITION_EPS) {
1088  index = result.insertAtClosest(pos);
1089  }
1090  while ((int)myShapeSegments.size() < index) {
1091  myShapeSegments.push_back(i);
1092  }
1093  //std::cout << "splitAtSegments " << getID() << " no=" << no << " i=" << i << " offset=" << offset << " index=" << index << " segs=" << toString(myShapeSegments) << " resultSize=" << result.size() << " result=" << toString(result) << "\n";
1094  }
1095  while ((int)myShapeSegments.size() < result.size()) {
1096  myShapeSegments.push_back(no - 1);
1097  }
1098  return result;
1099 }
1100 
1101 /****************************************************************************/
1102 
SUMOReal getScaleValue(size_t activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:504
std::vector< int > myShapeSegments
the meso segment index for each geometry segment
Definition: GUILane.h:319
SUMOReal getExaggeration(const GUIVisualizationSettings &s, SUMOReal factor=20) const
return the drawing size including exaggeration and constantSize values
virtual void incorporateVehicle(MSVehicle *veh, SUMOReal pos, SUMOReal speed, SUMOReal posLat, 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:114
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:1070
void drawLane2LaneConnections() const
Definition: GUILane.cpp:420
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GUILane.h:316
VehCont myVehicles
The lane&#39;s vehicles. This container holds all vehicles that have their front (longitudinally) and the...
Definition: MSLane.h:1034
const std::vector< SUMOReal > & getShapeRotations() const
Definition: GUILane.cpp:773
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:567
bool lefthand() const
return whether the network was built for lefthand traffic
Definition: MSNet.h:653
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:81
SUMOReal getScaleValue(size_t activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUILane.cpp:969
long long int SUMOTime
Definition: SUMOTime.h:43
float laneWidthExaggeration
The lane exaggeration (upscale thickness)
SUMOReal getLoadedEdgeWeight() const
Returns the loaded weight (effort) for the edge of this lane.
Definition: GUILane.cpp:810
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUILane.cpp:823
const SUMOReal SUMO_const_laneWidth
Definition: StdDefs.h:49
is a pedestrian
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:235
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
Definition: GUILane.cpp:186
static RGBColor fromHSV(SUMOReal h, SUMOReal s, SUMOReal v)
Converts the given hsv-triplet to rgb.
Definition: RGBColor.cpp:294
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void drawLinkRules(const GUIVisualizationSettings &s, const GUINet &net) const
Definition: GUILane.cpp:269
~GUILane()
Destructor.
Definition: GUILane.cpp:104
static void debugVertices(const PositionVector &shape, SUMOReal size, SUMOReal layer=256)
draw vertex numbers for the given shape (in a random color)
Definition: GLHelper.cpp:518
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:192
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
Definition: GUILane.cpp:1061
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:475
vehicle is a bicycle
int SVCPermissions
PositionVector splitAtSegments(const PositionVector &shape)
add intermediate points at segment borders
Definition: GUILane.cpp:1077
void drawTextAtEnd(const std::string &text, const PositionVector &shape, SUMOReal x, const GUIVisualizationTextSettings &settings) const
Definition: GUILane.cpp:256
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
int myIndex
The lane index.
Definition: MSLane.h:1021
virtual bool integrateNewVehicle(SUMOTime t)
Insert buffered vehicle into the real lane.
Definition: MSLane.cpp:1302
bool showRails
Information whether rails shall be drawn.
The link is a 180 degree turn.
const RGBColor & getLinkColor(const LinkState &ls)
Definition: StdDefs.cpp:53
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:439
Notification
Definition of a vehicle state.
SUMOReal getFuelConsumption() const
Returns the sum of last step fuel consumption.
Definition: MSLane.cpp:2089
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
Definition: MSLane.cpp:1476
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
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:278
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
SUMOReal getWidth() const
Returns the lane&#39;s width.
Definition: MSLane.h:491
void drawMarkings(const GUIVisualizationSettings &s, SUMOReal scale) const
draw lane borders and white markings
Definition: GUILane.cpp:608
This is a dead end link.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:159
SUMOReal getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
Definition: MSLane.cpp:1985
T MAX2(T a, T b)
Definition: StdDefs.h:75
static void drawBoxLine(const Position &beg, SUMOReal rot, SUMOReal visLength, SUMOReal width, SUMOReal offset=0)
Draws a thick line.
Definition: GLHelper.cpp:130
SVCPermissions myOriginalPermissions
Definition: GUILane.h:333
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
static void drawFilledPoly(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
Definition: GLHelper.cpp:76
This is an uncontrolled, right-before-left link.
SUMOReal getElectricityConsumption() const
Returns the sum of last step electricity consumption.
Definition: MSLane.cpp:2101
const std::vector< SUMOReal > & getShapeLengths() const
Definition: GUILane.cpp:779
#define RAD2DEG(x)
Definition: GeomHelper.h:46
SUMOReal distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:221
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:460
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:52
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
const SUMOReal myWidth
Lane width [m].
Definition: MSLane.h:1061
void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const
draw crossties for railroads or pedestrian crossings
Definition: GUILane.cpp:671
void drawArrows() const
Definition: GUILane.cpp:353
SUMOReal beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
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.
Position positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
SUMOReal myMaxSpeed
Lane-wide speedlimit [m/s].
Definition: MSLane.h:1067
GUIGlID getGlID() const
Returns the numerical id of the object.
static void drawTriangleAtEnd(const Position &p1, const Position &p2, SUMOReal tLength, SUMOReal tWidth)
Draws a triangle at the end of the given line.
Definition: GLHelper.cpp:422
bool integrateNewVehicle(SUMOTime t)
Definition: GUILane.cpp:165
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and some lane function ...
Definition: GUILane.cpp:846
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:1018
SUMOReal getHCEmissions() const
Returns the sum of last step HC emissions.
Definition: MSLane.cpp:2077
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:69
SUMOReal scale
information about a lane&#39;s width (temporary, used for a single view)
void drawBikeMarkings() const
bike lane markings on top of an intersection
Definition: GUILane.cpp:646
authorities vehicles
PositionVector reverse() const
reverse position vector
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.
virtual void incorporateVehicle(MSVehicle *veh, SUMOReal pos, SUMOReal speed, SUMOReal posLat, 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:244
MSLinkCont myLinks
Definition: MSLane.h:1087
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
Definition: MSLane.cpp:916
static void drawFilledPolyTesselated(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
Definition: GLHelper.cpp:95
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:60
std::vector< SUMOReal > myShapeRotations
The rotations of the shape parts.
Definition: GUILane.h:310
A road/street connecting two junctions.
Definition: MSEdge.h:80
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void rebuildAllowedLanes()
Definition: MSEdge.cpp:252
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
Definition: MSLane.cpp:1883
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUILane.cpp:725
void drawLinkNo(const GUIVisualizationSettings &s) const
helper methods
Definition: GUILane.cpp:194
virtual void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
Definition: MSLane.cpp:224
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:443
bool executeMovements(SUMOTime t, std::vector< MSLane * > &into)
Definition: GUILane.cpp:144
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUILane.h:337
static bool gCheckRoutes
Definition: MSGlobals.h:78
static int numSegmentsFor(const SUMOReal length, const SUMOReal slength)
Compute number of segments per edge (best value stay close to the configured segment length) ...
Definition: MELoop.cpp:254
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUILane.cpp:750
This is an uncontrolled, minor link, has to brake.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
A list of positions.
void planMovements(const SUMOTime t)
Definition: GUILane.cpp:137
int indexOfClosest(const Position &p) const
index of the closest position to p
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition: RGBColor.h:99
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterway
Definition: GUILane.cpp:1044
SUMOReal getMeanSpeed() const
Returns the mean speed on this lane.
Definition: MSLane.cpp:2013
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
Definition: GUILane.h:313
SUMOReal z() const
Returns the z-position.
Definition: Position.h:73
SUMOReal setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
Definition: GUILane.cpp:179
#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.
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
int getLinkTLIndex(MSLink *link) const
Definition: GUINet.cpp:210
const T getColor(const SUMOReal value) const
SUMOReal firstWaitingTime() const
Definition: GUILane.cpp:785
GUIVisualizationTextSettings drawLinkTLIndex
T MIN2(T a, T b)
Definition: StdDefs.h:69
The link is a (hard) right direction.
#define POSITION_EPS
Definition: config.h:188
SUMOReal getSpeedLimit() const
Returns the lane&#39;s maximum allowed speed.
Definition: MSLane.h:467
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:76
float minSize
The minimum size to draw this object.
MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify)
Definition: GUILane.cpp:151
SUMOReal myLength
Lane length [m].
Definition: MSLane.h:1058
int insertAtClosest(const Position &p)
inserts p between the two closest positions and returns the insertion index
bool setFunctionalColor(size_t activeScheme) const
sets the color according to the current scheme index and some lane function
Definition: GUILane.cpp:832
virtual SUMOReal setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
Definition: MSLane.cpp:211
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: MSLane.cpp:1465
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
int getIndex() const
Returns the lane&#39;s index.
Definition: MSLane.h:498
GUIScaler edgeScaler
The mesoscopic edge scaler.
The link is a partial right direction.
std::string getVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a &#39; &#39;.
const std::string & getEdgeType() const
Returns the type of the edge.
Definition: MSEdge.h:284
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:91
vehicle is a passenger car (a "normal" car)
SUMOReal getEdgeLaneNumber() const
Definition: GUILane.cpp:791
static SUMOReal naviDegree(const SUMOReal angle)
Definition: GeomHelper.cpp:191
void drawLinkRule(const GUIVisualizationSettings &s, const GUINet &net, MSLink *link, const PositionVector &shape, SUMOReal x1, SUMOReal x2) const
Definition: GUILane.cpp:297
is an arbitrary ship
const SUMOReal myLengthGeometryFactor
precomputed myShape.length / myLength
Definition: MSLane.h:1104
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
void unlock()
release mutex lock
Definition: MFXMutex.cpp:96
void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: GUILane.cpp:158
The edge is a pedestrian walking area (a special type of internal edge)
Definition: MSEdge.h:103
SUMOReal length() const
Returns the length.
SUMOReal getNOxEmissions() const
Returns the sum of last step NOx emissions.
Definition: MSLane.cpp:2065
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:201
SUMOReal getPMxEmissions() const
Returns the sum of last step PMx emissions.
Definition: MSLane.cpp:2053
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
Definition: MSEdge.h:249
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
Definition: GUILane.cpp:868
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
void drawTLSLinkNo(const GUIVisualizationSettings &s, const GUINet &net) const
Definition: GUILane.cpp:222
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:89
int getPriority() const
Returns the priority of the edge.
Definition: MSEdge.h:290
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:797
SUMOReal getCO2Emissions() const
Returns the sum of last step CO2 emissions.
Definition: MSLane.cpp:2029
MSEdge *const myEdge
The lane&#39;s edge, for routing only.
Definition: MSLane.h:1064
SUMOReal getCOEmissions() const
Returns the sum of last step CO emissions.
Definition: MSLane.cpp:2041
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
The edge is a pedestrian crossing (a special type of internal edge)
Definition: MSEdge.h:101
void detectCollisions(SUMOTime timestep, const std::string &stage)
Definition: GUILane.cpp:172
The link has red light (must brake)
static SUMOReal gLateralResolution
Definition: MSGlobals.h:84
The popup menu of a globject.
an edge
SUMOReal myHalfLaneWidth
Half of lane width, for speed-up.
Definition: GUILane.h:322
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.
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition: GUILane.cpp:1038
void lock()
lock mutex
Definition: MFXMutex.cpp:86
void text()
Definition: gl2psTest.c:260
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
unsigned int getLinkTLID(MSLink *link) const
Definition: GUINet.cpp:195
bool myAmClosed
state for dynamic lane closings
Definition: GUILane.h:332
SUMOReal myQuarterLaneWidth
Quarter of lane width, for speed-up.
Definition: GUILane.h:325
const PositionVector & getShape() const
Returns this lane&#39;s shape.
Definition: MSLane.h:422
const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: GUILane.cpp:124
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:232
The link is a 180 degree turn (left-hand network)
static void drawLine(const Position &beg, SUMOReal rot, SUMOReal visLength)
Draws a thin line.
Definition: GLHelper.cpp:269
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
bool knowsEffort(const MSEdge *const e) const
Returns the information whether any effort is known for the given edge.
SUMOReal getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:659
unsigned char green() const
Returns the green-amount of the color.
Definition: RGBColor.h:83
#define SUMOReal
Definition: config.h:214
GUIVisualizationSizeSettings vehicleSize
FXbool locked()
Definition: MFXMutex.h:70
bool retrieveExistingEffort(const MSEdge *const e, const SUMOReal t, SUMOReal &value) const
Returns an effort for an edge and time if stored.
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:2113
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUILane.cpp:695
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
The edge is an internal edge.
Definition: MSEdge.h:97
SUMOReal interpolateGeometryPosToLanePos(SUMOReal geometryPos) const
Definition: MSLane.h:445
SUMOReal getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
Definition: MSLane.cpp:1970
virtual bool executeMovements(SUMOTime t, std::vector< MSLane * > &lanesWithVehiclesToIntegrate)
Executes planned vehicle movements with regards to right-of-way.
Definition: MSLane.cpp:1124
GUIScaler laneScaler
The lane scaler.
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.
static bool gUseMesoSim
Definition: MSGlobals.h:90
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
A window containing a gl-object&#39;s parameter.
bool retrieveExistingTravelTime(const MSEdge *const e, const SUMOReal t, SUMOReal &value) const
Returns a travel time for an edge and time if stored.
The link has red light (must brake) but indicates upcoming green.
GUIVisualizationTextSettings drawLinkJunctionIndex
void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: GUILane.cpp:131
void extrapolate(const SUMOReal val, const bool onlyFirst=false)
extrapolate position vector
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:874
The link has no direction (is a dead end link)
const PositionVector & getShape() const
Definition: GUILane.cpp:767
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net&#39;s internal edge travel times/efforts container.
Definition: MSNet.cpp:710
a junction
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