SUMO - Simulation of Urban MObility
GNELane.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-2018 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 /****************************************************************************/
15 // A class for visualizing Lane geometry (adapted from GNELaneWrapper)
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
29 #include <utils/gui/div/GLHelper.h>
34 #include <netedit/GNEUndoList.h>
35 #include <netedit/GNENet.h>
36 #include <netedit/GNEViewParent.h>
41 
42 #include "GNELane.h"
43 #include "GNEEdge.h"
44 #include "GNEJunction.h"
45 #include "GNEInternalLane.h"
46 #include "GNEConnection.h"
47 
48 // ===========================================================================
49 // FOX callback mapping
50 // ===========================================================================
51 
52 // Object implementation
53 FXIMPLEMENT(GNELane, FXDelegator, 0, 0)
54 
55 // ===========================================================================
56 // method definitions
57 // ===========================================================================
58 
59 GNELane::GNELane(GNEEdge& edge, const int index) :
60  GNENetElement(edge.getNet(), edge.getNBEdge()->getLaneID(index), GLO_LANE, SUMO_TAG_LANE),
61  myParentEdge(edge),
62  myIndex(index),
63  mySpecialColor(nullptr) {
64 }
65 
67  GNENetElement(nullptr, "dummyConstructorGNELane", GLO_LANE, SUMO_TAG_LANE),
68  myParentEdge(GNEEdge::DummyEdge),
69  myIndex(-1),
70  mySpecialColor(nullptr) {
71 }
72 
73 
75 }
76 
77 
78 void
80  const std::vector<NBEdge::Connection>& cons = myParentEdge.getNBEdge()->getConnectionsFromLane(myIndex);
81  int noLinks = (int)cons.size();
82  if (noLinks == 0) {
83  return;
84  }
85  // draw all links
86  glPushMatrix();
87  glTranslated(0, 0, GLO_JUNCTION + 0.5);
88  double w = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
89  double x1 = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2;
90  const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
91  for (int i = noLinks; --i >= 0;) {
92  double x2 = x1 - (double)(w / 2.);
94  cons[lefthand ? noLinks - 1 - i : i]);
96  x1 -= w;
97  }
98  glPopMatrix();
99 }
100 
101 
102 void
104  const std::vector<NBEdge::Connection>& cons = myParentEdge.getNBEdge()->getConnectionsFromLane(myIndex);
105  int noLinks = (int)cons.size();
106  if (noLinks == 0) {
107  return;
108  }
109  // draw all links
110  glPushMatrix();
111  glTranslated(0, 0, GLO_JUNCTION + 0.5);
112  double w = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
113  double x1 = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2;
114  const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
115  for (int i = noLinks; --i >= 0;) {
116  double x2 = x1 - (double)(w / 2.);
117  int linkNo = cons[lefthand ? noLinks - 1 - i : i].tlLinkIndex;
119  x1 -= w;
120  }
121  glPopMatrix();
122 }
123 
124 
125 void
127 }
128 
129 
130 void
132  const Position& end = getShape().back();
133  const Position& f = getShape()[-2];
134  double rot = (double) atan2((end.x() - f.x()), (f.y() - end.y())) * (double) 180.0 / (double)M_PI;
135  glPushMatrix();
136  glPushName(0);
137  glTranslated(0, 0, GLO_JUNCTION + .1); // must draw on top of junction shape
138  glColor3d(1, 1, 1);
139  glTranslated(end.x(), end.y(), 0);
140  glRotated(rot, 0, 0, 1);
141 
142  // draw all links
143  const std::vector<NBEdge::Connection>& edgeCons = myParentEdge.getNBEdge()->myConnections;
144  NBNode* dest = myParentEdge.getNBEdge()->myTo;
145  for (auto i : edgeCons) {
146  if (i.fromLane == myIndex) {
147  LinkDirection dir = dest->getDirection(myParentEdge.getNBEdge(), i.toEdge, OptionsCont::getOptions().getBool("lefthand"));
148  switch (dir) {
149  case LINKDIR_STRAIGHT:
150  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
151  GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25);
152  break;
153  case LINKDIR_LEFT:
154  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
155  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
156  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25);
157  break;
158  case LINKDIR_RIGHT:
159  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
160  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
161  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25);
162  break;
163  case LINKDIR_TURN:
164  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
165  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
166  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
167  GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25);
168  break;
170  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
171  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
172  GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
173  GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25);
174  break;
175  case LINKDIR_PARTLEFT:
176  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
177  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
178  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25);
179  break;
180  case LINKDIR_PARTRIGHT:
181  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
182  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
183  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25);
184  break;
185  case LINKDIR_NODIR:
186  GLHelper::drawBoxLine(Position(1, 5.8), 245, 2, .05);
187  GLHelper::drawBoxLine(Position(-1, 5.8), 115, 2, .05);
188  glTranslated(0, 5, 0);
189  GLHelper::drawOutlineCircle(0.9, 0.8, 32);
190  glTranslated(0, -5, 0);
191  break;
192  }
193  }
194  }
195  glPopName();
196  glPopMatrix();
197 }
198 
199 
200 void
202  glPushMatrix();
203  glPushName(0);
204  glTranslated(0, 0, GLO_JUNCTION + .1); // must draw on top of junction shape
205  std::vector<NBEdge::Connection> connections = myParentEdge.getNBEdge()->getConnectionsFromLane(myIndex);
206  NBNode* node = myParentEdge.getNBEdge()->getToNode();
207  const Position& startPos = getShape()[-1];
208  for (auto it : connections) {
209  const LinkState state = node->getLinkState(myParentEdge.getNBEdge(), it.toEdge, it.fromLane, it.toLane, it.mayDefinitelyPass, it.tlID);
210  switch (state) {
212  glColor3d(1, 1, 0);
213  break;
215  glColor3d(0, 1, 1);
216  break;
217  case LINKSTATE_MAJOR:
218  glColor3d(1, 1, 1);
219  break;
220  case LINKSTATE_MINOR:
221  glColor3d(.4, .4, .4);
222  break;
223  case LINKSTATE_STOP:
224  glColor3d(.7, .4, .4);
225  break;
226  case LINKSTATE_EQUAL:
227  glColor3d(.7, .7, .7);
228  break;
230  glColor3d(.7, .7, 1);
231  break;
232  case LINKSTATE_ZIPPER:
233  glColor3d(.75, .5, 0.25);
234  break;
235  default:
236  throw ProcessError("Unexpected LinkState '" + toString(state) + "'");
237  }
238  const Position& endPos = it.toEdge->getLaneShape(it.toLane)[0];
239  glBegin(GL_LINES);
240  glVertex2d(startPos.x(), startPos.y());
241  glVertex2d(endPos.x(), endPos.y());
242  glEnd();
243  GLHelper::drawTriangleAtEnd(startPos, endPos, (double) 1.5, (double) .2);
244  }
245  glPopName();
246  glPopMatrix();
247 }
248 
249 
250 void
252  // Push draw matrix 1
253  glPushMatrix();
254  // Push name
255  glPushName(getGlID());
256  // Traslate to fromt
257  glTranslated(0, 0, getType());
258  setLaneColor(s);
259  // start drawing lane checking whether it is not too small
260  const double selectionScale = isAttributeCarrierSelected() || myParentEdge.isAttributeCarrierSelected() ? s.selectionScale : 1;
261  double exaggeration = selectionScale * s.laneWidthExaggeration; // * s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive()));
262  // XXX apply usefull scale values
263  //exaggeration *= s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive()));
264 
265  // recognize full transparency and simply don't draw
266  GLfloat color[4];
267  glGetFloatv(GL_CURRENT_COLOR, color);
268  if ((color[3] == 0) || (s.scale * exaggeration < s.laneMinSize)) {
269  // Pop draw matrix 1
270  glPopMatrix();
271  } else if (s.scale * exaggeration < 1.) {
272  // draw as lines, depending of myShapeColors
273  if (myShapeColors.size() > 0) {
275  } else {
277  }
278  // Pop draw matrix 1
279  glPopMatrix();
280  } else {
281  // we draw the lanes with reduced width so that the lane markings below are visible
282  // (this avoids artifacts at geometry corners without having to
283  // compute lane-marking intersection points)
284  const double halfWidth2 = exaggeration * (myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2 - SUMO_const_laneMarkWidth / 2);
285  // Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen
286  const double halfWidth = myParentEdge.isAttributeCarrierSelected() ? halfWidth2 - exaggeration * 0.3 : halfWidth2;
287  const bool spreadSuperposed = s.spreadSuperposed && drawAsRailway(s) && myParentEdge.getNBEdge()->isBidiRail();
288  // Check if lane has to be draw as railway and if isn't being drawn for selecting
289  if (drawAsRailway(s) && (!s.drawForSelecting || spreadSuperposed)) {
290  PositionVector shape = getShape();
291  const double width = myParentEdge.getNBEdge()->getLaneWidth(myIndex);
292  // draw as railway: assume standard gauge of 1435mm when lane width is not set
293  // draw foot width 150mm, assume that distance between rail feet inner sides is reduced on both sides by 39mm with regard to the gauge
294  // assume crosstie length of 181% gauge (2600mm for standard gauge)
295  double halfGauge = 0.5 * (width == SUMO_const_laneWidth ? 1.4350 : width) * exaggeration;
296  if (spreadSuperposed) {
297  shape.move2side(halfGauge * 0.8);
298  halfGauge *= 0.4;
299  //std::cout << "spreadSuperposed " << getID() << " old=" << getShape() << " new=" << shape << "\n";
300  }
301  const double halfInnerFeetWidth = halfGauge - 0.039 * exaggeration;
302  const double halfRailWidth = halfInnerFeetWidth + 0.15 * exaggeration;
303  const double halfCrossTieWidth = halfGauge * 1.81;
304  // Draw box depending of myShapeColors
305  if (myShapeColors.size() > 0) {
307  } else {
309  }
310  // Save current color
311  RGBColor current = GLHelper::getColor();
312  // Draw gray on top with reduced width (the area between the two tracks)
313  glColor3d(0.8, 0.8, 0.8);
314  glTranslated(0, 0, .1);
315  GLHelper::drawBoxLines(shape, myShapeRotations, myShapeLengths, halfInnerFeetWidth);
316  // Set current color back
317  GLHelper::setColor(current);
318  // Draw crossties
319  GLHelper::drawCrossTies(shape, myShapeRotations, myShapeLengths, 0.26 * exaggeration, 0.6 * exaggeration, halfCrossTieWidth, s.drawForSelecting);
320  } else {
321  if (myShapeColors.size() > 0) {
323  } else {
325  }
326  }
327  if (halfWidth != halfWidth2 && !spreadSuperposed) {
328  // draw again to show the selected edge
330  glTranslated(0, 0, -.1);
332  }
333  // check if dotted contour has to be drawn
334  if (!s.drawForSelecting && (myNet->getViewNet()->getDottedAC() == this)) {
336  }
337  // Pop draw matrix 1
338  glPopMatrix();
339  // only draw details depending of the scale and if isn't being drawn for selecting
340  if ((s.scale >= 10) && !s.drawForSelecting) {
341  // if exaggeration is 1, draw drawMarkings
342  if (s.laneShowBorders && exaggeration == 1 && !drawAsRailway(s)) {
343  drawMarkings(s, exaggeration);
344  }
345  // draw ROWs only if target junction has a valid logic)
347  drawArrows();
348  }
349  // Draw direction indicators if the correspondient option is enabled
350  if (s.showLaneDirection) {
351  if (drawAsRailway(s)) {
352  // improve visibility of superposed rail edges
353  setLaneColor(s);
354  } else {
355  glColor3d(0.3, 0.3, 0.3);
356  }
357  drawDirectionIndicators(exaggeration, spreadSuperposed);
358  }
359  if (s.drawLinkJunctionIndex.show) {
360  drawLinkNo(s);
361  }
362  if (s.drawLinkTLIndex.show) {
363  drawTLSLinkNo(s);
364  }
365  }
366  // If there are texture of restricted lanes to draw, check if icons can be drawn
367  if (!s.drawForSelecting && !OptionsCont::getOptions().getBool("disable-laneIcons") && (myLaneRestrictedTexturePositions.size() > 0) && (s.scale >= 10)) {
368  // Declare default width of icon (3)
369  double iconWidth = 1;
370  // Obtain width of icon, if width of lane is different
372  iconWidth = myParentEdge.getNBEdge()->getLaneStruct(myIndex).width / 3;
373  }
374  // Draw list of icons
375  for (int i = 0; i < (int)myLaneRestrictedTexturePositions.size(); i++) {
376  // Push draw matrix 2
377  glPushMatrix();
378  // Set white color
379  glColor3d(1, 1, 1);
380  // Traslate matrix 2
381  glTranslated(myLaneRestrictedTexturePositions.at(i).x(), myLaneRestrictedTexturePositions.at(i).y(), getType() + 0.1);
382  // Rotate matrix 2
383  glRotated(myLaneRestrictedTextureRotations.at(i), 0, 0, -1);
384  glRotated(-90, 0, 0, 1);
385  // draw texture box depending of type of restriction
388  } else if (isRestricted(SVC_BICYCLE)) {
390  } else if (isRestricted(SVC_BUS)) {
392  }
393  // Pop draw matrix 2
394  glPopMatrix();
395  }
396  }
397  // draw a Start/endPoints if lane has a custom shape
399  GLHelper::setColor(s.junctionColorer.getSchemes()[0].getColor(2));
401  // override with special colors (unless the color scheme is based on selection)
403  }
404  // obtain circle width and resolution
405  double circleWidth = GNEEdge::SNAP_RADIUS * MIN2((double)1, s.laneWidthExaggeration) / 2;
406  int circleResolution = GNEAttributeCarrier::getCircleResolution(s);
407  // obtain custom shape
409  // draw s
410  glPushMatrix();
411  glTranslated(customShape.front().x(), customShape.front().y(), GLO_JUNCTION + 0.01);
412  GLHelper::drawFilledCircle(circleWidth, circleResolution);
413  glTranslated(0, 0, 0.01);
414  GLHelper::drawText("S", Position(), 0, circleWidth, RGBColor::WHITE);
415  glPopMatrix();
416  // draw line between Junction and point
417  glPushMatrix();
418  glTranslated(0, 0, GLO_JUNCTION - 0.01);
419  glLineWidth(4);
421  glPopMatrix();
422  // draw "e"
423  glPushMatrix();
424  glTranslated(customShape.back().x(), customShape.back().y(), GLO_JUNCTION + 0.01);
425  GLHelper::drawFilledCircle(circleWidth, circleResolution);
426  glTranslated(0, 0, 0.01);
427  GLHelper::drawText("E", Position(), 0, circleWidth, RGBColor::WHITE);
428  glPopMatrix();
429  // draw line between Junction and point
430  glPushMatrix();
431  glTranslated(0, 0, GLO_JUNCTION - 0.01);
432  glLineWidth(4);
434  glPopMatrix();
435  }
436  }
437  // Pop Name
438  glPopName();
439 }
440 
441 
442 void
443 GNELane::drawMarkings(const GUIVisualizationSettings& /* s */, double scale) const {
444  glPushMatrix();
445  glTranslated(0, 0, GLO_EDGE);
446  const double myHalfLaneWidth = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2;
447  // optionally draw inverse markings
449  double mw = (myHalfLaneWidth + SUMO_const_laneMarkWidth) * scale;
450  double mw2 = (myHalfLaneWidth - SUMO_const_laneMarkWidth) * scale;
451  if (OptionsCont::getOptions().getBool("lefthand")) {
452  mw *= -1;
453  mw2 *= -1;
454  }
455  int e = (int) getShape().size() - 1;
456  for (int i = 0; i < e; ++i) {
457  glPushMatrix();
458  glTranslated(getShape()[i].x(), getShape()[i].y(), 2.1);
459  glRotated(myShapeRotations[i], 0, 0, 1);
460  for (double t = 0; t < myShapeLengths[i]; t += 6) {
461  const double length = MIN2((double)3, myShapeLengths[i] - t);
462  glBegin(GL_QUADS);
463  glVertex2d(-mw, -t);
464  glVertex2d(-mw, -t - length);
465  glVertex2d(-mw2, -t - length);
466  glVertex2d(-mw2, -t);
467  glEnd();
468  }
469  glPopMatrix();
470  }
471  }
472  // draw white boundings and white markings
473  glColor3d(1, 1, 1);
475  getShape(),
477  getShapeLengths(),
478  (myHalfLaneWidth + SUMO_const_laneMarkWidth) * scale);
479  glPopMatrix();
480 }
481 
482 
485  // first obtain edit mode (needed because certain Commands depend of current edit mode)
486  const int editMode = parent.getVisualisationSettings()->editMode;
487  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
488  buildPopupHeader(ret, app);
490  // build copy names entry
491  if (editMode != GNE_MODE_TLS) {
492  new FXMenuCommand(ret, "Copy edge parent name to clipboard", nullptr, ret, MID_COPY_EDGE_NAME);
494  }
495  // build selection
497  if (editMode != GNE_MODE_TLS) {
498  // build show parameters menu
500  // build position copy entry
501  buildPositionCopyEntry(ret, false);
502  }
503  if (editMode != GNE_MODE_CONNECT && editMode != GNE_MODE_TLS && editMode != GNE_MODE_CREATE_EDGE) {
504  // Get icons
505  FXIcon* pedestrianIcon = GUIIconSubSys::getIcon(ICON_LANEPEDESTRIAN);
506  FXIcon* bikeIcon = GUIIconSubSys::getIcon(ICON_LANEBIKE);
507  FXIcon* busIcon = GUIIconSubSys::getIcon(ICON_LANEBUS);
508  FXIcon* greenVergeIcon = GUIIconSubSys::getIcon(ICON_LANEGREENVERGE);
509  // Create basic commands
510  std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
511  const int edgeSelSize = (int)myNet->retrieveEdges(true).size();
512  if (edgeSelSize && myParentEdge.isAttributeCarrierSelected() && (edgeSelSize > 1)) {
513  edgeDescPossibleMulti = toString(edgeSelSize) + " " + toString(SUMO_TAG_EDGE) + "s";
514  }
515  // if lane is selected, calculate number of restricted lanes
516  bool edgeHasSidewalk = false;
517  bool edgeHasBikelane = false;
518  bool edgeHasBuslane = false;
519  bool edgeHasGreenVerge = false;
520  bool differentLaneShapes = false;
522  auto selectedLanes = myNet->retrieveLanes(true);
523  for (auto i : selectedLanes) {
524  if (i->getParentEdge().hasRestrictedLane(SVC_PEDESTRIAN)) {
525  edgeHasSidewalk = true;
526  }
527  if (i->getParentEdge().hasRestrictedLane(SVC_BICYCLE)) {
528  edgeHasBikelane = true;
529  }
530  if (i->getParentEdge().hasRestrictedLane(SVC_BUS)) {
531  edgeHasBuslane = true;
532  }
533  if (i->getParentEdge().hasRestrictedLane(SVC_IGNORING)) {
534  edgeHasGreenVerge = true;
535  }
536  if (i->getParentEdge().getNBEdge()->getLaneStruct(i->getIndex()).customShape.size() != 0) {
537  differentLaneShapes = true;
538  }
539  }
540  } else {
541  edgeHasSidewalk = myParentEdge.hasRestrictedLane(SVC_PEDESTRIAN);
542  edgeHasBikelane = myParentEdge.hasRestrictedLane(SVC_BICYCLE);
543  edgeHasBuslane = myParentEdge.hasRestrictedLane(SVC_BUS);
544  edgeHasGreenVerge = myParentEdge.hasRestrictedLane(SVC_IGNORING);
545  differentLaneShapes = myParentEdge.getNBEdge()->getLaneStruct(myIndex).customShape.size() != 0;
546  }
547  // create menu pane for edge operations
548  FXMenuPane* edgeOperations = new FXMenuPane(ret);
549  ret->insertMenuPaneChild(edgeOperations);
550  new FXMenuCascade(ret, "edge operations", nullptr, edgeOperations);
551  // create menu commands for all edge oeprations
552  new FXMenuCommand(edgeOperations, "Split edge here", nullptr, &parent, MID_GNE_EDGE_SPLIT);
553  new FXMenuCommand(edgeOperations, "Split edge in both direction here", nullptr, &parent, MID_GNE_EDGE_SPLIT_BIDI);
554  new FXMenuCommand(edgeOperations, "Set geometry endpoint here (shift-click)", nullptr, &parent, MID_GNE_EDGE_EDIT_ENDPOINT);
555  new FXMenuCommand(edgeOperations, "Restore geometry endpoint (shift-click)", nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
556  new FXMenuCommand(edgeOperations, ("Reverse " + edgeDescPossibleMulti).c_str(), nullptr, &parent, MID_GNE_EDGE_REVERSE);
557  new FXMenuCommand(edgeOperations, ("Add reverse direction for " + edgeDescPossibleMulti).c_str(), nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE);
558  new FXMenuCommand(edgeOperations, ("Straighten " + edgeDescPossibleMulti).c_str(), nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN);
559  new FXMenuCommand(edgeOperations, ("Smooth " + edgeDescPossibleMulti).c_str(), nullptr, &parent, MID_GNE_EDGE_SMOOTH);
560  new FXMenuCommand(edgeOperations, ("Straighten elevation of " + edgeDescPossibleMulti).c_str(), nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN_ELEVATION);
561  new FXMenuCommand(edgeOperations, ("Smooth elevation of " + edgeDescPossibleMulti).c_str(), nullptr, &parent, MID_GNE_EDGE_SMOOTH_ELEVATION);
562  // create menu pane for lane operations
563  FXMenuPane* laneOperations = new FXMenuPane(ret);
564  ret->insertMenuPaneChild(laneOperations);
565  new FXMenuCascade(ret, "lane operations", nullptr, laneOperations);
566  new FXMenuCommand(laneOperations, "Duplicate lane", nullptr, &parent, MID_GNE_LANE_DUPLICATE);
567  if (differentLaneShapes) {
568  new FXMenuCommand(laneOperations, "reset custom shape", nullptr, &parent, MID_GNE_LANE_RESET_CUSTOMSHAPE);
569  }
570  // Create panel for lane operations and insert it in ret
571  FXMenuPane* addSpecialLanes = new FXMenuPane(laneOperations);
572  ret->insertMenuPaneChild(addSpecialLanes);
573  FXMenuPane* removeSpecialLanes = new FXMenuPane(laneOperations);
574  ret->insertMenuPaneChild(removeSpecialLanes);
575  FXMenuPane* transformSlanes = new FXMenuPane(laneOperations);
576  ret->insertMenuPaneChild(transformSlanes);
577  // Create menu comands for all add special lanes
578  FXMenuCommand* addSidewalk = new FXMenuCommand(addSpecialLanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_ADD_SIDEWALK);
579  FXMenuCommand* addBikelane = new FXMenuCommand(addSpecialLanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_ADD_BIKE);
580  FXMenuCommand* addBuslane = new FXMenuCommand(addSpecialLanes, "Buslane", busIcon, &parent, MID_GNE_LANE_ADD_BUS);
581  FXMenuCommand* addGreenVerge = new FXMenuCommand(addSpecialLanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE);
582  // Create menu comands for all remove special lanes and disable it
583  FXMenuCommand* removeSidewalk = new FXMenuCommand(removeSpecialLanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_REMOVE_SIDEWALK);
584  removeSidewalk->disable();
585  FXMenuCommand* removeBikelane = new FXMenuCommand(removeSpecialLanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_REMOVE_BIKE);
586  removeBikelane->disable();
587  FXMenuCommand* removeBuslane = new FXMenuCommand(removeSpecialLanes, "Buslane", busIcon, &parent, MID_GNE_LANE_REMOVE_BUS);
588  removeBuslane->disable();
589  FXMenuCommand* removeGreenVerge = new FXMenuCommand(removeSpecialLanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_REMOVE_GREENVERGE);
590  removeGreenVerge->disable();
591  // Create menu comands for all trasform special lanes and disable it
592  FXMenuCommand* transformLaneToSidewalk = new FXMenuCommand(transformSlanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_TRANSFORM_SIDEWALK);
593  FXMenuCommand* transformLaneToBikelane = new FXMenuCommand(transformSlanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_TRANSFORM_BIKE);
594  FXMenuCommand* transformLaneToBuslane = new FXMenuCommand(transformSlanes, "Buslane", busIcon, &parent, MID_GNE_LANE_TRANSFORM_BUS);
595  FXMenuCommand* transformLaneToGreenVerge = new FXMenuCommand(transformSlanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_TRANSFORM_GREENVERGE);
596  // add menuCascade for lane operations
597  FXMenuCascade* cascadeAddSpecialLane = new FXMenuCascade(laneOperations, ("add restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, addSpecialLanes);
598  FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(laneOperations, ("remove restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, removeSpecialLanes);
599  new FXMenuCascade(laneOperations, ("transform to restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, transformSlanes);
600  // Enable and disable options depending of current transform of the lane
601  if (edgeHasSidewalk) {
602  transformLaneToSidewalk->disable();
603  addSidewalk->disable();
604  removeSidewalk->enable();
605  }
606  if (edgeHasBikelane) {
607  transformLaneToBikelane->disable();
608  addBikelane->disable();
609  removeBikelane->enable();
610  }
611  if (edgeHasBuslane) {
612  transformLaneToBuslane->disable();
613  addBuslane->disable();
614  removeBuslane->enable();
615  }
616  if (edgeHasGreenVerge) {
617  transformLaneToGreenVerge->disable();
618  addGreenVerge->disable();
619  removeGreenVerge->enable();
620  }
621  // Check if cascade menus must be disabled
622  if (edgeHasSidewalk && edgeHasBikelane && edgeHasBuslane && edgeHasGreenVerge) {
623  cascadeAddSpecialLane->disable();
624  }
625  if (!edgeHasSidewalk && !edgeHasBikelane && !edgeHasBuslane && !edgeHasGreenVerge) {
626  cascadeRemoveSpecialLane->disable();
627  }
628  } else if (editMode == GNE_MODE_TLS) {
630  new FXMenuCommand(ret, "Select state for all links from this edge:", nullptr, nullptr, 0);
631  const std::vector<std::string> names = GNEInternalLane::LinkStateNames.getStrings();
632  for (auto it : names) {
633  FXuint state = GNEInternalLane::LinkStateNames.get(it);
634  FXMenuRadio* mc = new FXMenuRadio(ret, it.c_str(), this, FXDataTarget::ID_OPTION + state);
635  mc->setSelBackColor(MFXUtils::getFXColor(GNEInternalLane::colorForLinksState(state)));
637  }
638  }
639  } else {
640  FXMenuCommand* mc = new FXMenuCommand(ret, "Additional options available in 'Inspect Mode'", nullptr, nullptr, 0);
641  mc->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
642  }
643  // buildShowParamsPopupEntry(ret, false);
644  // build shape positions menu
645  if (editMode != GNE_MODE_TLS) {
646  new FXMenuSeparator(ret);
647  const double pos = getShape().nearest_offset_to_point2D(parent.getPositionInformation());
648  const double height = getShape().positionAtOffset2D(getShape().nearest_offset_to_point2D(parent.getPositionInformation())).z();
649  new FXMenuCommand(ret, ("Shape pos: " + toString(pos)).c_str(), nullptr, nullptr, 0);
650  new FXMenuCommand(ret, ("Length pos: " + toString(pos * getLaneParametricLength() / getLaneShapeLength())).c_str(), nullptr, nullptr, 0);
651  new FXMenuCommand(ret, ("Height: " + toString(height)).c_str(), nullptr, nullptr, 0);
652  }
653  // new FXMenuSeparator(ret);
654  // buildPositionCopyEntry(ret, false);
655  return ret;
656 }
657 
658 
659 Boundary
661  // Lanes don't use myMovingGeometryBoundary
663  b.grow(10);
664  return b;
665 }
666 
667 
668 const PositionVector&
671 }
672 
673 
674 const std::vector<double>&
676  return myShapeRotations;
677 }
678 
679 
680 const std::vector<double>&
682  return myShapeLengths;
683 }
684 
685 
686 Boundary
690  } else {
692  }
693 }
694 
695 
696 void
697 GNELane::updateGeometry(bool updateGrid) {
698  // Clear containers
699  myShapeRotations.clear();
700  myShapeLengths.clear();
703  //double length = myParentEdge.getLength(); // @todo see ticket #448
704  // may be different from length
705 
706  // Obtain lane and shape rotations
707  int segments = (int) getShape().size() - 1;
708  if (segments >= 0) {
709  myShapeRotations.reserve(segments);
710  myShapeLengths.reserve(segments);
711  for (int i = 0; i < segments; ++i) {
712  const Position& f = getShape()[i];
713  const Position& s = getShape()[i + 1];
714  myShapeLengths.push_back(f.distanceTo2D(s));
715  myShapeRotations.push_back((double) atan2((s.x() - f.x()), (f.y() - s.y())) * (double) 180.0 / (double)M_PI);
716  }
717  }
718  // update additional childs
719  for (auto i : myAdditionalChilds) {
720  i->updateGeometry(updateGrid);
721  }
722  // update additionals with this lane as chid
723  for (auto i : myFirstAdditionalParents) {
724  i->updateGeometry(updateGrid);
725  }
726  // update POIs associated to this lane
727  for (auto i : myShapes) {
728  i->updateGeometry(updateGrid);
729  }
730  // In Move mode, connections aren't updated
732  // Update incoming connections of this lane
733  auto incomingConnections = getGNEIncomingConnections();
734  for (auto i : incomingConnections) {
735  i->updateGeometry(updateGrid);
736  }
737  // Update outgoings connections of this lane
738  auto outGoingConnections = getGNEOutcomingConnections();
739  for (auto i : outGoingConnections) {
740  i->updateGeometry(updateGrid);
741  }
742  }
743  // If lane has enought length for show textures of restricted lanes
744  if ((getLaneShapeLength() > 4)) {
745  // if lane is restricted
747  // get values for position and rotation of icons
748  for (int i = 2; i < getLaneShapeLength() - 1; i += 15) {
749  myLaneRestrictedTexturePositions.push_back(getShape().positionAtOffset(i));
750  myLaneRestrictedTextureRotations.push_back(getShape().rotationDegreeAtOffset(i));
751  }
752  }
753  }
754 }
755 
756 int
758  return myIndex;
759 }
760 
761 void
762 GNELane::setIndex(int index) {
763  myIndex = index;
765 }
766 
767 
768 double
771 }
772 
773 
774 double
776  double laneParametricLenght = myParentEdge.getNBEdge()->getLoadedLength();
777  if (laneParametricLenght > 0) {
778  return laneParametricLenght;
779  } else {
780  throw ProcessError("Lane Parametric Lenght cannot be never 0");
781  }
782 }
783 
784 
785 double
787  return getShape().length();
788 }
789 
790 
791 void
793  // Check if Shape exist before remove
794  if (std::find(myShapes.begin(), myShapes.end(), shape) == myShapes.end()) {
795  myShapes.push_back(shape);
796  // update Geometry of shape after add
797  shape->updateGeometry(true);
798  } else {
799  throw ProcessError(shape->getTagStr() + " with ID='" + shape->getID() + "' was already inserted in lane with ID='" + getID() + "'");
800  }
801 }
802 
803 
804 void
806  auto it = std::find(myShapes.begin(), myShapes.end(), shape);
807  // Check if Shape exist before remove
808  if (it != myShapes.end()) {
809  myShapes.erase(it);
810  } else {
811  throw ProcessError(shape->getTagStr() + " with ID='" + shape->getID() + "' doesn't exist in lane with ID='" + getID() + "'");
812  }
813 }
814 
815 
816 const std::vector<GNEShape*>&
818  return myShapes;
819 }
820 
821 
822 bool
824  return myParentEdge.getNBEdge()->getPermissions(myIndex) == vclass;
825 }
826 
827 
828 std::string
830  const NBEdge* edge = myParentEdge.getNBEdge();
831  switch (key) {
832  case SUMO_ATTR_ID:
833  return getMicrosimID();
834  case SUMO_ATTR_SPEED:
835  return toString(edge->getLaneSpeed(myIndex));
836  case SUMO_ATTR_ALLOW:
838  case SUMO_ATTR_DISALLOW:
840  case SUMO_ATTR_WIDTH:
841  return toString(edge->getLaneStruct(myIndex).width);
842  case SUMO_ATTR_ENDOFFSET:
843  return toString(edge->getLaneStruct(myIndex).endOffset);
845  return toString(edge->getLaneStruct(myIndex).accelRamp);
847  return toString(edge->getLaneStruct(myIndex).customShape);
848  case SUMO_ATTR_INDEX:
849  return toString(myIndex);
850  case GNE_ATTR_SELECTED:
852  case GNE_ATTR_GENERIC:
853  return getGenericParametersStr();
854  default:
855  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
856  }
857 }
858 
859 std::string
861  std::string result = getAttribute(key);
862  if ((key == SUMO_ATTR_ALLOW || key == SUMO_ATTR_DISALLOW) && result.find("all") != std::string::npos) {
863  result += " " + getVehicleClassNames(SVCAll, true);
864  }
865  return result;
866 }
867 
868 
869 void
870 GNELane::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
871  switch (key) {
872  case SUMO_ATTR_ID:
873  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
874  case SUMO_ATTR_SPEED:
875  case SUMO_ATTR_ALLOW:
876  case SUMO_ATTR_DISALLOW:
877  case SUMO_ATTR_WIDTH:
878  case SUMO_ATTR_ENDOFFSET:
881  case SUMO_ATTR_INDEX:
882  case GNE_ATTR_SELECTED:
883  case GNE_ATTR_GENERIC:
884  // no special handling
885  undoList->p_add(new GNEChange_Attribute(this, key, value));
886  break;
887  default:
888  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
889  }
890 }
891 
892 
893 bool
894 GNELane::isValid(SumoXMLAttr key, const std::string& value) {
895  switch (key) {
896  case SUMO_ATTR_ID:
897  return false;
898  case SUMO_ATTR_SPEED:
899  return canParse<double>(value);
900  case SUMO_ATTR_ALLOW:
901  case SUMO_ATTR_DISALLOW:
902  return canParseVehicleClasses(value);
903  case SUMO_ATTR_WIDTH:
904  return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_WIDTH));
905  case SUMO_ATTR_ENDOFFSET:
906  return canParse<double>(value) && (parse<double>(value) >= 0);
908  return canParse<bool>(value);
909  case SUMO_ATTR_CUSTOMSHAPE: {
910  // A lane shape can either be empty or have more than 1 element
911  if (value.empty()) {
912  return true;
913  } else if (canParse<PositionVector>(value)) {
914  return parse<PositionVector>(value).size() > 1;
915  }
916  return false;
917  }
918  case SUMO_ATTR_INDEX:
919  return canParse<int>(value) && (parse<int>(value) == myIndex);
920  case GNE_ATTR_SELECTED:
921  return canParse<bool>(value);
922  case GNE_ATTR_GENERIC:
923  return isGenericParametersValid(value);
924  default:
925  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
926  }
927 }
928 
929 
930 std::string
932  std::string result;
933  // Generate an string using the following structure: "key1=value1|key2=value2|...
935  result += i.first + "=" + i.second + "|";
936  }
937  // remove the last "|"
938  if (!result.empty()) {
939  result.pop_back();
940  }
941  return result;
942 }
943 
944 
945 std::vector<std::pair<std::string, std::string> >
947  std::vector<std::pair<std::string, std::string> > result;
948  // iterate over parameters map and fill result
950  result.push_back(std::make_pair(i.first, i.second));
951  }
952  return result;
953 }
954 
955 
956 void
957 GNELane::setGenericParametersStr(const std::string& value) {
958  // clear parameters
960  // separate value in a vector of string using | as separator
961  std::vector<std::string> parsedValues;
962  StringTokenizer stValues(value, "|", true);
963  while (stValues.hasNext()) {
964  parsedValues.push_back(stValues.next());
965  }
966  // check that parsed values (A=B)can be parsed in generic parameters
967  for (auto i : parsedValues) {
968  std::vector<std::string> parsedParameters;
969  StringTokenizer stParam(i, "=", true);
970  while (stParam.hasNext()) {
971  parsedParameters.push_back(stParam.next());
972  }
973  // Check that parsed parameters are exactly two and contains valid chracters
974  if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
975  myParentEdge.getNBEdge()->getLaneStruct(myIndex).setParameter(parsedParameters.front(), parsedParameters.back());
976  }
977  }
978 }
979 
980 
981 void
983  mySpecialColor = color;
984 }
985 
986 // ===========================================================================
987 // private
988 // ===========================================================================
989 
990 void
991 GNELane::setAttribute(SumoXMLAttr key, const std::string& value) {
992  NBEdge* edge = myParentEdge.getNBEdge();
993  switch (key) {
994  case SUMO_ATTR_ID:
995  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
996  case SUMO_ATTR_SPEED:
997  edge->setSpeed(myIndex, parse<double>(value));
998  break;
999  case SUMO_ATTR_ALLOW:
1001  break;
1002  case SUMO_ATTR_DISALLOW:
1004  break;
1005  case SUMO_ATTR_WIDTH:
1006  edge->setLaneWidth(myIndex, parse<double>(value));
1007  break;
1008  case SUMO_ATTR_ENDOFFSET:
1009  edge->setEndOffset(myIndex, parse<double>(value));
1010  break;
1012  edge->setAcceleration(myIndex, parse<bool>(value));
1013  break;
1014  case SUMO_ATTR_CUSTOMSHAPE: {
1015  // first remove edge parent from net
1017  // set new shape
1018  edge->setLaneShape(myIndex, parse<PositionVector>(value));
1019  // add edge parent into net again
1021  break;
1022  }
1023  case GNE_ATTR_SELECTED:
1024  if (parse<bool>(value)) {
1026  } else {
1028  }
1029  break;
1030  case GNE_ATTR_GENERIC:
1031  setGenericParametersStr(value);
1032  break;
1033  default:
1034  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1035  }
1036  // Update Geometry after setting a new attribute (but avoided for certain attributes)
1037  if((key != SUMO_ATTR_ID) && (key != GNE_ATTR_GENERIC) && (key != GNE_ATTR_SELECTED)) {
1038  updateGeometry(true);
1039  }
1040 }
1041 
1042 
1043 void
1045 }
1046 
1047 
1048 void
1050  if (mySpecialColor != nullptr) {
1051  // If special color is enabled, set it
1053  } else if (isAttributeCarrierSelected() && s.laneColorer.getActive() != 1) {
1054  // override with special colors (unless the color scheme is based on selection)
1056  } else if (myParentEdge.isAttributeCarrierSelected() && s.laneColorer.getActive() != 1) {
1057  // override with special colors (unless the color scheme is based on selection)
1059  } else {
1060  // Get normal lane color
1061  const GUIColorer& c = s.laneColorer;
1062  if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) {
1064  }
1065  }
1066 }
1067 
1068 bool
1069 GNELane::setFunctionalColor(int activeScheme) const {
1070  switch (activeScheme) {
1071  case 6: {
1072  double hue = GeomHelper::naviDegree(getShape().beginEndAngle()); // [0-360]
1073  GLHelper::setColor(RGBColor::fromHSV(hue, 1., 1.));
1074  return true;
1075  }
1076  default:
1077  return false;
1078  }
1079 }
1080 
1081 
1082 bool
1084  const int activeScheme = c.getActive();
1085  myShapeColors.clear();
1086  switch (activeScheme) {
1087  case 9: // color by height at segment start
1088  for (PositionVector::const_iterator ii = getShape().begin(); ii != getShape().end() - 1; ++ii) {
1089  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
1090  }
1091  return true;
1092  case 11: // color by inclination at segment start
1093  for (int ii = 1; ii < (int)getShape().size(); ++ii) {
1094  const double inc = (getShape()[ii].z() - getShape()[ii - 1].z()) / MAX2(POSITION_EPS, getShape()[ii].distanceTo2D(getShape()[ii - 1]));
1095  myShapeColors.push_back(c.getScheme().getColor(inc));
1096  }
1097  return true;
1098  default:
1099  return false;
1100  }
1101 }
1102 
1103 
1104 double
1105 GNELane::getColorValue(const GUIVisualizationSettings& s, int activeScheme) const {
1106  const SVCPermissions myPermissions = myParentEdge.getNBEdge()->getPermissions(myIndex);
1107  switch (activeScheme) {
1108  case 0:
1109  switch (myPermissions) {
1110  case SVC_PEDESTRIAN:
1111  return 1;
1112  case SVC_BICYCLE:
1113  return 2;
1114  case 0:
1115  return 3;
1116  case SVC_SHIP:
1117  return 4;
1118  default:
1119  break;
1120  }
1121  if (isRailway(myPermissions)) {
1122  return 5;
1123  } else if ((myPermissions & SVC_PASSENGER) != 0) {
1124  return 0;
1125  } else {
1126  return 6;
1127  }
1128  case 1:
1130  case 2:
1131  return (double)myPermissions;
1132  case 3:
1134  case 4:
1135  return myParentEdge.getNBEdge()->getNumLanes();
1136  case 5: {
1138  }
1139  // case 6: by angle (functional)
1140  case 7: {
1141  return myParentEdge.getNBEdge()->getPriority();
1142  }
1143  case 8: {
1144  // color by z of first shape point
1145  return getShape()[0].z();
1146  }
1147  // case 9: by segment height
1148  case 10: {
1149  // color by incline
1150  return (getShape()[-1].z() - getShape()[0].z()) / myParentEdge.getNBEdge()->getLength();
1151  }
1152  // case 11: by segment incline
1153 
1154  case 12: {
1155  // by numerical edge param value
1156  try {
1158  } catch (NumberFormatException&) {
1159  WRITE_WARNING("Edge parameter '" + myParentEdge.getNBEdge()->getParameter(s.edgeParam, "0") + "' key '" + s.edgeParam + "' is not a number for edge '" + myParentEdge.getID() + "'");
1160  return 0;
1161  }
1162  }
1163  case 13: {
1164  // by numerical lane param value
1165  try {
1167  } catch (NumberFormatException&) {
1168  WRITE_WARNING("Lane parameter '" + myParentEdge.getNBEdge()->getLaneStruct(myIndex).getParameter(s.laneParam, "0") + "' key '" + s.laneParam + "' is not a number for lane '" + getID() + "'");
1169  return 0;
1170  }
1171  }
1172  }
1173  return 0;
1174 }
1175 
1176 
1177 void
1179  // iterate over all additional parents of lane
1180  for (auto i : myFirstAdditionalParents) {
1181  // Obtain attribute LANES of additional
1182  std::vector<std::string> laneIDs = parse<std::vector<std::string> >(i->getAttribute(SUMO_ATTR_LANES));
1183  // check that at least there is an lane
1184  if (laneIDs.empty()) {
1185  throw ProcessError("Additional lane childs is empty");
1186  } else if ((laneIDs.size() == 1) && (allowEmpty == false)) {
1187  // remove entire Additional if SUMO_ATTR_LANES cannot be empty
1188  if (laneIDs.front() == getID()) {
1189  undoList->add(new GNEChange_Additional(i, false), true);
1190  } else {
1191  throw ProcessError("lane ID wasnt' found in Additional");
1192  }
1193  } else {
1194  auto it = std::find(laneIDs.begin(), laneIDs.end(), getID());
1195  if (it != laneIDs.end()) {
1196  // set new attribute in Additional
1197  laneIDs.erase(it);
1198  i->setAttribute(SUMO_ATTR_LANES, toString(laneIDs), undoList);
1199  } else {
1200  throw ProcessError("lane ID wasnt' found in Additional");
1201  }
1202  }
1203  }
1204 }
1205 
1206 
1207 bool
1210 }
1211 
1212 
1213 bool
1215  return isWaterway(myParentEdge.getNBEdge()->getPermissions(myIndex)) && s.showRails && !s.drawForSelecting; // reusing the showRails setting
1216 }
1217 
1218 
1219 void
1220 GNELane::drawDirectionIndicators(double exaggeration, bool spreadSuperposed) const {
1221  const double width = MAX2(NUMERICAL_EPS, (myParentEdge.getNBEdge()->getLaneWidth(myIndex) * exaggeration
1222  * (spreadSuperposed ? 0.4 : 1)));
1223  const double sideOffset = spreadSuperposed ? width * -0.5 : 0;
1224  glPushMatrix();
1225  glTranslated(0, 0, GLO_JUNCTION + 0.1);
1226  int e = (int) getShape().size() - 1;
1227  for (int i = 0; i < e; ++i) {
1228  glPushMatrix();
1229  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
1230  glRotated(myShapeRotations[i], 0, 0, 1);
1231  for (double t = 0; t < myShapeLengths[i]; t += width) {
1232  const double length = MIN2(width * 0.5, myShapeLengths[i] - t);
1233  glBegin(GL_TRIANGLES);
1234  glVertex2d(sideOffset, -t - length);
1235  glVertex2d(sideOffset - width * 0.25, -t);
1236  glVertex2d(sideOffset + width * 0.25, -t);
1237  glEnd();
1238  }
1239  glPopMatrix();
1240  }
1241  glPopMatrix();
1242 }
1243 
1244 
1245 
1246 std::string
1248  return myParentEdge.getMicrosimID();
1249 }
1250 
1251 
1252 long
1253 GNELane::onDefault(FXObject* obj, FXSelector sel, void* data) {
1254  myNet->getViewNet()->getViewParent()->getTLSEditorFrame()->handleMultiChange(this, obj, sel, data);
1255  return 1;
1256 }
1257 
1258 
1259 GNEEdge&
1261  return myParentEdge;
1262 }
1263 
1264 
1265 std::vector<GNEConnection*>
1267  // Declare a vector to save incoming connections
1268  std::vector<GNEConnection*> incomingConnections;
1269  // Obtain incoming edges if junction source was already created
1270  GNEJunction* junctionSource = myParentEdge.getGNEJunctionSource();
1271  if (junctionSource) {
1272  // Iterate over incoming GNEEdges of junction
1273  for (auto i : junctionSource->getGNEIncomingEdges()) {
1274  // Iterate over connection of incoming edges
1275  for (auto j : i->getGNEConnections()) {
1276  if (j->getNBEdgeConnection().fromLane == getIndex()) {
1277  incomingConnections.push_back(j);
1278  }
1279  }
1280  }
1281  }
1282  return incomingConnections;
1283 }
1284 
1285 
1286 std::vector<GNEConnection*>
1288  // Obtain GNEConnection of edge parent
1289  const std::vector<GNEConnection*>& edgeConnections = myParentEdge.getGNEConnections();
1290  std::vector<GNEConnection*> outcomingConnections;
1291  // Obtain outgoing connections
1292  for (auto i : edgeConnections) {
1293  if (i->getNBEdgeConnection().fromLane == getIndex()) {
1294  outcomingConnections.push_back(i);
1295  }
1296  }
1297  return outcomingConnections;
1298 }
1299 
1300 
1301 void
1303  // update incoming connections of lane
1304  std::vector<GNEConnection*> incomingConnections = getGNEIncomingConnections();
1305  for (auto i : incomingConnections) {
1306  i->updateID();
1307  }
1308  // update outocming connections of lane
1309  std::vector<GNEConnection*> outcomingConnections = getGNEOutcomingConnections();
1310  for (auto i : outcomingConnections) {
1311  i->updateID();
1312  }
1313 }
1314 
1315 
1316 double
1318  // factor should not be 0
1319  if (myParentEdge.getNBEdge()->getFinalLength() > 0) {
1321  } else {
1322  return POSITION_EPS;
1323  };
1324 }
1325 
1326 
1327 void
1329  // Lanes don't need to save the current Centering Boundary, due they are parts of an Edge
1330  // Save current centering boundary of additional childs
1331  for (auto i : myAdditionalChilds) {
1332  i->startGeometryMoving();
1333  }
1334  // Save current centering boundary of additionals with this lane as chid
1335  for (auto i : myFirstAdditionalParents) {
1336  i->startGeometryMoving();
1337  }
1338  // Save current centering boundary of POIs associated to this lane
1339  for (auto i : myShapes) {
1340  i->startGeometryMoving();
1341  }
1342 }
1343 
1344 
1345 void
1347  // Lanes don't need to save the current Centering Boundary, due they are parts of an Edge
1348  // Restore centering boundary of additionals with this lane as chid
1349  for (auto i : myAdditionalChilds) {
1350  i->endGeometryMoving();
1351  }
1352  // Restore centering boundary of additionals with this lane as chid
1353  for (auto i : myFirstAdditionalParents) {
1354  i->endGeometryMoving();
1355  }
1356  // Restore centering boundary of POIs associated to this lane
1357  for (auto i : myShapes) {
1358  i->endGeometryMoving();
1359  }
1360 }
1361 
1362 /****************************************************************************/
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
remove inner geometry
Definition: GUIAppEnum.h:704
int getConnectionIndex(const NBEdge *from, const NBEdge::Connection &con) const
return the index of the given connection
Definition: NBNode.cpp:3007
The link is a partial left direction.
std::string getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a &#39; &#39;.
double getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:488
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and some lane function ...
Definition: GNELane.cpp:1083
std::vector< double > myShapeLengths
The lengths of the shape parts.
Definition: GNELane.h:234
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
Definition: GNENet.cpp:1044
Position getPositionInView() const
Return current position.
void drawLane2LaneConnections() const
draw lane to lane connections
Definition: GNELane.cpp:201
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:1855
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
Definition: GNELane.cpp:823
const std::vector< T > & getSchemes() const
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNELane.cpp:1247
double scale
information about a lane&#39;s width (temporary, used for a single view)
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:154
PositionVector shape
The lane&#39;s shape.
Definition: NBEdge.h:121
whether a given shape is user-defined
GNENet * myNet
the net to inform about updates
is a pedestrian
mode for moving things
Definition: GNEViewNet.h:48
std::string next()
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:178
double z() const
Returns the z-position.
Definition: Position.h:67
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
begin/end of the description of a single lane
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNELane.cpp:484
smooth geometry
Definition: GUIAppEnum.h:706
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
NBNode * myTo
Definition: NBEdge.h:1454
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3222
double getLaneSpeed(int lane) const
get lane speed
Definition: NBEdge.cpp:1837
const RGBColor * mySpecialColor
optional special color
Definition: GNELane.h:247
void updateGeometry(bool updateGrid)
update pre-computed geometry information
Definition: GNELane.cpp:697
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:683
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb.
Definition: RGBColor.cpp:299
static const RGBColor WHITE
Definition: RGBColor.h:191
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:244
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3272
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
Boundary getBoundary() const
returns the boundry (including lanes)
Definition: GNELane.cpp:687
GUIColorer laneColorer
The lane colorer.
Stores the information about how to visualize structures.
This is an uncontrolled, minor link, has to stop.
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:427
vehicle is a bicycle
const double SUMO_const_laneWidth
Definition: StdDefs.h:51
static const double SNAP_RADIUS
Definition: GNEEdge.h:274
reverse an edge
Definition: GUIAppEnum.h:716
split an edge
Definition: GUIAppEnum.h:712
GNEViewParent * getViewParent() const
get the net object
double y() const
Returns the y-position.
Definition: Position.h:62
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
interpolate z values linear between junctions
Definition: GUIAppEnum.h:708
split an edge
Definition: GUIAppEnum.h:714
The representation of a single edge during network building.
Definition: NBEdge.h:65
bool showRails
Information whether rails shall be drawn.
The link is a 180 degree turn.
smooth elevation with regard to adjoining edges
Definition: GUIAppEnum.h:710
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
Definition: GNEEdge.cpp:1584
double x() const
Returns the x-position.
Definition: Position.h:57
mode for editing tls
Definition: GNEViewNet.h:58
const std::vector< double > & getShapeRotations() const
returns the vector with the shape rotations
Definition: GNELane.cpp:675
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition: NBEdge.cpp:668
std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
Definition: GNELane.cpp:860
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, int align=0, double width=-1)
Definition: GLHelper.cpp:611
T MAX2(T a, T b)
Definition: StdDefs.h:76
transform lane to bikelane
Definition: GUIAppEnum.h:789
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given ...
Definition: NBEdge.cpp:3303
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:47
int editMode
the current NETEDIT mode (temporary)
bool showLaneDirection
Whether to show direction indicators for lanes.
double getSpeed() const
returns the current speed of lane
Definition: GNELane.cpp:769
double endOffset
This lane&#39;s offset to the intersection begin.
Definition: NBEdge.h:133
bool laneShowBorders
Information whether lane borders shall be drawn.
GNELane()
FOX needs this.
Definition: GNELane.cpp:66
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GNELane.h:250
This is an uncontrolled, right-before-left link.
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition: GNELane.cpp:1208
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::vector< GNEConnection * > & getGNEConnections()
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:879
void handleMultiChange(GNELane *lane, FXObject *obj, FXSelector sel, void *data)
update phase definition for the current traffic light and phase
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
const SVCPermissions SVCAll
all VClasses are allowed
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1206
The link is controlled by a tls which is off, not blinking, may pass.
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:344
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
This is an uncontrolled, all-way stop link.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
generic attribute
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:258
void setIndex(int index)
Definition: GNELane.cpp:762
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
int myIndex
The index of this lane.
Definition: GNELane.h:226
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some lane function
Definition: GNELane.cpp:1069
This is an uncontrolled, zipper-merge link.
The link is a (hard) left direction.
std::vector< std::string > getStrings() const
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:241
GNETLSEditorFrame * getTLSEditorFrame() const
get frame for GNE_MODE_TLS
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
Definition: NBEdge.cpp:3295
bool accelRamp
Whether this lane is an acceleration lane.
Definition: NBEdge.h:146
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
Definition: NBEdge.cpp:3287
std::vector< double > myLaneRestrictedTextureRotations
Rotations of textures of restricted lanes.
Definition: GNELane.h:240
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNELane.cpp:251
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
The link is a straight direction.
std::string edgeParam
key for coloring by edge parameter
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1117
remove bikelane
Definition: GUIAppEnum.h:805
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
Definition: GNELane.cpp:1214
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:180
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:757
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNELane.cpp:946
double getLaneParametricLength() const
returns the parameteric length of the lane
Definition: GNELane.cpp:775
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
add bikelane
Definition: GUIAppEnum.h:797
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:573
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:1260
void endGeometryMoving()
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
Definition: GNELane.cpp:1346
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNELane.cpp:870
virtual FXuint size() const
return actual size
Definition: GNEChange.cpp:45
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNELane.cpp:931
transform lane to busLane
Definition: GUIAppEnum.h:791
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:234
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
This is an uncontrolled, minor link, has to brake.
std::string getLaneID(int lane) const
get Lane ID (Secure)
Definition: NBEdge.cpp:3022
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:420
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
A list of positions.
bool controlsEdge(GNEEdge &edge) const
whether the given edge is controlled by the currently edited tlDef
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
bool isLogicValid()
whether this junction has a valid logic
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1160
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
void removeLaneOfAdditionalParents(GNEUndoList *undoList, bool allowEmpty)
remove lane of Additional Parent
Definition: GNELane.cpp:1178
std::vector< double > myShapeRotations
Definition: GNELane.h:231
friend class GNEChange_Attribute
declare friend class
T get(const std::string &str) const
const double SUMO_const_laneMarkWidth
Definition: StdDefs.h:57
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1266
void addShapeChild(GNEShape *shape)
add shape child to this lane
Definition: GNELane.cpp:792
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:464
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
void drawArrows() const
draw arrows
Definition: GNELane.cpp:131
double getLengthGeometryFactor() const
get lenght geometry factor
Definition: GNELane.cpp:1317
GUIVisualizationTextSettings drawLinkTLIndex
T MIN2(T a, T b)
Definition: StdDefs.h:70
static void drawOutlineCircle(double width, double iwidth, int steps=8)
Draws an unfilled circle around (0,0)
Definition: GLHelper.cpp:389
The link is a (hard) right direction.
void drawMarkings(const GUIVisualizationSettings &s, double scale) const
draw lane markings
Definition: GNELane.cpp:443
#define POSITION_EPS
Definition: config.h:172
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:301
GUIColorer junctionColorer
The junction colorer.
std::vector< GNEShape * > myShapes
list with the shapes vinculated with this lane
Definition: GNELane.h:244
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string getID() const
function to support debugging
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNELane.cpp:957
remove busLane
Definition: GUIAppEnum.h:807
const T getColor(const double value) const
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:270
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition: GNELane.cpp:1287
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1475
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:458
double laneMinSize
The minimum visual lane width for drawing.
The link is a partial right direction.
double getLaneShapeLength() const
returns the length of the lane&#39;s shape
Definition: GNELane.cpp:786
void startGeometryMoving()
Definition: GNELane.cpp:1328
double width
This lane&#39;s width.
Definition: NBEdge.h:140
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3331
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:3575
void move2side(double amount)
move position vector to side using certain ammount
vehicle is a passenger car (a "normal" car)
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
add busLane
Definition: GUIAppEnum.h:799
is an arbitrary ship
std::string getAttribute(SumoXMLAttr key) const
Definition: GNELane.cpp:829
begin/end of the description of an edge
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream&#39;s direction.
Definition: NBNode.cpp:1764
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
EditMode getCurrentEditMode() const
get the current edit mode
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
transform lane to sidewalk
Definition: GUIAppEnum.h:787
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEEdge & myParentEdge
The Edge that to which this lane belongs.
Definition: GNELane.h:220
vehicle is a bus
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:530
change default geometry endpoints
Definition: GUIAppEnum.h:700
virtual void updateGeometry(bool updateGrid)=0
update pre-computed geometry information
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:669
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
double selectionScale
the current selection scaling in NETEDIT (temporary)
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:617
double length() const
Returns the length.
void updateConnectionIDs()
update IDs of incoming connections of this lane
Definition: GNELane.cpp:1302
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
Definition: GNELane.cpp:1253
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:855
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:1031
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
#define M_PI
Definition: odrSpiral.cpp:40
static void drawShapeDottedContour(const int type, const PositionVector &shape, const double width)
draw a dotted contour around the given Non closed shape with certain width
Definition: GLHelper.cpp:471
void drawTLSLinkNo(const GUIVisualizationSettings &s) const
draw TLS Link Number
Definition: GNELane.cpp:103
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
The link is controlled by a tls which is off and blinks, has to brake.
add reverse edge
Definition: GUIAppEnum.h:718
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:696
const std::string & getTagStr() const
get tag assigned to this object in string format
std::vector< Position > myLaneRestrictedTexturePositions
Position of textures of restricted lanes.
Definition: GNELane.h:237
element is selected
void setSpecialColor(const RGBColor *Color2)
Definition: GNELane.cpp:982
The popup menu of a globject.
an edge
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
static int getCircleResolution(const GUIVisualizationSettings &settings)
function to calculate circle resolution for all circles drawn in drawGL(...) functions ...
void mouseOverObject(const GUIVisualizationSettings &s) const
method for check if mouse is over objects
Definition: GNELane.cpp:1044
duplicate a lane
Definition: GUIAppEnum.h:783
This is an uncontrolled, major link, may pass.
reset default geometry endpoints
Definition: GUIAppEnum.h:702
void drawLinkNo(const GUIVisualizationSettings &s) const
draw link Number
Definition: GNELane.cpp:79
void drawLinkRules() const
draw link rules
Definition: GNELane.cpp:126
static const StringBijection< FXuint > LinkStateNames
long names for link states
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:114
Represents a single node (junction) during network building.
Definition: NBNode.h:68
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
GUIGlID getGlID() const
Returns the numerical id of the object.
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
The link is a 180 degree turn (left-hand network)
std::vector< GNEAdditional * > myAdditionalChilds
list of Additional Childs of this NetElement
void drawDirectionIndicators(double exaggeration, bool spreadSuperposed) const
direction indicators for lanes
Definition: GNELane.cpp:1220
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:436
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
void removeShapeChild(GNEShape *shape)
remove shape child of this lane
Definition: GNELane.cpp:805
std::vector< GNEAdditional * > myFirstAdditionalParents
list of Additional parents of this NetElement
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
#define NUMERICAL_EPS
Definition: config.h:148
void setLaneColor(const GUIVisualizationSettings &s) const
set color according to edit mode and visualisation settings
Definition: GNELane.cpp:1049
mode for connecting lanes
Definition: GNEViewNet.h:56
mode for creating new edges
Definition: GNEViewNet.h:46
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:132
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNELane.cpp:894
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:613
const std::vector< double > & getShapeLengths() const
returns the vector with the shape lengths
Definition: GNELane.cpp:681
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn&#39;t set.
Definition: NBEdge.h:497
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
return value for lane coloring according to the given scheme
Definition: GNELane.cpp:1105
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1153
PositionVector customShape
A custom shape for this lane set by the user.
Definition: NBEdge.h:153
const std::vector< GNEShape * > & getShapeChilds() const
get shape childs of lane
Definition: GNELane.cpp:817
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
GUIVisualizationTextSettings drawLinkJunctionIndex
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:441
vehicles ignoring classes
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNELane.cpp:660
~GNELane()
Destructor.
Definition: GNELane.cpp:74
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3174
transform lane to greenVerge
Definition: GUIAppEnum.h:793
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1730
The link has no direction (is a dead end link)
void clearParameter()
Clears the parameter map.
a junction
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:579