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