Eclipse SUMO - Simulation of Urban MObility
GNELane.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A class for visualizing Lane geometry (adapted from GNELaneWrapper)
19 /****************************************************************************/
20 #include <config.h>
21 
22 #include <netedit/GNENet.h>
23 #include <netedit/GNEUndoList.h>
24 #include <netedit/GNEViewNet.h>
25 #include <netedit/GNEViewParent.h>
30 #include <netbuild/NBEdgeCont.h>
31 #include <utils/gui/div/GLHelper.h>
37 
38 #include "GNELane.h"
39 #include "GNEInternalLane.h"
40 #include "GNEConnection.h"
41 #include "GNEEdgeTemplate.h"
42 
43 // ===========================================================================
44 // FOX callback mapping
45 // ===========================================================================
46 
47 // Object implementation
48 FXIMPLEMENT(GNELane, FXDelegator, 0, 0)
49 
50 // ===========================================================================
51 // method definitions
52 // ===========================================================================
53 
54 // ---------------------------------------------------------------------------
55 // GNELane::LaneDrawingConstants - methods
56 // ---------------------------------------------------------------------------
57 
59  selectionScale(lane->isAttributeCarrierSelected() || lane->myParentEdge->isAttributeCarrierSelected() ? s.selectorFrameScale : 1),
60  exaggeration(selectionScale * s.laneWidthExaggeration),
61  halfWidth2(exaggeration * (lane->myParentEdge->getNBEdge()->getLaneWidth(lane->getIndex()) / 2 - SUMO_const_laneMarkWidth / 2)),
62  halfWidth(lane->drawUsingSelectColor() ? halfWidth2 - exaggeration * 0.3 : halfWidth2) {
63  // start drawing lane checking whether it is not too small
64  //selectionScale = lane->isAttributeCarrierSelected() || lane->myParentEdge->isAttributeCarrierSelected() ? s.selectionScale : 1;
65  //exaggeration = selectionScale * s.laneWidthExaggeration; // * s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive()));
66  // compute lane-marking intersection points)
67  //halfWidth2 = exaggeration * (lane->myParentEdge->getNBEdge()->getLaneWidth(lane->getIndex()) / 2 - SUMO_const_laneMarkWidth / 2);
68 
69  // Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen
70  //halfWidth = lane->drawUsingSelectColor() ? halfWidth2 - exaggeration * 0.3 : halfWidth2;
71 }
72 
73 
75  selectionScale(0),
76  exaggeration(0),
77  halfWidth2(0),
78  halfWidth(0) {
79 }
80 
81 // ---------------------------------------------------------------------------
82 // GNELane - methods
83 // ---------------------------------------------------------------------------
84 
85 GNELane::GNELane(GNEEdge* edge, const int index) :
86  GNENetworkElement(edge->getNet(), edge->getNBEdge()->getLaneID(index), GLO_LANE, SUMO_TAG_LANE,
87 {}, {}, {}, {}, {}, {}, {}, {}),
88 myParentEdge(edge),
89 myIndex(index),
90 mySpecialColor(nullptr),
91 mySpecialColorValue(-1),
92 myLane2laneConnections(this) {
93  // update centering boundary without updating grid
94  updateCenteringBoundary(false);
95 }
96 
97 
99  GNENetworkElement(nullptr, "dummyConstructorGNELane", GLO_LANE, SUMO_TAG_LANE,
100 {}, {}, {}, {}, {}, {}, {}, {}),
101 myParentEdge(nullptr),
102 myIndex(-1),
103 mySpecialColor(nullptr),
104 mySpecialColorValue(-1),
105 myLane2laneConnections(this) {
106 }
107 
108 
110 
111 
112 GNEEdge*
114  return myParentEdge;
115 }
116 
117 
118 bool
121 }
122 
123 
124 const GUIGeometry&
126  return myLaneGeometry;
127 }
128 
129 
130 const PositionVector&
134  } else {
136  }
137 }
138 
139 
140 const std::vector<double>&
143 }
144 
145 
146 const std::vector<double>&
149 }
150 
151 
152 void
154  // Clear texture containers
157  // get lane shape and extend if is too short
158  auto laneShape = getLaneShape();
159  if (laneShape.length2D() < 1) {
160  laneShape.extrapolate2D(1 - laneShape.length2D());
161  }
162  // Obtain lane shape of NBEdge
163  myLaneGeometry.updateGeometry(laneShape);
164  // update connections
166  // update shapes parents associated with this lane
167  for (const auto& shape : getParentShapes()) {
168  shape->updateGeometry();
169  }
170  // update child shapes associated with this lane
171  for (const auto& shape : getChildShapes()) {
172  shape->updateGeometry();
173  }
174  // update additionals children associated with this lane
175  for (const auto& additional : getParentAdditionals()) {
176  additional->updateGeometry();
177  }
178  // update additionals parents associated with this lane
179  for (const auto& additional : getChildAdditionals()) {
180  additional->updateGeometry();
181  }
182  // update partial demand elements parents associated with this lane
183  for (const auto& demandElement : getParentDemandElements()) {
184  demandElement->updateGeometry();
185  }
186  // update partial demand elements children associated with this lane
187  for (const auto& demandElement : getChildDemandElements()) {
188  demandElement->updateGeometry();
189  }
190  // Update geometry of parent generic datas that have this edge as parent
191  for (const auto& additionalParent : getParentGenericDatas()) {
192  additionalParent->updateGeometry();
193  }
194  // Update geometry of additionals generic datas vinculated to this edge
195  for (const auto& childAdditionals : getChildGenericDatas()) {
196  childAdditionals->updateGeometry();
197  }
198  // compute geometry of path elements elements vinculated with this lane (depending of showDemandElements)
200  for (const auto& childAdditional : getChildAdditionals()) {
201  childAdditional->computePathElement();
202  }
203  for (const auto& childDemandElement : getChildDemandElements()) {
204  childDemandElement->computePathElement();
205  }
206  for (const auto& childGenericData : getChildGenericDatas()) {
207  childGenericData->computePathElement();
208  }
209  }
210  // in Move mode, connections aren't updated
212  // Update incoming connections of this lane
213  const auto incomingConnections = getGNEIncomingConnections();
214  for (const auto& connection : incomingConnections) {
215  connection->updateGeometry();
216  }
217  // Update outgoings connections of this lane
218  const auto outGoingConnections = getGNEOutcomingConnections();
219  for (const auto& connection : outGoingConnections) {
220  connection->updateGeometry();
221  }
222  }
223  // if lane has enought length for show textures of restricted lanes
224  if ((getLaneShapeLength() > 4)) {
225  // if lane is restricted
227  // get values for position and rotation of icons
228  for (int i = 2; i < getLaneShapeLength() - 1; i += 15) {
231  }
232  }
233  }
234 }
235 
236 
237 Position
239  return getLaneShape().positionAtOffset2D(getLaneShape().length2D() * 0.5);
240 }
241 
242 
245  // edit depending if shape is being edited
246  if (isShapeEdited()) {
247  // calculate move shape operation
250  } else {
251  return nullptr;
252  }
253 }
254 
255 
256 void
257 GNELane::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
258  // edit depending if shape is being edited
259  if (isShapeEdited()) {
260  // get original shape
261  PositionVector shape = getLaneShape();
262  // check shape size
263  if (shape.size() > 2) {
264  // obtain index
265  int index = shape.indexOfClosest(clickedPosition);
266  // get snap radius
268  // check if we have to create a new index
269  if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
270  // remove geometry point
271  shape.erase(shape.begin() + index);
272  // commit new shape
273  undoList->begin(GUIIcon::CROSSING, "remove geometry point of " + getTagStr());
275  undoList->end();
276  }
277  }
278  }
279 }
280 
281 
282 void
284  // first check that drawLinkJunctionIndex must be drawn
286  // get connections
287  const std::vector<NBEdge::Connection>& cons = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
288  // get number of links
289  const int noLinks = (int)cons.size();
290  // only continue if there is links
291  if (noLinks > 0) {
292  // push link matrix
294  // move front
295  glTranslated(0, 0, GLO_TEXTNAME);
296  // calculate width
297  const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
298  // get X1
299  double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
300  // iterate over links
301  for (int i = noLinks; --i >= 0;) {
302  // calculate x2
303  const double x2 = x1 - (double)(width / 2.);
304  // get link index
306  cons[s.lefthand ? noLinks - 1 - i : i]);
307  // draw link index
309  // update x1
310  x1 -= width;
311  }
312  // pop link matrix
314  }
315  }
316 }
317 
318 
319 void
321  // first check that drawLinkTLIndex must be drawn
323  // get connections
324  const std::vector<NBEdge::Connection>& cons = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
325  // get numer of links
326  const int noLinks = (int)cons.size();
327  // only continue if there is lnks
328  if (noLinks > 0) {
329  // push link matrix
331  // move t front
332  glTranslated(0, 0, GLO_TEXTNAME);
333  // calculate width
334  const double w = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
335  // calculate x1
336  double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
337  // iterate over links
338  for (int i = noLinks; --i >= 0;) {
339  // calculate x2
340  const double x2 = x1 - (double)(w / 2.);
341  // get link number
342  const int linkNo = cons[s.lefthand ? noLinks - 1 - i : i].tlLinkIndex;
343  // draw link number
345  // update x1
346  x1 -= w;
347  }
348  // pop link matrix
350  }
351  }
352 }
353 
354 
355 void
357  // currently unused
358 }
359 
360 
361 void
362 GNELane::drawArrows(const GUIVisualizationSettings& s, const bool spreadSuperposed) const {
363  if (s.showLinkDecals && myParentEdge->getToJunction()->isLogicValid() && s.scale > 3) {
364  // calculate begin, end and rotation
365  const Position& begin = myLaneGeometry.getShape()[-2];
366  const Position& end = myLaneGeometry.getShape().back();
367  const double rot = GUIGeometry::calculateRotation(begin, end);
368  // push arrow matrix
370  // move front (note: must draw on top of junction shape?
371  glTranslated(0, 0, 0.5);
372  // change color depending of spreadSuperposed
373  if (spreadSuperposed) {
375  } else {
377  }
378  // move to end
379  glTranslated(end.x(), end.y(), 0);
380  // rotate
381  glRotated(rot, 0, 0, 1);
382  const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex);
383  if (width < SUMO_const_laneWidth) {
384  glScaled(width / SUMO_const_laneWidth, 1, 1);
385  }
386  // get destiny node
387  const NBNode* dest = myParentEdge->getNBEdge()->myTo;
388  // draw all links iterating over connections
389  for (const auto& connection : myParentEdge->getNBEdge()->myConnections) {
390  if (connection.fromLane == myIndex) {
391  // get link direction
392  LinkDirection dir = dest->getDirection(myParentEdge->getNBEdge(), connection.toEdge, s.lefthand);
393  // draw depending of link direction
394  switch (dir) {
396  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
397  GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25);
398  break;
399  case LinkDirection::LEFT:
400  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
401  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
402  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25);
403  break;
405  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
406  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
407  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25);
408  break;
409  case LinkDirection::TURN:
410  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
411  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
412  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
413  GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25);
414  break;
416  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
417  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
418  GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
419  GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25);
420  break;
422  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
423  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
424  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25);
425  break;
427  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
428  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
429  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25);
430  break;
432  GLHelper::drawBoxLine(Position(1, 5.8), 245, 2, .05);
433  GLHelper::drawBoxLine(Position(-1, 5.8), 115, 2, .05);
434  glTranslated(0, 5, 0);
435  GLHelper::drawOutlineCircle(0.9, 0.8, 32);
436  glTranslated(0, -5, 0);
437  break;
438  }
439  }
440  }
441  // pop arrow matrix
443  }
444 }
445 
446 
447 void
450  glTranslated(0, 0, 0.1); // must draw on top of junction shape
451  std::vector<NBEdge::Connection> connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
452  NBNode* node = myParentEdge->getNBEdge()->getToNode();
453  const Position& startPos = myLaneGeometry.getShape()[-1];
454  for (auto it : connections) {
455  const LinkState state = node->getLinkState(myParentEdge->getNBEdge(), it.toEdge, it.fromLane, it.toLane, it.mayDefinitelyPass, it.tlID);
456  switch (state) {
458  glColor3d(1, 1, 0);
459  break;
461  glColor3d(0, 1, 1);
462  break;
463  case LINKSTATE_MAJOR:
464  glColor3d(1, 1, 1);
465  break;
466  case LINKSTATE_MINOR:
467  glColor3d(.4, .4, .4);
468  break;
469  case LINKSTATE_STOP:
470  glColor3d(.7, .4, .4);
471  break;
472  case LINKSTATE_EQUAL:
473  glColor3d(.7, .7, .7);
474  break;
476  glColor3d(.7, .7, 1);
477  break;
478  case LINKSTATE_ZIPPER:
479  glColor3d(.75, .5, 0.25);
480  break;
481  default:
482  throw ProcessError("Unexpected LinkState '" + toString(state) + "'");
483  }
484  const Position& endPos = it.toEdge->getLaneShape(it.toLane)[0];
485  glBegin(GL_LINES);
486  glVertex2d(startPos.x(), startPos.y());
487  glVertex2d(endPos.x(), endPos.y());
488  glEnd();
489  GLHelper::drawTriangleAtEnd(startPos, endPos, (double) 1.5, (double) .2);
490  }
492 }
493 
494 
495 void
497  // get lane drawing constants
498  LaneDrawingConstants laneDrawingConstants(s, this);
499  // get lane color
500  const RGBColor color = setLaneColor(s);
501  // get flag for draw lane as railwy
502  const bool drawRailway = drawAsRailway(s);
503  // we draw the lanes with reduced width so that the lane markings below are visible (this avoids artifacts at geometry corners without having to)
504  const bool spreadSuperposed = s.spreadSuperposed && drawRailway && myParentEdge->getNBEdge()->isBidiRail();
505  // Push edge parent name
507  // Push lane name
509  // Push layer matrix
511  // translate to front (note: Special case)
513  glTranslated(0, 0, GLO_DOTTEDCONTOUR_FRONT);
516  } else {
518  }
519  // recognize full transparency and simply don't draw
520  if ((color.alpha() == 0) || ((s.scale * laneDrawingConstants.exaggeration) < s.laneMinSize)) {
521  // Pop draw matrix 1
523  // Pop Lane Name
525  } else {
526  if ((s.scale * laneDrawingConstants.exaggeration) < 1.) {
527  // draw lane as line, depending of myShapeColors
528  if (myShapeColors.size() > 0) {
530  } else {
532  }
533  } else {
534  // Check if lane has to be draw as railway and if isn't being drawn for selecting
535  if (drawRailway && (!s.drawForRectangleSelection || spreadSuperposed)) {
536  // draw as railway
537  drawLaneAsRailway(s, laneDrawingConstants);
538  } else {
539  // draw as box lines
541  }
542  if (laneDrawingConstants.halfWidth != laneDrawingConstants.halfWidth2 && !spreadSuperposed) {
543  // Push matrix
545  // move back
546  glTranslated(0, 0, -0.1);
547  // set selected edge color
549  // draw again to show the selected edge
551  // Pop matrix
553  }
554  // only draw details depending of the scale and if isn't being drawn for selecting
555  if ((s.scale >= 10) && !s.drawForRectangleSelection && !s.drawForPositionSelection) {
556  // draw markings
557  drawMarkings(s, laneDrawingConstants.exaggeration, drawRailway);
558  // draw arrows
559  drawArrows(s, spreadSuperposed);
560  // Draw direction indicators
561  drawDirectionIndicators(s, laneDrawingConstants.exaggeration, drawRailway, spreadSuperposed);
562  }
563  // draw lane textures
564  drawTextures(s, laneDrawingConstants);
565  // draw start end shape points
567  // draw edge geometry points
569  }
570  // draw stopOffsets
571  const auto& laneStopOffset = myParentEdge->getNBEdge()->getLaneStruct(myIndex).laneStopOffset;
572  if (laneStopOffset.isDefined() && (laneStopOffset.getPermissions() & SVC_PASSENGER) != 0) {
573  drawLaneStopOffset(s, laneStopOffset.getOffset());
574  }
575  // Pop layer matrix
577  // if shape is being edited, draw point and green line
578  if (myShapeEdited) {
579  // psuh shape edited matrix
581  // translate
583  // set selected edge color
585  // draw again to show the selected edge
587  // move front
588  glTranslated(0, 0, 1);
589  // color
590  const RGBColor darkerColor = s.colorSettings.editShapeColor.changedBrightness(-32);
591  // draw geometry points
594  // Pop shape edited matrix
596  }
597  // Pop lane Name
599  // Pop edge Name
601  // only draw links number depending of the scale and if isn't being drawn for selecting
602  if ((s.scale >= 10) && !s.drawForRectangleSelection && !s.drawForPositionSelection) {
603  // draw link number
604  drawLinkNo(s);
605  // draw TLS link number
606  drawTLSLinkNo(s);
607  }
608  // draw lock icon
610  // check if dotted contours has to be drawn
611  if (!drawRailway) {
615  }
616  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this) ||
617  ((myNet->getViewNet()->getFrontAttributeCarrier() == myParentEdge) && (myParentEdge->getLanes().size() == 1))) {
619  }
620  }
621  // draw children
622  drawChildren(s);
623  // draw path additional elements
625  }
626 }
627 
628 
629 void
631  // draw child shapes
632  for (const auto& POILane : getChildShapes()) {
633  POILane->drawGL(s);
634  }
635  // draw child additional
636  for (const auto& additional : getChildAdditionals()) {
637  // check that ParkingAreas aren't draw two times
638  additional->drawGL(s);
639  }
640  // draw child demand elements
641  for (const auto& demandElement : getChildDemandElements()) {
642  if (!demandElement->getTagProperty().isPlacedInRTree()) {
643  demandElement->drawGL(s);
644  }
645  }
646 }
647 
648 
649 void
650 GNELane::drawMarkings(const GUIVisualizationSettings& s, const double exaggeration, const bool drawRailway) const {
651  if (s.laneShowBorders && (exaggeration == 1) && !drawRailway) {
652  const double myHalfLaneWidth = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
654  glTranslated(0, 0, 0.1);
655  // optionally draw inverse markings
656  bool haveChangeProhibitions = false;
661  3, 6, myHalfLaneWidth, cl, cr, s.lefthand, exaggeration);
662  haveChangeProhibitions = !(cl && cr);
663  }
666  if (haveChangeProhibitions) {
667  // highlightchange prohibitions
668  glTranslated(0, 0, -0.05);
670  const double offset = myHalfLaneWidth * exaggeration * (s.lefthand ? -1 : 1);
671  GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), myLaneGeometry, (myHalfLaneWidth * 0.5) * exaggeration, offset);
672  glTranslated(0, 0, +0.05);
673  }
674  // draw white boundings and white markings
675  glTranslated(0, 0, -0.1);
679  }
680 }
681 
682 
685  // first obtain edit mode (needed because certain Commands depend of current edit mode)
687  // get mouse position
688  const auto mousePosition = myNet->getViewNet()->getPositionInformation();
689  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
690  buildPopupHeader(ret, app);
692  // build copy names entry
693  if (editMode != NetworkEditMode::NETWORK_TLS) {
694  GUIDesigns::buildFXMenuCommand(ret, "Copy parent edge name to clipboard", nullptr, ret, MID_COPY_EDGE_NAME);
696  }
697  // build lane selection
700  } else {
702  }
703  // build edge selection
706  } else {
708  }
709  // add separator
710  new FXMenuSeparator(ret);
711  if (editMode != NetworkEditMode::NETWORK_TLS) {
712  // build show parameters menu
714  // build position copy entry
715  buildPositionCopyEntry(ret, false);
716  }
717  // check if we're in supermode network
719  // create end point
720  FXMenuCommand* resetEndPoints = GUIDesigns::buildFXMenuCommand(ret, "Reset edge end points", nullptr, &parent, MID_GNE_RESET_GEOMETRYPOINT);
721  // enable or disable reset end points
723  resetEndPoints->enable();
724  } else {
725  resetEndPoints->disable();
726  }
727  // check if we clicked over a geometry point
728  if ((editMode == NetworkEditMode::NETWORK_MOVE) && myParentEdge->clickedOverGeometryPoint(mousePosition)) {
729  GUIDesigns::buildFXMenuCommand(ret, "Set custom Geometry Point", nullptr, &parent, MID_GNE_CUSTOM_GEOMETRYPOINT);
730  }
731  // add separator
732  new FXMenuSeparator(ret);
733  //build operations
734  if ((editMode != NetworkEditMode::NETWORK_CONNECT) && (editMode != NetworkEditMode::NETWORK_TLS)) {
735  // build edge operations
736  buildEdgeOperations(parent, ret);
737  // build lane operations
738  buildLaneOperations(parent, ret);
739  // add separator
740  new FXMenuSeparator(ret);
741  // build rechable operations
742  buildRechableOperations(parent, ret);
743  } else if (editMode == NetworkEditMode::NETWORK_TLS) {
745  GUIDesigns::buildFXMenuCommand(ret, "Select state for all links from this edge:", nullptr, nullptr, 0);
746  const std::vector<std::string> names = GNEInternalLane::LinkStateNames.getStrings();
747  for (auto it : names) {
748  FXuint state = GNEInternalLane::LinkStateNames.get(it);
749  FXMenuRadio* mc = new FXMenuRadio(ret, it.c_str(), this, FXDataTarget::ID_OPTION + state);
750  mc->setSelBackColor(MFXUtils::getFXColor(GNEInternalLane::colorForLinksState(state)));
752  }
753  }
754  } else {
755  FXMenuCommand* mc = GUIDesigns::buildFXMenuCommand(ret, "Additional options available in 'Inspect Mode'", nullptr, nullptr, 0);
756  mc->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
757  }
758  // build shape positions menu
759  if (editMode != NetworkEditMode::NETWORK_TLS) {
760  new FXMenuSeparator(ret);
761  // get lane shape
762  const auto& laneShape = myLaneGeometry.getShape();
763  // get variables
764  const double pos = laneShape.nearest_offset_to_point2D(mousePosition);
765  const Position firstAnglePos = laneShape.positionAtOffset2D(pos - 0.001);
766  const Position secondAnglePos = laneShape.positionAtOffset2D(pos);
767  const double angle = firstAnglePos.angleTo2D(secondAnglePos);
768 
769  // build menu commands
770  GUIDesigns::buildFXMenuCommand(ret, "Shape pos: " + toString(pos), nullptr, nullptr, 0);
771  GUIDesigns::buildFXMenuCommand(ret, "Length pos: " + toString(pos * getLaneParametricLength() / getLaneShapeLength()), nullptr, nullptr, 0);
772  GUIDesigns::buildFXMenuCommand(ret, "Height: " + toString(firstAnglePos.z()), nullptr, nullptr, 0);
773  GUIDesigns::buildFXMenuCommand(ret, "Angle: " + toString((GeomHelper::naviDegree(angle))), nullptr, nullptr, 0);
774  }
775  }
776  return ret;
777 }
778 
779 
780 double
782  return s.addSize.getExaggeration(s, this);
783 }
784 
785 
786 void
787 GNELane::updateCenteringBoundary(const bool /*updateGrid*/) {
788  if (myParentEdge->getNBEdge()->getLaneStruct(myIndex).customShape.size() == 0) {
790  } else {
792  }
793 }
794 
795 
796 int
798  return myIndex;
799 }
800 
801 void
802 GNELane::setIndex(int index) {
803  myIndex = index;
805 }
806 
807 
808 double
811 }
812 
813 
814 double
816  double laneParametricLength = myParentEdge->getNBEdge()->getLoadedLength();
817  if (laneParametricLength > 0) {
818  return laneParametricLength;
819  } else {
820  throw ProcessError("Lane Parametric Length cannot be never 0");
821  }
822 }
823 
824 
825 double
827  return myLaneGeometry.getShape().length();
828 }
829 
830 
831 bool
833  return myParentEdge->getNBEdge()->getPermissions(myIndex) == vclass;
834 }
835 
836 
839  return myLane2laneConnections;
840 }
841 
842 
843 std::string
845  const NBEdge* edge = myParentEdge->getNBEdge();
846  switch (key) {
847  case SUMO_ATTR_ID:
848  return getID();
849  case SUMO_ATTR_SPEED:
850  return toString(edge->getLaneSpeed(myIndex));
851  case SUMO_ATTR_ALLOW:
853  case SUMO_ATTR_DISALLOW:
859  case SUMO_ATTR_WIDTH:
861  return "default";
862  } else {
863  return toString(edge->getLaneStruct(myIndex).width);
864  }
865  case SUMO_ATTR_ENDOFFSET:
866  return toString(edge->getLaneStruct(myIndex).endOffset);
868  return toString(edge->getLaneStruct(myIndex).accelRamp);
870  return toString(edge->getLaneStruct(myIndex).customShape);
871  case GNE_ATTR_OPPOSITE:
872  return toString(edge->getLaneStruct(myIndex).oppositeID);
873  case SUMO_ATTR_TYPE:
874  return edge->getLaneStruct(myIndex).type;
875  case SUMO_ATTR_INDEX:
876  return toString(myIndex);
877  case GNE_ATTR_STOPOFFSET:
882  } else {
883  return "";
884  }
885  case GNE_ATTR_PARENT:
886  return myParentEdge->getID();
887  case GNE_ATTR_SELECTED:
889  case GNE_ATTR_PARAMETERS:
891  default:
892  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
893  }
894 }
895 
896 std::string
898  std::string result = getAttribute(key);
899  if ((key == SUMO_ATTR_ALLOW || key == SUMO_ATTR_DISALLOW) && result.find("all") != std::string::npos) {
900  result += " " + getVehicleClassNames(SVCAll, true);
901  }
902  return result;
903 }
904 
905 
906 void
907 GNELane::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
908  switch (key) {
909  case SUMO_ATTR_ID:
910  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
911  case SUMO_ATTR_SPEED:
912  case SUMO_ATTR_ALLOW:
913  case SUMO_ATTR_DISALLOW:
916  case SUMO_ATTR_WIDTH:
917  case SUMO_ATTR_ENDOFFSET:
920  case GNE_ATTR_OPPOSITE:
921  case SUMO_ATTR_TYPE:
922  case SUMO_ATTR_INDEX:
923  case GNE_ATTR_STOPOFFSET:
925  case GNE_ATTR_SELECTED:
926  case GNE_ATTR_PARAMETERS:
927  // no special handling
928  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
929  break;
930  default:
931  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
932  }
933 }
934 
935 
936 bool
937 GNELane::isValid(SumoXMLAttr key, const std::string& value) {
938  switch (key) {
939  case SUMO_ATTR_ID:
940  case SUMO_ATTR_INDEX:
941  return false;
942  case SUMO_ATTR_SPEED:
943  return canParse<double>(value);
944  case SUMO_ATTR_ALLOW:
945  case SUMO_ATTR_DISALLOW:
948  return canParseVehicleClasses(value);
949  case SUMO_ATTR_WIDTH:
950  if (value.empty() || (value == "default")) {
951  return true;
952  } else {
953  return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_WIDTH));
954  }
955  case SUMO_ATTR_ENDOFFSET:
956  return canParse<double>(value) && (parse<double>(value) >= 0);
958  return canParse<bool>(value);
959  case SUMO_ATTR_CUSTOMSHAPE: {
960  // A lane shape can either be empty or have more than 1 element
961  if (value.empty()) {
962  return true;
963  } else if (canParse<PositionVector>(value)) {
964  return parse<PositionVector>(value).size() > 1;
965  }
966  return false;
967  }
968  case GNE_ATTR_OPPOSITE: {
969  if (value.empty()) {
970  return true;
971  } else {
972  NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
973  if (oppEdge == nullptr || oppEdge->getLaneID(oppEdge->getNumLanes() - 1) != value) {
974  return false;
975  }
976  NBEdge* edge = myParentEdge->getNBEdge();
977  if (oppEdge->getFromNode() != edge->getToNode() || oppEdge->getToNode() != edge->getFromNode()) {
978  WRITE_WARNING("Opposite lane '" + value + "' does not connect the same nodes as edge '" + edge->getID() + "'!");
979  return false;
980  }
981  return true;
982  }
983  }
984  case SUMO_ATTR_TYPE:
985  return true;
986  case GNE_ATTR_STOPOFFSET:
987  return canParse<int>(value) && (parse<double>(value) >= 0);
989  return canParseVehicleClasses(value);
990  case GNE_ATTR_SELECTED:
991  return canParse<bool>(value);
992  case GNE_ATTR_PARAMETERS:
993  return Parameterised::areParametersValid(value);
994  default:
995  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
996  }
997 }
998 
999 
1000 bool
1002  switch (key) {
1003  case SUMO_ATTR_ID:
1004  case SUMO_ATTR_INDEX:
1005  return false;
1006  default:
1007  return true;
1008  }
1009 }
1010 
1011 
1012 bool
1014  const NBEdge* edge = myParentEdge->getNBEdge();
1015  switch (key) {
1016  case SUMO_ATTR_WIDTH:
1018  default:
1019  return false;
1020  }
1021 }
1022 
1023 
1024 const std::map<std::string, std::string>&
1027 }
1028 
1029 
1030 void
1031 GNELane::setSpecialColor(const RGBColor* color, double colorValue) {
1032  mySpecialColor = color;
1033  mySpecialColorValue = colorValue;
1034 }
1035 
1036 // ===========================================================================
1037 // private
1038 // ===========================================================================
1039 
1040 void
1041 GNELane::setAttribute(SumoXMLAttr key, const std::string& value) {
1042  // get parent edge
1043  NBEdge* edge = myParentEdge->getNBEdge();
1044  // get template editor
1046  // check if we have to update template
1047  const bool updateTemplate = templateEditor->getEdgeTemplate() ? (templateEditor->getEdgeTemplate()->getID() == myParentEdge->getID()) : false;
1048  switch (key) {
1049  case SUMO_ATTR_ID:
1050  case SUMO_ATTR_INDEX:
1051  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
1052  case SUMO_ATTR_SPEED:
1053  edge->setSpeed(myIndex, parse<double>(value));
1054  break;
1055  case SUMO_ATTR_ALLOW:
1057  break;
1058  case SUMO_ATTR_DISALLOW:
1060  break;
1061  case SUMO_ATTR_CHANGE_LEFT:
1063  break;
1066  break;
1067  case SUMO_ATTR_WIDTH:
1068  if (value.empty() || (value == "default")) {
1070  } else {
1071  edge->setLaneWidth(myIndex, parse<double>(value));
1072  }
1073  // update edge parent boundary
1075  break;
1076  case SUMO_ATTR_ENDOFFSET:
1077  edge->setEndOffset(myIndex, parse<double>(value));
1078  break;
1080  edge->setAcceleration(myIndex, parse<bool>(value));
1081  break;
1082  case SUMO_ATTR_CUSTOMSHAPE: {
1083  // set new shape
1084  edge->setLaneShape(myIndex, parse<PositionVector>(value));
1085  // update edge parent boundary
1087  break;
1088  }
1089  case GNE_ATTR_OPPOSITE: {
1090  if (value != "") {
1091  NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
1092  oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = getID();
1093  } else {
1094  // reset prior oppEdge if existing
1095  const std::string oldValue = myParentEdge->getNBEdge()->getLaneStruct(myIndex).oppositeID;
1096  NBEdge* oppEdge = myNet->getEdgeCont().retrieve(oldValue.substr(0, oldValue.rfind("_")));
1097  if (oppEdge != nullptr) {
1098  oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = "";
1099  }
1100  }
1102  break;
1103  }
1104  case SUMO_ATTR_TYPE:
1105  edge->getLaneStruct(myIndex).type = value;
1106  break;
1107  case GNE_ATTR_STOPOFFSET:
1108  edge->getLaneStruct(myIndex).laneStopOffset.setOffset(parse<double>(value));
1109  break;
1111  if (value.empty()) {
1113  } else {
1115  }
1116  break;
1117  case GNE_ATTR_SELECTED:
1118  if (parse<bool>(value)) {
1120  } else {
1122  }
1123  break;
1124  case GNE_ATTR_PARAMETERS:
1126  break;
1127  default:
1128  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1129  }
1130  // update template
1131  if (updateTemplate) {
1132  templateEditor->setEdgeTemplate(myParentEdge);
1133  }
1134  // invalidate path calculator
1136 }
1137 
1138 
1139 void
1141  // set custom shape
1143  // update geometry
1144  updateGeometry();
1145 }
1146 
1147 
1148 void
1149 GNELane::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
1150  // commit new shape
1151  undoList->begin(GUIIcon::LANE, "moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
1153  undoList->end();
1154 }
1155 
1156 
1157 RGBColor
1159  // get inspected attribute carriers
1160  const auto& inspectedACs = myNet->getViewNet()->getInspectedAttributeCarriers();
1161  // declare a RGBColor variable
1162  RGBColor color;
1163  // get inspected AC
1164  const GNEAttributeCarrier* inspectedAC = inspectedACs.size() > 0 ? inspectedACs.front() : nullptr;
1165  // we need to draw lanes with a special color if we're inspecting a Trip or Flow and this lane belongs to a via's edge.
1166  if (inspectedAC && (inspectedAC->isAttributeCarrierSelected() == false) &&
1167  ((inspectedAC->getTagProperty().getTag() == SUMO_TAG_TRIP) || (inspectedAC->getTagProperty().getTag() == SUMO_TAG_FLOW))) {
1168  // obtain attribute "via"
1169  std::vector<std::string> viaEdges = parse<std::vector<std::string> >(inspectedAC->getAttribute(SUMO_ATTR_VIA));
1170  // iterate over viaEdges
1171  for (const auto& edge : viaEdges) {
1172  // check if parent edge is in the via edges
1173  if (myParentEdge->getID() == edge) {
1174  // set green color in GLHelper and return it
1175  color = RGBColor::GREEN;
1176  }
1177  }
1178  }
1179  if (mySpecialColor != nullptr) {
1180  // If special color is enabled, set it
1181  color = *mySpecialColor;
1182  } else if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1183  // override with special colors (unless the color scheme is based on selection)
1184  color = s.colorSettings.selectedLaneColor;
1185  } else if (myParentEdge->drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1186  // override with special colors (unless the color scheme is based on selection)
1187  color = s.colorSettings.selectedEdgeColor;
1188  } else {
1189  // Get normal lane color
1190  const GUIColorer& c = s.laneColorer;
1191  if (!setFunctionalColor(c.getActive(), color) && !setMultiColor(s, c, color)) {
1192  color = c.getScheme().getColor(getColorValue(s, c.getActive()));
1193  }
1194  }
1195  // special color for conflicted candidate edges
1197  // extra check for route frame
1199  color = s.candidateColorSettings.conflict;
1200  }
1201  }
1202  // special color for special candidate edges
1204  // extra check for route frame
1206  color = s.candidateColorSettings.special;
1207  }
1208  }
1209  // special color for candidate edges
1211  // extra check for route frame
1213  color = s.candidateColorSettings.possible;
1214  }
1215  }
1216  // special color for source candidate edges
1218  color = s.candidateColorSettings.source;
1219  }
1220  // special color for target candidate edges
1222  color = s.candidateColorSettings.target;
1223  }
1224  // special color for source candidate lanes
1225  if (mySourceCandidate) {
1226  color = s.candidateColorSettings.source;
1227  }
1228  // special color for target candidate lanes
1229  if (myTargetCandidate) {
1230  color = s.candidateColorSettings.target;
1231  }
1232  // special color for special candidate lanes
1233  if (mySpecialCandidate) {
1234  color = s.candidateColorSettings.special;
1235  }
1236  // special color for possible candidate lanes
1237  if (myPossibleCandidate) {
1238  color = s.candidateColorSettings.possible;
1239  }
1240  // special color for conflicted candidate lanes
1241  if (myConflictedCandidate) {
1242  color = s.candidateColorSettings.conflict;
1243  }
1244  // set color in GLHelper
1245  GLHelper::setColor(color);
1246  return color;
1247 }
1248 
1249 
1250 bool
1251 GNELane::setFunctionalColor(int activeScheme, RGBColor& col) const {
1252  switch (activeScheme) {
1253  case 6: {
1254  double hue = GeomHelper::naviDegree(myLaneGeometry.getShape().beginEndAngle()); // [0-360]
1255  col = RGBColor::fromHSV(hue, 1., 1.);
1256  return true;
1257  }
1258  default:
1259  return false;
1260  }
1261 }
1262 
1263 
1264 bool
1266  const int activeScheme = c.getActive();
1267  myShapeColors.clear();
1268  switch (activeScheme) {
1269  case 9: // color by height at segment start
1270  for (PositionVector::const_iterator ii = myLaneGeometry.getShape().begin(); ii != myLaneGeometry.getShape().end() - 1; ++ii) {
1271  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
1272  }
1273  col = c.getScheme().getColor(getColorValue(s, 8));
1274  return true;
1275  case 11: // color by inclination at segment start
1276  for (int ii = 1; ii < (int)myLaneGeometry.getShape().size(); ++ii) {
1277  const double inc = (myLaneGeometry.getShape()[ii].z() - myLaneGeometry.getShape()[ii - 1].z()) / MAX2(POSITION_EPS, myLaneGeometry.getShape()[ii].distanceTo2D(myLaneGeometry.getShape()[ii - 1]));
1278  myShapeColors.push_back(c.getScheme().getColor(inc));
1279  }
1280  col = c.getScheme().getColor(getColorValue(s, 10));
1281  return true;
1282  default:
1283  return false;
1284  }
1285 }
1286 
1287 
1288 double
1289 GNELane::getColorValue(const GUIVisualizationSettings& s, int activeScheme) const {
1290  const SVCPermissions myPermissions = myParentEdge->getNBEdge()->getPermissions(myIndex);
1291  if (mySpecialColor != nullptr && mySpecialColorValue != std::numeric_limits<double>::max()) {
1292  return mySpecialColorValue;
1293  }
1294  switch (activeScheme) {
1295  case 0:
1296  switch (myPermissions) {
1297  case SVC_PEDESTRIAN:
1298  return 1;
1299  case SVC_BICYCLE:
1300  return 2;
1301  case 0:
1302  // forbidden road or green verge
1303  return myParentEdge->getNBEdge()->getPermissions() == 0 ? 10 : 3;
1304  case SVC_SHIP:
1305  return 4;
1306  case SVC_AUTHORITY:
1307  return 8;
1308  default:
1309  break;
1310  }
1312  return 9;
1313  } else if (isRailway(myPermissions)) {
1314  if ((myPermissions & SVC_BUS) != 0) {
1315  return 6;
1316  } else {
1317  return 5;
1318  }
1319  } else if ((myPermissions & SVC_PASSENGER) != 0) {
1320  if ((myPermissions & (SVC_RAIL_CLASSES & ~SVC_RAIL_FAST)) != 0 && (myPermissions & SVC_SHIP) == 0) {
1321  return 6;
1322  } else {
1323  return 0;
1324  }
1325  } else {
1326  return 7;
1327  }
1328  case 1:
1330  case 2:
1331  return (double)myPermissions;
1332  case 3:
1334  case 4:
1335  return myParentEdge->getNBEdge()->getNumLanes();
1336  case 5: {
1338  }
1339  // case 6: by angle (functional)
1340  case 7: {
1341  return myParentEdge->getNBEdge()->getPriority();
1342  }
1343  case 8: {
1344  // color by z of first shape point
1345  return myLaneGeometry.getShape()[0].z();
1346  }
1347  // case 9: by segment height
1348  case 10: {
1349  // color by incline
1350  return (myLaneGeometry.getShape()[-1].z() - myLaneGeometry.getShape()[0].z()) / myParentEdge->getNBEdge()->getLength();
1351  }
1352  // case 11: by segment incline
1353 
1354  case 12: {
1355  // by numerical edge param value
1356  try {
1358  } catch (NumberFormatException&) {
1359  try {
1361  } catch (BoolFormatException&) {
1362  return -1;
1363  }
1364  }
1365  }
1366  case 13: {
1367  // by numerical lane param value
1368  try {
1370  } catch (NumberFormatException&) {
1371  try {
1373  } catch (BoolFormatException&) {
1374  return -1;
1375  }
1376  }
1377  }
1378  case 14: {
1379  return myParentEdge->getNBEdge()->getDistance();
1380  }
1381  case 15: {
1382  return fabs(myParentEdge->getNBEdge()->getDistance());
1383  }
1384  }
1385  return 0;
1386 }
1387 
1388 
1389 bool
1394 }
1395 
1396 
1397 void
1398 GNELane::drawOverlappedRoutes(const int numRoutes) const {
1399  // get middle point and angle
1402  // Push route matrix
1404  // translate to front
1405  glTranslated(0, 0, GLO_ROUTE + 1);
1406  // get middle
1407  GLHelper::drawText(toString(numRoutes) + " routes", center, 0, 1.8, RGBColor::BLACK, angle + 90);
1408  // pop route matrix
1410 
1411 }
1412 
1413 
1414 void
1415 GNELane::drawLaneStopOffset(const GUIVisualizationSettings& s, const double offset) const {
1416  GNELane::LaneDrawingConstants laneDrawingConstants(s, this);
1417  const Position& end = getLaneShape().back();
1418  const Position& f = getLaneShape()[-2];
1419  const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
1422  glTranslated(end.x(), end.y(), 1);
1423  glRotated(rot, 0, 0, 1);
1424  glTranslated(0, offset, 0);
1425  glBegin(GL_QUADS);
1426  glVertex2d(-laneDrawingConstants.halfWidth, 0.0);
1427  glVertex2d(-laneDrawingConstants.halfWidth, 0.2);
1428  glVertex2d(laneDrawingConstants.halfWidth, 0.2);
1429  glVertex2d(laneDrawingConstants.halfWidth, 0.0);
1430  glEnd();
1432 }
1433 
1434 
1435 bool
1437  return isWaterway(myParentEdge->getNBEdge()->getPermissions(myIndex)) && s.showRails && !s.drawForRectangleSelection; // reusing the showRails setting
1438 }
1439 
1440 
1441 void
1442 GNELane::drawDirectionIndicators(const GUIVisualizationSettings& s, double exaggeration, const bool drawAsRailway, const bool spreadSuperposed) const {
1443  // Draw direction indicators if the correspondient option is enabled
1444  if (s.showLaneDirection) {
1445  // improve visibility of superposed rail edges
1446  if (drawAsRailway) {
1447  setLaneColor(s);
1448  } else {
1449  glColor3d(0.3, 0.3, 0.3);
1450  }
1451  // get width and sideOffset
1452  const double width = MAX2(NUMERICAL_EPS, (myParentEdge->getNBEdge()->getLaneWidth(myIndex) * exaggeration * (spreadSuperposed ? 0.4 : 1)));
1453  const double sideOffset = spreadSuperposed ? width * -0.5 : 0;
1454  // push direction indicator matrix
1456  // move to front
1457  glTranslated(0, 0, 0.1);
1458  // iterate over shape
1459  for (int i = 0; i < (int) myLaneGeometry.getShape().size() - 1; ++i) {
1460  // push triangle matrix
1462  // move front
1463  glTranslated(myLaneGeometry.getShape()[i].x(), myLaneGeometry.getShape()[i].y(), 0.1);
1464  // rotate
1465  glRotated(myLaneGeometry.getShapeRotations()[i], 0, 0, 1);
1466  // calculate subwidth
1467  for (double subWidth = 0; subWidth < myLaneGeometry.getShapeLengths()[i]; subWidth += width) {
1468  // calculate lenght
1469  const double length = MIN2(width * 0.5, myLaneGeometry.getShapeLengths()[i] - subWidth);
1470  // draw tiangle
1471  glBegin(GL_TRIANGLES);
1472  glVertex2d(sideOffset, -subWidth - length);
1473  glVertex2d(sideOffset - width * 0.25, -subWidth);
1474  glVertex2d(sideOffset + width * 0.25, -subWidth);
1475  glEnd();
1476  }
1477  // pop triangle matrix
1479  }
1480  // pop direction indicator matrix
1482  }
1483 }
1484 
1485 
1486 void
1487 GNELane::drawLaneAsRailway(const GUIVisualizationSettings& s, const LaneDrawingConstants& laneDrawingConstants) const {
1488  // we draw the lanes with reduced width so that the lane markings below are visible
1489  // (this avoids artifacts at geometry corners without having to
1490  const bool spreadSuperposed = s.spreadSuperposed && drawAsRailway(s) && myParentEdge->getNBEdge()->isBidiRail();
1491  // get lane shape
1493  // get width
1494  const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex);
1495  // draw as railway: assume standard gauge of 1435mm when lane width is not set
1496  // draw foot width 150mm, assume that distance between rail feet inner sides is reduced on both sides by 39mm with regard to the gauge
1497  // assume crosstie length of 181% gauge (2600mm for standard gauge)
1498  double halfGauge = 0.5 * (width == SUMO_const_laneWidth ? 1.4350 : width) * laneDrawingConstants.exaggeration;
1499  // check if we have to modify shape
1500  if (spreadSuperposed) {
1501  shape.move2side(halfGauge * 0.8);
1502  halfGauge *= 0.4;
1503  //std::cout << "spreadSuperposed " << getID() << " old=" << myLaneGeometry.getShape() << " new=" << shape << "\n";
1504  }
1505  // calculate constant
1506  const double halfInnerFeetWidth = halfGauge - 0.039 * laneDrawingConstants.exaggeration;
1507  const double halfRailWidth = halfInnerFeetWidth + 0.15 * laneDrawingConstants.exaggeration;
1508  const double halfCrossTieWidth = halfGauge * 1.81;
1509  // Draw lane geometry
1511  // Save current color
1512  RGBColor current = GLHelper::getColor();
1513  // Draw gray on top with reduced width (the area between the two tracks)
1514  glColor3d(0.8, 0.8, 0.8);
1515  // move
1516  glTranslated(0, 0, 0.1);
1517  // draw lane geometry again
1519  // Set current color back
1520  GLHelper::setColor(current);
1521  // Draw crossties
1522  GLHelper::drawCrossTies(shape, myLaneGeometry.getShapeRotations(), myLaneGeometry.getShapeLengths(), 0.26 * laneDrawingConstants.exaggeration, 0.6 * laneDrawingConstants.exaggeration, halfCrossTieWidth, s.drawForRectangleSelection);
1523  // check if dotted contours has to be drawn
1527  }
1528  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this) ||
1529  ((myNet->getViewNet()->getFrontAttributeCarrier() == myParentEdge) && (myParentEdge->getLanes().size() == 1))) {
1531  }
1532 }
1533 
1534 
1535 void
1536 GNELane::drawTextures(const GUIVisualizationSettings& s, const LaneDrawingConstants& laneDrawingConstants) const {
1537  // check all conditions for drawing textures
1539  (myLaneRestrictedTexturePositions.size() > 0) &&
1540  s.drawDetail(s.detailSettings.laneTextures, laneDrawingConstants.exaggeration)) {
1541  // Declare default width of icon (3)
1542  double iconWidth = 1;
1543  // Obtain width of icon, if width of lane is different
1545  iconWidth = myParentEdge->getNBEdge()->getLaneStruct(myIndex).width / 3;
1546  }
1547  // Draw list of icons
1548  for (int i = 0; i < (int)myLaneRestrictedTexturePositions.size(); i++) {
1549  // Push draw matrix 2
1551  // Set white color
1552  glColor3d(1, 1, 1);
1553  // Traslate matrix 2
1554  glTranslated(myLaneRestrictedTexturePositions.at(i).x(), myLaneRestrictedTexturePositions.at(i).y(), 0.1);
1555  // Rotate matrix 2
1556  glRotated(myLaneRestrictedTextureRotations.at(i), 0, 0, -1);
1557  glRotated(90, 0, 0, 1);
1558  // draw texture box depending of type of restriction
1561  } else if (isRestricted(SVC_BICYCLE)) {
1563  } else if (isRestricted(SVC_BUS)) {
1565  }
1566  // Pop draw matrix 2
1568  }
1569  }
1570 }
1571 
1572 
1573 void
1575  // draw a Start/endPoints if lane has a custom shape
1577  GLHelper::setColor(s.junctionColorer.getSchemes()[0].getColor(2));
1578  if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1579  // override with special colors (unless the color scheme is based on selection)
1581  }
1582  // obtain circle width and resolution
1583  double circleWidth = GNEEdge::SNAP_RADIUS * MIN2((double)1, s.laneWidthExaggeration) / 2;
1584  // Obtain exaggeration of the draw
1585  const double exaggeration = getExaggeration(s);
1586  // obtain custom shape
1588  // draw s depending of detail
1589  if (s.drawDetail(s.detailSettings.geometryPointsText, exaggeration)) {
1590  // push start matrix
1592  // move to shape start position
1593  glTranslated(customShape.front().x(), customShape.front().y(), 0.1);
1594  // draw circle
1596  // check if we can draw "S"
1597  if (!s.drawForPositionSelection) {
1598  // move top
1599  glTranslated(0, 0, 0.1);
1600  // draw "S"
1601  GLHelper::drawText("S", Position(), 0.1, circleWidth, RGBColor::WHITE);
1602  }
1603  // pop start matrix
1605  }
1606  // draw line between junction and start position
1608  // move top
1609  glTranslated(0, 0, 0.1);
1610  // set line width
1611  glLineWidth(4);
1612  // draw line
1614  // pop line matrix
1616  // draw "e" depending of detail
1617  if (s.drawDetail(s.detailSettings.geometryPointsText, exaggeration)) {
1618  // push start matrix
1620  // move to end position
1621  glTranslated(customShape.back().x(), customShape.back().y(), 0.1);
1622  // draw filled circle
1624  // check if we can draw "E"
1625  if (!s.drawForPositionSelection) {
1626  // move top
1627  glTranslated(0, 0, 0.1);
1628  // draw "E"
1629  GLHelper::drawText("E", Position(), 0, circleWidth, RGBColor::WHITE);
1630  }
1631  // pop start matrix
1633  }
1634  // draw line between Junction and end position
1636  // move top
1637  glTranslated(0, 0, 0.1);
1638  // set line width
1639  glLineWidth(4);
1640  // draw line
1642  // pop line matrix
1644  }
1645 }
1646 
1647 
1648 std::string
1650  return myParentEdge->getID();
1651 }
1652 
1653 
1654 long
1655 GNELane::onDefault(FXObject* obj, FXSelector sel, void* data) {
1656  myNet->getViewNet()->getViewParent()->getTLSEditorFrame()->handleMultiChange(this, obj, sel, data);
1657  return 1;
1658 }
1659 
1660 
1661 std::vector<GNEConnection*>
1663  // Declare a vector to save incoming connections
1664  std::vector<GNEConnection*> incomingConnections;
1665  // Obtain incoming edges if junction source was already created
1666  GNEJunction* junctionSource = myParentEdge->getFromJunction();
1667  if (junctionSource) {
1668  // Iterate over incoming GNEEdges of junction
1669  for (auto i : junctionSource->getGNEIncomingEdges()) {
1670  // Iterate over connection of incoming edges
1671  for (auto j : i->getGNEConnections()) {
1672  if (j->getNBEdgeConnection().fromLane == getIndex()) {
1673  incomingConnections.push_back(j);
1674  }
1675  }
1676  }
1677  }
1678  return incomingConnections;
1679 }
1680 
1681 
1682 std::vector<GNEConnection*>
1684  // Obtain GNEConnection of parent edge
1685  const std::vector<GNEConnection*>& edgeConnections = myParentEdge->getGNEConnections();
1686  std::vector<GNEConnection*> outcomingConnections;
1687  // Obtain outgoing connections
1688  for (auto i : edgeConnections) {
1689  if (i->getNBEdgeConnection().fromLane == getIndex()) {
1690  outcomingConnections.push_back(i);
1691  }
1692  }
1693  return outcomingConnections;
1694 }
1695 
1696 
1697 void
1699  // update incoming connections of lane
1700  std::vector<GNEConnection*> incomingConnections = getGNEIncomingConnections();
1701  for (auto i : incomingConnections) {
1702  i->updateID();
1703  }
1704  // update outocming connections of lane
1705  std::vector<GNEConnection*> outcomingConnections = getGNEOutcomingConnections();
1706  for (auto i : outcomingConnections) {
1707  i->updateID();
1708  }
1709 }
1710 
1711 
1712 double
1714  // factor should not be 0
1715  if (myParentEdge->getNBEdge()->getFinalLength() > 0) {
1716  return MAX2(POSITION_EPS, (getLaneShape().length() / myParentEdge->getNBEdge()->getFinalLength()));
1717  } else {
1718  return POSITION_EPS;
1719  };
1720 }
1721 
1722 
1723 void
1725  // Create basic commands
1726  std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
1728  if (edgeSelSize && myParentEdge->isAttributeCarrierSelected() && (edgeSelSize > 1)) {
1729  edgeDescPossibleMulti = toString(edgeSelSize) + " " + toString(SUMO_TAG_EDGE) + "s";
1730  }
1731  // create menu pane for edge operations
1732  FXMenuPane* edgeOperations = new FXMenuPane(ret);
1733  ret->insertMenuPaneChild(edgeOperations);
1734  if (edgeSelSize > 0) {
1735  new FXMenuCascade(ret, ("edge operations (" + toString(edgeSelSize) + " selected)").c_str(), nullptr, edgeOperations);
1736  } else {
1737  new FXMenuCascade(ret, "edge operations", nullptr, edgeOperations);
1738  }
1739  // create menu commands for all edge operations
1740  GUIDesigns::buildFXMenuCommand(edgeOperations, "Split edge here", nullptr, &parent, MID_GNE_EDGE_SPLIT);
1741  GUIDesigns::buildFXMenuCommand(edgeOperations, "Split edge in both directions here", nullptr, &parent, MID_GNE_EDGE_SPLIT_BIDI);
1742  GUIDesigns::buildFXMenuCommand(edgeOperations, "Set geometry endpoint here (shift-click)", nullptr, &parent, MID_GNE_EDGE_EDIT_ENDPOINT);
1743  // restore geometry points depending of selection status
1745  if (edgeSelSize == 1) {
1746  GUIDesigns::buildFXMenuCommand(edgeOperations, "Restore both geometry endpoints", nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
1747  } else {
1748  GUIDesigns::buildFXMenuCommand(edgeOperations, "Restore geometry endpoints of all selected edges", nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
1749  }
1750  } else {
1751  GUIDesigns::buildFXMenuCommand(edgeOperations, "Restore geometry endpoint (shift-click)", nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
1752  }
1753  GUIDesigns::buildFXMenuCommand(edgeOperations, "Reverse " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_REVERSE);
1754  GUIDesigns::buildFXMenuCommand(edgeOperations, "Add reverse direction for " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE);
1755  GUIDesigns::buildFXMenuCommand(edgeOperations, "Reset lengths for " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_RESET_LENGTH);
1756  GUIDesigns::buildFXMenuCommand(edgeOperations, "Straighten " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN);
1757  GUIDesigns::buildFXMenuCommand(edgeOperations, "Smooth " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_SMOOTH);
1758  GUIDesigns::buildFXMenuCommand(edgeOperations, "Straighten elevation of " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN_ELEVATION);
1759  GUIDesigns::buildFXMenuCommand(edgeOperations, "Smooth elevation of " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_SMOOTH_ELEVATION);
1760 }
1761 
1762 
1763 void
1765  // Get icons
1766  FXIcon* pedestrianIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_PEDESTRIAN);
1767  FXIcon* bikeIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_BIKE);
1768  FXIcon* busIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_BUS);
1769  FXIcon* greenVergeIcon = GUIIconSubSys::getIcon(GUIIcon::LANEGREENVERGE);
1770  // declare number of selected lanes
1771  int numSelectedLanes = 0;
1772  // if lane is selected, calculate number of restricted lanes
1773  bool edgeHasSidewalk = false;
1774  bool edgeHasBikelane = false;
1775  bool edgeHasBuslane = false;
1776  bool differentLaneShapes = false;
1778  const auto selectedLanes = myNet->getAttributeCarriers()->getSelectedLanes();
1779  // update numSelectedLanes
1780  numSelectedLanes = (int)selectedLanes.size();
1781  // iterate over selected lanes
1782  for (const auto& selectedLane : selectedLanes) {
1783  if (selectedLane->myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN)) {
1784  edgeHasSidewalk = true;
1785  }
1786  if (selectedLane->myParentEdge->hasRestrictedLane(SVC_BICYCLE)) {
1787  edgeHasBikelane = true;
1788  }
1789  if (selectedLane->myParentEdge->hasRestrictedLane(SVC_BUS)) {
1790  edgeHasBuslane = true;
1791  }
1792  if (selectedLane->myParentEdge->getNBEdge()->getLaneStruct(selectedLane->getIndex()).customShape.size() != 0) {
1793  differentLaneShapes = true;
1794  }
1795  }
1796  } else {
1797  edgeHasSidewalk = myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN);
1798  edgeHasBikelane = myParentEdge->hasRestrictedLane(SVC_BICYCLE);
1799  edgeHasBuslane = myParentEdge->hasRestrictedLane(SVC_BUS);
1800  differentLaneShapes = myParentEdge->getNBEdge()->getLaneStruct(myIndex).customShape.size() != 0;
1801  }
1802  // create menu pane for lane operations
1803  FXMenuPane* laneOperations = new FXMenuPane(ret);
1804  ret->insertMenuPaneChild(laneOperations);
1805  if (numSelectedLanes > 0) {
1806  new FXMenuCascade(ret, ("lane operations (" + toString(numSelectedLanes) + " selected)").c_str(), nullptr, laneOperations);
1807  } else {
1808  new FXMenuCascade(ret, "lane operations", nullptr, laneOperations);
1809  }
1810  GUIDesigns::buildFXMenuCommand(laneOperations, "Duplicate lane", nullptr, &parent, MID_GNE_LANE_DUPLICATE);
1811  GUIDesigns::buildFXMenuCommand(ret, "Set custom lane shape", nullptr, &parent, MID_GNE_LANE_EDIT_SHAPE);
1812  FXMenuCommand* resetCustomShape = GUIDesigns::buildFXMenuCommand(laneOperations, "reset custom shape", nullptr, &parent, MID_GNE_LANE_RESET_CUSTOMSHAPE);
1813  if (!differentLaneShapes) {
1814  resetCustomShape->disable();
1815  }
1816  FXMenuCommand* resetOppositeLane = GUIDesigns::buildFXMenuCommand(laneOperations, "reset opposite lane", nullptr, &parent, MID_GNE_LANE_RESET_OPPOSITELANE);
1817  if (getAttribute(GNE_ATTR_OPPOSITE).empty()) {
1818  resetOppositeLane->disable();
1819  }
1820  // Create panel for lane operations and insert it in ret
1821  FXMenuPane* addSpecialLanes = new FXMenuPane(laneOperations);
1822  ret->insertMenuPaneChild(addSpecialLanes);
1823  FXMenuPane* removeSpecialLanes = new FXMenuPane(laneOperations);
1824  ret->insertMenuPaneChild(removeSpecialLanes);
1825  FXMenuPane* transformSlanes = new FXMenuPane(laneOperations);
1826  ret->insertMenuPaneChild(transformSlanes);
1827  // Create menu comands for all add special lanes
1828  FXMenuCommand* addSidewalk = GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_ADD_SIDEWALK);
1829  FXMenuCommand* addBikelane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_ADD_BIKE);
1830  FXMenuCommand* addBuslane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Buslane", busIcon, &parent, MID_GNE_LANE_ADD_BUS);
1831  GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Greenverge (front)", greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_FRONT);
1832  GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Greenverge (back)", greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_BACK);
1833  // Create menu comands for all remove special lanes and disable it
1834  FXMenuCommand* removeSidewalk = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_REMOVE_SIDEWALK);
1835  removeSidewalk->disable();
1836  FXMenuCommand* removeBikelane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_REMOVE_BIKE);
1837  removeBikelane->disable();
1838  FXMenuCommand* removeBuslane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, "Buslane", busIcon, &parent, MID_GNE_LANE_REMOVE_BUS);
1839  removeBuslane->disable();
1840  FXMenuCommand* removeGreenVerge = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_REMOVE_GREENVERGE);
1841  removeGreenVerge->disable();
1842  // Create menu comands for all trasform special lanes and disable it
1843  FXMenuCommand* transformLaneToSidewalk = GUIDesigns::buildFXMenuCommand(transformSlanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_TRANSFORM_SIDEWALK);
1844  FXMenuCommand* transformLaneToBikelane = GUIDesigns::buildFXMenuCommand(transformSlanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_TRANSFORM_BIKE);
1845  FXMenuCommand* transformLaneToBuslane = GUIDesigns::buildFXMenuCommand(transformSlanes, "Buslane", busIcon, &parent, MID_GNE_LANE_TRANSFORM_BUS);
1846  FXMenuCommand* transformLaneToGreenVerge = GUIDesigns::buildFXMenuCommand(transformSlanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_TRANSFORM_GREENVERGE);
1847  // add menuCascade for lane operations
1848  new FXMenuCascade(laneOperations, ("add restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, addSpecialLanes);
1849  FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(laneOperations, ("remove restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, removeSpecialLanes);
1850  new FXMenuCascade(laneOperations, ("transform to restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, transformSlanes);
1851  // Enable and disable options depending of current transform of the lane
1852  if (edgeHasSidewalk) {
1853  transformLaneToSidewalk->disable();
1854  addSidewalk->disable();
1855  removeSidewalk->enable();
1856  }
1857  if (edgeHasBikelane) {
1858  transformLaneToBikelane->disable();
1859  addBikelane->disable();
1860  removeBikelane->enable();
1861  }
1862  if (edgeHasBuslane) {
1863  transformLaneToBuslane->disable();
1864  addBuslane->disable();
1865  removeBuslane->enable();
1866  }
1867  if (isRestricted(SVC_IGNORING)) {
1868  transformLaneToGreenVerge->disable();
1869  removeGreenVerge->enable();
1870  }
1871  // Check if cascade menu must be disabled
1872  if (!edgeHasSidewalk && !edgeHasBikelane && !edgeHasBuslane && !isRestricted(SVC_IGNORING)) {
1873  cascadeRemoveSpecialLane->disable();
1874  }
1875 }
1876 
1877 
1878 void
1880  // addreachability menu
1881  FXMenuPane* reachableByClass = new FXMenuPane(ret);
1882  ret->insertMenuPaneChild(reachableByClass);
1883  if (myNet->isNetRecomputed()) {
1884  new FXMenuCascade(ret, "Select reachable", GUIIconSubSys::getIcon(GUIIcon::FLAG), reachableByClass);
1885  for (const auto& vClass : SumoVehicleClassStrings.getStrings()) {
1886  GUIDesigns::buildFXMenuCommand(reachableByClass, vClass.c_str(), nullptr, &parent, MID_REACHABILITY);
1887  }
1888  } else {
1889  FXMenuCommand* menuCommand = GUIDesigns::buildFXMenuCommand(ret, "Select reachable (compute junctions)", nullptr, nullptr, 0);
1890  menuCommand->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
1891  }
1892 }
1893 
1894 /****************************************************************************/
1895 
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_TLS
mode for editing tls
@ NETWORK_CONNECT
mode for connecting lanes
@ MID_GNE_ADDSELECT_EDGE
Add edge to selected items - menu entry.
Definition: GUIAppEnum.h:710
@ MID_GNE_LANE_EDIT_SHAPE
edit lane shape
Definition: GUIAppEnum.h:1140
@ MID_GNE_LANE_TRANSFORM_BIKE
transform lane to bikelane
Definition: GUIAppEnum.h:1148
@ MID_GNE_EDGE_REVERSE
reverse an edge
Definition: GUIAppEnum.h:1058
@ MID_ADDSELECT
Add to selected items - menu entry.
Definition: GUIAppEnum.h:439
@ MID_GNE_LANE_ADD_BUS
add busLane
Definition: GUIAppEnum.h:1158
@ MID_GNE_REMOVESELECT_EDGE
Remove edge from selected items - Menu Etry.
Definition: GUIAppEnum.h:712
@ MID_GNE_EDGE_STRAIGHTEN_ELEVATION
interpolate z values linear between junctions
Definition: GUIAppEnum.h:1050
@ MID_GNE_EDGE_SMOOTH
smooth geometry
Definition: GUIAppEnum.h:1048
@ MID_GNE_LANE_RESET_CUSTOMSHAPE
reset custom shape
Definition: GUIAppEnum.h:1142
@ MID_GNE_EDGE_STRAIGHTEN
remove inner geometry
Definition: GUIAppEnum.h:1046
@ MID_GNE_LANE_TRANSFORM_BUS
transform lane to busLane
Definition: GUIAppEnum.h:1150
@ MID_COPY_EDGE_NAME
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:415
@ MID_GNE_LANE_DUPLICATE
duplicate a lane
Definition: GUIAppEnum.h:1138
@ MID_GNE_LANE_ADD_GREENVERGE_FRONT
add greenVerge front of current lane
Definition: GUIAppEnum.h:1160
@ MID_GNE_LANE_REMOVE_GREENVERGE
remove greenVerge
Definition: GUIAppEnum.h:1170
@ MID_GNE_EDGE_SPLIT_BIDI
split an edge
Definition: GUIAppEnum.h:1056
@ MID_GNE_LANE_REMOVE_BIKE
remove bikelane
Definition: GUIAppEnum.h:1166
@ MID_GNE_LANE_RESET_OPPOSITELANE
reset opposite lane
Definition: GUIAppEnum.h:1144
@ MID_REACHABILITY
show reachability from a given lane
Definition: GUIAppEnum.h:485
@ MID_GNE_EDGE_RESET_LENGTH
reset custom lengths
Definition: GUIAppEnum.h:1062
@ MID_GNE_LANE_REMOVE_BUS
remove busLane
Definition: GUIAppEnum.h:1168
@ MID_GNE_LANE_REMOVE_SIDEWALK
remove sidewalk
Definition: GUIAppEnum.h:1164
@ MID_GNE_EDGE_RESET_ENDPOINT
reset default geometry endpoints
Definition: GUIAppEnum.h:1044
@ MID_GNE_LANE_ADD_GREENVERGE_BACK
add greenVerge back of current laen
Definition: GUIAppEnum.h:1162
@ MID_GNE_EDGE_SMOOTH_ELEVATION
smooth elevation with regard to adjoining edges
Definition: GUIAppEnum.h:1052
@ MID_GNE_EDGE_ADD_REVERSE
add reverse edge
Definition: GUIAppEnum.h:1060
@ MID_GNE_LANE_ADD_SIDEWALK
add sidewalk
Definition: GUIAppEnum.h:1154
@ MID_GNE_RESET_GEOMETRYPOINT
reset geometry point
Definition: GUIAppEnum.h:877
@ MID_GNE_LANE_TRANSFORM_SIDEWALK
transform lane to sidewalk
Definition: GUIAppEnum.h:1146
@ MID_GNE_LANE_ADD_BIKE
add bikelane
Definition: GUIAppEnum.h:1156
@ MID_GNE_EDGE_SPLIT
split an edge
Definition: GUIAppEnum.h:1054
@ MID_GNE_LANE_TRANSFORM_GREENVERGE
transform lane to greenVerge
Definition: GUIAppEnum.h:1152
@ MID_GNE_CUSTOM_GEOMETRYPOINT
set custom geometry point
Definition: GUIAppEnum.h:875
@ MID_GNE_EDGE_EDIT_ENDPOINT
change default geometry endpoints
Definition: GUIAppEnum.h:1042
@ MID_REMOVESELECT
Remove from selected items - Menu Etry.
Definition: GUIAppEnum.h:441
@ GLO_DOTTEDCONTOUR_FRONT
dotted contour front element (used in NETEDIT)
@ GLO_ROUTE
a route
@ GLO_JUNCTION
a junction
@ GLO_LANE
a lane
@ GLO_TEXTNAME
text element (used in NETEDIT)
@ LANE_PEDESTRIAN
@ LANEGREENVERGE
#define RAD2DEG(x)
Definition: GeomHelper.h:36
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
const SVCPermissions SVCAll
all VClasses are allowed
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_SHIP
is an arbitrary ship
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_RAIL_CLASSES
classes which drive on tracks
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_RAIL_FAST
vehicle that is allowed to drive on high-speed rail tracks
@ SVC_AUTHORITY
authorities vehicles
@ SVC_BUS
vehicle is a bus
@ SVC_PEDESTRIAN
pedestrian
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
@ PARTLEFT
The link is a partial left direction.
@ RIGHT
The link is a (hard) right direction.
@ TURN
The link is a 180 degree turn.
@ LEFT
The link is a (hard) left direction.
@ STRAIGHT
The link is a straight direction.
@ TURN_LEFTHAND
The link is a 180 degree turn (left-hand network)
@ PARTRIGHT
The link is a partial right direction.
@ NODIR
The link has no direction (is a dead end link)
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
@ LINKSTATE_ALLWAY_STOP
This is an uncontrolled, all-way stop link.
@ LINKSTATE_MAJOR
This is an uncontrolled, major link, may pass.
@ LINKSTATE_STOP
This is an uncontrolled, minor link, has to stop.
@ LINKSTATE_EQUAL
This is an uncontrolled, right-before-left link.
@ LINKSTATE_ZIPPER
This is an uncontrolled, zipper-merge link.
@ LINKSTATE_TL_OFF_BLINKING
The link is controlled by a tls which is off and blinks, has to brake.
@ LINKSTATE_MINOR
This is an uncontrolled, minor link, has to brake.
@ LINKSTATE_TL_OFF_NOSIGNAL
The link is controlled by a tls which is off, not blinking, may pass.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_DISALLOW
@ SUMO_ATTR_ALLOW
@ SUMO_ATTR_SPEED
@ GNE_ATTR_STOPOFFSET
stop offset (virtual, used by edge and lanes)
@ SUMO_ATTR_VIA
@ GNE_ATTR_OPPOSITE
neighboring lane, simplified lane attr instead of child element
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_CUSTOMSHAPE
whether a given shape is user-defined
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_STOPOEXCEPTION
stop exceptions (virtual, used by edge and lanes)
@ SUMO_ATTR_CHANGE_LEFT
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_ENDOFFSET
@ SUMO_ATTR_ACCELERATION
@ SUMO_ATTR_CHANGE_RIGHT
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_ID
@ SUMO_ATTR_WIDTH
const double SUMO_const_laneWidth
Definition: StdDefs.h:48
T MIN2(T a, T b)
Definition: StdDefs.h:74
const double SUMO_const_laneMarkWidth
Definition: StdDefs.h:54
T MAX2(T a, T b)
Definition: StdDefs.h:80
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:369
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:507
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:431
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth, const double extraOffset=0)
Draws a triangle at the end of the given line.
Definition: GLHelper.cpp:485
static void drawTextAtEnd(const std::string &text, const PositionVector &shape, double x, const GUIVisualizationTextSettings &settings, const double scale)
draw text and the end of shape
Definition: GLHelper.cpp:691
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:132
static void drawOutlineCircle(double width, double iwidth, int steps=8)
Draws an unfilled circle around (0,0)
Definition: GLHelper.cpp:455
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:513
static void drawCrossTies(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double length, double spacing, double halfWidth, bool drawForSelection)
draw crossties for railroads or pedestrian crossings
Definition: GLHelper.cpp:709
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:231
static void popName()
pop Name
Definition: GLHelper.cpp:141
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
static void drawInverseMarkings(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double maxLength, double spacing, double halfWidth, bool cl, bool cr, bool lefthand, double scale)
@bried draw the space between markings (in road color)
Definition: GLHelper.cpp:748
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
Definition: GLHelper.cpp:609
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
virtual std::string getAttribute(SumoXMLAttr key) const =0
bool myPossibleCandidate
flag to mark this element as possible candidate
bool mySpecialCandidate
flag to mark this element as special candidate
bool isSpecialCandidate() const
check if this element is a special candidate
bool isPossibleCandidate() const
check if this element is a possible candidate
bool isTargetCandidate() const
check if this element is a target candidate
bool isSourceCandidate() const
check if this element is a source candidate
bool isConflictedCandidate() const
check if this element is a conflicted candidate
bool myTargetCandidate
flag to mark this element as target candidate
bool myConflictedCandidate
flag to mark this element as conflicted candidate
bool mySourceCandidate
flag to mark this element as source candidate
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNEEdge.cpp:329
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:77
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:435
bool clickedOverGeometryPoint(const Position &pos) const
return true if user clicked over a Geometry Point
Definition: GNEEdge.cpp:290
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:82
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:782
static const double SNAP_RADIUS
Definition: GNEEdge.h:258
bool hasCustomEndPoints() const
Definition: GNEEdge.cpp:258
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
Definition: GNEEdge.cpp:1955
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:788
void drawEdgeGeometryPoints(const GUIVisualizationSettings &s, const GNELane *lane) const
draw edge geometry points (note: This function is called by GNELane::drawGL(...)
Definition: GNEEdge.cpp:1263
const std::string & getID() const
return ID of object
bool drawCandidateEdgesWithSpecialColor() const
draw candidate edges with special color (Only for candidates, special and conflicted)
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEGenericData * > & getParentGenericDatas() const
get parent demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEShape * > & getParentShapes() const
get parent shapes
const std::vector< GNEShape * > & getChildShapes() const
get child shapes
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
void setEdgeTemplate(const GNEEdge *edge)
set edge template
GNEEdgeTemplate * getEdgeTemplate() const
get edge template (to copy attributes from)
TemplateEditor * getTemplateEditor() const
get template editor
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
static const StringBijection< FXuint > LinkStateNames
long names for link states
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
bool isLogicValid()
whether this junction has a valid logic
Position getPositionInView() const
Returns position of hierarchical element in view.
class lane2lane connection geometry
FOX-declaration.
Definition: GNELane.h:52
const double exaggeration
exaggeration
Definition: GNELane.h:62
LaneDrawingConstants()
default constructor
Definition: GNELane.cpp:74
const double halfWidth
Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen.
Definition: GNELane.h:68
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNELane2laneConnection myLane2laneConnections
lane2lane connections
Definition: GNELane.h:280
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:131
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
Definition: GNELane.cpp:1655
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:838
~GNELane()
Destructor.
Definition: GNELane.cpp:109
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNELane.cpp:1649
std::string getAttribute(SumoXMLAttr key) const
Definition: GNELane.cpp:844
void drawLinkRules(const GUIVisualizationSettings &s) const
draw link rules
Definition: GNELane.cpp:356
std::vector< double > myLaneRestrictedTextureRotations
Rotations of textures of restricted lanes.
Definition: GNELane.h:267
bool allowPedestrians() const
check if current lane allow pedestrians
Definition: GNELane.cpp:119
const RGBColor * mySpecialColor
optional special color
Definition: GNELane.h:271
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNELane.cpp:238
bool isAttributeComputed(SumoXMLAttr key) const
Definition: GNELane.cpp:1013
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
Definition: GNELane.cpp:1436
double getLengthGeometryFactor() const
get length geometry factor
Definition: GNELane.cpp:1713
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNELane.cpp:1001
void updateGeometry()
update pre-computed geometry information
Definition: GNELane.cpp:153
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNELane.cpp:1140
GNEEdge * myParentEdge
parent edge (GNELanes cannot use hierarchical structures)
Definition: GNELane.h:252
std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
Definition: GNELane.cpp:897
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNELane.cpp:684
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:797
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
Definition: GNELane.cpp:781
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition: GNELane.cpp:257
GUIGeometry myLaneGeometry
lane geometry
Definition: GNELane.h:258
void drawStartEndShapePoints(const GUIVisualizationSettings &s) const
draw start and end shape points
Definition: GNELane.cpp:1574
void drawMarkings(const GUIVisualizationSettings &s, const double exaggeration, const bool drawRailway) const
draw lane markings
Definition: GNELane.cpp:650
void drawOverlappedRoutes(const int numRoutes) const
draw overlapped routes
Definition: GNELane.cpp:1398
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNELane.cpp:244
void buildLaneOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build lane operations contextual menu
Definition: GNELane.cpp:1764
GNELane()
FOX needs this.
Definition: GNELane.cpp:98
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition: GNELane.cpp:1683
const std::vector< double > & getShapeRotations() const
get rotations of the single shape parts
Definition: GNELane.cpp:141
void drawTextures(const GUIVisualizationSettings &s, const LaneDrawingConstants &laneDrawingConstants) const
draw lane textures
Definition: GNELane.cpp:1536
bool setMultiColor(const GUIVisualizationSettings &s, const GUIColorer &c, RGBColor &col) const
sets multiple colors according to the current scheme index and some lane function
Definition: GNELane.cpp:1265
void drawLaneAsRailway(const GUIVisualizationSettings &s, const LaneDrawingConstants &laneDrawingConstants) const
draw lane as railway
Definition: GNELane.cpp:1487
void drawTLSLinkNo(const GUIVisualizationSettings &s) const
draw TLS Link Number
Definition: GNELane.cpp:320
double getLaneParametricLength() const
returns the parameteric length of the lane
Definition: GNELane.cpp:815
RGBColor setLaneColor(const GUIVisualizationSettings &s) const
set color according to edit mode and visualisation settings
Definition: GNELane.cpp:1158
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNELane.cpp:937
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1662
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition: GNELane.cpp:1390
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
Definition: GNELane.cpp:832
int myIndex
The index of this lane.
Definition: GNELane.h:255
void drawDirectionIndicators(const GUIVisualizationSettings &s, double exaggeration, const bool drawAsRailway, const bool spreadSuperposed) const
direction indicators for lanes
Definition: GNELane.cpp:1442
void setIndex(int index)
Definition: GNELane.cpp:802
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNELane.cpp:496
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNELane.cpp:1025
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition: GNELane.cpp:1031
const GUIGeometry & getLaneGeometry() const
Definition: GNELane.cpp:125
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNELane.cpp:787
double mySpecialColorValue
optional value that corresponds to which the special color corresponds
Definition: GNELane.h:274
void drawChildren(const GUIVisualizationSettings &s) const
draw children
Definition: GNELane.cpp:630
std::vector< Position > myLaneRestrictedTexturePositions
Position of textures of restricted lanes.
Definition: GNELane.h:264
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNELane.cpp:1149
double getLaneShapeLength() const
returns the length of the lane's shape
Definition: GNELane.cpp:826
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GNELane.h:277
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
return value for lane coloring according to the given scheme
Definition: GNELane.cpp:1289
bool setFunctionalColor(int activeScheme, RGBColor &col) const
sets the color according to the current scheme index and some lane function
Definition: GNELane.cpp:1251
void updateConnectionIDs()
update IDs of incoming connections of this lane
Definition: GNELane.cpp:1698
void drawArrows(const GUIVisualizationSettings &s, const bool spreadSuperposed) const
draw arrows
Definition: GNELane.cpp:362
void buildRechableOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build rechable operations contextual menu
Definition: GNELane.cpp:1879
void drawLaneStopOffset(const GUIVisualizationSettings &s, const double offset) const
draw laneStopOffset
Definition: GNELane.cpp:1415
void drawLane2LaneConnections() const
draw lane to lane connections
Definition: GNELane.cpp:448
void buildEdgeOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build edge operations contextual menu
Definition: GNELane.cpp:1724
const std::vector< double > & getShapeLengths() const
get lengths of the single shape parts
Definition: GNELane.cpp:147
void drawLinkNo(const GUIVisualizationSettings &s) const
draw link Number
Definition: GNELane.cpp:283
double getSpeed() const
returns the current speed of lane
Definition: GNELane.cpp:809
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNELane.cpp:907
GNEEdge * getParentEdge() const
get arent edge
Definition: GNELane.cpp:113
GNEMoveOperation * calculateMoveShapeOperation(const PositionVector originalShape, const Position mousePosition, const double snapRadius, const bool onlyContour)
calculate move shape operation
move operation
move result
PositionVector shapeToUpdate
shape to update (edited in moveElement)
std::vector< GNELane * > getSelectedLanes() const
get selected lanes
int getNumberOfSelectedEdges() const
get number of selected edges
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
bool isNetRecomputed() const
check if net require recomputing
Definition: GNENet.cpp:1347
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:131
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
Definition: GNENet.cpp:1976
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
bool myShapeEdited
flag to check if element shape is being edited
bool isShapeEdited() const
check if shape is being edited
const std::string & getID() const
get ID
Boundary myBoundary
object boundary
void invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
void drawLanePathElements(const GUIVisualizationSettings &s, const GNELane *lane)
draw lane path elements
GNEFrameModules::PathCreator * getPathCreator() const
get path creator modul
bool controlsEdge(GNEEdge *edge) const
whether the given edge is controlled by the currently edited tlDef
void handleMultiChange(GNELane *lane, FXObject *obj, FXSelector sel, void *data)
update phase definition for the current traffic light and phase
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:513
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:525
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
GNEViewParent * getViewParent() const
get the net object
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
GNETLSEditorFrame * getTLSEditorFrame() const
get frame for NETWORK_TLS
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
GNERouteFrame * getRouteFrame() const
get frame for DEMAND_ROUTE
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem, const double lineWidth=-1)
draw dotted contour for the given shape (used by additionals)
The popup menu of a globject.
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
static void drawGeometryPoints(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &geometryPointColor, const RGBColor &textColor, const double radius, const double exaggeration, const bool editingElevation, const bool drawExtremeSymbols)
draw geometry points
static void drawLaneGeometry(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const std::vector< double > &rotations, const std::vector< double > &lengths, const std::vector< RGBColor > &colors, double width, const bool onlyContour=false)
draw lane geometry (use their own function due colors)
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawGeometry(const GUIVisualizationSettings &s, const Position &mousePos, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
static double calculateRotation(const Position &first, const Position &second)
return angle between two points (used in geometric calculations)
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:58
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
const T getColor(const double value) const
const std::vector< T > & getSchemes() const
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
Stores the information about how to visualize structures.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationDetailSettings detailSettings
detail settings
GUIVisualizationSizeSettings addSize
bool disableLaneIcons
whether drawing is performed in left-hand networks
GUIVisualizationTextSettings drawLinkJunctionIndex
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
bool showRails
Information whether rails shall be drawn.
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
bool lefthand
whether drawing is performed in left-hand networks
GUIVisualizationColorSettings colorSettings
color settings
static const RGBColor & getLinkColor(const LinkState &ls, bool realistic=false)
map from LinkState to color constants
double scale
information about a lane's width (temporary, used for a single view)
bool showLaneDirection
Whether to show direction indicators for lanes.
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
GUIColorer laneColorer
The lane colorer.
bool laneShowBorders
Information whether lane borders shall be drawn.
double laneMinSize
The minimum visual lane width for drawing.
GUIVisualizationTextSettings drawLinkTLIndex
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
GUIColorer junctionColorer
The junction colorer.
std::string edgeParam
key for coloring by edge parameter
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:192
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:112
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:275
The representation of a single edge during network building.
Definition: NBEdge.h:91
double getLaneSpeed(int lane) const
get lane speed
Definition: NBEdge.cpp:2089
void setPermittedChanging(int lane, SVCPermissions changeLeft, SVCPermissions changeRight)
set allowed classes for changing to the left and right from the given lane
Definition: NBEdge.cpp:4013
double getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:588
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:4022
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:3985
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
Definition: NBEdge.h:597
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3953
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:630
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1699
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition: NBEdge.cpp:742
const std::string & getID() const
Definition: NBEdge.h:1465
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:541
NBNode * myTo
Definition: NBEdge.h:1672
bool allowsChangingRight(int lane, SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
Definition: NBEdge.cpp:4168
double getDistance() const
get distance
Definition: NBEdge.h:653
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3839
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
Definition: NBEdge.cpp:3969
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1206
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:515
std::string getLaneID(int lane) const
get lane ID
Definition: NBEdge.cpp:3693
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
Definition: NBEdge.cpp:3977
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:522
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:349
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3907
bool allowsChangingLeft(int lane, SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
Definition: NBEdge.cpp:4162
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:1101
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:930
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1368
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:4354
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:534
Represents a single node (junction) during network building.
Definition: NBNode.h:66
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:2286
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
Definition: NBNode.cpp:2221
int getConnectionIndex(const NBEdge *from, const NBEdge::Connection &con) const
return the index of the given connection
Definition: NBNode.cpp:3480
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double x() const
Returns the x-position.
Definition: Position.h:55
double z() const
Returns the z-position.
Definition: Position.h:65
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position
Definition: Position.h:262
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
double length2D() const
Returns the length.
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position
double length() const
Returns the length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
int indexOfClosest(const Position &p, bool twoD=false) const
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor WHITE
Definition: RGBColor.h:192
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition: RGBColor.cpp:92
static const RGBColor ORANGE
Definition: RGBColor.h:191
static const RGBColor CYAN
Definition: RGBColor.h:189
static const RGBColor GREEN
Definition: RGBColor.h:186
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb....
Definition: RGBColor.cpp:368
static const RGBColor BLACK
Definition: RGBColor.h:193
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:197
void setOffset(const double offset)
set offset
bool isDefined() const
check if stopOffset was defined
void reset()
reset stopOffset
void setExceptions(const std::string permissions)
set exceptions (used in NETEDIT)
std::string getExceptions() const
get exceptions (used in NETEDIT)
double getOffset() const
get offset
T get(const std::string &str) const
std::vector< std::string > getStrings() const
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool editingElevation() const
check if we're editing elevation
bool showDemandElements() const
check if show demand elements checkbox is enabled
static const RGBColor special
color for selected special candidate element (Usually selected using shift+click)
static const RGBColor conflict
color for selected conflict candidate element (Usually selected using ctrl+click)
static const RGBColor target
color for selected candidate target
static const RGBColor possible
color for possible candidate element
static const RGBColor source
color for selected candidate source
RGBColor selectedEdgeColor
edge selection color
RGBColor selectedLaneColor
lane selection color
static const RGBColor editShapeColor
color for edited shapes (Junctions, crossings and connections)
static const double laneTextures
details for lane textures
static const double geometryPointsText
details for Geometry Points Texts
static const double laneGeometryPointRadius
moving lane geometry point radius
static const double junctionBubbleRadius
junction buuble radius
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool show(const GUIGlObject *o) const
whether to show the text
double width
This lane's width.
Definition: NBEdge.h:172
StopOffset laneStopOffset
stopOffsets.second - The stop offset for vehicles stopping at the lane's end. Applies if vClass is in...
Definition: NBEdge.h:169
PositionVector customShape
A custom shape for this lane set by the user.
Definition: NBEdge.h:185
double endOffset
This lane's offset to the intersection begin.
Definition: NBEdge.h:165
std::string type
the type of this lane
Definition: NBEdge.h:188
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:175
SVCPermissions changeRight
List of vehicle types that are allowed to change right from this lane.
Definition: NBEdge.h:162
SVCPermissions changeLeft
List of vehicle types that are allowed to change Left from this lane.
Definition: NBEdge.h:159
bool accelRamp
Whether this lane is an acceleration lane.
Definition: NBEdge.h:178
PositionVector shape
The lane's shape.
Definition: NBEdge.h:147