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