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.dev/sumo
3 // Copyright (C) 2001-2024 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>
37 #include <netbuild/NBEdgeCont.h>
39 #include <utils/gui/div/GLHelper.h>
47 
48 #include "GNELane.h"
49 #include "GNEInternalLane.h"
50 #include "GNEConnection.h"
51 #include "GNEEdgeTemplate.h"
52 
53 // ===========================================================================
54 // FOX callback mapping
55 // ===========================================================================
56 
57 // Object implementation
58 FXIMPLEMENT(GNELane, FXDelegator, 0, 0)
59 
60 // ===========================================================================
61 // method definitions
62 // ===========================================================================
63 
64 // ---------------------------------------------------------------------------
65 // GNELane::LaneDrawingConstants - methods
66 // ---------------------------------------------------------------------------
67 
69  myLane(lane) {
70 }
71 
72 
73 void
75  // get NBEdge
76  const auto& NBEdge = myLane->getParentEdge()->getNBEdge();
77  // get lane struct
78  const auto& laneStruct = myLane->myParentEdge->getNBEdge()->getLaneStruct(myLane->getIndex());
79  // get selection scale
81  // get lane width
82  const double laneWidth = (laneStruct.width == -1 ? SUMO_const_laneWidth : laneStruct.width);
83  // calculate exaggeration
84  myExaggeration = selectionScale * s.laneWidthExaggeration;
85  // get detail level
87  // check if draw lane as railway
88  myDrawAsRailway = isRailway(laneStruct.permissions) && ((laneStruct.permissions & SVC_BUS) == 0) && s.showRails;
89  // adjust rest of parameters depending if draw as railway
90  if (myDrawAsRailway) {
91  // draw as railway: assume standard gauge of 1435mm when lane width is not set
92  myDrawingWidth = (laneWidth == SUMO_const_laneWidth ? 1.4350 : laneWidth) * myExaggeration;
93  // calculate internal drawing width
95  } else {
96  // calculate exaggerated drawing width
97  myDrawingWidth = laneWidth * myExaggeration * 0.5;
98  // calculate internal drawing width
100  }
101  // check if draw superposed
103  // adjust parameters depending of superposing
104  if (myDrawSuperposed) {
105  // apply offset
106  myOffset = myDrawingWidth * 0.5;
107  // reduce width
108  myDrawingWidth *= 0.4;
109  myInternalDrawingWidth *= 0.4;
110  } else {
111  // restore offset
112  myOffset = 0;
113  }
114 }
115 
116 
117 double
119  return myExaggeration;
120 }
121 
122 
123 double
125  return myDrawingWidth;
126 }
127 
128 
129 double
131  return myInternalDrawingWidth;
132 }
133 
134 
135 double
137  return myOffset;
138 }
139 
140 
143  return myDetail;
144 }
145 
146 
147 bool
149  return myDrawAsRailway;
150 }
151 
152 
153 bool
155  return myDrawSuperposed;
156 }
157 
158 // ---------------------------------------------------------------------------
159 // GNELane - methods
160 // ---------------------------------------------------------------------------
161 
162 GNELane::GNELane(GNEEdge* edge, const int index) :
163  GNENetworkElement(edge->getNet(), edge->getNBEdge()->getLaneID(index), GLO_LANE, SUMO_TAG_LANE,
164  GUIIconSubSys::getIcon(GUIIcon::LANE), {}, {}, {}, {}, {}, {}),
165  myParentEdge(edge),
166  myIndex(index),
167  myDrawingConstants(new DrawingConstants(this)),
168  mySpecialColor(nullptr),
169  mySpecialColorValue(-1),
170 myLane2laneConnections(this) {
171  // update centering boundary without updating grid
172  updateCenteringBoundary(false);
173 }
174 
175 
177  GNENetworkElement(nullptr, "dummyConstructorGNELane", GLO_LANE, SUMO_TAG_LANE,
178  GUIIconSubSys::getIcon(GUIIcon::LANE), {}, {}, {}, {}, {}, {}),
179 myParentEdge(nullptr),
180 myIndex(-1),
181 myDrawingConstants(nullptr),
182 mySpecialColor(nullptr),
183 mySpecialColorValue(-1),
184 myLane2laneConnections(this) {
185 }
186 
187 
189  if (myDrawingConstants) {
190  delete myDrawingConstants;
191  }
192 }
193 
194 
195 GNEEdge*
197  return myParentEdge;
198 }
199 
200 
201 bool
204 }
205 
206 
207 const GUIGeometry&
209  return myLaneGeometry;
210 }
211 
212 
213 const PositionVector&
217  } else {
219  }
220 }
221 
222 
223 const std::vector<double>&
226 }
227 
228 
229 const std::vector<double>&
232 }
233 
234 
237  return myDrawingConstants;
238 }
239 
240 
241 void
243  // Clear texture containers
246  // get lane shape and extend if is too short
247  auto laneShape = getLaneShape();
248  if (laneShape.length2D() < 1) {
249  laneShape.extrapolate2D(1 - laneShape.length2D());
250  }
251  // Obtain lane shape of NBEdge
252  myLaneGeometry.updateGeometry(laneShape);
253  // update connections
255  // update additionals children associated with this lane
256  for (const auto& additional : getParentAdditionals()) {
257  additional->updateGeometry();
258  }
259  // update additionals parents associated with this lane
260  for (const auto& additional : getChildAdditionals()) {
261  additional->updateGeometry();
262  }
263  // update partial demand elements parents associated with this lane
264  for (const auto& demandElement : getParentDemandElements()) {
265  demandElement->updateGeometry();
266  }
267  // update partial demand elements children associated with this lane
268  for (const auto& demandElement : getChildDemandElements()) {
269  demandElement->updateGeometry();
270  }
271  // Update geometry of parent generic datas that have this edge as parent
272  for (const auto& additionalParent : getParentGenericDatas()) {
273  additionalParent->updateGeometry();
274  }
275  // Update geometry of additionals generic datas vinculated to this edge
276  for (const auto& childAdditionals : getChildGenericDatas()) {
277  childAdditionals->updateGeometry();
278  }
279  // compute geometry of path elements elements vinculated with this lane (depending of showDemandElements)
281  for (const auto& childAdditional : getChildAdditionals()) {
282  childAdditional->computePathElement();
283  }
284  for (const auto& childDemandElement : getChildDemandElements()) {
285  childDemandElement->computePathElement();
286  }
287  for (const auto& childGenericData : getChildGenericDatas()) {
288  childGenericData->computePathElement();
289  }
290  }
291  // in Move mode, connections aren't updated
293  // Update incoming connections of this lane
294  const auto incomingConnections = getGNEIncomingConnections();
295  for (const auto& connection : incomingConnections) {
296  connection->updateGeometry();
297  }
298  // Update outgoings connections of this lane
299  const auto outGoingConnections = getGNEOutcomingConnections();
300  for (const auto& connection : outGoingConnections) {
301  connection->updateGeometry();
302  }
303  }
304  // if lane has enought length for show textures of restricted lanes
305  if ((getLaneShapeLength() > 4)) {
306  // if lane is restricted
308  // get values for position and rotation of icons
309  for (int i = 2; i < getLaneShapeLength() - 1; i += 15) {
312  }
313  }
314  }
315 }
316 
317 
318 Position
320  return getLaneShape().positionAtOffset2D(getLaneShape().length2D() * 0.5);
321 }
322 
323 
324 bool
326  // get inspected ACs
327  const auto& inspectedACs = myNet->getViewNet()->getInspectedAttributeCarriers();
328  // check if we're inspecting a connection
329  if ((inspectedACs.size() == 1) && (inspectedACs.front()->getTagProperty().getTag() == SUMO_TAG_CONNECTION) &&
330  inspectedACs.front()->getAttribute(GNE_ATTR_FROM_LANEID) == getID()) {
331  return true;
332  } else {
333  return false;
334  }
335 }
336 
337 
338 bool
340  // get inspected ACs
341  const auto& inspectedACs = myNet->getViewNet()->getInspectedAttributeCarriers();
342  // check if we're inspecting a connection
343  if ((inspectedACs.size() == 1) && (inspectedACs.front()->getTagProperty().getTag() == SUMO_TAG_CONNECTION) &&
344  inspectedACs.front()->getAttribute(GNE_ATTR_TO_LANEID) == getID()) {
345  return true;
346  } else {
347  return false;
348  }
349 }
350 
351 
352 bool
354  return false;
355 }
356 
357 
358 bool
360  return false;
361 }
362 
363 
364 bool
366  // first check if we're selecting edges or lanes
367  if (myNet->getViewNet()->checkSelectEdges()) {
368  return false;
369  } else {
370  // get edit modes
371  const auto& editModes = myNet->getViewNet()->getEditModes();
372  // check if we're in delete mode
373  if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
375  } else {
376  return false;
377  }
378  }
379 }
380 
381 
382 bool
384  // first check if we're selecting edges or lanes
385  if (myNet->getViewNet()->checkSelectEdges()) {
386  return false;
387  } else {
388  // get edit modes
389  const auto& editModes = myNet->getViewNet()->getEditModes();
390  // check if we're in select mode
391  if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
393  } else {
394  return false;
395  }
396  }
397 }
398 
399 
400 bool
402  // check if we're editing this network element
404  if (editedNetworkElement) {
405  return editedNetworkElement == this;
406  } else {
407  return false;
408  }
409 }
410 
411 
414  // edit depending if shape is being edited
415  if (isShapeEdited()) {
416  // calculate move shape operation
417  return calculateMoveShapeOperation(this, getLaneShape(), false);
418  } else {
419  return nullptr;
420  }
421 }
422 
423 
424 void
425 GNELane::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
426  // edit depending if shape is being edited
427  if (isShapeEdited()) {
428  // get original shape
429  PositionVector shape = getLaneShape();
430  // check shape size
431  if (shape.size() > 2) {
432  // obtain index
433  int index = shape.indexOfClosest(clickedPosition);
434  // get snap radius
436  // check if we have to create a new index
437  if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
438  // remove geometry point
439  shape.erase(shape.begin() + index);
440  // commit new shape
441  undoList->begin(this, "remove geometry point of " + getTagStr());
443  undoList->end();
444  }
445  }
446  }
447 }
448 
449 
450 void
452  // update lane drawing constan
454  // check drawing conditions
455  if (!s.drawForViewObjectsHandler) {
456  // draw lane
457  drawLane(s);
458  // draw lock icon
460  // draw dotted contour
462  }
463  // calculate contour (always before children)
465  // draw children
466  drawChildren(s);
467 }
468 
469 
470 void
472  // Check if edge can be deleted
474  myNet->deleteLane(this, myNet->getViewNet()->getUndoList(), false);
475  }
476 }
477 
478 
479 void
481  updateGeometry();
482 }
483 
484 
485 
488  // first obtain edit mode (needed because certain Commands depend of current edit mode)
490  // get mouse position
491  const auto mousePosition = myNet->getViewNet()->getPositionInformation();
492  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
493  buildPopupHeader(ret, app);
495  // build copy names entry
496  if (editMode != NetworkEditMode::NETWORK_TLS) {
497  GUIDesigns::buildFXMenuCommand(ret, TL("Copy parent edge name to clipboard"), nullptr, ret, MID_COPY_EDGE_NAME);
499  }
500  // stop if we're in data mode
502  return ret;
503  }
504  // build lane selection
507  } else {
509  }
510  // build edge selection
513  } else {
515  }
516  // stop if we're in data mode
518  return ret;
519  }
520  // add separator
521  new FXMenuSeparator(ret);
522  if (editMode != NetworkEditMode::NETWORK_TLS) {
523  // build show parameters menu
525  // build position copy entry
526  buildPositionCopyEntry(ret, app);
527  }
528  // check if we're in supermode network
530  // create end point
531  FXMenuCommand* resetEndPoints = GUIDesigns::buildFXMenuCommand(ret, TL("Reset edge end points"), nullptr, &parent, MID_GNE_RESET_GEOMETRYPOINT);
532  // enable or disable reset end points
534  resetEndPoints->enable();
535  } else {
536  resetEndPoints->disable();
537  }
538  // check if we clicked over a geometry point
539  if ((editMode == NetworkEditMode::NETWORK_MOVE) && myParentEdge->clickedOverGeometryPoint(mousePosition)) {
540  GUIDesigns::buildFXMenuCommand(ret, TL("Set custom Geometry Point"), nullptr, &parent, MID_GNE_CUSTOM_GEOMETRYPOINT);
541  }
542  // add separator
543  new FXMenuSeparator(ret);
544  //build operations
545  if ((editMode != NetworkEditMode::NETWORK_CONNECT) && (editMode != NetworkEditMode::NETWORK_TLS)) {
546  // build edge operations
547  buildEdgeOperations(parent, ret);
548  // build lane operations
549  buildLaneOperations(parent, ret);
550  // build template operations
551  buildTemplateOperations(parent, ret);
552  // add separator
553  new FXMenuSeparator(ret);
554  // build rechable operations
555  buildRechableOperations(parent, ret);
556  } else if (editMode == NetworkEditMode::NETWORK_TLS) {
558  GUIDesigns::buildFXMenuCommand(ret, TL("Select state for all links from this edge:"), nullptr, nullptr, 0);
559  const std::vector<std::string> names = GNEInternalLane::LinkStateNames.getStrings();
560  for (auto it : names) {
561  FXuint state = GNEInternalLane::LinkStateNames.get(it);
562  FXMenuRadio* mc = new FXMenuRadio(ret, it.c_str(), this, FXDataTarget::ID_OPTION + state);
563  mc->setSelBackColor(MFXUtils::getFXColor(GNEInternalLane::colorForLinksState(state)));
565  }
566  }
567  } else {
568  FXMenuCommand* mc = GUIDesigns::buildFXMenuCommand(ret, TL("Additional options available in 'Inspect Mode'"), nullptr, nullptr, 0);
569  mc->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
570  }
571  // build shape positions menu
572  if (editMode != NetworkEditMode::NETWORK_TLS) {
573  new FXMenuSeparator(ret);
574  // get lane shape
575  const auto& laneShape = myLaneGeometry.getShape();
576  // get variables
577  const double pos = laneShape.nearest_offset_to_point2D(mousePosition);
578  const Position firstAnglePos = laneShape.positionAtOffset2D(pos - 0.001);
579  const Position secondAnglePos = laneShape.positionAtOffset2D(pos);
580  const double angle = firstAnglePos.angleTo2D(secondAnglePos);
581 
582  // build menu commands
583  GUIDesigns::buildFXMenuCommand(ret, TL("Shape pos: ") + toString(pos), nullptr, nullptr, 0);
584  GUIDesigns::buildFXMenuCommand(ret, TL("Length pos: ") + toString(pos * getLaneParametricLength() / getLaneShapeLength()), nullptr, nullptr, 0);
585  if (myParentEdge->getNBEdge()->getDistance() != 0) {
586  GUIDesigns::buildFXMenuCommand(ret, TL("Distance: ") + toString(myParentEdge->getNBEdge()->getDistancAt(pos)), nullptr, nullptr, 0);
587  }
588  GUIDesigns::buildFXMenuCommand(ret, TL("Height: ") + toString(firstAnglePos.z()), nullptr, nullptr, 0);
589  GUIDesigns::buildFXMenuCommand(ret, TL("Angle: ") + toString((GeomHelper::naviDegree(angle))), nullptr, nullptr, 0);
590  }
591  }
592  return ret;
593 }
594 
595 
596 double
598  return s.addSize.getExaggeration(s, this);
599 }
600 
601 
602 Boundary
605 }
606 
607 
608 void
609 GNELane::updateCenteringBoundary(const bool /*updateGrid*/) {
610  // nothing to update
611 }
612 
613 
614 int
616  return myIndex;
617 }
618 
619 
620 void
621 GNELane::setIndex(int index) {
622  myIndex = index;
624 }
625 
626 
627 double
630 }
631 
632 
633 double
635  double laneParametricLength = myParentEdge->getNBEdge()->getLoadedLength();
636  if (laneParametricLength > 0) {
637  return laneParametricLength;
638  } else {
639  throw ProcessError(TL("Lane Parametric Length cannot be never 0"));
640  }
641 }
642 
643 
644 double
646  return myLaneGeometry.getShape().length();
647 }
648 
649 
650 bool
652  return myParentEdge->getNBEdge()->getPermissions(myIndex) == vclass;
653 }
654 
655 
658  return myLane2laneConnections;
659 }
660 
661 
662 std::string
664  const NBEdge* edge = myParentEdge->getNBEdge();
665  switch (key) {
666  case SUMO_ATTR_ID:
667  return getMicrosimID();
669  return myParentEdge->getFromJunction()->getID();
671  return myParentEdge->getToJunction()->getID();
672  case SUMO_ATTR_SPEED:
673  return toString(edge->getLaneSpeed(myIndex));
674  case SUMO_ATTR_ALLOW:
676  case SUMO_ATTR_DISALLOW:
682  case SUMO_ATTR_WIDTH:
684  return "default";
685  } else {
686  return toString(edge->getLaneStruct(myIndex).width);
687  }
688  case SUMO_ATTR_FRICTION:
689  return toString(edge->getLaneStruct(myIndex).friction);
690  case SUMO_ATTR_ENDOFFSET:
691  return toString(edge->getLaneStruct(myIndex).endOffset);
693  return toString(edge->getLaneStruct(myIndex).accelRamp);
694  case SUMO_ATTR_SHAPE:
696  return toString(edge->getLaneStruct(myIndex).customShape);
697  case GNE_ATTR_OPPOSITE:
698  return toString(edge->getLaneStruct(myIndex).oppositeID);
699  case SUMO_ATTR_TYPE:
700  return edge->getLaneStruct(myIndex).type;
701  case SUMO_ATTR_INDEX:
702  return toString(myIndex);
703  case GNE_ATTR_STOPOFFSET:
708  } else {
709  return "";
710  }
711  case GNE_ATTR_PARENT:
712  return myParentEdge->getID();
713  case GNE_ATTR_SELECTED:
715  case GNE_ATTR_PARAMETERS:
717  default:
718  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
719  }
720 }
721 
722 
725  switch (key) {
726  case SUMO_ATTR_SHAPE:
729  default:
730  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
731  }
732 }
733 
734 
735 std::string
737  std::string result = getAttribute(key);
738  if ((key == SUMO_ATTR_ALLOW || key == SUMO_ATTR_DISALLOW) && result.find("all") != std::string::npos) {
739  result += " " + getVehicleClassNames(SVCAll, true);
740  }
741  return result;
742 }
743 
744 
745 void
746 GNELane::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
747  switch (key) {
748  case SUMO_ATTR_ID:
749  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
750  case SUMO_ATTR_SPEED:
751  case SUMO_ATTR_ALLOW:
752  case SUMO_ATTR_DISALLOW:
755  case SUMO_ATTR_WIDTH:
756  case SUMO_ATTR_FRICTION:
757  case SUMO_ATTR_ENDOFFSET:
759  case SUMO_ATTR_SHAPE:
761  case GNE_ATTR_OPPOSITE:
762  case SUMO_ATTR_TYPE:
763  case SUMO_ATTR_INDEX:
764  case GNE_ATTR_STOPOFFSET:
765  // special case for stop offset, because affects to stopOffsetExceptions (#15297)
766  if (canParse<double>(value) && (parse<double>(value) == 0)) {
768  }
769  GNEChange_Attribute::changeAttribute(this, key, value, undoList);
770  break;
772  case GNE_ATTR_SELECTED:
773  case GNE_ATTR_PARAMETERS:
774  // no special handling
775  GNEChange_Attribute::changeAttribute(this, key, value, undoList);
776  break;
777  default:
778  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
779  }
780 }
781 
782 
783 bool
784 GNELane::isValid(SumoXMLAttr key, const std::string& value) {
785  switch (key) {
786  case SUMO_ATTR_ID:
787  case SUMO_ATTR_INDEX:
788  return false;
789  case SUMO_ATTR_SPEED:
790  return canParse<double>(value);
791  case SUMO_ATTR_ALLOW:
792  case SUMO_ATTR_DISALLOW:
795  return canParseVehicleClasses(value);
796  case SUMO_ATTR_WIDTH:
797  if (value.empty() || (value == "default")) {
798  return true;
799  } else {
800  return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_WIDTH));
801  }
802  case SUMO_ATTR_FRICTION:
803  case SUMO_ATTR_ENDOFFSET:
804  return canParse<double>(value) && (parse<double>(value) >= 0);
806  return canParse<bool>(value);
807  case SUMO_ATTR_SHAPE:
809  // A lane shape can either be empty or have more than 1 element
810  if (value.empty()) {
811  return true;
812  } else if (canParse<PositionVector>(value)) {
813  return parse<PositionVector>(value).size() > 1;
814  }
815  return false;
816  case GNE_ATTR_OPPOSITE: {
817  if (value.empty()) {
818  return true;
819  } else {
820  NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
821  if (oppEdge == nullptr || oppEdge->getLaneID(oppEdge->getNumLanes() - 1) != value) {
822  return false;
823  }
824  NBEdge* edge = myParentEdge->getNBEdge();
825  if (oppEdge->getFromNode() != edge->getToNode() || oppEdge->getToNode() != edge->getFromNode()) {
826  WRITE_WARNINGF(TL("Opposite lane '%' does not connect the same nodes as edge '%'!"), value, edge->getID());
827  return false;
828  }
829  return true;
830  }
831  }
832  case SUMO_ATTR_TYPE:
833  return true;
834  case GNE_ATTR_STOPOFFSET:
835  return canParse<double>(value) && (parse<double>(value) >= 0);
837  return canParseVehicleClasses(value);
838  case GNE_ATTR_SELECTED:
839  return canParse<bool>(value);
840  case GNE_ATTR_PARAMETERS:
841  return Parameterised::areParametersValid(value);
842  default:
843  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
844  }
845 }
846 
847 
848 bool
850  switch (key) {
851  case SUMO_ATTR_ID:
852  case SUMO_ATTR_INDEX:
853  return false;
856  default:
857  return true;
858  }
859 }
860 
861 
862 bool
864  const NBEdge* edge = myParentEdge->getNBEdge();
865  switch (key) {
866  case SUMO_ATTR_WIDTH:
868  default:
869  return false;
870  }
871 }
872 
873 
874 const Parameterised::Map&
877 }
878 
879 
880 void
881 GNELane::setSpecialColor(const RGBColor* color, double colorValue) {
882  mySpecialColor = color;
883  mySpecialColorValue = colorValue;
884 }
885 
886 // ===========================================================================
887 // private
888 // ===========================================================================
889 
890 void
891 GNELane::setAttribute(SumoXMLAttr key, const std::string& value) {
892  // get parent edge
893  NBEdge* edge = myParentEdge->getNBEdge();
894  // get template editor
896  // check if we have to update template
897  const bool updateTemplate = templateEditor->getEdgeTemplate() ? (templateEditor->getEdgeTemplate()->getID() == myParentEdge->getID()) : false;
898  switch (key) {
899  case SUMO_ATTR_ID:
900  case SUMO_ATTR_INDEX:
901  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
902  case SUMO_ATTR_SPEED:
903  edge->setSpeed(myIndex, parse<double>(value));
904  break;
905  case SUMO_ATTR_ALLOW:
907  break;
908  case SUMO_ATTR_DISALLOW:
910  break;
913  break;
916  break;
917  case SUMO_ATTR_WIDTH:
918  if (value.empty() || (value == "default")) {
920  } else {
921  edge->setLaneWidth(myIndex, parse<double>(value));
922  }
923  // update edge parent boundary
925  break;
926  case SUMO_ATTR_FRICTION:
927  edge->setFriction(myIndex, parse<double>(value));
928  break;
929  case SUMO_ATTR_ENDOFFSET:
930  edge->setEndOffset(myIndex, parse<double>(value));
931  break;
933  edge->setAcceleration(myIndex, parse<bool>(value));
934  break;
935  case SUMO_ATTR_SHAPE:
937  // set new shape
938  edge->setLaneShape(myIndex, parse<PositionVector>(value));
939  // update edge parent boundary
941  break;
942  case GNE_ATTR_OPPOSITE: {
943  if (value != "") {
944  NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
945  oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = getID();
946  } else {
947  // reset prior oppEdge if existing
948  const std::string oldValue = myParentEdge->getNBEdge()->getLaneStruct(myIndex).oppositeID;
949  NBEdge* oppEdge = myNet->getEdgeCont().retrieve(oldValue.substr(0, oldValue.rfind("_")));
950  if (oppEdge != nullptr) {
951  oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = "";
952  }
953  }
955  break;
956  }
957  case SUMO_ATTR_TYPE:
958  edge->getLaneStruct(myIndex).type = value;
959  break;
960  case GNE_ATTR_STOPOFFSET:
961  if (value.empty()) {
963  } else {
964  edge->getLaneStruct(myIndex).laneStopOffset.setOffset(parse<double>(value));
965  }
966  break;
969  break;
970  case GNE_ATTR_SELECTED:
971  if (parse<bool>(value)) {
973  } else {
975  }
976  break;
977  case GNE_ATTR_PARAMETERS:
979  break;
980  default:
981  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
982  }
983  // update template
984  if (updateTemplate) {
985  templateEditor->setEdgeTemplate(myParentEdge);
986  }
987  // invalidate path calculator
989 }
990 
991 
992 void
994  // set custom shape
996  // update geometry
997  updateGeometry();
998 }
999 
1000 
1001 void
1002 GNELane::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
1003  // commit new shape
1004  undoList->begin(this, "moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
1006  undoList->end();
1007 }
1008 
1009 
1010 void
1012  // Push layer matrix
1014  // translate to front (note: Special case)
1016  glTranslated(0, 0, GLO_FRONTELEMENT);
1019  } else {
1021  }
1022  // set lane colors
1023  setLaneColor(s);
1024  // Check if lane has to be draw as railway and if isn't being drawn for selecting
1026  // draw as railway
1028  } else if (myShapeColors.size() > 0) {
1029  // draw geometry with own colors
1032  } else {
1033  // draw geometry with current color
1036  }
1037  // if lane is selected, draw a second lane over it
1038  drawSelectedLane(s);
1039  // draw start end shape points
1041  // check if draw details
1043  // draw markings
1045  // Draw direction indicators
1047  // draw lane textures
1048  drawTextures(s);
1049  // draw lane arrows
1050  drawArrows(s);
1051  // draw link numbers
1052  drawLinkNo(s);
1053  // draw TLS link numbers
1054  drawTLSLinkNo(s);
1055  // draw stopOffsets
1056  drawLaneStopOffset(s);
1057  }
1058  // draw shape edited
1059  drawShapeEdited(s);
1060  // Pop layer matrix
1062 }
1063 
1064 
1065 void
1067  // only draw if lane is selected
1068  if (drawUsingSelectColor()) {
1069  // Push matrix
1071  // move back
1072  glTranslated(0, 0, 0.1);
1073  // set selected edge color
1075  // draw geometry with current color
1078  // Pop matrix
1080  }
1081 }
1082 
1083 
1084 void
1086  // if shape is being edited, draw point and green line
1087  if (myShapeEdited) {
1088  // push shape edited matrix
1090  // translate
1092  // set selected edge color
1094  // draw shape around
1097  // move front
1098  glTranslated(0, 0, 1);
1099  // draw geometry points
1104  // Pop shape edited matrix
1106  }
1107 }
1108 
1109 
1110 void
1112  // draw additional children
1113  for (const auto& additional : getChildAdditionals()) {
1114  // check that ParkingAreas aren't draw two times
1115  additional->drawGL(s);
1116  }
1117  // draw demand element children
1118  for (const auto& demandElement : getChildDemandElements()) {
1119  if (!demandElement->getTagProperty().isPlacedInRTree()) {
1120  demandElement->drawGL(s);
1121  }
1122  }
1123  // draw path additional elements
1125 }
1126 
1127 
1128 void
1130  // check conditions
1132  // check if this is the last lane (note: First lane is the lane more far of the edge's center)
1133  const bool firstlane = (myIndex == 0);
1134  const bool lastLane = (myIndex == (myParentEdge->getNBEdge()->getNumLanes() - 1));
1135  // declare separator width
1136  const auto separatorWidth = SUMO_const_laneMarkWidth * 0.5;
1137  // get passengers change left and right for previous, current and next lane
1138  const bool changeRightTop = lastLane ? true : myParentEdge->getNBEdge()->allowsChangingRight(myIndex + 1, SVC_PASSENGER);
1139  const bool changeLeftCurrent = lastLane ? true : myParentEdge->getNBEdge()->allowsChangingLeft(myIndex, SVC_PASSENGER);
1140  const bool changeRightCurrent = firstlane ? true : myParentEdge->getNBEdge()->allowsChangingRight(myIndex, SVC_PASSENGER);
1141  const bool changeLeftBot = firstlane ? true : myParentEdge->getNBEdge()->allowsChangingLeft(myIndex - 1, SVC_PASSENGER);
1142  // save current color
1143  const auto currentColor = GLHelper::getColor();
1144  // separator offsets
1145  const double topSeparatorOffset = myDrawingConstants->getOffset() + (myDrawingConstants->getDrawingWidth() * -1) + separatorWidth;
1146  const double botSeparatorOffset = myDrawingConstants->getOffset() + myDrawingConstants->getDrawingWidth() - separatorWidth;
1147  // push matrix
1149  // translate
1150  glTranslated(0, 0, 0.1);
1151  // continue depending of lanes
1152  if (myDrawingConstants->drawSuperposed() || (firstlane && lastLane)) {
1153  // draw top and bot separator only
1155  GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, topSeparatorOffset);
1156  GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, botSeparatorOffset);
1157  } else if (firstlane) {
1158  // draw top separator
1159  GLHelper::setColor((changeLeftCurrent && changeRightTop) ? RGBColor::WHITE : RGBColor::ORANGE);
1160  GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, topSeparatorOffset);
1161  // check if draw inverse marking
1162  if (changeLeftCurrent) {
1163  GLHelper::setColor(currentColor);
1165  3, 6, topSeparatorOffset, true, true, s.lefthand, 1);
1166  }
1167  // draw bot separator
1169  GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, botSeparatorOffset);
1170  } else if (lastLane) {
1171  // draw top separator
1173  GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, topSeparatorOffset);
1174  // draw bot separator
1175  GLHelper::setColor((changeRightCurrent && changeLeftBot) ? RGBColor::WHITE : RGBColor::ORANGE);
1176  GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, botSeparatorOffset);
1177  // check if draw inverse marking
1178  if (changeRightCurrent) {
1179  GLHelper::setColor(currentColor);
1181  3, 6, botSeparatorOffset, true, true, s.lefthand, 1);
1182  }
1183  } else {
1184  // draw top separator
1185  GLHelper::setColor((changeLeftCurrent && changeRightTop) ? RGBColor::WHITE : RGBColor::ORANGE);
1186  GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, topSeparatorOffset);
1187  // check if draw inverse marking
1188  if (changeLeftCurrent) {
1189  GLHelper::setColor(currentColor);
1191  3, 6, topSeparatorOffset, true, true, s.lefthand, 1);
1192  }
1193  // draw bot separator
1194  GLHelper::setColor((changeRightCurrent && changeLeftBot) ? RGBColor::WHITE : RGBColor::ORANGE);
1195  GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, botSeparatorOffset);
1196  // check if draw inverse marking
1197  if (changeRightCurrent) {
1198  GLHelper::setColor(currentColor);
1200  3, 6, botSeparatorOffset, true, true, s.lefthand, 1);
1201  }
1202  }
1203  // pop matrix
1205  }
1206 }
1207 
1208 
1209 void
1211  // check draw conditions
1213  // get connections
1214  const auto& connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
1215  // get number of links
1216  const int noLinks = (int)connections.size();
1217  // only continue if there is links
1218  if (noLinks > 0) {
1219  // push link matrix
1221  // move front
1222  glTranslated(0, 0, GLO_TEXTNAME);
1223  // calculate width
1224  const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
1225  // get X1
1226  double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
1227  // iterate over links
1228  for (int i = noLinks - 1; i >= 0; i--) {
1229  // calculate x2
1230  const double x2 = x1 - (double)(width / 2.);
1231  // get link index
1232  const int linkIndex = myParentEdge->getNBEdge()->getToNode()->getConnectionIndex(myParentEdge->getNBEdge(),
1233  connections[s.lefthand ? noLinks - 1 - i : i]);
1234  // draw link index
1236  // update x1
1237  x1 -= width;
1238  }
1239  // pop link matrix
1241  }
1242  }
1243 }
1244 
1245 
1246 void
1248  // check conditions
1250  (myParentEdge->getToJunction()->getNBNode()->getControllingTLS().size() > 0)) {
1251  // get connections
1252  const auto& connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
1253  // get numer of links
1254  const int noLinks = (int)connections.size();
1255  // only continue if there are links
1256  if (noLinks > 0) {
1257  // push link matrix
1259  // move t front
1260  glTranslated(0, 0, GLO_TEXTNAME);
1261  // calculate width
1262  const double w = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
1263  // calculate x1
1264  double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
1265  // iterate over links
1266  for (int i = noLinks - 1; i >= 0; --i) {
1267  // calculate x2
1268  const double x2 = x1 - (double)(w / 2.);
1269  // get link number
1270  const int linkNo = connections[s.lefthand ? noLinks - 1 - i : i].tlLinkIndex;
1271  // draw link number
1273  // update x1
1274  x1 -= w;
1275  }
1276  // pop link matrix
1278  }
1279  }
1280 }
1281 
1282 
1283 void
1286  // calculate begin, end and rotation
1287  const Position& begin = myLaneGeometry.getShape()[-2];
1288  const Position& end = myLaneGeometry.getShape().back();
1289  const double rot = GUIGeometry::calculateRotation(begin, end);
1290  // push arrow matrix
1292  // move front (note: must draw on top of junction shape?
1293  glTranslated(0, 0, 3);
1294  // change color depending of spreadSuperposed
1297  } else {
1299  }
1300  // move to end
1301  glTranslated(end.x(), end.y(), 0);
1302  // rotate
1303  glRotated(rot, 0, 0, 1);
1304  const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex);
1305  if (width < SUMO_const_laneWidth) {
1307  }
1308  // apply offset
1309  glTranslated(myDrawingConstants->getOffset(), 0, 0);
1310  // get destination node
1311  const NBNode* dest = myParentEdge->getNBEdge()->myTo;
1312  // draw all links iterating over connections
1313  for (const auto& connection : myParentEdge->getNBEdge()->myConnections) {
1314  if (connection.fromLane == myIndex) {
1315  // get link direction
1316  LinkDirection dir = dest->getDirection(myParentEdge->getNBEdge(), connection.toEdge, s.lefthand);
1317  // draw depending of link direction
1318  switch (dir) {
1320  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
1321  GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25);
1322  break;
1323  case LinkDirection::LEFT:
1324  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1325  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
1326  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25);
1327  break;
1328  case LinkDirection::RIGHT:
1329  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1330  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
1331  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25);
1332  break;
1333  case LinkDirection::TURN:
1334  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1335  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
1336  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
1337  GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25);
1338  break;
1340  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1341  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
1342  GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
1343  GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25);
1344  break;
1346  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1347  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
1348  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25);
1349  break;
1351  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1352  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
1353  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25);
1354  break;
1355  case LinkDirection::NODIR:
1356  GLHelper::drawBoxLine(Position(1, 5.8), 245, 2, .05);
1357  GLHelper::drawBoxLine(Position(-1, 5.8), 115, 2, .05);
1358  glTranslated(0, 5, 0);
1359  GLHelper::drawOutlineCircle(0.9, 0.8, 32);
1360  glTranslated(0, -5, 0);
1361  break;
1362  }
1363  }
1364  }
1365  // pop arrow matrix
1367  }
1368 }
1369 
1370 
1371 void
1374  glTranslated(0, 0, 0.1); // must draw on top of junction shape
1375  std::vector<NBEdge::Connection> connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
1376  NBNode* node = myParentEdge->getNBEdge()->getToNode();
1377  const Position& startPos = myLaneGeometry.getShape()[-1];
1378  for (auto it : connections) {
1379  const LinkState state = node->getLinkState(myParentEdge->getNBEdge(), it.toEdge, it.fromLane, it.toLane, it.mayDefinitelyPass, it.tlID);
1380  switch (state) {
1382  glColor3d(1, 1, 0);
1383  break;
1385  glColor3d(0, 1, 1);
1386  break;
1387  case LINKSTATE_MAJOR:
1388  glColor3d(1, 1, 1);
1389  break;
1390  case LINKSTATE_MINOR:
1391  glColor3d(.4, .4, .4);
1392  break;
1393  case LINKSTATE_STOP:
1394  glColor3d(.7, .4, .4);
1395  break;
1396  case LINKSTATE_EQUAL:
1397  glColor3d(.7, .7, .7);
1398  break;
1399  case LINKSTATE_ALLWAY_STOP:
1400  glColor3d(.7, .7, 1);
1401  break;
1402  case LINKSTATE_ZIPPER:
1403  glColor3d(.75, .5, 0.25);
1404  break;
1405  default:
1406  throw ProcessError(TLF("Unexpected LinkState '%'", toString(state)));
1407  }
1408  const Position& endPos = it.toEdge->getLaneShape(it.toLane)[0];
1409  glBegin(GL_LINES);
1410  glVertex2d(startPos.x(), startPos.y());
1411  glVertex2d(endPos.x(), endPos.y());
1412  glEnd();
1413  GLHelper::drawTriangleAtEnd(startPos, endPos, (double) 1.5, (double) .2);
1414  }
1416 }
1417 
1418 
1419 void
1421  // first check if edge parent was inserted with full boundary
1423  // calculate contour
1426  // calculate geometry points contour if we're editing shape
1427  if (myShapeEdited) {
1430  }
1431  }
1432 }
1433 
1434 
1435 RGBColor
1437  // get inspected attribute carriers
1438  const auto& inspectedACs = myNet->getViewNet()->getInspectedAttributeCarriers();
1439  // declare a RGBColor variable
1440  RGBColor color;
1441  // get inspected AC
1442  const GNEAttributeCarrier* inspectedAC = inspectedACs.size() > 0 ? inspectedACs.front() : nullptr;
1443  // 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.
1444  if (inspectedAC && (!inspectedAC->isAttributeCarrierSelected()) &&
1445  ((inspectedAC->getTagProperty().getTag() == SUMO_TAG_TRIP) || (inspectedAC->getTagProperty().getTag() == SUMO_TAG_FLOW))) {
1446  // obtain attribute "via"
1447  std::vector<std::string> viaEdges = parse<std::vector<std::string> >(inspectedAC->getAttribute(SUMO_ATTR_VIA));
1448  // iterate over viaEdges
1449  for (const auto& edge : viaEdges) {
1450  // check if parent edge is in the via edges
1451  if (myParentEdge->getID() == edge) {
1452  // set green color in GLHelper and return it
1453  color = RGBColor::GREEN;
1454  }
1455  }
1456  }
1457  if (mySpecialColor != nullptr) {
1458  // If special color is enabled, set it
1459  color = *mySpecialColor;
1460  } else if (myParentEdge->drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1461  // override with special colors (unless the color scheme is based on selection)
1462  color = s.colorSettings.selectedEdgeColor;
1463  } else {
1464  // Get normal lane color
1465  const GUIColorer& c = s.laneColorer;
1466  if (!setFunctionalColor(c.getActive(), color) && !setMultiColor(s, c, color)) {
1467  color = c.getScheme().getColor(getColorValue(s, c.getActive()));
1468  }
1469  }
1470  // special color for conflicted candidate edges
1472  // extra check for route frame
1474  color = s.candidateColorSettings.conflict;
1475  }
1476  }
1477  // special color for special candidate edges
1479  // extra check for route frame
1481  color = s.candidateColorSettings.special;
1482  }
1483  }
1484  // special color for candidate edges
1486  // extra check for route frame
1488  color = s.candidateColorSettings.possible;
1489  }
1490  }
1491  // special color for source candidate edges
1493  color = s.candidateColorSettings.source;
1494  }
1495  // special color for target candidate edges
1497  color = s.candidateColorSettings.target;
1498  }
1499  // special color for invalid candidate edges
1501  color = s.candidateColorSettings.invalid;
1502  }
1503  // special color for source candidate lanes
1504  if (mySourceCandidate) {
1505  color = s.candidateColorSettings.source;
1506  }
1507  // special color for target candidate lanes
1508  if (myTargetCandidate) {
1509  color = s.candidateColorSettings.target;
1510  }
1511  // special color for special candidate lanes
1512  if (mySpecialCandidate) {
1513  color = s.candidateColorSettings.special;
1514  }
1515  // special color for possible candidate lanes
1516  if (myPossibleCandidate) {
1517  color = s.candidateColorSettings.possible;
1518  }
1519  // special color for conflicted candidate lanes
1520  if (myConflictedCandidate) {
1521  color = s.candidateColorSettings.conflict;
1522  }
1523  // special color for invalid candidate lanes
1524  if (myInvalidCandidate) {
1525  color = s.candidateColorSettings.invalid;
1526  }
1527  // set color in GLHelper
1528  GLHelper::setColor(color);
1529  return color;
1530 }
1531 
1532 
1533 bool
1534 GNELane::setFunctionalColor(int activeScheme, RGBColor& col) const {
1535  switch (activeScheme) {
1536  case 6: {
1537  double hue = GeomHelper::naviDegree(myLaneGeometry.getShape().beginEndAngle()); // [0-360]
1538  col = RGBColor::fromHSV(hue, 1., 1.);
1539  return true;
1540  }
1541  default:
1542  return false;
1543  }
1544 }
1545 
1546 
1547 bool
1549  const int activeScheme = c.getActive();
1550  myShapeColors.clear();
1551  switch (activeScheme) {
1552  case 9: // color by height at segment start
1553  for (PositionVector::const_iterator ii = myLaneGeometry.getShape().begin(); ii != myLaneGeometry.getShape().end() - 1; ++ii) {
1554  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
1555  }
1556  col = c.getScheme().getColor(getColorValue(s, 8));
1557  return true;
1558  case 11: // color by inclination at segment start
1559  for (int ii = 1; ii < (int)myLaneGeometry.getShape().size(); ++ii) {
1560  const double inc = (myLaneGeometry.getShape()[ii].z() - myLaneGeometry.getShape()[ii - 1].z()) / MAX2(POSITION_EPS, myLaneGeometry.getShape()[ii].distanceTo2D(myLaneGeometry.getShape()[ii - 1]));
1561  myShapeColors.push_back(c.getScheme().getColor(inc));
1562  }
1563  col = c.getScheme().getColor(getColorValue(s, 10));
1564  return true;
1565  default:
1566  return false;
1567  }
1568 }
1569 
1570 
1571 double
1572 GNELane::getColorValue(const GUIVisualizationSettings& s, int activeScheme) const {
1573  const SVCPermissions myPermissions = myParentEdge->getNBEdge()->getPermissions(myIndex);
1574  if (mySpecialColor != nullptr && mySpecialColorValue != std::numeric_limits<double>::max()) {
1575  return mySpecialColorValue;
1576  }
1577  switch (activeScheme) {
1578  case 0:
1579  switch (myPermissions) {
1580  case SVC_PEDESTRIAN:
1581  return 1;
1582  case SVC_BICYCLE:
1583  return 2;
1584  case 0:
1585  // forbidden road or green verge
1586  return myParentEdge->getNBEdge()->getPermissions() == 0 ? 10 : 3;
1587  case SVC_SHIP:
1588  return 4;
1589  case SVC_AUTHORITY:
1590  return 8;
1591  case SVC_AIRCRAFT:
1592  case SVC_DRONE:
1593  return 12;
1594  default:
1595  break;
1596  }
1598  return 9;
1599  } else if (isRailway(myPermissions)) {
1600  if ((myPermissions & SVC_BUS) != 0) {
1601  return 6;
1602  } else {
1603  return 5;
1604  }
1605  } else if ((myPermissions & SVC_PASSENGER) != 0) {
1606  if ((myPermissions & (SVC_RAIL_CLASSES & ~SVC_RAIL_FAST)) != 0 && (myPermissions & SVC_SHIP) == 0) {
1607  return 6;
1608  } else {
1609  return 0;
1610  }
1611  } else {
1612  return 7;
1613  }
1614  case 1:
1616  case 2:
1617  return (double)myPermissions;
1618  case 3:
1620  case 4:
1621  return myParentEdge->getNBEdge()->getNumLanes();
1622  case 5: {
1624  }
1625  // case 6: by angle (functional)
1626  case 7: {
1627  return myParentEdge->getNBEdge()->getPriority();
1628  }
1629  case 8: {
1630  // color by z of first shape point
1631  return myLaneGeometry.getShape()[0].z();
1632  }
1633  // case 9: by segment height
1634  case 10: {
1635  // color by incline
1636  return (myLaneGeometry.getShape()[-1].z() - myLaneGeometry.getShape()[0].z()) / myParentEdge->getNBEdge()->getLength();
1637  }
1638  // case 11: by segment incline
1639 
1640  case 12: {
1641  // by numerical edge param value
1643  try {
1645  } catch (NumberFormatException&) {
1646  try {
1648  } catch (BoolFormatException&) {
1649  return -1;
1650  }
1651  }
1652  } else {
1654  }
1655  }
1656  case 13: {
1657  // by numerical lane param value
1659  try {
1661  } catch (NumberFormatException&) {
1662  try {
1664  } catch (BoolFormatException&) {
1665  return -1;
1666  }
1667  }
1668  } else {
1670  }
1671  }
1672  case 14: {
1673  return myParentEdge->getNBEdge()->getDistance();
1674  }
1675  case 15: {
1676  return fabs(myParentEdge->getNBEdge()->getDistance());
1677  }
1678  }
1679  return 0;
1680 }
1681 
1682 
1683 void
1684 GNELane::drawOverlappedRoutes(const int numRoutes) const {
1685  // get middle point and angle
1688  // Push route matrix
1690  // translate to front
1691  glTranslated(0, 0, GLO_ROUTE + 1);
1692  // get middle
1693  GLHelper::drawText(toString(numRoutes) + " routes", center, 0, 1.8, RGBColor::BLACK, angle + 90);
1694  // pop route matrix
1696 
1697 }
1698 
1699 
1700 void
1702  const auto& laneStopOffset = myParentEdge->getNBEdge()->getLaneStruct(myIndex).laneStopOffset;
1703  // check conditions
1704  if (laneStopOffset.isDefined() && (laneStopOffset.getPermissions() & SVC_PASSENGER) != 0) {
1705  const Position& end = getLaneShape().back();
1706  const Position& f = getLaneShape()[-2];
1707  const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
1710  glTranslated(end.x(), end.y(), 1);
1711  glRotated(rot, 0, 0, 1);
1712  glTranslated(0, laneStopOffset.getOffset(), 0);
1713  glBegin(GL_QUADS);
1714  glVertex2d(-myDrawingConstants->getDrawingWidth(), 0.0);
1715  glVertex2d(-myDrawingConstants->getDrawingWidth(), 0.2);
1716  glVertex2d(myDrawingConstants->getDrawingWidth(), 0.2);
1717  glVertex2d(myDrawingConstants->getDrawingWidth(), 0.0);
1718  glEnd();
1720  }
1721 }
1722 
1723 
1724 bool
1726  return isWaterway(myParentEdge->getNBEdge()->getPermissions(myIndex)) && s.showRails && !s.drawForRectangleSelection; // reusing the showRails setting
1727 }
1728 
1729 
1730 void
1732  // Draw direction indicators if the correspondient option is enabled
1733  if (s.showLaneDirection) {
1734  // improve visibility of superposed rail edges
1736  glColor3d(0.3, 0.3, 0.3);
1737  }
1738  // get width and sideOffset
1739  const double width = MAX2(NUMERICAL_EPS, (myDrawingConstants->getDrawingWidth() * 2 * myDrawingConstants->getExaggeration()));
1740  // push direction indicator matrix
1742  // move to front
1743  glTranslated(0, 0, 0.1);
1744  // iterate over shape
1745  for (int i = 0; i < (int) myLaneGeometry.getShape().size() - 1; ++i) {
1746  // push triangle matrix
1748  // move front
1749  glTranslated(myLaneGeometry.getShape()[i].x(), myLaneGeometry.getShape()[i].y(), 0.1);
1750  // rotate
1751  glRotated(myLaneGeometry.getShapeRotations()[i], 0, 0, 1);
1752  // calculate subwidth
1753  for (double subWidth = 0; subWidth < myLaneGeometry.getShapeLengths()[i]; subWidth += width) {
1754  // calculate length
1755  const double length = MIN2(width * 0.5, myLaneGeometry.getShapeLengths()[i] - subWidth);
1756  // draw triangle
1757  glBegin(GL_TRIANGLES);
1758  glVertex2d(-myDrawingConstants->getOffset(), -subWidth - length);
1759  glVertex2d(-myDrawingConstants->getOffset() - width * 0.25, -subWidth);
1760  glVertex2d(-myDrawingConstants->getOffset() + width * 0.25, -subWidth);
1761  glEnd();
1762  }
1763  // pop triangle matrix
1765  }
1766  // pop direction indicator matrix
1768  }
1769 }
1770 
1771 
1772 void
1774  // draw foot width 150mm, assume that distance between rail feet inner sides is reduced on both sides by 39mm with regard to the gauge
1775  // assume crosstie length of 181% gauge (2600mm for standard gauge)
1776  // first save current color (obtained from view configuration)
1777  const auto currentLaneColor = GLHelper::getColor();
1778  // Set current color
1779  GLHelper::setColor(currentLaneColor);
1780  // continue depending of detail
1782  // move
1783  glTranslated(0, 0, 0.1);
1784  // draw external crossbar
1785  const double crossbarWidth = 0.2 * myDrawingConstants->getExaggeration();
1786  // draw geometry
1790  // move
1791  glTranslated(0, 0, 0.01);
1792  // Set color gray
1793  glColor3d(0.8, 0.8, 0.8);
1794  // draw geometry
1798  // move
1799  glTranslated(0, 0, 0.01);
1800  // Set current color
1801  GLHelper::setColor(currentLaneColor);
1802  // Draw crossties
1805  myDrawingConstants->getOffset(), false);
1806  } else if (myShapeColors.size() > 0) {
1807  // draw colored box lines
1810  } else {
1811  // draw geometry with current color
1814  }
1815 }
1816 
1817 
1818 void
1820  // check all conditions for drawing textures
1821  if (!s.disableLaneIcons && (myLaneRestrictedTexturePositions.size() > 0)) {
1822  // Declare default width of icon (3)
1823  const double iconWidth = myDrawingConstants->getDrawingWidth() * 0.6;
1824  // Draw list of icons
1825  for (int i = 0; i < (int)myLaneRestrictedTexturePositions.size(); i++) {
1826  // Push draw matrix 2
1828  // Set white color
1829  glColor3d(1, 1, 1);
1830  // Translate matrix 2
1831  glTranslated(myLaneRestrictedTexturePositions.at(i).x(), myLaneRestrictedTexturePositions.at(i).y(), 0.1);
1832  // Rotate matrix 2
1833  glRotated(myLaneRestrictedTextureRotations.at(i), 0, 0, -1);
1834  glRotated(90, 0, 0, 1);
1835  // draw texture box depending of type of restriction
1838  } else if (isRestricted(SVC_BICYCLE)) {
1840  } else if (isRestricted(SVC_BUS)) {
1842  }
1843  // Pop draw matrix 2
1845  }
1846  }
1847 }
1848 
1849 
1850 void
1852  // draw a Start/endPoints if lane has a custom shape
1854  // obtain circle width and resolution
1855  const double circleWidth = GNEEdge::SNAP_RADIUS * MIN2((double)1, s.laneWidthExaggeration) / 2;
1856  // obtain custom shape
1858  // set color (override with special colors unless the color scheme is based on selection)
1859  if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1861  } else {
1862  GLHelper::setColor(s.junctionColorer.getSchemes()[0].getColor(2));
1863  }
1864  // push start matrix
1866  // move to shape start position
1867  glTranslated(customShape.front().x(), customShape.front().y(), 0.1);
1868  // draw circle
1870  // draw s depending of detail
1872  // move top
1873  glTranslated(0, 0, 0.1);
1874  // draw "S"
1875  GLHelper::drawText("S", Position(), 0.1, circleWidth, RGBColor::WHITE);
1876  }
1877  // pop start matrix
1879  // draw line between junction and start position
1881  // move top
1882  glTranslated(0, 0, 0.1);
1883  // set line width
1884  glLineWidth(4);
1885  // draw line
1887  // pop line matrix
1889  // push start matrix
1891  // move to end position
1892  glTranslated(customShape.back().x(), customShape.back().y(), 0.1);
1893  // draw filled circle
1895  // draw "e" depending of detail
1897  // move top
1898  glTranslated(0, 0, 0.1);
1899  // draw "E"
1900  GLHelper::drawText("E", Position(), 0, circleWidth, RGBColor::WHITE);
1901  }
1902  // pop start matrix
1904  // draw line between Junction and end position
1906  // move top
1907  glTranslated(0, 0, 0.1);
1908  // set line width
1909  glLineWidth(4);
1910  // draw line
1912  // pop line matrix
1914  }
1915 }
1916 
1917 
1918 std::string
1920  return myParentEdge->getID();
1921 }
1922 
1923 
1924 long
1925 GNELane::onDefault(FXObject* obj, FXSelector sel, void* data) {
1926  myNet->getViewNet()->getViewParent()->getTLSEditorFrame()->handleMultiChange(this, obj, sel, data);
1927  return 1;
1928 }
1929 
1930 
1931 std::vector<GNEConnection*>
1933  // Declare a vector to save incoming connections
1934  std::vector<GNEConnection*> incomingConnections;
1935  // Obtain incoming edges if junction source was already created
1936  GNEJunction* junctionSource = myParentEdge->getFromJunction();
1937  if (junctionSource) {
1938  // Iterate over incoming GNEEdges of junction
1939  for (const auto& incomingEdge : junctionSource->getGNEIncomingEdges()) {
1940  // Iterate over connection of incoming edges
1941  for (const auto& connection : incomingEdge->getGNEConnections()) {
1942  if (connection->getLaneTo()->getIndex() == getIndex()) {
1943  incomingConnections.push_back(connection);
1944  }
1945  }
1946  }
1947  }
1948  return incomingConnections;
1949 }
1950 
1951 
1952 std::vector<GNEConnection*>
1954  // Obtain GNEConnection of parent edge
1955  const std::vector<GNEConnection*>& edgeConnections = myParentEdge->getGNEConnections();
1956  std::vector<GNEConnection*> outcomingConnections;
1957  // Obtain outgoing connections
1958  for (const auto& connection : edgeConnections) {
1959  if (connection->getLaneFrom()->getIndex() == getIndex()) {
1960  outcomingConnections.push_back(connection);
1961  }
1962  }
1963  return outcomingConnections;
1964 }
1965 
1966 
1967 void
1969  // update incoming connections of lane
1970  std::vector<GNEConnection*> incomingConnections = getGNEIncomingConnections();
1971  for (const auto& incomingConnection : incomingConnections) {
1972  incomingConnection->updateConnectionID();
1973  }
1974  // update outcoming connections of lane
1975  std::vector<GNEConnection*> outcomingConnections = getGNEOutcomingConnections();
1976  for (const auto& outcomingConnection : outcomingConnections) {
1977  outcomingConnection->updateConnectionID();
1978  }
1979 }
1980 
1981 
1982 double
1984  // factor should not be 0
1985  if (myParentEdge->getNBEdge()->getFinalLength() > 0) {
1986  return MAX2(POSITION_EPS, (getLaneShape().length() / myParentEdge->getNBEdge()->getFinalLength()));
1987  } else {
1988  return POSITION_EPS;
1989  };
1990 }
1991 
1992 
1993 void
1995  // Create basic commands
1996  std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
1998  if (edgeSelSize && myParentEdge->isAttributeCarrierSelected() && (edgeSelSize > 1)) {
1999  edgeDescPossibleMulti = toString(edgeSelSize) + " " + toString(SUMO_TAG_EDGE) + "s";
2000  }
2001  // create menu pane for edge operations
2002  FXMenuPane* edgeOperations = new FXMenuPane(ret);
2003  ret->insertMenuPaneChild(edgeOperations);
2004  if (edgeSelSize > 0) {
2005  new FXMenuCascade(ret, TLF("Edge operations (% selected)", toString(edgeSelSize)).c_str(), nullptr, edgeOperations);
2006  } else {
2007  new FXMenuCascade(ret, TL("Edge operations"), nullptr, edgeOperations);
2008  }
2009  // create menu commands for all edge operations
2010  GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Split edge here"), nullptr, &parent, MID_GNE_EDGE_SPLIT);
2011  auto splitBothDirections = GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Split edge in both directions here (no symmetric opposite edge)"), nullptr, &parent, MID_GNE_EDGE_SPLIT_BIDI);
2012  // check if allow split edge in both directions
2013  splitBothDirections->disable();
2014  const auto oppositeEdges = myParentEdge->getOppositeEdges();
2015  if (oppositeEdges.size() == 0) {
2016  splitBothDirections->setText(TL("Split edge in both directions here (no opposite edge)"));
2017  } else {
2018  for (const auto& oppositeEdge : oppositeEdges) {
2019  // get reverse inner geometry
2020  const auto reverseGeometry = oppositeEdge->getNBEdge()->getInnerGeometry().reverse();
2021  if (reverseGeometry == myParentEdge->getNBEdge()->getInnerGeometry()) {
2022  splitBothDirections->enable();
2023  splitBothDirections->setText(TL("Split edge in both directions here"));
2024  }
2025  }
2026  }
2027  GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Set geometry endpoint here (shift-click)"), nullptr, &parent, MID_GNE_EDGE_EDIT_ENDPOINT);
2028  // restore geometry points depending of selection status
2030  if (edgeSelSize == 1) {
2031  GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Restore both geometry endpoints"), nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
2032  } else {
2033  GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Restore geometry endpoints of all selected edges"), nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
2034  }
2035  } else {
2036  GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Restore geometry endpoint (shift-click)"), nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
2037  }
2038  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Reverse %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_REVERSE);
2039  auto reverse = GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Add reverse direction for %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE);
2040  if (myParentEdge->getReverseEdge() != nullptr) {
2041  reverse->disable();
2042  }
2043  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Add reverse disconnected direction for %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE_DISCONNECTED);
2044  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Reset lengths for %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_RESET_LENGTH);
2045  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Straighten %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN);
2046  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Smooth %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_SMOOTH);
2047  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Straighten elevation of %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN_ELEVATION);
2048  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Smooth elevation of %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_SMOOTH_ELEVATION);
2049 }
2050 
2051 
2052 void
2054  // Get icons
2055  FXIcon* pedestrianIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_PEDESTRIAN);
2056  FXIcon* bikeIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_BIKE);
2057  FXIcon* busIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_BUS);
2058  FXIcon* greenVergeIcon = GUIIconSubSys::getIcon(GUIIcon::LANEGREENVERGE);
2059  // declare number of selected lanes
2060  int numSelectedLanes = 0;
2061  // if lane is selected, calculate number of restricted lanes
2062  bool edgeHasSidewalk = false;
2063  bool edgeHasBikelane = false;
2064  bool edgeHasBuslane = false;
2065  bool differentLaneShapes = false;
2067  const auto selectedLanes = myNet->getAttributeCarriers()->getSelectedLanes();
2068  // update numSelectedLanes
2069  numSelectedLanes = (int)selectedLanes.size();
2070  // iterate over selected lanes
2071  for (const auto& selectedLane : selectedLanes) {
2072  if (selectedLane->myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN)) {
2073  edgeHasSidewalk = true;
2074  }
2075  if (selectedLane->myParentEdge->hasRestrictedLane(SVC_BICYCLE)) {
2076  edgeHasBikelane = true;
2077  }
2078  if (selectedLane->myParentEdge->hasRestrictedLane(SVC_BUS)) {
2079  edgeHasBuslane = true;
2080  }
2081  if (selectedLane->myParentEdge->getNBEdge()->getLaneStruct(selectedLane->getIndex()).customShape.size() != 0) {
2082  differentLaneShapes = true;
2083  }
2084  }
2085  } else {
2086  edgeHasSidewalk = myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN);
2087  edgeHasBikelane = myParentEdge->hasRestrictedLane(SVC_BICYCLE);
2088  edgeHasBuslane = myParentEdge->hasRestrictedLane(SVC_BUS);
2089  differentLaneShapes = myParentEdge->getNBEdge()->getLaneStruct(myIndex).customShape.size() != 0;
2090  }
2091  // create menu pane for lane operations
2092  FXMenuPane* laneOperations = new FXMenuPane(ret);
2093  ret->insertMenuPaneChild(laneOperations);
2094  if (numSelectedLanes > 0) {
2095  new FXMenuCascade(ret, TLF("Lane operations (% selected)", toString(numSelectedLanes)).c_str(), nullptr, laneOperations);
2096  } else {
2097  new FXMenuCascade(ret, TL("Lane operations"), nullptr, laneOperations);
2098  }
2099  GUIDesigns::buildFXMenuCommand(laneOperations, TL("Duplicate lane"), nullptr, &parent, MID_GNE_LANE_DUPLICATE);
2100  GUIDesigns::buildFXMenuCommand(laneOperations, TL("Set custom lane shape"), nullptr, &parent, MID_GNE_LANE_EDIT_SHAPE);
2101  FXMenuCommand* resetCustomShape = GUIDesigns::buildFXMenuCommand(laneOperations, TL("Reset custom shape"), nullptr, &parent, MID_GNE_LANE_RESET_CUSTOMSHAPE);
2102  if (!differentLaneShapes) {
2103  resetCustomShape->disable();
2104  }
2105  FXMenuCommand* resetOppositeLane = GUIDesigns::buildFXMenuCommand(laneOperations, TL("Reset opposite lane"), nullptr, &parent, MID_GNE_LANE_RESET_OPPOSITELANE);
2106  if (getAttribute(GNE_ATTR_OPPOSITE).empty()) {
2107  resetOppositeLane->disable();
2108  }
2109  // Create panel for lane operations and insert it in ret
2110  FXMenuPane* addSpecialLanes = new FXMenuPane(laneOperations);
2111  ret->insertMenuPaneChild(addSpecialLanes);
2112  FXMenuPane* removeSpecialLanes = new FXMenuPane(laneOperations);
2113  ret->insertMenuPaneChild(removeSpecialLanes);
2114  FXMenuPane* transformSlanes = new FXMenuPane(laneOperations);
2115  ret->insertMenuPaneChild(transformSlanes);
2116  // Create menu comands for all add special lanes
2117  FXMenuCommand* addSidewalk = GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Sidewalk"), pedestrianIcon, &parent, MID_GNE_LANE_ADD_SIDEWALK);
2118  FXMenuCommand* addBikelane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Bike lane"), bikeIcon, &parent, MID_GNE_LANE_ADD_BIKE);
2119  FXMenuCommand* addBuslane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Bus lane"), busIcon, &parent, MID_GNE_LANE_ADD_BUS);
2120  // if parent edge is selected, always add greenverge in front
2122  GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Green verge"), greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_FRONT);
2123  } else {
2124  GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Green verge (front)"), greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_FRONT);
2125  GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Green verge (back)"), greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_BACK);
2126  }
2127  // Create menu comands for all remove special lanes and disable it
2128  FXMenuCommand* removeSidewalk = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Sidewalk"), pedestrianIcon, &parent, MID_GNE_LANE_REMOVE_SIDEWALK);
2129  removeSidewalk->disable();
2130  FXMenuCommand* removeBikelane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Bike lane"), bikeIcon, &parent, MID_GNE_LANE_REMOVE_BIKE);
2131  removeBikelane->disable();
2132  FXMenuCommand* removeBuslane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Bus lane"), busIcon, &parent, MID_GNE_LANE_REMOVE_BUS);
2133  removeBuslane->disable();
2134  FXMenuCommand* removeGreenVerge = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Green verge"), greenVergeIcon, &parent, MID_GNE_LANE_REMOVE_GREENVERGE);
2135  removeGreenVerge->disable();
2136  // Create menu comands for all transform special lanes and disable it
2137  FXMenuCommand* transformLaneToSidewalk = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Sidewalk"), pedestrianIcon, &parent, MID_GNE_LANE_TRANSFORM_SIDEWALK);
2138  FXMenuCommand* transformLaneToBikelane = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Bike lane"), bikeIcon, &parent, MID_GNE_LANE_TRANSFORM_BIKE);
2139  FXMenuCommand* transformLaneToBuslane = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Bus lane"), busIcon, &parent, MID_GNE_LANE_TRANSFORM_BUS);
2140  FXMenuCommand* transformLaneToGreenVerge = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Green verge"), greenVergeIcon, &parent, MID_GNE_LANE_TRANSFORM_GREENVERGE);
2141  // add menuCascade for lane operations
2142  new FXMenuCascade(laneOperations, TLF("Add restricted %", toString(SUMO_TAG_LANE)).c_str(), nullptr, addSpecialLanes);
2143  FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(laneOperations, TLF("Remove restricted %", toString(SUMO_TAG_LANE)).c_str(), nullptr, removeSpecialLanes);
2144  new FXMenuCascade(laneOperations, TLF("Transform to restricted %", toString(SUMO_TAG_LANE)).c_str(), nullptr, transformSlanes);
2145  // Enable and disable options depending of current transform of the lane
2146  if (edgeHasSidewalk) {
2147  transformLaneToSidewalk->disable();
2148  addSidewalk->disable();
2149  removeSidewalk->enable();
2150  }
2151  if (edgeHasBikelane) {
2152  transformLaneToBikelane->disable();
2153  addBikelane->disable();
2154  removeBikelane->enable();
2155  }
2156  if (edgeHasBuslane) {
2157  transformLaneToBuslane->disable();
2158  addBuslane->disable();
2159  removeBuslane->enable();
2160  }
2161  if (isRestricted(SVC_IGNORING)) {
2162  transformLaneToGreenVerge->disable();
2163  removeGreenVerge->enable();
2164  }
2165  // Check if cascade menu must be disabled
2166  if (!edgeHasSidewalk && !edgeHasBikelane && !edgeHasBuslane && !isRestricted(SVC_IGNORING)) {
2167  cascadeRemoveSpecialLane->disable();
2168  }
2169  // for whatever reason, sonar complains in the next line that cascadeRemoveSpecialLane may leak, but fox does the cleanup
2170 } // NOSONAR
2171 
2172 
2173 void
2175  // Create basic commands
2176  std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
2178  if ((numSelectedEdges > 0) && myParentEdge->isAttributeCarrierSelected() && (numSelectedEdges > 1)) {
2179  edgeDescPossibleMulti = toString(numSelectedEdges) + " " + toString(SUMO_TAG_EDGE) + "s";
2180  }
2181  // create menu pane for edge operations
2182  FXMenuPane* edgeOperations = new FXMenuPane(ret);
2183  ret->insertMenuPaneChild(edgeOperations);
2184  if (numSelectedEdges > 0) {
2185  new FXMenuCascade(ret, TLF("Template operations (% selected)", toString(numSelectedEdges)).c_str(), nullptr, edgeOperations);
2186  } else {
2187  new FXMenuCascade(ret, TL("Template operations"), nullptr, edgeOperations);
2188  }
2189  // create menu commands for all edge operations
2190  GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Use edge as template"), nullptr, &parent, MID_GNE_EDGE_USEASTEMPLATE);
2191  auto applyTemplate = GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Apply template"), nullptr, &parent, MID_GNE_EDGE_APPLYTEMPLATE);
2192  // check if disable apply template
2194  applyTemplate->disable();
2195  }
2196 }
2197 
2198 
2199 void
2201  // addreachability menu
2202  FXMenuPane* reachableByClass = new FXMenuPane(ret);
2203  ret->insertMenuPaneChild(reachableByClass);
2204  if (myNet->isNetRecomputed()) {
2205  new FXMenuCascade(ret, TL("Select reachable"), GUIIconSubSys::getIcon(GUIIcon::MODEVEHICLE), reachableByClass);
2206  for (const auto& vClass : SumoVehicleClassStrings.getStrings()) {
2207  GUIDesigns::buildFXMenuCommand(reachableByClass, vClass.c_str(), VClassIcons::getVClassIcon(SumoVehicleClassStrings.get(vClass)), &parent, MID_REACHABILITY);
2208  }
2209  } else {
2210  FXMenuCommand* menuCommand = GUIDesigns::buildFXMenuCommand(ret, TL("Select reachable (compute junctions)"), nullptr, nullptr, 0);
2211  menuCommand->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
2212  }
2213 }
2214 
2215 /****************************************************************************/
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_DELETE
mode for deleting network elements
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_TLS
mode for editing tls
@ NETWORK_SELECT
mode for selecting network elements
@ NETWORK_CONNECT
mode for connecting lanes
@ MID_GNE_ADDSELECT_EDGE
Add edge to selected items - menu entry.
Definition: GUIAppEnum.h:845
@ MID_GNE_LANE_EDIT_SHAPE
edit lane shape
Definition: GUIAppEnum.h:1346
@ MID_GNE_LANE_TRANSFORM_BIKE
transform lane to bikelane
Definition: GUIAppEnum.h:1354
@ MID_GNE_EDGE_REVERSE
reverse an edge
Definition: GUIAppEnum.h:1234
@ MID_ADDSELECT
Add to selected items - menu entry.
Definition: GUIAppEnum.h:485
@ MID_GNE_LANE_ADD_BUS
add busLane
Definition: GUIAppEnum.h:1364
@ MID_GNE_REMOVESELECT_EDGE
Remove edge from selected items - Menu Entry.
Definition: GUIAppEnum.h:847
@ MID_GNE_EDGE_STRAIGHTEN_ELEVATION
interpolate z values linear between junctions
Definition: GUIAppEnum.h:1226
@ MID_GNE_EDGE_SMOOTH
smooth geometry
Definition: GUIAppEnum.h:1224
@ MID_GNE_LANE_RESET_CUSTOMSHAPE
reset custom shape
Definition: GUIAppEnum.h:1348
@ MID_GNE_EDGE_STRAIGHTEN
remove inner geometry
Definition: GUIAppEnum.h:1222
@ MID_GNE_LANE_TRANSFORM_BUS
transform lane to busLane
Definition: GUIAppEnum.h:1356
@ MID_COPY_EDGE_NAME
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:459
@ MID_GNE_LANE_DUPLICATE
duplicate a lane
Definition: GUIAppEnum.h:1344
@ MID_GNE_LANE_ADD_GREENVERGE_FRONT
add greenVerge front of current lane
Definition: GUIAppEnum.h:1366
@ MID_GNE_LANE_REMOVE_GREENVERGE
remove greenVerge
Definition: GUIAppEnum.h:1376
@ MID_GNE_EDGE_ADD_REVERSE_DISCONNECTED
add reverse edge disconnected (used for for spreadtype center)
Definition: GUIAppEnum.h:1238
@ MID_GNE_EDGE_SPLIT_BIDI
split an edge
Definition: GUIAppEnum.h:1232
@ MID_GNE_LANE_REMOVE_BIKE
remove bikelane
Definition: GUIAppEnum.h:1372
@ MID_GNE_LANE_RESET_OPPOSITELANE
reset opposite lane
Definition: GUIAppEnum.h:1350
@ MID_REACHABILITY
show reachability from a given lane
Definition: GUIAppEnum.h:531
@ MID_GNE_EDGE_RESET_LENGTH
reset custom lengths
Definition: GUIAppEnum.h:1240
@ MID_GNE_LANE_REMOVE_BUS
remove busLane
Definition: GUIAppEnum.h:1374
@ MID_GNE_LANE_REMOVE_SIDEWALK
remove sidewalk
Definition: GUIAppEnum.h:1370
@ MID_GNE_EDGE_RESET_ENDPOINT
reset default geometry endpoints
Definition: GUIAppEnum.h:1220
@ MID_GNE_LANE_ADD_GREENVERGE_BACK
add greenVerge back of current lane
Definition: GUIAppEnum.h:1368
@ MID_GNE_EDGE_SMOOTH_ELEVATION
smooth elevation with regard to adjoining edges
Definition: GUIAppEnum.h:1228
@ MID_GNE_EDGE_ADD_REVERSE
add reverse edge
Definition: GUIAppEnum.h:1236
@ MID_GNE_EDGE_APPLYTEMPLATE
apply template
Definition: GUIAppEnum.h:1244
@ MID_GNE_EDGE_USEASTEMPLATE
use edge as tempalte
Definition: GUIAppEnum.h:1242
@ MID_GNE_LANE_ADD_SIDEWALK
add sidewalk
Definition: GUIAppEnum.h:1360
@ MID_GNE_RESET_GEOMETRYPOINT
reset geometry point
Definition: GUIAppEnum.h:1025
@ MID_GNE_LANE_TRANSFORM_SIDEWALK
transform lane to sidewalk
Definition: GUIAppEnum.h:1352
@ MID_GNE_LANE_ADD_BIKE
add bikelane
Definition: GUIAppEnum.h:1362
@ MID_GNE_EDGE_SPLIT
split an edge
Definition: GUIAppEnum.h:1230
@ MID_GNE_LANE_TRANSFORM_GREENVERGE
transform lane to greenVerge
Definition: GUIAppEnum.h:1358
@ MID_GNE_CUSTOM_GEOMETRYPOINT
set custom geometry point
Definition: GUIAppEnum.h:1023
@ MID_GNE_EDGE_EDIT_ENDPOINT
change default geometry endpoints
Definition: GUIAppEnum.h:1218
@ MID_REMOVESELECT
Remove from selected items - Menu Entry.
Definition: GUIAppEnum.h:487
@ GLO_ROUTE
a route
@ GLO_JUNCTION
a junction
@ GLO_FRONTELEMENT
front element (used in netedit)
@ GLO_LANE
a lane
@ GLO_TEXTNAME
text element (used in netedit)
GUIViewObjectsHandler gViewObjectsHandler
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
@ LANE_PEDESTRIAN
@ LANEGREENVERGE
#define RAD2DEG(x)
Definition: GeomHelper.h:36
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:296
#define TL(string)
Definition: MsgHandler.h:315
#define TLF(string,...)
Definition: MsgHandler.h:317
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 permissions is a railway edge.
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permissions 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.
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
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_DRONE
@ SVC_AUTHORITY
authorities vehicles
@ SVC_BUS
vehicle is a bus
@ SVC_AIRCRAFT
@ SVC_PEDESTRIAN
pedestrian
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_CONNECTION
connectioon between two lanes
@ 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_FROM_JUNCTION
@ SUMO_ATTR_SPEED
@ GNE_ATTR_STOPOFFSET
stop offset (virtual, used by edge and lanes)
@ SUMO_ATTR_VIA
@ GNE_ATTR_OPPOSITE
to busStop (used by personPlans)
@ SUMO_ATTR_TO_JUNCTION
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_CUSTOMSHAPE
whether a given shape is user-defined
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_FROM_LANEID
from lane ID (used in GNEConnection)
@ GNE_ATTR_STOPOEXCEPTION
stop exceptions (virtual, used by edge and lanes)
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_CHANGE_LEFT
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_ENDOFFSET
@ SUMO_ATTR_ACCELERATION
@ GNE_ATTR_TO_LANEID
to lane ID (used in GNEConnection)
@ SUMO_ATTR_CHANGE_RIGHT
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_ID
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_FRICTION
const double SUMO_const_laneWidth
Definition: StdDefs.h:48
T MIN2(T a, T b)
Definition: StdDefs.h:76
const double SUMO_const_laneMarkWidth
Definition: StdDefs.h:51
T MAX2(T a, T b)
Definition: StdDefs.h:82
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:438
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:654
static void drawOutlineCircle(double radius, double iRadius, int steps=8)
Draws an unfilled circle around (0,0)
Definition: GLHelper.cpp:596
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth, const double extraOffset=0)
Draws a triangle at the end of the given line.
Definition: GLHelper.cpp:629
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:838
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:660
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:295
static void drawFilledCircleDetailled(const GUIVisualizationSettings::Detail d, const double radius)
Draws a filled circle around (0,0) depending of level of detail.
Definition: GLHelper.cpp:539
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
static void drawInverseMarkings(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double maxLength, double spacing, double halfWidth, bool cl, bool cr, bool lefthand, double scale)
@bried draw the space between markings (in road color)
Definition: GLHelper.cpp:900
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:756
static void drawCrossTies(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double length, double spacing, double halfWidth, double offset, bool lessDetail)
draw crossties for railroads or pedestrian crossings
Definition: GLHelper.cpp:857
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
virtual std::string getAttribute(SumoXMLAttr key) const =0
bool myPossibleCandidate
flag to mark this element as possible candidate
bool mySpecialCandidate
flag to mark this element as special candidate
bool myInvalidCandidate
flag to mark this element as invalid candidate
bool isSpecialCandidate() const
check if this element is a special candidate
bool isPossibleCandidate() const
check if this element is a possible candidate
bool isInvalidCandidate() const
check if this element is a invalid 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
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const
calculate contour extruded (used in elements formed by a central shape)
Definition: GNEContour.cpp:88
void calculateContourAllGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double radius, const double scale, const bool calculatePosOverShape) const
calculate contour for all geometry points
Definition: GNEContour.cpp:192
void drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
drawing contour functions
Definition: GNEContour.cpp:265
Boundary getContourBoundary() const
get contour boundary
Definition: GNEContour.cpp:59
struct for saving subordinated elements (Junction->Edge->Lane->(Additional | DemandElement)
ProtectElements * getProtectElements() const
get protect elements modul
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNEEdge.cpp:639
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:77
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:753
GNEEdge * getReverseEdge() const
get reverse edge (if exist)
Definition: GNEEdge.cpp:1770
bool clickedOverGeometryPoint(const Position &pos) const
return true if user clicked over a Geometry Point
Definition: GNEEdge.cpp:592
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:82
static const double SNAP_RADIUS
Definition: GNEEdge.h:308
bool hasCustomEndPoints() const
Definition: GNEEdge.cpp:556
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
Definition: GNEEdge.cpp:2304
std::vector< GNEEdge * > getOppositeEdges() const
get opposite edges
Definition: GNEEdge.cpp:694
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:1096
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< GNEAdditional * > & getChildAdditionals() const
return child additionals
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
void setEdgeTemplate(const GNEEdge *edge)
set edge template
GNEEdgeTemplate * getEdgeTemplate() const
get edge template (to copy attributes from)
TemplateEditor * getTemplateEditor() const
get template editor
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
static const StringBijection< FXuint > LinkStateNames
long names for link states
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
bool isLogicValid()
whether this junction has a valid logic
Position getPositionInView() const
Returns position of hierarchical element in view.
NBNode * getNBNode() const
Return net build node.
class lane2lane connection geometry
FOX-declaration.
Definition: GNELane.h:52
const GNELane * myLane
lane
Definition: GNELane.h:84
double myInternalDrawingWidth
internal lane drawing width (used for drawing selected lanes)
Definition: GNELane.h:93
void update(const GUIVisualizationSettings &s)
update lane drawing constants
Definition: GNELane.cpp:74
GUIVisualizationSettings::Detail myDetail
detail level
Definition: GNELane.h:99
bool drawAsRailway() const
draw as railway
Definition: GNELane.cpp:148
bool drawSuperposed() const
draw superposed
Definition: GNELane.cpp:154
double getExaggeration() const
get exaggeration
Definition: GNELane.cpp:118
double myExaggeration
exaggeration
Definition: GNELane.h:87
double getDrawingWidth() const
get lane drawing width
Definition: GNELane.cpp:124
double getInternalDrawingWidth() const
get internal lane drawing width
Definition: GNELane.cpp:130
double myDrawingWidth
lane drawing width
Definition: GNELane.h:90
bool myDrawAsRailway
draw as railway
Definition: GNELane.h:102
double myOffset
lane offset
Definition: GNELane.h:96
double getOffset() const
get lane offset
Definition: GNELane.cpp:136
bool myDrawSuperposed
draw supersposed (reduced width so that the lane markings below are visible)
Definition: GNELane.h:105
GUIVisualizationSettings::Detail getDetail() const
get detail
Definition: GNELane.cpp:142
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNELane2laneConnection myLane2laneConnections
lane2lane connections
Definition: GNELane.h:366
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:214
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
Definition: GNELane.cpp:1925
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:657
~GNELane()
Destructor.
Definition: GNELane.cpp:188
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNELane.cpp:1919
std::string getAttribute(SumoXMLAttr key) const
Definition: GNELane.cpp:663
void drawLaneStopOffset(const GUIVisualizationSettings &s) const
draw laneStopOffset
Definition: GNELane.cpp:1701
void drawSelectedLane(const GUIVisualizationSettings &s) const
draw selected lane
Definition: GNELane.cpp:1066
bool checkDrawMoveContour() const
check if draw move contour (red)
Definition: GNELane.cpp:401
std::vector< double > myLaneRestrictedTextureRotations
Rotations of textures of restricted lanes.
Definition: GNELane.h:353
bool allowPedestrians() const
check if current lane allow pedestrians
Definition: GNELane.cpp:202
void drawMarkingsAndBoundings(const GUIVisualizationSettings &s) const
draw lane markings
Definition: GNELane.cpp:1129
const RGBColor * mySpecialColor
optional special color
Definition: GNELane.h:357
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNELane.cpp:319
bool isAttributeComputed(SumoXMLAttr key) const
Definition: GNELane.cpp:863
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
Definition: GNELane.cpp:1725
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
Definition: GNELane.cpp:365
double getLengthGeometryFactor() const
get length geometry factor
Definition: GNELane.cpp:1983
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNELane.cpp:849
void drawDirectionIndicators(const GUIVisualizationSettings &s) const
direction indicators for lanes
Definition: GNELane.cpp:1731
bool checkDrawSelectContour() const
check if draw select contour (blue)
Definition: GNELane.cpp:383
void updateGeometry()
update pre-computed geometry information
Definition: GNELane.cpp:242
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNELane.cpp:993
GNEEdge * myParentEdge
parent edge (GNELanes cannot use hierarchical structures)
Definition: GNELane.h:335
void deleteGLObject()
delete element
Definition: GNELane.cpp:471
std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
Definition: GNELane.cpp:736
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNELane.cpp:487
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:615
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNELane.cpp:597
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition: GNELane.cpp:425
GUIGeometry myLaneGeometry
lane geometry
Definition: GNELane.h:341
bool checkDrawOverContour() const
check if draw over contour (orange)
Definition: GNELane.cpp:359
void drawShapeEdited(const GUIVisualizationSettings &s) const
draw shape edited
Definition: GNELane.cpp:1085
void drawOverlappedRoutes(const int numRoutes) const
draw overlapped routes
Definition: GNELane.cpp:1684
void calculateLaneContour(const GUIVisualizationSettings &s) const
calculate contour
Definition: GNELane.cpp:1420
void updateGLObject()
update GLObject (geometry, ID, etc.)
Definition: GNELane.cpp:480
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNELane.cpp:413
void drawLane(const GUIVisualizationSettings &s) const
draw lane
Definition: GNELane.cpp:1011
void buildLaneOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build lane operations contextual menu
Definition: GNELane.cpp:2053
GNELane()
FOX needs this.
Definition: GNELane.cpp:176
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition: GNELane.cpp:1953
DrawingConstants * myDrawingConstants
LaneDrawingConstants.
Definition: GNELane.h:344
const std::vector< double > & getShapeRotations() const
get rotations of the single shape parts
Definition: GNELane.cpp:224
void buildTemplateOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build template oerations contextual menu
Definition: GNELane.cpp:2174
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:1548
void drawTLSLinkNo(const GUIVisualizationSettings &s) const
draw TLS link Number
Definition: GNELane.cpp:1247
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNELane.cpp:875
double getLaneParametricLength() const
returns the parameteric length of the lane
Definition: GNELane.cpp:634
RGBColor setLaneColor(const GUIVisualizationSettings &s) const
set color according to edit mode and visualisation settings
Definition: GNELane.cpp:1436
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNELane.cpp:784
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1932
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
Definition: GNELane.cpp:651
const DrawingConstants * getDrawingConstants() const
get lane drawing constants (previously calculated in drawGL())
Definition: GNELane.cpp:236
int myIndex
The index of this lane.
Definition: GNELane.h:338
void drawLaneAsRailway() const
draw lane as railway
Definition: GNELane.cpp:1773
void setIndex(int index)
Definition: GNELane.cpp:621
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNELane.cpp:451
bool checkDrawFromContour() const
check if draw from contour (green)
Definition: GNELane.cpp:325
void setSpecialColor(const RGBColor *Color2, double colorValue=std::numeric_limits< double >::max())
Definition: GNELane.cpp:881
const GUIGeometry & getLaneGeometry() const
get lane geometry
Definition: GNELane.cpp:208
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNELane.cpp:603
void drawArrows(const GUIVisualizationSettings &s) const
draw lane arrows
Definition: GNELane.cpp:1284
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNELane.cpp:609
double mySpecialColorValue
optional value that corresponds to which the special color corresponds
Definition: GNELane.h:360
void drawChildren(const GUIVisualizationSettings &s) const
draw children
Definition: GNELane.cpp:1111
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
Definition: GNELane.cpp:353
std::vector< Position > myLaneRestrictedTexturePositions
Position of textures of restricted lanes.
Definition: GNELane.h:350
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNELane.cpp:1002
double getLaneShapeLength() const
returns the length of the lane's shape
Definition: GNELane.cpp:645
void drawStartEndGeometryPoints(const GUIVisualizationSettings &s) const
draw start and end geometry points
Definition: GNELane.cpp:1851
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GNELane.h:363
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
return value for lane coloring according to the given scheme
Definition: GNELane.cpp:1572
bool checkDrawToContour() const
check if draw from contour (magenta)
Definition: GNELane.cpp:339
bool setFunctionalColor(int activeScheme, RGBColor &col) const
sets the color according to the current scheme index and some lane function
Definition: GNELane.cpp:1534
void updateConnectionIDs()
update IDs of incoming connections of this lane
Definition: GNELane.cpp:1968
void buildRechableOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build rechable operations contextual menu
Definition: GNELane.cpp:2200
void drawLane2LaneConnections() const
draw lane to lane connections
Definition: GNELane.cpp:1372
void buildEdgeOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build edge operations contextual menu
Definition: GNELane.cpp:1994
const std::vector< double > & getShapeLengths() const
get lengths of the single shape parts
Definition: GNELane.cpp:230
PositionVector getAttributePositionVector(SumoXMLAttr key) const
Definition: GNELane.cpp:724
void drawLinkNo(const GUIVisualizationSettings &s) const
draw link Number
Definition: GNELane.cpp:1210
double getSpeed() const
returns the current speed of lane
Definition: GNELane.cpp:628
void drawTextures(const GUIVisualizationSettings &s) const
draw lane textures
Definition: GNELane.cpp:1819
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNELane.cpp:746
GNEEdge * getParentEdge() const
get parent edge
Definition: GNELane.cpp:196
GNEMoveOperation * calculateMoveShapeOperation(const GUIGlObject *obj, const PositionVector originalShape, const bool maintainShapeClosed)
calculate move shape operation
move operation
move result
PositionVector shapeToUpdate
shape to update (edited in moveElement)
std::vector< GNELane * > getSelectedLanes() const
get selected lanes
int getNumberOfSelectedEdges() const
get number of selected edges
void deleteLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
removes lane
Definition: GNENet.cpp:581
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:123
bool isNetRecomputed() const
check if net require recomputing
Definition: GNENet.cpp:1528
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:135
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
Definition: GNENet.cpp:2148
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2136
GNEContour myNetworkElementContour
network element contour
bool myShapeEdited
flag to check if element shape is being edited
void setNetworkElementID(const std::string &newID)
set network element id
bool isShapeEdited() const
check if shape is being edited
bool drawCandidateEdgesWithSpecialColor() const
draw candidate edges with special color (Only for candidates, special and conflicted)
void invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
void drawLanePathElements(const GUIVisualizationSettings &s, const GNELane *lane) const
draw lane path elements
GNEPathCreator * getPathCreator() const
get path creator module
bool controlsEdge(GNEEdge *edge) const
whether the given edge is controlled by the currently edited tlDef
void handleMultiChange(GNELane *lane, FXObject *obj, FXSelector sel, void *data)
update phase definition for the current traffic light and phase
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:723
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
Definition: GNEViewNet.cpp:759
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:735
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
GNEViewParent * getViewParent() const
get the net object
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
bool checkSelectEdges() const
check if select edges (toggle using button or shift)
GNEUndoList * getUndoList() const
get the undoList object
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
GNEDeleteFrame * getDeleteFrame() const
get frame for delete elements
GNETLSEditorFrame * getTLSEditorFrame() const
get frame for NETWORK_TLS
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
GNERouteFrame * getRouteFrame() const
get frame for DEMAND_ROUTE
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
Definition: GUIDesigns.cpp:42
The popup menu of a globject.
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawGeometryPoints(const GUIVisualizationSettings::Detail d, const PositionVector &shape, const RGBColor &color, const double radius, const double exaggeration, const bool editingElevation)
draw geometry points
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
static double calculateRotation(const Position &first, const Position &second)
return angle between two points (used in geometric calculations)
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:59
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:156
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:143
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
T getColor(const double value) const
const std::vector< T > & getSchemes() const
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
virtual 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.
bool checkBoundaryParentElement(const GUIGlObject *GLObject, const GUIGlObject *parent)
check boundary parent element
Stores the information about how to visualize structures.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationSizeSettings addSize
bool disableLaneIcons
whether drawing is performed in left-hand networks
GUIVisualizationTextSettings drawLinkJunctionIndex
Detail getDetailLevel(const double exaggeration) const
return the detail level
bool showRails
Information whether rails shall be drawn.
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
bool lefthand
whether drawing is performed in left-hand networks
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
static const RGBColor & getLinkColor(const LinkState &ls, bool realistic=false)
map from LinkState to color constants
double scale
information about a lane's width (temporary, used for a single view)
bool showLaneDirection
Whether to show direction indicators for lanes.
bool drawForViewObjectsHandler
whether drawing is performed for the purpose of selecting objects in view using ViewObjectsHandler
bool showLinkDecals
Information whether link textures (arrows) shall be drawn.
GUIColorer laneColorer
The lane colorer.
bool laneShowBorders
Information whether lane borders shall be drawn.
GUIVisualizationTextSettings drawLinkTLIndex
double selectorFrameScale
the current selection scaling in netedit (set in SelectorFrame)
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
GUIColorer junctionColorer
The junction colorer.
std::string edgeParam
key for coloring by edge parameter
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:191
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:281
The representation of a single edge during network building.
Definition: NBEdge.h:92
double getLaneSpeed(int lane) const
get lane speed
Definition: NBEdge.cpp:2198
void setPermittedChanging(int lane, SVCPermissions changeLeft, SVCPermissions changeRight)
set allowed classes for changing to the left and right from the given lane
Definition: NBEdge.cpp:4359
double getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:589
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:4368
double getDistancAt(double pos) const
get distance at the given offset
Definition: NBEdge.cpp:4906
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:4331
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
Definition: NBEdge.h:598
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:4283
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:638
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1766
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition: NBEdge.cpp:743
const std::string & getID() const
Definition: NBEdge.h:1524
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:542
NBNode * myTo
Definition: NBEdge.h:1736
bool allowsChangingRight(int lane, SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
Definition: NBEdge.cpp:4515
double getDistance() const
get distance
Definition: NBEdge.h:675
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:4154
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
Definition: NBEdge.cpp:4315
bool isBidiEdge(bool checkPotential=false) const
whether this edge is part of a bidirectional edge pair
Definition: NBEdge.cpp:755
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:516
std::vector< Connection > getConnectionsFromLane(int lane, const NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1280
void setFriction(int lane, double friction)
set lane specific friction (negative lane implies set for all lanes)
Definition: NBEdge.cpp:4299
std::string getLaneID(int lane) const
get lane ID
Definition: NBEdge.cpp:4006
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
Definition: NBEdge.cpp:4323
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:523
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:342
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:4237
bool allowsChangingLeft(int lane, SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
Definition: NBEdge.cpp:4509
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:1132
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:980
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1424
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition: NBEdge.cpp:584
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:4704
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:535
Represents a single node (junction) during network building.
Definition: NBNode.h:66
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:2358
LinkState getLinkState(const NBEdge *incoming, const NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:2441
int getConnectionIndex(const NBEdge *from, const NBEdge::Connection &con) const
return the index of the given connection
Definition: NBNode.cpp:3949
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
Definition: NBNode.h:336
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
bool hasParameter(const std::string &key) const
Returns whether the parameter is set.
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
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".
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double x() const
Returns the x-position.
Definition: Position.h:55
double z() const
Returns the z-position.
Definition: Position.h:65
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position (in radians bet...
Definition: Position.h:286
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
double length2D() const
Returns the length.
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position
double length() const
Returns the length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
int indexOfClosest(const Position &p, bool twoD=false) const
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor WHITE
Definition: RGBColor.h:192
static const RGBColor ORANGE
Definition: RGBColor.h:191
static const RGBColor CYAN
Definition: RGBColor.h:189
static const RGBColor GREEN
Definition: RGBColor.h:186
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb....
Definition: RGBColor.cpp:371
static const RGBColor BLACK
Definition: RGBColor.h:193
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:200
void setOffset(const double offset)
set offset
bool isDefined() const
check if stopOffset was defined
void setExceptions(const std::string permissions)
set exceptions (used in netedit)
std::string getExceptions() const
get exceptions (used in netedit)
double getOffset() const
get offset
T get(const std::string &str) const
std::vector< std::string > getStrings() const
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
Definition: VClassIcons.cpp:35
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool editingElevation() const
check if we're editing elevation
bool showDemandElements() const
check if show demand elements checkbox is enabled
static const RGBColor special
color for selected special candidate element (Usually selected using shift+click)
static const RGBColor conflict
color for selected conflict candidate element (Usually selected using ctrl+click)
static const RGBColor invalid
color for invalid elements
static const RGBColor target
color for selected candidate target
static const RGBColor possible
color for possible candidate element
static const RGBColor source
color for selected candidate source
RGBColor selectedEdgeColor
edge selection color
RGBColor selectedLaneColor
lane selection color
static const RGBColor editShapeColor
color for edited shapes (Junctions, crossings and connections)
static const double segmentWidth
width of dotted contour segments
static const double laneGeometryPointRadius
moving lane geometry point radius
static const double junctionBubbleRadius
junction bubble radius
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool show(const GUIGlObject *o) const
whether to show the text
double width
This lane's width.
Definition: NBEdge.h:176
StopOffset laneStopOffset
stopOffsets.second - The stop offset for vehicles stopping at the lane's end. Applies if vClass is in...
Definition: NBEdge.h:173
PositionVector customShape
A custom shape for this lane set by the user.
Definition: NBEdge.h:189
double endOffset
This lane's offset to the intersection begin.
Definition: NBEdge.h:169
std::string type
the type of this lane
Definition: NBEdge.h:192
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:179
SVCPermissions changeRight
List of vehicle types that are allowed to change right from this lane.
Definition: NBEdge.h:166
double friction
The friction on this lane.
Definition: NBEdge.h:154
SVCPermissions changeLeft
List of vehicle types that are allowed to change Left from this lane.
Definition: NBEdge.h:163
bool accelRamp
Whether this lane is an acceleration lane.
Definition: NBEdge.h:182
PositionVector shape
The lane's shape.
Definition: NBEdge.h:148