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>
40 #include <utils/common/StdDefs.h>
41 #include <utils/geom/GeomHelper.h>
42 #include <utils/gui/div/GLHelper.h>
48 #include <microsim/MSGlobals.h>
49 #include <microsim/MSLane.h>
52 #include <microsim/MSNet.h>
55 #include "GUILane.h"
56 #include "GUIEdge.h"
57 #include "GUIVehicle.h"
58 #include "GUINet.h"
59 
60 #ifdef HAVE_OSG
61 #include <osg/Geometry>
62 #endif
63 
64 #ifdef CHECK_MEMORY_LEAKS
65 #include <foreign/nvwa/debug_new.h>
66 #endif // CHECK_MEMORY_LEAKS
67 
68 //#define GUILane_DEBUG_DRAW_WALKING_AREA_VERTICES
69 
70 // ===========================================================================
71 // method definitions
72 // ===========================================================================
73 GUILane::GUILane(const std::string& id, SUMOReal maxSpeed, SUMOReal length,
74  MSEdge* const edge, unsigned int numericalID,
75  const PositionVector& shape, SUMOReal width,
76  SVCPermissions permissions, unsigned int index) :
77  MSLane(id, maxSpeed, length, edge, numericalID, shape, width, permissions, index),
78  GUIGlObject(GLO_LANE, id),
79  myAmClosed(false) {
80  myShapeRotations.reserve(myShape.size() - 1);
81  myShapeLengths.reserve(myShape.size() - 1);
82  myShapeColors.reserve(myShape.size() - 1);
83  int e = (int) myShape.size() - 1;
84  for (int i = 0; i < e; ++i) {
85  const Position& f = myShape[i];
86  const Position& s = myShape[i + 1];
87  myShapeLengths.push_back(f.distanceTo2D(s));
88  myShapeRotations.push_back(RAD2DEG(atan2(s.x() - f.x(), f.y() - s.y())));
89  }
90  //
93 }
94 
95 
97  // just to quit cleanly on a failure
98  if (myLock.locked()) {
99  myLock.unlock();
100  }
101 }
102 
103 
104 // ------ Vehicle insertion ------
105 void
107  const MSLane::VehCont::iterator& at,
108  MSMoveReminder::Notification notification) {
110  MSLane::incorporateVehicle(veh, pos, speed, at, notification);
111 }
112 
113 
114 // ------ Access to vehicles ------
115 const MSLane::VehCont&
117  myLock.lock();
118  return myVehicles;
119 }
120 
121 
122 void
124  myLock.unlock();
125 }
126 
127 
128 void
132 }
133 
134 
135 bool
136 GUILane::executeMovements(SUMOTime t, std::vector<MSLane*>& into) {
138  return MSLane::executeMovements(t, into);
139 }
140 
141 
142 MSVehicle*
143 GUILane::removeVehicle(MSVehicle* remVehicle, MSMoveReminder::Notification notification, bool notify) {
145  return MSLane::removeVehicle(remVehicle, notification, notify);
146 }
147 
148 
149 void
153 }
154 
155 
156 bool
159  return MSLane::integrateNewVehicle(t);
160 }
161 
162 
163 void
164 GUILane::detectCollisions(SUMOTime timestep, const std::string& stage) {
166  MSLane::detectCollisions(timestep, stage);
167 }
168 
169 
170 // ------ Drawing methods ------
171 void
173  unsigned int noLinks = (unsigned int)myLinks.size();
174  if (noLinks == 0) {
175  return;
176  }
177  // draw all links
178  if (getEdge().isCrossing()) {
179  // draw indices at the start and end of the crossing
181  PositionVector shape = getShape();
182  shape.extrapolate(0.5); // draw on top of the walking area
183  drawTextAtEnd(toString(link->getIndex()), shape, 0, s.drawLinkJunctionIndex);
185  return;
186  }
187  // draw all links
188  SUMOReal w = myWidth / (SUMOReal) noLinks;
190  const bool lefthand = MSNet::getInstance()->lefthand();
191  for (int i = noLinks; --i >= 0;) {
192  SUMOReal x2 = x1 - (SUMOReal)(w / 2.);
193  drawTextAtEnd(toString(myLinks[lefthand ? noLinks - 1 - i : i]->getIndex()), getShape(), x2, s.drawLinkJunctionIndex);
194  x1 -= w;
195  }
196 }
197 
198 
199 void
201  unsigned int noLinks = (unsigned int)myLinks.size();
202  if (noLinks == 0) {
203  return;
204  }
205  if (getEdge().isCrossing()) {
206  // draw indices at the start and end of the crossing
208  int linkNo = net.getLinkTLIndex(link);
209  if (linkNo >= 0) {
210  PositionVector shape = getShape();
211  shape.extrapolate(0.5); // draw on top of the walking area
212  drawTextAtEnd(toString(linkNo), shape, 0, s.drawLinkTLIndex);
213  drawTextAtEnd(toString(linkNo), shape.reverse(), 0, s.drawLinkTLIndex);
214  }
215  return;
216  }
217  // draw all links
218  SUMOReal w = myWidth / (SUMOReal) noLinks;
220  const bool lefthand = MSNet::getInstance()->lefthand();
221  for (int i = noLinks; --i >= 0;) {
222  SUMOReal x2 = x1 - (SUMOReal)(w / 2.);
223  int linkNo = net.getLinkTLIndex(myLinks[lefthand ? noLinks - 1 - i : i]);
224  if (linkNo < 0) {
225  continue;
226  }
227  drawTextAtEnd(toString(linkNo), getShape(), x2, s.drawLinkTLIndex);
228  x1 -= w;
229  }
230 }
231 
232 
233 void
234 GUILane::drawTextAtEnd(const std::string& text, const PositionVector& shape, SUMOReal x, const GUIVisualizationTextSettings& settings) const {
235  glPushMatrix();
236  const Position& end = shape.back();
237  const Position& f = shape[-2];
238  const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
239  glTranslated(end.x(), end.y(), 0);
240  glRotated(rot, 0, 0, 1);
241  GLHelper::drawText(text, Position(x, 0.26), 0, .6 * settings.size / 50, settings.color, 180);
242  glPopMatrix();
243 }
244 
245 
246 void
248  unsigned int noLinks = (unsigned int)myLinks.size();
249  if (noLinks == 0) {
250  drawLinkRule(s, net, 0, getShape(), 0, 0);
251  return;
252  }
253  if (getEdge().isCrossing()) {
254  // draw rules at the start and end of the crossing
256  PositionVector shape = getShape();
257  shape.extrapolate(0.5); // draw on top of the walking area
258  drawLinkRule(s, net, link, shape, 0, myWidth);
259  drawLinkRule(s, net, link, shape.reverse(), 0, myWidth);
260  return;
261  }
262  // draw all links
263  SUMOReal w = myWidth / (SUMOReal) noLinks;
264  SUMOReal x1 = 0;
265  const bool lefthand = MSNet::getInstance()->lefthand();
266  for (unsigned int i = 0; i < noLinks; ++i) {
267  SUMOReal x2 = x1 + w;
268  drawLinkRule(s, net, myLinks[lefthand ? noLinks - 1 - i : i], getShape(), x1, x2);
269  x1 = x2;
270  }
271 }
272 
273 
274 void
275 GUILane::drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, SUMOReal x1, SUMOReal x2) const {
276  const Position& end = shape.back();
277  const Position& f = shape[-2];
278  const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
279  if (link == 0) {
281  glPushMatrix();
282  glTranslated(end.x(), end.y(), 0);
283  glRotated(rot, 0, 0, 1);
284  glBegin(GL_QUADS);
285  glVertex2d(-myHalfLaneWidth, 0.0);
286  glVertex2d(-myHalfLaneWidth, 0.5);
287  glVertex2d(myHalfLaneWidth, 0.5);
288  glVertex2d(myHalfLaneWidth, 0.0);
289  glEnd();
290  glPopMatrix();
291  } else {
292  glPushMatrix();
293  glTranslated(end.x(), end.y(), 0);
294  glRotated(rot, 0, 0, 1);
295  // select glID
296  switch (link->getState()) {
299  case LINKSTATE_TL_RED:
304  glPushName(net.getLinkTLID(link));
305  break;
306  case LINKSTATE_MAJOR:
307  case LINKSTATE_MINOR:
308  case LINKSTATE_EQUAL:
310  default:
311  glPushName(getGlID());
312  break;
313  }
315  if (!(drawAsRailway(s) || drawAsWaterway(s)) || link->getState() != LINKSTATE_MAJOR) {
316  // the white bar should be the default for most railway
317  // links and looks ugly so we do not draw it
318  glBegin(GL_QUADS);
319  glVertex2d(x1 - myHalfLaneWidth, 0.0);
320  glVertex2d(x1 - myHalfLaneWidth, 0.5);
321  glVertex2d(x2 - myHalfLaneWidth, 0.5);
322  glVertex2d(x2 - myHalfLaneWidth, 0.0);
323  glEnd();
324  }
325  glPopName();
326  glPopMatrix();
327  }
328 }
329 
330 void
332  if (myLinks.size() == 0) {
333  return;
334  }
335  // draw all links
336  const Position& end = getShape().back();
337  const Position& f = getShape()[-2];
338  const SUMOReal rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
339  glPushMatrix();
340  glColor3d(1, 1, 1);
341  glTranslated(end.x(), end.y(), 0);
342  glRotated(rot, 0, 0, 1);
344  glScaled(myWidth / SUMO_const_laneWidth, 1, 1);
345  }
346  for (std::vector<MSLink*>::const_iterator i = myLinks.begin(); i != myLinks.end(); ++i) {
347  LinkDirection dir = (*i)->getDirection();
348  LinkState state = (*i)->getState();
349  if (state == LINKSTATE_TL_OFF_NOSIGNAL || dir == LINKDIR_NODIR) {
350  continue;
351  }
352  switch (dir) {
353  case LINKDIR_STRAIGHT:
354  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
356  break;
357  case LINKDIR_TURN:
358  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
359  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
360  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
361  GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (SUMOReal) 1, (SUMOReal) .25);
362  break;
364  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
365  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
366  GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
367  GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (SUMOReal) 1, (SUMOReal) .25);
368  break;
369  case LINKDIR_LEFT:
370  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
371  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
372  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (SUMOReal) 1, (SUMOReal) .25);
373  break;
374  case LINKDIR_RIGHT:
375  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
376  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
377  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (SUMOReal) 1, (SUMOReal) .25);
378  break;
379  case LINKDIR_PARTLEFT:
380  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
381  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
382  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (SUMOReal) 1, (SUMOReal) .25);
383  break;
384  case LINKDIR_PARTRIGHT:
385  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
386  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
387  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (SUMOReal) 1, (SUMOReal) .25);
388  break;
389  default:
390  break;
391  }
392  }
393  glPopMatrix();
394 }
395 
396 
397 void
399  for (std::vector<MSLink*>::const_iterator i = myLinks.begin(); i != myLinks.end(); ++i) {
400  const MSLane* connected = (*i)->getLane();
401  if (connected == 0) {
402  continue;
403  }
404  GLHelper::setColor(getLinkColor((*i)->getState()));
405  glBegin(GL_LINES);
406  const Position& p1 = getShape()[-1];
407  const Position& p2 = connected->getShape()[0];
408  glVertex2f(p1.x(), p1.y());
409  glVertex2f(p2.x(), p2.y());
410  glEnd();
411  GLHelper::drawTriangleAtEnd(p1, p2, (SUMOReal) .4, (SUMOReal) .2);
412  }
413 }
414 
415 
416 void
418  glPushMatrix();
419  glPushName(getGlID());
420  const bool isCrossing = myEdge->getPurpose() == MSEdge::EDGEFUNCTION_CROSSING;
421  const bool isWalkingArea = myEdge->getPurpose() == MSEdge::EDGEFUNCTION_WALKINGAREA;
422  const bool isInternal = isCrossing || isWalkingArea || myEdge->getPurpose() == MSEdge::EDGEFUNCTION_INTERNAL;
423  bool mustDrawMarkings = false;
424  SUMOReal exaggeration = s.laneWidthExaggeration;
426  GUIEdge* myGUIEdge = dynamic_cast<GUIEdge*>(myEdge);
427  exaggeration *= s.edgeScaler.getScheme().getColor(myGUIEdge->getScaleValue(s.edgeScaler.getActive()));
428  } else {
430  }
431  const bool drawDetails = s.scale * exaggeration > 5;
432  if (isCrossing || isWalkingArea) {
433  // draw internal lanes on top of junctions
434  glTranslated(0, 0, GLO_JUNCTION + 0.1);
435  } else if (isWaterway(myPermissions)) {
436  // draw waterways below normal roads
437  glTranslated(0, 0, getType() - 0.2);
438  } else {
439  glTranslated(0, 0, getType());
440  }
441  // set lane color
442  if (!MSGlobals::gUseMesoSim) {
443  setColor(s);
444  }
445  // recognize full transparency and simply don't draw
446  GLfloat color[4];
447  glGetFloatv(GL_CURRENT_COLOR, color);
448  if (color[3] != 0) {
449  // draw lane
450  // check whether it is not too small
451  if (s.scale * exaggeration < 1.) {
452  if (myShapeColors.size() > 0) {
454  } else {
456  }
457  glPopMatrix();
458  } else {
459  GUINet* net = (GUINet*) MSNet::getInstance();
460  if (drawAsRailway(s)) {
461  // draw as railway
462  const SUMOReal halfRailWidth = 0.725 * exaggeration;
463  if (myShapeColors.size() > 0) {
465  } else {
467  }
468  glColor3d(1, 1, 1);
469  glTranslated(0, 0, .1);
471  if (!MSGlobals::gUseMesoSim) {
472  setColor(s);
473  }
474  drawCrossties(0.3 * exaggeration, 1 * exaggeration, 1 * exaggeration);
475  } else if (isCrossing) {
477  // determine priority to decide color
479  if (link->havePriority() || net->getLinkTLIndex(link) > 0) {
480  glColor3d(0.9, 0.9, 0.9);
481  } else {
482  glColor3d(0.1, 0.1, 0.1);
483  }
484  glTranslated(0, 0, .2);
485  drawCrossties(0.5, 1.0, getWidth() * 0.5);
486  glTranslated(0, 0, -.2);
487  }
488  } else if (isWalkingArea) {
490  glTranslated(0, 0, .2);
491  if (s.scale * exaggeration < 20.) {
493  } else {
495  }
496  glTranslated(0, 0, -.2);
497 #ifdef GUILane_DEBUG_DRAW_WALKING_AREA_VERTICES
499 #endif
500  }
501  } else {
502  const SUMOReal halfWidth = isInternal ? myQuarterLaneWidth : myHalfLaneWidth;
503  mustDrawMarkings = !isInternal && myPermissions != 0 && myPermissions != SVC_PEDESTRIAN && exaggeration == 1.0 && !isWaterway(myPermissions);
504  const int cornerDetail = drawDetails && !isInternal ? s.scale * exaggeration : 0;
505  const SUMOReal offset = halfWidth * MAX2((SUMOReal)0, (exaggeration - 1));
506  if (myShapeColors.size() > 0) {
507  GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, myShapeColors, halfWidth * exaggeration, cornerDetail, offset);
508  } else {
509  GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, halfWidth * exaggeration, cornerDetail, offset);
510  }
511  }
512  glPopMatrix();
513  // draw ROWs (not for inner lanes)
514  if ((!isInternal || isCrossing) && drawDetails) {
515  glPushMatrix();
516  glTranslated(0, 0, GLO_JUNCTION); // must draw on top of junction shape
517  glTranslated(0, 0, .5);
518  drawLinkRules(s, *net);
520  drawArrows();
521  }
522  if (s.showLane2Lane) {
523  // this should be independent to the geometry:
524  // draw from end of first to the begin of second
526  }
527  glTranslated(0, 0, .1);
528  if (s.drawLinkJunctionIndex.show) {
529  drawLinkNo(s);
530  }
531  if (s.drawLinkTLIndex.show) {
532  drawTLSLinkNo(s, *net);
533  }
534  glPopMatrix();
535  }
536  }
537  if (mustDrawMarkings && drawDetails) { // needs matrix reset
538  drawMarkings(s, exaggeration);
539  }
540  if (drawDetails && isInternal && myPermissions == SVC_BICYCLE && exaggeration == 1.0 && s.showLinkDecals) {
542  }
543  } else {
544  glPopMatrix();
545  }
546  // draw vehicles
548  // retrieve vehicles from lane; disallow simulation
549  const MSLane::VehCont& vehicles = getVehiclesSecure();
550  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
551  if ((*v)->getLane() == this) {
552  static_cast<const GUIVehicle* const>(*v)->drawGL(s);
553  } // else: this is the shadow during a continuous lane change
554  }
555  // draw parking vehicles
556  const std::set<const MSVehicle*> parking = MSVehicleTransfer::getInstance()->getParkingVehicles(this);
557  for (std::set<const MSVehicle*>::const_iterator v = parking.begin(); v != parking.end(); ++v) {
558  static_cast<const GUIVehicle* const>(*v)->drawGL(s);
559  }
560  // allow lane simulation
561  releaseVehicles();
562  }
563  glPopName();
564 }
565 
566 
567 void
569  glPushMatrix();
570  glTranslated(0, 0, GLO_EDGE);
571  if (!MSGlobals::gUseMesoSim) {
572  setColor(s);
573  }
574  // optionally draw inverse markings
575  if (myIndex > 0 && (myEdge->getLanes()[myIndex - 1]->getPermissions() & myPermissions) != 0) {
576  SUMOReal mw = (myHalfLaneWidth + SUMO_const_laneOffset + .01) * scale * (MSNet::getInstance()->lefthand() ? -1 : 1);
577  int e = (int) getShape().size() - 1;
578  for (int i = 0; i < e; ++i) {
579  glPushMatrix();
580  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
581  glRotated(myShapeRotations[i], 0, 0, 1);
582  for (SUMOReal t = 0; t < myShapeLengths[i]; t += 6) {
583  const SUMOReal length = MIN2((SUMOReal)3, myShapeLengths[i] - t);
584  glBegin(GL_QUADS);
585  glVertex2d(-mw, -t);
586  glVertex2d(-mw, -t - length);
587  glVertex2d(myQuarterLaneWidth * scale, -t - length);
588  glVertex2d(myQuarterLaneWidth * scale, -t);
589  glEnd();
590  }
591  glPopMatrix();
592  }
593  }
594  // draw white boundings and white markings
595  glColor3d(1, 1, 1);
597  getShape(),
599  getShapeLengths(),
601  glPopMatrix();
602 }
603 
604 
605 void
607  // draw bike lane markings onto the intersection
608  glColor3d(1, 1, 1);
609  int e = (int) getShape().size() - 1;
611  for (int i = 0; i < e; ++i) {
612  glPushMatrix();
613  glTranslated(getShape()[i].x(), getShape()[i].y(), GLO_JUNCTION + 0.1);
614  glRotated(myShapeRotations[i], 0, 0, 1);
615  for (SUMOReal t = 0; t < myShapeLengths[i]; t += 0.5) {
616  // left and right marking
617  for (int side = -1; side <= 1; side += 2) {
618  glBegin(GL_QUADS);
619  glVertex2d(side * mw, -t);
620  glVertex2d(side * mw, -t - 0.35);
621  glVertex2d(side * (mw + SUMO_const_laneOffset), -t - 0.35);
622  glVertex2d(side * (mw + SUMO_const_laneOffset), -t);
623  glEnd();
624  }
625  }
626  glPopMatrix();
627  }
628 }
629 
630 void
631 GUILane::drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const {
632  glPushMatrix();
633  // draw on top of of the white area between the rails
634  glTranslated(0, 0, 0.1);
635  int e = (int) getShape().size() - 1;
636  for (int i = 0; i < e; ++i) {
637  glPushMatrix();
638  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.0);
639  glRotated(myShapeRotations[i], 0, 0, 1);
640  for (SUMOReal t = 0; t < myShapeLengths[i]; t += spacing) {
641  glBegin(GL_QUADS);
642  glVertex2d(-halfWidth, -t);
643  glVertex2d(-halfWidth, -t - length);
644  glVertex2d(halfWidth, -t - length);
645  glVertex2d(halfWidth, -t);
646  glEnd();
647  }
648  glPopMatrix();
649  }
650  glPopMatrix();
651 }
652 
653 // ------ inherited from GUIGlObject
656  GUISUMOAbstractView& parent) {
657  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
658  buildPopupHeader(ret, app);
660  //
661  new FXMenuCommand(ret, "Copy edge name to clipboard", 0, ret, MID_COPY_EDGE_NAME);
664  //
665  buildShowParamsPopupEntry(ret, false);
668  new FXMenuCommand(ret, ("pos: " + toString(pos) + " height: " + toString(height)).c_str(), 0, 0, 0);
669  new FXMenuSeparator(ret);
670  buildPositionCopyEntry(ret, false);
671  new FXMenuSeparator(ret);
672  if (myAmClosed) {
673  new FXMenuCommand(ret, "Reopen lane", 0, &parent, MID_CLOSE_LANE);
674  new FXMenuCommand(ret, "Reopen edge", 0, &parent, MID_CLOSE_EDGE);
675  } else {
676  new FXMenuCommand(ret, "Close lane", 0, &parent, MID_CLOSE_LANE);
677  new FXMenuCommand(ret, "Close edge", 0, &parent, MID_CLOSE_EDGE);
678  }
679  new FXMenuCommand(ret, "Add rerouter", 0, &parent, MID_ADD_REROUTER);
680  return ret;
681 }
682 
683 
687  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, 11);
688  // add items
689  ret->mkItem("maxspeed [m/s]", false, getSpeedLimit());
690  ret->mkItem("length [m]", false, myLength);
691  ret->mkItem("width [m]", false, myWidth);
692  ret->mkItem("street name", false, myEdge->getStreetName());
693  ret->mkItem("stored traveltime [s]", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getStoredEdgeTravelTime));
694  ret->mkItem("loaded weight", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getLoadedEdgeWeight));
695  ret->mkItem("occupancy [%]", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getBruttoOccupancy, 100.));
696  ret->mkItem("edge type", false, myEdge->getEdgeType());
697  ret->mkItem("priority", false, myEdge->getPriority());
698  ret->mkItem("allowed vehicle class", false, getVehicleClassNames(myPermissions));
699  ret->mkItem("disallowed vehicle class", false, getVehicleClassNames(~myPermissions));
700  ret->mkItem("permission code", false, myPermissions);
701  // close building
702  ret->closeBuilding();
703  return ret;
704 }
705 
706 
707 Boundary
709  Boundary b;
710  b.add(myShape[0]);
711  b.add(myShape[-1]);
712  b.grow(10);
713  // ensure that vehicles and persons on the side are drawn even if the edge
714  // is outside the view
715  return b;
716 }
717 
718 
719 
720 
721 
722 
723 
724 const PositionVector&
726  return myShape;
727 }
728 
729 
730 const std::vector<SUMOReal>&
732  return myShapeRotations;
733 }
734 
735 
736 const std::vector<SUMOReal>&
738  return myShapeLengths;
739 }
740 
741 
742 SUMOReal
744  return myVehicles.size() == 0 ? 0 : myVehicles.back()->getWaitingSeconds();
745 }
746 
747 
748 SUMOReal
750  return (SUMOReal) myEdge->getLanes().size();
751 }
752 
753 
754 SUMOReal
757  if (!ews.knowsTravelTime(myEdge)) {
758  return -1;
759  } else {
760  SUMOReal value(0);
761  ews.retrieveExistingTravelTime(myEdge, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value);
762  return value;
763  }
764 }
765 
766 
767 SUMOReal
770  if (!ews.knowsEffort(myEdge)) {
771  return -1;
772  } else {
773  SUMOReal value(0);
774  ews.retrieveExistingEffort(myEdge, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value);
775  return value;
776  }
777 }
778 
779 
780 void
782  const GUIColorer& c = s.laneColorer;
783  if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) {
785  }
786 }
787 
788 
789 bool
790 GUILane::setFunctionalColor(size_t activeScheme) const {
791  switch (activeScheme) {
792  case 18: {
795  return true;
796  }
797  default:
798  return false;
799  }
800 }
801 
802 
803 bool
805  const size_t activeScheme = c.getActive();
806  myShapeColors.clear();
807  switch (activeScheme) {
808  case 22: // color by height at segment start
809  for (PositionVector::const_iterator ii = myShape.begin(); ii != myShape.end() - 1; ++ii) {
810  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
811  }
812  return true;
813  case 24: // color by inclination at segment start
814  for (int ii = 1; ii < (int)myShape.size(); ++ii) {
815  const SUMOReal inc = (myShape[ii].z() - myShape[ii - 1].z()) / MAX2(POSITION_EPS, myShape[ii].distanceTo2D(myShape[ii - 1]));
816  myShapeColors.push_back(c.getScheme().getColor(inc));
817  }
818  return true;
819  default:
820  return false;
821  }
822 }
823 
824 
825 SUMOReal
826 GUILane::getColorValue(size_t activeScheme) const {
827  switch (activeScheme) {
828  case 0:
829  switch (myPermissions) {
830  case SVC_PEDESTRIAN:
831  return 1;
832  case SVC_BICYCLE:
833  return 2;
834  case 0:
835  return 3;
836  case SVC_SHIP:
837  return 4;
838  case SVC_AUTHORITY:
839  return 6;
840  default:
841  break;
842  }
844  return 0;
845  } else {
846  return 5;
847  }
848  case 1:
849  return gSelected.isSelected(getType(), getGlID()) ||
850  gSelected.isSelected(GLO_EDGE, dynamic_cast<GUIEdge*>(myEdge)->getGlID());
851  case 2:
852  return (SUMOReal)myPermissions;
853  case 3:
854  return getSpeedLimit();
855  case 4:
856  return getBruttoOccupancy();
857  case 5:
858  return getNettoOccupancy();
859  case 6:
860  return firstWaitingTime();
861  case 7:
862  return getEdgeLaneNumber();
863  case 8:
864  return getCO2Emissions() / myLength;
865  case 9:
866  return getCOEmissions() / myLength;
867  case 10:
868  return getPMxEmissions() / myLength;
869  case 11:
870  return getNOxEmissions() / myLength;
871  case 12:
872  return getHCEmissions() / myLength;
873  case 13:
874  return getFuelConsumption() / myLength;
875  case 14:
877  case 15: {
878  return getStoredEdgeTravelTime();
879  }
880  case 16: {
882  if (!ews.knowsTravelTime(myEdge)) {
883  return -1;
884  } else {
885  SUMOReal value(0);
886  ews.retrieveExistingTravelTime(myEdge, 0, value);
887  return 100 * myLength / value / getSpeedLimit();
888  }
889  }
890  case 17: {
891  return 1 / myLengthGeometryFactor;
892  }
893  case 19: {
894  return getLoadedEdgeWeight();
895  }
896  case 20: {
897  return myEdge->getPriority();
898  }
899  case 21: {
900  // color by z of first shape point
901  return getShape()[0].z();
902  }
903  case 23: {
904  // color by incline
905  return (getShape()[-1].z() - getShape()[0].z()) / getLength();
906  }
907  case 25: {
908  // color by average speed
909  return getMeanSpeed();
910  }
911  case 26: {
912  // color by average relative speed
913  return getMeanSpeed() / myMaxSpeed;
914  }
915  case 27: {
916  // color by routing device assumed speed
918  }
919  case 28:
921  }
922  return 0;
923 }
924 
925 
926 SUMOReal
927 GUILane::getScaleValue(size_t activeScheme) const {
928  switch (activeScheme) {
929  case 0:
930  return 0;
931  case 1:
932  return gSelected.isSelected(getType(), getGlID()) ||
933  gSelected.isSelected(GLO_EDGE, dynamic_cast<GUIEdge*>(myEdge)->getGlID());
934  case 2:
935  return getSpeedLimit();
936  case 3:
937  return getBruttoOccupancy();
938  case 4:
939  return getNettoOccupancy();
940  case 5:
941  return firstWaitingTime();
942  case 6:
943  return getEdgeLaneNumber();
944  case 7:
945  return getCO2Emissions() / myLength;
946  case 8:
947  return getCOEmissions() / myLength;
948  case 9:
949  return getPMxEmissions() / myLength;
950  case 10:
951  return getNOxEmissions() / myLength;
952  case 11:
953  return getHCEmissions() / myLength;
954  case 12:
955  return getFuelConsumption() / myLength;
956  case 13:
958  case 14: {
959  return getStoredEdgeTravelTime();
960  }
961  case 15: {
963  if (!ews.knowsTravelTime(myEdge)) {
964  return -1;
965  } else {
966  SUMOReal value(0);
967  ews.retrieveExistingTravelTime(myEdge, 0, value);
968  return 100 * myLength / value / getSpeedLimit();
969  }
970  }
971  case 16: {
972  return 1 / myLengthGeometryFactor;
973  }
974  case 17: {
975  return getLoadedEdgeWeight();
976  }
977  case 18: {
978  return myEdge->getPriority();
979  }
980  case 19: {
981  // scale by average speed
982  return getMeanSpeed();
983  }
984  case 20: {
985  // scale by average relative speed
986  return getMeanSpeed() / myMaxSpeed;
987  }
988  case 21:
990  }
991  return 0;
992 }
993 
994 
995 bool
997  return isRailway(myPermissions) && s.showRails;
998 }
999 
1000 
1001 bool
1003  return isWaterway(myPermissions) && s.showRails; // reusing the showRails setting
1004 }
1005 
1006 
1007 #ifdef HAVE_OSG
1008 void
1009 GUILane::updateColor(const GUIVisualizationSettings& s) {
1011  osg::Vec4ubArray* colors = dynamic_cast<osg::Vec4ubArray*>(myGeom->getColorArray());
1012  (*colors)[0].set(col.red(), col.green(), col.blue(), col.alpha());
1013  myGeom->setColorArray(colors);
1014 }
1015 #endif
1016 
1017 
1018 void
1019 GUILane::closeTraffic(bool rebuildAllowed) {
1020  MSGlobals::gCheckRoutes = false;
1021  if (myAmClosed) {
1023  } else {
1026  }
1028  if (rebuildAllowed) {
1030  }
1031 }
1032 
1033 /****************************************************************************/
1034 
SUMOReal getScaleValue(size_t activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:436
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:877
void drawLane2LaneConnections() const
Definition: GUILane.cpp:398
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GUILane.h:299
VehCont myVehicles
The lane&#39;s vehicles. The entering vehicles are inserted at the front of this container and the leavin...
Definition: MSLane.h:854
const std::vector< SUMOReal > & getShapeRotations() const
Definition: GUILane.cpp:731
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:467
bool lefthand() const
return whether the network was built for lefthand traffic
Definition: MSNet.h:638
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
SUMOReal getScaleValue(size_t activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUILane.cpp:927
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:768
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUILane.cpp:781
const SUMOReal SUMO_const_laneWidth
Definition: StdDefs.h:49
is a pedestrian
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
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:247
~GUILane()
Destructor.
Definition: GUILane.cpp:96
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:185
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:223
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
Definition: GUILane.cpp:1019
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:375
vehicle is a bicycle
int SVCPermissions
void drawTextAtEnd(const std::string &text, const PositionVector &shape, SUMOReal x, const GUIVisualizationTextSettings &settings) const
Definition: GUILane.cpp:234
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
int myIndex
The lane index.
Definition: MSLane.h:845
virtual bool integrateNewVehicle(SUMOTime t)
Insert buffered vehicle into the real lane.
Definition: MSLane.cpp:848
bool showRails
Information whether rails shall be drawn.
The link is a 180 degree turn.
const RGBColor & getLinkColor(const LinkState &ls)
Definition: StdDefs.cpp:53
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:88
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:417
Notification
Definition of a vehicle state.
SUMOReal getFuelConsumption() const
Returns the sum of last step fuel consumption.
Definition: MSLane.cpp:1520
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
Definition: MSLane.cpp:974
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:271
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
virtual void incorporateVehicle(MSVehicle *veh, SUMOReal pos, SUMOReal speed, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
Definition: MSLane.cpp:126
SUMOReal getWidth() const
Returns the lane&#39;s width.
Definition: MSLane.h:391
void drawMarkings(const GUIVisualizationSettings &s, SUMOReal scale) const
draw lane borders and white markings
Definition: GUILane.cpp:568
This is a dead end link.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:160
SUMOReal getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
Definition: MSLane.cpp:1410
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:313
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
static void drawFilledPoly(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
Definition: GLHelper.cpp:76
This is an uncontrolled, right-before-left link.
SUMOReal getElectricityConsumption() const
Returns the sum of last step electricity consumption.
Definition: MSLane.cpp:1532
const std::vector< SUMOReal > & getShapeLengths() const
Definition: GUILane.cpp:737
#define RAD2DEG(x)
Definition: GeomHelper.h:46
static void drawText(const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &col=RGBColor::BLACK, const SUMOReal angle=0)
draw Text with given parameters
Definition: GLHelper.cpp: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:860
void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const
draw crossties for railroads or pedestrian crossings
Definition: GUILane.cpp:631
void drawArrows() const
Definition: GUILane.cpp:331
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:866
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:123
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:157
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:804
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:842
SUMOReal getHCEmissions() const
Returns the sum of last step HC emissions.
Definition: MSLane.cpp:1508
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:606
authorities vehicles
PositionVector reverse() const
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
virtual bool executeMovements(SUMOTime t, std::vector< MSLane * > &into)
Executes planned vehicle movements with regards to right-of-way.
Definition: MSLane.cpp:662
unsigned char blue() const
Returns the blue-amount of the color.
Definition: RGBColor.h:91
The link is a straight direction.
MSLinkCont myLinks
Definition: MSLane.h:901
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
Definition: MSLane.cpp:595
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:293
A road/street connecting two junctions.
Definition: MSEdge.h:80
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:180
void rebuildAllowedLanes()
Definition: MSEdge.cpp:172
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
Definition: MSLane.cpp:1308
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUILane.cpp:685
void drawLinkNo(const GUIVisualizationSettings &s) const
helper methods
Definition: GUILane.cpp:172
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:136
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUILane.h:317
static bool gCheckRoutes
Definition: MSGlobals.h:78
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUILane.cpp:708
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:129
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:1002
SUMOReal getMeanSpeed() const
Returns the mean speed on this lane.
Definition: MSLane.cpp:1444
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
Definition: GUILane.h:296
SUMOReal z() const
Returns the z-position.
Definition: Position.h:73
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
int getLinkTLIndex(MSLink *link) const
Definition: GUINet.cpp:211
const T getColor(const SUMOReal value) const
SUMOReal firstWaitingTime() const
Definition: GUILane.cpp:743
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:367
GUILane(const std::string &id, SUMOReal maxSpeed, SUMOReal length, MSEdge *const edge, unsigned int numericalID, const PositionVector &shape, SUMOReal width, SVCPermissions permissions, unsigned int index)
Constructor.
Definition: GUILane.cpp:73
float minSize
The minimum size to draw this object.
MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify)
Definition: GUILane.cpp:143
SUMOReal myLength
Lane length [m].
Definition: MSLane.h:857
virtual void incorporateVehicle(MSVehicle *veh, SUMOReal pos, SUMOReal speed, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
Definition: GUILane.cpp:106
bool setFunctionalColor(size_t activeScheme) const
sets the color according to the current scheme index and some lane function
Definition: GUILane.cpp:790
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: MSLane.cpp:967
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:54
int getIndex() const
Returns the lane&#39;s index.
Definition: MSLane.h:398
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:277
vehicle is a passenger car (a "normal" car)
SUMOReal getEdgeLaneNumber() const
Definition: GUILane.cpp:749
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:275
is an arbitrary ship
const SUMOReal myLengthGeometryFactor
Definition: MSLane.h:906
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:150
The edge is a pedestrian walking area (a special type of internal edge)
Definition: MSEdge.h:103
SUMOReal getNOxEmissions() const
Returns the sum of last step NOx emissions.
Definition: MSLane.cpp:1496
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:76
static SUMOReal getAssumedSpeed(const MSEdge *edge)
return current travel speed assumption
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:1484
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
Definition: MSEdge.h:242
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
Definition: GUILane.cpp:826
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
void drawTLSLinkNo(const GUIVisualizationSettings &s, const GUINet &net) const
Definition: GUILane.cpp:200
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:283
The link has yellow light, may pass.
The link is controlled by a tls which is off and blinks, has to brake.
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
Definition: AbstractMutex.h:71
SUMOReal getStoredEdgeTravelTime() const
Returns the stored traveltime for the edge of this lane.
Definition: GUILane.cpp:755
SUMOReal getCO2Emissions() const
Returns the sum of last step CO2 emissions.
Definition: MSLane.cpp:1460
MSEdge *const myEdge
The lane&#39;s edge, for routing only.
Definition: MSLane.h:863
SUMOReal getCOEmissions() const
Returns the sum of last step CO emissions.
Definition: MSLane.cpp:1472
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:164
The link has red light (must brake)
The popup menu of a globject.
an edge
SUMOReal myHalfLaneWidth
Half of lane width, for speed-up.
Definition: GUILane.h:302
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:996
void lock()
lock mutex
Definition: MFXMutex.cpp:86
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
unsigned int getLinkTLID(MSLink *link) const
Definition: GUINet.cpp:196
bool myAmClosed
state for dynamic lane closings
Definition: GUILane.h:312
SUMOReal myQuarterLaneWidth
Quarter of lane width, for speed-up.
Definition: GUILane.h:305
const PositionVector & getShape() const
Returns this lane&#39;s shape.
Definition: MSLane.h:322
const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: GUILane.cpp:116
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.
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
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:1544
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUILane.cpp:655
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:345
SUMOReal getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
Definition: MSLane.cpp:1395
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:87
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
A window containing a gl-object&#39;s parameter.
bool retrieveExistingTravelTime(const MSEdge *const e, const SUMOReal t, SUMOReal &value) const
Returns a travel time for an edge and time if stored.
The link has red light (must brake) but indicates upcoming green.
GUIVisualizationTextSettings drawLinkJunctionIndex
void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: GUILane.cpp:123
SUMOReal getExaggeration(const GUIVisualizationSettings &s) const
return the drawing size including exaggeration and constantSize values
void extrapolate(const SUMOReal val, const bool onlyFirst=false)
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:580
The link has no direction (is a dead end link)
const PositionVector & getShape() const
Definition: GUILane.cpp:725
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net&#39;s internal edge travel times/efforts container.
Definition: MSNet.cpp:707
a junction
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:61