Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A class for visualizing Lane geometry (adapted from GNELaneWrapper)
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
27 #include <utils/gui/div/GLHelper.h>
31 #include <netedit/GNEUndoList.h>
32 #include <netedit/GNENet.h>
33 #include <netedit/GNEViewNet.h>
34 #include <netedit/GNEViewParent.h>
40 
41 #include "GNELane.h"
42 #include "GNEEdge.h"
43 #include "GNEJunction.h"
44 #include "GNEInternalLane.h"
45 #include "GNEConnection.h"
46 
47 // ===========================================================================
48 // FOX callback mapping
49 // ===========================================================================
50 
51 // Object implementation
52 FXIMPLEMENT(GNELane, FXDelegator, 0, 0)
53 
54 // ===========================================================================
55 // method definitions
56 // ===========================================================================
57 
58 GNELane::GNELane(GNEEdge& edge, const int index) :
59  GNENetElement(edge.getNet(), edge.getNBEdge()->getLaneID(index), GLO_LANE, SUMO_TAG_LANE),
60  myParentEdge(edge),
61  myIndex(index),
62  mySpecialColor(nullptr) {
63 }
64 
66  GNENetElement(nullptr, "dummyConstructorGNELane", GLO_LANE, SUMO_TAG_LANE),
67  myParentEdge(GNEEdge::getDummyEdge()),
68  myIndex(-1),
69  mySpecialColor(nullptr) {
70 }
71 
72 
74 }
75 
76 std::string
78  // currently unused
79  return "";
80 }
81 
82 
83 void
85  // Clear containers
89  //double length = myParentEdge.getLength(); // @todo see ticket #448
90  // may be different from length
91  // Obtain lane and shape rotations
94  // update shapes parents associated with this lane
95  for (auto i : getShapeParents()) {
96  i->updateGeometry();
97  }
98  // update shape children associated with this lane
99  for (auto i : getShapeChildren()) {
100  i->updateGeometry();
101  }
102  // update additionals parents associated with this lane
103  for (auto i : getAdditionalChildren()) {
104  i->updateGeometry();
105  }
106  // update additionals children associated with this lane
107  for (auto i : getAdditionalParents()) {
108  i->updateGeometry();
109  }
110  // update demand elements parents associated with this lane
111  for (auto i : getDemandElementParents()) {
112  i->updateGeometry();
113  }
114  // update demand elements children associated with this lane
115  for (auto i : getDemandElementChildren()) {
116  i->updateGeometry();
117  }
118  // In Move mode, connections aren't updated
120  // Update incoming connections of this lane
121  auto incomingConnections = getGNEIncomingConnections();
122  for (auto i : incomingConnections) {
123  i->updateGeometry();
124  }
125  // Update outgoings connections of this lane
126  auto outGoingConnections = getGNEOutcomingConnections();
127  for (auto i : outGoingConnections) {
128  i->updateGeometry();
129  }
130  }
131  // If lane has enought length for show textures of restricted lanes
132  if ((getLaneShapeLength() > 4)) {
133  // if lane is restricted
135  // get values for position and rotation of icons
136  for (int i = 2; i < getLaneShapeLength() - 1; i += 15) {
139  }
140  }
141  }
142 }
143 
144 
145 Position
147  // currently unused
148  return Position(0, 0);
149 }
150 
151 
152 void
154  const std::vector<NBEdge::Connection>& cons = myParentEdge.getNBEdge()->getConnectionsFromLane(myIndex);
155  int noLinks = (int)cons.size();
156  if (noLinks == 0) {
157  return;
158  }
159  // draw all links
160  glPushMatrix();
161  glTranslated(0, 0, GLO_JUNCTION + 0.5);
162  double w = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
163  double x1 = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2;
164  const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
165  for (int i = noLinks; --i >= 0;) {
166  double x2 = x1 - (double)(w / 2.);
168  cons[lefthand ? noLinks - 1 - i : i]);
170  x1 -= w;
171  }
172  glPopMatrix();
173 }
174 
175 
176 void
178  const std::vector<NBEdge::Connection>& cons = myParentEdge.getNBEdge()->getConnectionsFromLane(myIndex);
179  int noLinks = (int)cons.size();
180  if (noLinks == 0) {
181  return;
182  }
183  // draw all links
184  glPushMatrix();
185  glTranslated(0, 0, GLO_JUNCTION + 0.5);
186  double w = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
187  double x1 = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2;
188  const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
189  for (int i = noLinks; --i >= 0;) {
190  double x2 = x1 - (double)(w / 2.);
191  int linkNo = cons[lefthand ? noLinks - 1 - i : i].tlLinkIndex;
193  x1 -= w;
194  }
195  glPopMatrix();
196 }
197 
198 
199 void
201 }
202 
203 
204 void
206  const Position& end = myGeometry.shape.back();
207  const Position& f = myGeometry.shape[-2];
208  double rot = (double) atan2((end.x() - f.x()), (f.y() - end.y())) * (double) 180.0 / (double)M_PI;
209  glPushMatrix();
210  glPushName(0);
211  glTranslated(0, 0, GLO_JUNCTION + .1); // must draw on top of junction shape
212  glColor3d(1, 1, 1);
213  glTranslated(end.x(), end.y(), 0);
214  glRotated(rot, 0, 0, 1);
215  // draw all links
216  const std::vector<NBEdge::Connection>& edgeCons = myParentEdge.getNBEdge()->myConnections;
217  NBNode* dest = myParentEdge.getNBEdge()->myTo;
218  for (auto i : edgeCons) {
219  if (i.fromLane == myIndex) {
220  LinkDirection dir = dest->getDirection(myParentEdge.getNBEdge(), i.toEdge, OptionsCont::getOptions().getBool("lefthand"));
221  switch (dir) {
222  case LINKDIR_STRAIGHT:
223  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
224  GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25);
225  break;
226  case LINKDIR_LEFT:
227  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
228  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
229  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25);
230  break;
231  case LINKDIR_RIGHT:
232  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
233  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
234  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25);
235  break;
236  case LINKDIR_TURN:
237  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
238  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
239  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
240  GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25);
241  break;
243  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
244  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
245  GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
246  GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25);
247  break;
248  case LINKDIR_PARTLEFT:
249  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
250  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
251  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25);
252  break;
253  case LINKDIR_PARTRIGHT:
254  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
255  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
256  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25);
257  break;
258  case LINKDIR_NODIR:
259  GLHelper::drawBoxLine(Position(1, 5.8), 245, 2, .05);
260  GLHelper::drawBoxLine(Position(-1, 5.8), 115, 2, .05);
261  glTranslated(0, 5, 0);
262  GLHelper::drawOutlineCircle(0.9, 0.8, 32);
263  glTranslated(0, -5, 0);
264  break;
265  }
266  }
267  }
268  glPopName();
269  glPopMatrix();
270 }
271 
272 
273 void
275  glPushMatrix();
276  glPushName(0);
277  glTranslated(0, 0, GLO_JUNCTION + .1); // must draw on top of junction shape
278  std::vector<NBEdge::Connection> connections = myParentEdge.getNBEdge()->getConnectionsFromLane(myIndex);
279  NBNode* node = myParentEdge.getNBEdge()->getToNode();
280  const Position& startPos = myGeometry.shape[-1];
281  for (auto it : connections) {
282  const LinkState state = node->getLinkState(myParentEdge.getNBEdge(), it.toEdge, it.fromLane, it.toLane, it.mayDefinitelyPass, it.tlID);
283  switch (state) {
285  glColor3d(1, 1, 0);
286  break;
288  glColor3d(0, 1, 1);
289  break;
290  case LINKSTATE_MAJOR:
291  glColor3d(1, 1, 1);
292  break;
293  case LINKSTATE_MINOR:
294  glColor3d(.4, .4, .4);
295  break;
296  case LINKSTATE_STOP:
297  glColor3d(.7, .4, .4);
298  break;
299  case LINKSTATE_EQUAL:
300  glColor3d(.7, .7, .7);
301  break;
303  glColor3d(.7, .7, 1);
304  break;
305  case LINKSTATE_ZIPPER:
306  glColor3d(.75, .5, 0.25);
307  break;
308  default:
309  throw ProcessError("Unexpected LinkState '" + toString(state) + "'");
310  }
311  const Position& endPos = it.toEdge->getLaneShape(it.toLane)[0];
312  glBegin(GL_LINES);
313  glVertex2d(startPos.x(), startPos.y());
314  glVertex2d(endPos.x(), endPos.y());
315  glEnd();
316  GLHelper::drawTriangleAtEnd(startPos, endPos, (double) 1.5, (double) .2);
317  }
318  glPopName();
319  glPopMatrix();
320 }
321 
322 
323 void
325  // Push draw matrix 1
326  glPushMatrix();
327  // Push name
328  glPushName(getGlID());
329  // Traslate to fromt
330  glTranslated(0, 0, myParentEdge.getNBEdge()->getLength() < 1 ? GLO_JUNCTION + 1 : getType());
331  const RGBColor color = setLaneColor(s);
332  // start drawing lane checking whether it is not too small
333  const double selectionScale = isAttributeCarrierSelected() || myParentEdge.isAttributeCarrierSelected() ? s.selectionScale : 1;
334  double exaggeration = selectionScale * s.laneWidthExaggeration; // * s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive()));
335  // XXX apply usefull scale values
336  //exaggeration *= s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive()));
337  // recognize full transparency and simply don't draw
338  if (color.alpha() == 0 || (s.scale * exaggeration < s.laneMinSize)) {
339  // Pop draw matrix 1
340  glPopMatrix();
341  // Pop Lane Name
342  glPopName();
343  } else if (s.scale * exaggeration < 1.) {
344  // draw as lines, depending of myShapeColors
345  if (myShapeColors.size() > 0) {
347  } else {
349  }
350  // Pop draw matrix 1
351  glPopMatrix();
352  // Pop Lane Name
353  glPopName();
354  } else {
355  // we draw the lanes with reduced width so that the lane markings below are visible
356  // (this avoids artifacts at geometry corners without having to
357  // compute lane-marking intersection points)
358  const double halfWidth2 = exaggeration * (myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2 - SUMO_const_laneMarkWidth / 2);
359  // Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen
360  const double halfWidth = drawUsingSelectColor() ? halfWidth2 - exaggeration * 0.3 : halfWidth2;
361  const bool spreadSuperposed = s.spreadSuperposed && drawAsRailway(s) && myParentEdge.getNBEdge()->isBidiRail();
362  // Check if lane has to be draw as railway and if isn't being drawn for selecting
363  if (drawAsRailway(s) && (!s.drawForSelecting || spreadSuperposed)) {
365  const double width = myParentEdge.getNBEdge()->getLaneWidth(myIndex);
366  // draw as railway: assume standard gauge of 1435mm when lane width is not set
367  // draw foot width 150mm, assume that distance between rail feet inner sides is reduced on both sides by 39mm with regard to the gauge
368  // assume crosstie length of 181% gauge (2600mm for standard gauge)
369  double halfGauge = 0.5 * (width == SUMO_const_laneWidth ? 1.4350 : width) * exaggeration;
370  if (spreadSuperposed) {
371  shape.move2side(halfGauge * 0.8);
372  halfGauge *= 0.4;
373  //std::cout << "spreadSuperposed " << getID() << " old=" << myGeometry.shape << " new=" << shape << "\n";
374  }
375  const double halfInnerFeetWidth = halfGauge - 0.039 * exaggeration;
376  const double halfRailWidth = halfInnerFeetWidth + 0.15 * exaggeration;
377  const double halfCrossTieWidth = halfGauge * 1.81;
378  // Draw box depending of myShapeColors
379  if (myShapeColors.size() > 0) {
381  } else {
383  }
384  // Save current color
385  RGBColor current = GLHelper::getColor();
386  // Draw gray on top with reduced width (the area between the two tracks)
387  glColor3d(0.8, 0.8, 0.8);
388  glTranslated(0, 0, .1);
390  // Set current color back
391  GLHelper::setColor(current);
392  // Draw crossties
393  GLHelper::drawCrossTies(shape, myGeometry.shapeRotations, myGeometry.shapeLengths, 0.26 * exaggeration, 0.6 * exaggeration, halfCrossTieWidth, s.drawForSelecting);
394  } else {
395  if (myShapeColors.size() > 0) {
397  } else {
399  }
400  }
401  if (halfWidth != halfWidth2 && !spreadSuperposed) {
402  // draw again to show the selected edge
404  glTranslated(0, 0, -.1);
406  }
407  // check if dotted contour has to be drawn
408  if (myNet->getViewNet()->getDottedAC() == this) {
410  }
411  // Pop draw matrix 1
412  glPopMatrix();
413  // only draw details depending of the scale and if isn't being drawn for selecting
414  if ((s.scale >= 10) && !s.drawForSelecting) {
415  // if exaggeration is 1, draw drawMarkings
416  if (s.laneShowBorders && exaggeration == 1 && !drawAsRailway(s)) {
417  drawMarkings(s, exaggeration);
418  }
419  // draw ROWs only if target junction has a valid logic)
421  drawArrows();
422  }
423  // Draw direction indicators if the correspondient option is enabled
424  if (s.showLaneDirection) {
425  if (drawAsRailway(s)) {
426  // improve visibility of superposed rail edges
427  setLaneColor(s);
428  } else {
429  glColor3d(0.3, 0.3, 0.3);
430  }
431  drawDirectionIndicators(exaggeration, spreadSuperposed);
432  }
433  if (s.drawLinkJunctionIndex.show) {
434  drawLinkNo(s);
435  }
436  if (s.drawLinkTLIndex.show) {
437  drawTLSLinkNo(s);
438  }
439  }
440  // If there are texture of restricted lanes to draw, check if icons can be drawn
441  if (!s.drawForSelecting && !OptionsCont::getOptions().getBool("disable-laneIcons") && (myLaneRestrictedTexturePositions.size() > 0) && s.drawDetail(s.detailSettings.laneTextures, exaggeration)) {
442  // Declare default width of icon (3)
443  double iconWidth = 1;
444  // Obtain width of icon, if width of lane is different
446  iconWidth = myParentEdge.getNBEdge()->getLaneStruct(myIndex).width / 3;
447  }
448  // Draw list of icons
449  for (int i = 0; i < (int)myLaneRestrictedTexturePositions.size(); i++) {
450  // Push draw matrix 2
451  glPushMatrix();
452  // Set white color
453  glColor3d(1, 1, 1);
454  // Traslate matrix 2
455  glTranslated(myLaneRestrictedTexturePositions.at(i).x(), myLaneRestrictedTexturePositions.at(i).y(), getType() + 0.1);
456  // Rotate matrix 2
457  glRotated(myLaneRestrictedTextureRotations.at(i), 0, 0, -1);
458  glRotated(90, 0, 0, 1);
459  // draw texture box depending of type of restriction
462  } else if (isRestricted(SVC_BICYCLE)) {
464  } else if (isRestricted(SVC_BUS)) {
466  }
467  // Pop draw matrix 2
468  glPopMatrix();
469  }
470  }
471  // draw a Start/endPoints if lane has a custom shape
474  }
475  // Pop Lane Name
476  glPopName();
477  // draw parents
478  for (const auto& i : getAdditionalParents()) {
479  if (i->getTagProperty().getTag() == SUMO_TAG_VSS) {
480  // draw VSS Symbol
481  drawVSSSymbol(s, i);
482  }
483  }
484  // draw shape children
485  for (const auto& i : getShapeChildren()) {
486  i->drawGL(s);
487  }
488  // draw additional children
489  for (const auto& i : getAdditionalChildren()) {
490  // check that ParkingAreas aren't draw two times
491  if (!i->getTagProperty().isPlacedInRTree()) {
492  i->drawGL(s);
493  }
494  }
495  // draw demand element children
496  for (const auto& i : getDemandElementChildren()) {
497  if (!i->getTagProperty().isPlacedInRTree()) {
498  i->drawGL(s);
499  }
500  }
501  }
502 }
503 
504 
505 void
506 GNELane::drawMarkings(const GUIVisualizationSettings& /* s */, double scale) const {
507  glPushMatrix();
508  glTranslated(0, 0, GLO_EDGE);
509  const double myHalfLaneWidth = myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2;
510  // optionally draw inverse markings
512  double mw = (myHalfLaneWidth + SUMO_const_laneMarkWidth) * scale;
513  double mw2 = (myHalfLaneWidth - SUMO_const_laneMarkWidth) * scale;
514  if (OptionsCont::getOptions().getBool("lefthand")) {
515  mw *= -1;
516  mw2 *= -1;
517  }
518  int e = (int) myGeometry.shape.size() - 1;
519  for (int i = 0; i < e; ++i) {
520  glPushMatrix();
521  glTranslated(myGeometry.shape[i].x(), myGeometry.shape[i].y(), 2.1);
522  glRotated(myGeometry.shapeRotations[i], 0, 0, 1);
523  for (double t = 0; t < myGeometry.shapeLengths[i]; t += 6) {
524  const double length = MIN2((double)3, myGeometry.shapeLengths[i] - t);
525  glBegin(GL_QUADS);
526  glVertex2d(-mw, -t);
527  glVertex2d(-mw, -t - length);
528  glVertex2d(-mw2, -t - length);
529  glVertex2d(-mw2, -t);
530  glEnd();
531  }
532  glPopMatrix();
533  }
534  }
535  // draw white boundings and white markings
536  glColor3d(1, 1, 1);
541  (myHalfLaneWidth + SUMO_const_laneMarkWidth) * scale);
542  glPopMatrix();
543 }
544 
545 
548  // first obtain edit mode (needed because certain Commands depend of current edit mode)
550  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
551  buildPopupHeader(ret, app);
553  // build copy names entry
554  if (editMode != GNE_NMODE_TLS) {
555  new FXMenuCommand(ret, "Copy edge parent name to clipboard", nullptr, ret, MID_COPY_EDGE_NAME);
557  }
558  // build selection
560  if (editMode != GNE_NMODE_TLS) {
561  // build show parameters menu
563  // build position copy entry
564  buildPositionCopyEntry(ret, false);
565  }
566  if (editMode != GNE_NMODE_CONNECT && editMode != GNE_NMODE_TLS && editMode != GNE_NMODE_CREATE_EDGE) {
567  // Get icons
568  FXIcon* pedestrianIcon = GUIIconSubSys::getIcon(ICON_LANEPEDESTRIAN);
569  FXIcon* bikeIcon = GUIIconSubSys::getIcon(ICON_LANEBIKE);
570  FXIcon* busIcon = GUIIconSubSys::getIcon(ICON_LANEBUS);
571  FXIcon* greenVergeIcon = GUIIconSubSys::getIcon(ICON_LANEGREENVERGE);
572  // Create basic commands
573  std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
574  const int edgeSelSize = (int)myNet->retrieveEdges(true).size();
575  if (edgeSelSize && myParentEdge.isAttributeCarrierSelected() && (edgeSelSize > 1)) {
576  edgeDescPossibleMulti = toString(edgeSelSize) + " " + toString(SUMO_TAG_EDGE) + "s";
577  }
578  // if lane is selected, calculate number of restricted lanes
579  bool edgeHasSidewalk = false;
580  bool edgeHasBikelane = false;
581  bool edgeHasBuslane = false;
582  bool edgeHasGreenVerge = false;
583  bool differentLaneShapes = false;
585  auto selectedLanes = myNet->retrieveLanes(true);
586  for (auto i : selectedLanes) {
587  if (i->getParentEdge().hasRestrictedLane(SVC_PEDESTRIAN)) {
588  edgeHasSidewalk = true;
589  }
590  if (i->getParentEdge().hasRestrictedLane(SVC_BICYCLE)) {
591  edgeHasBikelane = true;
592  }
593  if (i->getParentEdge().hasRestrictedLane(SVC_BUS)) {
594  edgeHasBuslane = true;
595  }
596  if (i->getParentEdge().hasRestrictedLane(SVC_IGNORING)) {
597  edgeHasGreenVerge = true;
598  }
599  if (i->getParentEdge().getNBEdge()->getLaneStruct(i->getIndex()).customShape.size() != 0) {
600  differentLaneShapes = true;
601  }
602  }
603  } else {
604  edgeHasSidewalk = myParentEdge.hasRestrictedLane(SVC_PEDESTRIAN);
605  edgeHasBikelane = myParentEdge.hasRestrictedLane(SVC_BICYCLE);
606  edgeHasBuslane = myParentEdge.hasRestrictedLane(SVC_BUS);
607  edgeHasGreenVerge = myParentEdge.hasRestrictedLane(SVC_IGNORING);
608  differentLaneShapes = myParentEdge.getNBEdge()->getLaneStruct(myIndex).customShape.size() != 0;
609  }
610  // create menu pane for edge operations
611  FXMenuPane* edgeOperations = new FXMenuPane(ret);
612  ret->insertMenuPaneChild(edgeOperations);
613  new FXMenuCascade(ret, "edge operations", nullptr, edgeOperations);
614  // create menu commands for all edge oeprations
615  new FXMenuCommand(edgeOperations, "Split edge here", nullptr, &parent, MID_GNE_EDGE_SPLIT);
616  new FXMenuCommand(edgeOperations, "Split edge in both directions here", nullptr, &parent, MID_GNE_EDGE_SPLIT_BIDI);
617  new FXMenuCommand(edgeOperations, "Set geometry endpoint here (shift-click)", nullptr, &parent, MID_GNE_EDGE_EDIT_ENDPOINT);
618  new FXMenuCommand(edgeOperations, "Restore geometry endpoint (shift-click)", nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
619  new FXMenuCommand(edgeOperations, ("Reverse " + edgeDescPossibleMulti).c_str(), nullptr, &parent, MID_GNE_EDGE_REVERSE);
620  new FXMenuCommand(edgeOperations, ("Add reverse direction for " + edgeDescPossibleMulti).c_str(), nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE);
621  new FXMenuCommand(edgeOperations, ("Straighten " + edgeDescPossibleMulti).c_str(), nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN);
622  new FXMenuCommand(edgeOperations, ("Smooth " + edgeDescPossibleMulti).c_str(), nullptr, &parent, MID_GNE_EDGE_SMOOTH);
623  new FXMenuCommand(edgeOperations, ("Straighten elevation of " + edgeDescPossibleMulti).c_str(), nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN_ELEVATION);
624  new FXMenuCommand(edgeOperations, ("Smooth elevation of " + edgeDescPossibleMulti).c_str(), nullptr, &parent, MID_GNE_EDGE_SMOOTH_ELEVATION);
625  // create menu pane for lane operations
626  FXMenuPane* laneOperations = new FXMenuPane(ret);
627  ret->insertMenuPaneChild(laneOperations);
628  new FXMenuCascade(ret, "lane operations", nullptr, laneOperations);
629  new FXMenuCommand(laneOperations, "Duplicate lane", nullptr, &parent, MID_GNE_LANE_DUPLICATE);
630  if (differentLaneShapes) {
631  new FXMenuCommand(laneOperations, "reset custom shape", nullptr, &parent, MID_GNE_LANE_RESET_CUSTOMSHAPE);
632  }
633  // Create panel for lane operations and insert it in ret
634  FXMenuPane* addSpecialLanes = new FXMenuPane(laneOperations);
635  ret->insertMenuPaneChild(addSpecialLanes);
636  FXMenuPane* removeSpecialLanes = new FXMenuPane(laneOperations);
637  ret->insertMenuPaneChild(removeSpecialLanes);
638  FXMenuPane* transformSlanes = new FXMenuPane(laneOperations);
639  ret->insertMenuPaneChild(transformSlanes);
640  // Create menu comands for all add special lanes
641  FXMenuCommand* addSidewalk = new FXMenuCommand(addSpecialLanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_ADD_SIDEWALK);
642  FXMenuCommand* addBikelane = new FXMenuCommand(addSpecialLanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_ADD_BIKE);
643  FXMenuCommand* addBuslane = new FXMenuCommand(addSpecialLanes, "Buslane", busIcon, &parent, MID_GNE_LANE_ADD_BUS);
644  FXMenuCommand* addGreenVerge = new FXMenuCommand(addSpecialLanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE);
645  // Create menu comands for all remove special lanes and disable it
646  FXMenuCommand* removeSidewalk = new FXMenuCommand(removeSpecialLanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_REMOVE_SIDEWALK);
647  removeSidewalk->disable();
648  FXMenuCommand* removeBikelane = new FXMenuCommand(removeSpecialLanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_REMOVE_BIKE);
649  removeBikelane->disable();
650  FXMenuCommand* removeBuslane = new FXMenuCommand(removeSpecialLanes, "Buslane", busIcon, &parent, MID_GNE_LANE_REMOVE_BUS);
651  removeBuslane->disable();
652  FXMenuCommand* removeGreenVerge = new FXMenuCommand(removeSpecialLanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_REMOVE_GREENVERGE);
653  removeGreenVerge->disable();
654  // Create menu comands for all trasform special lanes and disable it
655  FXMenuCommand* transformLaneToSidewalk = new FXMenuCommand(transformSlanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_TRANSFORM_SIDEWALK);
656  FXMenuCommand* transformLaneToBikelane = new FXMenuCommand(transformSlanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_TRANSFORM_BIKE);
657  FXMenuCommand* transformLaneToBuslane = new FXMenuCommand(transformSlanes, "Buslane", busIcon, &parent, MID_GNE_LANE_TRANSFORM_BUS);
658  FXMenuCommand* transformLaneToGreenVerge = new FXMenuCommand(transformSlanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_TRANSFORM_GREENVERGE);
659  // add menuCascade for lane operations
660  FXMenuCascade* cascadeAddSpecialLane = new FXMenuCascade(laneOperations, ("add restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, addSpecialLanes);
661  FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(laneOperations, ("remove restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, removeSpecialLanes);
662  new FXMenuCascade(laneOperations, ("transform to restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, transformSlanes);
663  // Enable and disable options depending of current transform of the lane
664  if (edgeHasSidewalk) {
665  transformLaneToSidewalk->disable();
666  addSidewalk->disable();
667  removeSidewalk->enable();
668  }
669  if (edgeHasBikelane) {
670  transformLaneToBikelane->disable();
671  addBikelane->disable();
672  removeBikelane->enable();
673  }
674  if (edgeHasBuslane) {
675  transformLaneToBuslane->disable();
676  addBuslane->disable();
677  removeBuslane->enable();
678  }
679  if (edgeHasGreenVerge) {
680  transformLaneToGreenVerge->disable();
681  addGreenVerge->disable();
682  removeGreenVerge->enable();
683  }
684  // Check if cascade menus must be disabled
685  if (edgeHasSidewalk && edgeHasBikelane && edgeHasBuslane && edgeHasGreenVerge) {
686  cascadeAddSpecialLane->disable();
687  }
688  if (!edgeHasSidewalk && !edgeHasBikelane && !edgeHasBuslane && !edgeHasGreenVerge) {
689  cascadeRemoveSpecialLane->disable();
690  }
691  } else if (editMode == GNE_NMODE_TLS) {
693  new FXMenuCommand(ret, "Select state for all links from this edge:", nullptr, nullptr, 0);
694  const std::vector<std::string> names = GNEInternalLane::LinkStateNames.getStrings();
695  for (auto it : names) {
696  FXuint state = GNEInternalLane::LinkStateNames.get(it);
697  FXMenuRadio* mc = new FXMenuRadio(ret, it.c_str(), this, FXDataTarget::ID_OPTION + state);
698  mc->setSelBackColor(MFXUtils::getFXColor(GNEInternalLane::colorForLinksState(state)));
700  }
701  }
702  } else {
703  FXMenuCommand* mc = new FXMenuCommand(ret, "Additional options available in 'Inspect Mode'", nullptr, nullptr, 0);
704  mc->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
705  }
706  // buildShowParamsPopupEntry(ret, false);
707  // build shape positions menu
708  if (editMode != GNE_NMODE_TLS) {
709  new FXMenuSeparator(ret);
712  new FXMenuCommand(ret, ("Shape pos: " + toString(pos)).c_str(), nullptr, nullptr, 0);
713  new FXMenuCommand(ret, ("Length pos: " + toString(pos * getLaneParametricLength() / getLaneShapeLength())).c_str(), nullptr, nullptr, 0);
714  new FXMenuCommand(ret, ("Height: " + toString(height)).c_str(), nullptr, nullptr, 0);
715  }
716  // new FXMenuSeparator(ret);
717  // buildPositionCopyEntry(ret, false);
718  return ret;
719 }
720 
721 
722 Boundary
726  } else {
728  }
729 }
730 
731 
732 int
734  return myIndex;
735 }
736 
737 void
738 GNELane::setIndex(int index) {
739  myIndex = index;
741 }
742 
743 
744 double
747 }
748 
749 
750 double
752  double laneParametricLenght = myParentEdge.getNBEdge()->getLoadedLength();
753  if (laneParametricLenght > 0) {
754  return laneParametricLenght;
755  } else {
756  throw ProcessError("Lane Parametric Lenght cannot be never 0");
757  }
758 }
759 
760 
761 double
763  return myGeometry.shape.length();
764 }
765 
766 
767 bool
769  return myParentEdge.getNBEdge()->getPermissions(myIndex) == vclass;
770 }
771 
772 
773 std::string
775  const NBEdge* edge = myParentEdge.getNBEdge();
776  switch (key) {
777  case SUMO_ATTR_ID:
778  return getMicrosimID();
779  case SUMO_ATTR_SPEED:
780  return toString(edge->getLaneSpeed(myIndex));
781  case SUMO_ATTR_ALLOW:
783  case SUMO_ATTR_DISALLOW:
785  case SUMO_ATTR_WIDTH:
786  return toString(edge->getLaneStruct(myIndex).width);
787  case SUMO_ATTR_ENDOFFSET:
788  return toString(edge->getLaneStruct(myIndex).endOffset);
790  return toString(edge->getLaneStruct(myIndex).accelRamp);
792  return toString(edge->getLaneStruct(myIndex).customShape);
793  case SUMO_ATTR_INDEX:
794  return toString(myIndex);
795  case GNE_ATTR_SELECTED:
797  case GNE_ATTR_GENERIC:
798  return getGenericParametersStr();
799  default:
800  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
801  }
802 }
803 
804 std::string
806  std::string result = getAttribute(key);
807  if ((key == SUMO_ATTR_ALLOW || key == SUMO_ATTR_DISALLOW) && result.find("all") != std::string::npos) {
808  result += " " + getVehicleClassNames(SVCAll, true);
809  }
810  return result;
811 }
812 
813 
814 void
815 GNELane::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
816  switch (key) {
817  case SUMO_ATTR_ID:
818  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
819  case SUMO_ATTR_SPEED:
820  case SUMO_ATTR_ALLOW:
821  case SUMO_ATTR_DISALLOW:
822  case SUMO_ATTR_WIDTH:
823  case SUMO_ATTR_ENDOFFSET:
826  case SUMO_ATTR_INDEX:
827  case GNE_ATTR_SELECTED:
828  case GNE_ATTR_GENERIC:
829  // no special handling
830  undoList->p_add(new GNEChange_Attribute(this, myNet, key, value));
831  break;
832  default:
833  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
834  }
835 }
836 
837 
838 bool
839 GNELane::isValid(SumoXMLAttr key, const std::string& value) {
840  switch (key) {
841  case SUMO_ATTR_ID:
842  return false;
843  case SUMO_ATTR_SPEED:
844  return canParse<double>(value);
845  case SUMO_ATTR_ALLOW:
846  case SUMO_ATTR_DISALLOW:
847  return canParseVehicleClasses(value);
848  case SUMO_ATTR_WIDTH:
849  return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_WIDTH));
850  case SUMO_ATTR_ENDOFFSET:
851  return canParse<double>(value) && (parse<double>(value) >= 0);
853  return canParse<bool>(value);
854  case SUMO_ATTR_CUSTOMSHAPE: {
855  // A lane shape can either be empty or have more than 1 element
856  if (value.empty()) {
857  return true;
858  } else if (canParse<PositionVector>(value)) {
859  return parse<PositionVector>(value).size() > 1;
860  }
861  return false;
862  }
863  case SUMO_ATTR_INDEX:
864  return canParse<int>(value) && (parse<int>(value) == myIndex);
865  case GNE_ATTR_SELECTED:
866  return canParse<bool>(value);
867  case GNE_ATTR_GENERIC:
868  return isGenericParametersValid(value);
869  default:
870  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
871  }
872 }
873 
874 
875 std::string
877  std::string result;
878  // Generate an string using the following structure: "key1=value1|key2=value2|...
880  result += i.first + "=" + i.second + "|";
881  }
882  // remove the last "|"
883  if (!result.empty()) {
884  result.pop_back();
885  }
886  return result;
887 }
888 
889 
890 std::vector<std::pair<std::string, std::string> >
892  std::vector<std::pair<std::string, std::string> > result;
893  // iterate over parameters map and fill result
895  result.push_back(std::make_pair(i.first, i.second));
896  }
897  return result;
898 }
899 
900 
901 void
902 GNELane::setGenericParametersStr(const std::string& value) {
903  // clear parameters
905  // separate value in a vector of string using | as separator
906  std::vector<std::string> parsedValues;
907  StringTokenizer stValues(value, "|", true);
908  while (stValues.hasNext()) {
909  parsedValues.push_back(stValues.next());
910  }
911  // check that parsed values (A=B)can be parsed in generic parameters
912  for (auto i : parsedValues) {
913  std::vector<std::string> parsedParameters;
914  StringTokenizer stParam(i, "=", true);
915  while (stParam.hasNext()) {
916  parsedParameters.push_back(stParam.next());
917  }
918  // Check that parsed parameters are exactly two and contains valid chracters
919  if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
920  myParentEdge.getNBEdge()->getLaneStruct(myIndex).setParameter(parsedParameters.front(), parsedParameters.back());
921  }
922  }
923 }
924 
925 
926 void
927 GNELane::setSpecialColor(const RGBColor* color, double colorValue) {
928  mySpecialColor = color;
929  mySpecialColorValue = colorValue;
930 }
931 
932 // ===========================================================================
933 // private
934 // ===========================================================================
935 
936 void
937 GNELane::setAttribute(SumoXMLAttr key, const std::string& value) {
938  NBEdge* edge = myParentEdge.getNBEdge();
939  switch (key) {
940  case SUMO_ATTR_ID:
941  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
942  case SUMO_ATTR_SPEED:
943  edge->setSpeed(myIndex, parse<double>(value));
944  break;
945  case SUMO_ATTR_ALLOW:
947  break;
948  case SUMO_ATTR_DISALLOW:
950  break;
951  case SUMO_ATTR_WIDTH:
952  edge->setLaneWidth(myIndex, parse<double>(value));
953  break;
954  case SUMO_ATTR_ENDOFFSET:
955  edge->setEndOffset(myIndex, parse<double>(value));
956  break;
958  edge->setAcceleration(myIndex, parse<bool>(value));
959  break;
960  case SUMO_ATTR_CUSTOMSHAPE: {
961  // first remove edge parent from net
963  // set new shape
964  edge->setLaneShape(myIndex, parse<PositionVector>(value));
965  // add edge parent into net again
967  break;
968  }
969  case GNE_ATTR_SELECTED:
970  if (parse<bool>(value)) {
972  } else {
974  }
975  break;
976  case GNE_ATTR_GENERIC:
978  break;
979  default:
980  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
981  }
982 }
983 
984 
985 RGBColor
987  // we need to draw lanes with a special color if we're inspecting a Trip or Flow and this lane belongs to a via's edge.
991  // obtain attribute "via"
992  std::vector<std::string> viaEdges = parse<std::vector<std::string> >(myNet->getViewNet()->getDottedAC()->getAttribute(SUMO_ATTR_VIA));
993  // iterate over viaEdges
994  for (const auto& i : viaEdges) {
995  // check if edge parent is in the via edges
996  if (myParentEdge.getID() == i) {
997  // set green color in GLHelper and return it
999  return RGBColor::GREEN;
1000  }
1001  }
1002  }
1003  // declare a RGBColor variable
1004  RGBColor color;
1005  if (mySpecialColor != nullptr) {
1006  // If special color is enabled, set it
1007  color = *mySpecialColor;
1008  } else if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1009  // override with special colors (unless the color scheme is based on selection)
1010  color = s.colorSettings.selectedLaneColor;
1011  } else if (myParentEdge.drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1012  // override with special colors (unless the color scheme is based on selection)
1013  color = s.colorSettings.selectedEdgeColor;
1014  } else {
1015  // Get normal lane color
1016  const GUIColorer& c = s.laneColorer;
1017  if (!setFunctionalColor(c.getActive(), color) && !setMultiColor(s, c, color)) {
1018  color = c.getScheme().getColor(getColorValue(s, c.getActive()));
1019  }
1020  }
1021  // set color in GLHelper
1022  GLHelper::setColor(color);
1023  return color;
1024 }
1025 
1026 bool
1027 GNELane::setFunctionalColor(int activeScheme, RGBColor& col) const {
1028  switch (activeScheme) {
1029  case 6: {
1030  double hue = GeomHelper::naviDegree(myGeometry.shape.beginEndAngle()); // [0-360]
1031  col = RGBColor::fromHSV(hue, 1., 1.);
1032  return true;
1033  }
1034  default:
1035  return false;
1036  }
1037 }
1038 
1039 
1040 bool
1042  const int activeScheme = c.getActive();
1043  myShapeColors.clear();
1044  switch (activeScheme) {
1045  case 9: // color by height at segment start
1046  for (PositionVector::const_iterator ii = myGeometry.shape.begin(); ii != myGeometry.shape.end() - 1; ++ii) {
1047  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
1048  }
1049  col = c.getScheme().getColor(getColorValue(s, 8));
1050  return true;
1051  case 11: // color by inclination at segment start
1052  for (int ii = 1; ii < (int)myGeometry.shape.size(); ++ii) {
1053  const double inc = (myGeometry.shape[ii].z() - myGeometry.shape[ii - 1].z()) / MAX2(POSITION_EPS, myGeometry.shape[ii].distanceTo2D(myGeometry.shape[ii - 1]));
1054  myShapeColors.push_back(c.getScheme().getColor(inc));
1055  }
1056  col = c.getScheme().getColor(getColorValue(s, 10));
1057  return true;
1058  default:
1059  return false;
1060  }
1061 }
1062 
1063 
1064 double
1065 GNELane::getColorValue(const GUIVisualizationSettings& s, int activeScheme) const {
1066  const SVCPermissions myPermissions = myParentEdge.getNBEdge()->getPermissions(myIndex);
1067  if (mySpecialColor != nullptr && mySpecialColorValue != std::numeric_limits<double>::max()) {
1068  return mySpecialColorValue;
1069  }
1070  switch (activeScheme) {
1071  case 0:
1072  switch (myPermissions) {
1073  case SVC_PEDESTRIAN:
1074  return 1;
1075  case SVC_BICYCLE:
1076  return 2;
1077  case 0:
1078  return 3;
1079  case SVC_SHIP:
1080  return 4;
1081  default:
1082  break;
1083  }
1084  if (isRailway(myPermissions)) {
1085  return 5;
1086  } else if ((myPermissions & SVC_PASSENGER) != 0) {
1087  return 0;
1088  } else {
1089  return 6;
1090  }
1091  case 1:
1093  case 2:
1094  return (double)myPermissions;
1095  case 3:
1097  case 4:
1098  return myParentEdge.getNBEdge()->getNumLanes();
1099  case 5: {
1101  }
1102  // case 6: by angle (functional)
1103  case 7: {
1104  return myParentEdge.getNBEdge()->getPriority();
1105  }
1106  case 8: {
1107  // color by z of first shape point
1108  return myGeometry.shape[0].z();
1109  }
1110  // case 9: by segment height
1111  case 10: {
1112  // color by incline
1113  return (myGeometry.shape[-1].z() - myGeometry.shape[0].z()) / myParentEdge.getNBEdge()->getLength();
1114  }
1115  // case 11: by segment incline
1116 
1117  case 12: {
1118  // by numerical edge param value
1119  try {
1121  } catch (NumberFormatException&) {
1122  WRITE_WARNING("Edge parameter '" + myParentEdge.getNBEdge()->getParameter(s.edgeParam, "0") + "' key '" + s.edgeParam + "' is not a number for edge '" + myParentEdge.getID() + "'");
1123  return 0;
1124  }
1125  }
1126  case 13: {
1127  // by numerical lane param value
1128  try {
1130  } catch (NumberFormatException&) {
1131  WRITE_WARNING("Lane parameter '" + myParentEdge.getNBEdge()->getLaneStruct(myIndex).getParameter(s.laneParam, "0") + "' key '" + s.laneParam + "' is not a number for lane '" + getID() + "'");
1132  return 0;
1133  }
1134  }
1135  case 14: {
1136  return myParentEdge.getNBEdge()->getDistance();
1137  }
1138  case 15: {
1139  return fabs(myParentEdge.getNBEdge()->getDistance());
1140  }
1141  }
1142  return 0;
1143 }
1144 
1145 
1146 bool
1149 }
1150 
1151 
1152 bool
1154  return isWaterway(myParentEdge.getNBEdge()->getPermissions(myIndex)) && s.showRails && !s.drawForSelecting; // reusing the showRails setting
1155 }
1156 
1157 
1158 void
1159 GNELane::drawDirectionIndicators(double exaggeration, bool spreadSuperposed) const {
1160  const double width = MAX2(NUMERICAL_EPS, (myParentEdge.getNBEdge()->getLaneWidth(myIndex) * exaggeration
1161  * (spreadSuperposed ? 0.4 : 1)));
1162  const double sideOffset = spreadSuperposed ? width * -0.5 : 0;
1163  glPushMatrix();
1164  glTranslated(0, 0, GLO_JUNCTION + 0.1);
1165  int e = (int) myGeometry.shape.size() - 1;
1166  for (int i = 0; i < e; ++i) {
1167  glPushMatrix();
1168  glTranslated(myGeometry.shape[i].x(), myGeometry.shape[i].y(), 0.1);
1169  glRotated(myGeometry.shapeRotations[i], 0, 0, 1);
1170  for (double t = 0; t < myGeometry.shapeLengths[i]; t += width) {
1171  const double length = MIN2(width * 0.5, myGeometry.shapeLengths[i] - t);
1172  glBegin(GL_TRIANGLES);
1173  glVertex2d(sideOffset, -t - length);
1174  glVertex2d(sideOffset - width * 0.25, -t);
1175  glVertex2d(sideOffset + width * 0.25, -t);
1176  glEnd();
1177  }
1178  glPopMatrix();
1179  }
1180  glPopMatrix();
1181 }
1182 
1183 
1184 void
1186  // obtain VSSExaggeration, lane pos and route
1187  const double exaggeration = s.addSize.getExaggeration(s, vss);
1188  const Position& lanePos = vss->getChildPosition(this);
1189  const double laneRot = vss->getChildRotation(this);
1190  // Start drawing adding an VSS gl identificator (used to identify element after clicking)
1191  glPushName(vss->getGlID());
1192  // start drawing symbol
1193  glPushMatrix();
1194  glScaled(exaggeration, exaggeration, 1);
1195  glTranslated(lanePos.x(), lanePos.y(), vss->getType());
1196  glRotated(-1 * laneRot, 0, 0, 1);
1197  glTranslated(0, -1.5, 0);
1198  // draw circle
1199  int noPoints = 9;
1200  if (s.scale > 25) {
1201  noPoints = (int)(9.0 + s.scale / 10.0);
1202  if (noPoints > 36) {
1203  noPoints = 36;
1204  }
1205  }
1206  glColor3d(1, 0, 0);
1207  GLHelper::drawFilledCircle((double) 1.3, noPoints);
1208  if (!s.drawForSelecting && (s.scale >= 5)) {
1209  glTranslated(0, 0, .1);
1210  glColor3d(0, 0, 0);
1211  GLHelper::drawFilledCircle((double) 1.1, noPoints);
1212  // draw the speed string
1213  glColor3d(1, 1, 0);
1214  glTranslated(0, 0, .1);
1215  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1216  // draw last value string
1217  GLHelper::drawText("S", Position(0, 0), .1, 1.2, RGBColor(255, 255, 0), 180);
1218  }
1219  // Pop symbol matrix
1220  glPopMatrix();
1221  // Pop VSS name
1222  glPopName();
1223  // check if dotted contour has to be drawn
1224  if (myNet->getViewNet()->getDottedAC() == vss) {
1225  GLHelper::drawShapeDottedContourRectangle(s, getType(), lanePos, 2.6, 2.6, -1 * laneRot, 0, -1.5);
1226  }
1227  // Draw connections
1228  vss->drawChildConnections(s, getType());
1229 }
1230 
1231 
1232 void
1234  GLHelper::setColor(s.junctionColorer.getSchemes()[0].getColor(2));
1235  if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1236  // override with special colors (unless the color scheme is based on selection)
1238  }
1239  // obtain circle width and resolution
1240  double circleWidth = GNEEdge::SNAP_RADIUS * MIN2((double)1, s.laneWidthExaggeration) / 2;
1241  // Obtain exaggeration of the draw
1242  const double exaggeration = s.addSize.getExaggeration(s, this);
1243  // obtain custom shape
1245  // draw s depending of detail
1246  if (s.drawDetail(s.detailSettings.geometryPointsText, exaggeration)) {
1247  glPushMatrix();
1248  glTranslated(customShape.front().x(), customShape.front().y(), GLO_JUNCTION + 0.01);
1250  glTranslated(0, 0, 0.01);
1251  GLHelper::drawText("S", Position(), 0, circleWidth, RGBColor::WHITE);
1252  glPopMatrix();
1253  }
1254  // draw line between Junction and point
1255  glPushMatrix();
1256  glTranslated(0, 0, GLO_JUNCTION - 0.01);
1257  glLineWidth(4);
1259  glPopMatrix();
1260  // draw "e" depending of detail
1261  if (s.drawDetail(s.detailSettings.geometryPointsText, exaggeration)) {
1262  glPushMatrix();
1263  glTranslated(customShape.back().x(), customShape.back().y(), GLO_JUNCTION + 0.01);
1265  glTranslated(0, 0, 0.01);
1266  GLHelper::drawText("E", Position(), 0, circleWidth, RGBColor::WHITE);
1267  glPopMatrix();
1268  }
1269  // draw line between Junction and point
1270  glPushMatrix();
1271  glTranslated(0, 0, GLO_JUNCTION - 0.01);
1272  glLineWidth(4);
1274  glPopMatrix();
1275 }
1276 
1277 
1278 std::string
1280  return myParentEdge.getMicrosimID();
1281 }
1282 
1283 
1284 long
1285 GNELane::onDefault(FXObject* obj, FXSelector sel, void* data) {
1286  myNet->getViewNet()->getViewParent()->getTLSEditorFrame()->handleMultiChange(this, obj, sel, data);
1287  return 1;
1288 }
1289 
1290 
1291 GNEEdge&
1293  return myParentEdge;
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 shape children
1369  for (auto i : getShapeChildren()) {
1370  i->startGeometryMoving();
1371  }
1372  // Save current centering boundary of shapes with this lane as chid
1373  for (auto i : getShapeParents()) {
1374  i->startGeometryMoving();
1375  }
1376  // Save current centering boundary of additional children
1377  for (auto i : getAdditionalChildren()) {
1378  i->startGeometryMoving();
1379  }
1380  // Save current centering boundary of additionals with this lane as chid
1381  for (auto i : getAdditionalParents()) {
1382  i->startGeometryMoving();
1383  }
1384  // Save current centering boundary of demand element children
1385  for (auto i : getDemandElementChildren()) {
1386  i->startGeometryMoving();
1387  }
1388  // Save current centering boundary of demand element with this lane as chid
1389  for (auto i : getDemandElementParents()) {
1390  i->startGeometryMoving();
1391  }
1392 }
1393 
1394 
1395 void
1397  // Lanes don't need to save the current Centering Boundary, due they are parts of an Edge
1398  // Restore centering boundary of shapes with this lane as chid
1399  for (auto i : getShapeChildren()) {
1400  i->endGeometryMoving();
1401  }
1402  // Restore centering boundary of shapes with this lane as chid
1403  for (auto i : getShapeParents()) {
1404  i->endGeometryMoving();
1405  }
1406  // Restore centering boundary of additionals with this lane as chid
1407  for (auto i : getAdditionalChildren()) {
1408  i->endGeometryMoving();
1409  }
1410  // Restore centering boundary of additionals with this lane as chid
1411  for (auto i : getAdditionalParents()) {
1412  i->endGeometryMoving();
1413  }
1414  // Restore centering boundary of demand elements with this lane as chid
1415  for (auto i : getDemandElementChildren()) {
1416  i->endGeometryMoving();
1417  }
1418  // Restore centering boundary of demand elements with this lane as chid
1419  for (auto i : getDemandElementParents()) {
1420  i->endGeometryMoving();
1421  }
1422 }
1423 
1424 /****************************************************************************/
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
RGBColor setLaneColor(const GUIVisualizationSettings &s) const
set color according to edit mode and visualisation settings
Definition: GNELane.cpp:986
remove inner geometry
Definition: GUIAppEnum.h:815
int getConnectionIndex(const NBEdge *from, const NBEdge::Connection &con) const
return the index of the given connection
Definition: NBNode.cpp:3175
The link is a partial left direction.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
double getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:533
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
Definition: GNENet.cpp:1164
Position getPositionInView() const
Returns position of hierarchical element in view.
SumoXMLTag
Numbers representing SUMO-XML - element names.
void drawLane2LaneConnections() const
draw lane to lane connections
Definition: GNELane.cpp:274
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:2014
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
Definition: GNELane.cpp:768
const std::vector< T > & getSchemes() const
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNELane.cpp:1279
const Position & getChildPosition(const GNELane *lane)
get child position calculated in ChildConnections
double scale
information about a lane&#39;s width (temporary, used for a single view)
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:154
bool setFunctionalColor(int activeScheme, RGBColor &col) const
sets the color according to the current scheme index and some lane function
Definition: GNELane.cpp:1027
void drawVSSSymbol(const GUIVisualizationSettings &s, GNEAdditional *vss) const
draw VSS symbol
Definition: GNELane.cpp:1185
PositionVector shape
The shape of the netElement element.
Definition: GNENetElement.h:57
PositionVector shape
The lane&#39;s shape.
Definition: NBEdge.h:142
whether a given shape is user-defined
GNENet * myNet
the net to inform about updates
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:182
double z() const
Returns the z-position.
Definition: Position.h:67
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
begin/end of the description of a single lane
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNELane.cpp:547
smooth geometry
Definition: GUIAppEnum.h:817
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
NBNode * myTo
Definition: NBEdge.h:1533
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3332
a flow definitio nusing a from-to edges instead of a route (used by router)
double getLaneSpeed(int lane) const
get lane speed
Definition: NBEdge.cpp:1899
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
const RGBColor * mySpecialColor
optional special color
Definition: GNELane.h:229
static void drawTextAtEnd(const std::string &text, const PositionVector &shape, double x, double size, RGBColor color)
draw text and the end of shape
Definition: GLHelper.cpp:750
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb.htm.
Definition: RGBColor.cpp:299
static const RGBColor WHITE
Definition: RGBColor.h:197
NetworkEditMode
enum for network edit modes
RGBColor selectedLaneColor
lane selection color
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3382
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
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:472
vehicle is a bicycle
const double SUMO_const_laneWidth
Definition: StdDefs.h:50
static const double SNAP_RADIUS
Definition: GNEEdge.h:281
reverse an edge
Definition: GUIAppEnum.h:827
split an edge
Definition: GUIAppEnum.h:823
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:921
double y() const
Returns the y-position.
Definition: Position.h:62
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:819
split an edge
Definition: GUIAppEnum.h:825
The representation of a single edge during network building.
Definition: NBEdge.h:86
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:821
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:846
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:1872
double x() const
Returns the x-position.
Definition: Position.h:57
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition: NBEdge.cpp:683
NetElementGeometry myGeometry
netElement geometry
std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
Definition: GNELane.cpp:805
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:668
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
T MAX2(T a, T b)
Definition: StdDefs.h:80
transform lane to bikelane
Definition: GUIAppEnum.h:905
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:3413
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
double getChildRotation(const GNELane *lane)
get child rotation calculated in ChildConnections
bool showLaneDirection
Whether to show direction indicators for lanes.
double getSpeed() const
returns the current speed of lane
Definition: GNELane.cpp:745
double endOffset
This lane&#39;s offset to the intersection begin.
Definition: NBEdge.h:154
bool laneShowBorders
Information whether lane borders shall be drawn.
GNELane()
FOX needs this.
Definition: GNELane.cpp:65
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GNELane.h:235
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:1147
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
void handleMultiChange(GNELane *lane, FXObject *obj, FXSelector sel, void *data)
update phase definition for the current traffic light and phase
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
bool hasNext()
returns the information whether further substrings exist
const SVCPermissions SVCAll
all VClasses are allowed
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1271
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:348
virtual std::string getAttribute(SumoXMLAttr key) const =0
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.
const std::vector< GNEAdditional * > & getAdditionalChildren() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
generic attribute
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:303
void setIndex(int index)
Definition: GNELane.cpp:738
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
int myIndex
The index of this lane.
Definition: GNELane.h:216
This is an uncontrolled, zipper-merge link.
The link is a (hard) left direction.
std::vector< std::string > getStrings() const
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
mode for editing tls
double getDistance() const
Definition: NBEdge.h:604
mode for moving network elements
GNETLSEditorFrame * getTLSEditorFrame() const
get frame for GNE_NMODE_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:3405
bool accelRamp
Whether this lane is an acceleration lane.
Definition: NBEdge.h:167
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
Definition: NBEdge.cpp:3397
std::vector< double > myLaneRestrictedTextureRotations
Rotations of textures of restricted lanes.
Definition: GNELane.h:225
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:324
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
const std::vector< GNEShape * > & getShapeChildren() const
get shapes of VSS
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
The link is a straight direction.
std::string edgeParam
key for coloring by edge parameter
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:625
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions ...
const std::vector< GNEShape * > & getShapeParents() const
get shapes of VSS
GUIVisualizationSizeSettings addSize
remove bikelane
Definition: GUIAppEnum.h:921
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
Definition: GNELane.cpp:1153
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:194
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:733
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNELane.cpp:891
std::vector< double > shapeRotations
The rotations of the single shape parts.
Definition: GNENetElement.h:60
static const RGBColor GREEN
Definition: RGBColor.h:191
double getLaneParametricLength() const
returns the parameteric length of the lane
Definition: GNELane.cpp:751
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
add bikelane
Definition: GUIAppEnum.h:913
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:616
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:1292
void endGeometryMoving()
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
Definition: GNELane.cpp:1396
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNELane.cpp:815
virtual FXuint size() const
return actual size
Definition: GNEChange.cpp:45
bool setMultiColor(const GUIVisualizationSettings &s, const GUIColorer &c, RGBColor &col) const
sets multiple colors according to the current scheme index and some lane function ...
Definition: GNELane.cpp:1041
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNELane.cpp:876
transform lane to busLane
Definition: GUIAppEnum.h:907
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:373
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
This is an uncontrolled, minor link, has to brake.
std::string getLaneID(int lane) const
get lane ID
Definition: NBEdge.cpp:3125
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:465
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
double mySpecialColorValue
optional value that corresponds to which the special color corresponds
Definition: GNELane.h:232
bool isLogicValid()
whether this junction has a valid logic
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1279
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
friend class GNEChange_Attribute
declare friend class
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
T get(const std::string &str) const
mode for creating new edges
virtual bool isAttributeCarrierSelected() const =0
check if attribute carrier is selected
const double SUMO_const_laneMarkWidth
Definition: StdDefs.h:56
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1304
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:505
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
static const double laneTextures
details for lane textures
const std::vector< GNEAdditional * > & getAdditionalParents() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
void drawArrows() const
draw arrows
Definition: GNELane.cpp:205
double getLengthGeometryFactor() const
get length geometry factor
Definition: GNELane.cpp:1355
GUIVisualizationTextSettings drawLinkTLIndex
T MIN2(T a, T b)
Definition: StdDefs.h:74
static void drawOutlineCircle(double width, double iwidth, int steps=8)
Draws an unfilled circle around (0,0)
Definition: GLHelper.cpp:393
The link is a (hard) right direction.
void drawMarkings(const GUIVisualizationSettings &s, double scale) const
draw lane markings
Definition: GNELane.cpp:506
#define POSITION_EPS
Definition: config.h:169
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
GUIColorer junctionColorer
The junction colorer.
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:902
remove busLane
Definition: GUIAppEnum.h:923
const T getColor(const double value) const
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:274
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:1557
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:499
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:762
void startGeometryMoving()
Definition: GNELane.cpp:1366
double width
This lane&#39;s width.
Definition: NBEdge.h:161
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3441
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:3704
vehicle is a passenger car (a "normal" car)
void updateGeometry()
update pre-computed geometry information
Definition: GNELane.cpp:84
void selectAttributeCarrier(bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
std::vector< double > shapeLengths
The lengths of the single shape parts.
Definition: GNENetElement.h:63
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition: GNELane.cpp:927
static void drawShapeDottedContourAroundShape(const GUIVisualizationSettings &s, 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:461
add busLane
Definition: GUIAppEnum.h:915
is an arbitrary ship
std::string getAttribute(SumoXMLAttr key) const
Definition: GNELane.cpp:774
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:1936
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
static void drawShapeDottedContourRectangle(const GUIVisualizationSettings &s, const int type, const Position &center, const double width, const double height, const double rotation=0, const double offsetX=0, const double offsetY=0)
draw a dotted contour around the given Position with certain width and height
Definition: GLHelper.cpp:555
transform lane to sidewalk
Definition: GUIAppEnum.h:903
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GUIVisualizationDetailSettings detailSettings
detail settings
const std::vector< GNEDemandElement * > & getDemandElementParents() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
GNEEdge & myParentEdge
The Edge that to which this lane belongs.
Definition: GNELane.h:210
vehicle is a bus
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:575
change default geometry endpoints
Definition: GUIAppEnum.h:811
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:331
double length() const
Returns the length.
void updateConnectionIDs()
update IDs of incoming connections of this lane
Definition: GNELane.cpp:1340
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNELane.cpp:77
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
Definition: GNELane.cpp:1285
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:871
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:1151
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
#define M_PI
Definition: odrSpiral.cpp:40
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a &#39; &#39;.
void drawTLSLinkNo(const GUIVisualizationSettings &s) const
draw TLS Link Number
Definition: GNELane.cpp:177
void drawChildConnections(const GUIVisualizationSettings &s, const GUIGlObjectType GLTypeParent) const
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
Definition: GNEViewNet.cpp:939
The link is controlled by a tls which is off and blinks, has to brake.
add reverse edge
Definition: GUIAppEnum.h:829
static void drawCrossTies(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double length, double spacing, double halfWidth, bool drawForSelecting)
draw crossties for railroads or pedestrian crossings
Definition: GLHelper.cpp:763
const std::string & getTagStr() const
get tag assigned to this object in string format
std::vector< Position > myLaneRestrictedTexturePositions
Position of textures of restricted lanes.
Definition: GNELane.h:222
element is selected
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.
duplicate a lane
Definition: GUIAppEnum.h:899
This is an uncontrolled, major link, may pass.
reset default geometry endpoints
Definition: GUIAppEnum.h:813
void drawLinkNo(const GUIVisualizationSettings &s) const
draw link Number
Definition: GNELane.cpp:153
void drawLinkRules() const
draw link rules
Definition: GNELane.cpp:200
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
mode for connecting lanes
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.
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1127
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
The link is a 180 degree turn (left-hand network)
void drawDirectionIndicators(double exaggeration, bool spreadSuperposed) const
direction indicators for lanes
Definition: GNELane.cpp:1159
A variable speed sign.
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth)
Draws a triangle at the end of the given line.
Definition: GLHelper.cpp:440
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
void calculateShapeRotationsAndLengths()
calculate shape rotations and lengths
NetworkEditMode networkEditMode
the current Network edit mode
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
GUIVisualizationColorSettings colorSettings
color settings
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
#define NUMERICAL_EPS
Definition: config.h:145
void drawStartEndShapePoints(const GUIVisualizationSettings &s) const
draw start and end shape points
Definition: GNELane.cpp:1233
a single trip definition (used by router)
RGBColor selectedEdgeColor
edge selection color
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:136
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNELane.cpp:839
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn&#39;t set.
Definition: NBEdge.h:542
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:399
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
static const double geometryPointsText
details for Geometry Points Texts
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
return value for lane coloring according to the given scheme
Definition: GNELane.cpp:1065
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:1273
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
void clearGeometry()
reset geometry
PositionVector customShape
A custom shape for this lane set by the user.
Definition: NBEdge.h:174
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:486
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:723
~GNELane()
Destructor.
Definition: GNELane.cpp:73
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:3271
transform lane to greenVerge
Definition: GUIAppEnum.h:909
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNELane.cpp:146
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2067
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:622