SUMO - Simulation of Urban MObility
GNELane.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // A class for visualizing Lane geometry (adapted from GNELaneWrapper)
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #include <string>
32 #include <iostream>
33 #include <utility>
39 #include <utils/common/ToString.h>
40 #include <utils/geom/GeomHelper.h>
47 #include <utils/gui/div/GLHelper.h>
51 
52 #include "GNELane.h"
53 #include "GNEEdge.h"
54 #include "GNEJunction.h"
55 #include "GNETLSEditorFrame.h"
56 #include "GNEInternalLane.h"
57 #include "GNEUndoList.h"
58 #include "GNENet.h"
59 #include "GNEChange_Attribute.h"
60 #include "GNEViewNet.h"
61 #include "GNEViewParent.h"
62 #include "GNEConnection.h"
63 
64 #ifdef CHECK_MEMORY_LEAKS
65 #include <foreign/nvwa/debug_new.h>
66 #endif // CHECK_MEMORY_LEAKS
67 
68 // ===========================================================================
69 // FOX callback mapping
70 // ===========================================================================
71 
72 // Object implementation
73 FXIMPLEMENT(GNELane, FXDelegator, 0, 0)
74 
75 // ===========================================================================
76 // method definitions
77 // ===========================================================================
78 
79 GNELane::GNELane(GNEEdge& edge, const int index) :
80  GNENetElement(edge.getNet(), edge.getNBEdge()->getLaneID(index), GLO_LANE, SUMO_TAG_LANE, ICON_LANE),
81  myParentEdge(edge),
82  myIndex(index),
83  mySpecialColor(0),
84  myTLSEditor(0) {
85  updateGeometry();
86 }
87 
89  GNENetElement(NULL, "dummyConstructorGNELane", GLO_LANE, SUMO_TAG_LANE, ICON_LOCATEEDGE),
90  myParentEdge(*static_cast<GNEEdge*>(0)),
91  myIndex(-1),
92  mySpecialColor(0),
93  myTLSEditor(0) {
94 }
95 
96 
98 }
99 
100 
101 void
103 }
104 
105 
106 void
108 }
109 
110 
111 void
113 }
114 
115 
116 void
118  const Position& end = getShape().back();
119  const Position& f = getShape()[-2];
120  SUMOReal rot = (SUMOReal) atan2((end.x() - f.x()), (f.y() - end.y())) * (SUMOReal) 180.0 / (SUMOReal) PI;
121  glPushMatrix();
122  glPushName(0);
123  glTranslated(0, 0, GLO_JUNCTION + .1); // must draw on top of junction shape
124  glColor3d(1, 1, 1);
125  glTranslated(end.x(), end.y(), 0);
126  glRotated(rot, 0, 0, 1);
127 
128  // draw all links
129  const std::vector<NBEdge::Connection>& edgeCons = myParentEdge.getNBEdge()->myConnections;
130  NBNode* dest = myParentEdge.getNBEdge()->myTo;
131  for (std::vector<NBEdge::Connection>::const_iterator i = edgeCons.begin(); i != edgeCons.end(); ++i) {
132  if ((*i).fromLane == myIndex) {
133  LinkDirection dir = dest->getDirection(myParentEdge.getNBEdge(), i->toEdge, OptionsCont::getOptions().getBool("lefthand"));
134  switch (dir) {
135  case LINKDIR_STRAIGHT:
136  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
138  break;
139  case LINKDIR_LEFT:
140  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
141  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
142  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (SUMOReal) 1, (SUMOReal) .25);
143  break;
144  case LINKDIR_RIGHT:
145  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
146  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
147  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (SUMOReal) 1, (SUMOReal) .25);
148  break;
149  case LINKDIR_TURN:
150  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
151  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
152  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
153  GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (SUMOReal) 1, (SUMOReal) .25);
154  break;
156  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
157  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
158  GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
159  GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (SUMOReal) 1, (SUMOReal) .25);
160  break;
161  case LINKDIR_PARTLEFT:
162  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
163  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
164  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (SUMOReal) 1, (SUMOReal) .25);
165  break;
166  case LINKDIR_PARTRIGHT:
167  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
168  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
169  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (SUMOReal) 1, (SUMOReal) .25);
170  break;
171  case LINKDIR_NODIR:
172  GLHelper::drawBoxLine(Position(1, 5.8), 245, 2, .05);
173  GLHelper::drawBoxLine(Position(-1, 5.8), 115, 2, .05);
174  glTranslated(0, 5, 0);
175  GLHelper::drawOutlineCircle(0.9, 0.8, 32);
176  glTranslated(0, -5, 0);
177  break;
178  }
179  }
180  }
181  glPopName();
182  glPopMatrix();
183 }
184 
185 
186 void
188  glPushMatrix();
189  glPushName(0);
190  glTranslated(0, 0, GLO_JUNCTION + .1); // must draw on top of junction shape
191  std::vector<NBEdge::Connection> connections = myParentEdge.getNBEdge()->getConnectionsFromLane(myIndex);
192  NBNode* node = myParentEdge.getNBEdge()->getToNode();
193  const Position& startPos = getShape()[-1];
194  for (std::vector<NBEdge::Connection>::iterator it = connections.begin(); it != connections.end(); it++) {
195  const LinkState state = node->getLinkState(
196  myParentEdge.getNBEdge(), it->toEdge, it->fromLane, it->toLane, it->mayDefinitelyPass, it->tlID);
197  switch (state) {
199  glColor3d(1, 1, 0);
200  break;
202  glColor3d(0, 1, 1);
203  break;
204  case LINKSTATE_MAJOR:
205  glColor3d(1, 1, 1);
206  break;
207  case LINKSTATE_MINOR:
208  glColor3d(.4, .4, .4);
209  break;
210  case LINKSTATE_STOP:
211  glColor3d(.7, .4, .4);
212  break;
213  case LINKSTATE_EQUAL:
214  glColor3d(.7, .7, .7);
215  break;
217  glColor3d(.7, .7, 1);
218  case LINKSTATE_ZIPPER:
219  glColor3d(.75, .5, 0.25);
220  break;
221  default:
222  throw ProcessError("Unexpected LinkState '" + toString(state) + "'");
223  }
224  const Position& endPos = it->toEdge->getLaneShape(it->toLane)[0];
225  glBegin(GL_LINES);
226  glVertex2d(startPos.x(), startPos.y());
227  glVertex2d(endPos.x(), endPos.y());
228  glEnd();
229  GLHelper::drawTriangleAtEnd(startPos, endPos, (SUMOReal) 1.5, (SUMOReal) .2);
230  }
231  glPopName();
232  glPopMatrix();
233 }
234 
235 
236 void
238  // Push draw matrix 1
239  glPushMatrix();
240  // Push name
241  glPushName(getGlID());
242  // Traslate to fromt
243  glTranslated(0, 0, getType());
244  // Check if edge parent or this lane is selected
245  const bool selectedEdge = gSelected.isSelected(myParentEdge.getType(), myParentEdge.getGlID());
246  const bool selected = gSelected.isSelected(getType(), getGlID());
247  // Set color
248  if (mySpecialColor != 0) {
249  // If special color is enabled, set it
251  } else if (selected && s.laneColorer.getActive() != 1) {
252  // override with special colors (unless the color scheme is based on selection)
254  } else if (selectedEdge && s.laneColorer.getActive() != 1) {
255  // override with special colors (unless the color scheme is based on selection)
257  } else {
258  // Get normal lane color
259  const GUIColorer& c = s.laneColorer;
260  if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) {
262  }
263  }
264 
265  // start drawing lane checikg whether it is not too small
266  const SUMOReal selectionScale = selected || selectedEdge ? s.selectionScale : 1;
267  SUMOReal exaggeration = selectionScale * s.laneWidthExaggeration; // * s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive()));
268  // XXX apply usefull scale values
269  //exaggeration *= s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive()));
270 
271  // recognize full transparency and simply don't draw
272  GLfloat color[4];
273  glGetFloatv(GL_CURRENT_COLOR, color);
274  if (color[3] == 0 || s.scale * exaggeration < s.laneMinSize) {
275  // Pop draw matrix 1
276  glPopMatrix();
277  } else if (s.scale * exaggeration < 1.) {
278  // draw as lines, depending of myShapeColors
279  if (myShapeColors.size() > 0) {
281  } else {
283  }
284  // Pop draw matrix 1
285  glPopMatrix();
286  } else {
287  if (drawAsRailway(s)) {
288  // draw as railway
289  const SUMOReal halfRailWidth = 0.725 * exaggeration;
290  // Draw box depending of myShapeColors
291  if (myShapeColors.size() > 0) {
293  } else {
295  }
296  // Save current color
297  RGBColor current = GLHelper::getColor();
298  // Set white color
299  glColor3d(1, 1, 1);
300  // Traslate matrix 1
301  glTranslated(0, 0, .1);
302  // Draw Box
304  // Set current color back
305  GLHelper::setColor(current);
306  // Draw crossties
307  drawCrossties(0.3 * exaggeration, 1 * exaggeration, 1 * exaggeration);
308  } else {
309  // Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen
310  const SUMOReal halfWidth = selectionScale * (myParentEdge.getNBEdge()->getLaneWidth(myIndex) / 2 - (selectedEdge ? .3 : 0));
311  if (myShapeColors.size() > 0) {
313  } else {
315  }
316  }
317  // Pop draw matrix 1
318  glPopMatrix();
319  // if exaggeration is 1, draw drawMarkings
320  if (exaggeration == 1) {
321  drawMarkings(selectedEdge, exaggeration);
322  }
323  // draw ROWs only if target junction has a valid logic)
325  drawArrows();
326  }
327  // Draw direction indicators if the correspondient option is enabled
328  if (s.showLaneDirection) {
330  }
331  // If there are texture of restricted lanes to draw, and draw lane icons is enabled in options
332  if ((OptionsCont::getOptions().getBool("disable-laneIcons") == false) && myLaneRestrictedTexturePositions.size() > 0) {
333  // Declare default width of icon (3)
334  double iconWidth = 1;
335  // Obtain width of icon, if width of lane is different
337  iconWidth = myParentEdge.getNBEdge()->getLaneStruct(myIndex).width / 3;
338  }
339  // Draw list of icons
340  for (int i = 0; i < (int)myLaneRestrictedTexturePositions.size(); i++) {
341  // Push draw matrix 2
342  glPushMatrix();
343  // Set white color
344  glColor3d(1, 1, 1);
345  // Traslate matrix 2
346  glTranslated(myLaneRestrictedTexturePositions.at(i).x(), myLaneRestrictedTexturePositions.at(i).y(), getType() + 0.1);
347  // Rotate matrix 2
348  glRotated(myLaneRestrictedTextureRotations.at(i), 0, 0, -1);
349  glRotated(90, 0, 0, 1);
350  // draw texture box depending of type of restriction
353  } else if (isRestricted(SVC_BICYCLE)) {
355  } else if (isRestricted(SVC_BUS)) {
357  }
358  // Pop draw matrix 2
359  glPopMatrix();
360  }
361  }
362  }
363  // Pop Name
364  glPopName();
365 }
366 
367 
368 void
369 GNELane::drawMarkings(const bool& selectedEdge, SUMOReal scale) const {
370  glPushMatrix();
371  glTranslated(0, 0, GLO_EDGE);
372 
373  const SUMOReal halfWidth = myParentEdge.getNBEdge()->getLaneWidth(myIndex) * 0.5;
374  // optionally draw inverse markings
376  SUMOReal mw = (halfWidth + SUMO_const_laneOffset + .01) * scale;
377  int e = (int) getShape().size() - 1;
378  for (int i = 0; i < e; ++i) {
379  glPushMatrix();
380  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
381  glRotated(myShapeRotations[i], 0, 0, 1);
382  for (SUMOReal t = 0; t < myShapeLengths[i]; t += 6) {
383  const SUMOReal length = MIN2((SUMOReal)3, myShapeLengths[i] - t);
384  glBegin(GL_QUADS);
385  glVertex2d(-mw, -t);
386  glVertex2d(-mw, -t - length);
387  glVertex2d(halfWidth * 0.5 * scale, -t - length);
388  glVertex2d(halfWidth * 0.5 * scale, -t);
389  glEnd();
390  }
391  glPopMatrix();
392  }
393  }
394 
395  // draw white boundings (and white markings) depending on selection
396  if (selectedEdge) {
397  glTranslated(0, 0, 0.2); // draw selection on top of regular markings
399  } else {
400  glColor3d(1, 1, 1);
401  }
402 
404  getShape(),
406  getShapeLengths(),
407  (halfWidth + SUMO_const_laneOffset) * scale);
408  glPopMatrix();
409 
410 }
411 
412 
415  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
416  buildPopupHeader(ret, app);
418  new FXMenuCommand(ret, ("Copy " + toString(SUMO_TAG_EDGE) + " name to clipboard").c_str(), 0, ret, MID_COPY_EDGE_NAME);
421  buildPositionCopyEntry(ret, false);
422  const int editMode = parent.getVisualisationSettings()->editMode;
423  myTLSEditor = 0;
424  if (editMode != GNE_MODE_CONNECT && editMode != GNE_MODE_TLS && editMode != GNE_MODE_CREATE_EDGE) {
425  // Get icons
426  FXIcon* pedestrianIcon = GUIIconSubSys::getIcon(ICON_LANEPEDESTRIAN);
427  FXIcon* bikeIcon = GUIIconSubSys::getIcon(ICON_LANEBIKE);
428  FXIcon* busIcon = GUIIconSubSys::getIcon(ICON_LANEBUS);
429  // Create basic commands
430  new FXMenuCommand(ret, ("Split " + toString(SUMO_TAG_EDGE) + " here").c_str(), 0, &parent, MID_GNE_SPLIT_EDGE);
431  new FXMenuCommand(ret, ("Split " + toString(SUMO_TAG_EDGE) + "s in both direction here").c_str(), 0, &parent, MID_GNE_SPLIT_EDGE_BIDI);
432  new FXMenuCommand(ret, ("Reverse " + toString(SUMO_TAG_EDGE)).c_str(), 0, &parent, MID_GNE_REVERSE_EDGE);
433  new FXMenuCommand(ret, "Add reverse direction", 0, &parent, MID_GNE_ADD_REVERSE_EDGE);
434  new FXMenuCommand(ret, "Set geometry endpoint here", 0, &parent, MID_GNE_SET_EDGE_ENDPOINT);
435  new FXMenuCommand(ret, "Restore geometry endpoint", 0, &parent, MID_GNE_RESET_EDGE_ENDPOINT);
437  new FXMenuCommand(ret, ("Straighten selected " + toString(SUMO_TAG_EDGE) + "s").c_str(), 0, &parent, MID_GNE_STRAIGHTEN);
438  } else {
439  new FXMenuCommand(ret, ("Straighten " + toString(SUMO_TAG_EDGE)).c_str(), 0, &parent, MID_GNE_STRAIGHTEN);
440  }
442  new FXMenuCommand(ret, ("Duplicate selected" + toString(SUMO_TAG_LANE) + "s").c_str(), 0, &parent, MID_GNE_DUPLICATE_LANE);
443  // Create panel for lane operations
444  FXMenuPane* addSpecialLanes = new FXMenuPane(ret);
445  ret->insertMenuPaneChild(addSpecialLanes);
446  FXMenuPane* removeSpecialLanes = new FXMenuPane(ret);
447  ret->insertMenuPaneChild(removeSpecialLanes);
448  FXMenuPane* transformSlanes = new FXMenuPane(ret);
449  ret->insertMenuPaneChild(transformSlanes);
450  // Create menu comands for all add special lanes
451  new FXMenuCommand(addSpecialLanes, "Sidewalks", pedestrianIcon, &parent, MID_GNE_ADD_LANE_SIDEWALK);
452  new FXMenuCommand(addSpecialLanes, "Bikelanes", bikeIcon, &parent, MID_GNE_ADD_LANE_BIKE);
453  new FXMenuCommand(addSpecialLanes, "Buslanes", busIcon, &parent, MID_GNE_ADD_LANE_BUS);
454  // Create menu comands for all remove special lanes and disable it
455  new FXMenuCommand(removeSpecialLanes, "Sidewalks", pedestrianIcon, &parent, MID_GNE_REMOVE_LANE_SIDEWALK);
456  new FXMenuCommand(removeSpecialLanes, "Bikelanes", bikeIcon, &parent, MID_GNE_REMOVE_LANE_BIKE);
457  new FXMenuCommand(removeSpecialLanes, "Buslanes", busIcon, &parent, MID_GNE_REMOVE_LANE_BUS);
458  // Create menu comands for all trasform special lanes and disable it
459  new FXMenuCommand(transformSlanes, "Sidewalks", pedestrianIcon, &parent, MID_GNE_TRANSFORM_LANE_SIDEWALK);
460  new FXMenuCommand(transformSlanes, "Bikelanes", bikeIcon, &parent, MID_GNE_TRANSFORM_LANE_BIKE);
461  new FXMenuCommand(transformSlanes, "Buslanes", busIcon, &parent, MID_GNE_TRANSFORM_LANE_BUS);
462  new FXMenuCommand(transformSlanes, "revert transformations", 0, &parent, MID_GNE_REVERT_TRANSFORMATION);
463  // add menuCascade for lane operations
464  new FXMenuCascade(ret, ("add special" + toString(SUMO_TAG_LANE) + "s").c_str(), 0, addSpecialLanes);
465  new FXMenuCascade(ret, ("remove special" + toString(SUMO_TAG_LANE) + "s").c_str(), 0, removeSpecialLanes);
466  new FXMenuCascade(ret, ("transform to special" + toString(SUMO_TAG_LANE) + "s").c_str(), 0, transformSlanes);
467  } else {
468  new FXMenuCommand(ret, ("Duplicate" + toString(SUMO_TAG_LANE)).c_str(), 0, &parent, MID_GNE_DUPLICATE_LANE);
469  // Declare flags
470  bool edgeHasSidewalk = myParentEdge.hasRestrictedLane(SVC_PEDESTRIAN);
471  bool edgeHasBikelane = myParentEdge.hasRestrictedLane(SVC_BICYCLE);
472  bool edgeHasBuslane = myParentEdge.hasRestrictedLane(SVC_BUS);
473  // Create panel for lane operations and insert it in ret
474  FXMenuPane* addSpecialLanes = new FXMenuPane(ret);
475  ret->insertMenuPaneChild(addSpecialLanes);
476  FXMenuPane* removeSpecialLanes = new FXMenuPane(ret);
477  ret->insertMenuPaneChild(removeSpecialLanes);
478  FXMenuPane* transformSlanes = new FXMenuPane(ret);
479  ret->insertMenuPaneChild(transformSlanes);
480  // Create menu comands for all add special lanes
481  FXMenuCommand* addSidewalk = new FXMenuCommand(addSpecialLanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_ADD_LANE_SIDEWALK);
482  FXMenuCommand* addBikelane = new FXMenuCommand(addSpecialLanes, "Bikelane", bikeIcon, &parent, MID_GNE_ADD_LANE_BIKE);
483  FXMenuCommand* addBuslane = new FXMenuCommand(addSpecialLanes, "Buslane", busIcon, &parent, MID_GNE_ADD_LANE_BUS);
484  // Create menu comands for all remove special lanes and disable it
485  FXMenuCommand* removeSidewalk = new FXMenuCommand(removeSpecialLanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_REMOVE_LANE_SIDEWALK);
486  removeSidewalk->disable();
487  FXMenuCommand* removeBikelane = new FXMenuCommand(removeSpecialLanes, "Bikelane", bikeIcon, &parent, MID_GNE_REMOVE_LANE_BIKE);
488  removeBikelane->disable();
489  FXMenuCommand* removeBuslane = new FXMenuCommand(removeSpecialLanes, "Buslane", busIcon, &parent, MID_GNE_REMOVE_LANE_BUS);
490  removeBuslane->disable();
491  // Create menu comands for all trasform special lanes and disable it
492  FXMenuCommand* transformLaneToSidewalk = new FXMenuCommand(transformSlanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_TRANSFORM_LANE_SIDEWALK);
493  FXMenuCommand* transformLaneToBikelane = new FXMenuCommand(transformSlanes, "Bikelane", bikeIcon, &parent, MID_GNE_TRANSFORM_LANE_BIKE);
494  FXMenuCommand* transformLaneToBuslane = new FXMenuCommand(transformSlanes, "Buslane", busIcon, &parent, MID_GNE_TRANSFORM_LANE_BUS);
495  FXMenuCommand* revertTransformation = new FXMenuCommand(transformSlanes, "revert transformation", 0, &parent, MID_GNE_REVERT_TRANSFORMATION);
496  // add menuCascade for lane operations
497  FXMenuCascade* cascadeAddSpecialLane = new FXMenuCascade(ret, ("add special" + toString(SUMO_TAG_LANE)).c_str(), 0, addSpecialLanes);
498  FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(ret, ("remove special" + toString(SUMO_TAG_LANE)).c_str(), 0, removeSpecialLanes);
499  new FXMenuCascade(ret, ("transform to special" + toString(SUMO_TAG_LANE)).c_str(), 0, transformSlanes);
500  // Enable and disable options depending of current transform of the lane
501  if (edgeHasSidewalk) {
502  transformLaneToSidewalk->disable();
503  addSidewalk->disable();
504  removeSidewalk->enable();
505  }
506  if (edgeHasBikelane) {
507  transformLaneToBikelane->disable();
508  addBikelane->disable();
509  removeBikelane->enable();
510  }
511  if (edgeHasBuslane) {
512  transformLaneToBuslane->disable();
513  addBuslane->disable();
514  removeBuslane->enable();
515  }
516  // Check if cascade menus must be disabled
517  if (edgeHasSidewalk && edgeHasBikelane && edgeHasBuslane) {
518  cascadeAddSpecialLane->disable();
519  }
520  if (!edgeHasSidewalk && !edgeHasBikelane && !edgeHasBuslane) {
521  cascadeRemoveSpecialLane->disable();
522  }
523  // Enable or disable revert transformation
525  revertTransformation->enable();
526  } else {
527  revertTransformation->disable();
528  }
529  }
530  } else if (editMode == GNE_MODE_TLS) {
531  myTLSEditor = static_cast<GNEViewNet&>(parent).getViewParent()->getTLSEditorFrame();
533  new FXMenuCommand(ret, "Select state for all links from this edge:", 0, 0, 0);
534  const std::vector<std::string> names = GNEInternalLane::LinkStateNames.getStrings();
535  for (std::vector<std::string>::const_iterator it = names.begin(); it != names.end(); it++) {
536  FXuint state = GNEInternalLane::LinkStateNames.get(*it);
537  FXMenuRadio* mc = new FXMenuRadio(ret, (*it).c_str(), this, FXDataTarget::ID_OPTION + state);
538  mc->setSelBackColor(MFXUtils::getFXColor(GNEInternalLane::colorForLinksState(state)));
540  }
541  }
542  } else {
543  FXMenuCommand* mc = new FXMenuCommand(ret, "Additional options available in 'Inspect Mode'", 0, 0, 0);
544  mc->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), 0);
545  }
546  // buildShowParamsPopupEntry(ret, false);
547  new FXMenuSeparator(ret);
549  const SUMOReal height = getShape().positionAtOffset2D(getShape().nearest_offset_to_point2D(parent.getPositionInformation())).z();
550  new FXMenuCommand(ret, ("Shape pos: " + toString(pos)).c_str(), 0, 0, 0);
551  new FXMenuCommand(ret, ("Length pos: " + toString(getPositionRelativeToShapeLenght(pos))).c_str(), 0, 0, 0);
552  new FXMenuCommand(ret, ("Height: " + toString(height)).c_str(), 0, 0, 0);
553  // new FXMenuSeparator(ret);
554  // buildPositionCopyEntry(ret, false);
555 
556  // let the GNEViewNet store the popup position
557  (dynamic_cast<GNEViewNet&>(parent)).markPopupPosition();
558  return ret;
559 }
560 
561 
565  new GUIParameterTableWindow(app, *this, 2);
566  // add items
567  ret->mkItem("length [m]", false, myParentEdge.getNBEdge()->getLength());
568  // close building
569  ret->closeBuilding();
570  return ret;
571 }
572 
573 
574 Boundary
577  b.grow(10);
578  return b;
579 }
580 
581 
582 const PositionVector&
585 }
586 
587 
588 const std::vector<SUMOReal>&
590  return myShapeRotations;
591 }
592 
593 
594 const std::vector<SUMOReal>&
596  return myShapeLengths;
597 }
598 
599 
600 Boundary
603 }
604 
605 
606 void
608  // Clear containers
609  myShapeRotations.clear();
610  myShapeLengths.clear();
613  //SUMOReal length = myParentEdge.getLength(); // @todo see ticket #448
614  // may be different from length
615 
616  // Obtain lane and shape rotations
617  int segments = (int) getShape().size() - 1;
618  if (segments >= 0) {
619  myShapeRotations.reserve(segments);
620  myShapeLengths.reserve(segments);
621  for (int i = 0; i < segments; ++i) {
622  const Position& f = getShape()[i];
623  const Position& s = getShape()[i + 1];
624  myShapeLengths.push_back(f.distanceTo2D(s));
625  myShapeRotations.push_back((SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI);
626  }
627  }
628  // Update geometry of additionals vinculated with this lane
629  for (AdditionalVector::iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) {
630  (*i)->updateGeometry();
631  }
632  // In Move mode, connections aren't updated
634  // Update incoming connections of this lane
635  std::vector<GNEConnection*> incomingConnections = getGNEIncomingConnections();
636  for (std::vector<GNEConnection*>::iterator i = incomingConnections.begin(); i != incomingConnections.end(); i++) {
637  (*i)->updateGeometry();
638  }
639  // Update outgoings connections of this lane
640  std::vector<GNEConnection*> outGoingConnections = getGNEOutcomingConnections();
641  for (std::vector<GNEConnection*>::iterator i = outGoingConnections.begin(); i != outGoingConnections.end(); i++) {
642  (*i)->updateGeometry();
643  }
644  }
645  // If lane has enought lenght for show textures of restricted lanes
646  if ((getLaneShapeLenght() > 4)) {
647  // if lane is restricted
649  // get values for position and rotation of icons
650  for (int i = 2; i < getLaneShapeLenght() - 1; i += 15) {
651  myLaneRestrictedTexturePositions.push_back(getShape().positionAtOffset(i));
652  myLaneRestrictedTextureRotations.push_back(getShape().rotationDegreeAtOffset(i));
653  }
654  }
655  }
656 }
657 
658 int
660  return myIndex;
661 }
662 
663 void
664 GNELane::setIndex(int index) {
665  myIndex = index;
667 }
668 
669 
670 SUMOReal
673 }
674 
675 
676 SUMOReal
679 }
680 
681 
682 SUMOReal
684  return getShape().length();
685 }
686 
687 
688 SUMOReal
690  return (position * getLaneShapeLenght()) / getLaneParametricLenght();
691 }
692 
693 
694 SUMOReal
696  return (position * getLaneParametricLenght()) / getLaneShapeLenght();
697 }
698 
699 
700 void
702  // First check that additional wasn't already inserted
703  for (AdditionalVector::iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) {
704  if (*i == additional) {
705  throw ProcessError(toString(getTag()) + " with ID='" + additional->getID() + "' was already inserted in lane with ID='" + getID() + "'");
706  }
707  }
708  myAdditionals.push_back(additional);
709 }
710 
711 
712 void
714  // Declare iterator
715  AdditionalVector::iterator i = myAdditionals.begin();
716  // Find additional
717  while ((*i != additional) && (i != myAdditionals.end())) {
718  i++;
719  }
720  // If additional was found, remove it
721  if (i == myAdditionals.end()) {
722  throw ProcessError(toString(getTag()) + " with ID='" + additional->getID() + "' doesn't exist in lane with ID='" + getID() + "'");
723  } else {
724  myAdditionals.erase(i);
725  }
726 }
727 
728 
729 const std::vector<GNEAdditional*>&
731  return myAdditionals;
732 }
733 
734 
735 bool
737  return myParentEdge.getNBEdge()->getPermissions(myIndex) == vclass;
738 }
739 
740 
741 std::string
743  const NBEdge* edge = myParentEdge.getNBEdge();
744  switch (key) {
745  case SUMO_ATTR_ID:
746  return getMicrosimID();
747  case SUMO_ATTR_SPEED:
748  return toString(edge->getLaneSpeed(myIndex));
749  case SUMO_ATTR_ALLOW:
750  // return all allowed classes (may differ from the written attributes)
752  case SUMO_ATTR_DISALLOW:
753  // return all disallowed classes (may differ from the written attributes)
754  return getVehicleClassNames(~(edge->getPermissions(myIndex)));
755  case SUMO_ATTR_WIDTH:
757  return "default";
758  } else {
759  return toString(edge->getLaneStruct(myIndex).width);
760  }
761  case SUMO_ATTR_ENDOFFSET:
762  return toString(edge->getLaneStruct(myIndex).endOffset);
763  case SUMO_ATTR_INDEX:
764  return toString(myIndex);
765  default:
766  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
767  }
768 }
769 
770 
771 void
772 GNELane::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
773  switch (key) {
774  case SUMO_ATTR_ID:
775  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + toString(getTag()) + " isn't allowed");
776  case SUMO_ATTR_SPEED:
777  case SUMO_ATTR_ALLOW:
778  case SUMO_ATTR_DISALLOW:
779  case SUMO_ATTR_WIDTH:
780  case SUMO_ATTR_ENDOFFSET:
781  case SUMO_ATTR_INDEX:
782  // no special handling
783  undoList->p_add(new GNEChange_Attribute(this, key, value));
784  break;
785  default:
786  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
787  }
788 }
789 
790 
791 bool
792 GNELane::isValid(SumoXMLAttr key, const std::string& value) {
793  switch (key) {
794  case SUMO_ATTR_ID:
795  return false;
796  case SUMO_ATTR_SPEED:
797  return canParse<SUMOReal>(value);
798  case SUMO_ATTR_ALLOW:
799  case SUMO_ATTR_DISALLOW:
800  return canParseVehicleClasses(value);
801  case SUMO_ATTR_WIDTH:
802  if (value == "default") {
803  return true;
804  } else {
805  return canParse<SUMOReal>(value) && (isPositive<SUMOReal>(value) || parse<SUMOReal>(value) == NBEdge::UNSPECIFIED_WIDTH);
806  }
807  case SUMO_ATTR_ENDOFFSET:
808  return canParse<SUMOReal>(value);
809  case SUMO_ATTR_INDEX:
810  return value == toString(myIndex);
811  default:
812  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
813  }
814 }
815 
816 
817 void
819  mySpecialColor = color;
820 }
821 
822 // ===========================================================================
823 // private
824 // ===========================================================================
825 
826 void
827 GNELane::setAttribute(SumoXMLAttr key, const std::string& value) {
828  NBEdge* edge = myParentEdge.getNBEdge();
829  switch (key) {
830  case SUMO_ATTR_ID:
831  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + toString(getTag()) + " isn't allowed");
832  case SUMO_ATTR_SPEED:
833  edge->setSpeed(myIndex, parse<SUMOReal>(value));
834  break;
835  case SUMO_ATTR_ALLOW:
837  updateGeometry();
838  myNet->getViewNet()->update();
839  break;
840  case SUMO_ATTR_DISALLOW:
841  edge->setPermissions(~parseVehicleClasses(value), myIndex); // negation yields allowed
842  updateGeometry();
843  myNet->getViewNet()->update();
844  break;
845  case SUMO_ATTR_WIDTH:
846  if (value == "default") {
848  } else {
849  edge->setLaneWidth(myIndex, parse<SUMOReal>(value));
850  }
851  break;
852  case SUMO_ATTR_ENDOFFSET:
853  edge->setEndOffset(myIndex, parse<SUMOReal>(value));
854  break;
855  default:
856  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
857  }
858 }
859 
860 
861 bool
862 GNELane::setFunctionalColor(int activeScheme) const {
863  switch (activeScheme) {
864  case 6: {
865  SUMOReal hue = GeomHelper::naviDegree(getShape().beginEndAngle()); // [0-360]
867  return true;
868  }
869  default:
870  return false;
871  }
872 }
873 
874 
875 bool
877  const int activeScheme = c.getActive();
878  myShapeColors.clear();
879  switch (activeScheme) {
880  case 9: // color by height at segment start
881  for (PositionVector::const_iterator ii = getShape().begin(); ii != getShape().end() - 1; ++ii) {
882  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
883  }
884  return true;
885  case 11: // color by inclination at segment start
886  for (int ii = 1; ii < (int)getShape().size(); ++ii) {
887  const SUMOReal inc = (getShape()[ii].z() - getShape()[ii - 1].z()) / MAX2(POSITION_EPS, getShape()[ii].distanceTo2D(getShape()[ii - 1]));
888  myShapeColors.push_back(c.getScheme().getColor(inc));
889  }
890  return true;
891  default:
892  return false;
893  }
894 }
895 
896 
897 SUMOReal
898 GNELane::getColorValue(int activeScheme) const {
899  const SVCPermissions myPermissions = myParentEdge.getNBEdge()->getPermissions(myIndex);
900  switch (activeScheme) {
901  case 0:
902  switch (myPermissions) {
903  case SVC_PEDESTRIAN:
904  return 1;
905  case SVC_BICYCLE:
906  return 2;
907  case 0:
908  return 3;
909  case SVC_SHIP:
910  return 4;
911  default:
912  break;
913  }
914  if ((myPermissions & SVC_PASSENGER) != 0 || isRailway(myPermissions)) {
915  return 0;
916  } else {
917  return 5;
918  }
919  case 1:
920  return gSelected.isSelected(getType(), getGlID()) ||
921  gSelected.isSelected(GLO_EDGE, dynamic_cast<GNEEdge*>(&myParentEdge)->getGlID());
922  case 2:
923  return (SUMOReal)myPermissions;
924  case 3:
926  case 4:
927  return myParentEdge.getNBEdge()->getNumLanes();
928  case 5: {
930  }
931  // case 6: by angle (functional)
932  case 7: {
933  return myParentEdge.getNBEdge()->getPriority();
934  }
935  case 8: {
936  // color by z of first shape point
937  return getShape()[0].z();
938  }
939  // case 9: by segment height
940  case 10: {
941  // color by incline
942  return (getShape()[-1].z() - getShape()[0].z()) / myParentEdge.getNBEdge()->getLength();
943  }
944  }
945  return 0;
946 }
947 
948 
949 bool
952 }
953 
954 
955 bool
957  return isWaterway(myParentEdge.getNBEdge()->getPermissions(myIndex)) && s.showRails; // reusing the showRails setting
958 }
959 
960 
961 void
962 GNELane::drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const {
963  glPushMatrix();
964  // draw on top of of the white area between the rails
965  glTranslated(0, 0, 0.1);
966  int e = (int) getShape().size() - 1;
967  for (int i = 0; i < e; ++i) {
968  glPushMatrix();
969  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.0);
970  glRotated(myShapeRotations[i], 0, 0, 1);
971  for (SUMOReal t = 0; t < myShapeLengths[i]; t += spacing) {
972  glBegin(GL_QUADS);
973  glVertex2d(-halfWidth, -t);
974  glVertex2d(-halfWidth, -t - length);
975  glVertex2d(halfWidth, -t - length);
976  glVertex2d(halfWidth, -t);
977  glEnd();
978  }
979  glPopMatrix();
980  }
981  glPopMatrix();
982 }
983 
984 
985 void
988  glColor3d(0.3, 0.3, 0.3);
989  glPushMatrix();
990  glTranslated(0, 0, GLO_JUNCTION + 0.1);
991  int e = (int) getShape().size() - 1;
992  for (int i = 0; i < e; ++i) {
993  glPushMatrix();
994  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
995  glRotated(myShapeRotations[i], 0, 0, 1);
996  for (SUMOReal t = 0; t < myShapeLengths[i]; t += width) {
997  const SUMOReal length = MIN2(width * (SUMOReal)0.5, myShapeLengths[i] - t);
998  glBegin(GL_TRIANGLES);
999  glVertex2d(0, -t - length);
1000  glVertex2d(-width * 0.25, -t);
1001  glVertex2d(+width * 0.25, -t);
1002  glEnd();
1003  }
1004  glPopMatrix();
1005  }
1006  glPopMatrix();
1007 }
1008 
1009 
1010 
1011 const std::string&
1013  return myParentEdge.getMicrosimID();
1014 }
1015 
1016 
1017 long
1018 GNELane::onDefault(FXObject* obj, FXSelector sel, void* data) {
1019  if (myTLSEditor != 0) {
1020  myTLSEditor->handleMultiChange(this, obj, sel, data);
1021  }
1022  return 1;
1023 }
1024 
1025 
1026 GNEEdge&
1028  return myParentEdge;
1029 }
1030 
1031 
1032 std::vector<GNEConnection*>
1034  // Declare a vector to save incoming connections
1035  std::vector<GNEConnection*> incomingConnections;
1036  // Obtain incoming edges if junction source was already created
1037  GNEJunction* junctionSource = myParentEdge.getGNEJunctionSource();
1038  if (junctionSource) {
1039  // Iterate over incoming GNEEdges of junction
1040  for (std::vector<GNEEdge*>::const_iterator i = junctionSource->getGNEIncomingEdges().begin(); i != junctionSource->getGNEIncomingEdges().end(); i++) {
1041  // Iterate over connection of incoming edges
1042  for (std::vector<GNEConnection*>::const_iterator j = (*i)->getGNEConnections().begin(); j != (*i)->getGNEConnections().end(); j++) {
1043  if ((*j)->getNBEdgeConnection().fromLane == getIndex()) {
1044  incomingConnections.push_back(*j);
1045  }
1046  }
1047  }
1048  }
1049  return incomingConnections;
1050 }
1051 
1052 
1053 std::vector<GNEConnection*>
1055  // Obtain GNEConnection of edge parent
1056  const std::vector<GNEConnection*>& edgeConnections = myParentEdge.getGNEConnections();
1057  std::vector<GNEConnection*> outcomingConnections;
1058  // Obtain outgoing connections
1059  for (std::vector<GNEConnection*>::const_iterator i = edgeConnections.begin(); i != edgeConnections.end(); i++) {
1060  if ((*i)->getNBEdgeConnection().fromLane == getIndex()) {
1061  outcomingConnections.push_back(*i);
1062  }
1063  }
1064  return outcomingConnections;
1065 }
1066 
1067 /****************************************************************************/
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
Definition: GNELane.cpp:956
EditMode getCurrentEditMode() const
get the current edit mode
The link is a partial left direction.
SUMOReal endOffset
This lane&#39;s offset to the intersection begin.
Definition: NBEdge.h:141
bool controlsEdge(GNEEdge &edge) const
whether the given edge is controlled by the currently edited tlDef
const std::string & getParentName() const
Returns the name of the parent object (if any)
Definition: GNELane.cpp:1012
const std::vector< SUMOReal > & getShapeRotations() const
returns the vector with the shape rotations
Definition: GNELane.cpp:589
add busLane
Definition: GUIAppEnum.h:635
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:244
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:156
PositionVector shape
The lane&#39;s shape.
Definition: NBEdge.h:129
GNENet * myNet
the net to inform about updates
is a pedestrian
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:237
mode for moving things
Definition: GNEViewNet.h:53
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
GNETLSEditorFrame * myTLSEditor
the tls-editor for setting multiple links in TLS-mode
Definition: GNELane.h:245
static RGBColor fromHSV(SUMOReal h, SUMOReal s, SUMOReal v)
Converts the given hsv-triplet to rgb.
Definition: RGBColor.cpp:294
AdditionalVector myAdditionals
list with the additonals vinculated with this lane
Definition: GNELane.h:236
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:414
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
NBNode * myTo
Definition: NBEdge.h:1321
void drawMarkings(const bool &selectedEdge, SUMOReal scale) const
draw lane markings
Definition: GNELane.cpp:369
SUMOReal getSpeed() const
returns the current speed of lane
Definition: GNELane.cpp:671
const RGBColor * mySpecialColor
optional special color
Definition: GNELane.h:239
static const RGBColor selectedLaneColor
color of selected lane
Definition: GNENet.h:99
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
Definition: NBEdge.cpp:936
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
void setLaneWidth(int lane, SUMOReal width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2664
SUMOReal getPositionRelativeToShapeLenght(SUMOReal position) const
Definition: GNELane.cpp:695
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2719
GUIColorer laneColorer
The lane colorer.
SUMOReal laneWidthExaggeration
The lane exaggeration (upscale thickness)
Stores the information about how to visualize structures.
This is an uncontrolled, minor link, has to stop.
vehicle is a bicycle
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
Definition: GNELane.cpp:736
const std::vector< GNEAdditional * > & getAdditionalChilds() const
get additional childs of lane
Definition: GNELane.cpp:730
int SVCPermissions
void removeAdditionalChild(GNEAdditional *additional)
remove additional child to this lane
Definition: GNELane.cpp:713
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
The representation of a single edge during network building.
Definition: NBEdge.h:71
static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth, int steps=8)
Draws an unfilled circle around (0,0)
Definition: GLHelper.cpp:375
bool showRails
Information whether rails shall be drawn.
The link is a 180 degree turn.
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:974
mode for editing tls
Definition: GNEViewNet.h:63
duplicate a lane
Definition: GUIAppEnum.h:621
static void drawBoxLines(const PositionVector &geom, const std::vector< SUMOReal > &rots, const std::vector< SUMOReal > &lengths, SUMOReal width, int cornerDetail=0, SUMOReal offset=0)
Draws thick lines.
Definition: GLHelper.cpp:176
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some lane function
Definition: GNELane.cpp:862
SUMOReal getColorValue(int activeScheme) const
return value for lane coloring according to the given scheme
Definition: GNELane.cpp:898
T MAX2(T a, T b)
Definition: StdDefs.h:70
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:512
static void drawBoxLine(const Position &beg, SUMOReal rot, SUMOReal visLength, SUMOReal width, SUMOReal offset=0)
Draws a thick line.
Definition: GLHelper.cpp:130
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
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:2735
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
remove bikelane
Definition: GUIAppEnum.h:639
int editMode
the current NETEDIT mode (temporary)
transform lane to busLane
Definition: GUIAppEnum.h:627
bool showLaneDirection
Whether to show direction indicators for lanes.
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and some lane function ...
Definition: GNELane.cpp:876
GNELane()
FOX needs this.
Definition: GNELane.cpp:88
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GNELane.h:242
This is an uncontrolled, right-before-left link.
void drawTLSLinkNo() const
draw TLS Link Number
Definition: GNELane.cpp:107
add reverse edge
Definition: GUIAppEnum.h:605
split an edge
Definition: GUIAppEnum.h:601
const std::vector< GNEConnection * > & getGNEConnections()
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:485
void handleMultiChange(GNELane *lane, FXObject *obj, FXSelector sel, void *data)
update phase definition for the current traffic light and phase
const SUMOReal SUMO_const_laneOffset
Definition: StdDefs.h:51
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1123
The link is controlled by a tls which is off, not blinking, may pass.
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
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.
Boundary getBoundary() const
returns the boundry (including lanes)
Definition: GNELane.cpp:601
Position positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:659
std::vector< SUMOReal > myLaneRestrictedTextureRotations
Rotations of textures of restricted lanes.
Definition: GNELane.h:232
GUIGlID getGlID() const
Returns the numerical id of the object.
static void drawTriangleAtEnd(const Position &p1, const Position &p2, SUMOReal tLength, SUMOReal tWidth)
Draws a triangle at the end of the given line.
Definition: GLHelper.cpp:422
SUMOReal getLaneSpeed(int lane) const
get lane speed
Definition: NBEdge.cpp:1522
void setIndex(int index)
Definition: GNELane.cpp:664
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
int myIndex
The index of this lane.
Definition: GNELane.h:218
This is an uncontrolled, zipper-merge link.
The link is a (hard) left direction.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:69
SUMOReal scale
information about a lane&#39;s width (temporary, used for a single view)
transform lane to bikelane
Definition: GUIAppEnum.h:625
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
std::vector< std::string > getStrings() const
The link is a straight direction.
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition: GNELane.cpp:950
SUMOReal getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn&#39;t set.
Definition: NBEdge.h:479
void drawDirectionIndicators() const
direction indicators for lanes
Definition: GNELane.cpp:986
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
reverse an edge
Definition: GUIAppEnum.h:603
#define PI
Definition: polyfonts.c:61
SUMOReal selectionScale
the current selection scaling in NETEDIT (temporary)
void drawLane2LaneConnections() const
draw lane to lane connections
Definition: GNELane.cpp:187
set non-default geometry endpoint
Definition: GUIAppEnum.h:611
restore geometry endpoint to node position
Definition: GUIAppEnum.h:613
void drawArrows() const
draw arrows
Definition: GNELane.cpp:117
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:409
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:443
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:1027
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNELane.cpp:772
SUMOReal getLaneParametricLenght() const
returns the parameteric length of the lane
Definition: GNELane.cpp:677
SUMOReal getPositionRelativeToParametricLenght(SUMOReal position) const
Definition: GNELane.cpp:689
This is an uncontrolled, minor link, has to brake.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void addAdditionalChild(GNEAdditional *additional)
add additional child to this lane
Definition: GNELane.cpp:701
A list of positions.
bool isLogicValid()
whether this junction has a valid logic
std::vector< SUMOReal > myShapeRotations
Definition: GNELane.h:223
revert transformation
Definition: GUIAppEnum.h:629
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
friend class GNEChange_Attribute
declare friend class
SUMOReal z() const
Returns the z-position.
Definition: Position.h:73
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1033
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:402
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
const T getColor(const SUMOReal value) const
T MIN2(T a, T b)
Definition: StdDefs.h:64
The link is a (hard) right direction.
#define POSITION_EPS
Definition: config.h:182
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:1617
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
const std::string getID() const
function to support debugging
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition: GNELane.cpp:1054
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:1553
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1342
The link is a partial right direction.
std::string getVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a &#39; &#39;.
vehicle is a passenger car (a "normal" car)
void updateGeometry()
update pre-computed geometry information
Definition: GNELane.cpp:607
static SUMOReal naviDegree(const SUMOReal angle)
Definition: GeomHelper.cpp:191
transform lane to sidewalk
Definition: GUIAppEnum.h:623
is an arbitrary ship
void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const
draw crossties for railroads
Definition: GNELane.cpp:962
begin/end of the description of an edge
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
std::string getAttribute(SumoXMLAttr key) const
Definition: GNELane.cpp:742
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:2763
void drawLinkRules() const
draw link rules
Definition: GNELane.cpp:112
GNEEdge & myParentEdge
The Edge that to which this lane belongs.
Definition: GNELane.h:215
SUMOReal length() const
Returns the length.
vehicle is a bus
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
Definition: Boundary.cpp:238
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:423
split an edge
Definition: GUIAppEnum.h:599
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:583
SUMOReal getLaneShapeLenght() const
returns the length of the lane&#39;s shape
Definition: GNELane.cpp:683
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
Definition: GNELane.cpp:1018
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
The link is controlled by a tls which is off and blinks, has to brake.
std::vector< Position > myLaneRestrictedTexturePositions
Position of textures of restricted lanes.
Definition: GNELane.h:229
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
Definition: GNELane.h:226
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
void setSpecialColor(const RGBColor *Color2)
Definition: GNELane.cpp:818
The popup menu of a globject.
an edge
const std::vector< SUMOReal > & getShapeLengths() const
returns the vector with the shape lengths
Definition: GNELane.cpp:595
This is an uncontrolled, major link, may pass.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNELane.cpp:575
remove inner geometry
Definition: GUIAppEnum.h:615
static const StringBijection< FXuint > LinkStateNames
long names for link states
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:125
Represents a single node (junction) during network building.
Definition: NBNode.h:75
T get(const std::string &str) const
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:250
The link is a 180 degree turn (left-hand network)
static void drawLine(const Position &beg, SUMOReal rot, SUMOReal visLength)
Draws a thin line.
Definition: GLHelper.cpp:269
SumoXMLTag getTag() const
get XML Tag assigned to this object
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
add bikelane
Definition: GUIAppEnum.h:633
void setEndOffset(int lane, SUMOReal offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2703
#define SUMOReal
Definition: config.h:208
std::string getLaneID(int lane) const
get Lane ID (Secure)
Definition: NBEdge.cpp:2536
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
static const RGBColor selectionColor
color of selection
Definition: GNENet.h:96
mode for connecting lanes
Definition: GNEViewNet.h:61
mode for creating new edges
Definition: GNEViewNet.h:51
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNELane.cpp:792
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:258
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
SUMOReal laneMinSize
The minimum visual lane width for drawing.
void drawLinkNo() const
draw link Number
Definition: GNELane.cpp:102
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNELane.cpp:563
GUISelectedStorage gSelected
A global holder of selected objects.
void closeBuilding()
Closes the building of the table.
A window containing a gl-object&#39;s parameter.
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1114
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static void drawTexturedBox(int which, SUMOReal size)
Draws a named texture as a box with the given size.
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:683
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNELane.cpp:237
~GNELane()
Destructor.
Definition: GNELane.cpp:97
SUMOReal width
This lane&#39;s width.
Definition: NBEdge.h:144
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
SUMOReal getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:470
The link has no direction (is a dead end link)
remove busLane
Definition: GUIAppEnum.h:641
a junction
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:162
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:449