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-2020 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>
29 #include <netbuild/NBEdgeCont.h>
30 #include <utils/gui/div/GLHelper.h>
36 
37 #include "GNELane.h"
38 #include "GNEInternalLane.h"
39 #include "GNEConnection.h"
40 
41 // ===========================================================================
42 // FOX callback mapping
43 // ===========================================================================
44 
45 // Object implementation
46 FXIMPLEMENT(GNELane, FXDelegator, 0, 0)
47 
48 // ===========================================================================
49 // method definitions
50 // ===========================================================================
51 
52 // ---------------------------------------------------------------------------
53 // GNELane::LaneDrawingConstants - methods
54 // ---------------------------------------------------------------------------
55 
57  selectionScale(lane->isAttributeCarrierSelected() || lane->myParentEdge->isAttributeCarrierSelected() ? s.selectorFrameScale : 1),
58  exaggeration(selectionScale * s.laneWidthExaggeration),
59  halfWidth2(exaggeration * (lane->myParentEdge->getNBEdge()->getLaneWidth(lane->getIndex()) / 2 - SUMO_const_laneMarkWidth / 2)),
60  halfWidth(lane->drawUsingSelectColor() ? halfWidth2 - exaggeration * 0.3 : halfWidth2) {
61  // start drawing lane checking whether it is not too small
62  //selectionScale = lane->isAttributeCarrierSelected() || lane->myParentEdge->isAttributeCarrierSelected() ? s.selectionScale : 1;
63  //exaggeration = selectionScale * s.laneWidthExaggeration; // * s.laneScaler.getScheme().getColor(getScaleValue(s.laneScaler.getActive()));
64  // compute lane-marking intersection points)
65  //halfWidth2 = exaggeration * (lane->myParentEdge->getNBEdge()->getLaneWidth(lane->getIndex()) / 2 - SUMO_const_laneMarkWidth / 2);
66 
67  // Draw as a normal lane, and reduce width to make sure that a selected edge can still be seen
68  //halfWidth = lane->drawUsingSelectColor() ? halfWidth2 - exaggeration * 0.3 : halfWidth2;
69 }
70 
71 
73  selectionScale(0),
74  exaggeration(0),
75  halfWidth2(0),
76  halfWidth(0) {
77 }
78 
79 // ---------------------------------------------------------------------------
80 // GNELane - methods
81 // ---------------------------------------------------------------------------
82 
83 GNELane::GNELane(GNEEdge* edge, const int index) :
84  GNENetworkElement(edge->getNet(), edge->getNBEdge()->getLaneID(index), GLO_LANE, SUMO_TAG_LANE,
85 {}, {}, {}, {}, {}, {}, {}, {}),
86 myParentEdge(edge),
87 myIndex(index),
88 mySpecialColor(nullptr),
89 mySpecialColorValue(-1),
90 myLane2laneConnections(this) {
91  // update centering boundary without updating grid
92  updateCenteringBoundary(false);
93 }
94 
95 
97  GNENetworkElement(nullptr, "dummyConstructorGNELane", GLO_LANE, SUMO_TAG_LANE,
98 {}, {}, {}, {}, {}, {}, {}, {}),
99 myParentEdge(nullptr),
100 myIndex(-1),
101 mySpecialColor(nullptr),
102 mySpecialColorValue(-1),
103 myLane2laneConnections(this) {
104 }
105 
106 
108 
109 
110 GNEEdge*
112  return myParentEdge;
113 }
114 
115 
116 const PositionVector&
119 }
120 
121 
122 const std::vector<double>&
125 }
126 
127 
128 const std::vector<double>&
131 }
132 
133 
136  return myDottedLaneGeometry;
137 }
138 
139 
140 void
142  // Clear texture containers
145  //double length = myParentEdge->getLength(); // @todo see ticket #448
146  // may be different from length
147  // Obtain lane shape of NBEdge
149  // update connections
151  // update dotted lane geometry
152  if (myNet->getViewNet()) {
154  }
155  // update shapes parents associated with this lane
156  for (const auto& shape : getParentShapes()) {
157  shape->updateGeometry();
158  }
159  // update child shapes associated with this lane
160  for (const auto& shape : getChildShapes()) {
161  shape->updateGeometry();
162  }
163  // update additionals children associated with this lane
164  for (const auto& additional : getParentAdditionals()) {
165  additional->updateGeometry();
166  additional->updatePartialGeometry(this);
167  }
168  // update additionals parents associated with this lane
169  for (const auto& additional : getChildAdditionals()) {
170  additional->updateGeometry();
171  additional->updatePartialGeometry(this);
172  }
173  // update partial demand elements parents associated with this lane
174  for (const auto& demandElement : getParentDemandElements()) {
175  demandElement->updateGeometry();
176  demandElement->updatePartialGeometry(this);
177  }
178  // update partial demand elements children associated with this lane
179  for (const auto& demandElement : getChildDemandElements()) {
180  demandElement->updateGeometry();
181  demandElement->updatePartialGeometry(this);
182  }
183  // Update geometry of parent generic datas that have this edge as parent
184  for (const auto& additionalParent : getParentGenericDatas()) {
185  additionalParent->updateGeometry();
186  }
187  // Update geometry of additionals generic datas vinculated to this edge
188  for (const auto& childAdditionals : getChildGenericDatas()) {
189  childAdditionals->updateGeometry();
190  }
191  // in Move mode, connections aren't updated
193  // Update incoming connections of this lane
194  auto incomingConnections = getGNEIncomingConnections();
195  for (auto i : incomingConnections) {
196  i->updateGeometry();
197  }
198  // Update outgoings connections of this lane
199  auto outGoingConnections = getGNEOutcomingConnections();
200  for (auto i : outGoingConnections) {
201  i->updateGeometry();
202  }
203  }
204  // if lane has enought length for show textures of restricted lanes
205  if ((getLaneShapeLength() > 4)) {
206  // if lane is restricted
208  // get values for position and rotation of icons
209  for (int i = 2; i < getLaneShapeLength() - 1; i += 15) {
212  }
213  }
214  }
215 }
216 
217 
218 Position
220  // currently unused
221  return Position(0, 0);
222 }
223 
224 
226 GNELane::getMoveOperation(const double /*shapeOffset*/) {
227  // currently Lane shapes cannot be edited
228  return nullptr;
229 }
230 
231 
232 void
233 GNELane::removeGeometryPoint(const Position /*clickedPosition*/, GNEUndoList* /*undoList*/) {
234  // currently unused
235 }
236 
237 
238 void
240  // first check that drawLinkJunctionIndex must be drawn
241  if (s.drawLinkJunctionIndex.show) {
242  // get connections
243  const std::vector<NBEdge::Connection>& cons = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
244  // get number of links
245  const int noLinks = (int)cons.size();
246  // only continue if there is links
247  if (noLinks > 0) {
248  // push link matrix
249  glPushMatrix();
250  // move front
251  glTranslated(0, 0, GLO_TEXTNAME);
252  // calculate width
253  const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
254  // get X1
255  double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
256  // iterate over links
257  for (int i = noLinks; --i >= 0;) {
258  // calculate x2
259  const double x2 = x1 - (double)(width / 2.);
260  // get link index
262  cons[s.lefthand ? noLinks - 1 - i : i]);
263  // draw link index
265  // update x1
266  x1 -= width;
267  }
268  // pop link matrix
269  glPopMatrix();
270  }
271  }
272 }
273 
274 
275 void
277  // first check that drawLinkTLIndex must be drawn
278  if (s.drawLinkTLIndex.show) {
279  // get connections
280  const std::vector<NBEdge::Connection>& cons = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
281  // get numer of links
282  const int noLinks = (int)cons.size();
283  // only continue if there is lnks
284  if (noLinks > 0) {
285  // push link matrix
286  glPushMatrix();
287  // move t front
288  glTranslated(0, 0, GLO_TEXTNAME);
289  // calculate width
290  const double w = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
291  // calculate x1
292  double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
293  // iterate over links
294  for (int i = noLinks; --i >= 0;) {
295  // calculate x2
296  const double x2 = x1 - (double)(w / 2.);
297  // get link number
298  const int linkNo = cons[s.lefthand ? noLinks - 1 - i : i].tlLinkIndex;
299  // draw link number
301  // update x1
302  x1 -= w;
303  }
304  // pop link matrix
305  glPopMatrix();
306  }
307  }
308 }
309 
310 
311 void
313  // currently unused
314 }
315 
316 
317 void
319  if (s.showLinkDecals && myParentEdge->getParentJunctions().back()->isLogicValid() && s.scale > 3) {
320  // calculate begin, end and rotation
321  const Position& begin = myLaneGeometry.getShape()[-2];
322  const Position& end = myLaneGeometry.getShape().back();
323  const double rot = GNEGeometry::calculateRotation(begin, end);
324  // push arrow matrix
325  glPushMatrix();
326  // move front (note: must draw on top of junction shape?
327  glTranslated(0, 0, 0.1);
328  // change color to white
330  // move to end
331  glTranslated(end.x(), end.y(), 0);
332  // rotate
333  glRotated(rot, 0, 0, 1);
334  // get destiny node
335  const NBNode* dest = myParentEdge->getNBEdge()->myTo;
336  // draw all links iterating over connections
337  for (const auto& connection : myParentEdge->getNBEdge()->myConnections) {
338  if (connection.fromLane == myIndex) {
339  // get link direction
340  LinkDirection dir = dest->getDirection(myParentEdge->getNBEdge(), connection.toEdge, s.lefthand);
341  // draw depending of link direction
342  switch (dir) {
344  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
345  GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25);
346  break;
347  case LinkDirection::LEFT:
348  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
349  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
350  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25);
351  break;
353  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
354  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
355  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25);
356  break;
357  case LinkDirection::TURN:
358  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
359  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
360  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
361  GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25);
362  break;
364  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
365  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
366  GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
367  GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25);
368  break;
370  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
371  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
372  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25);
373  break;
375  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
376  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
377  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25);
378  break;
380  GLHelper::drawBoxLine(Position(1, 5.8), 245, 2, .05);
381  GLHelper::drawBoxLine(Position(-1, 5.8), 115, 2, .05);
382  glTranslated(0, 5, 0);
383  GLHelper::drawOutlineCircle(0.9, 0.8, 32);
384  glTranslated(0, -5, 0);
385  break;
386  }
387  }
388  }
389  // pop arrow matrix
390  glPopMatrix();
391  }
392 }
393 
394 
395 void
397  glPushMatrix();
398  glTranslated(0, 0, 0.1); // must draw on top of junction shape
399  std::vector<NBEdge::Connection> connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
400  NBNode* node = myParentEdge->getNBEdge()->getToNode();
401  const Position& startPos = myLaneGeometry.getShape()[-1];
402  for (auto it : connections) {
403  const LinkState state = node->getLinkState(myParentEdge->getNBEdge(), it.toEdge, it.fromLane, it.toLane, it.mayDefinitelyPass, it.tlID);
404  switch (state) {
406  glColor3d(1, 1, 0);
407  break;
409  glColor3d(0, 1, 1);
410  break;
411  case LINKSTATE_MAJOR:
412  glColor3d(1, 1, 1);
413  break;
414  case LINKSTATE_MINOR:
415  glColor3d(.4, .4, .4);
416  break;
417  case LINKSTATE_STOP:
418  glColor3d(.7, .4, .4);
419  break;
420  case LINKSTATE_EQUAL:
421  glColor3d(.7, .7, .7);
422  break;
424  glColor3d(.7, .7, 1);
425  break;
426  case LINKSTATE_ZIPPER:
427  glColor3d(.75, .5, 0.25);
428  break;
429  default:
430  throw ProcessError("Unexpected LinkState '" + toString(state) + "'");
431  }
432  const Position& endPos = it.toEdge->getLaneShape(it.toLane)[0];
433  glBegin(GL_LINES);
434  glVertex2d(startPos.x(), startPos.y());
435  glVertex2d(endPos.x(), endPos.y());
436  glEnd();
437  GLHelper::drawTriangleAtEnd(startPos, endPos, (double) 1.5, (double) .2);
438  }
439  glPopMatrix();
440 }
441 
442 
443 void
445  // get lane drawing constants
446  LaneDrawingConstants laneDrawingConstants(s, this);
447  // get lane color
448  const RGBColor color = setLaneColor(s);
449  // get flag for draw lane as railwy
450  const bool drawRailway = drawAsRailway(s);
451  // we draw the lanes with reduced width so that the lane markings below are visible (this avoids artifacts at geometry corners without having to)
452  const bool spreadSuperposed = s.spreadSuperposed && drawRailway && myParentEdge->getNBEdge()->isBidiRail();
453  // Push edge parent name
454  glPushName(myParentEdge->getGlID());
455  // Push lane name
456  glPushName(getGlID());
457  // Push layer matrix
458  glPushMatrix();
459  // translate to front (note: Special case)
461  glTranslated(0, 0, GLO_DOTTEDCONTOUR_FRONT);
462  } else {
464  }
465  // recognize full transparency and simply don't draw
466  if ((color.alpha() == 0) || ((s.scale * laneDrawingConstants.exaggeration) < s.laneMinSize)) {
467  // Pop draw matrix 1
468  glPopMatrix();
469  // Pop Lane Name
470  glPopName();
471  } else {
472  if ((s.scale * laneDrawingConstants.exaggeration) < 1.) {
473  // draw lane as line, depending of myShapeColors
474  if (myShapeColors.size() > 0) {
476  } else {
478  }
479  } else {
480  // Check if lane has to be draw as railway and if isn't being drawn for selecting
481  if (drawRailway && (!s.drawForRectangleSelection || spreadSuperposed)) {
482  // draw as railway
483  drawLaneAsRailway(s, laneDrawingConstants);
484  } else {
485  // draw as box lines
487  }
488  if (laneDrawingConstants.halfWidth != laneDrawingConstants.halfWidth2 && !spreadSuperposed) {
489  // Push matrix
490  glPushMatrix();
491  // move back
492  glTranslated(0, 0, -0.1);
493  // set selected edge color
495  // draw again to show the selected edge
497  // Pop matrix
498  glPopMatrix();
499  }
500  // only draw details depending of the scale and if isn't being drawn for selecting
501  if ((s.scale >= 10) && !s.drawForRectangleSelection && !s.drawForPositionSelection) {
502  // draw markings
503  drawMarkings(s, laneDrawingConstants.exaggeration, drawRailway);
504  // draw arrows
505  drawArrows(s);
506  // Draw direction indicators
507  drawDirectionIndicators(s, laneDrawingConstants.exaggeration, drawRailway, spreadSuperposed);
508  }
509  // draw lane textures
510  drawTextures(s, laneDrawingConstants);
511  // draw start end shape points
513  // draw edge geometry points
515  }
516  // Pop layer matrix
517  glPopMatrix();
518  // Pop lane Name
519  glPopName();
520  // Pop edge Name
521  glPopName();
522  // only draw links number depending of the scale and if isn't being drawn for selecting
523  if ((s.scale >= 10) && !s.drawForRectangleSelection && !s.drawForPositionSelection) {
524  // draw link number
525  drawLinkNo(s);
526  // draw TLS link number
527  drawTLSLinkNo(s);
528  }
529  // check if dotted contours has to be drawn
530  if (!drawRailway) {
534  }
535  if (s.drawDottedContour() || (myNet->getViewNet()->getFrontAttributeCarrier() == this) ||
536  ((myNet->getViewNet()->getFrontAttributeCarrier() == myParentEdge) && (myParentEdge->getLanes().size() == 1))) {
538  }
539  }
540  // draw children
541  drawChildren(s);
542  // draw path additional elements
544  // draw path demand elements
546  // draw path generic dataelements
548  }
549 }
550 
551 
552 void
554  // draw child shapes
555  for (const auto& POILane : getChildShapes()) {
556  POILane->drawGL(s);
557  }
558  // draw child additional
559  for (const auto& additional : getChildAdditionals()) {
560  if (!additional->getTagProperty().isPlacedInRTree()) {
561  // check that ParkingAreas aren't draw two times
562  additional->drawGL(s);
563  }
564  }
565  // draw child demand elements
566  for (const auto& demandElement : getChildDemandElements()) {
567  if (!demandElement->getTagProperty().isPlacedInRTree()) {
568  demandElement->drawGL(s);
569  }
570  }
571 }
572 
573 
574 void
576  // draw child path additionals
577  for (const auto& tag : myPathAdditionalElements) {
578  for (const GNEAdditional* element : tag.second) {
579  element->drawLanePathChildren(s, this, 0);
580  }
581  }
582 }
583 
584 
585 void
587  // draw child path demand elements
588  for (const auto& tag : myPathDemandElements) {
589  for (const GNEDemandElement* const element : tag.second) {
590  element->drawLanePathChildren(s, this, 0);
591  }
592  }
593 }
594 
595 
596 void
598  // draw child path generic datas
599  for (const auto& tag : myPathGenericDatas) {
600  for (const GNEGenericData* element : tag.second) {
601  element->drawLanePathChildren(s, this, 0);
602  }
603  }
604 }
605 
606 
607 void
608 GNELane::drawMarkings(const GUIVisualizationSettings& s, const double exaggeration, const bool drawRailway) const {
609  if (s.laneShowBorders && (exaggeration == 1) && !drawRailway) {
610  // get half lane width
611  const double myHalfLaneWidth = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
612  const int lefthand = s.lefthand ? -1 : 1;
613  // push matrix
614  glPushMatrix();
615  // move top
616  glTranslated(0, 0, 0.1);
617  // optionally draw inverse markings
619  // calculate marking witdhs
620  const double markinWidthA = (myHalfLaneWidth + SUMO_const_laneMarkWidth) * exaggeration * lefthand;
621  const double markinWidthB = (myHalfLaneWidth - SUMO_const_laneMarkWidth) * exaggeration * lefthand;
622  // iterate over lane shape
623  for (int i = 0; i < (int) myLaneGeometry.getShape().size() - 1; ++i) {
624  // push matrix
625  glPushMatrix();
626  // move to gemetry point
627  glTranslated(myLaneGeometry.getShape()[i].x(), myLaneGeometry.getShape()[i].y(), 0.1);
628  // rotate
629  glRotated(myLaneGeometry.getShapeRotations()[i], 0, 0, 1);
630  // calculate subLengths
631  for (double subLengths = 0; subLengths < myLaneGeometry.getShapeLengths()[i]; subLengths += 6) {
632  // calculate lenght
633  const double length = MIN2((double)3, myLaneGeometry.getShapeLengths()[i] - subLengths);
634  // draw rectangle
635  glBegin(GL_QUADS);
636  glVertex2d(-markinWidthA, -subLengths);
637  glVertex2d(-markinWidthA, -subLengths - length);
638  glVertex2d(-markinWidthB, -subLengths - length);
639  glVertex2d(-markinWidthB, -subLengths);
640  glEnd();
641  }
642  // pop matrix
643  glPopMatrix();
644  }
645  }
646  // pop matrix
647  glPopMatrix();
648  // push background matrix
649  glPushMatrix();
650  // move back
651  glTranslated(0, 0, -0.1);
652  // draw white boundings and white markings
654  // draw geometry
655  GNEGeometry::drawGeometry(myNet->getViewNet(), myLaneGeometry, (myHalfLaneWidth + SUMO_const_laneMarkWidth) * exaggeration);
656  // pop background matrix
657  glPopMatrix();
658  }
659 }
660 
661 
664  // first obtain edit mode (needed because certain Commands depend of current edit mode)
666  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
667  buildPopupHeader(ret, app);
669  // build copy names entry
670  if (editMode != NetworkEditMode::NETWORK_TLS) {
671  GUIDesigns::buildFXMenuCommand(ret, "Copy parent edge name to clipboard", nullptr, ret, MID_COPY_EDGE_NAME);
673  }
674  // build selection
676  if (editMode != NetworkEditMode::NETWORK_TLS) {
677  // build show parameters menu
679  // build position copy entry
680  buildPositionCopyEntry(ret, false);
681  }
682  // check if we're in supermode network
685  // build edge oeprations
686  buildEdgeOperations(parent, ret);
687  // build lane operations
688  buildLaneOperations(parent, ret);
689  // add separator
690  new FXMenuSeparator(ret);
691  // build rechable operations
692  buildRechableOperations(parent, ret);
693  } else if (editMode == NetworkEditMode::NETWORK_TLS) {
695  GUIDesigns::buildFXMenuCommand(ret, "Select state for all links from this edge:", nullptr, nullptr, 0);
696  const std::vector<std::string> names = GNEInternalLane::LinkStateNames.getStrings();
697  for (auto it : names) {
698  FXuint state = GNEInternalLane::LinkStateNames.get(it);
699  FXMenuRadio* mc = new FXMenuRadio(ret, it.c_str(), this, FXDataTarget::ID_OPTION + state);
700  mc->setSelBackColor(MFXUtils::getFXColor(GNEInternalLane::colorForLinksState(state)));
702  }
703  }
704  } else {
705  FXMenuCommand* mc = GUIDesigns::buildFXMenuCommand(ret, "Additional options available in 'Inspect Mode'", nullptr, nullptr, 0);
706  mc->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
707  }
708  // build shape positions menu
709  if (editMode != NetworkEditMode::NETWORK_TLS) {
710  new FXMenuSeparator(ret);
713  GUIDesigns::buildFXMenuCommand(ret, "Shape pos: " + toString(pos), nullptr, nullptr, 0);
714  GUIDesigns::buildFXMenuCommand(ret, "Length pos: " + toString(pos * getLaneParametricLength() / getLaneShapeLength()), nullptr, nullptr, 0);
715  GUIDesigns::buildFXMenuCommand(ret, "Height: " + toString(height), nullptr, nullptr, 0);
716  }
717  }
718  return ret;
719 }
720 
721 
722 void
723 GNELane::updateCenteringBoundary(const bool /*updateGrid*/) {
724  if (myParentEdge->getNBEdge()->getLaneStruct(myIndex).customShape.size() == 0) {
726  } else {
728  }
729 }
730 
731 
732 int
734  return myIndex;
735 }
736 
737 void
738 GNELane::setIndex(int index) {
739  myIndex = index;
741 }
742 
743 
744 double
747 }
748 
749 
750 double
752  double laneParametricLength = myParentEdge->getNBEdge()->getLoadedLength();
753  if (laneParametricLength > 0) {
754  return laneParametricLength;
755  } else {
756  throw ProcessError("Lane Parametric Length cannot be never 0");
757  }
758 }
759 
760 
761 double
763  return myLaneGeometry.getShape().length();
764 }
765 
766 
767 bool
769  return myParentEdge->getNBEdge()->getPermissions(myIndex) == vclass;
770 }
771 
772 
775  return myLane2laneConnections;
776 }
777 
778 
779 std::string
781  const NBEdge* edge = myParentEdge->getNBEdge();
782  switch (key) {
783  case SUMO_ATTR_ID:
784  return getID();
785  case SUMO_ATTR_SPEED:
786  return toString(edge->getLaneSpeed(myIndex));
787  case SUMO_ATTR_ALLOW:
789  case SUMO_ATTR_DISALLOW:
791  case SUMO_ATTR_WIDTH:
792  return toString(edge->getLaneStruct(myIndex).width);
793  case SUMO_ATTR_ENDOFFSET:
794  return toString(edge->getLaneStruct(myIndex).endOffset);
796  return toString(edge->getLaneStruct(myIndex).accelRamp);
798  return toString(edge->getLaneStruct(myIndex).customShape);
799  case GNE_ATTR_OPPOSITE:
800  return toString(edge->getLaneStruct(myIndex).oppositeID);
801  case SUMO_ATTR_INDEX:
802  return toString(myIndex);
803  case GNE_ATTR_PARENT:
804  return myParentEdge->getID();
805  case GNE_ATTR_SELECTED:
807  case GNE_ATTR_PARAMETERS:
809  default:
810  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
811  }
812 }
813 
814 std::string
816  std::string result = getAttribute(key);
817  if ((key == SUMO_ATTR_ALLOW || key == SUMO_ATTR_DISALLOW) && result.find("all") != std::string::npos) {
818  result += " " + getVehicleClassNames(SVCAll, true);
819  }
820  return result;
821 }
822 
823 
824 void
825 GNELane::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
826  switch (key) {
827  case SUMO_ATTR_ID:
828  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
829  case SUMO_ATTR_SPEED:
830  case SUMO_ATTR_ALLOW:
831  case SUMO_ATTR_DISALLOW:
832  case SUMO_ATTR_WIDTH:
833  case SUMO_ATTR_ENDOFFSET:
836  case GNE_ATTR_OPPOSITE:
837  case SUMO_ATTR_INDEX:
838  case GNE_ATTR_SELECTED:
839  case GNE_ATTR_PARAMETERS:
840  // no special handling
841  undoList->p_add(new GNEChange_Attribute(this, key, value));
842  break;
843  default:
844  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
845  }
846 }
847 
848 
849 bool
850 GNELane::isValid(SumoXMLAttr key, const std::string& value) {
851  switch (key) {
852  case SUMO_ATTR_ID:
853  case SUMO_ATTR_INDEX:
854  return false;
855  case SUMO_ATTR_SPEED:
856  return canParse<double>(value);
857  case SUMO_ATTR_ALLOW:
858  case SUMO_ATTR_DISALLOW:
859  return canParseVehicleClasses(value);
860  case SUMO_ATTR_WIDTH:
861  return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_WIDTH));
862  case SUMO_ATTR_ENDOFFSET:
863  return canParse<double>(value) && (parse<double>(value) >= 0);
865  return canParse<bool>(value);
866  case SUMO_ATTR_CUSTOMSHAPE: {
867  // A lane shape can either be empty or have more than 1 element
868  if (value.empty()) {
869  return true;
870  } else if (canParse<PositionVector>(value)) {
871  return parse<PositionVector>(value).size() > 1;
872  }
873  return false;
874  }
875  case GNE_ATTR_OPPOSITE: {
876  if (value.empty()) {
877  return true;
878  } else {
879  NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
880  if (oppEdge == nullptr || oppEdge->getLaneID(oppEdge->getNumLanes() - 1) != value) {
881  return false;
882  }
883  NBEdge* edge = myParentEdge->getNBEdge();
884  if (oppEdge->getFromNode() != edge->getToNode() || oppEdge->getToNode() != edge->getFromNode()) {
885  WRITE_WARNING("Opposite lane '" + value + "' does not connect the same nodes as edge '" + edge->getID() + "'!");
886  return false;
887  }
888  return true;
889  }
890  }
891  case GNE_ATTR_SELECTED:
892  return canParse<bool>(value);
893  case GNE_ATTR_PARAMETERS:
894  return Parameterised::areParametersValid(value);
895  default:
896  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
897  }
898 }
899 
900 
901 bool
903  switch (key) {
904  case SUMO_ATTR_ID:
905  case SUMO_ATTR_INDEX:
906  return false;
907  default:
908  return true;
909  }
910 }
911 
912 
913 const std::map<std::string, std::string>&
916 }
917 
918 
919 void
921  // get tag
922  SumoXMLTag tag = additionalElement->getTagProperty().getTag();
923  // avoid insert duplicated path element childs
924  if (std::find(myPathAdditionalElements[tag].begin(), myPathAdditionalElements[tag].end(), additionalElement) == myPathAdditionalElements[tag].end()) {
925  myPathAdditionalElements[tag].push_back(additionalElement);
926  }
927 }
928 
929 
930 void
932  // get tag
933  SumoXMLTag tag = additionalElement->getTagProperty().getTag();
934  // search and remove pathElementChild
935  auto it = std::find(myPathAdditionalElements[tag].begin(), myPathAdditionalElements[tag].end(), additionalElement);
936  if (it != myPathAdditionalElements[tag].end()) {
937  myPathAdditionalElements[tag].erase(it);
938  }
939 }
940 
941 
942 void
944  // get tag
945  SumoXMLTag tag = demandElement->getTagProperty().getTag();
946  // avoid insert duplicated path element childs
947  if (std::find(myPathDemandElements[tag].begin(), myPathDemandElements[tag].end(), demandElement) == myPathDemandElements[tag].end()) {
948  myPathDemandElements[tag].push_back(demandElement);
949  }
950 }
951 
952 
953 void
955  // get tag
956  SumoXMLTag tag = demandElement->getTagProperty().getTag();
957  // search and remove pathElementChild
958  auto it = std::find(myPathDemandElements[tag].begin(), myPathDemandElements[tag].end(), demandElement);
959  if (it != myPathDemandElements[tag].end()) {
960  myPathDemandElements[tag].erase(it);
961  }
962 }
963 
964 
965 void
967  // get tag
968  SumoXMLTag tag = genericData->getTagProperty().getTag();
969  // avoid insert duplicated path element childs
970  if (std::find(myPathGenericDatas[tag].begin(), myPathGenericDatas[tag].end(), genericData) == myPathGenericDatas[tag].end()) {
971  myPathGenericDatas[tag].push_back(genericData);
972  }
973 }
974 
975 
976 void
978  // get tag
979  SumoXMLTag tag = genericData->getTagProperty().getTag();
980  // search and remove pathElementChild
981  auto it = std::find(myPathGenericDatas[tag].begin(), myPathGenericDatas[tag].end(), genericData);
982  if (it != myPathGenericDatas[tag].end()) {
983  myPathGenericDatas[tag].erase(it);
984  }
985 }
986 
987 
988 void
990  // make a copy of myPathAdditionalElements
991  auto copyOfPathAdditionalElements = myPathAdditionalElements;
992  for (const auto& tag : copyOfPathAdditionalElements) {
993  for (const auto& additionalElement : tag.second) {
994  // note: currently additional elements don't use compute/invalidate paths
995  additionalElement->updateGeometry();
996  }
997  }
998  // make a copy of myPathDemandElements
999  auto copyOfPathDemandElements = myPathDemandElements;
1000  for (const auto& tag : copyOfPathDemandElements) {
1001  for (const auto& demandElement : tag.second) {
1002  demandElement->invalidatePath();
1003  }
1004  }
1005  // make a copy of myPathGenericDatas
1006  auto copyOfPathGenericDatas = myPathGenericDatas;
1007  for (const auto& tag : copyOfPathGenericDatas) {
1008  for (const auto& genericData : tag.second) {
1009  // note: currently generic datas don't use compute/invalidate paths
1010  genericData->updateGeometry();
1011  }
1012  }
1013 }
1014 
1015 
1016 void
1017 GNELane::setSpecialColor(const RGBColor* color, double colorValue) {
1018  mySpecialColor = color;
1019  mySpecialColorValue = colorValue;
1020 }
1021 
1022 // ===========================================================================
1023 // private
1024 // ===========================================================================
1025 
1026 void
1027 GNELane::setAttribute(SumoXMLAttr key, const std::string& value) {
1028  NBEdge* edge = myParentEdge->getNBEdge();
1029  switch (key) {
1030  case SUMO_ATTR_ID:
1031  case SUMO_ATTR_INDEX:
1032  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
1033  case SUMO_ATTR_SPEED:
1034  edge->setSpeed(myIndex, parse<double>(value));
1035  break;
1036  case SUMO_ATTR_ALLOW:
1038  break;
1039  case SUMO_ATTR_DISALLOW:
1041  break;
1042  case SUMO_ATTR_WIDTH:
1043  edge->setLaneWidth(myIndex, parse<double>(value));
1044  // update edge parent boundary
1046  break;
1047  case SUMO_ATTR_ENDOFFSET:
1048  edge->setEndOffset(myIndex, parse<double>(value));
1049  break;
1051  edge->setAcceleration(myIndex, parse<bool>(value));
1052  break;
1053  case SUMO_ATTR_CUSTOMSHAPE: {
1054  // set new shape
1055  edge->setLaneShape(myIndex, parse<PositionVector>(value));
1056  // update edge parent boundary
1058  break;
1059  }
1060  case GNE_ATTR_OPPOSITE: {
1061  if (value != "") {
1062  NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
1063  oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = getID();
1064  } else {
1065  // reset prior oppEdge if existing
1066  const std::string oldValue = myParentEdge->getNBEdge()->getLaneStruct(myIndex).oppositeID;
1067  NBEdge* oppEdge = myNet->getEdgeCont().retrieve(oldValue.substr(0, oldValue.rfind("_")));
1068  if (oppEdge != nullptr) {
1069  oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = "";
1070  }
1071  }
1073  break;
1074  }
1075  case GNE_ATTR_SELECTED:
1076  if (parse<bool>(value)) {
1078  } else {
1080  }
1081  break;
1082  case GNE_ATTR_PARAMETERS:
1084  break;
1085  default:
1086  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1087  }
1088 }
1089 
1090 
1091 void
1092 GNELane::setMoveShape(const GNEMoveResult& /*moveResult*/) {
1093  // currently unused
1094 }
1095 
1096 
1097 void
1098 GNELane::commitMoveShape(const GNEMoveResult& /*moveResult*/, GNEUndoList* /*undoList*/) {
1099  // currently unused
1100 }
1101 
1102 
1103 RGBColor
1105  // get inspected attribute carriers
1106  const auto& inspectedACs = myNet->getViewNet()->getInspectedAttributeCarriers();
1107  // declare a RGBColor variable
1108  RGBColor color;
1109  // get inspected AC
1110  const GNEAttributeCarrier* inspectedAC = inspectedACs.size() > 0 ? inspectedACs.front() : nullptr;
1111  // 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.
1112  if (inspectedAC && (inspectedAC->isAttributeCarrierSelected() == false) &&
1113  ((inspectedAC->getTagProperty().getTag() == SUMO_TAG_TRIP) || (inspectedAC->getTagProperty().getTag() == SUMO_TAG_FLOW))) {
1114  // obtain attribute "via"
1115  std::vector<std::string> viaEdges = parse<std::vector<std::string> >(inspectedAC->getAttribute(SUMO_ATTR_VIA));
1116  // iterate over viaEdges
1117  for (const auto& edge : viaEdges) {
1118  // check if parent edge is in the via edges
1119  if (myParentEdge->getID() == edge) {
1120  // set green color in GLHelper and return it
1121  color = RGBColor::GREEN;
1122  }
1123  }
1124  }
1125  if (mySpecialColor != nullptr) {
1126  // If special color is enabled, set it
1127  color = *mySpecialColor;
1128  } else if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1129  // override with special colors (unless the color scheme is based on selection)
1130  color = s.colorSettings.selectedLaneColor;
1131  } else if (myParentEdge->drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1132  // override with special colors (unless the color scheme is based on selection)
1133  color = s.colorSettings.selectedEdgeColor;
1134  } else {
1135  // Get normal lane color
1136  const GUIColorer& c = s.laneColorer;
1137  if (!setFunctionalColor(c.getActive(), color) && !setMultiColor(s, c, color)) {
1138  color = c.getScheme().getColor(getColorValue(s, c.getActive()));
1139  }
1140  }
1141  // special color for conflicted candidate edges
1143  // extra check for route frame
1145  color = s.candidateColorSettings.conflict;
1146  }
1147  }
1148  // special color for special candidate edges
1150  // extra check for route frame
1152  color = s.candidateColorSettings.special;
1153  }
1154  }
1155  // special color for candidate edges
1157  // extra check for route frame
1159  color = s.candidateColorSettings.possible;
1160  }
1161  }
1162  // special color for source candidate edges
1164  color = s.candidateColorSettings.source;
1165  }
1166  // special color for target candidate edges
1168  color = s.candidateColorSettings.target;
1169  }
1170  // special color for source candidate lanes
1171  if (mySourceCandidate) {
1172  color = s.candidateColorSettings.source;
1173  }
1174  // special color for target candidate lanes
1175  if (myTargetCandidate) {
1176  color = s.candidateColorSettings.target;
1177  }
1178  // special color for special candidate lanes
1179  if (mySpecialCandidate) {
1180  color = s.candidateColorSettings.special;
1181  }
1182  // special color for possible candidate lanes
1183  if (myPossibleCandidate) {
1184  color = s.candidateColorSettings.possible;
1185  }
1186  // special color for conflicted candidate lanes
1187  if (myConflictedCandidate) {
1188  color = s.candidateColorSettings.conflict;
1189  }
1190  // set color in GLHelper
1191  GLHelper::setColor(color);
1192  return color;
1193 }
1194 
1195 
1196 bool
1197 GNELane::setFunctionalColor(int activeScheme, RGBColor& col) const {
1198  switch (activeScheme) {
1199  case 6: {
1200  double hue = GeomHelper::naviDegree(myLaneGeometry.getShape().beginEndAngle()); // [0-360]
1201  col = RGBColor::fromHSV(hue, 1., 1.);
1202  return true;
1203  }
1204  default:
1205  return false;
1206  }
1207 }
1208 
1209 
1210 bool
1212  const int activeScheme = c.getActive();
1213  myShapeColors.clear();
1214  switch (activeScheme) {
1215  case 9: // color by height at segment start
1216  for (PositionVector::const_iterator ii = myLaneGeometry.getShape().begin(); ii != myLaneGeometry.getShape().end() - 1; ++ii) {
1217  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
1218  }
1219  col = c.getScheme().getColor(getColorValue(s, 8));
1220  return true;
1221  case 11: // color by inclination at segment start
1222  for (int ii = 1; ii < (int)myLaneGeometry.getShape().size(); ++ii) {
1223  const double inc = (myLaneGeometry.getShape()[ii].z() - myLaneGeometry.getShape()[ii - 1].z()) / MAX2(POSITION_EPS, myLaneGeometry.getShape()[ii].distanceTo2D(myLaneGeometry.getShape()[ii - 1]));
1224  myShapeColors.push_back(c.getScheme().getColor(inc));
1225  }
1226  col = c.getScheme().getColor(getColorValue(s, 10));
1227  return true;
1228  default:
1229  return false;
1230  }
1231 }
1232 
1233 
1234 double
1235 GNELane::getColorValue(const GUIVisualizationSettings& s, int activeScheme) const {
1236  const SVCPermissions myPermissions = myParentEdge->getNBEdge()->getPermissions(myIndex);
1237  if (mySpecialColor != nullptr && mySpecialColorValue != std::numeric_limits<double>::max()) {
1238  return mySpecialColorValue;
1239  }
1240  switch (activeScheme) {
1241  case 0:
1242  switch (myPermissions) {
1243  case SVC_PEDESTRIAN:
1244  return 1;
1245  case SVC_BICYCLE:
1246  return 2;
1247  case 0:
1248  // forbidden road or green verge
1249  return myParentEdge->getNBEdge()->getPermissions() == 0 ? 10 : 3;
1250  case SVC_SHIP:
1251  return 4;
1252  case SVC_AUTHORITY:
1253  return 8;
1254  default:
1255  break;
1256  }
1258  return 9;
1259  } else if (isRailway(myPermissions)) {
1260  return 5;
1261  } else if ((myPermissions & SVC_PASSENGER) != 0) {
1262  if ((myPermissions & (SVC_RAIL_CLASSES & ~SVC_RAIL_FAST)) != 0 && (myPermissions & SVC_SHIP) == 0) {
1263  return 6;
1264  } else {
1265  return 0;
1266  }
1267  } else {
1268  return 7;
1269  }
1270  case 1:
1272  case 2:
1273  return (double)myPermissions;
1274  case 3:
1276  case 4:
1277  return myParentEdge->getNBEdge()->getNumLanes();
1278  case 5: {
1280  }
1281  // case 6: by angle (functional)
1282  case 7: {
1283  return myParentEdge->getNBEdge()->getPriority();
1284  }
1285  case 8: {
1286  // color by z of first shape point
1287  return myLaneGeometry.getShape()[0].z();
1288  }
1289  // case 9: by segment height
1290  case 10: {
1291  // color by incline
1292  return (myLaneGeometry.getShape()[-1].z() - myLaneGeometry.getShape()[0].z()) / myParentEdge->getNBEdge()->getLength();
1293  }
1294  // case 11: by segment incline
1295 
1296  case 12: {
1297  // by numerical edge param value
1298  try {
1300  } catch (NumberFormatException&) {
1301  try {
1303  } catch (BoolFormatException&) {
1304  return -1;
1305  }
1306  }
1307  }
1308  case 13: {
1309  // by numerical lane param value
1310  try {
1312  } catch (NumberFormatException&) {
1313  try {
1315  } catch (BoolFormatException&) {
1316  return -1;
1317  }
1318  }
1319  }
1320  case 14: {
1321  return myParentEdge->getNBEdge()->getDistance();
1322  }
1323  case 15: {
1324  return fabs(myParentEdge->getNBEdge()->getDistance());
1325  }
1326  }
1327  return 0;
1328 }
1329 
1330 
1331 bool
1334 }
1335 
1336 
1337 bool
1339  return isWaterway(myParentEdge->getNBEdge()->getPermissions(myIndex)) && s.showRails && !s.drawForRectangleSelection; // reusing the showRails setting
1340 }
1341 
1342 
1343 void
1344 GNELane::drawDirectionIndicators(const GUIVisualizationSettings& s, double exaggeration, const bool drawAsRailway, const bool spreadSuperposed) const {
1345  // Draw direction indicators if the correspondient option is enabled
1346  if (s.showLaneDirection) {
1347  // improve visibility of superposed rail edges
1348  if (drawAsRailway) {
1349  setLaneColor(s);
1350  } else {
1351  glColor3d(0.3, 0.3, 0.3);
1352  }
1353  // get width and sideOffset
1354  const double width = MAX2(NUMERICAL_EPS, (myParentEdge->getNBEdge()->getLaneWidth(myIndex) * exaggeration * (spreadSuperposed ? 0.4 : 1)));
1355  const double sideOffset = spreadSuperposed ? width * -0.5 : 0;
1356  // push direction indicator matrix
1357  glPushMatrix();
1358  // move to front
1359  glTranslated(0, 0, 0.1);
1360  // iterate over shape
1361  for (int i = 0; i < (int) myLaneGeometry.getShape().size() - 1; ++i) {
1362  // push triangle matrix
1363  glPushMatrix();
1364  // move front
1365  glTranslated(myLaneGeometry.getShape()[i].x(), myLaneGeometry.getShape()[i].y(), 0.1);
1366  // rotate
1367  glRotated(myLaneGeometry.getShapeRotations()[i], 0, 0, 1);
1368  // calculate subwidth
1369  for (double subWidth = 0; subWidth < myLaneGeometry.getShapeLengths()[i]; subWidth += width) {
1370  // calculate lenght
1371  const double length = MIN2(width * 0.5, myLaneGeometry.getShapeLengths()[i] - subWidth);
1372  // draw tiangle
1373  glBegin(GL_TRIANGLES);
1374  glVertex2d(sideOffset, -subWidth - length);
1375  glVertex2d(sideOffset - width * 0.25, -subWidth);
1376  glVertex2d(sideOffset + width * 0.25, -subWidth);
1377  glEnd();
1378  }
1379  // pop triangle matrix
1380  glPopMatrix();
1381  }
1382  // pop direction indicator matrix
1383  glPopMatrix();
1384  }
1385 }
1386 
1387 
1388 void
1389 GNELane::drawLaneAsRailway(const GUIVisualizationSettings& s, const LaneDrawingConstants& laneDrawingConstants) const {
1390  // we draw the lanes with reduced width so that the lane markings below are visible
1391  // (this avoids artifacts at geometry corners without having to
1392  const bool spreadSuperposed = s.spreadSuperposed && drawAsRailway(s) && myParentEdge->getNBEdge()->isBidiRail();
1393  // get lane shape
1395  // get width
1396  const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex);
1397  // draw as railway: assume standard gauge of 1435mm when lane width is not set
1398  // draw foot width 150mm, assume that distance between rail feet inner sides is reduced on both sides by 39mm with regard to the gauge
1399  // assume crosstie length of 181% gauge (2600mm for standard gauge)
1400  double halfGauge = 0.5 * (width == SUMO_const_laneWidth ? 1.4350 : width) * laneDrawingConstants.exaggeration;
1401  // check if we have to modify shape
1402  if (spreadSuperposed) {
1403  shape.move2side(halfGauge * 0.8);
1404  halfGauge *= 0.4;
1405  //std::cout << "spreadSuperposed " << getID() << " old=" << myLaneGeometry.getShape() << " new=" << shape << "\n";
1406  }
1407  // calculate constant
1408  const double halfInnerFeetWidth = halfGauge - 0.039 * laneDrawingConstants.exaggeration;
1409  const double halfRailWidth = halfInnerFeetWidth + 0.15 * laneDrawingConstants.exaggeration;
1410  const double halfCrossTieWidth = halfGauge * 1.81;
1411  // Draw lane geometry
1413  // Save current color
1414  RGBColor current = GLHelper::getColor();
1415  // Draw gray on top with reduced width (the area between the two tracks)
1416  glColor3d(0.8, 0.8, 0.8);
1417  // move
1418  glTranslated(0, 0, 0.1);
1419  // draw lane geometry again
1421  // Set current color back
1422  GLHelper::setColor(current);
1423  // Draw crossties
1424  GLHelper::drawCrossTies(shape, myLaneGeometry.getShapeRotations(), myLaneGeometry.getShapeLengths(), 0.26 * laneDrawingConstants.exaggeration, 0.6 * laneDrawingConstants.exaggeration, halfCrossTieWidth, s.drawForRectangleSelection);
1425  // check if dotted contours has to be drawn
1429  }
1430  if (s.drawDottedContour() || (myNet->getViewNet()->getFrontAttributeCarrier() == this) ||
1431  ((myNet->getViewNet()->getFrontAttributeCarrier() == myParentEdge) && (myParentEdge->getLanes().size() == 1))) {
1433  }
1434 }
1435 
1436 
1437 void
1438 GNELane::drawTextures(const GUIVisualizationSettings& s, const LaneDrawingConstants& laneDrawingConstants) const {
1439  // check all conditions for drawing textures
1441  (myLaneRestrictedTexturePositions.size() > 0) &&
1442  s.drawDetail(s.detailSettings.laneTextures, laneDrawingConstants.exaggeration)) {
1443  // Declare default width of icon (3)
1444  double iconWidth = 1;
1445  // Obtain width of icon, if width of lane is different
1447  iconWidth = myParentEdge->getNBEdge()->getLaneStruct(myIndex).width / 3;
1448  }
1449  // Draw list of icons
1450  for (int i = 0; i < (int)myLaneRestrictedTexturePositions.size(); i++) {
1451  // Push draw matrix 2
1452  glPushMatrix();
1453  // Set white color
1454  glColor3d(1, 1, 1);
1455  // Traslate matrix 2
1456  glTranslated(myLaneRestrictedTexturePositions.at(i).x(), myLaneRestrictedTexturePositions.at(i).y(), 0.1);
1457  // Rotate matrix 2
1458  glRotated(myLaneRestrictedTextureRotations.at(i), 0, 0, -1);
1459  glRotated(90, 0, 0, 1);
1460  // draw texture box depending of type of restriction
1463  } else if (isRestricted(SVC_BICYCLE)) {
1465  } else if (isRestricted(SVC_BUS)) {
1467  }
1468  // Pop draw matrix 2
1469  glPopMatrix();
1470  }
1471  }
1472 }
1473 
1474 
1475 void
1477  // draw a Start/endPoints if lane has a custom shape
1479  GLHelper::setColor(s.junctionColorer.getSchemes()[0].getColor(2));
1480  if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1481  // override with special colors (unless the color scheme is based on selection)
1483  }
1484  // obtain circle width and resolution
1485  double circleWidth = GNEEdge::SNAP_RADIUS * MIN2((double)1, s.laneWidthExaggeration) / 2;
1486  // Obtain exaggeration of the draw
1487  const double exaggeration = s.addSize.getExaggeration(s, this);
1488  // obtain custom shape
1490  // draw s depending of detail
1491  if (s.drawDetail(s.detailSettings.geometryPointsText, exaggeration)) {
1492  // push start matrix
1493  glPushMatrix();
1494  // move to shape start position
1495  glTranslated(customShape.front().x(), customShape.front().y(), 0.1);
1496  // draw circle
1498  // check if we can draw "S"
1499  if (!s.drawForPositionSelection) {
1500  // move top
1501  glTranslated(0, 0, 0.1);
1502  // draw "S"
1503  GLHelper::drawText("S", Position(), 0.1, circleWidth, RGBColor::WHITE);
1504  }
1505  // pop start matrix
1506  glPopMatrix();
1507  }
1508  // draw line between junction and start position
1509  glPushMatrix();
1510  // move top
1511  glTranslated(0, 0, 0.1);
1512  // set line width
1513  glLineWidth(4);
1514  // draw line
1515  GLHelper::drawLine(customShape.front(), myParentEdge->getParentJunctions().front()->getPositionInView());
1516  // pop line matrix
1517  glPopMatrix();
1518  // draw "e" depending of detail
1519  if (s.drawDetail(s.detailSettings.geometryPointsText, exaggeration)) {
1520  // push start matrix
1521  glPushMatrix();
1522  // move to end position
1523  glTranslated(customShape.back().x(), customShape.back().y(), 0.1);
1524  // draw filled circle
1526  // check if we can draw "E"
1527  if (!s.drawForPositionSelection) {
1528  // move top
1529  glTranslated(0, 0, 0.1);
1530  // draw "E"
1531  GLHelper::drawText("E", Position(), 0, circleWidth, RGBColor::WHITE);
1532  }
1533  // pop start matrix
1534  glPopMatrix();
1535  }
1536  // draw line between Junction and end position
1537  glPushMatrix();
1538  // move top
1539  glTranslated(0, 0, 0.1);
1540  // set line width
1541  glLineWidth(4);
1542  // draw line
1543  GLHelper::drawLine(customShape.back(), myParentEdge->getParentJunctions().back()->getPositionInView());
1544  // pop line matrix
1545  glPopMatrix();
1546  }
1547 }
1548 
1549 
1550 std::string
1552  return myParentEdge->getID();
1553 }
1554 
1555 
1556 long
1557 GNELane::onDefault(FXObject* obj, FXSelector sel, void* data) {
1558  myNet->getViewNet()->getViewParent()->getTLSEditorFrame()->handleMultiChange(this, obj, sel, data);
1559  return 1;
1560 }
1561 
1562 
1563 std::vector<GNEConnection*>
1565  // Declare a vector to save incoming connections
1566  std::vector<GNEConnection*> incomingConnections;
1567  // Obtain incoming edges if junction source was already created
1568  GNEJunction* junctionSource = myParentEdge->getParentJunctions().front();
1569  if (junctionSource) {
1570  // Iterate over incoming GNEEdges of junction
1571  for (auto i : junctionSource->getGNEIncomingEdges()) {
1572  // Iterate over connection of incoming edges
1573  for (auto j : i->getGNEConnections()) {
1574  if (j->getNBEdgeConnection().fromLane == getIndex()) {
1575  incomingConnections.push_back(j);
1576  }
1577  }
1578  }
1579  }
1580  return incomingConnections;
1581 }
1582 
1583 
1584 std::vector<GNEConnection*>
1586  // Obtain GNEConnection of parent edge
1587  const std::vector<GNEConnection*>& edgeConnections = myParentEdge->getGNEConnections();
1588  std::vector<GNEConnection*> outcomingConnections;
1589  // Obtain outgoing connections
1590  for (auto i : edgeConnections) {
1591  if (i->getNBEdgeConnection().fromLane == getIndex()) {
1592  outcomingConnections.push_back(i);
1593  }
1594  }
1595  return outcomingConnections;
1596 }
1597 
1598 
1599 void
1601  // update incoming connections of lane
1602  std::vector<GNEConnection*> incomingConnections = getGNEIncomingConnections();
1603  for (auto i : incomingConnections) {
1604  i->updateID();
1605  }
1606  // update outocming connections of lane
1607  std::vector<GNEConnection*> outcomingConnections = getGNEOutcomingConnections();
1608  for (auto i : outcomingConnections) {
1609  i->updateID();
1610  }
1611 }
1612 
1613 
1614 double
1616  // factor should not be 0
1617  if (myParentEdge->getNBEdge()->getFinalLength() > 0) {
1619  } else {
1620  return POSITION_EPS;
1621  };
1622 }
1623 
1624 
1625 void
1627  // Create basic commands
1628  std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
1629  const int edgeSelSize = (int)myNet->retrieveEdges(true).size();
1630  if (edgeSelSize && myParentEdge->isAttributeCarrierSelected() && (edgeSelSize > 1)) {
1631  edgeDescPossibleMulti = toString(edgeSelSize) + " " + toString(SUMO_TAG_EDGE) + "s";
1632  }
1633  // create menu pane for edge operations
1634  FXMenuPane* edgeOperations = new FXMenuPane(ret);
1635  ret->insertMenuPaneChild(edgeOperations);
1636  new FXMenuCascade(ret, "edge operations", nullptr, edgeOperations);
1637  // create menu commands for all edge operations
1638  GUIDesigns::buildFXMenuCommand(edgeOperations, "Split edge here", nullptr, &parent, MID_GNE_EDGE_SPLIT);
1639  GUIDesigns::buildFXMenuCommand(edgeOperations, "Split edge in both directions here", nullptr, &parent, MID_GNE_EDGE_SPLIT_BIDI);
1640  GUIDesigns::buildFXMenuCommand(edgeOperations, "Set geometry endpoint here (shift-click)", nullptr, &parent, MID_GNE_EDGE_EDIT_ENDPOINT);
1641  // restore geometry points depending of selection status
1643  if (edgeSelSize == 1) {
1644  GUIDesigns::buildFXMenuCommand(edgeOperations, "Restore both geometry endpoints", nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
1645  } else {
1646  GUIDesigns::buildFXMenuCommand(edgeOperations, "Restore geometry endpoints of all selected edges", nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
1647  }
1648  } else {
1649  GUIDesigns::buildFXMenuCommand(edgeOperations, "Restore geometry endpoint (shift-click)", nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
1650  }
1651  GUIDesigns::buildFXMenuCommand(edgeOperations, "Reverse " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_REVERSE);
1652  GUIDesigns::buildFXMenuCommand(edgeOperations, "Add reverse direction for " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE);
1653  GUIDesigns::buildFXMenuCommand(edgeOperations, "Reset lengths for " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_RESET_LENGTH);
1654  GUIDesigns::buildFXMenuCommand(edgeOperations, "Straighten " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN);
1655  GUIDesigns::buildFXMenuCommand(edgeOperations, "Smooth " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_SMOOTH);
1656  GUIDesigns::buildFXMenuCommand(edgeOperations, "Straighten elevation of " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN_ELEVATION);
1657  GUIDesigns::buildFXMenuCommand(edgeOperations, "Smooth elevation of " + edgeDescPossibleMulti, nullptr, &parent, MID_GNE_EDGE_SMOOTH_ELEVATION);
1658 }
1659 
1660 
1661 void
1663  // Get icons
1664  FXIcon* pedestrianIcon = GUIIconSubSys::getIcon(GUIIcon::LANEPEDESTRIAN);
1665  FXIcon* bikeIcon = GUIIconSubSys::getIcon(GUIIcon::LANEBIKE);
1666  FXIcon* busIcon = GUIIconSubSys::getIcon(GUIIcon::LANEBUS);
1667  FXIcon* greenVergeIcon = GUIIconSubSys::getIcon(GUIIcon::LANEGREENVERGE);
1668  // if lane is selected, calculate number of restricted lanes
1669  bool edgeHasSidewalk = false;
1670  bool edgeHasBikelane = false;
1671  bool edgeHasBuslane = false;
1672  bool edgeHasGreenVerge = false;
1673  bool differentLaneShapes = false;
1675  auto selectedLanes = myNet->retrieveLanes(true);
1676  for (auto i : selectedLanes) {
1677  if (i->myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN)) {
1678  edgeHasSidewalk = true;
1679  }
1680  if (i->myParentEdge->hasRestrictedLane(SVC_BICYCLE)) {
1681  edgeHasBikelane = true;
1682  }
1683  if (i->myParentEdge->hasRestrictedLane(SVC_BUS)) {
1684  edgeHasBuslane = true;
1685  }
1686  if (i->myParentEdge->hasRestrictedLane(SVC_IGNORING)) {
1687  edgeHasGreenVerge = true;
1688  }
1689  if (i->myParentEdge->getNBEdge()->getLaneStruct(i->getIndex()).customShape.size() != 0) {
1690  differentLaneShapes = true;
1691  }
1692  }
1693  } else {
1694  edgeHasSidewalk = myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN);
1695  edgeHasBikelane = myParentEdge->hasRestrictedLane(SVC_BICYCLE);
1696  edgeHasBuslane = myParentEdge->hasRestrictedLane(SVC_BUS);
1697  edgeHasGreenVerge = myParentEdge->hasRestrictedLane(SVC_IGNORING);
1698  differentLaneShapes = myParentEdge->getNBEdge()->getLaneStruct(myIndex).customShape.size() != 0;
1699  }
1700  // create menu pane for lane operations
1701  FXMenuPane* laneOperations = new FXMenuPane(ret);
1702  ret->insertMenuPaneChild(laneOperations);
1703  new FXMenuCascade(ret, "lane operations", nullptr, laneOperations);
1704  GUIDesigns::buildFXMenuCommand(laneOperations, "Duplicate lane", nullptr, &parent, MID_GNE_LANE_DUPLICATE);
1705  if (differentLaneShapes) {
1706  GUIDesigns::buildFXMenuCommand(laneOperations, "reset custom shape", nullptr, &parent, MID_GNE_LANE_RESET_CUSTOMSHAPE);
1707  }
1708  // Create panel for lane operations and insert it in ret
1709  FXMenuPane* addSpecialLanes = new FXMenuPane(laneOperations);
1710  ret->insertMenuPaneChild(addSpecialLanes);
1711  FXMenuPane* removeSpecialLanes = new FXMenuPane(laneOperations);
1712  ret->insertMenuPaneChild(removeSpecialLanes);
1713  FXMenuPane* transformSlanes = new FXMenuPane(laneOperations);
1714  ret->insertMenuPaneChild(transformSlanes);
1715  // Create menu comands for all add special lanes
1716  FXMenuCommand* addSidewalk = GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_ADD_SIDEWALK);
1717  FXMenuCommand* addBikelane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_ADD_BIKE);
1718  FXMenuCommand* addBuslane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Buslane", busIcon, &parent, MID_GNE_LANE_ADD_BUS);
1719  FXMenuCommand* addGreenVerge = GUIDesigns::buildFXMenuCommand(addSpecialLanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE);
1720  // Create menu comands for all remove special lanes and disable it
1721  FXMenuCommand* removeSidewalk = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_REMOVE_SIDEWALK);
1722  removeSidewalk->disable();
1723  FXMenuCommand* removeBikelane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_REMOVE_BIKE);
1724  removeBikelane->disable();
1725  FXMenuCommand* removeBuslane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, "Buslane", busIcon, &parent, MID_GNE_LANE_REMOVE_BUS);
1726  removeBuslane->disable();
1727  FXMenuCommand* removeGreenVerge = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_REMOVE_GREENVERGE);
1728  removeGreenVerge->disable();
1729  // Create menu comands for all trasform special lanes and disable it
1730  FXMenuCommand* transformLaneToSidewalk = GUIDesigns::buildFXMenuCommand(transformSlanes, "Sidewalk", pedestrianIcon, &parent, MID_GNE_LANE_TRANSFORM_SIDEWALK);
1731  FXMenuCommand* transformLaneToBikelane = GUIDesigns::buildFXMenuCommand(transformSlanes, "Bikelane", bikeIcon, &parent, MID_GNE_LANE_TRANSFORM_BIKE);
1732  FXMenuCommand* transformLaneToBuslane = GUIDesigns::buildFXMenuCommand(transformSlanes, "Buslane", busIcon, &parent, MID_GNE_LANE_TRANSFORM_BUS);
1733  FXMenuCommand* transformLaneToGreenVerge = GUIDesigns::buildFXMenuCommand(transformSlanes, "Greenverge", greenVergeIcon, &parent, MID_GNE_LANE_TRANSFORM_GREENVERGE);
1734  // add menuCascade for lane operations
1735  FXMenuCascade* cascadeAddSpecialLane = new FXMenuCascade(laneOperations, ("add restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, addSpecialLanes);
1736  FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(laneOperations, ("remove restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, removeSpecialLanes);
1737  new FXMenuCascade(laneOperations, ("transform to restricted " + toString(SUMO_TAG_LANE)).c_str(), nullptr, transformSlanes);
1738  // Enable and disable options depending of current transform of the lane
1739  if (edgeHasSidewalk) {
1740  transformLaneToSidewalk->disable();
1741  addSidewalk->disable();
1742  removeSidewalk->enable();
1743  }
1744  if (edgeHasBikelane) {
1745  transformLaneToBikelane->disable();
1746  addBikelane->disable();
1747  removeBikelane->enable();
1748  }
1749  if (edgeHasBuslane) {
1750  transformLaneToBuslane->disable();
1751  addBuslane->disable();
1752  removeBuslane->enable();
1753  }
1754  if (edgeHasGreenVerge) {
1755  transformLaneToGreenVerge->disable();
1756  addGreenVerge->disable();
1757  removeGreenVerge->enable();
1758  }
1759  // Check if cascade menus must be disabled
1760  if (edgeHasSidewalk && edgeHasBikelane && edgeHasBuslane && edgeHasGreenVerge) {
1761  cascadeAddSpecialLane->disable();
1762  }
1763  if (!edgeHasSidewalk && !edgeHasBikelane && !edgeHasBuslane && !edgeHasGreenVerge) {
1764  cascadeRemoveSpecialLane->disable();
1765  }
1766 }
1767 
1768 
1769 void
1771  // addreachability menu
1772  FXMenuPane* reachableByClass = new FXMenuPane(ret);
1773  ret->insertMenuPaneChild(reachableByClass);
1774  if (myNet->isNetRecomputed()) {
1775  new FXMenuCascade(ret, "Select reachable", GUIIconSubSys::getIcon(GUIIcon::FLAG), reachableByClass);
1776  for (const auto& vClass : SumoVehicleClassStrings.getStrings()) {
1777  GUIDesigns::buildFXMenuCommand(reachableByClass, vClass.c_str(), nullptr, &parent, MID_REACHABILITY);
1778  }
1779  } else {
1780  FXMenuCommand* menuCommand = GUIDesigns::buildFXMenuCommand(ret, "Select reachable (compute junctions)", nullptr, nullptr, 0);
1781  menuCommand->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
1782  }
1783 }
1784 
1785 
1786 void
1787 removeGeometryPoint(const Position /*clickedPosition*/, GNEUndoList* /*undoList*/) {
1788  // currently unused
1789 }
1790 
1791 /****************************************************************************/
1792 
void removeGeometryPoint(const Position, GNEUndoList *)
Definition: GNELane.cpp:1787
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_CREATE_EDGE
mode for creating new edges
@ NETWORK_TLS
mode for editing tls
@ NETWORK_CONNECT
mode for connecting lanes
@ MID_GNE_LANE_TRANSFORM_BIKE
transform lane to bikelane
Definition: GUIAppEnum.h:1053
@ MID_GNE_EDGE_REVERSE
reverse an edge
Definition: GUIAppEnum.h:969
@ MID_GNE_LANE_ADD_GREENVERGE
add greenVerge
Definition: GUIAppEnum.h:1065
@ MID_GNE_LANE_ADD_BUS
add busLane
Definition: GUIAppEnum.h:1063
@ MID_GNE_EDGE_STRAIGHTEN_ELEVATION
interpolate z values linear between junctions
Definition: GUIAppEnum.h:961
@ MID_GNE_EDGE_SMOOTH
smooth geometry
Definition: GUIAppEnum.h:959
@ MID_GNE_LANE_RESET_CUSTOMSHAPE
remove greenVerge
Definition: GUIAppEnum.h:1049
@ MID_GNE_EDGE_STRAIGHTEN
remove inner geometry
Definition: GUIAppEnum.h:957
@ MID_GNE_LANE_TRANSFORM_BUS
transform lane to busLane
Definition: GUIAppEnum.h:1055
@ MID_COPY_EDGE_NAME
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:405
@ MID_GNE_LANE_DUPLICATE
duplicate a lane
Definition: GUIAppEnum.h:1047
@ MID_GNE_LANE_REMOVE_GREENVERGE
remove greenVerge
Definition: GUIAppEnum.h:1073
@ MID_GNE_EDGE_SPLIT_BIDI
split an edge
Definition: GUIAppEnum.h:967
@ MID_GNE_LANE_REMOVE_BIKE
remove bikelane
Definition: GUIAppEnum.h:1069
@ MID_REACHABILITY
show reachability from a given lane
Definition: GUIAppEnum.h:471
@ MID_GNE_EDGE_RESET_LENGTH
reset custom lengths
Definition: GUIAppEnum.h:973
@ MID_GNE_LANE_REMOVE_BUS
remove busLane
Definition: GUIAppEnum.h:1071
@ MID_GNE_LANE_REMOVE_SIDEWALK
remove sidewalk
Definition: GUIAppEnum.h:1067
@ MID_GNE_EDGE_RESET_ENDPOINT
reset default geometry endpoints
Definition: GUIAppEnum.h:955
@ MID_GNE_EDGE_SMOOTH_ELEVATION
smooth elevation with regard to adjoining edges
Definition: GUIAppEnum.h:963
@ MID_GNE_EDGE_ADD_REVERSE
add reverse edge
Definition: GUIAppEnum.h:971
@ MID_GNE_LANE_ADD_SIDEWALK
add sidewalk
Definition: GUIAppEnum.h:1059
@ MID_GNE_LANE_TRANSFORM_SIDEWALK
transform lane to sidewalk
Definition: GUIAppEnum.h:1051
@ MID_GNE_LANE_ADD_BIKE
add bikelane
Definition: GUIAppEnum.h:1061
@ MID_GNE_EDGE_SPLIT
split an edge
Definition: GUIAppEnum.h:965
@ MID_GNE_LANE_TRANSFORM_GREENVERGE
transform lane to greenVerge
Definition: GUIAppEnum.h:1057
@ MID_GNE_EDGE_EDIT_ENDPOINT
change default geometry endpoints
Definition: GUIAppEnum.h:953
@ GLO_DOTTEDCONTOUR_FRONT
dotted contour front element (used in NETEDIT)
@ GLO_LANE
a lane
@ GLO_TEXTNAME
text element (used in NETEDIT)
@ LANEPEDESTRIAN
@ LANEGREENVERGE
@ GNETEXTURE_LANEBUS
Definition: GUITextures.h:50
@ GNETEXTURE_LANEBIKE
Definition: GUITextures.h:49
@ GNETEXTURE_LANEPEDESTRIAN
Definition: GUITextures.h:51
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:276
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
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ 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
@ 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"
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_ENDOFFSET
@ SUMO_ATTR_ACCELERATION
@ SUMO_ATTR_ID
@ SUMO_ATTR_WIDTH
const double SUMO_const_laneWidth
Definition: StdDefs.h:47
T MIN2(T a, T b)
Definition: StdDefs.h:73
const double SUMO_const_laneMarkWidth
Definition: StdDefs.h:53
T MAX2(T a, T b)
Definition: StdDefs.h:79
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
static void drawCrossTies(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double length, double spacing, double halfWidth, bool drawForRectangleSelection)
draw crossties for railroads or pedestrian crossings
Definition: GLHelper.cpp:598
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:273
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:446
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:347
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:580
static void drawOutlineCircle(double width, double iwidth, int steps=8)
Draws an unfilled circle around (0,0)
Definition: GLHelper.cpp:378
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:452
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth)
Draws a triangle at the end of the given line.
Definition: GLHelper.cpp:425
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:135
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:498
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
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 Tag Property assigned to this object
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
An Element which don't belongs to GNENet but has influency in the simulation.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNEEdge.cpp:304
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:399
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:723
static const double SNAP_RADIUS
Definition: GNEEdge.h:229
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
Definition: GNEEdge.cpp:1712
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:729
void drawEdgeGeometryPoints(const GUIVisualizationSettings &s, const GNELane *lane) const
draw edge geometry points (note: This function is called by GNELane::drawGL(...)
Definition: GNEEdge.cpp:1155
bool drawCandidateEdgesWithSpecialColor() const
draw candidate edges with special color (Only for candidates, special and conflicted)
An Element which don't belongs to GNENet but has influency in the simulation.
class for pack all variables related with DottedGeometry
Definition: GNEGeometry.h:187
void updateDottedGeometry(const GUIVisualizationSettings &s, const GNELane *lane)
update DottedGeometry (using lane shape)
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
Definition: GNEGeometry.cpp:81
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
class lane2lane connection geometry
Definition: GNEGeometry.h:412
const std::vector< GNEJunction * > & getParentJunctions() const
get parent junctions
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
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.
FOX-declaration.
Definition: GNELane.h:51
const double exaggeration
exaggeration
Definition: GNELane.h:61
LaneDrawingConstants()
default constructor
Definition: GNELane.cpp:72
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:67
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
const PositionVector & getLaneShape() const
Definition: GNELane.cpp:117
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
Definition: GNELane.cpp:1557
void drawPathAdditionalElements(const GUIVisualizationSettings &s) const
path additional elements
Definition: GNELane.cpp:575
~GNELane()
Destructor.
Definition: GNELane.cpp:107
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNELane.cpp:1551
std::string getAttribute(SumoXMLAttr key) const
Definition: GNELane.cpp:780
const GNEGeometry::DottedGeometry & getDottedLaneGeometry() const
get dotted lane geometry
Definition: GNELane.cpp:135
void removePathDemandElement(GNEDemandElement *demandElement)
remove path demand element (used by GNEPathElement)
Definition: GNELane.cpp:954
void drawLinkRules(const GUIVisualizationSettings &s) const
draw link rules
Definition: GNELane.cpp:312
std::vector< double > myLaneRestrictedTextureRotations
Rotations of textures of restricted lanes.
Definition: GNELane.h:273
const RGBColor * mySpecialColor
optional special color
Definition: GNELane.h:277
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNELane.cpp:219
void addPathGenericData(GNEGenericData *genericData)
add path demand element (used by GNEPathElement)
Definition: GNELane.cpp:966
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
Definition: GNELane.cpp:1338
GNEGeometry::DottedGeometry myDottedLaneGeometry
dotted lane geometry
Definition: GNELane.h:264
double getLengthGeometryFactor() const
get length geometry factor
Definition: GNELane.cpp:1615
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNELane.cpp:902
std::map< SumoXMLTag, std::vector< GNEDemandElement * > > myPathDemandElements
map with references to path demand elements
Definition: GNELane.h:292
void updateGeometry()
update pre-computed geometry information
Definition: GNELane.cpp:141
void invalidatePathElements()
invalidate path element childs
Definition: GNELane.cpp:989
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNELane.cpp:1092
GNEEdge * myParentEdge
parent edge (GNELanes cannot use hierarchical structures)
Definition: GNELane.h:255
const GNEGeometry::Lane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:774
std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
Definition: GNELane.cpp:815
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNELane.cpp:663
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:733
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition: GNELane.cpp:233
GNEGeometry::Lane2laneConnection myLane2laneConnections
lane2lane connections
Definition: GNELane.h:286
void drawStartEndShapePoints(const GUIVisualizationSettings &s) const
draw start and end shape points
Definition: GNELane.cpp:1476
void drawMarkings(const GUIVisualizationSettings &s, const double exaggeration, const bool drawRailway) const
draw lane markings
Definition: GNELane.cpp:608
void buildLaneOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build lane operations contextual menu
Definition: GNELane.cpp:1662
GNELane()
FOX needs this.
Definition: GNELane.cpp:96
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition: GNELane.cpp:1585
const std::vector< double > & getShapeRotations() const
get rotations of the single shape parts
Definition: GNELane.cpp:123
void drawTextures(const GUIVisualizationSettings &s, const LaneDrawingConstants &laneDrawingConstants) const
draw lane textures
Definition: GNELane.cpp:1438
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:1211
void drawLaneAsRailway(const GUIVisualizationSettings &s, const LaneDrawingConstants &laneDrawingConstants) const
draw lane as railway
Definition: GNELane.cpp:1389
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
Definition: GNELane.cpp:226
GNEGeometry::Geometry myLaneGeometry
lane geometry
Definition: GNELane.h:261
void drawTLSLinkNo(const GUIVisualizationSettings &s) const
draw TLS Link Number
Definition: GNELane.cpp:276
double getLaneParametricLength() const
returns the parameteric length of the lane
Definition: GNELane.cpp:751
RGBColor setLaneColor(const GUIVisualizationSettings &s) const
set color according to edit mode and visualisation settings
Definition: GNELane.cpp:1104
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNELane.cpp:850
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1564
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition: GNELane.cpp:1332
void removePathAdditionalElement(GNEAdditional *additionalElement)
remove path additional element (used by GNEPathElement)
Definition: GNELane.cpp:931
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
Definition: GNELane.cpp:768
void addPathDemandElement(GNEDemandElement *demandElement)
add path demand element (used by GNEPathElement)
Definition: GNELane.cpp:943
int myIndex
The index of this lane.
Definition: GNELane.h:258
void drawDirectionIndicators(const GUIVisualizationSettings &s, double exaggeration, const bool drawAsRailway, const bool spreadSuperposed) const
direction indicators for lanes
Definition: GNELane.cpp:1344
void setIndex(int index)
Definition: GNELane.cpp:738
void addPathAdditionalElement(GNEAdditional *additionalElement)
add path additional element (used by GNEPathElement)
Definition: GNELane.cpp:920
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNELane.cpp:444
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNELane.cpp:914
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition: GNELane.cpp:1017
void drawPathDemandElements(const GUIVisualizationSettings &s) const
path demand elements
Definition: GNELane.cpp:586
void drawArrows(const GUIVisualizationSettings &s) const
draw arrows
Definition: GNELane.cpp:318
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNELane.cpp:723
double mySpecialColorValue
optional value that corresponds to which the special color corresponds
Definition: GNELane.h:280
void drawChildren(const GUIVisualizationSettings &s) const
draw children
Definition: GNELane.cpp:553
std::vector< Position > myLaneRestrictedTexturePositions
Position of textures of restricted lanes.
Definition: GNELane.h:270
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNELane.cpp:1098
double getLaneShapeLength() const
returns the length of the lane's shape
Definition: GNELane.cpp:762
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GNELane.h:283
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
return value for lane coloring according to the given scheme
Definition: GNELane.cpp:1235
bool setFunctionalColor(int activeScheme, RGBColor &col) const
sets the color according to the current scheme index and some lane function
Definition: GNELane.cpp:1197
std::map< SumoXMLTag, std::vector< GNEAdditional * > > myPathAdditionalElements
map with references to path additional elements
Definition: GNELane.h:289
void updateConnectionIDs()
update IDs of incoming connections of this lane
Definition: GNELane.cpp:1600
void buildRechableOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build rechable operations contextual menu
Definition: GNELane.cpp:1770
void drawLane2LaneConnections() const
draw lane to lane connections
Definition: GNELane.cpp:396
void removePathGenericData(GNEGenericData *genericData)
remove path demand element (used by GNEPathElement)
Definition: GNELane.cpp:977
std::map< SumoXMLTag, std::vector< GNEGenericData * > > myPathGenericDatas
map with references to path generic data elements
Definition: GNELane.h:295
void buildEdgeOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build edge operations contextual menu
Definition: GNELane.cpp:1626
const std::vector< double > & getShapeLengths() const
get lengths of the single shape parts
Definition: GNELane.cpp:129
void drawLinkNo(const GUIVisualizationSettings &s) const
draw link Number
Definition: GNELane.cpp:239
void drawPathGenericDataElements(const GUIVisualizationSettings &s) const
path generic data elements
Definition: GNELane.cpp:597
double getSpeed() const
returns the current speed of lane
Definition: GNELane.cpp:745
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNELane.cpp:825
GNEEdge * getParentEdge() const
get arent edge
Definition: GNELane.cpp:111
move operation
move result
std::vector< GNELane * > retrieveLanes(bool onlySelected=false)
return all lanes
Definition: GNENet.cpp:1322
bool isNetRecomputed() const
check if net requiere recomputing
Definition: GNENet.cpp:1715
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:1249
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
Definition: GNENet.cpp:2288
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2245
const std::string & getID() const
get ID
Boundary myBoundary
object boundary
void drawLanePathChildren(const GUIVisualizationSettings &s, const GNELane *lane, const double offset) const
draw lane path child
GNEFrameModuls::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 p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:467
GNEViewParent * getViewParent() const
get the net object
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:368
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, GUIGlObjectType objectType, const double extraOffset=0)
draw front attributeCarrier
GNETLSEditorFrame * getTLSEditorFrame() const
get frame for NETWORK_TLS
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:40
The popup menu of a globject.
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
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.
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
bool drawDottedContour() const
check if dotted contour can be drawn
GUIVisualizationColorSettings colorSettings
color settings
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
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:1982
double getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:563
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3655
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:3627
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
Definition: NBEdge.h:572
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3597
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:605
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1633
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition: NBEdge.cpp:713
const std::string & getID() const
Definition: NBEdge.h:1423
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:516
NBNode * myTo
Definition: NBEdge.h:1609
double getDistance() const
Definition: NBEdge.h:634
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3491
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
Definition: NBEdge.cpp:3612
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1152
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:490
std::string getLaneID(int lane) const
get lane ID
Definition: NBEdge.cpp:3345
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
Definition: NBEdge.cpp:3619
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:497
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:324
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3552
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:1059
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:901
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1326
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:3954
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:509
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:2156
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:2078
int getConnectionIndex(const NBEdge *from, const NBEdge::Connection &con) const
return the index of the given connection
Definition: NBNode.cpp:3329
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, 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"
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:36
double x() const
Returns the x-position.
Definition: Position.h:54
double z() const
Returns the z-position.
Definition: Position.h:64
double y() const
Returns the y-position.
Definition: Position.h:59
A list of positions.
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
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:187
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition: RGBColor.h:73
static const RGBColor GREEN
Definition: RGBColor.h:181
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:300
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:145
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
static void drawDottedContourLane(const DottedContourType type, const GUIVisualizationSettings &s, const DottedGeometry &dottedGeometry, const double width, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given dottedGeometry (used by lanes, routes, etc.)
static double calculateRotation(const Position &first, const Position &second)
return angle between two points (used in geometric calculations)
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration)
draw dotted contour for the given shape (used by additionals)
static void drawGeometry(const GNEViewNet *viewNet, const Geometry &geometry, const double width)
draw geometry
static void drawLaneGeometry(const GNEViewNet *viewNet, const PositionVector &shape, const std::vector< double > &rotations, const std::vector< double > &lengths, const std::vector< RGBColor > &colors, double width)
draw lane geometry (use their own function due colors)
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
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 double laneTextures
details for lane textures
static const double geometryPointsText
details for Geometry Points Texts
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
double width
This lane's width.
Definition: NBEdge.h:166
PositionVector customShape
A custom shape for this lane set by the user.
Definition: NBEdge.h:179
double endOffset
This lane's offset to the intersection begin.
Definition: NBEdge.h:159
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:169
bool accelRamp
Whether this lane is an acceleration lane.
Definition: NBEdge.h:172
PositionVector shape
The lane's shape.
Definition: NBEdge.h:147