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