Eclipse SUMO - Simulation of Urban MObility
GUILane.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // Representation of a lane in the micro simulation (gui-version)
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <string>
27 #include <utility>
28 #include <fx.h>
29 #include <utils/geom/GeomHelper.h>
30 #include <utils/geom/Position.h>
34 #include <utils/common/StdDefs.h>
35 #include <utils/geom/GeomHelper.h>
36 #include <utils/gui/div/GLHelper.h>
42 #include <microsim/MSGlobals.h>
43 #include <microsim/MSLane.h>
47 #include <microsim/MSNet.h>
50 #include <mesosim/MELoop.h>
51 #include <mesosim/MESegment.h>
52 #include "GUILane.h"
53 #include "GUIEdge.h"
54 #include "GUIVehicle.h"
55 #include "GUINet.h"
56 
57 #ifdef HAVE_OSG
58 #include <osg/Geometry>
59 #endif
60 
61 //#define GUILane_DEBUG_DRAW_WALKING_AREA_VERTICES
62 //#define GUILane_DEBUG_DRAW_VERTICES
63 //#define GUILane_DEBUG_DRAW_FOE_INTERSECTIONS
64 
65 // ===========================================================================
66 // static member declaration
67 // ===========================================================================
68 const RGBColor GUILane::MESO_USE_LANE_COLOR(0, 0, 0, 0);
69 
70 
71 // ===========================================================================
72 // method definitions
73 // ===========================================================================
74 GUILane::GUILane(const std::string& id, double maxSpeed, double length,
75  MSEdge* const edge, int numericalID,
76  const PositionVector& shape, double width,
77  SVCPermissions permissions, int index, bool isRampAccel,
78  const std::string& type) :
79  MSLane(id, maxSpeed, length, edge, numericalID, shape, width, permissions, index, isRampAccel, type),
80  GUIGlObject(GLO_LANE, id),
81 #ifdef HAVE_OSG
82  myGeom(0),
83 #endif
84  myAmClosed(false),
85  myLock(true) {
87  myShape = splitAtSegments(shape);
88  assert(fabs(myShape.length() - shape.length()) < POSITION_EPS);
89  assert(myShapeSegments.size() == myShape.size());
90  }
91  myShapeRotations.reserve(myShape.size() - 1);
92  myShapeLengths.reserve(myShape.size() - 1);
93  myShapeColors.reserve(myShape.size() - 1);
94  int e = (int) myShape.size() - 1;
95  for (int i = 0; i < e; ++i) {
96  const Position& f = myShape[i];
97  const Position& s = myShape[i + 1];
98  myShapeLengths.push_back(f.distanceTo2D(s));
99  myShapeRotations.push_back(RAD2DEG(atan2(s.x() - f.x(), f.y() - s.y())));
100  }
101  //
102  myHalfLaneWidth = myWidth / 2.;
104 }
105 
106 
108  // just to quit cleanly on a failure
109  if (myLock.locked()) {
110  myLock.unlock();
111  }
112 }
113 
114 
115 // ------ Vehicle insertion ------
116 void
117 GUILane::incorporateVehicle(MSVehicle* veh, double pos, double speed, double posLat,
118  const MSLane::VehCont::iterator& at,
119  MSMoveReminder::Notification notification) {
120  FXMutexLock locker(myLock);
121  MSLane::incorporateVehicle(veh, pos, speed, posLat, at, notification);
122 }
123 
124 
125 // ------ Access to vehicles ------
126 const MSLane::VehCont&
128  myLock.lock();
129  return myVehicles;
130 }
131 
132 
133 void
135  myLock.unlock();
136 }
137 
138 
139 void
141  FXMutexLock locker(myLock);
143 }
144 
145 void
147  FXMutexLock locker(myLock);
149 }
150 
151 
152 void
154  FXMutexLock locker(myLock);
156 }
157 
158 
159 MSVehicle*
160 GUILane::removeVehicle(MSVehicle* remVehicle, MSMoveReminder::Notification notification, bool notify) {
161  FXMutexLock locker(myLock);
162  return MSLane::removeVehicle(remVehicle, notification, notify);
163 }
164 
165 
166 void
168  FXMutexLock locker(myLock);
169  return MSLane::removeParking(remVehicle);
170 }
171 
172 
173 void
175  FXMutexLock locker(myLock);
177 }
178 
179 
180 void
182  FXMutexLock locker(myLock);
184 }
185 
186 
187 void
188 GUILane::detectCollisions(SUMOTime timestep, const std::string& stage) {
189  FXMutexLock locker(myLock);
190  MSLane::detectCollisions(timestep, stage);
191 }
192 
193 
194 double
196  FXMutexLock locker(myLock);
198 }
199 
200 
201 void
203  FXMutexLock locker(myLock);
205 }
206 
207 
208 // ------ Drawing methods ------
209 void
211  int noLinks = (int)myLinks.size();
212  if (noLinks == 0) {
213  return;
214  }
215  // draw all links
216  if (getEdge().isCrossing()) {
217  // draw indices at the start and end of the crossing
219  PositionVector shape = getShape();
220  shape.extrapolate(0.5); // draw on top of the walking area
223  return;
224  }
225  // draw all links
226  double w = myWidth / (double) noLinks;
227  double x1 = myHalfLaneWidth;
228  const bool lefthand = MSNet::getInstance()->lefthand();
229  for (int i = noLinks; --i >= 0;) {
230  double x2 = x1 - (double)(w / 2.);
232  x1 -= w;
233  }
234 }
235 
236 
237 void
239  int noLinks = (int)myLinks.size();
240  if (noLinks == 0) {
241  return;
242  }
243  if (getEdge().isCrossing()) {
244  // draw indices at the start and end of the crossing
246  int linkNo = net.getLinkTLIndex(link);
247  // maybe the reverse link is controlled separately
248  int linkNo2 = net.getLinkTLIndex(myLinks.front());
249  // otherwise, use the same index as the forward link
250  if (linkNo2 < 0) {
251  linkNo2 = linkNo;
252  }
253  if (linkNo >= 0) {
254  PositionVector shape = getShape();
255  shape.extrapolate(0.5); // draw on top of the walking area
258  }
259  return;
260  }
261  // draw all links
262  double w = myWidth / (double) noLinks;
263  double x1 = myHalfLaneWidth;
264  const bool lefthand = MSNet::getInstance()->lefthand();
265  for (int i = noLinks; --i >= 0;) {
266  double x2 = x1 - (double)(w / 2.);
267  int linkNo = net.getLinkTLIndex(myLinks[lefthand ? noLinks - 1 - i : i]);
268  if (linkNo < 0) {
269  continue;
270  }
272  x1 -= w;
273  }
274 }
275 
276 
277 void
279  int noLinks = (int)myLinks.size();
280  if (noLinks == 0) {
281  drawLinkRule(s, net, nullptr, getShape(), 0, 0);
282  return;
283  }
284  if (getEdge().isCrossing()) {
285  // draw rules at the start and end of the crossing
287  MSLink* link2 = myLinks.front();
288  if (link2->getTLLogic() == nullptr) {
289  link2 = link;
290  }
291  PositionVector shape = getShape();
292  shape.extrapolate(0.5); // draw on top of the walking area
293  drawLinkRule(s, net, link2, shape, 0, myWidth);
294  drawLinkRule(s, net, link, shape.reverse(), 0, myWidth);
295  return;
296  }
297  // draw all links
298  const double w = myWidth / (double) noLinks;
299  double x1 = myEdge->getToJunction()->getType() == NODETYPE_RAIL_SIGNAL ? -myWidth * 0.5 : 0;
300  const bool lefthand = MSNet::getInstance()->lefthand();
301  for (int i = 0; i < noLinks; ++i) {
302  double x2 = x1 + w;
303  drawLinkRule(s, net, myLinks[lefthand ? noLinks - 1 - i : i], getShape(), x1, x2);
304  x1 = x2;
305  }
306  // draw stopOffset for passenger cars
307  if (myStopOffsets.size() != 0 && (myStopOffsets.begin()->first & SVC_PASSENGER) != 0) {
308  const double stopOffsetPassenger = myStopOffsets.begin()->second;
309  const Position& end = myShape.back();
310  const Position& f = myShape[-2];
311  const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
313  glPushMatrix();
314  glTranslated(end.x(), end.y(), 0);
315  glRotated(rot, 0, 0, 1);
316  glTranslated(0, stopOffsetPassenger, 0);
317  glBegin(GL_QUADS);
318  glVertex2d(-myHalfLaneWidth, 0.0);
319  glVertex2d(-myHalfLaneWidth, 0.2);
320  glVertex2d(myHalfLaneWidth, 0.2);
321  glVertex2d(myHalfLaneWidth, 0.0);
322  glEnd();
323  glPopMatrix();
324  }
325 }
326 
327 
328 void
329 GUILane::drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, double x1, double x2) const {
330  const Position& end = shape.back();
331  const Position& f = shape[-2];
332  const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
333  if (link == nullptr) {
335  glPushMatrix();
336  glTranslated(end.x(), end.y(), 0);
337  glRotated(rot, 0, 0, 1);
338  glBegin(GL_QUADS);
339  glVertex2d(-myHalfLaneWidth, 0.0);
340  glVertex2d(-myHalfLaneWidth, 0.5);
341  glVertex2d(myHalfLaneWidth, 0.5);
342  glVertex2d(myHalfLaneWidth, 0.0);
343  glEnd();
344  glPopMatrix();
345  } else {
346  glPushMatrix();
347  glTranslated(end.x(), end.y(), 0);
348  glRotated(rot, 0, 0, 1);
349  // select glID
350  switch (link->getState()) {
353  case LINKSTATE_TL_RED:
359  glPushName(net.getLinkTLID(link));
360  break;
361  case LINKSTATE_MAJOR:
362  case LINKSTATE_MINOR:
363  case LINKSTATE_EQUAL:
364  default:
365  glPushName(getGlID());
366  break;
367  }
369  if (!(drawAsRailway(s) || drawAsWaterway(s)) || link->getState() != LINKSTATE_MAJOR) {
370  // the white bar should be the default for most railway
371  // links and looks ugly so we do not draw it
372  double scale = isInternal() ? 0.5 : 1;
374  scale *= MAX2(s.laneWidthExaggeration, s.junctionSize.getExaggeration(s, this, 10));
375  }
376  glScaled(scale, scale, 1);
377  glBegin(GL_QUADS);
378  glVertex2d(x1 - myHalfLaneWidth, 0.0);
379  glVertex2d(x1 - myHalfLaneWidth, 0.5);
380  glVertex2d(x2 - myHalfLaneWidth, 0.5);
381  glVertex2d(x2 - myHalfLaneWidth, 0.0);
382  glEnd();
383  }
384  glPopName();
385  glPopMatrix();
386  }
387 }
388 
389 void
391  if (myLinks.size() == 0) {
392  return;
393  }
394  // draw all links
395  const Position& end = getShape().back();
396  const Position& f = getShape()[-2];
397  const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
398  glPushMatrix();
399  glColor3d(1, 1, 1);
400  glTranslated(end.x(), end.y(), 0);
401  glRotated(rot, 0, 0, 1);
403  glScaled(myWidth / SUMO_const_laneWidth, 1, 1);
404  }
405  for (std::vector<MSLink*>::const_iterator i = myLinks.begin(); i != myLinks.end(); ++i) {
406  LinkDirection dir = (*i)->getDirection();
407  LinkState state = (*i)->getState();
408  if (state == LINKSTATE_DEADEND || dir == LINKDIR_NODIR) {
409  continue;
410  }
411  switch (dir) {
412  case LINKDIR_STRAIGHT:
413  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
414  GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25);
415  break;
416  case LINKDIR_TURN:
417  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
418  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
419  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
420  GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25);
421  break;
423  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
424  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
425  GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
426  GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25);
427  break;
428  case LINKDIR_LEFT:
429  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
430  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
431  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25);
432  break;
433  case LINKDIR_RIGHT:
434  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
435  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
436  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25);
437  break;
438  case LINKDIR_PARTLEFT:
439  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
440  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
441  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25);
442  break;
443  case LINKDIR_PARTRIGHT:
444  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
445  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
446  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25);
447  break;
448  default:
449  break;
450  }
451  }
452  glPopMatrix();
453 }
454 
455 
456 void
457 GUILane::drawLane2LaneConnections(double exaggeration) const {
458  Position centroid;
459  if (exaggeration > 1) {
460  centroid = myEdge->getToJunction()->getShape().getCentroid();
461  }
462  for (std::vector<MSLink*>::const_iterator i = myLinks.begin(); i != myLinks.end(); ++i) {
463  const MSLane* connected = (*i)->getLane();
464  if (connected == nullptr) {
465  continue;
466  }
468  glBegin(GL_LINES);
470  Position p2 = connected->getEdge().isWalkingArea() ? connected->getShape().getCentroid() : connected->getShape()[0];
471  if (exaggeration > 1) {
472  p1 = centroid + ((p1 - centroid) * exaggeration);
473  p2 = centroid + ((p2 - centroid) * exaggeration);
474  }
475  glVertex2d(p1.x(), p1.y());
476  glVertex2d(p2.x(), p2.y());
477  glEnd();
478  GLHelper::drawTriangleAtEnd(p1, p2, (double) .4, (double) .2);
479  }
480 }
481 
482 
483 void
485  glPushMatrix();
486  glPushName(getGlID());
487  const bool isCrossing = myEdge->isCrossing();
488  const bool isWalkingArea = myEdge->isWalkingArea();
489  const bool isInternal = isCrossing || isWalkingArea || myEdge->isInternal();
490  bool mustDrawMarkings = false;
491  double exaggeration = s.laneWidthExaggeration;
493  GUIEdge* myGUIEdge = dynamic_cast<GUIEdge*>(myEdge);
494  exaggeration *= s.edgeScaler.getScheme().getColor(myGUIEdge->getScaleValue(s.edgeScaler.getActive()));
495  } else {
497  }
498  const bool hasRailSignal = myEdge->getToJunction()->getType() == NODETYPE_RAIL_SIGNAL;
499  const bool detailZoom = s.scale * exaggeration > 5;
500  const bool drawDetails = (detailZoom || s.junctionSize.minSize == 0 || hasRailSignal) && !s.drawForSelecting;
501  if (isCrossing || isWalkingArea) {
502  // draw internal lanes on top of junctions
503  glTranslated(0, 0, GLO_JUNCTION + 0.1);
504  } else if (isWaterway(myPermissions)) {
505  // draw waterways below normal roads
506  glTranslated(0, 0, getType() - 0.2);
507  } else {
508  glTranslated(0, 0, getType());
509  }
510  // set lane color
511  const RGBColor color = setColor(s);
513  myShapeColors.clear();
514  const std::vector<RGBColor>& segmentColors = static_cast<const GUIEdge*>(myEdge)->getSegmentColors();
515  if (segmentColors.size() > 0) {
516  // apply segment specific shape colors
517  //std::cout << getID() << " shape=" << myShape << " shapeSegs=" << toString(myShapeSegments) << "\n";
518  for (int ii = 0; ii < (int)myShape.size() - 1; ++ii) {
519  myShapeColors.push_back(segmentColors[myShapeSegments[ii]]);
520  }
521  }
522  }
523  // recognize full transparency and simply don't draw
524  bool hiddenBidi = myEdge->getBidiEdge() != nullptr && myEdge->getNumericalID() > myEdge->getBidiEdge()->getNumericalID();
525  if (color.alpha() != 0 && s.scale * exaggeration > s.laneMinSize) {
526  // scale tls-controlled lane2lane-arrows along with their junction shapes
527  double junctionExaggeration = 1;
528  if (!isInternal
531  junctionExaggeration = MAX2(1.001, s.junctionSize.getExaggeration(s, this, 4));
532  }
533  // draw lane
534  // check whether it is not too small
535  if (s.scale * exaggeration < 1. && junctionExaggeration == 1 && s.junctionSize.minSize != 0) {
536  if (!isInternal || hasRailSignal) {
537  if (myShapeColors.size() > 0) {
539  } else {
541  }
542  }
543  glPopMatrix();
544  } else {
545  GUINet* net = (GUINet*) MSNet::getInstance();
546  const bool spreadSuperposed = s.spreadSuperposed && myEdge->getBidiEdge() != nullptr && drawAsRailway(s);
547  if (hiddenBidi && !spreadSuperposed) {
548  // do not draw shape
549  } else if (drawAsRailway(s) && (!s.drawForSelecting || spreadSuperposed)) {
550  // draw as railway: assume standard gauge of 1435mm when lane width is not set
551  // draw foot width 150mm, assume that distance between rail feet inner sides is reduced on both sides by 39mm with regard to the gauge
552  // assume crosstie length of 181% gauge (2600mm for standard gauge)
553  PositionVector shape = myShape;
554  const double width = myWidth;
555  double halfGauge = 0.5 * (width == SUMO_const_laneWidth ? 1.4350 : width) * exaggeration;
556  if (spreadSuperposed) {
557  shape.move2side(halfGauge * 0.8);
558  halfGauge *= 0.4;
559  }
560  const double halfInnerFeetWidth = halfGauge - 0.039 * exaggeration;
561  const double halfRailWidth = detailZoom ? (halfInnerFeetWidth + 0.15 * exaggeration) : SUMO_const_halfLaneWidth;
562  const double halfCrossTieWidth = halfGauge * 1.81;
563  if (myShapeColors.size() > 0) {
565  } else {
567  }
568  // Draw white on top with reduced width (the area between the two tracks)
569  if (detailZoom) {
570  glColor3d(1, 1, 1);
571  glTranslated(0, 0, .1);
572  GLHelper::drawBoxLines(shape, myShapeRotations, myShapeLengths, halfInnerFeetWidth);
573  setColor(s);
574  GLHelper::drawCrossTies(shape, myShapeRotations, myShapeLengths, 0.26 * exaggeration, 0.6 * exaggeration, halfCrossTieWidth, s.drawForSelecting);
575  }
576  } else if (isCrossing) {
577  if (s.drawCrossingsAndWalkingareas && (s.scale > 3.0 || s.junctionSize.minSize == 0)) {
578  glTranslated(0, 0, .2);
580  glTranslated(0, 0, -.2);
581  }
582  } else if (isWalkingArea) {
583  if (s.drawCrossingsAndWalkingareas && (s.scale > 3.0 || s.junctionSize.minSize == 0)) {
584  glTranslated(0, 0, .2);
585  if (s.scale * exaggeration < 20.) {
587  } else {
589  }
590  glTranslated(0, 0, -.2);
591 #ifdef GUILane_DEBUG_DRAW_WALKING_AREA_VERTICES
593 #endif
594  }
595  } else {
596  // we draw the lanes with reduced width so that the lane markings below are visible
597  // (this avoids artifacts at geometry corners without having to
598  // compute lane-marking intersection points)
599  const double halfWidth = isInternal ? myQuarterLaneWidth : (myHalfLaneWidth - SUMO_const_laneMarkWidth / 2);
600  mustDrawMarkings = !isInternal && myPermissions != 0 && myPermissions != SVC_PEDESTRIAN && exaggeration == 1.0 && !isWaterway(myPermissions);
601  const int cornerDetail = drawDetails && !isInternal ? (int)(s.scale * exaggeration) : 0;
602  const double offset = halfWidth * MAX2(0., (exaggeration - 1));
603  if (myShapeColors.size() > 0) {
604  GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, myShapeColors, halfWidth * exaggeration, cornerDetail, offset);
605  } else {
606  GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, halfWidth * exaggeration, cornerDetail, offset);
607  }
608  }
609 #ifdef GUILane_DEBUG_DRAW_VERTICES
611 #endif
612 #ifdef GUILane_DEBUG_DRAW_FOE_INTERSECTIONS
615  }
616 #endif
617  glPopMatrix();
618  // draw details
619  if ((!isInternal || isCrossing || !s.drawJunctionShape) && (drawDetails || s.drawForSelecting || junctionExaggeration > 1)) {
620  glPushMatrix();
621  glTranslated(0, 0, GLO_JUNCTION); // must draw on top of junction shape
622  glTranslated(0, 0, .5);
623  if (drawDetails) {
624  if (s.showLaneDirection) {
625  if (drawAsRailway(s)) {
626  // improve visibility of superposed rail edges
627  GLHelper::setColor(setColor(s).changedBrightness(100));
628  } else {
629  glColor3d(0.3, 0.3, 0.3);
630  }
631  if (!isCrossing || s.drawCrossingsAndWalkingareas) {
632  drawDirectionIndicators(exaggeration, spreadSuperposed);
633  }
634  }
635  if ((!isInternal || isCrossing)) {
636  if (MSGlobals::gLateralResolution > 0 && s.showSublanes && !hiddenBidi && !isCrossing) {
637  // draw sublane-borders
638  const double offsetSign = MSNet::getInstance()->lefthand() ? -1 : 1;
639  GLHelper::setColor(GLHelper::getColor().changedBrightness(51));
640  for (double offset = -myHalfLaneWidth; offset < myHalfLaneWidth; offset += MSGlobals::gLateralResolution) {
641  GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, 0.01, 0, -offset * offsetSign);
642  }
643  }
645  drawArrows();
646  }
647  glTranslated(0, 0, 1000);
648  if (s.drawLinkJunctionIndex.show) {
649  drawLinkNo(s);
650  }
651  if (s.drawLinkTLIndex.show) {
652  drawTLSLinkNo(s, *net);
653  }
654  glTranslated(0, 0, -1000);
655  }
656  glTranslated(0, 0, .1);
657  }
658  // make sure link rules are drawn so tls can be selected via right-click
659  if (s.showLinkRules && (drawDetails || s.drawForSelecting)
660  && !isWalkingArea
661  && (!myEdge->isInternal() || getLinkCont()[0]->isInternalJunctionLink())) {
662  drawLinkRules(s, *net);
663  }
664  if ((drawDetails || junctionExaggeration > 1) && s.showLane2Lane) {
665  // draw from end of first to the begin of second but respect junction scaling
666  drawLane2LaneConnections(junctionExaggeration);
667  }
668  glPopMatrix();
669  }
670  }
671  if (mustDrawMarkings && drawDetails && s.laneShowBorders && !hiddenBidi) { // needs matrix reset
672  drawMarkings(s, exaggeration);
673  }
674  if (drawDetails && isInternal && s.showBikeMarkings && myPermissions == SVC_BICYCLE && exaggeration == 1.0 && s.showLinkDecals && s.laneShowBorders && !hiddenBidi) {
676  }
677  } else {
678  glPopMatrix();
679  }
680  // draw vehicles
681  if (s.scale * s.vehicleSize.getExaggeration(s, nullptr) > s.vehicleSize.minSize) {
682  // retrieve vehicles from lane; disallow simulation
683  const MSLane::VehCont& vehicles = getVehiclesSecure();
684  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
685  if ((*v)->getLane() == this) {
686  static_cast<const GUIVehicle* const>(*v)->drawGL(s);
687  } // else: this is the shadow during a continuous lane change
688  }
689  // draw parking vehicles
690  for (std::set<const MSVehicle*>::const_iterator v = myParkingVehicles.begin(); v != myParkingVehicles.end(); ++v) {
691  static_cast<const GUIVehicle* const>(*v)->drawGL(s);
692  }
693  // allow lane simulation
694  releaseVehicles();
695  }
696  glPopName();
697 }
698 
699 
700 void
701 GUILane::drawMarkings(const GUIVisualizationSettings& s, double scale) const {
702  glPushMatrix();
703  glTranslated(0, 0, GLO_EDGE);
704  setColor(s);
705  // optionally draw inverse markings
706  if (myIndex > 0 && (myEdge->getLanes()[myIndex - 1]->getPermissions() & myPermissions) != 0) {
707  double mw = (myHalfLaneWidth + SUMO_const_laneMarkWidth) * scale;
708  double mw2 = (myHalfLaneWidth - SUMO_const_laneMarkWidth) * scale;
709  if (MSNet::getInstance()->lefthand()) {
710  mw *= -1;
711  mw2 *= -1;
712  }
713  int e = (int) getShape().size() - 1;
714  for (int i = 0; i < e; ++i) {
715  glPushMatrix();
716  glTranslated(getShape()[i].x(), getShape()[i].y(), 2.1);
717  glRotated(myShapeRotations[i], 0, 0, 1);
718  for (double t = 0; t < myShapeLengths[i]; t += 6) {
719  const double length = MIN2((double)3, myShapeLengths[i] - t);
720  glBegin(GL_QUADS);
721  glVertex2d(-mw, -t);
722  glVertex2d(-mw, -t - length);
723  glVertex2d(-mw2, -t - length);
724  glVertex2d(-mw2, -t);
725  glEnd();
726  }
727  glPopMatrix();
728  }
729  }
730  // draw white boundings and white markings
731  glColor3d(1, 1, 1);
733  getShape(),
735  getShapeLengths(),
737  glPopMatrix();
738 }
739 
740 
741 void
743  // draw bike lane markings onto the intersection
744  glColor3d(1, 1, 1);
745  const int e = (int) getShape().size() - 1;
746  const double markWidth = 0.1;
747  const double mw = myHalfLaneWidth;
748  for (int i = 0; i < e; ++i) {
749  glPushMatrix();
750  glTranslated(getShape()[i].x(), getShape()[i].y(), GLO_JUNCTION + 0.4);
751  glRotated(myShapeRotations[i], 0, 0, 1);
752  for (double t = 0; t < myShapeLengths[i]; t += 0.5) {
753  // left and right marking
754  for (int side = -1; side <= 1; side += 2) {
755  glBegin(GL_QUADS);
756  glVertex2d(side * mw, -t);
757  glVertex2d(side * mw, -t - 0.35);
758  glVertex2d(side * (mw + markWidth), -t - 0.35);
759  glVertex2d(side * (mw + markWidth), -t);
760  glEnd();
761  }
762  }
763  glPopMatrix();
764  }
765 }
766 
767 void
768 GUILane::drawDirectionIndicators(double exaggeration, bool spreadSuperposed) const {
769  glPushMatrix();
770  glTranslated(0, 0, GLO_EDGE);
771  int e = (int) getShape().size() - 1;
772  const double widthFactor = spreadSuperposed ? 0.4 : 1;
773  const double w = MAX2(POSITION_EPS, myWidth * widthFactor);
774  const double w2 = MAX2(POSITION_EPS, myHalfLaneWidth * widthFactor);
775  const double w4 = MAX2(POSITION_EPS, myQuarterLaneWidth * widthFactor);
776  const double sideOffset = spreadSuperposed ? w * -0.5 : 0;
777  for (int i = 0; i < e; ++i) {
778  glPushMatrix();
779  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
780  glRotated(myShapeRotations[i], 0, 0, 1);
781  for (double t = 0; t < myShapeLengths[i]; t += w) {
782  const double length = MIN2(w2, myShapeLengths[i] - t) * exaggeration;
783  glBegin(GL_TRIANGLES);
784  glVertex2d(sideOffset, -t - length);
785  glVertex2d(sideOffset - w4 * exaggeration, -t);
786  glVertex2d(sideOffset + w4 * exaggeration, -t);
787  glEnd();
788  }
789  glPopMatrix();
790  }
791  glPopMatrix();
792 }
793 
794 
795 void
797  glPushMatrix();
798  glColor3d(1.0, 0.3, 0.3);
799  const double orthoLength = 0.5;
800  const MSLink* link = getLinkCont().front();
801  const std::vector<const MSLane*>& foeLanes = link->getFoeLanes();
802  const std::vector<std::pair<double, double> >& lengthsBehind = link->getLengthsBehindCrossing();
803  if (foeLanes.size() == lengthsBehind.size()) {
804  for (int i = 0; i < (int)foeLanes.size(); ++i) {
805  const MSLane* l = foeLanes[i];
806  Position pos = l->geometryPositionAtOffset(l->getLength() - lengthsBehind[i].second);
807  PositionVector ortho = l->getShape().getOrthogonal(pos, 10, true, orthoLength);
808  if (ortho.length() < orthoLength) {
809  ortho.extrapolate(orthoLength - ortho.length(), false, true);
810  }
811  GLHelper::drawLine(ortho);
812  //std::cout << "foe=" << l->getID() << " lanePos=" << l->getLength() - lengthsBehind[i].second << " pos=" << pos << "\n";
813  }
814  }
815  glPopMatrix();
816 }
817 
818 
819 // ------ inherited from GUIGlObject
822  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
823  buildPopupHeader(ret, app);
825  //
826  new FXMenuCommand(ret, "Copy edge name to clipboard", nullptr, ret, MID_COPY_EDGE_NAME);
829  //
830  buildShowParamsPopupEntry(ret, false);
832  const double height = myShape.positionAtOffset(pos).z();
833  new FXMenuCommand(ret, ("pos: " + toString(pos) + " height: " + toString(height)).c_str(), nullptr, nullptr, 0);
834  new FXMenuSeparator(ret);
835  buildPositionCopyEntry(ret, false);
836  new FXMenuSeparator(ret);
837  if (myAmClosed) {
838  if (myPermissionChanges.empty()) {
839  new FXMenuCommand(ret, "Reopen lane", nullptr, &parent, MID_CLOSE_LANE);
840  new FXMenuCommand(ret, "Reopen edge", nullptr, &parent, MID_CLOSE_EDGE);
841  } else {
842  new FXMenuCommand(ret, "Reopen lane (override rerouter)", nullptr, &parent, MID_CLOSE_LANE);
843  new FXMenuCommand(ret, "Reopen edge (override rerouter)", nullptr, &parent, MID_CLOSE_EDGE);
844  }
845  } else {
846  new FXMenuCommand(ret, "Close lane", nullptr, &parent, MID_CLOSE_LANE);
847  new FXMenuCommand(ret, "Close edge", nullptr, &parent, MID_CLOSE_EDGE);
848  }
849  new FXMenuCommand(ret, "Add rerouter", nullptr, &parent, MID_ADD_REROUTER);
850  return ret;
851 }
852 
853 
856  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, 19 + (int)myEdge->getParametersMap().size());
857  // add items
858  ret->mkItem("maxspeed [m/s]", false, getSpeedLimit());
859  ret->mkItem("length [m]", false, myLength);
860  ret->mkItem("width [m]", false, myWidth);
861  ret->mkItem("street name", false, myEdge->getStreetName());
862  ret->mkItem("stored traveltime [s]", true, new FunctionBinding<GUILane, double>(this, &GUILane::getStoredEdgeTravelTime));
863  ret->mkItem("loaded weight", true, new FunctionBinding<GUILane, double>(this, &GUILane::getLoadedEdgeWeight));
864  ret->mkItem("routing speed [m/s]", true, new FunctionBinding<MSEdge, double>(myEdge, &MSEdge::getRoutingSpeed));
865  ret->mkItem("brutto occupancy [%]", true, new FunctionBinding<GUILane, double>(this, &GUILane::getBruttoOccupancy, 100.));
866  ret->mkItem("netto occupancy [%]", true, new FunctionBinding<GUILane, double>(this, &GUILane::getNettoOccupancy, 100.));
867  ret->mkItem("pending insertions [#]", true, new FunctionBinding<GUILane, double>(this, &GUILane::getPendingEmits));
868  ret->mkItem("edge type", false, myEdge->getEdgeType());
869  ret->mkItem("type", false, myLaneType);
870  ret->mkItem("priority", false, myEdge->getPriority());
871  ret->mkItem("distance [km]", false, myEdge->getDistance() / 1000);
872  ret->mkItem("allowed vehicle class", false, getVehicleClassNames(myPermissions));
873  ret->mkItem("disallowed vehicle class", false, getVehicleClassNames(~myPermissions));
874  ret->mkItem("permission code", false, myPermissions);
875  if (myEdge->getBidiEdge() != nullptr) {
876  ret->mkItem("bidi-edge", false, myEdge->getBidiEdge()->getID());
877  }
878  for (const auto& kv : myEdge->getParametersMap()) {
879  ret->mkItem(("edgeParam:" + kv.first).c_str(), false, kv.second);
880  }
881  ret->closeBuilding();
882  return ret;
883 }
884 
885 
886 Boundary
888  Boundary b;
889  b.add(myShape[0]);
890  b.add(myShape[-1]);
891  b.grow(10);
892  // ensure that vehicles and persons on the side are drawn even if the edge
893  // is outside the view
894  return b;
895 }
896 
897 
898 const PositionVector&
900  return myShape;
901 }
902 
903 
904 const std::vector<double>&
906  return myShapeRotations;
907 }
908 
909 
910 const std::vector<double>&
912  return myShapeLengths;
913 }
914 
915 
916 double
918  return myVehicles.size() == 0 ? 0 : myVehicles.back()->getWaitingSeconds();
919 }
920 
921 
922 double
924  return (double) myEdge->getLanes().size();
925 }
926 
927 
928 double
931  if (!ews.knowsTravelTime(myEdge)) {
932  return -1;
933  } else {
934  double value(0);
935  ews.retrieveExistingTravelTime(myEdge, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value);
936  return value;
937  }
938 }
939 
940 
941 double
944  if (!ews.knowsEffort(myEdge)) {
945  return -1;
946  } else {
947  double value(-1);
948  ews.retrieveExistingEffort(myEdge, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value);
949  return value;
950  }
951 }
952 
953 
954 RGBColor
956  // setting and retrieving the color does not work in OSGView so we return it explicitliy
957  RGBColor col;
958  if (MSGlobals::gUseMesoSim && static_cast<const GUIEdge*>(myEdge)->getMesoColor() != MESO_USE_LANE_COLOR) {
959  col = static_cast<const GUIEdge*>(myEdge)->getMesoColor();
960  } else {
961  const GUIColorer& c = s.laneColorer;
962  if (!setFunctionalColor(c, col) && !setMultiColor(s, c, col)) {
963  col = c.getScheme().getColor(getColorValue(s, c.getActive()));
964  }
965  }
966  GLHelper::setColor(col);
967  return col;
968 }
969 
970 
971 bool
972 GUILane::setFunctionalColor(const GUIColorer& c, RGBColor& col, int activeScheme) const {
973  if (activeScheme < 0) {
974  activeScheme = c.getActive();
975  }
976  switch (activeScheme) {
977  case 0:
978  if (myEdge->isCrossing()) {
979  // determine priority to decide color
981  if (link->havePriority() || link->getTLLogic() != nullptr) {
982  col = RGBColor(230, 230, 230);
983  } else {
984  col = RGBColor(26, 26, 26);
985  }
986  GLHelper::setColor(col);
987  return true;
988  } else {
989  return false;
990  }
991  case 18: {
992  double hue = GeomHelper::naviDegree(myShape.beginEndAngle()); // [0-360]
993  col = RGBColor::fromHSV(hue, 1., 1.);
994  GLHelper::setColor(col);
995  return true;
996  }
997  case 30: { // taz color
998  col = c.getScheme().getColor(0);
999  std::vector<RGBColor> tazColors;
1000  for (MSEdge* e : myEdge->getPredecessors()) {
1001  if (e->isTazConnector() && e->knowsParameter("tazColor")) {
1002  tazColors.push_back(RGBColor::parseColor(e->getParameter("tazColor")));
1003  }
1004  }
1005  for (MSEdge* e : myEdge->getSuccessors()) {
1006  if (e->isTazConnector() && e->knowsParameter("tazColor")) {
1007  tazColors.push_back(RGBColor::parseColor(e->getParameter("tazColor")));
1008  }
1009  }
1010  if (tazColors.size() > 0) {
1011  int randColor = RandHelper::rand((int)tazColors.size(), RGBColor::getColorRNG());
1012  col = tazColors[randColor];
1013  }
1014  GLHelper::setColor(col);
1015  return true;
1016  }
1017  default:
1018  return false;
1019  }
1020 }
1021 
1022 
1023 bool
1025  const int activeScheme = c.getActive();
1026  myShapeColors.clear();
1027  switch (activeScheme) {
1028  case 22: // color by height at segment start
1029  for (PositionVector::const_iterator ii = myShape.begin(); ii != myShape.end() - 1; ++ii) {
1030  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
1031  }
1032  // osg fallback (edge height at start)
1033  col = c.getScheme().getColor(getColorValue(s, 21));
1034  return true;
1035  case 24: // color by inclination at segment start
1036  for (int ii = 1; ii < (int)myShape.size(); ++ii) {
1037  const double inc = (myShape[ii].z() - myShape[ii - 1].z()) / MAX2(POSITION_EPS, myShape[ii].distanceTo2D(myShape[ii - 1]));
1038  myShapeColors.push_back(c.getScheme().getColor(inc));
1039  }
1040  col = c.getScheme().getColor(getColorValue(s, 23));
1041  return true;
1042  default:
1043  return false;
1044  }
1045 }
1046 
1047 
1048 double
1049 GUILane::getColorValue(const GUIVisualizationSettings& s, int activeScheme) const {
1050  switch (activeScheme) {
1051  case 0:
1052  switch (myPermissions) {
1053  case SVC_PEDESTRIAN:
1054  return 1;
1055  case SVC_BICYCLE:
1056  return 2;
1057  case 0:
1058  // forbidden road or green verge
1059  return myEdge->getPermissions() == 0 ? 9 : 3;
1060  case SVC_SHIP:
1061  return 4;
1062  case SVC_AUTHORITY:
1063  return 7;
1064  default:
1065  break;
1066  }
1067  if (myEdge->isTazConnector()) {
1068  return 8;
1069  } else if (isRailway(myPermissions)) {
1070  return 5;
1071  } else if ((myPermissions & SVC_PASSENGER) != 0) {
1072  return 0;
1073  } else {
1074  return 6;
1075  }
1076  case 1:
1077  return isLaneOrEdgeSelected();
1078  case 2:
1079  return (double)myPermissions;
1080  case 3:
1081  return getSpeedLimit();
1082  case 4:
1083  return getBruttoOccupancy();
1084  case 5:
1085  return getNettoOccupancy();
1086  case 6:
1087  return firstWaitingTime();
1088  case 7:
1089  return getEdgeLaneNumber();
1090  case 8:
1091  return getCO2Emissions() / myLength;
1092  case 9:
1093  return getCOEmissions() / myLength;
1094  case 10:
1095  return getPMxEmissions() / myLength;
1096  case 11:
1097  return getNOxEmissions() / myLength;
1098  case 12:
1099  return getHCEmissions() / myLength;
1100  case 13:
1101  return getFuelConsumption() / myLength;
1102  case 14:
1104  case 15: {
1105  return getStoredEdgeTravelTime();
1106  }
1107  case 16: {
1109  if (!ews.knowsTravelTime(myEdge)) {
1110  return -1;
1111  } else {
1112  double value(0);
1113  ews.retrieveExistingTravelTime(myEdge, 0, value);
1114  return 100 * myLength / value / getSpeedLimit();
1115  }
1116  }
1117  case 17: {
1118  // geometrical length has no meaning for walkingAreas since it describes the outer boundary
1119  return myEdge->isWalkingArea() ? 1 : 1 / myLengthGeometryFactor;
1120  }
1121  case 19: {
1122  return getLoadedEdgeWeight();
1123  }
1124  case 20: {
1125  return myEdge->getPriority();
1126  }
1127  case 21: {
1128  // color by z of first shape point
1129  return getShape()[0].z();
1130  }
1131  case 23: {
1132  // color by incline
1133  return (getShape()[-1].z() - getShape()[0].z()) / getLength();
1134  }
1135  case 25: {
1136  // color by average speed
1137  return getMeanSpeed();
1138  }
1139  case 26: {
1140  // color by average relative speed
1141  return getMeanSpeed() / myMaxSpeed;
1142  }
1143  case 27: {
1144  // color by routing device assumed speed
1145  return myEdge->getRoutingSpeed();
1146  }
1147  case 28:
1149  case 29:
1150  return getPendingEmits();
1151  case 31: {
1152  // by numerical edge param value
1153  try {
1155  } catch (NumberFormatException&) {
1156  try {
1158  } catch (BoolFormatException&) {
1159  WRITE_WARNING("Edge parameter '" + myEdge->getParameter(s.edgeParam, "0") + "' key '" + s.edgeParam + "' is not a number for edge '" + myEdge->getID() + "'");
1160  return -1;
1161  }
1162  }
1163  }
1164  case 32: {
1165  // by numerical lane param value
1166  try {
1168  } catch (NumberFormatException&) {
1169  try {
1170  return StringUtils::toBool(getParameter(s.laneParam, "0"));
1171  } catch (BoolFormatException&) {
1172  WRITE_WARNING("Lane parameter '" + getParameter(s.laneParam, "0") + "' key '" + s.laneParam + "' is not a number for lane '" + getID() + "'");
1173  return -1;
1174  }
1175  }
1176  }
1177  case 33: {
1178  // by edge data value
1180  }
1181  case 34: {
1182  return myEdge->getDistance();
1183  }
1184  case 35: {
1185  return fabs(myEdge->getDistance());
1186  }
1187  }
1188  return 0;
1189 }
1190 
1191 
1192 double
1193 GUILane::getScaleValue(int activeScheme) const {
1194  switch (activeScheme) {
1195  case 0:
1196  return 0;
1197  case 1:
1198  return isLaneOrEdgeSelected();
1199  case 2:
1200  return getSpeedLimit();
1201  case 3:
1202  return getBruttoOccupancy();
1203  case 4:
1204  return getNettoOccupancy();
1205  case 5:
1206  return firstWaitingTime();
1207  case 6:
1208  return getEdgeLaneNumber();
1209  case 7:
1210  return getCO2Emissions() / myLength;
1211  case 8:
1212  return getCOEmissions() / myLength;
1213  case 9:
1214  return getPMxEmissions() / myLength;
1215  case 10:
1216  return getNOxEmissions() / myLength;
1217  case 11:
1218  return getHCEmissions() / myLength;
1219  case 12:
1220  return getFuelConsumption() / myLength;
1221  case 13:
1223  case 14: {
1224  return getStoredEdgeTravelTime();
1225  }
1226  case 15: {
1228  if (!ews.knowsTravelTime(myEdge)) {
1229  return -1;
1230  } else {
1231  double value(0);
1232  ews.retrieveExistingTravelTime(myEdge, 0, value);
1233  return 100 * myLength / value / getSpeedLimit();
1234  }
1235  }
1236  case 16: {
1237  return 1 / myLengthGeometryFactor;
1238  }
1239  case 17: {
1240  return getLoadedEdgeWeight();
1241  }
1242  case 18: {
1243  return myEdge->getPriority();
1244  }
1245  case 19: {
1246  // scale by average speed
1247  return getMeanSpeed();
1248  }
1249  case 20: {
1250  // scale by average relative speed
1251  return getMeanSpeed() / myMaxSpeed;
1252  }
1253  case 21:
1255  case 22:
1257  }
1258  return 0;
1259 }
1260 
1261 
1262 bool
1265 }
1266 
1267 
1268 bool
1270  return isWaterway(myPermissions) && s.showRails && !s.drawForSelecting; // reusing the showRails setting
1271 }
1272 
1273 
1274 #ifdef HAVE_OSG
1275 void
1276 GUILane::updateColor(const GUIVisualizationSettings& s) {
1277  if (myGeom == 0) {
1278  // not drawn
1279  return;
1280  }
1281  const RGBColor col = setColor(s);
1282  osg::Vec4ubArray* colors = dynamic_cast<osg::Vec4ubArray*>(myGeom->getColorArray());
1283  (*colors)[0].set(col.red(), col.green(), col.blue(), col.alpha());
1284  myGeom->setColorArray(colors);
1285 }
1286 #endif
1287 
1288 
1289 void
1290 GUILane::closeTraffic(bool rebuildAllowed) {
1291  MSGlobals::gCheckRoutes = false;
1292  if (myAmClosed) {
1293  myPermissionChanges.clear(); // reset rerouters
1295  } else {
1297  }
1299  if (rebuildAllowed) {
1301  for (MSEdge* const pred : getEdge().getPredecessors()) {
1302  pred->rebuildAllowedTargets();
1303  }
1304  }
1305 }
1306 
1307 
1310  assert(MSGlobals::gUseMesoSim);
1311  int no = MELoop::numSegmentsFor(myLength, OptionsCont::getOptions().getFloat("meso-edgelength"));
1312  const double slength = myLength / no;
1313  PositionVector result = shape;
1314  double offset = 0;
1315  for (int i = 0; i < no; ++i) {
1316  offset += slength;
1317  Position pos = shape.positionAtOffset(offset);
1318  int index = result.indexOfClosest(pos);
1319  if (pos.distanceTo(result[index]) > POSITION_EPS) {
1320  index = result.insertAtClosest(pos);
1321  }
1322  while ((int)myShapeSegments.size() < index) {
1323  myShapeSegments.push_back(i);
1324  }
1325  //std::cout << "splitAtSegments " << getID() << " no=" << no << " i=" << i << " offset=" << offset << " index=" << index << " segs=" << toString(myShapeSegments) << " resultSize=" << result.size() << " result=" << toString(result) << "\n";
1326  }
1327  while (myShapeSegments.size() < result.size()) {
1328  myShapeSegments.push_back(no - 1);
1329  }
1330  return result;
1331 }
1332 
1333 bool
1335  return gSelected.isSelected(GLO_LANE, getGlID());
1336 }
1337 
1338 bool
1340  return isSelected() || gSelected.isSelected(GLO_EDGE, dynamic_cast<GUIEdge*>(myEdge)->getGlID());
1341 }
1342 
1343 double
1346 }
1347 
1348 
1349 /****************************************************************************/
RGBColor::alpha
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition: RGBColor.h:83
PositionVector::nearest_offset_to_point25D
double nearest_offset_to_point25D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D projected onto the 3D geometry
Definition: PositionVector.cpp:845
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:181
MSEdgeWeightsStorage::knowsEffort
bool knowsEffort(const MSEdge *const e) const
Returns the information whether any effort is known for the given edge.
Definition: MSEdgeWeightsStorage.cpp:120
MSEdge::getEdgeType
const std::string & getEdgeType() const
Returns the type of the edge.
Definition: MSEdge.h:276
GLHelper::debugVertices
static void debugVertices(const PositionVector &shape, double size, double layer=256)
draw vertex numbers for the given shape (in a random color)
Definition: GLHelper.cpp:803
GUILane::detectCollisions
void detectCollisions(SUMOTime timestep, const std::string &stage)
Definition: GUILane.cpp:188
PositionVector::beginEndAngle
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position
Definition: PositionVector.cpp:800
SVC_PEDESTRIAN
pedestrian
Definition: SUMOVehicleClass.h:157
GUILane::splitAtSegments
PositionVector splitAtSegments(const PositionVector &shape)
add intermediate points at segment borders
Definition: GUILane.cpp:1309
MID_CLOSE_EDGE
close edge
Definition: GUIAppEnum.h:544
GUILane::drawTLSLinkNo
void drawTLSLinkNo(const GUIVisualizationSettings &s, const GUINet &net) const
Definition: GUILane.cpp:238
LINKSTATE_EQUAL
This is an uncontrolled, right-before-left link.
Definition: SUMOXMLDefinitions.h:1154
MSLane::getCOEmissions
double getCOEmissions() const
Returns the sum of last step CO emissions.
Definition: MSLane.cpp:2737
MSEdge::getSuccessors
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition: MSEdge.cpp:998
GLHelper::getColor
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:622
MIN2
T MIN2(T a, T b)
Definition: StdDefs.h:74
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:63
GUIVisualizationSettings::laneShowBorders
bool laneShowBorders
Information whether lane borders shall be drawn.
Definition: GUIVisualizationSettings.h:444
GUILane::setMultiColor
bool setMultiColor(const GUIVisualizationSettings &s, const GUIColorer &c, RGBColor &col) const
sets multiple colors according to the current scheme index and some lane function
Definition: GUILane.cpp:1024
GUIVisualizationSettings::edgeParam
std::string edgeParam
key for coloring by edge parameter
Definition: GUIVisualizationSettings.h:480
MSEdge::getNumericalID
int getNumericalID() const
Returns the numerical id of the edge.
Definition: MSEdge.h:263
StringUtils::toBool
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
Definition: StringUtils.cpp:342
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
GUIVehicle.h
GUILane::myQuarterLaneWidth
double myQuarterLaneWidth
Quarter of lane width, for speed-up.
Definition: GUILane.h:339
GUIVisualizationSettings::laneMinSize
double laneMinSize
The minimum visual lane width for drawing.
Definition: GUIVisualizationSettings.h:468
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
MSNet.h
MSEdge::getStreetName
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:270
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
GUIVisualizationSettings::junctionSize
GUIVisualizationSizeSettings junctionSize
Definition: GUIVisualizationSettings.h:569
LINKSTATE_TL_OFF_BLINKING
The link is controlled by a tls which is off and blinks, has to brake.
Definition: SUMOXMLDefinitions.h:1146
GUIParameterTableWindow.h
GUINet::getLinkTLID
int getLinkTLID(MSLink *link) const
Definition: GUINet.cpp:189
MSLane::resetPartialOccupation
virtual void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
Definition: MSLane.cpp:282
MSLane::setJunctionApproaches
virtual void setJunctionApproaches(const SUMOTime t) const
Register junction approaches for all vehicles after velocities have been planned.
Definition: MSLane.cpp:1202
GUINet::getGUIInstance
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:516
LINKSTATE_TL_OFF_NOSIGNAL
The link is controlled by a tls which is off, not blinking, may pass.
Definition: SUMOXMLDefinitions.h:1148
Position::z
double z() const
Returns the z-position.
Definition: Position.h:67
GUIGlObject::buildSelectionPopupEntry
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
Definition: GUIGlObject.cpp:236
PositionVector::insertAtClosest
int insertAtClosest(const Position &p)
inserts p between the two closest positions and returns the insertion index
Definition: PositionVector.cpp:951
OptionsCont.h
GLHelper::drawBoxLines
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:182
MSLane::myLaneType
const std::string myLaneType
the type of this lane
Definition: MSLane.h:1395
StringUtils::toDouble
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
Definition: StringUtils.cpp:313
GUILane::myShapeSegments
std::vector< int > myShapeSegments
the meso segment index for each geometry segment
Definition: GUILane.h:333
MsgHandler.h
GUIVisualizationTextSettings::color
RGBColor color
text color
Definition: GUIVisualizationSettings.h:75
LINKDIR_PARTRIGHT
The link is a partial right direction.
Definition: SUMOXMLDefinitions.h:1185
GUILane::getEdgeLaneNumber
double getEdgeLaneNumber() const
Definition: GUILane.cpp:923
GUILane::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUILane.cpp:855
GUILane::debugDrawFoeIntersections
void debugDrawFoeIntersections() const
draw intersection positions of foe internal lanes with this one
Definition: GUILane.cpp:796
GUIGlobalSelection.h
GUILane::getLoadedEdgeWeight
double getLoadedEdgeWeight() const
Returns the loaded weight (effort) for the edge of this lane.
Definition: GUILane.cpp:942
MSNet::getInsertionControl
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:390
GUILane::drawLinkNo
void drawLinkNo(const GUIVisualizationSettings &s) const
helper methods
Definition: GUILane.cpp:210
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
MSLane::VehCont
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:93
GeomHelper::naviDegree
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:194
GUILane::setFunctionalColor
bool setFunctionalColor(const GUIColorer &c, RGBColor &col, int activeScheme=-1) const
Definition: GUILane.cpp:972
LINKDIR_TURN_LEFTHAND
The link is a 180 degree turn (left-hand network)
Definition: SUMOXMLDefinitions.h:1177
SVC_BICYCLE
vehicle is a bicycle
Definition: SUMOVehicleClass.h:180
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
MSLane::getHarmonoise_NoiseEmissions
double getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
Definition: MSLane.cpp:2809
LINKSTATE_TL_GREEN_MINOR
The link has green light, has to brake.
Definition: SUMOXMLDefinitions.h:1136
SUMO_const_laneWidth
const double SUMO_const_laneWidth
Definition: StdDefs.h:50
MSGlobals::gUseMesoSim
static bool gUseMesoSim
Definition: MSGlobals.h:91
MSEdge::getPriority
int getPriority() const
Returns the priority of the edge.
Definition: MSEdge.h:282
RAD2DEG
#define RAD2DEG(x)
Definition: GeomHelper.h:39
PositionVector::extrapolate
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
Definition: PositionVector.cpp:1025
PositionVector::length
double length() const
Returns the length.
Definition: PositionVector.cpp:476
MSLane::getHCEmissions
double getHCEmissions() const
Returns the sum of last step HC emissions.
Definition: MSLane.cpp:2773
RGBColor::red
unsigned char red() const
Returns the red-amount of the color.
Definition: RGBColor.h:62
GLHelper.h
GUILane::isLaneOrEdgeSelected
bool isLaneOrEdgeSelected() const
whether this lane or its parent edge is selected in the GUI
Definition: GUILane.cpp:1339
MSLane::planMovements
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:1162
GUIVisualizationSettings::drawLinkJunctionIndex
GUIVisualizationTextSettings drawLinkJunctionIndex
Definition: GUIVisualizationSettings.h:560
GUIEdge::getScaleValue
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:510
GUIVisualizationSettings::vehicleSize
GUIVisualizationSizeSettings vehicleSize
Definition: GUIVisualizationSettings.h:511
GUIVisualizationSettings::showRails
bool showRails
Information whether rails shall be drawn.
Definition: GUIVisualizationSettings.h:456
GUILane::isSelected
bool isSelected() const
whether this lane is selected in the GUI
Definition: GUILane.cpp:1334
MSLane::myShape
PositionVector myShape
The shape of the lane.
Definition: MSLane.h:1270
GUILane::drawDirectionIndicators
void drawDirectionIndicators(double exaggeration, bool spreadSuperposed) const
direction indicators for lanes
Definition: GUILane.cpp:768
LinkDirection
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
Definition: SUMOXMLDefinitions.h:1171
MSInsertionControl.h
LINKSTATE_TL_GREEN_MAJOR
The link has green light, may pass.
Definition: SUMOXMLDefinitions.h:1134
GUINet.h
GUIVisualizationSettings::edgeScaler
GUIScaler edgeScaler
The mesoscopic edge scaler.
Definition: GUIVisualizationSettings.h:432
LINKSTATE_MAJOR
This is an uncontrolled, major link, may pass.
Definition: SUMOXMLDefinitions.h:1150
GUILane::incorporateVehicle
virtual void incorporateVehicle(MSVehicle *veh, double pos, double speed, double posLat, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
Definition: GUILane.cpp:117
PositionVector
A list of positions.
Definition: PositionVector.h:46
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
MSLane::myLinks
MSLinkCont myLinks
Definition: MSLane.h:1373
LINKDIR_NODIR
The link has no direction (is a dead end link)
Definition: SUMOXMLDefinitions.h:1187
GLHelper::drawFilledPoly
static void drawFilledPoly(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
Definition: GLHelper.cpp:82
GUILane::closeTraffic
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
Definition: GUILane.cpp:1290
MSLane::getBruttoOccupancy
double getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
Definition: MSLane.cpp:2666
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:616
GUILane::MESO_USE_LANE_COLOR
static const RGBColor MESO_USE_LANE_COLOR
special color to signify alternative coloring scheme
Definition: GUILane.h:353
SVC_AUTHORITY
authorities vehicles
Definition: SUMOVehicleClass.h:146
GUIParameterTableWindow::closeBuilding
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Definition: GUIParameterTableWindow.cpp:220
MSEdgeWeightsStorage
A storage for edge travel times and efforts.
Definition: MSEdgeWeightsStorage.h:44
MSLane::myWidth
const double myWidth
Lane width [m].
Definition: MSLane.h:1325
GUILane::removeVehicle
MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify)
Definition: GUILane.cpp:160
Parameterised::getParameter
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
Definition: Parameterised.cpp:71
MSGlobals::gLateralResolution
static double gLateralResolution
Definition: MSGlobals.h:85
GUIAppEnum.h
GUILane::drawBikeMarkings
void drawBikeMarkings() const
bike lane markings on top of an intersection
Definition: GUILane.cpp:742
MESegment.h
GUILane::drawLinkRules
void drawLinkRules(const GUIVisualizationSettings &s, const GUINet &net) const
Definition: GUILane.cpp:278
GUILane::resetPartialOccupation
void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
Definition: GUILane.cpp:202
GUILane::executeMovements
void executeMovements(const SUMOTime t)
Definition: GUILane.cpp:153
LINKDIR_RIGHT
The link is a (hard) right direction.
Definition: SUMOXMLDefinitions.h:1181
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:80
MSEdge::isInternal
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:233
GUISUMOAbstractView.h
GUILane::integrateNewVehicles
void integrateNewVehicles()
Definition: GUILane.cpp:181
MSEdgeWeightsStorage::knowsTravelTime
bool knowsTravelTime(const MSEdge *const e) const
Returns the information whether any travel time is known for the given edge.
Definition: MSEdgeWeightsStorage.cpp:114
LINKDIR_TURN
The link is a 180 degree turn.
Definition: SUMOXMLDefinitions.h:1175
GUILane::GUILane
GUILane(const std::string &id, double maxSpeed, double length, MSEdge *const edge, int numericalID, const PositionVector &shape, double width, SVCPermissions permissions, int index, bool isRampAccel, const std::string &type)
Constructor.
Definition: GUILane.cpp:74
GUIVisualizationSettings::drawCrossingsAndWalkingareas
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
Definition: GUIVisualizationSettings.h:567
NumberFormatException
Definition: UtilExceptions.h:96
RGBColor
Definition: RGBColor.h:40
LinkState
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
Definition: SUMOXMLDefinitions.h:1132
MSEdgeWeightsStorage::retrieveExistingTravelTime
bool retrieveExistingTravelTime(const MSEdge *const e, const double t, double &value) const
Returns a travel time for an edge and time if stored.
Definition: MSEdgeWeightsStorage.cpp:40
MSLane::getCO2Emissions
double getCO2Emissions() const
Returns the sum of last step CO2 emissions.
Definition: MSLane.cpp:2725
NODETYPE_RAIL_SIGNAL
Definition: SUMOXMLDefinitions.h:1054
Parameterised::getParametersMap
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
Definition: Parameterised.cpp:105
RandHelper::rand
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
Definition: RandHelper.h:60
MSEdge::isCrossing
bool isCrossing() const
return whether this edge is a pedestrian crossing
Definition: MSEdge.h:238
LINKDIR_STRAIGHT
The link is a straight direction.
Definition: SUMOXMLDefinitions.h:1173
SUMO_const_halfLaneWidth
const double SUMO_const_halfLaneWidth
Definition: StdDefs.h:52
MSLane::executeMovements
virtual void executeMovements(const SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
Definition: MSLane.cpp:1703
MSLane::swapAfterLaneChange
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: MSLane.cpp:2158
MSLane::getElectricityConsumption
double getElectricityConsumption() const
Returns the sum of last step electricity consumption.
Definition: MSLane.cpp:2797
GUIVisualizationSettings::showBikeMarkings
bool showBikeMarkings
Information whether bicycle lane marking shall be drawn.
Definition: GUIVisualizationSettings.h:447
MSLane::setPermissions
void setPermissions(SVCPermissions permissions, long long transientID)
Sets the permissions to the given value. If a transientID is given, the permissions are recored as te...
Definition: MSLane.cpp:3611
GUILane::setColor
RGBColor setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUILane.cpp:955
MSLane::interpolateGeometryPosToLanePos
double interpolateGeometryPosToLanePos(double geometryPos) const
Definition: MSLane.h:511
LINKSTATE_TL_YELLOW_MINOR
The link has yellow light, has to brake anyway.
Definition: SUMOXMLDefinitions.h:1144
GUILane::getShape
const PositionVector & getShape() const
Definition: GUILane.cpp:899
MSLane::myStopOffsets
std::map< SVCPermissions, double > myStopOffsets
Definition: MSLane.h:1330
MSLane::myLengthGeometryFactor
const double myLengthGeometryFactor
precomputed myShape.length / myLength
Definition: MSLane.h:1389
MSEdgeWeightsStorage.h
GUIVisualizationSettings::showLinkDecals
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
Definition: GUIVisualizationSettings.h:450
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:219
MID_COPY_EDGE_NAME
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:373
MSNet::getWeightsStorage
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition: MSNet.cpp:820
GUIVisualizationSettings::laneWidthExaggeration
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
Definition: GUIVisualizationSettings.h:465
GUIGlObject::buildNameCopyPopupEntry
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
Definition: GUIGlObject.cpp:226
LINKSTATE_TL_REDYELLOW
The link has red light (must brake) but indicates upcoming green.
Definition: SUMOXMLDefinitions.h:1140
MSEdge::getDistance
double getDistance() const
Returns the kilometrage/mileage at the start of the edge.
Definition: MSEdge.h:288
MSNet::lefthand
bool lefthand() const
return whether the network was built for lefthand traffic
Definition: MSNet.h:662
GUIPropertySchemeStorage::getScheme
T & getScheme()
Definition: GUIPropertySchemeStorage.h:80
GUILane::drawAsRailway
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition: GUILane.cpp:1263
GUIVisualizationSettings::laneScaler
GUIScaler laneScaler
The lane scaler.
Definition: GUIVisualizationSettings.h:441
GUILane.h
Position::distanceTo
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:234
GUIParameterTableWindow::mkItem
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
Definition: GUIParameterTableWindow.h:109
GUIVisualizationSizeSettings::constantSize
bool constantSize
whether the object shall be drawn with constant size regardless of zoom
Definition: GUIVisualizationSettings.h:110
GUILane::getShapeRotations
const std::vector< double > & getShapeRotations() const
Definition: GUILane.cpp:905
MSEdge::isTazConnector
bool isTazConnector() const
Definition: MSEdge.h:256
GUINet::getEdgeData
double getEdgeData(const MSEdge *edge, const std::string &attr)
retrieve loaded edged weight for the given attribute and the current simulation time
Definition: GUINet.cpp:549
isWaterway
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
Definition: SUMOVehicleClass.cpp:370
RGBColor::parseColor
static RGBColor parseColor(std::string coldef)
Parses a color information.
Definition: RGBColor.cpp:177
RGBColor::getColorRNG
static std::mt19937 * getColorRNG()
Definition: RGBColor.h:113
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:57
SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
Definition: SUMOVehicleClass.h:160
PositionVector::positionAtOffset
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Definition: PositionVector.cpp:246
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:150
GUIVisualizationSettings::showSublanes
bool showSublanes
Whether to show sublane boundaries.
Definition: GUIVisualizationSettings.h:474
MID_ADD_REROUTER
add rerouter
Definition: GUIAppEnum.h:546
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
MSLane::getNOxEmissions
double getNOxEmissions() const
Returns the sum of last step NOx emissions.
Definition: MSLane.cpp:2761
GUILane::drawAsWaterway
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterway
Definition: GUILane.cpp:1269
MSLane::getLength
double getLength() const
Returns the lane's length.
Definition: MSLane.h:541
MSInsertionControl::getPendingEmits
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
Definition: MSInsertionControl.cpp:300
MSLane::CHANGE_PERMISSIONS_GUI
static const long CHANGE_PERMISSIONS_GUI
Definition: MSLane.h:1207
GUILane::setJunctionApproaches
void setJunctionApproaches(const SUMOTime t) const
Definition: GUILane.cpp:146
GUILane::getShapeLengths
const std::vector< double > & getShapeLengths() const
Definition: GUILane.cpp:911
GUIVisualizationSettings::scale
double scale
information about a lane's width (temporary, used for a single view)
Definition: GUIVisualizationSettings.h:623
getVehicleClassNames
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
Definition: SUMOVehicleClass.cpp:169
isRailway
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
Definition: SUMOVehicleClass.cpp:364
MSLane::getMeanSpeed
double getMeanSpeed() const
Returns the mean speed on this lane.
Definition: MSLane.cpp:2709
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GLO_EDGE
an edge
Definition: GUIGlObjectTypes.h:47
Position::x
double x() const
Returns the x-position.
Definition: Position.h:57
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:79
GUILane::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUILane.cpp:887
GLHelper::drawFilledPolyTesselated
static void drawFilledPolyTesselated(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
Definition: GLHelper.cpp:101
GUILane::drawMarkings
void drawMarkings(const GUIVisualizationSettings &s, double scale) const
draw lane borders and white markings
Definition: GUILane.cpp:701
MSGlobals.h
MSDevice_Routing.h
GLHelper::drawLine
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:274
MSEdge::getBidiEdge
const MSEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
Definition: MSEdge.h:247
LINKSTATE_DEADEND
This is a dead end link.
Definition: SUMOXMLDefinitions.h:1162
MSLane::removeVehicle
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
Definition: MSLane.cpp:2169
GUIVisualizationSettings::drawLinkTLIndex
GUIVisualizationTextSettings drawLinkTLIndex
Definition: GUIVisualizationSettings.h:560
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
GLO_LANE
a lane
Definition: GUIGlObjectTypes.h:49
GUILane::myShapeRotations
std::vector< double > myShapeRotations
The rotations of the shape parts.
Definition: GUILane.h:324
GUILane::firstWaitingTime
double firstWaitingTime() const
Definition: GUILane.cpp:917
LINKDIR_LEFT
The link is a (hard) left direction.
Definition: SUMOXMLDefinitions.h:1179
MSJunction::getType
SumoXMLNodeType getType() const
return the type of this Junction
Definition: MSJunction.h:127
RGBColor::fromHSV
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb....
Definition: RGBColor.cpp:299
MSEdgeWeightsStorage::retrieveExistingEffort
bool retrieveExistingEffort(const MSEdge *const e, const double t, double &value) const
Returns an effort for an edge and time if stored.
Definition: MSEdgeWeightsStorage.cpp:55
MSEdge::getToJunction
const MSJunction * getToJunction() const
Definition: MSEdge.h:361
MSGlobals::gCheckRoutes
static bool gCheckRoutes
Definition: MSGlobals.h:79
GUIVisualizationTextSettings::show
bool show
flag show
Definition: GUIVisualizationSettings.h:69
GUIGlObject
Definition: GUIGlObject.h:66
LINKSTATE_MINOR
This is an uncontrolled, minor link, has to brake.
Definition: SUMOXMLDefinitions.h:1152
PositionVector::indexOfClosest
int indexOfClosest(const Position &p) const
index of the closest position to p
Definition: PositionVector.cpp:932
MSLane::getNettoOccupancy
double getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)
Definition: MSLane.cpp:2681
GUISUMOAbstractView::getPositionInformation
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Definition: GUISUMOAbstractView.cpp:188
MSLane::getLinkCont
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:2099
RGBColor::green
unsigned char green() const
Returns the green-amount of the color.
Definition: RGBColor.h:69
GUILane::myShapeLengths
std::vector< double > myShapeLengths
The lengths of the shape parts.
Definition: GUILane.h:327
GUIVisualizationSettings::laneParam
std::string laneParam
Definition: GUIVisualizationSettings.h:480
SVC_SHIP
is an arbitrary ship
Definition: SUMOVehicleClass.h:196
MSEdge::getRoutingSpeed
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:797
GLHelper::drawCrossTies
static void drawCrossTies(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double length, double spacing, double halfWidth, bool drawForSelecting)
draw crossties for railroads or pedestrian crossings
Definition: GLHelper.cpp:763
MSLane::detectCollisions
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
Definition: MSLane.cpp:1260
NODETYPE_RAIL_CROSSING
Definition: SUMOXMLDefinitions.h:1055
GUILane::setPartialOccupation
double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
Definition: GUILane.cpp:195
MSLane::getPMxEmissions
double getPMxEmissions() const
Returns the sum of last step PMx emissions.
Definition: MSLane.cpp:2749
GUIVisualizationSizeSettings::minSize
double minSize
The minimum size to draw this object.
Definition: GUIVisualizationSettings.h:104
GUILane::getStoredEdgeTravelTime
double getStoredEdgeTravelTime() const
Returns the stored traveltime for the edge of this lane.
Definition: GUILane.cpp:929
MSLane::getLogicalPredecessorLane
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
Definition: MSLane.cpp:2532
GUILane::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:484
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:208
PositionVector::getOrthogonal
PositionVector getOrthogonal(const Position &p, double extend, bool before, double length=1.0) const
return orthogonal through p (extending this vector if necessary)
Definition: PositionVector.cpp:1500
BoolFormatException
Definition: UtilExceptions.h:109
GUILane::myHalfLaneWidth
double myHalfLaneWidth
Half of lane width, for speed-up.
Definition: GUILane.h:336
GUIVisualizationSettings::getLinkColor
static const RGBColor & getLinkColor(const LinkState &ls)
map from LinkState to color constants
Definition: GUIVisualizationSettings.cpp:1566
MSLane::getEdge
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:670
MSLane::incorporateVehicle
virtual void incorporateVehicle(MSVehicle *veh, double pos, double speed, double posLat, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
Definition: MSLane.cpp:330
Position::distanceTo2D
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:244
MSEdge::isWalkingArea
bool isWalkingArea() const
return whether this edge is walking area
Definition: MSEdge.h:252
GLIncludes.h
GUILane::myAmClosed
bool myAmClosed
state for dynamic lane closings
Definition: GUILane.h:346
GUILane::getPendingEmits
double getPendingEmits() const
get number of vehicles waiting for departure on this lane
Definition: GUILane.cpp:1344
Position.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
MSLane::myEdge
MSEdge *const myEdge
The lane's edge, for routing only.
Definition: MSLane.h:1333
MSLane::getShape
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:478
GUILane::releaseVehicles
void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: GUILane.cpp:134
GUILane::removeParking
void removeParking(MSVehicle *veh)
remove parking vehicle
Definition: GUILane.cpp:167
FunctionBinding.h
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:168
GUIMainWindow
Definition: GUIMainWindow.h:47
Position::y
double y() const
Returns the y-position.
Definition: Position.h:62
MSLane::myIndex
int myIndex
The lane index.
Definition: MSLane.h:1273
GUIEdge
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:53
GUIVisualizationSettings::showLaneDirection
bool showLaneDirection
Whether to show direction indicators for lanes.
Definition: GUIVisualizationSettings.h:471
RGBColor::blue
unsigned char blue() const
Returns the blue-amount of the color.
Definition: RGBColor.h:76
MID_CLOSE_LANE
close lane
Definition: GUIAppEnum.h:542
GUIVisualizationSettings::showLane2Lane
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
Definition: GUIVisualizationSettings.h:563
LINKSTATE_TL_YELLOW_MAJOR
The link has yellow light, may pass.
Definition: SUMOXMLDefinitions.h:1142
PositionVector::reverse
PositionVector reverse() const
reverse position vector
Definition: PositionVector.cpp:1069
GLHelper::drawBoxLine
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:136
GUILane::myLock
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUILane.h:350
MSLane::integrateNewVehicles
virtual void integrateNewVehicles()
Insert buffered vehicle into the real lane.
Definition: MSLane.cpp:1929
GUILane::getVehiclesSecure
const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: GUILane.cpp:127
MSLane::myPermissions
SVCPermissions myPermissions
The vClass permissions for this lane.
Definition: MSLane.h:1339
GUILane::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUILane.cpp:821
MSLane::myLength
double myLength
Lane length [m].
Definition: MSLane.h:1322
GUIEdge.h
GUILane::planMovements
void planMovements(const SUMOTime t)
Definition: GUILane.cpp:140
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:249
GUILane::myShapeColors
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GUILane.h:330
gSelected
GUISelectedStorage gSelected
A global holder of selected objects.
Definition: GUIGlobalSelection.cpp:34
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:217
GUIGlObject::buildPositionCopyEntry
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
Definition: GUIGlObject.cpp:267
PositionVector::getCentroid
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
Definition: PositionVector.cpp:406
MSEdge::getLanes
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:165
GUIVisualizationTextSettings::size
double size
text size
Definition: GUIVisualizationSettings.h:72
MSLane::removeParking
virtual void removeParking(MSVehicle *veh)
remove parking vehicle. This must be syncrhonized when running with GUI
Definition: MSLane.cpp:3012
MSLane::getWidth
double getWidth() const
Returns the lane's width.
Definition: MSLane.h:557
GUINet::getLinkTLIndex
int getLinkTLIndex(MSLink *link) const
Definition: GUINet.cpp:204
MSJunction::getShape
const PositionVector & getShape() const
Returns this junction's shape.
Definition: MSJunction.h:90
MSLane::myParkingVehicles
std::set< const MSVehicle * > myParkingVehicles
Definition: MSLane.h:1319
config.h
GUILane::getColorValue
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUILane.cpp:1049
MSLane::isInternal
bool isInternal() const
Definition: MSLane.cpp:1999
GUIVisualizationSettings::laneColorer
GUIColorer laneColorer
The lane colorer.
Definition: GUIVisualizationSettings.h:438
GeomHelper.h
GLO_JUNCTION
a junction
Definition: GUIGlObjectTypes.h:51
GUIVisualizationSettings::showLinkRules
bool showLinkRules
Information whether link rules (colored bars) shall be drawn.
Definition: GUIVisualizationSettings.h:453
GUILane::~GUILane
~GUILane()
Destructor.
Definition: GUILane.cpp:107
GUIVisualizationSettings::spreadSuperposed
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
Definition: GUIVisualizationSettings.h:477
StdDefs.h
Boundary::grow
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:301
MSLane::geometryPositionAtOffset
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:505
SUMO_const_laneMarkWidth
const double SUMO_const_laneMarkWidth
Definition: StdDefs.h:56
MELoop.h
LINKSTATE_TL_RED
The link has red light (must brake)
Definition: SUMOXMLDefinitions.h:1138
GUILane::drawArrows
void drawArrows() const
Definition: GUILane.cpp:390
GUILane::getScaleValue
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUILane.cpp:1193
GUIVisualizationSettings::drawJunctionShape
bool drawJunctionShape
whether the shape of the junction should be drawn
Definition: GUIVisualizationSettings.h:565
MSLane.h
MELoop::numSegmentsFor
static int numSegmentsFor(const double length, const double slength)
Compute number of segments per edge (best value stay close to the configured segment length)
Definition: MELoop.cpp:254
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
FunctionBinding
Definition: FunctionBinding.h:41
MSLane::myPermissionChanges
std::map< long long, SVCPermissions > myPermissionChanges
Definition: MSLane.h:1409
MSLane::getSpeedLimit
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
Definition: MSLane.h:533
GUINet
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:83
MSEdge::getPermissions
SVCPermissions getPermissions() const
Definition: MSEdge.h:546
MSLane::getFuelConsumption
double getFuelConsumption() const
Returns the sum of last step fuel consumption.
Definition: MSLane.cpp:2785
MSLane::setPartialOccupation
virtual double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
Definition: MSLane.cpp:268
GUILane::drawLane2LaneConnections
void drawLane2LaneConnections(double exaggeration) const
Definition: GUILane.cpp:457
LINKDIR_PARTLEFT
The link is a partial left direction.
Definition: SUMOXMLDefinitions.h:1183
MSVehicleControl.h
GUILane::swapAfterLaneChange
void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: GUILane.cpp:174
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:77
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:89
POSITION_EPS
#define POSITION_EPS
Definition: config.h:169
MSVehicleTransfer.h
GUIPropertyScheme::getColor
const T getColor(const double value) const
Definition: GUIPropertyScheme.h:111
MSLane::getIndex
int getIndex() const
Returns the lane's index.
Definition: MSLane.h:564
MSLane::myVehicles
VehCont myVehicles
The lane's vehicles. This container holds all vehicles that have their front (longitudinally) and the...
Definition: MSLane.h:1286
MSLane::myMaxSpeed
double myMaxSpeed
Lane-wide speedlimit [m/s].
Definition: MSLane.h:1336
GUIVisualizationSettings::edgeData
std::string edgeData
key for coloring by edgeData
Definition: GUIVisualizationSettings.h:483
GUIPropertySchemeStorage::getActive
int getActive() const
Definition: GUIPropertySchemeStorage.h:76
GUIVisualizationSizeSettings::getExaggeration
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
Definition: GUIVisualizationSettings.cpp:212
PositionVector::move2side
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
Definition: PositionVector.cpp:1086
GUILane::drawLinkRule
void drawLinkRule(const GUIVisualizationSettings &s, const GUINet &net, MSLink *link, const PositionVector &shape, double x1, double x2) const
Definition: GUILane.cpp:329
MSLane::resetPermissions
void resetPermissions(long long transientID)
Definition: MSLane.cpp:3623
MSEdge::rebuildAllowedLanes
void rebuildAllowedLanes()
Definition: MSEdge.cpp:268
GLHelper::drawTextAtEnd
static void drawTextAtEnd(const std::string &text, const PositionVector &shape, double x, double size, RGBColor color)
draw text and the end of shape
Definition: GLHelper.cpp:750
GUIVisualizationSizeSettings::exaggeration
double exaggeration
The size exaggeration (upscale)
Definition: GUIVisualizationSettings.h:107
GUIPropertySchemeStorage< GUIColorScheme >
GUIVisualizationSettings::drawForSelecting
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
Definition: GUIVisualizationSettings.h:635
MSEdge::getPredecessors
const MSEdgeVector & getPredecessors() const
Definition: MSEdge.h:352
GUISelectedStorage::isSelected
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
Definition: GUISelectedStorage.cpp:95
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
GLHelper::drawTriangleAtEnd
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth)
Draws a triangle at the end of the given line.
Definition: GLHelper.cpp:440