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-2016 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),
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),
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 edge name to clipboard", 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 edge here", 0, &parent, MID_GNE_SPLIT_EDGE);
431  new FXMenuCommand(ret, "Split edges in both direction here", 0, &parent, MID_GNE_SPLIT_EDGE_BIDI);
432  new FXMenuCommand(ret, "Reverse edge", 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 Edges", 0, &parent, MID_GNE_STRAIGHTEN);
438  } else {
439  new FXMenuCommand(ret, "Straighten edge", 0, &parent, MID_GNE_STRAIGHTEN);
440  }
442  new FXMenuCommand(ret, "Duplicate selected lanes", 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, "Sidewalsk", 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 lanes", 0, addSpecialLanes);
465  new FXMenuCascade(ret, "remove special lanes", 0, removeSpecialLanes);
466  new FXMenuCascade(ret, "transform to special lanes", 0, transformSlanes);
467  } else {
468  new FXMenuCommand(ret, "Duplicate lane", 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 lane", 0, addSpecialLanes);
498  FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(ret, "remove special lane", 0, removeSpecialLanes);
499  new FXMenuCascade(ret, "transform to special lane", 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  // Update geometry of additionalSets vinculated to this lane
633  for (AdditionalSetVector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); ++i) {
634  (*i)->updateGeometry();
635  }
636  // In Move mode, connections aren't updated
638  // Update incoming connections of this lane
639  std::vector<GNEConnection*> incomingConnections = getGNEIncomingConnections();
640  for (std::vector<GNEConnection*>::iterator i = incomingConnections.begin(); i != incomingConnections.end(); i++) {
641  (*i)->updateGeometry();
642  }
643  // Update outgoings connections of this lane
644  std::vector<GNEConnection*> outGoingConnections = getGNEOutcomingConnections();
645  for (std::vector<GNEConnection*>::iterator i = outGoingConnections.begin(); i != outGoingConnections.end(); i++) {
646  (*i)->updateGeometry();
647  }
648  }
649  // If lane has enought lenght for show textures of restricted lanes
650  if ((getLaneShapeLenght() > 4)) {
651  // if lane is restricted
653  // get values for position and rotation of icons
654  for (int i = 2; i < getLaneShapeLenght() - 1; i += 15) {
655  myLaneRestrictedTexturePositions.push_back(getShape().positionAtOffset(i));
656  myLaneRestrictedTextureRotations.push_back(getShape().rotationDegreeAtOffset(i));
657  }
658  }
659  }
660 }
661 
662 int
664  return myIndex;
665 }
666 
667 void
668 GNELane::setIndex(int index) {
669  myIndex = index;
671 }
672 
673 
674 SUMOReal
677 }
678 
679 
680 SUMOReal
683 }
684 
685 
686 SUMOReal
688  return getShape().length();
689 }
690 
691 
692 SUMOReal
694  return (position * getLaneShapeLenght()) / getLaneParametricLenght();
695 }
696 
697 
698 SUMOReal
700  return (position * getLaneParametricLenght()) / getLaneShapeLenght();
701 }
702 
703 
704 void
706  // First check that additional wasn't already inserted
707  for (AdditionalVector::iterator i = myAdditionals.begin(); i != myAdditionals.end(); i++) {
708  if (*i == additional) {
709  throw ProcessError("additional element with ID='" + additional->getID() + "' was already inserted in lane with ID='" + getID() + "'");
710  }
711  }
712  myAdditionals.push_back(additional);
713 }
714 
715 
716 void
718  // Declare iterator
719  AdditionalVector::iterator i = myAdditionals.begin();
720  // Find additional
721  while ((*i != additional) && (i != myAdditionals.end())) {
722  i++;
723  }
724  // If additional was found, remove it
725  if (i == myAdditionals.end()) {
726  throw ProcessError("additional element with ID='" + additional->getID() + "' doesn't exist in lane with ID='" + getID() + "'");
727  } else {
728  myAdditionals.erase(i);
729  }
730 }
731 
732 
733 const std::vector<GNEAdditional*>&
735  return myAdditionals;
736 }
737 
738 
739 bool
741  // Check if additionalSet already exists before insertion
742  for (AdditionalSetVector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); i++) {
743  if ((*i) == additionalSet) {
744  return false;
745  }
746  }
747  // Insert it and retur true
748  myAdditionalSetParents.push_back(additionalSet);
749  return true;
750 }
751 
752 
753 bool
755  // search additionalSet and remove it
756  for (AdditionalSetVector::iterator i = myAdditionalSetParents.begin(); i != myAdditionalSetParents.end(); i++) {
757  if ((*i) == additionalSet) {
758  myAdditionalSetParents.erase(i);
759  return true;
760  }
761  }
762  // If additionalSet wasn't found, return false
763  return false;
764 }
765 
766 
767 const std::vector<GNEAdditionalSet*>&
769  return myAdditionalSetParents;
770 }
771 
772 
773 bool
775  if (vclass == SVC_PEDESTRIAN) {
776  return (myParentEdge.getNBEdge()->getPermissions(myIndex) == 1048576);
777  } else if (vclass == SVC_BICYCLE) {
778  return (myParentEdge.getNBEdge()->getPermissions(myIndex) == 524288);
779  } else if (vclass == SVC_BUS) {
780  return (myParentEdge.getNBEdge()->getPermissions(myIndex) == 256);
781  } else {
782  return false;
783  }
784 }
785 
786 
787 std::string
789  const NBEdge* edge = myParentEdge.getNBEdge();
790  switch (key) {
791  case SUMO_ATTR_ID:
792  return getMicrosimID();
793  case SUMO_ATTR_SPEED:
794  return toString(edge->getLaneSpeed(myIndex));
795  case SUMO_ATTR_ALLOW:
796  // return all allowed classes (may differ from the written attributes)
798  case SUMO_ATTR_DISALLOW:
799  // return all disallowed classes (may differ from the written attributes)
800  return getVehicleClassNames(~(edge->getPermissions(myIndex)));
801  case SUMO_ATTR_WIDTH:
802  return toString(edge->getLaneStruct(myIndex).width);
803  case SUMO_ATTR_ENDOFFSET:
804  return toString(edge->getLaneStruct(myIndex).endOffset);
805  case SUMO_ATTR_INDEX:
806  return toString(myIndex);
807  default:
808  throw InvalidArgument("lane attribute '" + toString(key) + "' not allowed");
809  }
810 }
811 
812 
813 void
814 GNELane::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
815  switch (key) {
816  case SUMO_ATTR_ID:
817  throw InvalidArgument("modifying lane attribute '" + toString(key) + "' not allowed");
818  case SUMO_ATTR_SPEED:
819  case SUMO_ATTR_ALLOW:
820  case SUMO_ATTR_DISALLOW:
821  case SUMO_ATTR_WIDTH:
822  case SUMO_ATTR_ENDOFFSET:
823  case SUMO_ATTR_INDEX:
824  // no special handling
825  undoList->p_add(new GNEChange_Attribute(this, key, value));
826  break;
827  default:
828  throw InvalidArgument("lane attribute '" + toString(key) + "' not allowed");
829  }
830 }
831 
832 
833 bool
834 GNELane::isValid(SumoXMLAttr key, const std::string& value) {
835  switch (key) {
836  case SUMO_ATTR_ID:
837  return false;
838  case SUMO_ATTR_SPEED:
839  return canParse<SUMOReal>(value);
840  case SUMO_ATTR_ALLOW:
841  case SUMO_ATTR_DISALLOW:
842  return canParseVehicleClasses(value);
843  case SUMO_ATTR_WIDTH:
844  return canParse<SUMOReal>(value) && (isPositive<SUMOReal>(value) || parse<SUMOReal>(value) == NBEdge::UNSPECIFIED_WIDTH);
845  case SUMO_ATTR_ENDOFFSET:
846  return canParse<SUMOReal>(value);
847  case SUMO_ATTR_INDEX:
848  return value == toString(myIndex);
849  default:
850  throw InvalidArgument("lane attribute '" + toString(key) + "' not allowed");
851  }
852 }
853 
854 
855 void
857  mySpecialColor = color;
858 }
859 
860 // ===========================================================================
861 // private
862 // ===========================================================================
863 
864 void
865 GNELane::setAttribute(SumoXMLAttr key, const std::string& value) {
866  NBEdge* edge = myParentEdge.getNBEdge();
867  switch (key) {
868  case SUMO_ATTR_ID:
869  throw InvalidArgument("modifying lane attribute '" + toString(key) + "' not allowed");
870  case SUMO_ATTR_SPEED:
871  edge->setSpeed(myIndex, parse<SUMOReal>(value));
872  break;
873  case SUMO_ATTR_ALLOW:
875  updateGeometry();
876  myNet->getViewNet()->update();
877  break;
878  case SUMO_ATTR_DISALLOW:
879  edge->setPermissions(~parseVehicleClasses(value), myIndex); // negation yields allowed
880  updateGeometry();
881  myNet->getViewNet()->update();
882  break;
883  case SUMO_ATTR_WIDTH:
884  edge->setLaneWidth(myIndex, parse<SUMOReal>(value));
885  break;
886  case SUMO_ATTR_ENDOFFSET:
887  edge->setEndOffset(myIndex, parse<SUMOReal>(value));
888  break;
889  default:
890  throw InvalidArgument("lane attribute '" + toString(key) + "' not allowed");
891  }
892 }
893 
894 
895 bool
896 GNELane::setFunctionalColor(int activeScheme) const {
897  switch (activeScheme) {
898  case 6: {
899  SUMOReal hue = GeomHelper::naviDegree(getShape().beginEndAngle()); // [0-360]
901  return true;
902  }
903  default:
904  return false;
905  }
906 }
907 
908 
909 bool
911  const int activeScheme = c.getActive();
912  myShapeColors.clear();
913  switch (activeScheme) {
914  case 9: // color by height at segment start
915  for (PositionVector::const_iterator ii = getShape().begin(); ii != getShape().end() - 1; ++ii) {
916  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
917  }
918  return true;
919  case 11: // color by inclination at segment start
920  for (int ii = 1; ii < (int)getShape().size(); ++ii) {
921  const SUMOReal inc = (getShape()[ii].z() - getShape()[ii - 1].z()) / MAX2(POSITION_EPS, getShape()[ii].distanceTo2D(getShape()[ii - 1]));
922  myShapeColors.push_back(c.getScheme().getColor(inc));
923  }
924  return true;
925  default:
926  return false;
927  }
928 }
929 
930 
931 SUMOReal
932 GNELane::getColorValue(int activeScheme) const {
933  const SVCPermissions myPermissions = myParentEdge.getNBEdge()->getPermissions(myIndex);
934  switch (activeScheme) {
935  case 0:
936  switch (myPermissions) {
937  case SVC_PEDESTRIAN:
938  return 1;
939  case SVC_BICYCLE:
940  return 2;
941  case 0:
942  return 3;
943  case SVC_SHIP:
944  return 4;
945  default:
946  break;
947  }
948  if ((myPermissions & SVC_PASSENGER) != 0 || isRailway(myPermissions)) {
949  return 0;
950  } else {
951  return 5;
952  }
953  case 1:
954  return gSelected.isSelected(getType(), getGlID()) ||
955  gSelected.isSelected(GLO_EDGE, dynamic_cast<GNEEdge*>(&myParentEdge)->getGlID());
956  case 2:
957  return (SUMOReal)myPermissions;
958  case 3:
960  case 4:
961  return myParentEdge.getNBEdge()->getNumLanes();
962  case 5: {
964  }
965  // case 6: by angle (functional)
966  case 7: {
967  return myParentEdge.getNBEdge()->getPriority();
968  }
969  case 8: {
970  // color by z of first shape point
971  return getShape()[0].z();
972  }
973  // case 9: by segment height
974  case 10: {
975  // color by incline
976  return (getShape()[-1].z() - getShape()[0].z()) / myParentEdge.getNBEdge()->getLength();
977  }
978  }
979  return 0;
980 }
981 
982 
983 bool
986 }
987 
988 
989 bool
991  return isWaterway(myParentEdge.getNBEdge()->getPermissions(myIndex)) && s.showRails; // reusing the showRails setting
992 }
993 
994 
995 void
996 GNELane::drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const {
997  glPushMatrix();
998  // draw on top of of the white area between the rails
999  glTranslated(0, 0, 0.1);
1000  int e = (int) getShape().size() - 1;
1001  for (int i = 0; i < e; ++i) {
1002  glPushMatrix();
1003  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.0);
1004  glRotated(myShapeRotations[i], 0, 0, 1);
1005  for (SUMOReal t = 0; t < myShapeLengths[i]; t += spacing) {
1006  glBegin(GL_QUADS);
1007  glVertex2d(-halfWidth, -t);
1008  glVertex2d(-halfWidth, -t - length);
1009  glVertex2d(halfWidth, -t - length);
1010  glVertex2d(halfWidth, -t);
1011  glEnd();
1012  }
1013  glPopMatrix();
1014  }
1015  glPopMatrix();
1016 }
1017 
1018 
1019 void
1022  glColor3d(0.3, 0.3, 0.3);
1023  glPushMatrix();
1024  glTranslated(0, 0, GLO_JUNCTION + 0.1);
1025  int e = (int) getShape().size() - 1;
1026  for (int i = 0; i < e; ++i) {
1027  glPushMatrix();
1028  glTranslated(getShape()[i].x(), getShape()[i].y(), 0.1);
1029  glRotated(myShapeRotations[i], 0, 0, 1);
1030  for (SUMOReal t = 0; t < myShapeLengths[i]; t += width) {
1031  const SUMOReal length = MIN2(width * (SUMOReal)0.5, myShapeLengths[i] - t);
1032  glBegin(GL_TRIANGLES);
1033  glVertex2d(0, -t - length);
1034  glVertex2d(-width * 0.25, -t);
1035  glVertex2d(+width * 0.25, -t);
1036  glEnd();
1037  }
1038  glPopMatrix();
1039  }
1040  glPopMatrix();
1041 }
1042 
1043 
1044 
1045 const std::string&
1047  return myParentEdge.getMicrosimID();
1048 }
1049 
1050 
1051 long
1052 GNELane::onDefault(FXObject* obj, FXSelector sel, void* data) {
1053  if (myTLSEditor != 0) {
1054  myTLSEditor->handleMultiChange(this, obj, sel, data);
1055  }
1056  return 1;
1057 }
1058 
1059 
1060 GNEEdge&
1062  return myParentEdge;
1063 }
1064 
1065 
1066 std::vector<GNEConnection*>
1068  // Declare a vector to save incoming connections
1069  std::vector<GNEConnection*> incomingConnections;
1070  // Obtain incoming edges if junction source was already created
1071  GNEJunction* junctionSource = myParentEdge.getGNEJunctionSource();
1072  if (junctionSource) {
1073  std::vector<GNEEdge*> incomingEdges = junctionSource->getGNEIncomingEdges();
1074  // Iterate over incoming edges
1075  for (std::vector<GNEEdge*>::iterator i = incomingEdges.begin(); i != incomingEdges.end(); i++) {
1076  // Iterate over connection of incoming edges
1077  for (std::vector<GNEConnection*>::const_iterator j = (*i)->getGNEConnections().begin(); j != (*i)->getGNEConnections().end(); j++) {
1078  if ((*j)->getNBEdgeConnection().fromLane == getIndex()) {
1079  incomingConnections.push_back(*j);
1080  }
1081  }
1082  }
1083  }
1084  return incomingConnections;
1085 }
1086 
1087 
1088 std::vector<GNEConnection*>
1090  // Obtain GNEConnection of edge parent
1091  const std::vector<GNEConnection*>& edgeConnections = myParentEdge.getGNEConnections();
1092  std::vector<GNEConnection*> outcomingConnections;
1093  // Obtain outgoing connections
1094  for (std::vector<GNEConnection*>::const_iterator i = edgeConnections.begin(); i != edgeConnections.end(); i++) {
1095  if ((*i)->getNBEdgeConnection().fromLane == getIndex()) {
1096  outcomingConnections.push_back(*i);
1097  }
1098  }
1099  return outcomingConnections;
1100 }
1101 
1102 /****************************************************************************/
The link is a partial left direction.
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and some lane function ...
Definition: GNELane.cpp:910
SUMOReal endOffset
This lane&#39;s offset to the intersection begin.
Definition: NBEdge.h:141
void drawLane2LaneConnections() const
draw lane to lane connections
Definition: GNELane.cpp:187
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
Definition: NBNode.cpp:1619
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
Definition: GNELane.cpp:774
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:237
PositionVector shape
The lane&#39;s shape.
Definition: NBEdge.h:129
GNENet * myNet
the net to inform about updates
is a pedestrian
mode for moving things
Definition: GNEViewNet.h:52
void drawTLSLinkNo() const
draw TLS Link Number
Definition: GNELane.cpp:107
GNETLSEditorFrame * myTLSEditor
the tls-editor for setting multiple links in TLS-mode
Definition: GNELane.h:261
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:249
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
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:1313
const RGBColor * mySpecialColor
optional special color
Definition: GNELane.h:255
static const RGBColor selectedLaneColor
color of selected lane
Definition: GNENet.h:99
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:235
SUMOReal length() const
Returns the length.
void setLaneWidth(int lane, SUMOReal width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2627
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2682
Boundary getBoundary() const
returns the boundry (including lanes)
Definition: GNELane.cpp:601
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.
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:402
vehicle is a bicycle
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
int SVCPermissions
void removeAdditionalChild(GNEAdditional *additional)
remove additional child to this lane
Definition: GNELane.cpp:717
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:995
mode for editing tls
Definition: GNEViewNet.h:62
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.
T MAX2(T a, T b)
Definition: StdDefs.h:75
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:2698
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:55
std::vector< GNEEdge * > getGNEIncomingEdges() const
Return incoming GNEEdges.
int editMode
the current NETEDIT mode (temporary)
bool showLaneDirection
Whether to show direction indicators for lanes.
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:258
const std::vector< SUMOReal > & getShapeLengths() const
returns the vector with the shape lengths
Definition: GNELane.cpp:595
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:984
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::vector< GNEConnection * > & getGNEConnections()
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:491
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:52
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const
draw crossties for railroads
Definition: GNELane.cpp:996
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1117
An Element wich group additionalSet elements.
The link is controlled by a tls which is off, not blinking, may pass.
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.
std::vector< SUMOReal > myLaneRestrictedTextureRotations
Rotations of textures of restricted lanes.
Definition: GNELane.h:245
SUMOReal getLaneParametricLenght() const
returns the parameteric length of the lane
Definition: GNELane.cpp:681
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
void setIndex(int index)
Definition: GNELane.cpp:668
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
int myIndex
The index of this lane.
Definition: GNELane.h:231
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some lane function
Definition: GNELane.cpp:896
This is an uncontrolled, zipper-merge link.
The link is a (hard) left direction.
std::vector< std::string > getStrings() const
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:69
SUMOReal scale
information about a lane&#39;s width (temporary, used for a single view)
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNELane.cpp:237
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
The link is a straight direction.
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:232
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
Definition: NBEdge.cpp:912
SUMOReal getColorValue(int activeScheme) const
return value for lane coloring according to the given scheme
Definition: GNELane.cpp:932
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
Definition: GNELane.cpp:990
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:663
#define PI
Definition: polyfonts.c:61
SUMOReal selectionScale
the current selection scaling in NETEDIT (temporary)
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
SUMOReal getLaneShapeLenght() const
returns the length of the lane&#39;s shape
Definition: GNELane.cpp:687
const std::vector< GNEAdditionalSet * > & getAdditionalSetParents()
return list of additionalSets parents of this lane
Definition: GNELane.cpp:768
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:1061
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNELane.cpp:814
SUMOReal z() const
Returns the z-position.
Definition: Position.h:73
This is an uncontrolled, minor link, has to brake.
std::string getLaneID(int lane) const
get Lane ID (Secure)
Definition: NBEdge.cpp:2499
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:395
void drawLinkNo() const
draw link Number
Definition: GNELane.cpp:102
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:705
A list of positions.
SUMOReal getPositionRelativeToShapeLenght(SUMOReal position) const
Definition: GNELane.cpp:699
bool controlsEdge(GNEEdge &edge) const
whether the given edge is controlled by the currently edited tlDef
bool isLogicValid()
whether this junction has a valid logic
std::vector< SUMOReal > myShapeRotations
Definition: GNELane.h:236
bool removeAdditionalGeometrySet(GNEAdditionalSet *additionalSet)
remove GNEAdditionalSet from this lane
Definition: GNELane.cpp:754
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
friend class GNEChange_Attribute
declare friend class
T get(const std::string &str) const
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1067
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
void drawArrows() const
draw arrows
Definition: GNELane.cpp:117
T MIN2(T a, T b)
Definition: StdDefs.h:69
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
The link is a (hard) right direction.
#define POSITION_EPS
Definition: config.h:187
void drawMarkings(const bool &selectedEdge, SUMOReal scale) const
draw lane markings
Definition: GNELane.cpp:369
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
const T getColor(const SUMOReal value) const
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition: GNELane.cpp:1089
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1334
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:159
SUMOReal getSpeed() const
returns the current speed of lane
Definition: GNELane.cpp:675
The link is a partial right direction.
std::string getVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a &#39; &#39;.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:2726
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
is an arbitrary ship
std::string getAttribute(SumoXMLAttr key) const
Definition: GNELane.cpp:788
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:1555
EditMode getCurrentEditMode() const
get the current edit mode
Definition: GNEViewNet.cpp:924
bool addAdditionalSet(GNEAdditionalSet *additionalSet)
add GNEAdditionalSet to this lane
Definition: GNELane.cpp:740
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:55
void drawDirectionIndicators() const
direction indicators for lanes
Definition: GNELane.cpp:1020
GNEEdge & myParentEdge
The Edge that to which this lane belongs.
Definition: GNELane.h:228
vehicle is a bus
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
Definition: Boundary.cpp:232
GNEJunction * getGNEJunctionDest() const
returns the destination-junction
Definition: GNEEdge.cpp:165
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:583
const std::vector< SUMOReal > & getShapeRotations() const
returns the vector with the shape rotations
Definition: GNELane.cpp:589
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
Definition: GNELane.cpp:1052
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:659
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:63
The link is controlled by a tls which is off and blinks, has to brake.
AdditionalSetVector myAdditionalSetParents
list with the additonalSets parents of this lane
Definition: GNELane.h:252
std::vector< Position > myLaneRestrictedTexturePositions
Position of textures of restricted lanes.
Definition: GNELane.h:242
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
Definition: GNELane.h:239
SUMOReal getPositionRelativeToParametricLenght(SUMOReal position) const
Definition: GNELane.cpp:693
void setSpecialColor(const RGBColor *Color2)
Definition: GNELane.cpp:856
The popup menu of a globject.
an edge
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.
void drawLinkRules() const
draw link rules
Definition: GNELane.cpp:112
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:74
GUIGlID getGlID() const
Returns the numerical id of the object.
Position positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
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
void setEndOffset(int lane, SUMOReal offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2666
#define SUMOReal
Definition: config.h:213
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
const std::string & getParentName() const
Returns the name of the parent object (if any)
Definition: GNELane.cpp:1046
static const RGBColor selectionColor
color of selection
Definition: GNENet.h:96
mode for connecting lanes
Definition: GNEViewNet.h:60
mode for creating new edges
Definition: GNEViewNet.h:50
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNELane.cpp:834
NBEdge * getNBEdge()
returns the internal NBEdge
Definition: GNEEdge.cpp:261
SUMOReal getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn&#39;t set.
Definition: NBEdge.h:472
SUMOReal laneMinSize
The minimum visual lane width for drawing.
static GUIGlID getGif(GUITexture which)
returns a texture Gif previously defined in the enum GUITexture
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
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.
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:505
A window containing a gl-object&#39;s parameter.
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.
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:416
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNELane.cpp:575
SUMOReal getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:463
~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.
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1082
SUMOReal getLaneSpeed(int lane) const
get lane speed
Definition: NBEdge.cpp:1485
const std::vector< GNEAdditional * > & getAdditionalChilds() const
get additional childs of lane
Definition: GNELane.cpp:734
The link has no direction (is a dead end link)
a junction
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:449