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>
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 #ifdef CHECK_MEMORY_LEAKS
69 #include <foreign/nvwa/debug_new.h>
70 #endif // CHECK_MEMORY_LEAKS
71 
72 //#define GUILane_DEBUG_DRAW_WALKING_AREA_VERTICES
73 //#define GUILane_DEBUG_DRAW_VERTICES
74 
75 // ===========================================================================
76 // method definitions
77 // ===========================================================================
78 GUILane::GUILane(const std::string& id, SUMOReal maxSpeed, SUMOReal length,
79  MSEdge* const edge, int numericalID,
80  const PositionVector& shape, SUMOReal width,
81  SVCPermissions permissions, int index) :
82  MSLane(id, maxSpeed, length, edge, numericalID, shape, width, permissions, index),
83  GUIGlObject(GLO_LANE, id),
84  myAmClosed(false) {
86  myShape = splitAtSegments(shape);
87  assert(fabs(myShape.length() - shape.length()) < POSITION_EPS);
88  assert(myShapeSegments.size() == myShape.size());
89  }
90  myShapeRotations.reserve(myShape.size() - 1);
91  myShapeLengths.reserve(myShape.size() - 1);
92  myShapeColors.reserve(myShape.size() - 1);
93  int e = (int) myShape.size() - 1;
94  for (int i = 0; i < e; ++i) {
95  const Position& f = myShape[i];
96  const Position& s = myShape[i + 1];
97  myShapeLengths.push_back(f.distanceTo2D(s));
98  myShapeRotations.push_back(RAD2DEG(atan2(s.x() - f.x(), f.y() - s.y())));
99  }
100  //
101  myHalfLaneWidth = (SUMOReal)(myWidth / 2.);
103 }
104 
105 
107  // just to quit cleanly on a failure
108  if (myLock.locked()) {
109  myLock.unlock();
110  }
111 }
112 
113 
114 // ------ Vehicle insertion ------
115 void
117  const MSLane::VehCont::iterator& at,
118  MSMoveReminder::Notification notification) {
120  MSLane::incorporateVehicle(veh, pos, speed, posLat, at, notification);
121 }
122 
123 
124 // ------ Access to vehicles ------
125 const MSLane::VehCont&
127  myLock.lock();
128  return myVehicles;
129 }
130 
131 
132 void
134  myLock.unlock();
135 }
136 
137 
138 void
142 }
143 
144 
145 bool
146 GUILane::executeMovements(SUMOTime t, std::vector<MSLane*>& into) {
148  return MSLane::executeMovements(t, into);
149 }
150 
151 
152 MSVehicle*
153 GUILane::removeVehicle(MSVehicle* remVehicle, MSMoveReminder::Notification notification, bool notify) {
155  return MSLane::removeVehicle(remVehicle, notification, notify);
156 }
157 
158 
159 void
163 }
164 
165 
166 bool
169  return MSLane::integrateNewVehicle(t);
170 }
171 
172 
173 void
174 GUILane::detectCollisions(SUMOTime timestep, const std::string& stage) {
176  MSLane::detectCollisions(timestep, stage);
177 }
178 
179 
180 SUMOReal
184 }
185 
186 
187 void
191 }
192 
193 
194 // ------ Drawing methods ------
195 void
197  int noLinks = (int)myLinks.size();
198  if (noLinks == 0) {
199  return;
200  }
201  // draw all links
202  if (getEdge().isCrossing()) {
203  // draw indices at the start and end of the crossing
205  PositionVector shape = getShape();
206  shape.extrapolate(0.5); // draw on top of the walking area
207  drawTextAtEnd(toString(link->getIndex()), shape, 0, s.drawLinkJunctionIndex);
209  return;
210  }
211  // draw all links
212  SUMOReal w = myWidth / (SUMOReal) noLinks;
214  const bool lefthand = MSNet::getInstance()->lefthand();
215  for (int i = noLinks; --i >= 0;) {
216  SUMOReal x2 = x1 - (SUMOReal)(w / 2.);
217  drawTextAtEnd(toString(myLinks[lefthand ? noLinks - 1 - i : i]->getIndex()), getShape(), x2, s.drawLinkJunctionIndex);
218  x1 -= w;
219  }
220 }
221 
222 
223 void
225  int noLinks = (int)myLinks.size();
226  if (noLinks == 0) {
227  return;
228  }
229  if (getEdge().isCrossing()) {
230  // draw indices at the start and end of the crossing
232  int linkNo = net.getLinkTLIndex(link);
233  if (linkNo >= 0) {
234  PositionVector shape = getShape();
235  shape.extrapolate(0.5); // draw on top of the walking area
236  drawTextAtEnd(toString(linkNo), shape, 0, s.drawLinkTLIndex);
237  drawTextAtEnd(toString(linkNo), shape.reverse(), 0, s.drawLinkTLIndex);
238  }
239  return;
240  }
241  // draw all links
242  SUMOReal w = myWidth / (SUMOReal) noLinks;
244  const bool lefthand = MSNet::getInstance()->lefthand();
245  for (int i = noLinks; --i >= 0;) {
246  SUMOReal x2 = x1 - (SUMOReal)(w / 2.);
247  int linkNo = net.getLinkTLIndex(myLinks[lefthand ? noLinks - 1 - i : i]);
248  if (linkNo < 0) {
249  continue;
250  }
251  drawTextAtEnd(toString(linkNo), getShape(), x2, s.drawLinkTLIndex);
252  x1 -= w;
253  }
254 }
255 
256 
257 void
258 GUILane::drawTextAtEnd(const std::string& text, const PositionVector& shape, SUMOReal x, const GUIVisualizationTextSettings& settings) const {
259  glPushMatrix();
260  const Position& end = shape.back();
261  const Position& f = shape[-2];
262  const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
263  glTranslated(end.x(), end.y(), 0);
264  glRotated(rot, 0, 0, 1);
265  GLHelper::drawText(text, Position(x, 0.26), 0, .6 * settings.size / 50, settings.color, 180);
266  glPopMatrix();
267 }
268 
269 
270 void
272  int noLinks = (int)myLinks.size();
273  if (noLinks == 0) {
274  drawLinkRule(s, net, 0, getShape(), 0, 0);
275  return;
276  }
277  if (getEdge().isCrossing()) {
278  // draw rules at the start and end of the crossing
280  PositionVector shape = getShape();
281  shape.extrapolate(0.5); // draw on top of the walking area
282  drawLinkRule(s, net, link, shape, 0, myWidth);
283  drawLinkRule(s, net, link, shape.reverse(), 0, myWidth);
284  return;
285  }
286  // draw all links
287  SUMOReal w = myWidth / (SUMOReal) noLinks;
288  SUMOReal x1 = 0;
289  const bool lefthand = MSNet::getInstance()->lefthand();
290  for (int i = 0; i < noLinks; ++i) {
291  SUMOReal x2 = x1 + w;
292  drawLinkRule(s, net, myLinks[lefthand ? noLinks - 1 - i : i], getShape(), x1, x2);
293  x1 = x2;
294  }
295 }
296 
297 
298 void
299 GUILane::drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, SUMOReal x1, SUMOReal x2) const {
300  const Position& end = shape.back();
301  const Position& f = shape[-2];
302  const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
303  if (link == 0) {
305  glPushMatrix();
306  glTranslated(end.x(), end.y(), 0);
307  glRotated(rot, 0, 0, 1);
308  glBegin(GL_QUADS);
309  glVertex2d(-myHalfLaneWidth, 0.0);
310  glVertex2d(-myHalfLaneWidth, 0.5);
311  glVertex2d(myHalfLaneWidth, 0.5);
312  glVertex2d(myHalfLaneWidth, 0.0);
313  glEnd();
314  glPopMatrix();
315  } else {
316  glPushMatrix();
317  glTranslated(end.x(), end.y(), 0);
318  glRotated(rot, 0, 0, 1);
319  // select glID
320  switch (link->getState()) {
323  case LINKSTATE_TL_RED:
328  glPushName(net.getLinkTLID(link));
329  break;
330  case LINKSTATE_MAJOR:
331  case LINKSTATE_MINOR:
332  case LINKSTATE_EQUAL:
334  default:
335  glPushName(getGlID());
336  break;
337  }
339  if (!(drawAsRailway(s) || drawAsWaterway(s)) || link->getState() != LINKSTATE_MAJOR) {
340  // the white bar should be the default for most railway
341  // links and looks ugly so we do not draw it
342  glBegin(GL_QUADS);
343  glVertex2d(x1 - myHalfLaneWidth, 0.0);
344  glVertex2d(x1 - myHalfLaneWidth, 0.5);
345  glVertex2d(x2 - myHalfLaneWidth, 0.5);
346  glVertex2d(x2 - myHalfLaneWidth, 0.0);
347  glEnd();
348  }
349  glPopName();
350  glPopMatrix();
351  }
352 }
353 
354 void
356  if (myLinks.size() == 0) {
357  return;
358  }
359  // draw all links
360  const Position& end = getShape().back();
361  const Position& f = getShape()[-2];
362  const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
363  glPushMatrix();
364  glColor3d(1, 1, 1);
365  glTranslated(end.x(), end.y(), 0);
366  glRotated(rot, 0, 0, 1);
368  glScaled(myWidth / SUMO_const_laneWidth, 1, 1);
369  }
370  for (std::vector<MSLink*>::const_iterator i = myLinks.begin(); i != myLinks.end(); ++i) {
371  LinkDirection dir = (*i)->getDirection();
372  LinkState state = (*i)->getState();
373  if (state == LINKSTATE_TL_OFF_NOSIGNAL || dir == LINKDIR_NODIR) {
374  continue;
375  }
376  switch (dir) {
377  case LINKDIR_STRAIGHT:
378  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
380  break;
381  case LINKDIR_TURN:
382  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
383  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
384  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
385  GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (SUMOReal) 1, (SUMOReal) .25);
386  break;
388  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
389  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
390  GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
391  GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (SUMOReal) 1, (SUMOReal) .25);
392  break;
393  case LINKDIR_LEFT:
394  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
395  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
396  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (SUMOReal) 1, (SUMOReal) .25);
397  break;
398  case LINKDIR_RIGHT:
399  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
400  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
401  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (SUMOReal) 1, (SUMOReal) .25);
402  break;
403  case LINKDIR_PARTLEFT:
404  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
405  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
406  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (SUMOReal) 1, (SUMOReal) .25);
407  break;
408  case LINKDIR_PARTRIGHT:
409  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
410  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
411  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (SUMOReal) 1, (SUMOReal) .25);
412  break;
413  default:
414  break;
415  }
416  }
417  glPopMatrix();
418 }
419 
420 
421 void
423  for (std::vector<MSLink*>::const_iterator i = myLinks.begin(); i != myLinks.end(); ++i) {
424  const MSLane* connected = (*i)->getLane();
425  if (connected == 0) {
426  continue;
427  }
428  GLHelper::setColor(getLinkColor((*i)->getState()));
429  glBegin(GL_LINES);
430  const Position& p1 = getShape()[-1];
431  const Position& p2 = connected->getShape()[0];
432  glVertex2f(p1.x(), p1.y());
433  glVertex2f(p2.x(), p2.y());
434  glEnd();
435  GLHelper::drawTriangleAtEnd(p1, p2, (SUMOReal) .4, (SUMOReal) .2);
436  }
437 }
438 
439 
440 void
442  glPushMatrix();
443  glPushName(getGlID());
444  const bool isCrossing = myEdge->getPurpose() == MSEdge::EDGEFUNCTION_CROSSING;
445  const bool isWalkingArea = myEdge->getPurpose() == MSEdge::EDGEFUNCTION_WALKINGAREA;
446  const bool isInternal = isCrossing || isWalkingArea || myEdge->getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL;
447  bool mustDrawMarkings = false;
448  SUMOReal exaggeration = s.laneWidthExaggeration;
450  GUIEdge* myGUIEdge = dynamic_cast<GUIEdge*>(myEdge);
451  exaggeration *= s.edgeScaler.getScheme().getColor(myGUIEdge->getScaleValue(s.edgeScaler.getActive()));
452  } else {
454  }
455  const bool drawDetails = s.scale * exaggeration > 5;
456  if (isCrossing || isWalkingArea) {
457  // draw internal lanes on top of junctions
458  glTranslated(0, 0, GLO_JUNCTION + 0.1);
459  } else if (isWaterway(myPermissions)) {
460  // draw waterways below normal roads
461  glTranslated(0, 0, getType() - 0.2);
462  } else {
463  glTranslated(0, 0, getType());
464  }
465  // set lane color
466  if (!MSGlobals::gUseMesoSim) {
467  setColor(s);
468  } else {
469  myShapeColors.clear();
470  const std::vector<RGBColor>& segmentColors = static_cast<const GUIEdge*>(myEdge)->getSegmentColors();
471  if (segmentColors.size() > 0) {
472  // apply segment specific shape colors
473  //std::cout << getID() << " shape=" << myShape << " shapeSegs=" << toString(myShapeSegments) << "\n";
474  for (int ii = 0; ii < (int)myShape.size() - 1; ++ii) {
475  myShapeColors.push_back(segmentColors[myShapeSegments[ii]]);
476  }
477  }
478  }
479  // recognize full transparency and simply don't draw
480  GLfloat color[4];
481  glGetFloatv(GL_CURRENT_COLOR, color);
482  if (color[3] != 0 && s.scale * exaggeration > s.laneMinSize) {
483  // draw lane
484  // check whether it is not too small
485  if (s.scale * exaggeration < 1.) {
486  if (myShapeColors.size() > 0) {
488  } else {
490  }
491  glPopMatrix();
492  } else {
493  GUINet* net = (GUINet*) MSNet::getInstance();
494  if (drawAsRailway(s)) {
495  // draw as railway
496  const SUMOReal halfRailWidth = 0.725 * exaggeration;
497  if (myShapeColors.size() > 0) {
499  } else {
501  }
502  glColor3d(1, 1, 1);
503  glTranslated(0, 0, .1);
505  if (!MSGlobals::gUseMesoSim) {
506  setColor(s);
507  }
508  drawCrossties(0.3 * exaggeration, 1 * exaggeration, 1 * exaggeration);
509  } else if (isCrossing) {
511  // determine priority to decide color
513  if (link->havePriority() || net->getLinkTLIndex(link) > 0) {
514  glColor3d(0.9, 0.9, 0.9);
515  } else {
516  glColor3d(0.1, 0.1, 0.1);
517  }
518  glTranslated(0, 0, .2);
519  drawCrossties(0.5, 1.0, getWidth() * 0.5);
520  glTranslated(0, 0, -.2);
521  }
522  } else if (isWalkingArea) {
524  glTranslated(0, 0, .2);
525  if (s.scale * exaggeration < 20.) {
527  } else {
529  }
530  glTranslated(0, 0, -.2);
531 #ifdef GUILane_DEBUG_DRAW_WALKING_AREA_VERTICES
533 #endif
534  }
535  } else {
536  const SUMOReal halfWidth = isInternal ? myQuarterLaneWidth : myHalfLaneWidth;
537  mustDrawMarkings = !isInternal && myPermissions != 0 && myPermissions != SVC_PEDESTRIAN && exaggeration == 1.0 && !isWaterway(myPermissions);
538  const int cornerDetail = drawDetails && !isInternal ? s.scale * exaggeration : 0;
539  const SUMOReal offset = halfWidth * MAX2((SUMOReal)0, (exaggeration - 1));
540  if (myShapeColors.size() > 0) {
541  GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, myShapeColors, halfWidth * exaggeration, cornerDetail, offset);
542  } else {
543  GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, halfWidth * exaggeration, cornerDetail, offset);
544  }
545  }
546 #ifdef GUILane_DEBUG_DRAW_VERTICES
548 #endif
549  glPopMatrix();
550  // draw ROWs (not for inner lanes)
551  if ((!isInternal || isCrossing) && drawDetails) {
552  glPushMatrix();
553  glTranslated(0, 0, GLO_JUNCTION); // must draw on top of junction shape
554  glTranslated(0, 0, .5);
556  // draw sublane-borders
557  GLHelper::setColor(GLHelper::getColor().changedBrightness(51));
558  for (SUMOReal offset = -myHalfLaneWidth; offset < myHalfLaneWidth; offset += MSGlobals::gLateralResolution) {
560  }
561  }
562  drawLinkRules(s, *net);
564  drawArrows();
565  }
566  if (s.showLane2Lane) {
567  // this should be independent to the geometry:
568  // draw from end of first to the begin of second
570  }
571  if (s.showLaneDirection) {
573  }
574  glTranslated(0, 0, .1);
575  if (s.drawLinkJunctionIndex.show) {
576  drawLinkNo(s);
577  }
578  if (s.drawLinkTLIndex.show) {
579  drawTLSLinkNo(s, *net);
580  }
581  glPopMatrix();
582  }
583  }
584  if (mustDrawMarkings && drawDetails) { // needs matrix reset
585  drawMarkings(s, exaggeration);
586  }
587  if (drawDetails && isInternal && myPermissions == SVC_BICYCLE && exaggeration == 1.0 && s.showLinkDecals) {
589  }
590  } else {
591  glPopMatrix();
592  }
593  // draw vehicles
595  // retrieve vehicles from lane; disallow simulation
596  const MSLane::VehCont& vehicles = getVehiclesSecure();
597  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
598  if ((*v)->getLane() == this) {
599  static_cast<const GUIVehicle* const>(*v)->drawGL(s);
600  } // else: this is the shadow during a continuous lane change
601  }
602  // draw parking vehicles
603  const std::set<const MSVehicle*> parking = MSVehicleTransfer::getInstance()->getParkingVehicles(this);
604  for (std::set<const MSVehicle*>::const_iterator v = parking.begin(); v != parking.end(); ++v) {
605  static_cast<const GUIVehicle* const>(*v)->drawGL(s);
606  }
607  // allow lane simulation
608  releaseVehicles();
609  }
610  glPopName();
611 }
612 
613 
614 void
616  glPushMatrix();
617  glTranslated(0, 0, GLO_EDGE);
618  if (!MSGlobals::gUseMesoSim) {
619  setColor(s);
620  }
621  // optionally draw inverse markings
622  if (myIndex > 0 && (myEdge->getLanes()[myIndex - 1]->getPermissions() & myPermissions) != 0) {
623  SUMOReal mw = (myHalfLaneWidth + SUMO_const_laneOffset + .01) * scale * (MSNet::getInstance()->lefthand() ? -1 : 1);
624  int e = (int) getShape().size() - 1;
625  for (int i = 0; i < e; ++i) {
626  glPushMatrix();
627  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
628  glRotated(myShapeRotations[i], 0, 0, 1);
629  for (SUMOReal t = 0; t < myShapeLengths[i]; t += 6) {
630  const SUMOReal length = MIN2((SUMOReal)3, myShapeLengths[i] - t);
631  glBegin(GL_QUADS);
632  glVertex2d(-mw, -t);
633  glVertex2d(-mw, -t - length);
634  glVertex2d(myQuarterLaneWidth * scale, -t - length);
635  glVertex2d(myQuarterLaneWidth * scale, -t);
636  glEnd();
637  }
638  glPopMatrix();
639  }
640  }
641  // draw white boundings and white markings
642  glColor3d(1, 1, 1);
644  getShape(),
646  getShapeLengths(),
648  glPopMatrix();
649 }
650 
651 
652 void
654  // draw bike lane markings onto the intersection
655  glColor3d(1, 1, 1);
656  int e = (int) getShape().size() - 1;
658  for (int i = 0; i < e; ++i) {
659  glPushMatrix();
660  glTranslated(getShape()[i].x(), getShape()[i].y(), GLO_JUNCTION + 0.1);
661  glRotated(myShapeRotations[i], 0, 0, 1);
662  for (SUMOReal t = 0; t < myShapeLengths[i]; t += 0.5) {
663  // left and right marking
664  for (int side = -1; side <= 1; side += 2) {
665  glBegin(GL_QUADS);
666  glVertex2d(side * mw, -t);
667  glVertex2d(side * mw, -t - 0.35);
668  glVertex2d(side * (mw + SUMO_const_laneOffset), -t - 0.35);
669  glVertex2d(side * (mw + SUMO_const_laneOffset), -t);
670  glEnd();
671  }
672  }
673  glPopMatrix();
674  }
675 }
676 
677 void
678 GUILane::drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const {
679  glPushMatrix();
680  // draw on top of of the white area between the rails
681  glTranslated(0, 0, 0.1);
682  int e = (int) getShape().size() - 1;
683  for (int i = 0; i < e; ++i) {
684  glPushMatrix();
685  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.0);
686  glRotated(myShapeRotations[i], 0, 0, 1);
687  for (SUMOReal t = 0; t < myShapeLengths[i]; t += spacing) {
688  glBegin(GL_QUADS);
689  glVertex2d(-halfWidth, -t);
690  glVertex2d(-halfWidth, -t - length);
691  glVertex2d(halfWidth, -t - length);
692  glVertex2d(halfWidth, -t);
693  glEnd();
694  }
695  glPopMatrix();
696  }
697  glPopMatrix();
698 }
699 
700 
701 void
703  glColor3d(0.3, 0.3, 0.3);
704  glPushMatrix();
705  glTranslated(0, 0, GLO_EDGE);
706  int e = (int) getShape().size() - 1;
707  for (int i = 0; i < e; ++i) {
708  glPushMatrix();
709  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
710  glRotated(myShapeRotations[i], 0, 0, 1);
711  for (SUMOReal t = 0; t < myShapeLengths[i]; t += myWidth) {
712  const SUMOReal length = MIN2((SUMOReal)myHalfLaneWidth, myShapeLengths[i] - t);
713  glBegin(GL_TRIANGLES);
714  glVertex2d(0, -t - length);
715  glVertex2d(-myQuarterLaneWidth, -t);
716  glVertex2d(+myQuarterLaneWidth, -t);
717  glEnd();
718  }
719  glPopMatrix();
720  }
721  glPopMatrix();
722 }
723 
724 
725 
726 // ------ inherited from GUIGlObject
729  GUISUMOAbstractView& parent) {
730  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
731  buildPopupHeader(ret, app);
733  //
734  new FXMenuCommand(ret, "Copy edge name to clipboard", 0, ret, MID_COPY_EDGE_NAME);
737  //
738  buildShowParamsPopupEntry(ret, false);
741  new FXMenuCommand(ret, ("pos: " + toString(pos) + " height: " + toString(height)).c_str(), 0, 0, 0);
742  new FXMenuSeparator(ret);
743  buildPositionCopyEntry(ret, false);
744  new FXMenuSeparator(ret);
745  if (myAmClosed) {
746  new FXMenuCommand(ret, "Reopen lane", 0, &parent, MID_CLOSE_LANE);
747  new FXMenuCommand(ret, "Reopen edge", 0, &parent, MID_CLOSE_EDGE);
748  } else {
749  new FXMenuCommand(ret, "Close lane", 0, &parent, MID_CLOSE_LANE);
750  new FXMenuCommand(ret, "Close edge", 0, &parent, MID_CLOSE_EDGE);
751  }
752  new FXMenuCommand(ret, "Add rerouter", 0, &parent, MID_ADD_REROUTER);
753  return ret;
754 }
755 
756 
760  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, 14);
761  // add items
762  ret->mkItem("maxspeed [m/s]", false, getSpeedLimit());
763  ret->mkItem("length [m]", false, myLength);
764  ret->mkItem("width [m]", false, myWidth);
765  ret->mkItem("street name", false, myEdge->getStreetName());
766  ret->mkItem("stored traveltime [s]", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getStoredEdgeTravelTime));
767  ret->mkItem("loaded weight", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getLoadedEdgeWeight));
768  ret->mkItem("routing speed [m/s]", true, new FunctionBinding<MSEdge, SUMOReal>(myEdge, &MSEdge::getRoutingSpeed));
769  ret->mkItem("brutto occupancy [%]", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getBruttoOccupancy, 100.));
770  ret->mkItem("netto occupancy [%]", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getNettoOccupancy, 100.));
771  ret->mkItem("edge type", false, myEdge->getEdgeType());
772  ret->mkItem("priority", false, myEdge->getPriority());
773  ret->mkItem("allowed vehicle class", false, getVehicleClassNames(myPermissions));
774  ret->mkItem("disallowed vehicle class", false, getVehicleClassNames(~myPermissions));
775  ret->mkItem("permission code", false, myPermissions);
776  // close building
777  ret->closeBuilding();
778  return ret;
779 }
780 
781 
782 Boundary
784  Boundary b;
785  b.add(myShape[0]);
786  b.add(myShape[-1]);
787  b.grow(10);
788  // ensure that vehicles and persons on the side are drawn even if the edge
789  // is outside the view
790  return b;
791 }
792 
793 
794 
795 
796 
797 
798 
799 const PositionVector&
801  return myShape;
802 }
803 
804 
805 const std::vector<SUMOReal>&
807  return myShapeRotations;
808 }
809 
810 
811 const std::vector<SUMOReal>&
813  return myShapeLengths;
814 }
815 
816 
817 SUMOReal
819  return myVehicles.size() == 0 ? 0 : myVehicles.back()->getWaitingSeconds();
820 }
821 
822 
823 SUMOReal
825  return (SUMOReal) myEdge->getLanes().size();
826 }
827 
828 
829 SUMOReal
832  if (!ews.knowsTravelTime(myEdge)) {
833  return -1;
834  } else {
835  SUMOReal value(0);
836  ews.retrieveExistingTravelTime(myEdge, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value);
837  return value;
838  }
839 }
840 
841 
842 SUMOReal
845  if (!ews.knowsEffort(myEdge)) {
846  return -1;
847  } else {
848  SUMOReal value(-1);
849  ews.retrieveExistingEffort(myEdge, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value);
850  return value;
851  }
852 }
853 
854 
855 void
857  const GUIColorer& c = s.laneColorer;
858  if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) {
860  }
861 }
862 
863 
864 bool
865 GUILane::setFunctionalColor(int activeScheme) const {
866  switch (activeScheme) {
867  case 18: {
870  return true;
871  }
872  default:
873  return false;
874  }
875 }
876 
877 
878 bool
880  const int activeScheme = c.getActive();
881  myShapeColors.clear();
882  switch (activeScheme) {
883  case 22: // color by height at segment start
884  for (PositionVector::const_iterator ii = myShape.begin(); ii != myShape.end() - 1; ++ii) {
885  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
886  }
887  return true;
888  case 24: // color by inclination at segment start
889  for (int ii = 1; ii < (int)myShape.size(); ++ii) {
890  const SUMOReal inc = (myShape[ii].z() - myShape[ii - 1].z()) / MAX2(POSITION_EPS, myShape[ii].distanceTo2D(myShape[ii - 1]));
891  myShapeColors.push_back(c.getScheme().getColor(inc));
892  }
893  return true;
894  default:
895  return false;
896  }
897 }
898 
899 
900 SUMOReal
901 GUILane::getColorValue(int activeScheme) const {
902  switch (activeScheme) {
903  case 0:
904  switch (myPermissions) {
905  case SVC_PEDESTRIAN:
906  return 1;
907  case SVC_BICYCLE:
908  return 2;
909  case 0:
910  return 3;
911  case SVC_SHIP:
912  return 4;
913  case SVC_AUTHORITY:
914  return 6;
915  default:
916  break;
917  }
919  return 0;
920  } else {
921  return 5;
922  }
923  case 1:
924  return gSelected.isSelected(getType(), getGlID()) ||
925  gSelected.isSelected(GLO_EDGE, dynamic_cast<GUIEdge*>(myEdge)->getGlID());
926  case 2:
927  return (SUMOReal)myPermissions;
928  case 3:
929  return getSpeedLimit();
930  case 4:
931  return getBruttoOccupancy();
932  case 5:
933  return getNettoOccupancy();
934  case 6:
935  return firstWaitingTime();
936  case 7:
937  return getEdgeLaneNumber();
938  case 8:
939  return getCO2Emissions() / myLength;
940  case 9:
941  return getCOEmissions() / myLength;
942  case 10:
943  return getPMxEmissions() / myLength;
944  case 11:
945  return getNOxEmissions() / myLength;
946  case 12:
947  return getHCEmissions() / myLength;
948  case 13:
949  return getFuelConsumption() / myLength;
950  case 14:
952  case 15: {
953  return getStoredEdgeTravelTime();
954  }
955  case 16: {
957  if (!ews.knowsTravelTime(myEdge)) {
958  return -1;
959  } else {
960  SUMOReal value(0);
961  ews.retrieveExistingTravelTime(myEdge, 0, value);
962  return 100 * myLength / value / getSpeedLimit();
963  }
964  }
965  case 17: {
966  return 1 / myLengthGeometryFactor;
967  }
968  case 19: {
969  return getLoadedEdgeWeight();
970  }
971  case 20: {
972  return myEdge->getPriority();
973  }
974  case 21: {
975  // color by z of first shape point
976  return getShape()[0].z();
977  }
978  case 23: {
979  // color by incline
980  return (getShape()[-1].z() - getShape()[0].z()) / getLength();
981  }
982  case 25: {
983  // color by average speed
984  return getMeanSpeed();
985  }
986  case 26: {
987  // color by average relative speed
988  return getMeanSpeed() / myMaxSpeed;
989  }
990  case 27: {
991  // color by routing device assumed speed
992  return myEdge->getRoutingSpeed();
993  }
994  case 28:
996  case 29:
998  }
999  return 0;
1000 }
1001 
1002 
1003 SUMOReal
1004 GUILane::getScaleValue(int activeScheme) const {
1005  switch (activeScheme) {
1006  case 0:
1007  return 0;
1008  case 1:
1009  return gSelected.isSelected(getType(), getGlID()) ||
1010  gSelected.isSelected(GLO_EDGE, dynamic_cast<GUIEdge*>(myEdge)->getGlID());
1011  case 2:
1012  return getSpeedLimit();
1013  case 3:
1014  return getBruttoOccupancy();
1015  case 4:
1016  return getNettoOccupancy();
1017  case 5:
1018  return firstWaitingTime();
1019  case 6:
1020  return getEdgeLaneNumber();
1021  case 7:
1022  return getCO2Emissions() / myLength;
1023  case 8:
1024  return getCOEmissions() / myLength;
1025  case 9:
1026  return getPMxEmissions() / myLength;
1027  case 10:
1028  return getNOxEmissions() / myLength;
1029  case 11:
1030  return getHCEmissions() / myLength;
1031  case 12:
1032  return getFuelConsumption() / myLength;
1033  case 13:
1035  case 14: {
1036  return getStoredEdgeTravelTime();
1037  }
1038  case 15: {
1040  if (!ews.knowsTravelTime(myEdge)) {
1041  return -1;
1042  } else {
1043  SUMOReal value(0);
1044  ews.retrieveExistingTravelTime(myEdge, 0, value);
1045  return 100 * myLength / value / getSpeedLimit();
1046  }
1047  }
1048  case 16: {
1049  return 1 / myLengthGeometryFactor;
1050  }
1051  case 17: {
1052  return getLoadedEdgeWeight();
1053  }
1054  case 18: {
1055  return myEdge->getPriority();
1056  }
1057  case 19: {
1058  // scale by average speed
1059  return getMeanSpeed();
1060  }
1061  case 20: {
1062  // scale by average relative speed
1063  return getMeanSpeed() / myMaxSpeed;
1064  }
1065  case 21:
1067  case 22:
1069  }
1070  return 0;
1071 }
1072 
1073 
1074 bool
1076  return isRailway(myPermissions) && s.showRails;
1077 }
1078 
1079 
1080 bool
1082  return isWaterway(myPermissions) && s.showRails; // reusing the showRails setting
1083 }
1084 
1085 
1086 #ifdef HAVE_OSG
1087 void
1088 GUILane::updateColor(const GUIVisualizationSettings& s) {
1090  osg::Vec4ubArray* colors = dynamic_cast<osg::Vec4ubArray*>(myGeom->getColorArray());
1091  (*colors)[0].set(col.red(), col.green(), col.blue(), col.alpha());
1092  myGeom->setColorArray(colors);
1093 }
1094 #endif
1095 
1096 
1097 void
1098 GUILane::closeTraffic(bool rebuildAllowed) {
1099  MSGlobals::gCheckRoutes = false;
1100  if (myAmClosed) {
1102  } else {
1105  }
1107  if (rebuildAllowed) {
1109  }
1110 }
1111 
1112 
1115  assert(MSGlobals::gUseMesoSim);
1116  int no = MELoop::numSegmentsFor(myLength, OptionsCont::getOptions().getFloat("meso-edgelength"));
1117  const SUMOReal slength = myLength / no;
1118  PositionVector result = shape;
1119  SUMOReal offset = 0;
1120  for (int i = 0; i < no; ++i) {
1121  offset += slength;
1122  Position pos = shape.positionAtOffset(offset);
1123  int index = result.indexOfClosest(pos);
1124  if (pos.distanceTo(result[index]) > POSITION_EPS) {
1125  index = result.insertAtClosest(pos);
1126  }
1127  while ((int)myShapeSegments.size() < index) {
1128  myShapeSegments.push_back(i);
1129  }
1130  //std::cout << "splitAtSegments " << getID() << " no=" << no << " i=" << i << " offset=" << offset << " index=" << index << " segs=" << toString(myShapeSegments) << " resultSize=" << result.size() << " result=" << toString(result) << "\n";
1131  }
1132  while (myShapeSegments.size() < result.size()) {
1133  myShapeSegments.push_back(no - 1);
1134  }
1135  return result;
1136 }
1137 
1138 /****************************************************************************/
1139 
std::vector< int > myShapeSegments
the meso segment index for each geometry segment
Definition: GUILane.h:322
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:116
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:422
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GUILane.h:319
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:806
SUMOReal getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUILane.cpp:901
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:654
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:81
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:843
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUILane.cpp:856
const SUMOReal SUMO_const_laneWidth
Definition: StdDefs.h:49
is a pedestrian
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:188
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:271
~GUILane()
Destructor.
Definition: GUILane.cpp:106
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
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:235
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
Definition: GUILane.cpp:1098
int getLinkTLID(MSLink *link) const
Definition: GUINet.cpp:195
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:1114
void drawTextAtEnd(const std::string &text, const PositionVector &shape, SUMOReal x, const GUIVisualizationTextSettings &settings) const
Definition: GUILane.cpp:258
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.
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some lane function
Definition: GUILane.cpp:865
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:441
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:615
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:336
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
bool showLaneDirection
Whether to show direction indicators for lanes.
This is an uncontrolled, right-before-left link.
SUMOReal getElectricityConsumption() const
Returns the sum of last step electricity consumption.
Definition: MSLane.cpp:2101
SUMOReal getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUILane.cpp:1004
const std::vector< SUMOReal > & getShapeLengths() const
Definition: GUILane.cpp:812
#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:678
void drawArrows() const
Definition: GUILane.cpp:355
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:167
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:879
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:653
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:313
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:758
void drawLinkNo(const GUIVisualizationSettings &s) const
helper methods
Definition: GUILane.cpp:196
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:146
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUILane.h:340
static bool gCheckRoutes
Definition: MSGlobals.h:78
float laneMinSize
The minimum visual lane width for drawing.
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:783
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:139
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:1081
SUMOReal getMeanSpeed() const
Returns the mean speed on this lane.
Definition: MSLane.cpp:2013
bool showSublanes
Whether to show sublane boundaries.
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
Definition: GUILane.h:316
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:181
#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:818
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:187
SUMOReal getSpeedLimit() const
Returns the lane&#39;s maximum allowed speed.
Definition: MSLane.h:467
void drawDirectionIndicators() const
direction indicators for lanes
Definition: GUILane.cpp:702
float minSize
The minimum size to draw this object.
MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify)
Definition: GUILane.cpp:153
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
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:824
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:299
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:160
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
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
void drawTLSLinkNo(const GUIVisualizationSettings &s, const GUINet &net) const
Definition: GUILane.cpp:224
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.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:360
GUILane(const std::string &id, SUMOReal maxSpeed, SUMOReal length, MSEdge *const edge, int numericalID, const PositionVector &shape, SUMOReal width, SVCPermissions permissions, int index)
Constructor.
Definition: GUILane.cpp:78
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:830
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:174
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:325
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:1075
void lock()
lock mutex
Definition: MFXMutex.cpp:86
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
bool myAmClosed
state for dynamic lane closings
Definition: GUILane.h:335
SUMOReal myQuarterLaneWidth
Quarter of lane width, for speed-up.
Definition: GUILane.h:328
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:126
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:213
GUIVisualizationSizeSettings vehicleSize
FXbool locked()
Definition: MFXMutex.h:70
SUMOReal getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:507
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:728
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
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: GUILane.cpp:133
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:800
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net&#39;s internal edge travel times/efforts container.
Definition: MSNet.cpp:716
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