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 /****************************************************************************/
16 // Representation of a lane in the micro simulation (gui-version)
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <string>
26 #include <utility>
27 #include <fx.h>
28 #include <utils/geom/GeomHelper.h>
29 #include <utils/geom/Position.h>
33 #include <utils/common/StdDefs.h>
34 #include <utils/geom/GeomHelper.h>
35 #include <utils/gui/div/GLHelper.h>
41 #include <microsim/MSGlobals.h>
42 #include <microsim/MSLane.h>
46 #include <microsim/MSNet.h>
49 #include <mesosim/MELoop.h>
50 #include <mesosim/MESegment.h>
51 #include "GUILane.h"
52 #include "GUIEdge.h"
53 #include "GUIVehicle.h"
54 #include "GUINet.h"
55 
56 #ifdef HAVE_OSG
57 #include <osg/Geometry>
58 #endif
59 
60 //#define GUILane_DEBUG_DRAW_WALKING_AREA_VERTICES
61 //#define GUILane_DEBUG_DRAW_VERTICES
62 //#define GUILane_DEBUG_DRAW_FOE_INTERSECTIONS
63 
64 // ===========================================================================
65 // static member declaration
66 // ===========================================================================
67 const RGBColor GUILane::MESO_USE_LANE_COLOR(0, 0, 0, 0);
68 
69 
70 // ===========================================================================
71 // method definitions
72 // ===========================================================================
73 GUILane::GUILane(const std::string& id, double maxSpeed, double length,
74  MSEdge* const edge, int numericalID,
75  const PositionVector& shape, double width,
76  SVCPermissions permissions, int index, bool isRampAccel,
77  const std::string& type) :
78  MSLane(id, maxSpeed, length, edge, numericalID, shape, width, permissions, index, isRampAccel, type),
79  GUIGlObject(GLO_LANE, id),
80 #ifdef HAVE_OSG
81  myGeom(0),
82 #endif
83  myAmClosed(false),
84  myLock(true) {
86  myShape = splitAtSegments(shape);
87  assert(fabs(myShape.length() - shape.length()) < POSITION_EPS);
88  assert(myShapeSegments.size() == myShape.size());
89  }
90  myShapeRotations.reserve(myShape.size() - 1);
91  myShapeLengths.reserve(myShape.size() - 1);
92  myShapeColors.reserve(myShape.size() - 1);
93  int e = (int) myShape.size() - 1;
94  for (int i = 0; i < e; ++i) {
95  const Position& f = myShape[i];
96  const Position& s = myShape[i + 1];
97  myShapeLengths.push_back(f.distanceTo2D(s));
98  myShapeRotations.push_back(RAD2DEG(atan2(s.x() - f.x(), f.y() - s.y())));
99  }
100  //
101  myHalfLaneWidth = myWidth / 2.;
103 }
104 
105 
107  // just to quit cleanly on a failure
108  if (myLock.locked()) {
109  myLock.unlock();
110  }
111 }
112 
113 
114 // ------ Vehicle insertion ------
115 void
116 GUILane::incorporateVehicle(MSVehicle* veh, double pos, double speed, double posLat,
117  const MSLane::VehCont::iterator& at,
118  MSMoveReminder::Notification notification) {
119  FXMutexLock locker(myLock);
120  MSLane::incorporateVehicle(veh, pos, speed, posLat, at, notification);
121 }
122 
123 
124 // ------ Access to vehicles ------
125 const MSLane::VehCont&
127  myLock.lock();
128  return myVehicles;
129 }
130 
131 
132 void
134  myLock.unlock();
135 }
136 
137 
138 void
140  FXMutexLock locker(myLock);
142 }
143 
144 void
146  FXMutexLock locker(myLock);
148 }
149 
150 
151 void
153  FXMutexLock locker(myLock);
155 }
156 
157 
158 MSVehicle*
159 GUILane::removeVehicle(MSVehicle* remVehicle, MSMoveReminder::Notification notification, bool notify) {
160  FXMutexLock locker(myLock);
161  return MSLane::removeVehicle(remVehicle, notification, notify);
162 }
163 
164 
165 void
167  FXMutexLock locker(myLock);
168  return MSLane::removeParking(remVehicle);
169 }
170 
171 
172 void
174  FXMutexLock locker(myLock);
176 }
177 
178 
179 void
181  FXMutexLock locker(myLock);
183 }
184 
185 
186 void
187 GUILane::detectCollisions(SUMOTime timestep, const std::string& stage) {
188  FXMutexLock locker(myLock);
189  MSLane::detectCollisions(timestep, stage);
190 }
191 
192 
193 double
195  FXMutexLock locker(myLock);
197 }
198 
199 
200 void
202  FXMutexLock locker(myLock);
204 }
205 
206 
207 // ------ Drawing methods ------
208 void
210  int noLinks = (int)myLinks.size();
211  if (noLinks == 0) {
212  return;
213  }
214  // draw all links
215  if (getEdge().isCrossing()) {
216  // draw indices at the start and end of the crossing
218  PositionVector shape = getShape();
219  shape.extrapolate(0.5); // draw on top of the walking area
222  return;
223  }
224  // draw all links
225  double w = myWidth / (double) noLinks;
226  double x1 = myHalfLaneWidth;
227  const bool lefthand = MSNet::getInstance()->lefthand();
228  for (int i = noLinks; --i >= 0;) {
229  double x2 = x1 - (double)(w / 2.);
231  x1 -= w;
232  }
233 }
234 
235 
236 void
238  int noLinks = (int)myLinks.size();
239  if (noLinks == 0) {
240  return;
241  }
242  if (getEdge().isCrossing()) {
243  // draw indices at the start and end of the crossing
245  int linkNo = net.getLinkTLIndex(link);
246  // maybe the reverse link is controlled separately
247  int linkNo2 = net.getLinkTLIndex(myLinks.front());
248  // otherwise, use the same index as the forward link
249  if (linkNo2 < 0) {
250  linkNo2 = linkNo;
251  }
252  if (linkNo >= 0) {
253  PositionVector shape = getShape();
254  shape.extrapolate(0.5); // draw on top of the walking area
257  }
258  return;
259  }
260  // draw all links
261  double w = myWidth / (double) noLinks;
262  double x1 = myHalfLaneWidth;
263  const bool lefthand = MSNet::getInstance()->lefthand();
264  for (int i = noLinks; --i >= 0;) {
265  double x2 = x1 - (double)(w / 2.);
266  int linkNo = net.getLinkTLIndex(myLinks[lefthand ? noLinks - 1 - i : i]);
267  if (linkNo < 0) {
268  continue;
269  }
271  x1 -= w;
272  }
273 }
274 
275 
276 void
278  int noLinks = (int)myLinks.size();
279  if (noLinks == 0) {
280  drawLinkRule(s, net, nullptr, getShape(), 0, 0);
281  return;
282  }
283  if (getEdge().isCrossing()) {
284  // draw rules at the start and end of the crossing
286  MSLink* link2 = myLinks.front();
287  if (link2->getTLLogic() == nullptr) {
288  link2 = link;
289  }
290  PositionVector shape = getShape();
291  shape.extrapolate(0.5); // draw on top of the walking area
292  drawLinkRule(s, net, link2, shape, 0, myWidth);
293  drawLinkRule(s, net, link, shape.reverse(), 0, myWidth);
294  return;
295  }
296  // draw all links
297  const double w = myWidth / (double) noLinks;
298  double x1 = myEdge->getToJunction()->getType() == NODETYPE_RAIL_SIGNAL ? -myWidth * 0.5 : 0;
299  const bool lefthand = MSNet::getInstance()->lefthand();
300  for (int i = 0; i < noLinks; ++i) {
301  double x2 = x1 + w;
302  drawLinkRule(s, net, myLinks[lefthand ? noLinks - 1 - i : i], getShape(), x1, x2);
303  x1 = x2;
304  }
305  // draw stopOffset for passenger cars
306  if (myStopOffsets.size() != 0 && (myStopOffsets.begin()->first & SVC_PASSENGER) != 0) {
307  const double stopOffsetPassenger = myStopOffsets.begin()->second;
308  const Position& end = myShape.back();
309  const Position& f = myShape[-2];
310  const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
312  glPushMatrix();
313  glTranslated(end.x(), end.y(), 0);
314  glRotated(rot, 0, 0, 1);
315  glTranslated(0, stopOffsetPassenger, 0);
316  glBegin(GL_QUADS);
317  glVertex2d(-myHalfLaneWidth, 0.0);
318  glVertex2d(-myHalfLaneWidth, 0.2);
319  glVertex2d(myHalfLaneWidth, 0.2);
320  glVertex2d(myHalfLaneWidth, 0.0);
321  glEnd();
322  glPopMatrix();
323  }
324 }
325 
326 
327 void
328 GUILane::drawLinkRule(const GUIVisualizationSettings& s, const GUINet& net, MSLink* link, const PositionVector& shape, double x1, double x2) const {
329  const Position& end = shape.back();
330  const Position& f = shape[-2];
331  const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
332  if (link == nullptr) {
334  glPushMatrix();
335  glTranslated(end.x(), end.y(), 0);
336  glRotated(rot, 0, 0, 1);
337  glBegin(GL_QUADS);
338  glVertex2d(-myHalfLaneWidth, 0.0);
339  glVertex2d(-myHalfLaneWidth, 0.5);
340  glVertex2d(myHalfLaneWidth, 0.5);
341  glVertex2d(myHalfLaneWidth, 0.0);
342  glEnd();
343  glPopMatrix();
344  } else {
345  glPushMatrix();
346  glTranslated(end.x(), end.y(), 0);
347  glRotated(rot, 0, 0, 1);
348  // select glID
349  switch (link->getState()) {
352  case LINKSTATE_TL_RED:
358  glPushName(net.getLinkTLID(link));
359  break;
360  case LINKSTATE_MAJOR:
361  case LINKSTATE_MINOR:
362  case LINKSTATE_EQUAL:
363  default:
364  glPushName(getGlID());
365  break;
366  }
368  if (!(drawAsRailway(s) || drawAsWaterway(s)) || link->getState() != LINKSTATE_MAJOR) {
369  // the white bar should be the default for most railway
370  // links and looks ugly so we do not draw it
371  double scale = isInternal() ? 0.5 : 1;
373  scale *= MAX2(s.laneWidthExaggeration, s.junctionSize.getExaggeration(s, this, 10));
374  }
375  glScaled(scale, scale, 1);
376  glBegin(GL_QUADS);
377  glVertex2d(x1 - myHalfLaneWidth, 0.0);
378  glVertex2d(x1 - myHalfLaneWidth, 0.5);
379  glVertex2d(x2 - myHalfLaneWidth, 0.5);
380  glVertex2d(x2 - myHalfLaneWidth, 0.0);
381  glEnd();
382  }
383  glPopName();
384  glPopMatrix();
385  }
386 }
387 
388 void
390  if (myLinks.size() == 0) {
391  return;
392  }
393  // draw all links
394  const Position& end = getShape().back();
395  const Position& f = getShape()[-2];
396  const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
397  glPushMatrix();
398  glColor3d(1, 1, 1);
399  glTranslated(end.x(), end.y(), 0);
400  glRotated(rot, 0, 0, 1);
402  glScaled(myWidth / SUMO_const_laneWidth, 1, 1);
403  }
404  for (std::vector<MSLink*>::const_iterator i = myLinks.begin(); i != myLinks.end(); ++i) {
405  LinkDirection dir = (*i)->getDirection();
406  LinkState state = (*i)->getState();
407  if (state == LINKSTATE_DEADEND || dir == LINKDIR_NODIR) {
408  continue;
409  }
410  switch (dir) {
411  case LINKDIR_STRAIGHT:
412  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
413  GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25);
414  break;
415  case LINKDIR_TURN:
416  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
417  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
418  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
419  GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25);
420  break;
422  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
423  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
424  GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
425  GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25);
426  break;
427  case LINKDIR_LEFT:
428  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
429  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
430  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25);
431  break;
432  case LINKDIR_RIGHT:
433  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
434  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
435  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25);
436  break;
437  case LINKDIR_PARTLEFT:
438  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
439  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
440  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25);
441  break;
442  case LINKDIR_PARTRIGHT:
443  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
444  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
445  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25);
446  break;
447  default:
448  break;
449  }
450  }
451  glPopMatrix();
452 }
453 
454 
455 void
456 GUILane::drawLane2LaneConnections(double exaggeration) const {
457  Position centroid;
458  if (exaggeration > 1) {
459  centroid = myEdge->getToJunction()->getShape().getCentroid();
460  }
461  for (std::vector<MSLink*>::const_iterator i = myLinks.begin(); i != myLinks.end(); ++i) {
462  const MSLane* connected = (*i)->getLane();
463  if (connected == nullptr) {
464  continue;
465  }
467  glBegin(GL_LINES);
469  Position p2 = connected->getEdge().isWalkingArea() ? connected->getShape().getCentroid() : connected->getShape()[0];
470  if (exaggeration > 1) {
471  p1 = centroid + ((p1 - centroid) * exaggeration);
472  p2 = centroid + ((p2 - centroid) * exaggeration);
473  }
474  glVertex2d(p1.x(), p1.y());
475  glVertex2d(p2.x(), p2.y());
476  glEnd();
477  GLHelper::drawTriangleAtEnd(p1, p2, (double) .4, (double) .2);
478  }
479 }
480 
481 
482 void
484  glPushMatrix();
485  glPushName(getGlID());
486  const bool isCrossing = myEdge->isCrossing();
487  const bool isWalkingArea = myEdge->isWalkingArea();
488  const bool isInternal = isCrossing || isWalkingArea || myEdge->isInternal();
489  bool mustDrawMarkings = false;
490  double exaggeration = s.laneWidthExaggeration;
492  GUIEdge* myGUIEdge = dynamic_cast<GUIEdge*>(myEdge);
493  exaggeration *= s.edgeScaler.getScheme().getColor(myGUIEdge->getScaleValue(s.edgeScaler.getActive()));
494  } else {
496  }
497  const bool hasRailSignal = myEdge->getToJunction()->getType() == NODETYPE_RAIL_SIGNAL;
498  const bool detailZoom = s.scale * exaggeration > 5;
499  const bool drawDetails = (detailZoom || s.junctionSize.minSize == 0 || hasRailSignal) && !s.drawForRectangleSelection;
500  const bool drawRails = drawAsRailway(s);
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 && drawRails;
547  if (hiddenBidi && !spreadSuperposed) {
548  // do not draw shape
549  } else if (drawRails) {
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.drawForRectangleSelection);
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.drawForRectangleSelection || 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 (drawRails) {
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 && (myPermissions & ~(SVC_PEDESTRIAN | SVC_RAIL_CLASSES)) != 0) {
637  // draw sublane-borders
638  const double offsetSign = MSNet::getInstance()->lefthand() ? -1 : 1;
640  for (double offset = -myHalfLaneWidth; offset < myHalfLaneWidth; offset += MSGlobals::gLateralResolution) {
641  GLHelper::drawBoxLines(myShape, myShapeRotations, myShapeLengths, 0.01, 0, -offset * offsetSign);
642  }
643  }
644  if (s.showLinkDecals && !drawRails && !drawAsWaterway(s) && myPermissions != SVC_PEDESTRIAN) {
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.drawForRectangleSelection)
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  new FXMenuSeparator(ret);
851  // reachability menu
852  FXMenuPane* reachableByClass = new FXMenuPane(ret);
853  ret->insertMenuPaneChild(reachableByClass);
854  new FXMenuCascade(ret, "Select reachable", GUIIconSubSys::getIcon(ICON_FLAG), reachableByClass);
855  for (auto i : SumoVehicleClassStrings.getStrings()) {
856  new FXMenuCommand(reachableByClass, i.c_str(), nullptr, &parent, MID_REACHABILITY);
857  }
858  return ret;
859 }
860 
861 
864  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, 19 + (int)myEdge->getParametersMap().size());
865  // add items
866  ret->mkItem("maxspeed [m/s]", false, getSpeedLimit());
867  ret->mkItem("length [m]", false, myLength);
868  ret->mkItem("width [m]", false, myWidth);
869  ret->mkItem("street name", false, myEdge->getStreetName());
870  ret->mkItem("stored traveltime [s]", true, new FunctionBinding<GUILane, double>(this, &GUILane::getStoredEdgeTravelTime));
871  ret->mkItem("loaded weight", true, new FunctionBinding<GUILane, double>(this, &GUILane::getLoadedEdgeWeight));
872  ret->mkItem("routing speed [m/s]", true, new FunctionBinding<MSEdge, double>(myEdge, &MSEdge::getRoutingSpeed));
873  ret->mkItem("brutto occupancy [%]", true, new FunctionBinding<GUILane, double>(this, &GUILane::getBruttoOccupancy, 100.));
874  ret->mkItem("netto occupancy [%]", true, new FunctionBinding<GUILane, double>(this, &GUILane::getNettoOccupancy, 100.));
875  ret->mkItem("pending insertions [#]", true, new FunctionBinding<GUILane, double>(this, &GUILane::getPendingEmits));
876  ret->mkItem("edge type", false, myEdge->getEdgeType());
877  ret->mkItem("type", false, myLaneType);
878  ret->mkItem("priority", false, myEdge->getPriority());
879  ret->mkItem("distance [km]", false, myEdge->getDistance() / 1000);
880  ret->mkItem("allowed vehicle class", false, getVehicleClassNames(myPermissions));
881  ret->mkItem("disallowed vehicle class", false, getVehicleClassNames(~myPermissions));
882  ret->mkItem("permission code", false, myPermissions);
883  if (myEdge->getBidiEdge() != nullptr) {
884  ret->mkItem("bidi-edge", false, myEdge->getBidiEdge()->getID());
885  }
886  for (const auto& kv : myEdge->getParametersMap()) {
887  ret->mkItem(("edgeParam:" + kv.first).c_str(), false, kv.second);
888  }
889  ret->closeBuilding();
890  return ret;
891 }
892 
893 
894 Boundary
896  Boundary b;
897  b.add(myShape[0]);
898  b.add(myShape[-1]);
899  b.grow(10);
900  // ensure that vehicles and persons on the side are drawn even if the edge
901  // is outside the view
902  return b;
903 }
904 
905 
906 const PositionVector&
908  return myShape;
909 }
910 
911 
912 const std::vector<double>&
914  return myShapeRotations;
915 }
916 
917 
918 const std::vector<double>&
920  return myShapeLengths;
921 }
922 
923 
924 double
926  return myVehicles.size() == 0 ? 0 : myVehicles.back()->getWaitingSeconds();
927 }
928 
929 
930 double
932  return (double) myEdge->getLanes().size();
933 }
934 
935 
936 double
939  if (!ews.knowsTravelTime(myEdge)) {
940  return -1;
941  } else {
942  double value(0);
943  ews.retrieveExistingTravelTime(myEdge, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value);
944  return value;
945  }
946 }
947 
948 
949 double
952  if (!ews.knowsEffort(myEdge)) {
953  return -1;
954  } else {
955  double value(-1);
956  ews.retrieveExistingEffort(myEdge, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()), value);
957  return value;
958  }
959 }
960 
961 
962 RGBColor
964  // setting and retrieving the color does not work in OSGView so we return it explicitliy
965  RGBColor col;
966  if (MSGlobals::gUseMesoSim && static_cast<const GUIEdge*>(myEdge)->getMesoColor() != MESO_USE_LANE_COLOR) {
967  col = static_cast<const GUIEdge*>(myEdge)->getMesoColor();
968  } else {
969  const GUIColorer& c = s.laneColorer;
970  if (!setFunctionalColor(c, col) && !setMultiColor(s, c, col)) {
971  col = c.getScheme().getColor(getColorValue(s, c.getActive()));
972  }
973  }
974  GLHelper::setColor(col);
975  return col;
976 }
977 
978 
979 bool
980 GUILane::setFunctionalColor(const GUIColorer& c, RGBColor& col, int activeScheme) const {
981  if (activeScheme < 0) {
982  activeScheme = c.getActive();
983  }
984  switch (activeScheme) {
985  case 0:
986  if (myEdge->isCrossing()) {
987  // determine priority to decide color
989  if (link->havePriority() || link->getTLLogic() != nullptr) {
990  col = RGBColor(230, 230, 230);
991  } else {
992  col = RGBColor(26, 26, 26);
993  }
994  GLHelper::setColor(col);
995  return true;
996  } else {
997  return false;
998  }
999  case 18: {
1000  double hue = GeomHelper::naviDegree(myShape.beginEndAngle()); // [0-360]
1001  col = RGBColor::fromHSV(hue, 1., 1.);
1002  GLHelper::setColor(col);
1003  return true;
1004  }
1005  case 30: { // taz color
1006  col = c.getScheme().getColor(0);
1007  std::vector<RGBColor> tazColors;
1008  for (MSEdge* e : myEdge->getPredecessors()) {
1009  if (e->isTazConnector() && e->knowsParameter("tazColor")) {
1010  tazColors.push_back(RGBColor::parseColor(e->getParameter("tazColor")));
1011  }
1012  }
1013  for (MSEdge* e : myEdge->getSuccessors()) {
1014  if (e->isTazConnector() && e->knowsParameter("tazColor")) {
1015  tazColors.push_back(RGBColor::parseColor(e->getParameter("tazColor")));
1016  }
1017  }
1018  if (tazColors.size() > 0) {
1019  int randColor = RandHelper::rand((int)tazColors.size(), RGBColor::getColorRNG());
1020  col = tazColors[randColor];
1021  }
1022  GLHelper::setColor(col);
1023  return true;
1024  }
1025  default:
1026  return false;
1027  }
1028 }
1029 
1030 
1031 bool
1033  const int activeScheme = c.getActive();
1034  myShapeColors.clear();
1035  switch (activeScheme) {
1036  case 22: // color by height at segment start
1037  for (PositionVector::const_iterator ii = myShape.begin(); ii != myShape.end() - 1; ++ii) {
1038  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
1039  }
1040  // osg fallback (edge height at start)
1041  col = c.getScheme().getColor(getColorValue(s, 21));
1042  return true;
1043  case 24: // color by inclination at segment start
1044  for (int ii = 1; ii < (int)myShape.size(); ++ii) {
1045  const double inc = (myShape[ii].z() - myShape[ii - 1].z()) / MAX2(POSITION_EPS, myShape[ii].distanceTo2D(myShape[ii - 1]));
1046  myShapeColors.push_back(c.getScheme().getColor(inc));
1047  }
1048  col = c.getScheme().getColor(getColorValue(s, 23));
1049  return true;
1050  default:
1051  return false;
1052  }
1053 }
1054 
1055 
1056 double
1057 GUILane::getColorValue(const GUIVisualizationSettings& s, int activeScheme) const {
1058  switch (activeScheme) {
1059  case 0:
1060  switch (myPermissions) {
1061  case SVC_PEDESTRIAN:
1062  return 1;
1063  case SVC_BICYCLE:
1064  return 2;
1065  case 0:
1066  // forbidden road or green verge
1067  return myEdge->getPermissions() == 0 ? 9 : 3;
1068  case SVC_SHIP:
1069  return 4;
1070  case SVC_AUTHORITY:
1071  return 7;
1072  default:
1073  break;
1074  }
1075  if (myEdge->isTazConnector()) {
1076  return 8;
1077  } else if (isRailway(myPermissions)) {
1078  return 5;
1079  } else if ((myPermissions & SVC_PASSENGER) != 0) {
1080  return 0;
1081  } else {
1082  return 6;
1083  }
1084  case 1:
1085  return isLaneOrEdgeSelected();
1086  case 2:
1087  return (double)myPermissions;
1088  case 3:
1089  return getSpeedLimit();
1090  case 4:
1091  return getBruttoOccupancy();
1092  case 5:
1093  return getNettoOccupancy();
1094  case 6:
1095  return firstWaitingTime();
1096  case 7:
1097  return getEdgeLaneNumber();
1098  case 8:
1099  return getCO2Emissions() / myLength;
1100  case 9:
1101  return getCOEmissions() / myLength;
1102  case 10:
1103  return getPMxEmissions() / myLength;
1104  case 11:
1105  return getNOxEmissions() / myLength;
1106  case 12:
1107  return getHCEmissions() / myLength;
1108  case 13:
1109  return getFuelConsumption() / myLength;
1110  case 14:
1112  case 15: {
1113  return getStoredEdgeTravelTime();
1114  }
1115  case 16: {
1117  if (!ews.knowsTravelTime(myEdge)) {
1118  return -1;
1119  } else {
1120  double value(0);
1121  ews.retrieveExistingTravelTime(myEdge, 0, value);
1122  return 100 * myLength / value / getSpeedLimit();
1123  }
1124  }
1125  case 17: {
1126  // geometrical length has no meaning for walkingAreas since it describes the outer boundary
1127  return myEdge->isWalkingArea() ? 1 : 1 / myLengthGeometryFactor;
1128  }
1129  case 19: {
1130  return getLoadedEdgeWeight();
1131  }
1132  case 20: {
1133  return myEdge->getPriority();
1134  }
1135  case 21: {
1136  // color by z of first shape point
1137  return getShape()[0].z();
1138  }
1139  case 23: {
1140  // color by incline
1141  return (getShape()[-1].z() - getShape()[0].z()) / getLength();
1142  }
1143  case 25: {
1144  // color by average speed
1145  return getMeanSpeed();
1146  }
1147  case 26: {
1148  // color by average relative speed
1149  return getMeanSpeed() / myMaxSpeed;
1150  }
1151  case 27: {
1152  // color by routing device assumed speed
1153  return myEdge->getRoutingSpeed();
1154  }
1155  case 28:
1157  case 29:
1158  return getPendingEmits();
1159  case 31: {
1160  // by numerical edge param value
1161  try {
1163  } catch (NumberFormatException&) {
1164  try {
1166  } catch (BoolFormatException&) {
1167  return -1;
1168  }
1169  }
1170  }
1171  case 32: {
1172  // by numerical lane param value
1173  try {
1175  } catch (NumberFormatException&) {
1176  try {
1177  return StringUtils::toBool(getParameter(s.laneParam, "0"));
1178  } catch (BoolFormatException&) {
1179  return -1;
1180  }
1181  }
1182  }
1183  case 33: {
1184  // by edge data value
1186  }
1187  case 34: {
1188  return myEdge->getDistance();
1189  }
1190  case 35: {
1191  return fabs(myEdge->getDistance());
1192  }
1193  case 36: {
1194  return myReachability;
1195  }
1196  case 37: {
1198  }
1199  }
1200  return 0;
1201 }
1202 
1203 
1204 double
1205 GUILane::getScaleValue(int activeScheme) const {
1206  switch (activeScheme) {
1207  case 0:
1208  return 0;
1209  case 1:
1210  return isLaneOrEdgeSelected();
1211  case 2:
1212  return getSpeedLimit();
1213  case 3:
1214  return getBruttoOccupancy();
1215  case 4:
1216  return getNettoOccupancy();
1217  case 5:
1218  return firstWaitingTime();
1219  case 6:
1220  return getEdgeLaneNumber();
1221  case 7:
1222  return getCO2Emissions() / myLength;
1223  case 8:
1224  return getCOEmissions() / myLength;
1225  case 9:
1226  return getPMxEmissions() / myLength;
1227  case 10:
1228  return getNOxEmissions() / myLength;
1229  case 11:
1230  return getHCEmissions() / myLength;
1231  case 12:
1232  return getFuelConsumption() / myLength;
1233  case 13:
1235  case 14: {
1236  return getStoredEdgeTravelTime();
1237  }
1238  case 15: {
1240  if (!ews.knowsTravelTime(myEdge)) {
1241  return -1;
1242  } else {
1243  double value(0);
1244  ews.retrieveExistingTravelTime(myEdge, 0, value);
1245  return 100 * myLength / value / getSpeedLimit();
1246  }
1247  }
1248  case 16: {
1249  return 1 / myLengthGeometryFactor;
1250  }
1251  case 17: {
1252  return getLoadedEdgeWeight();
1253  }
1254  case 18: {
1255  return myEdge->getPriority();
1256  }
1257  case 19: {
1258  // scale by average speed
1259  return getMeanSpeed();
1260  }
1261  case 20: {
1262  // scale by average relative speed
1263  return getMeanSpeed() / myMaxSpeed;
1264  }
1265  case 21:
1267  case 22:
1269  }
1270  return 0;
1271 }
1272 
1273 
1274 bool
1277 }
1278 
1279 
1280 bool
1282  return isWaterway(myPermissions) && s.showRails && !s.drawForRectangleSelection; // reusing the showRails setting
1283 }
1284 
1285 
1286 #ifdef HAVE_OSG
1287 void
1288 GUILane::updateColor(const GUIVisualizationSettings& s) {
1289  if (myGeom == 0) {
1290  // not drawn
1291  return;
1292  }
1293  const RGBColor col = setColor(s);
1294  osg::Vec4ubArray* colors = dynamic_cast<osg::Vec4ubArray*>(myGeom->getColorArray());
1295  (*colors)[0].set(col.red(), col.green(), col.blue(), col.alpha());
1296  myGeom->setColorArray(colors);
1297 }
1298 #endif
1299 
1300 
1301 void
1302 GUILane::closeTraffic(bool rebuildAllowed) {
1303  MSGlobals::gCheckRoutes = false;
1304  if (myAmClosed) {
1305  myPermissionChanges.clear(); // reset rerouters
1307  } else {
1309  }
1311  if (rebuildAllowed) {
1313  for (MSEdge* const pred : getEdge().getPredecessors()) {
1314  pred->rebuildAllowedTargets();
1315  }
1316  }
1317 }
1318 
1319 
1322  assert(MSGlobals::gUseMesoSim);
1323  int no = MELoop::numSegmentsFor(myLength, OptionsCont::getOptions().getFloat("meso-edgelength"));
1324  const double slength = myLength / no;
1325  PositionVector result = shape;
1326  double offset = 0;
1327  for (int i = 0; i < no; ++i) {
1328  offset += slength;
1329  Position pos = shape.positionAtOffset(offset);
1330  int index = result.indexOfClosest(pos);
1331  if (pos.distanceTo(result[index]) > POSITION_EPS) {
1332  index = result.insertAtClosest(pos, false);
1333  }
1334  while ((int)myShapeSegments.size() < index) {
1335  myShapeSegments.push_back(i);
1336  }
1337  //std::cout << "splitAtSegments " << getID() << " no=" << no << " i=" << i << " offset=" << offset << " index=" << index << " segs=" << toString(myShapeSegments) << " resultSize=" << result.size() << " result=" << toString(result) << "\n";
1338  }
1339  while (myShapeSegments.size() < result.size()) {
1340  myShapeSegments.push_back(no - 1);
1341  }
1342  return result;
1343 }
1344 
1345 bool
1347  return gSelected.isSelected(GLO_LANE, getGlID());
1348 }
1349 
1350 bool
1352  return isSelected() || gSelected.isSelected(GLO_EDGE, dynamic_cast<GUIEdge*>(myEdge)->getGlID());
1353 }
1354 
1355 double
1358 }
1359 
1360 
1361 /****************************************************************************/
RGBColor::alpha
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition: RGBColor.h:82
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:853
GUIGlObject::getType
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.cpp:180
MSEdgeWeightsStorage::knowsEffort
bool knowsEffort(const MSEdge *const e) const
Returns the information whether any effort is known for the given edge.
Definition: MSEdgeWeightsStorage.cpp:119
MSEdge::getEdgeType
const std::string & getEdgeType() const
Returns the type of the edge.
Definition: MSEdge.h:278
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:808
GUILane::detectCollisions
void detectCollisions(SUMOTime timestep, const std::string &stage)
Definition: GUILane.cpp:187
PositionVector::beginEndAngle
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position
Definition: PositionVector.cpp:808
SVC_PEDESTRIAN
pedestrian
Definition: SUMOVehicleClass.h:156
GUILane::splitAtSegments
PositionVector splitAtSegments(const PositionVector &shape)
add intermediate points at segment borders
Definition: GUILane.cpp:1321
MID_CLOSE_EDGE
close edge
Definition: GUIAppEnum.h:561
GUILane::drawTLSLinkNo
void drawTLSLinkNo(const GUIVisualizationSettings &s, const GUINet &net) const
Definition: GUILane.cpp:237
MSLane::myRNGIndex
int myRNGIndex
Definition: MSLane.h:1411
LINKSTATE_EQUAL
This is an uncontrolled, right-before-left link.
Definition: SUMOXMLDefinitions.h:1159
MSLane::getCOEmissions
double getCOEmissions() const
Returns the sum of last step CO emissions.
Definition: MSLane.cpp:2748
MSEdge::getSuccessors
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition: MSEdge.cpp:959
MIN2
T MIN2(T a, T b)
Definition: StdDefs.h:73
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
GUIVisualizationSettings::laneShowBorders
bool laneShowBorders
Information whether lane borders shall be drawn.
Definition: GUIVisualizationSettings.h:446
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:1032
GUIVisualizationSettings::edgeParam
std::string edgeParam
key for coloring by edge parameter
Definition: GUIVisualizationSettings.h:482
MSEdge::getNumericalID
int getNumericalID() const
Returns the numerical id of the edge.
Definition: MSEdge.h:265
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:374
GUIVehicle.h
GUILane::myQuarterLaneWidth
double myQuarterLaneWidth
Quarter of lane width, for speed-up.
Definition: GUILane.h:346
GUIVisualizationSettings::laneMinSize
double laneMinSize
The minimum visual lane width for drawing.
Definition: GUIVisualizationSettings.h:470
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
MSNet.h
MSEdge::getStreetName
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:272
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
GUIVisualizationSettings::junctionSize
GUIVisualizationSizeSettings junctionSize
Definition: GUIVisualizationSettings.h:578
GUIGLObjectPopupMenu::insertMenuPaneChild
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
Definition: GUIGLObjectPopupMenu.cpp:80
LINKSTATE_TL_OFF_BLINKING
The link is controlled by a tls which is off and blinks, has to brake.
Definition: SUMOXMLDefinitions.h:1151
GUIParameterTableWindow.h
GUINet::getLinkTLID
int getLinkTLID(MSLink *link) const
Definition: GUINet.cpp:188
MSLane::resetPartialOccupation
virtual void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
Definition: MSLane.cpp:284
MSLane::setJunctionApproaches
virtual void setJunctionApproaches(const SUMOTime t) const
Register junction approaches for all vehicles after velocities have been planned.
Definition: MSLane.cpp:1213
GUINet::getGUIInstance
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:515
LINKSTATE_TL_OFF_NOSIGNAL
The link is controlled by a tls which is off, not blinking, may pass.
Definition: SUMOXMLDefinitions.h:1153
Position::z
double z() const
Returns the z-position.
Definition: Position.h:66
GUIVisualizationSettings::drawForRectangleSelection
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
Definition: GUIVisualizationSettings.h:647
GUIGlObject::buildSelectionPopupEntry
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
Definition: GUIGlObject.cpp:235
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:1394
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:345
GUILane::myShapeSegments
std::vector< int > myShapeSegments
the meso segment index for each geometry segment
Definition: GUILane.h:340
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 drawForRectangleSelection)
draw crossties for railroads or pedestrian crossings
Definition: GLHelper.cpp:768
MsgHandler.h
GUIVisualizationTextSettings::color
RGBColor color
text color
Definition: GUIVisualizationSettings.h:74
LINKDIR_PARTRIGHT
The link is a partial right direction.
Definition: SUMOXMLDefinitions.h:1190
GUILane::getEdgeLaneNumber
double getEdgeLaneNumber() const
Definition: GUILane.cpp:931
GUILane::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUILane.cpp:863
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:950
MSNet::getInsertionControl
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:389
MSGlobals::gNumSimThreads
static int gNumSimThreads
how many threads to use for simulation
Definition: MSGlobals.h:123
GUILane::drawLinkNo
void drawLinkNo(const GUIVisualizationSettings &s) const
helper methods
Definition: GUILane.cpp:209
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
MSLane::VehCont
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:92
GeomHelper::naviDegree
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:193
GUILane::setFunctionalColor
bool setFunctionalColor(const GUIColorer &c, RGBColor &col, int activeScheme=-1) const
Definition: GUILane.cpp:980
LINKDIR_TURN_LEFTHAND
The link is a 180 degree turn (left-hand network)
Definition: SUMOXMLDefinitions.h:1182
SVC_BICYCLE
vehicle is a bicycle
Definition: SUMOVehicleClass.h:179
MID_REACHABILITY
show reachability from a given lane
Definition: GUIAppEnum.h:446
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
MSLane::getHarmonoise_NoiseEmissions
double getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
Definition: MSLane.cpp:2820
LINKSTATE_TL_GREEN_MINOR
The link has green light, has to brake.
Definition: SUMOXMLDefinitions.h:1141
SUMO_const_laneWidth
const double SUMO_const_laneWidth
Definition: StdDefs.h:49
MSGlobals::gUseMesoSim
static bool gUseMesoSim
Definition: MSGlobals.h:90
MSEdge::getPriority
int getPriority() const
Returns the priority of the edge.
Definition: MSEdge.h:284
RAD2DEG
#define RAD2DEG(x)
Definition: GeomHelper.h:38
PositionVector::extrapolate
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
Definition: PositionVector.cpp:1042
PositionVector::length
double length() const
Returns the length.
Definition: PositionVector.cpp:484
MSLane::getHCEmissions
double getHCEmissions() const
Returns the sum of last step HC emissions.
Definition: MSLane.cpp:2784
RGBColor::red
unsigned char red() const
Returns the red-amount of the color.
Definition: RGBColor.h:61
GLHelper.h
GUILane::isLaneOrEdgeSelected
bool isLaneOrEdgeSelected() const
whether this lane or its parent edge is selected in the GUI
Definition: GUILane.cpp:1351
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:1173
GUIVisualizationSettings::drawLinkJunctionIndex
GUIVisualizationTextSettings drawLinkJunctionIndex
Definition: GUIVisualizationSettings.h:569
GUIEdge::getScaleValue
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:519
GUIVisualizationSettings::vehicleSize
GUIVisualizationSizeSettings vehicleSize
Definition: GUIVisualizationSettings.h:520
GUIVisualizationSettings::showRails
bool showRails
Information whether rails shall be drawn.
Definition: GUIVisualizationSettings.h:458
GUILane::isSelected
bool isSelected() const
whether this lane is selected in the GUI
Definition: GUILane.cpp:1346
MSLane::myShape
PositionVector myShape
The shape of the lane.
Definition: MSLane.h:1269
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:1176
MSInsertionControl.h
LINKSTATE_TL_GREEN_MAJOR
The link has green light, may pass.
Definition: SUMOXMLDefinitions.h:1139
GUINet.h
GUIVisualizationSettings::edgeScaler
GUIScaler edgeScaler
The mesoscopic edge scaler.
Definition: GUIVisualizationSettings.h:434
LINKSTATE_MAJOR
This is an uncontrolled, major link, may pass.
Definition: SUMOXMLDefinitions.h:1155
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:116
PositionVector
A list of positions.
Definition: PositionVector.h:45
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GUIIconSubSys::getIcon
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Definition: GUIIconSubSys.cpp:609
MSLane::myLinks
MSLinkCont myLinks
Definition: MSLane.h:1372
LINKDIR_NODIR
The link has no direction (is a dead end link)
Definition: SUMOXMLDefinitions.h:1192
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:1302
MSLane::getBruttoOccupancy
double getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
Definition: MSLane.cpp:2677
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:621
GUILane::MESO_USE_LANE_COLOR
static const RGBColor MESO_USE_LANE_COLOR
special color to signify alternative coloring scheme
Definition: GUILane.h:363
SVC_AUTHORITY
authorities vehicles
Definition: SUMOVehicleClass.h:145
GUIParameterTableWindow::closeBuilding
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Definition: GUIParameterTableWindow.cpp:219
MSEdgeWeightsStorage
A storage for edge travel times and efforts.
Definition: MSEdgeWeightsStorage.h:43
MSLane::myWidth
const double myWidth
Lane width [m].
Definition: MSLane.h:1324
GUILane::removeVehicle
MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify)
Definition: GUILane.cpp:159
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:72
MSGlobals::gLateralResolution
static double gLateralResolution
Definition: MSGlobals.h:84
SumoVehicleClassStrings
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
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:277
GUILane::resetPartialOccupation
void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
Definition: GUILane.cpp:201
GUILane::executeMovements
void executeMovements(const SUMOTime t)
Definition: GUILane.cpp:152
LINKDIR_RIGHT
The link is a (hard) right direction.
Definition: SUMOXMLDefinitions.h:1186
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
MSEdge::isInternal
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:235
GUISUMOAbstractView.h
GUILane::integrateNewVehicles
void integrateNewVehicles()
Definition: GUILane.cpp:180
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:113
LINKDIR_TURN
The link is a 180 degree turn.
Definition: SUMOXMLDefinitions.h:1180
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:73
GUIVisualizationSettings::drawCrossingsAndWalkingareas
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
Definition: GUIVisualizationSettings.h:576
NumberFormatException
Definition: UtilExceptions.h:95
RGBColor
Definition: RGBColor.h:39
LinkState
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
Definition: SUMOXMLDefinitions.h:1137
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:39
MSLane::getCO2Emissions
double getCO2Emissions() const
Returns the sum of last step CO2 emissions.
Definition: MSLane.cpp:2736
NODETYPE_RAIL_SIGNAL
Definition: SUMOXMLDefinitions.h:1059
Parameterised::getParametersMap
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
Definition: Parameterised.cpp:106
RandHelper::rand
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
Definition: RandHelper.h:53
MSEdge::isCrossing
bool isCrossing() const
return whether this edge is a pedestrian crossing
Definition: MSEdge.h:240
LINKDIR_STRAIGHT
The link is a straight direction.
Definition: SUMOXMLDefinitions.h:1178
SUMO_const_halfLaneWidth
const double SUMO_const_halfLaneWidth
Definition: StdDefs.h:51
MSLane::executeMovements
virtual void executeMovements(const SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
Definition: MSLane.cpp:1714
MSLane::swapAfterLaneChange
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: MSLane.cpp:2169
MSLane::getElectricityConsumption
double getElectricityConsumption() const
Returns the sum of last step electricity consumption.
Definition: MSLane.cpp:2808
GUIVisualizationSettings::showBikeMarkings
bool showBikeMarkings
Information whether bicycle lane marking shall be drawn.
Definition: GUIVisualizationSettings.h:449
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:3630
GUILane::setColor
RGBColor setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUILane.cpp:963
MSLane::interpolateGeometryPosToLanePos
double interpolateGeometryPosToLanePos(double geometryPos) const
Definition: MSLane.h:510
LINKSTATE_TL_YELLOW_MINOR
The link has yellow light, has to brake anyway.
Definition: SUMOXMLDefinitions.h:1149
GUILane::getShape
const PositionVector & getShape() const
Definition: GUILane.cpp:907
MSLane::myStopOffsets
std::map< SVCPermissions, double > myStopOffsets
Definition: MSLane.h:1329
MSLane::myLengthGeometryFactor
const double myLengthGeometryFactor
precomputed myShape.length / myLength
Definition: MSLane.h:1388
MSEdgeWeightsStorage.h
GUIVisualizationSettings::showLinkDecals
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
Definition: GUIVisualizationSettings.h:452
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:218
MID_COPY_EDGE_NAME
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:386
MSNet::getWeightsStorage
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition: MSNet.cpp:832
SVC_RAIL_CLASSES
classes which drive on tracks
Definition: SUMOVehicleClass.h:204
GUIVisualizationSettings::laneWidthExaggeration
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
Definition: GUIVisualizationSettings.h:467
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:225
LINKSTATE_TL_REDYELLOW
The link has red light (must brake) but indicates upcoming green.
Definition: SUMOXMLDefinitions.h:1145
MSEdge::getDistance
double getDistance() const
Returns the kilometrage/mileage at the start of the edge.
Definition: MSEdge.h:290
MSNet::lefthand
bool lefthand() const
return whether the network was built for lefthand traffic
Definition: MSNet.h:663
GUIPropertySchemeStorage::getScheme
T & getScheme()
Definition: GUIPropertySchemeStorage.h:79
GUILane::drawAsRailway
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition: GUILane.cpp:1275
GUIVisualizationSettings::laneScaler
GUIScaler laneScaler
The lane scaler.
Definition: GUIVisualizationSettings.h:443
GUILane.h
Position::distanceTo
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:233
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:108
GUIVisualizationSizeSettings::constantSize
bool constantSize
whether the object shall be drawn with constant size regardless of zoom
Definition: GUIVisualizationSettings.h:109
GUILane::getShapeRotations
const std::vector< double > & getShapeRotations() const
Definition: GUILane.cpp:913
MSEdge::isTazConnector
bool isTazConnector() const
Definition: MSEdge.h:258
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:548
isWaterway
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
Definition: SUMOVehicleClass.cpp:369
RGBColor::parseColor
static RGBColor parseColor(std::string coldef)
Parses a color information.
Definition: RGBColor.cpp:176
RGBColor::getColorRNG
static std::mt19937 * getColorRNG()
Definition: RGBColor.h:112
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:56
SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
Definition: SUMOVehicleClass.h:159
PositionVector::positionAtOffset
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Definition: PositionVector.cpp:248
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:149
GUIVisualizationSettings::showSublanes
bool showSublanes
Whether to show sublane boundaries.
Definition: GUIVisualizationSettings.h:476
MID_ADD_REROUTER
add rerouter
Definition: GUIAppEnum.h:563
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
MSLane::getNOxEmissions
double getNOxEmissions() const
Returns the sum of last step NOx emissions.
Definition: MSLane.cpp:2772
GUILane::drawAsWaterway
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterway
Definition: GUILane.cpp:1281
MSLane::getLength
double getLength() const
Returns the lane's length.
Definition: MSLane.h:540
MSInsertionControl::getPendingEmits
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
Definition: MSInsertionControl.cpp:299
MSLane::CHANGE_PERMISSIONS_GUI
static const long CHANGE_PERMISSIONS_GUI
Definition: MSLane.h:1206
GUILane::setJunctionApproaches
void setJunctionApproaches(const SUMOTime t) const
Definition: GUILane.cpp:145
GUILane::getShapeLengths
const std::vector< double > & getShapeLengths() const
Definition: GUILane.cpp:919
GUIVisualizationSettings::scale
double scale
information about a lane's width (temporary, used for a single view)
Definition: GUIVisualizationSettings.h:632
getVehicleClassNames
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
Definition: SUMOVehicleClass.cpp:168
isRailway
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
Definition: SUMOVehicleClass.cpp:363
MSLane::getMeanSpeed
double getMeanSpeed() const
Returns the mean speed on this lane.
Definition: MSLane.cpp:2720
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GLO_EDGE
an edge
Definition: GUIGlObjectTypes.h:46
Position::x
double x() const
Returns the x-position.
Definition: Position.h:56
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
GUILane::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUILane.cpp:895
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:249
LINKSTATE_DEADEND
This is a dead end link.
Definition: SUMOXMLDefinitions.h:1167
MSLane::removeVehicle
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
Definition: MSLane.cpp:2180
GUIVisualizationSettings::drawLinkTLIndex
GUIVisualizationTextSettings drawLinkTLIndex
Definition: GUIVisualizationSettings.h:569
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
GLO_LANE
a lane
Definition: GUIGlObjectTypes.h:48
GUILane::myShapeRotations
std::vector< double > myShapeRotations
The rotations of the shape parts.
Definition: GUILane.h:331
GUILane::firstWaitingTime
double firstWaitingTime() const
Definition: GUILane.cpp:925
LINKDIR_LEFT
The link is a (hard) left direction.
Definition: SUMOXMLDefinitions.h:1184
MSJunction::getType
SumoXMLNodeType getType() const
return the type of this Junction
Definition: MSJunction.h:126
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:298
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:54
MSEdge::getToJunction
const MSJunction * getToJunction() const
Definition: MSEdge.h:363
MSGlobals::gCheckRoutes
static bool gCheckRoutes
Definition: MSGlobals.h:78
GUIVisualizationTextSettings::show
bool show
flag show
Definition: GUIVisualizationSettings.h:68
GUIGlObject
Definition: GUIGlObject.h:65
LINKSTATE_MINOR
This is an uncontrolled, minor link, has to brake.
Definition: SUMOXMLDefinitions.h:1157
PositionVector::indexOfClosest
int indexOfClosest(const Position &p) const
index of the closest position to p
Definition: PositionVector.cpp:940
MSLane::getNettoOccupancy
double getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)
Definition: MSLane.cpp:2692
GUISUMOAbstractView::getPositionInformation
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Definition: GUISUMOAbstractView.cpp:190
MSLane::getLinkCont
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:2110
RGBColor::green
unsigned char green() const
Returns the green-amount of the color.
Definition: RGBColor.h:68
GUILane::myShapeLengths
std::vector< double > myShapeLengths
The lengths of the shape parts.
Definition: GUILane.h:334
GUIVisualizationSettings::laneParam
std::string laneParam
Definition: GUIVisualizationSettings.h:482
SVC_SHIP
is an arbitrary ship
Definition: SUMOVehicleClass.h:195
MSEdge::getRoutingSpeed
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:759
MSLane::detectCollisions
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
Definition: MSLane.cpp:1271
NODETYPE_RAIL_CROSSING
Definition: SUMOXMLDefinitions.h:1060
PositionVector::insertAtClosest
int insertAtClosest(const Position &p, bool interpolateZ)
inserts p between the two closest positions
Definition: PositionVector.cpp:959
GUILane::setPartialOccupation
double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
Definition: GUILane.cpp:194
MSLane::getPMxEmissions
double getPMxEmissions() const
Returns the sum of last step PMx emissions.
Definition: MSLane.cpp:2760
GUIVisualizationSizeSettings::minSize
double minSize
The minimum size to draw this object.
Definition: GUIVisualizationSettings.h:103
GUILane::getStoredEdgeTravelTime
double getStoredEdgeTravelTime() const
Returns the stored traveltime for the edge of this lane.
Definition: GUILane.cpp:937
MSLane::getLogicalPredecessorLane
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
Definition: MSLane.cpp:2543
GUILane::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:483
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:207
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:1543
BoolFormatException
Definition: UtilExceptions.h:121
GUILane::myHalfLaneWidth
double myHalfLaneWidth
Half of lane width, for speed-up.
Definition: GUILane.h:343
GUIVisualizationSettings::getLinkColor
static const RGBColor & getLinkColor(const LinkState &ls)
map from LinkState to color constants
Definition: GUIVisualizationSettings.cpp:1608
MSLane::getEdge
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:669
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:335
Position::distanceTo2D
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:243
MSEdge::isWalkingArea
bool isWalkingArea() const
return whether this edge is walking area
Definition: MSEdge.h:254
GLIncludes.h
GUILane::myAmClosed
bool myAmClosed
state for dynamic lane closings
Definition: GUILane.h:356
GUILane::getPendingEmits
double getPendingEmits() const
get number of vehicles waiting for departure on this lane
Definition: GUILane.cpp:1356
Position.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
MSLane::myEdge
MSEdge *const myEdge
The lane's edge, for routing only.
Definition: MSLane.h:1332
MSLane::getShape
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:477
GUILane::releaseVehicles
void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: GUILane.cpp:133
GUILane::removeParking
void removeParking(MSVehicle *veh)
remove parking vehicle
Definition: GUILane.cpp:166
FunctionBinding.h
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
GUIMainWindow
Definition: GUIMainWindow.h:46
Position::y
double y() const
Returns the y-position.
Definition: Position.h:61
MSLane::myIndex
int myIndex
The lane index.
Definition: MSLane.h:1272
GUIEdge
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:52
GUIVisualizationSettings::showLaneDirection
bool showLaneDirection
Whether to show direction indicators for lanes.
Definition: GUIVisualizationSettings.h:473
RGBColor::blue
unsigned char blue() const
Returns the blue-amount of the color.
Definition: RGBColor.h:75
MID_CLOSE_LANE
close lane
Definition: GUIAppEnum.h:559
GUIVisualizationSettings::showLane2Lane
bool showLane2Lane
Information whether lane-to-lane arrows shall be drawn.
Definition: GUIVisualizationSettings.h:572
LINKSTATE_TL_YELLOW_MAJOR
The link has yellow light, may pass.
Definition: SUMOXMLDefinitions.h:1147
PositionVector::reverse
PositionVector reverse() const
reverse position vector
Definition: PositionVector.cpp:1086
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:360
MSLane::integrateNewVehicles
virtual void integrateNewVehicles()
Insert buffered vehicle into the real lane.
Definition: MSLane.cpp:1940
GUILane::getVehiclesSecure
const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: GUILane.cpp:126
MSLane::myPermissions
SVCPermissions myPermissions
The vClass permissions for this lane.
Definition: MSLane.h:1338
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:1321
GUIEdge.h
GUILane::planMovements
void planMovements(const SUMOTime t)
Definition: GUILane.cpp:139
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:248
ICON_FLAG
Definition: GUIIcons.h:125
GUILane::myShapeColors
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GUILane.h:337
gSelected
GUISelectedStorage gSelected
A global holder of selected objects.
Definition: GUIGlobalSelection.cpp:33
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:216
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:266
PositionVector::getCentroid
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
Definition: PositionVector.cpp:414
MSEdge::getLanes
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:167
GUIVisualizationTextSettings::size
double size
text size
Definition: GUIVisualizationSettings.h:71
MSLane::removeParking
virtual void removeParking(MSVehicle *veh)
remove parking vehicle. This must be syncrhonized when running with GUI
Definition: MSLane.cpp:3031
MSLane::getWidth
double getWidth() const
Returns the lane's width.
Definition: MSLane.h:556
GUINet::getLinkTLIndex
int getLinkTLIndex(MSLink *link) const
Definition: GUINet.cpp:203
MSJunction::getShape
const PositionVector & getShape() const
Returns this junction's shape.
Definition: MSJunction.h:89
MSLane::myParkingVehicles
std::set< const MSVehicle * > myParkingVehicles
Definition: MSLane.h:1318
GUILane::myReachability
double myReachability
the time distance from a particular edge
Definition: GUILane.h:349
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:1057
MSLane::isInternal
bool isInternal() const
Definition: MSLane.cpp:2010
GUIVisualizationSettings::laneColorer
GUIColorer laneColorer
The lane colorer.
Definition: GUIVisualizationSettings.h:440
GeomHelper.h
GLO_JUNCTION
a junction
Definition: GUIGlObjectTypes.h:50
GUIVisualizationSettings::showLinkRules
bool showLinkRules
Information whether link rules (colored bars) shall be drawn.
Definition: GUIVisualizationSettings.h:455
GUILane::~GUILane
~GUILane()
Destructor.
Definition: GUILane.cpp:106
GUIVisualizationSettings::spreadSuperposed
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
Definition: GUIVisualizationSettings.h:479
StdDefs.h
Boundary::grow
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
MSLane::geometryPositionAtOffset
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:504
SUMO_const_laneMarkWidth
const double SUMO_const_laneMarkWidth
Definition: StdDefs.h:55
MELoop.h
LINKSTATE_TL_RED
The link has red light (must brake)
Definition: SUMOXMLDefinitions.h:1143
GUILane::drawArrows
void drawArrows() const
Definition: GUILane.cpp:389
GUILane::getScaleValue
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUILane.cpp:1205
GUIVisualizationSettings::drawJunctionShape
bool drawJunctionShape
whether the shape of the junction should be drawn
Definition: GUIVisualizationSettings.h:574
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:253
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
FunctionBinding
Definition: FunctionBinding.h:40
MSLane::myPermissionChanges
std::map< long long, SVCPermissions > myPermissionChanges
Definition: MSLane.h:1408
MSLane::getSpeedLimit
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
Definition: MSLane.h:532
GUINet
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:82
MSEdge::getPermissions
SVCPermissions getPermissions() const
Definition: MSEdge.h:553
MSLane::getFuelConsumption
double getFuelConsumption() const
Returns the sum of last step fuel consumption.
Definition: MSLane.cpp:2796
MSLane::setPartialOccupation
virtual double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
Definition: MSLane.cpp:267
RGBColor::changedBrightness
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:153
GUILane::drawLane2LaneConnections
void drawLane2LaneConnections(double exaggeration) const
Definition: GUILane.cpp:456
LINKDIR_PARTLEFT
The link is a partial left direction.
Definition: SUMOXMLDefinitions.h:1188
MSVehicleControl.h
GUILane::swapAfterLaneChange
void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
Definition: GUILane.cpp:173
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:91
POSITION_EPS
#define POSITION_EPS
Definition: config.h:172
MSVehicleTransfer.h
GUIPropertyScheme::getColor
const T getColor(const double value) const
Definition: GUIPropertyScheme.h:110
MSLane::getIndex
int getIndex() const
Returns the lane's index.
Definition: MSLane.h:563
MSLane::myVehicles
VehCont myVehicles
The lane's vehicles. This container holds all vehicles that have their front (longitudinally) and the...
Definition: MSLane.h:1285
MSLane::myMaxSpeed
double myMaxSpeed
Lane-wide speedlimit [m/s].
Definition: MSLane.h:1335
GUIVisualizationSettings::edgeData
std::string edgeData
key for coloring by edgeData
Definition: GUIVisualizationSettings.h:489
GUIPropertySchemeStorage::getActive
int getActive() const
Definition: GUIPropertySchemeStorage.h:75
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:1103
GUILane::drawLinkRule
void drawLinkRule(const GUIVisualizationSettings &s, const GUINet &net, MSLink *link, const PositionVector &shape, double x1, double x2) const
Definition: GUILane.cpp:328
MSLane::resetPermissions
void resetPermissions(long long transientID)
Definition: MSLane.cpp:3642
MSEdge::rebuildAllowedLanes
void rebuildAllowedLanes()
Definition: MSEdge.cpp:243
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:755
GUIVisualizationSizeSettings::exaggeration
double exaggeration
The size exaggeration (upscale)
Definition: GUIVisualizationSettings.h:106
GUIPropertySchemeStorage< GUIColorScheme >
MSEdge::getPredecessors
const MSEdgeVector & getPredecessors() const
Definition: MSEdge.h:354
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:94
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
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