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  // get modes
361  const auto& modes = myNet->getViewNet()->getEditModes();
362  // get vehicle frame
363  const auto& vehicleFrame = myNet->getViewNet()->getViewParent()->getVehicleFrame();
364  const auto& personFramePlanSelector = myNet->getViewNet()->getViewParent()->getPersonFrame()->getPlanSelector();
365  const auto& personPlanFramePlanSelector = myNet->getViewNet()->getViewParent()->getPersonPlanFrame()->getPlanSelector();
366  const auto& containerFramePlanSelector = myNet->getViewNet()->getViewParent()->getContainerFrame()->getPlanSelector();
367  const auto& containerPlanFramePlanSelector = myNet->getViewNet()->getViewParent()->getContainerPlanFrame()->getPlanSelector();
368  // check if we're in vehicle mode
369  if (vehicleFrame->shown()) {
370  // get current vehicle template
371  const auto vehicleTemplate = vehicleFrame->getVehicleTagSelector()->getCurrentTemplateAC();
372  // check if vehicle can be placed over from-to edges
373  if (vehicleTemplate && vehicleTemplate->getTagProperty().vehicleEdges()) {
374  // check if lane is under cursor
376  } else {
377  return false;
378  }
379  } else if (modes.isCurrentSupermodeDemand()) {
380  // check if we're in person or personPlan modes
381  if (((modes.demandEditMode == DemandEditMode::DEMAND_PERSON) && personFramePlanSelector->markEdges()) ||
382  ((modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) && personPlanFramePlanSelector->markEdges()) ||
383  ((modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) && containerFramePlanSelector->markEdges()) ||
384  ((modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) && containerPlanFramePlanSelector->markEdges())) {
386  }
387  }
388  return false;
389 }
390 
391 
392 bool
394  // first check if we're selecting edges or lanes
395  if (myNet->getViewNet()->checkSelectEdges()) {
396  return false;
397  } else {
398  // get edit modes
399  const auto& editModes = myNet->getViewNet()->getEditModes();
400  // check if we're in delete mode
401  if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
403  } else {
404  return false;
405  }
406  }
407 }
408 
409 
410 bool
412  // first check if we're selecting edges or lanes
413  if (myNet->getViewNet()->checkSelectEdges()) {
414  return false;
415  } else {
416  // get edit modes
417  const auto& editModes = myNet->getViewNet()->getEditModes();
418  // check if we're in select mode
419  if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
421  } else {
422  return false;
423  }
424  }
425 }
426 
427 
428 bool
430  // only move if shape is being edited
433  } else {
434  return false;
435  }
436 }
437 
438 
441  // edit depending if shape is being edited
442  if (isShapeEdited()) {
443  // calculate move shape operation
444  return calculateMoveShapeOperation(this, getLaneShape(), false);
445  } else {
446  return nullptr;
447  }
448 }
449 
450 
451 void
452 GNELane::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
453  // edit depending if shape is being edited
454  if (isShapeEdited()) {
455  // get original shape
456  PositionVector shape = getLaneShape();
457  // check shape size
458  if (shape.size() > 2) {
459  // obtain index
460  int index = shape.indexOfClosest(clickedPosition);
461  // get snap radius
463  // check if we have to create a new index
464  if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
465  // remove geometry point
466  shape.erase(shape.begin() + index);
467  // commit new shape
468  undoList->begin(this, "remove geometry point of " + getTagStr());
470  undoList->end();
471  }
472  }
473  }
474 }
475 
476 
477 void
479  // update lane drawing constan
481  // check drawing conditions
482  if (!s.drawForViewObjectsHandler) {
483  // draw lane
484  drawLane(s);
485  // draw lock icon
487  // draw dotted contour
489  }
490  // calculate contour (always before children)
492  // draw children
493  drawChildren(s);
494 }
495 
496 
497 void
499  // Check if edge can be deleted
501  myNet->deleteLane(this, myNet->getViewNet()->getUndoList(), false);
502  }
503 }
504 
505 
506 void
508  updateGeometry();
509 }
510 
511 
512 
515  // first obtain edit mode (needed because certain Commands depend of current edit mode)
517  // get mouse position
518  const auto mousePosition = myNet->getViewNet()->getPositionInformation();
519  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
520  buildPopupHeader(ret, app);
522  // build copy names entry
523  if (editMode != NetworkEditMode::NETWORK_TLS) {
524  GUIDesigns::buildFXMenuCommand(ret, TL("Copy parent edge name to clipboard"), nullptr, ret, MID_COPY_EDGE_NAME);
526  }
527  // stop if we're in data mode
529  return ret;
530  }
531  // build lane selection
534  } else {
536  }
537  // build edge selection
540  } else {
542  }
543  // stop if we're in data mode
545  return ret;
546  }
547  // add separator
548  new FXMenuSeparator(ret);
549  if (editMode != NetworkEditMode::NETWORK_TLS) {
550  // build show parameters menu
552  // build position copy entry
553  buildPositionCopyEntry(ret, app);
554  }
555  // check if we're in supermode network
557  // create end point
558  FXMenuCommand* resetEndPoints = GUIDesigns::buildFXMenuCommand(ret, TL("Reset edge end points"), nullptr, &parent, MID_GNE_RESET_GEOMETRYPOINT);
559  // enable or disable reset end points
561  resetEndPoints->enable();
562  } else {
563  resetEndPoints->disable();
564  }
565  // check if we clicked over a geometry point
566  if ((editMode == NetworkEditMode::NETWORK_MOVE) && myParentEdge->clickedOverGeometryPoint(mousePosition)) {
567  GUIDesigns::buildFXMenuCommand(ret, TL("Set custom Geometry Point"), nullptr, &parent, MID_GNE_CUSTOM_GEOMETRYPOINT);
568  }
569  // add separator
570  new FXMenuSeparator(ret);
571  //build operations
572  if ((editMode != NetworkEditMode::NETWORK_CONNECT) && (editMode != NetworkEditMode::NETWORK_TLS)) {
573  // build edge operations
574  buildEdgeOperations(parent, ret);
575  // build lane operations
576  buildLaneOperations(parent, ret);
577  // build template operations
578  buildTemplateOperations(parent, ret);
579  // add separator
580  new FXMenuSeparator(ret);
581  // build rechable operations
582  buildRechableOperations(parent, ret);
583  } else if (editMode == NetworkEditMode::NETWORK_TLS) {
585  GUIDesigns::buildFXMenuCommand(ret, TL("Select state for all links from this edge:"), nullptr, nullptr, 0);
586  const std::vector<std::string> names = GNEInternalLane::LinkStateNames.getStrings();
587  for (auto it : names) {
588  FXuint state = GNEInternalLane::LinkStateNames.get(it);
589  FXMenuRadio* mc = new FXMenuRadio(ret, it.c_str(), this, FXDataTarget::ID_OPTION + state);
590  mc->setSelBackColor(MFXUtils::getFXColor(GNEInternalLane::colorForLinksState(state)));
592  }
593  }
594  } else {
595  FXMenuCommand* mc = GUIDesigns::buildFXMenuCommand(ret, TL("Additional options available in 'Inspect Mode'"), nullptr, nullptr, 0);
596  mc->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
597  }
598  // build shape positions menu
599  if (editMode != NetworkEditMode::NETWORK_TLS) {
600  new FXMenuSeparator(ret);
601  // get lane shape
602  const auto& laneShape = myLaneGeometry.getShape();
603  // get variables
604  const double pos = laneShape.nearest_offset_to_point2D(mousePosition);
605  const Position firstAnglePos = laneShape.positionAtOffset2D(pos - 0.001);
606  const Position secondAnglePos = laneShape.positionAtOffset2D(pos);
607  const double angle = firstAnglePos.angleTo2D(secondAnglePos);
608 
609  // build menu commands
610  GUIDesigns::buildFXMenuCommand(ret, TL("Shape pos: ") + toString(pos), nullptr, nullptr, 0);
611  GUIDesigns::buildFXMenuCommand(ret, TL("Length pos: ") + toString(pos * getLaneParametricLength() / getLaneShapeLength()), nullptr, nullptr, 0);
612  if (myParentEdge->getNBEdge()->getDistance() != 0) {
613  GUIDesigns::buildFXMenuCommand(ret, TL("Distance: ") + toString(myParentEdge->getNBEdge()->getDistancAt(pos)), nullptr, nullptr, 0);
614  }
615  GUIDesigns::buildFXMenuCommand(ret, TL("Height: ") + toString(firstAnglePos.z()), nullptr, nullptr, 0);
616  GUIDesigns::buildFXMenuCommand(ret, TL("Angle: ") + toString((GeomHelper::naviDegree(angle))), nullptr, nullptr, 0);
617  }
618  }
619  return ret;
620 }
621 
622 
623 double
625  return s.addSize.getExaggeration(s, this);
626 }
627 
628 
629 Boundary
632 }
633 
634 
635 void
636 GNELane::updateCenteringBoundary(const bool /*updateGrid*/) {
637  // nothing to update
638 }
639 
640 
641 int
643  return myIndex;
644 }
645 
646 
647 void
648 GNELane::setIndex(int index) {
649  myIndex = index;
651 }
652 
653 
654 double
657 }
658 
659 
660 double
662  double laneParametricLength = myParentEdge->getNBEdge()->getLoadedLength();
663  if (laneParametricLength > 0) {
664  return laneParametricLength;
665  } else {
666  throw ProcessError(TL("Lane Parametric Length cannot be never 0"));
667  }
668 }
669 
670 
671 double
673  return myLaneGeometry.getShape().length();
674 }
675 
676 
677 bool
679  return myParentEdge->getNBEdge()->getPermissions(myIndex) == vclass;
680 }
681 
682 
685  return myLane2laneConnections;
686 }
687 
688 
689 std::string
691  const NBEdge* edge = myParentEdge->getNBEdge();
692  switch (key) {
693  case SUMO_ATTR_ID:
694  return getMicrosimID();
696  return myParentEdge->getFromJunction()->getID();
698  return myParentEdge->getToJunction()->getID();
699  case SUMO_ATTR_SPEED:
700  return toString(edge->getLaneSpeed(myIndex));
701  case SUMO_ATTR_ALLOW:
703  case SUMO_ATTR_DISALLOW:
709  case SUMO_ATTR_WIDTH:
711  return "default";
712  } else {
713  return toString(edge->getLaneStruct(myIndex).width);
714  }
715  case SUMO_ATTR_FRICTION:
716  return toString(edge->getLaneStruct(myIndex).friction);
717  case SUMO_ATTR_ENDOFFSET:
718  return toString(edge->getLaneStruct(myIndex).endOffset);
720  return toString(edge->getLaneStruct(myIndex).accelRamp);
722  return toString(edge->getLaneStruct(myIndex).customShape);
723  case GNE_ATTR_OPPOSITE:
724  return toString(edge->getLaneStruct(myIndex).oppositeID);
725  case SUMO_ATTR_TYPE:
726  return edge->getLaneStruct(myIndex).type;
727  case SUMO_ATTR_INDEX:
728  return toString(myIndex);
729  case GNE_ATTR_STOPOFFSET:
734  } else {
735  return "";
736  }
737  case GNE_ATTR_PARENT:
738  return myParentEdge->getID();
739  case GNE_ATTR_SELECTED:
741  case GNE_ATTR_PARAMETERS:
743  default:
744  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
745  }
746 }
747 
748 std::string
750  std::string result = getAttribute(key);
751  if ((key == SUMO_ATTR_ALLOW || key == SUMO_ATTR_DISALLOW) && result.find("all") != std::string::npos) {
752  result += " " + getVehicleClassNames(SVCAll, true);
753  }
754  return result;
755 }
756 
757 
758 void
759 GNELane::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
760  switch (key) {
761  case SUMO_ATTR_ID:
762  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
763  case SUMO_ATTR_SPEED:
764  case SUMO_ATTR_ALLOW:
765  case SUMO_ATTR_DISALLOW:
768  case SUMO_ATTR_WIDTH:
769  case SUMO_ATTR_FRICTION:
770  case SUMO_ATTR_ENDOFFSET:
773  case GNE_ATTR_OPPOSITE:
774  case SUMO_ATTR_TYPE:
775  case SUMO_ATTR_INDEX:
776  case GNE_ATTR_STOPOFFSET:
778  case GNE_ATTR_SELECTED:
779  case GNE_ATTR_PARAMETERS:
780  // no special handling
781  GNEChange_Attribute::changeAttribute(this, key, value, undoList);
782  break;
783  default:
784  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
785  }
786 }
787 
788 
789 bool
790 GNELane::isValid(SumoXMLAttr key, const std::string& value) {
791  switch (key) {
792  case SUMO_ATTR_ID:
793  case SUMO_ATTR_INDEX:
794  return false;
795  case SUMO_ATTR_SPEED:
796  return canParse<double>(value);
797  case SUMO_ATTR_ALLOW:
798  case SUMO_ATTR_DISALLOW:
801  return canParseVehicleClasses(value);
802  case SUMO_ATTR_WIDTH:
803  if (value.empty() || (value == "default")) {
804  return true;
805  } else {
806  return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_WIDTH));
807  }
808  case SUMO_ATTR_FRICTION:
809  case SUMO_ATTR_ENDOFFSET:
810  return canParse<double>(value) && (parse<double>(value) >= 0);
812  return canParse<bool>(value);
813  case SUMO_ATTR_CUSTOMSHAPE: {
814  // A lane shape can either be empty or have more than 1 element
815  if (value.empty()) {
816  return true;
817  } else if (canParse<PositionVector>(value)) {
818  return parse<PositionVector>(value).size() > 1;
819  }
820  return false;
821  }
822  case GNE_ATTR_OPPOSITE: {
823  if (value.empty()) {
824  return true;
825  } else {
826  NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
827  if (oppEdge == nullptr || oppEdge->getLaneID(oppEdge->getNumLanes() - 1) != value) {
828  return false;
829  }
830  NBEdge* edge = myParentEdge->getNBEdge();
831  if (oppEdge->getFromNode() != edge->getToNode() || oppEdge->getToNode() != edge->getFromNode()) {
832  WRITE_WARNINGF(TL("Opposite lane '%' does not connect the same nodes as edge '%'!"), value, edge->getID());
833  return false;
834  }
835  return true;
836  }
837  }
838  case SUMO_ATTR_TYPE:
839  return true;
840  case GNE_ATTR_STOPOFFSET:
841  return canParse<double>(value) && (parse<double>(value) >= 0);
843  return canParseVehicleClasses(value);
844  case GNE_ATTR_SELECTED:
845  return canParse<bool>(value);
846  case GNE_ATTR_PARAMETERS:
847  return Parameterised::areParametersValid(value);
848  default:
849  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
850  }
851 }
852 
853 
854 bool
856  switch (key) {
857  case SUMO_ATTR_ID:
858  case SUMO_ATTR_INDEX:
859  return false;
862  default:
863  return true;
864  }
865 }
866 
867 
868 bool
870  const NBEdge* edge = myParentEdge->getNBEdge();
871  switch (key) {
872  case SUMO_ATTR_WIDTH:
874  default:
875  return false;
876  }
877 }
878 
879 
880 const Parameterised::Map&
883 }
884 
885 
886 void
887 GNELane::setSpecialColor(const RGBColor* color, double colorValue) {
888  mySpecialColor = color;
889  mySpecialColorValue = colorValue;
890 }
891 
892 // ===========================================================================
893 // private
894 // ===========================================================================
895 
896 void
897 GNELane::setAttribute(SumoXMLAttr key, const std::string& value) {
898  // get parent edge
899  NBEdge* edge = myParentEdge->getNBEdge();
900  // get template editor
902  // check if we have to update template
903  const bool updateTemplate = templateEditor->getEdgeTemplate() ? (templateEditor->getEdgeTemplate()->getID() == myParentEdge->getID()) : false;
904  switch (key) {
905  case SUMO_ATTR_ID:
906  case SUMO_ATTR_INDEX:
907  throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
908  case SUMO_ATTR_SPEED:
909  edge->setSpeed(myIndex, parse<double>(value));
910  break;
911  case SUMO_ATTR_ALLOW:
913  break;
914  case SUMO_ATTR_DISALLOW:
916  break;
919  break;
922  break;
923  case SUMO_ATTR_WIDTH:
924  if (value.empty() || (value == "default")) {
926  } else {
927  edge->setLaneWidth(myIndex, parse<double>(value));
928  }
929  // update edge parent boundary
931  break;
932  case SUMO_ATTR_FRICTION:
933  edge->setFriction(myIndex, parse<double>(value));
934  break;
935  case SUMO_ATTR_ENDOFFSET:
936  edge->setEndOffset(myIndex, parse<double>(value));
937  break;
939  edge->setAcceleration(myIndex, parse<bool>(value));
940  break;
941  case SUMO_ATTR_CUSTOMSHAPE: {
942  // set new shape
943  edge->setLaneShape(myIndex, parse<PositionVector>(value));
944  // update edge parent boundary
946  break;
947  }
948  case GNE_ATTR_OPPOSITE: {
949  if (value != "") {
950  NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
951  oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = getID();
952  } else {
953  // reset prior oppEdge if existing
954  const std::string oldValue = myParentEdge->getNBEdge()->getLaneStruct(myIndex).oppositeID;
955  NBEdge* oppEdge = myNet->getEdgeCont().retrieve(oldValue.substr(0, oldValue.rfind("_")));
956  if (oppEdge != nullptr) {
957  oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = "";
958  }
959  }
961  break;
962  }
963  case SUMO_ATTR_TYPE:
964  edge->getLaneStruct(myIndex).type = value;
965  break;
966  case GNE_ATTR_STOPOFFSET:
967  edge->getLaneStruct(myIndex).laneStopOffset.setOffset(parse<double>(value));
968  break;
970  if (value.empty()) {
972  } else {
974  }
975  break;
976  case GNE_ATTR_SELECTED:
977  if (parse<bool>(value)) {
979  } else {
981  }
982  break;
983  case GNE_ATTR_PARAMETERS:
985  break;
986  default:
987  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
988  }
989  // update template
990  if (updateTemplate) {
991  templateEditor->setEdgeTemplate(myParentEdge);
992  }
993  // invalidate path calculator
995 }
996 
997 
998 void
1000  // set custom shape
1002  // update geometry
1003  updateGeometry();
1004 }
1005 
1006 
1007 void
1008 GNELane::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
1009  // commit new shape
1010  undoList->begin(this, "moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
1012  undoList->end();
1013 }
1014 
1015 
1016 void
1018  // Push layer matrix
1020  // translate to front (note: Special case)
1022  glTranslated(0, 0, GLO_FRONTELEMENT);
1025  } else {
1027  }
1028  // set lane colors
1029  setLaneColor(s);
1030  // Check if lane has to be draw as railway and if isn't being drawn for selecting
1032  // draw as railway
1034  } else if (myShapeColors.size() > 0) {
1035  // draw geometry with own colors
1038  } else {
1039  // draw geometry with current color
1042  }
1043  // if lane is selected, draw a second lane over it
1044  drawSelectedLane(s);
1045  // draw start end shape points
1047  // check if draw details
1049  // draw markings
1051  // Draw direction indicators
1053  // draw lane textures
1054  drawTextures(s);
1055  // draw lane arrows
1056  drawArrows(s);
1057  // draw link numbers
1058  drawLinkNo(s);
1059  // draw TLS link numbers
1060  drawTLSLinkNo(s);
1061  // draw stopOffsets
1062  drawLaneStopOffset(s);
1063  }
1064  // draw shape edited
1065  drawShapeEdited(s);
1066  // Pop layer matrix
1068 }
1069 
1070 
1071 void
1073  // only draw if lane is selected
1074  if (drawUsingSelectColor()) {
1075  // Push matrix
1077  // move back
1078  glTranslated(0, 0, 0.1);
1079  // set selected edge color
1081  // draw geometry with current color
1084  // Pop matrix
1086  }
1087 }
1088 
1089 
1090 void
1092  // if shape is being edited, draw point and green line
1093  if (myShapeEdited) {
1094  // push shape edited matrix
1096  // translate
1098  // set selected edge color
1100  // draw shape around
1103  // move front
1104  glTranslated(0, 0, 1);
1105  // draw geometry points
1110  // Pop shape edited matrix
1112  }
1113 }
1114 
1115 
1116 void
1118  // check if draw children elements
1120  // draw additional children
1121  for (const auto& additional : getChildAdditionals()) {
1122  // check that ParkingAreas aren't draw two times
1123  additional->drawGL(s);
1124  }
1125  // draw demand element children
1126  for (const auto& demandElement : getChildDemandElements()) {
1127  if (!demandElement->getTagProperty().isPlacedInRTree()) {
1128  demandElement->drawGL(s);
1129  }
1130  }
1131  // draw path additional elements
1133  }
1134 }
1135 
1136 
1137 void
1139  // check conditions
1141  // declare separator width
1142  const auto separatorWidth = SUMO_const_laneMarkWidth * 0.5;
1143  // push matrix
1145  // translate
1146  glTranslated(0, 0, 0.1);
1147  // set white color
1149  // continue depending of index
1150  if (myIndex == 0) {
1151  // in the first lane, draw a separator
1154  } else {
1155  // get permissions between this and previous lane
1156  const auto permissionsA = myParentEdge->getNBEdge()->getPermissions(myIndex - 1);
1157  const auto permissionsB = myParentEdge->getNBEdge()->getPermissions(myIndex);
1158  // get change left and right for passengers
1159  const bool changeLeft = myParentEdge->getNBEdge()->allowsChangingLeft(myIndex - 1, SVC_PASSENGER);
1160  const bool changeRight = myParentEdge->getNBEdge()->allowsChangingRight(myIndex, SVC_PASSENGER);
1161  // draw orange background under the lane and under the lane markings to highlight change prohibitions
1162  if (!(changeLeft && changeRight)) {
1164  glTranslated(0, 0, -0.1);
1169  }
1170  // if permissions are similar and we aren't drawing in spread mode, draw markings. In other case, draw a separator
1171  if (!s.spreadSuperposed && (permissionsA & permissionsB)) {
1173  3, 6, myDrawingConstants->getDrawingWidth(), changeLeft, changeRight, s.lefthand, 1);
1174  } else {
1176  separatorWidth, myDrawingConstants->getOffset() + myDrawingConstants->getDrawingWidth() + separatorWidth);
1177  }
1178  }
1179  // check if draw last separator
1180  if (myIndex == (myParentEdge->getNBEdge()->getNumLanes() - 1)) {
1182  myDrawingConstants->getOffset() + (myDrawingConstants->getDrawingWidth() * -1) + separatorWidth);
1183  }
1184  // pop matrix
1186  }
1187 }
1188 
1189 
1190 void
1192  // check draw conditions
1194  // get connections
1195  const auto& connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
1196  // get number of links
1197  const int noLinks = (int)connections.size();
1198  // only continue if there is links
1199  if (noLinks > 0) {
1200  // push link matrix
1202  // move front
1203  glTranslated(0, 0, GLO_TEXTNAME);
1204  // calculate width
1205  const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
1206  // get X1
1207  double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
1208  // iterate over links
1209  for (int i = noLinks - 1; i >= 0; i--) {
1210  // calculate x2
1211  const double x2 = x1 - (double)(width / 2.);
1212  // get link index
1213  const int linkIndex = myParentEdge->getNBEdge()->getToNode()->getConnectionIndex(myParentEdge->getNBEdge(),
1214  connections[s.lefthand ? noLinks - 1 - i : i]);
1215  // draw link index
1217  // update x1
1218  x1 -= width;
1219  }
1220  // pop link matrix
1222  }
1223  }
1224 }
1225 
1226 
1227 void
1229  // check conditions
1231  (myParentEdge->getToJunction()->getNBNode()->getControllingTLS().size() > 0)) {
1232  // get connections
1233  const auto& connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
1234  // get numer of links
1235  const int noLinks = (int)connections.size();
1236  // only continue if there are links
1237  if (noLinks > 0) {
1238  // push link matrix
1240  // move t front
1241  glTranslated(0, 0, GLO_TEXTNAME);
1242  // calculate width
1243  const double w = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
1244  // calculate x1
1245  double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
1246  // iterate over links
1247  for (int i = noLinks - 1; i >= 0; --i) {
1248  // calculate x2
1249  const double x2 = x1 - (double)(w / 2.);
1250  // get link number
1251  const int linkNo = connections[s.lefthand ? noLinks - 1 - i : i].tlLinkIndex;
1252  // draw link number
1254  // update x1
1255  x1 -= w;
1256  }
1257  // pop link matrix
1259  }
1260  }
1261 }
1262 
1263 
1264 void
1267  // calculate begin, end and rotation
1268  const Position& begin = myLaneGeometry.getShape()[-2];
1269  const Position& end = myLaneGeometry.getShape().back();
1270  const double rot = GUIGeometry::calculateRotation(begin, end);
1271  // push arrow matrix
1273  // move front (note: must draw on top of junction shape?
1274  glTranslated(0, 0, 3);
1275  // change color depending of spreadSuperposed
1278  } else {
1280  }
1281  // move to end
1282  glTranslated(end.x(), end.y(), 0);
1283  // rotate
1284  glRotated(rot, 0, 0, 1);
1285  const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex);
1286  if (width < SUMO_const_laneWidth) {
1288  }
1289  // apply offset
1290  glTranslated(myDrawingConstants->getOffset(), 0, 0);
1291  // get destination node
1292  const NBNode* dest = myParentEdge->getNBEdge()->myTo;
1293  // draw all links iterating over connections
1294  for (const auto& connection : myParentEdge->getNBEdge()->myConnections) {
1295  if (connection.fromLane == myIndex) {
1296  // get link direction
1297  LinkDirection dir = dest->getDirection(myParentEdge->getNBEdge(), connection.toEdge, s.lefthand);
1298  // draw depending of link direction
1299  switch (dir) {
1301  GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
1302  GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25);
1303  break;
1304  case LinkDirection::LEFT:
1305  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1306  GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
1307  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25);
1308  break;
1309  case LinkDirection::RIGHT:
1310  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1311  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
1312  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25);
1313  break;
1314  case LinkDirection::TURN:
1315  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1316  GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
1317  GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
1318  GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25);
1319  break;
1321  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1322  GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
1323  GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
1324  GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25);
1325  break;
1327  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1328  GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
1329  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25);
1330  break;
1332  GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1333  GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
1334  GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25);
1335  break;
1336  case LinkDirection::NODIR:
1337  GLHelper::drawBoxLine(Position(1, 5.8), 245, 2, .05);
1338  GLHelper::drawBoxLine(Position(-1, 5.8), 115, 2, .05);
1339  glTranslated(0, 5, 0);
1340  GLHelper::drawOutlineCircle(0.9, 0.8, 32);
1341  glTranslated(0, -5, 0);
1342  break;
1343  }
1344  }
1345  }
1346  // pop arrow matrix
1348  }
1349 }
1350 
1351 
1352 void
1355  glTranslated(0, 0, 0.1); // must draw on top of junction shape
1356  std::vector<NBEdge::Connection> connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
1357  NBNode* node = myParentEdge->getNBEdge()->getToNode();
1358  const Position& startPos = myLaneGeometry.getShape()[-1];
1359  for (auto it : connections) {
1360  const LinkState state = node->getLinkState(myParentEdge->getNBEdge(), it.toEdge, it.fromLane, it.toLane, it.mayDefinitelyPass, it.tlID);
1361  switch (state) {
1363  glColor3d(1, 1, 0);
1364  break;
1366  glColor3d(0, 1, 1);
1367  break;
1368  case LINKSTATE_MAJOR:
1369  glColor3d(1, 1, 1);
1370  break;
1371  case LINKSTATE_MINOR:
1372  glColor3d(.4, .4, .4);
1373  break;
1374  case LINKSTATE_STOP:
1375  glColor3d(.7, .4, .4);
1376  break;
1377  case LINKSTATE_EQUAL:
1378  glColor3d(.7, .7, .7);
1379  break;
1380  case LINKSTATE_ALLWAY_STOP:
1381  glColor3d(.7, .7, 1);
1382  break;
1383  case LINKSTATE_ZIPPER:
1384  glColor3d(.75, .5, 0.25);
1385  break;
1386  default:
1387  throw ProcessError(TLF("Unexpected LinkState '%'", toString(state)));
1388  }
1389  const Position& endPos = it.toEdge->getLaneShape(it.toLane)[0];
1390  glBegin(GL_LINES);
1391  glVertex2d(startPos.x(), startPos.y());
1392  glVertex2d(endPos.x(), endPos.y());
1393  glEnd();
1394  GLHelper::drawTriangleAtEnd(startPos, endPos, (double) 1.5, (double) .2);
1395  }
1397 }
1398 
1399 
1400 void
1402  // first check if edge parent was inserted with full boundary
1404  // calculate contour
1407  // calculate geometry points contour if we're editing shape
1408  if (myShapeEdited) {
1411  }
1412  }
1413 }
1414 
1415 
1416 RGBColor
1418  // get inspected attribute carriers
1419  const auto& inspectedACs = myNet->getViewNet()->getInspectedAttributeCarriers();
1420  // declare a RGBColor variable
1421  RGBColor color;
1422  // get inspected AC
1423  const GNEAttributeCarrier* inspectedAC = inspectedACs.size() > 0 ? inspectedACs.front() : nullptr;
1424  // 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.
1425  if (inspectedAC && (!inspectedAC->isAttributeCarrierSelected()) &&
1426  ((inspectedAC->getTagProperty().getTag() == SUMO_TAG_TRIP) || (inspectedAC->getTagProperty().getTag() == SUMO_TAG_FLOW))) {
1427  // obtain attribute "via"
1428  std::vector<std::string> viaEdges = parse<std::vector<std::string> >(inspectedAC->getAttribute(SUMO_ATTR_VIA));
1429  // iterate over viaEdges
1430  for (const auto& edge : viaEdges) {
1431  // check if parent edge is in the via edges
1432  if (myParentEdge->getID() == edge) {
1433  // set green color in GLHelper and return it
1434  color = RGBColor::GREEN;
1435  }
1436  }
1437  }
1438  if (mySpecialColor != nullptr) {
1439  // If special color is enabled, set it
1440  color = *mySpecialColor;
1441  } else if (myParentEdge->drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1442  // override with special colors (unless the color scheme is based on selection)
1443  color = s.colorSettings.selectedEdgeColor;
1444  } else {
1445  // Get normal lane color
1446  const GUIColorer& c = s.laneColorer;
1447  if (!setFunctionalColor(c.getActive(), color) && !setMultiColor(s, c, color)) {
1448  color = c.getScheme().getColor(getColorValue(s, c.getActive()));
1449  }
1450  }
1451  // special color for conflicted candidate edges
1453  // extra check for route frame
1455  color = s.candidateColorSettings.conflict;
1456  }
1457  }
1458  // special color for special candidate edges
1460  // extra check for route frame
1462  color = s.candidateColorSettings.special;
1463  }
1464  }
1465  // special color for candidate edges
1467  // extra check for route frame
1469  color = s.candidateColorSettings.possible;
1470  }
1471  }
1472  // special color for source candidate edges
1474  color = s.candidateColorSettings.source;
1475  }
1476  // special color for target candidate edges
1478  color = s.candidateColorSettings.target;
1479  }
1480  // special color for invalid candidate edges
1482  color = s.candidateColorSettings.invalid;
1483  }
1484  // special color for source candidate lanes
1485  if (mySourceCandidate) {
1486  color = s.candidateColorSettings.source;
1487  }
1488  // special color for target candidate lanes
1489  if (myTargetCandidate) {
1490  color = s.candidateColorSettings.target;
1491  }
1492  // special color for special candidate lanes
1493  if (mySpecialCandidate) {
1494  color = s.candidateColorSettings.special;
1495  }
1496  // special color for possible candidate lanes
1497  if (myPossibleCandidate) {
1498  color = s.candidateColorSettings.possible;
1499  }
1500  // special color for conflicted candidate lanes
1501  if (myConflictedCandidate) {
1502  color = s.candidateColorSettings.conflict;
1503  }
1504  // special color for invalid candidate lanes
1505  if (myInvalidCandidate) {
1506  color = s.candidateColorSettings.invalid;
1507  }
1508  // set color in GLHelper
1509  GLHelper::setColor(color);
1510  return color;
1511 }
1512 
1513 
1514 bool
1515 GNELane::setFunctionalColor(int activeScheme, RGBColor& col) const {
1516  switch (activeScheme) {
1517  case 6: {
1518  double hue = GeomHelper::naviDegree(myLaneGeometry.getShape().beginEndAngle()); // [0-360]
1519  col = RGBColor::fromHSV(hue, 1., 1.);
1520  return true;
1521  }
1522  default:
1523  return false;
1524  }
1525 }
1526 
1527 
1528 bool
1530  const int activeScheme = c.getActive();
1531  myShapeColors.clear();
1532  switch (activeScheme) {
1533  case 9: // color by height at segment start
1534  for (PositionVector::const_iterator ii = myLaneGeometry.getShape().begin(); ii != myLaneGeometry.getShape().end() - 1; ++ii) {
1535  myShapeColors.push_back(c.getScheme().getColor(ii->z()));
1536  }
1537  col = c.getScheme().getColor(getColorValue(s, 8));
1538  return true;
1539  case 11: // color by inclination at segment start
1540  for (int ii = 1; ii < (int)myLaneGeometry.getShape().size(); ++ii) {
1541  const double inc = (myLaneGeometry.getShape()[ii].z() - myLaneGeometry.getShape()[ii - 1].z()) / MAX2(POSITION_EPS, myLaneGeometry.getShape()[ii].distanceTo2D(myLaneGeometry.getShape()[ii - 1]));
1542  myShapeColors.push_back(c.getScheme().getColor(inc));
1543  }
1544  col = c.getScheme().getColor(getColorValue(s, 10));
1545  return true;
1546  default:
1547  return false;
1548  }
1549 }
1550 
1551 
1552 double
1553 GNELane::getColorValue(const GUIVisualizationSettings& s, int activeScheme) const {
1554  const SVCPermissions myPermissions = myParentEdge->getNBEdge()->getPermissions(myIndex);
1555  if (mySpecialColor != nullptr && mySpecialColorValue != std::numeric_limits<double>::max()) {
1556  return mySpecialColorValue;
1557  }
1558  switch (activeScheme) {
1559  case 0:
1560  switch (myPermissions) {
1561  case SVC_PEDESTRIAN:
1562  return 1;
1563  case SVC_BICYCLE:
1564  return 2;
1565  case 0:
1566  // forbidden road or green verge
1567  return myParentEdge->getNBEdge()->getPermissions() == 0 ? 10 : 3;
1568  case SVC_SHIP:
1569  return 4;
1570  case SVC_AUTHORITY:
1571  return 8;
1572  case SVC_AIRCRAFT:
1573  case SVC_DRONE:
1574  return 12;
1575  default:
1576  break;
1577  }
1579  return 9;
1580  } else if (isRailway(myPermissions)) {
1581  if ((myPermissions & SVC_BUS) != 0) {
1582  return 6;
1583  } else {
1584  return 5;
1585  }
1586  } else if ((myPermissions & SVC_PASSENGER) != 0) {
1587  if ((myPermissions & (SVC_RAIL_CLASSES & ~SVC_RAIL_FAST)) != 0 && (myPermissions & SVC_SHIP) == 0) {
1588  return 6;
1589  } else {
1590  return 0;
1591  }
1592  } else {
1593  return 7;
1594  }
1595  case 1:
1597  case 2:
1598  return (double)myPermissions;
1599  case 3:
1601  case 4:
1602  return myParentEdge->getNBEdge()->getNumLanes();
1603  case 5: {
1605  }
1606  // case 6: by angle (functional)
1607  case 7: {
1608  return myParentEdge->getNBEdge()->getPriority();
1609  }
1610  case 8: {
1611  // color by z of first shape point
1612  return myLaneGeometry.getShape()[0].z();
1613  }
1614  // case 9: by segment height
1615  case 10: {
1616  // color by incline
1617  return (myLaneGeometry.getShape()[-1].z() - myLaneGeometry.getShape()[0].z()) / myParentEdge->getNBEdge()->getLength();
1618  }
1619  // case 11: by segment incline
1620 
1621  case 12: {
1622  // by numerical edge param value
1624  try {
1626  } catch (NumberFormatException&) {
1627  try {
1629  } catch (BoolFormatException&) {
1630  return -1;
1631  }
1632  }
1633  } else {
1635  }
1636  }
1637  case 13: {
1638  // by numerical lane param value
1640  try {
1642  } catch (NumberFormatException&) {
1643  try {
1645  } catch (BoolFormatException&) {
1646  return -1;
1647  }
1648  }
1649  } else {
1651  }
1652  }
1653  case 14: {
1654  return myParentEdge->getNBEdge()->getDistance();
1655  }
1656  case 15: {
1657  return fabs(myParentEdge->getNBEdge()->getDistance());
1658  }
1659  }
1660  return 0;
1661 }
1662 
1663 
1664 void
1665 GNELane::drawOverlappedRoutes(const int numRoutes) const {
1666  // get middle point and angle
1669  // Push route matrix
1671  // translate to front
1672  glTranslated(0, 0, GLO_ROUTE + 1);
1673  // get middle
1674  GLHelper::drawText(toString(numRoutes) + " routes", center, 0, 1.8, RGBColor::BLACK, angle + 90);
1675  // pop route matrix
1677 
1678 }
1679 
1680 
1681 void
1683  const auto& laneStopOffset = myParentEdge->getNBEdge()->getLaneStruct(myIndex).laneStopOffset;
1684  // check conditions
1685  if (laneStopOffset.isDefined() && (laneStopOffset.getPermissions() & SVC_PASSENGER) != 0) {
1686  const Position& end = getLaneShape().back();
1687  const Position& f = getLaneShape()[-2];
1688  const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
1691  glTranslated(end.x(), end.y(), 1);
1692  glRotated(rot, 0, 0, 1);
1693  glTranslated(0, laneStopOffset.getOffset(), 0);
1694  glBegin(GL_QUADS);
1695  glVertex2d(-myDrawingConstants->getDrawingWidth(), 0.0);
1696  glVertex2d(-myDrawingConstants->getDrawingWidth(), 0.2);
1697  glVertex2d(myDrawingConstants->getDrawingWidth(), 0.2);
1698  glVertex2d(myDrawingConstants->getDrawingWidth(), 0.0);
1699  glEnd();
1701  }
1702 }
1703 
1704 
1705 bool
1707  return isWaterway(myParentEdge->getNBEdge()->getPermissions(myIndex)) && s.showRails && !s.drawForRectangleSelection; // reusing the showRails setting
1708 }
1709 
1710 
1711 void
1713  // Draw direction indicators if the correspondient option is enabled
1714  if (s.showLaneDirection) {
1715  // improve visibility of superposed rail edges
1717  glColor3d(0.3, 0.3, 0.3);
1718  }
1719  // get width and sideOffset
1720  const double width = MAX2(NUMERICAL_EPS, (myDrawingConstants->getDrawingWidth() * 2 * myDrawingConstants->getExaggeration()));
1721  // push direction indicator matrix
1723  // move to front
1724  glTranslated(0, 0, 0.1);
1725  // iterate over shape
1726  for (int i = 0; i < (int) myLaneGeometry.getShape().size() - 1; ++i) {
1727  // push triangle matrix
1729  // move front
1730  glTranslated(myLaneGeometry.getShape()[i].x(), myLaneGeometry.getShape()[i].y(), 0.1);
1731  // rotate
1732  glRotated(myLaneGeometry.getShapeRotations()[i], 0, 0, 1);
1733  // calculate subwidth
1734  for (double subWidth = 0; subWidth < myLaneGeometry.getShapeLengths()[i]; subWidth += width) {
1735  // calculate length
1736  const double length = MIN2(width * 0.5, myLaneGeometry.getShapeLengths()[i] - subWidth);
1737  // draw triangle
1738  glBegin(GL_TRIANGLES);
1739  glVertex2d(-myDrawingConstants->getOffset(), -subWidth - length);
1740  glVertex2d(-myDrawingConstants->getOffset() - width * 0.25, -subWidth);
1741  glVertex2d(-myDrawingConstants->getOffset() + width * 0.25, -subWidth);
1742  glEnd();
1743  }
1744  // pop triangle matrix
1746  }
1747  // pop direction indicator matrix
1749  }
1750 }
1751 
1752 
1753 void
1755  // draw foot width 150mm, assume that distance between rail feet inner sides is reduced on both sides by 39mm with regard to the gauge
1756  // assume crosstie length of 181% gauge (2600mm for standard gauge)
1757  // first save current color (obtained from view configuration)
1758  const auto currentLaneColor = GLHelper::getColor();
1759  // Set current color
1760  GLHelper::setColor(currentLaneColor);
1761  // continue depending of detail
1763  // move
1764  glTranslated(0, 0, 0.1);
1765  // draw external crossbar
1766  const double crossbarWidth = 0.2 * myDrawingConstants->getExaggeration();
1767  // draw geometry
1771  // move
1772  glTranslated(0, 0, 0.01);
1773  // Set color gray
1774  glColor3d(0.8, 0.8, 0.8);
1775  // draw geometry
1779  // move
1780  glTranslated(0, 0, 0.01);
1781  // Set current color
1782  GLHelper::setColor(currentLaneColor);
1783  // Draw crossties
1786  myDrawingConstants->getOffset(), false);
1787  } else if (myShapeColors.size() > 0) {
1788  // draw colored box lines
1791  } else {
1792  // draw geometry with current color
1795  }
1796 }
1797 
1798 
1799 void
1801  // check all conditions for drawing textures
1802  if (!s.disableLaneIcons && (myLaneRestrictedTexturePositions.size() > 0)) {
1803  // Declare default width of icon (3)
1804  const double iconWidth = myDrawingConstants->getDrawingWidth() * 0.6;
1805  // Draw list of icons
1806  for (int i = 0; i < (int)myLaneRestrictedTexturePositions.size(); i++) {
1807  // Push draw matrix 2
1809  // Set white color
1810  glColor3d(1, 1, 1);
1811  // Translate matrix 2
1812  glTranslated(myLaneRestrictedTexturePositions.at(i).x(), myLaneRestrictedTexturePositions.at(i).y(), 0.1);
1813  // Rotate matrix 2
1814  glRotated(myLaneRestrictedTextureRotations.at(i), 0, 0, -1);
1815  glRotated(90, 0, 0, 1);
1816  // draw texture box depending of type of restriction
1819  } else if (isRestricted(SVC_BICYCLE)) {
1821  } else if (isRestricted(SVC_BUS)) {
1823  }
1824  // Pop draw matrix 2
1826  }
1827  }
1828 }
1829 
1830 
1831 void
1833  // draw a Start/endPoints if lane has a custom shape
1835  // obtain circle width and resolution
1836  const double circleWidth = GNEEdge::SNAP_RADIUS * MIN2((double)1, s.laneWidthExaggeration) / 2;
1837  // obtain custom shape
1839  // set color (override with special colors unless the color scheme is based on selection)
1840  if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1842  } else {
1843  GLHelper::setColor(s.junctionColorer.getSchemes()[0].getColor(2));
1844  }
1845  // push start matrix
1847  // move to shape start position
1848  glTranslated(customShape.front().x(), customShape.front().y(), 0.1);
1849  // draw circle
1851  // draw s depending of detail
1853  // move top
1854  glTranslated(0, 0, 0.1);
1855  // draw "S"
1856  GLHelper::drawText("S", Position(), 0.1, circleWidth, RGBColor::WHITE);
1857  }
1858  // pop start matrix
1860  // draw line between junction and start position
1862  // move top
1863  glTranslated(0, 0, 0.1);
1864  // set line width
1865  glLineWidth(4);
1866  // draw line
1868  // pop line matrix
1870  // push start matrix
1872  // move to end position
1873  glTranslated(customShape.back().x(), customShape.back().y(), 0.1);
1874  // draw filled circle
1876  // draw "e" depending of detail
1878  // move top
1879  glTranslated(0, 0, 0.1);
1880  // draw "E"
1881  GLHelper::drawText("E", Position(), 0, circleWidth, RGBColor::WHITE);
1882  }
1883  // pop start matrix
1885  // draw line between Junction and end position
1887  // move top
1888  glTranslated(0, 0, 0.1);
1889  // set line width
1890  glLineWidth(4);
1891  // draw line
1893  // pop line matrix
1895  }
1896 }
1897 
1898 
1899 std::string
1901  return myParentEdge->getID();
1902 }
1903 
1904 
1905 long
1906 GNELane::onDefault(FXObject* obj, FXSelector sel, void* data) {
1907  myNet->getViewNet()->getViewParent()->getTLSEditorFrame()->handleMultiChange(this, obj, sel, data);
1908  return 1;
1909 }
1910 
1911 
1912 std::vector<GNEConnection*>
1914  // Declare a vector to save incoming connections
1915  std::vector<GNEConnection*> incomingConnections;
1916  // Obtain incoming edges if junction source was already created
1917  GNEJunction* junctionSource = myParentEdge->getFromJunction();
1918  if (junctionSource) {
1919  // Iterate over incoming GNEEdges of junction
1920  for (const auto& incomingEdge : junctionSource->getGNEIncomingEdges()) {
1921  // Iterate over connection of incoming edges
1922  for (const auto& connection : incomingEdge->getGNEConnections()) {
1923  if (connection->getLaneFrom()->getIndex() == getIndex()) {
1924  incomingConnections.push_back(connection);
1925  }
1926  }
1927  }
1928  }
1929  return incomingConnections;
1930 }
1931 
1932 
1933 std::vector<GNEConnection*>
1935  // Obtain GNEConnection of parent edge
1936  const std::vector<GNEConnection*>& edgeConnections = myParentEdge->getGNEConnections();
1937  std::vector<GNEConnection*> outcomingConnections;
1938  // Obtain outgoing connections
1939  for (const auto& connection : edgeConnections) {
1940  if (connection->getLaneTo()->getIndex() == getIndex()) {
1941  outcomingConnections.push_back(connection);
1942  }
1943  }
1944  return outcomingConnections;
1945 }
1946 
1947 
1948 void
1950  // update incoming connections of lane
1951  std::vector<GNEConnection*> incomingConnections = getGNEIncomingConnections();
1952  for (const auto& incomingConnection : incomingConnections) {
1953  incomingConnection->updateConnectionID();
1954  }
1955  // update outcoming connections of lane
1956  std::vector<GNEConnection*> outcomingConnections = getGNEOutcomingConnections();
1957  for (const auto& outcomingConnection : outcomingConnections) {
1958  outcomingConnection->updateConnectionID();
1959  }
1960 }
1961 
1962 
1963 double
1965  // factor should not be 0
1966  if (myParentEdge->getNBEdge()->getFinalLength() > 0) {
1967  return MAX2(POSITION_EPS, (getLaneShape().length() / myParentEdge->getNBEdge()->getFinalLength()));
1968  } else {
1969  return POSITION_EPS;
1970  };
1971 }
1972 
1973 
1974 void
1976  // Create basic commands
1977  std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
1979  if (edgeSelSize && myParentEdge->isAttributeCarrierSelected() && (edgeSelSize > 1)) {
1980  edgeDescPossibleMulti = toString(edgeSelSize) + " " + toString(SUMO_TAG_EDGE) + "s";
1981  }
1982  // create menu pane for edge operations
1983  FXMenuPane* edgeOperations = new FXMenuPane(ret);
1984  ret->insertMenuPaneChild(edgeOperations);
1985  if (edgeSelSize > 0) {
1986  new FXMenuCascade(ret, TLF("Edge operations (% selected)", toString(edgeSelSize)).c_str(), nullptr, edgeOperations);
1987  } else {
1988  new FXMenuCascade(ret, TL("Edge operations"), nullptr, edgeOperations);
1989  }
1990  // create menu commands for all edge operations
1991  GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Split edge here"), nullptr, &parent, MID_GNE_EDGE_SPLIT);
1992  auto splitBothDirections = GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Split edge in both directions here (no symmetric opposite edge)"), nullptr, &parent, MID_GNE_EDGE_SPLIT_BIDI);
1993  // check if allow split edge in both directions
1994  splitBothDirections->disable();
1995  const auto oppositeEdges = myParentEdge->getOppositeEdges();
1996  if (oppositeEdges.size() == 0) {
1997  splitBothDirections->setText(TL("Split edge in both directions here (no opposite edge)"));
1998  } else {
1999  for (const auto& oppositeEdge : oppositeEdges) {
2000  // get reverse inner geometry
2001  const auto reverseGeometry = oppositeEdge->getNBEdge()->getInnerGeometry().reverse();
2002  if (reverseGeometry == myParentEdge->getNBEdge()->getInnerGeometry()) {
2003  splitBothDirections->enable();
2004  splitBothDirections->setText(TL("Split edge in both directions here"));
2005  }
2006  }
2007  }
2008  GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Set geometry endpoint here (shift-click)"), nullptr, &parent, MID_GNE_EDGE_EDIT_ENDPOINT);
2009  // restore geometry points depending of selection status
2011  if (edgeSelSize == 1) {
2012  GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Restore both geometry endpoints"), nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
2013  } else {
2014  GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Restore geometry endpoints of all selected edges"), nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
2015  }
2016  } else {
2017  GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Restore geometry endpoint (shift-click)"), nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
2018  }
2019  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Reverse %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_REVERSE);
2020  auto reverse = GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Add reverse direction for %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE);
2021  if (myParentEdge->getReverseEdge() != nullptr) {
2022  reverse->disable();
2023  }
2024  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Add reverse disconnected direction for %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE_DISCONNECTED);
2025  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Reset lengths for %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_RESET_LENGTH);
2026  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Straighten %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN);
2027  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Smooth %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_SMOOTH);
2028  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Straighten elevation of %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN_ELEVATION);
2029  GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Smooth elevation of %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_SMOOTH_ELEVATION);
2030 }
2031 
2032 
2033 void
2035  // Get icons
2036  FXIcon* pedestrianIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_PEDESTRIAN);
2037  FXIcon* bikeIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_BIKE);
2038  FXIcon* busIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_BUS);
2039  FXIcon* greenVergeIcon = GUIIconSubSys::getIcon(GUIIcon::LANEGREENVERGE);
2040  // declare number of selected lanes
2041  int numSelectedLanes = 0;
2042  // if lane is selected, calculate number of restricted lanes
2043  bool edgeHasSidewalk = false;
2044  bool edgeHasBikelane = false;
2045  bool edgeHasBuslane = false;
2046  bool differentLaneShapes = false;
2048  const auto selectedLanes = myNet->getAttributeCarriers()->getSelectedLanes();
2049  // update numSelectedLanes
2050  numSelectedLanes = (int)selectedLanes.size();
2051  // iterate over selected lanes
2052  for (const auto& selectedLane : selectedLanes) {
2053  if (selectedLane->myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN)) {
2054  edgeHasSidewalk = true;
2055  }
2056  if (selectedLane->myParentEdge->hasRestrictedLane(SVC_BICYCLE)) {
2057  edgeHasBikelane = true;
2058  }
2059  if (selectedLane->myParentEdge->hasRestrictedLane(SVC_BUS)) {
2060  edgeHasBuslane = true;
2061  }
2062  if (selectedLane->myParentEdge->getNBEdge()->getLaneStruct(selectedLane->getIndex()).customShape.size() != 0) {
2063  differentLaneShapes = true;
2064  }
2065  }
2066  } else {
2067  edgeHasSidewalk = myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN);
2068  edgeHasBikelane = myParentEdge->hasRestrictedLane(SVC_BICYCLE);
2069  edgeHasBuslane = myParentEdge->hasRestrictedLane(SVC_BUS);
2070  differentLaneShapes = myParentEdge->getNBEdge()->getLaneStruct(myIndex).customShape.size() != 0;
2071  }
2072  // create menu pane for lane operations
2073  FXMenuPane* laneOperations = new FXMenuPane(ret);
2074  ret->insertMenuPaneChild(laneOperations);
2075  if (numSelectedLanes > 0) {
2076  new FXMenuCascade(ret, TLF("Lane operations (% selected)", toString(numSelectedLanes)).c_str(), nullptr, laneOperations);
2077  } else {
2078  new FXMenuCascade(ret, TL("Lane operations"), nullptr, laneOperations);
2079  }
2080  GUIDesigns::buildFXMenuCommand(laneOperations, TL("Duplicate lane"), nullptr, &parent, MID_GNE_LANE_DUPLICATE);
2081  GUIDesigns::buildFXMenuCommand(laneOperations, TL("Set custom lane shape"), nullptr, &parent, MID_GNE_LANE_EDIT_SHAPE);
2082  FXMenuCommand* resetCustomShape = GUIDesigns::buildFXMenuCommand(laneOperations, TL("Reset custom shape"), nullptr, &parent, MID_GNE_LANE_RESET_CUSTOMSHAPE);
2083  if (!differentLaneShapes) {
2084  resetCustomShape->disable();
2085  }
2086  FXMenuCommand* resetOppositeLane = GUIDesigns::buildFXMenuCommand(laneOperations, TL("Reset opposite lane"), nullptr, &parent, MID_GNE_LANE_RESET_OPPOSITELANE);
2087  if (getAttribute(GNE_ATTR_OPPOSITE).empty()) {
2088  resetOppositeLane->disable();
2089  }
2090  // Create panel for lane operations and insert it in ret
2091  FXMenuPane* addSpecialLanes = new FXMenuPane(laneOperations);
2092  ret->insertMenuPaneChild(addSpecialLanes);
2093  FXMenuPane* removeSpecialLanes = new FXMenuPane(laneOperations);
2094  ret->insertMenuPaneChild(removeSpecialLanes);
2095  FXMenuPane* transformSlanes = new FXMenuPane(laneOperations);
2096  ret->insertMenuPaneChild(transformSlanes);
2097  // Create menu comands for all add special lanes
2098  FXMenuCommand* addSidewalk = GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Sidewalk"), pedestrianIcon, &parent, MID_GNE_LANE_ADD_SIDEWALK);
2099  FXMenuCommand* addBikelane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Bike lane"), bikeIcon, &parent, MID_GNE_LANE_ADD_BIKE);
2100  FXMenuCommand* addBuslane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Bus lane"), busIcon, &parent, MID_GNE_LANE_ADD_BUS);
2101  // if parent edge is selected, always add greenverge in front
2103  GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Green verge"), greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_FRONT);
2104  } else {
2105  GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Green verge (front)"), greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_FRONT);
2106  GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Green verge (back)"), greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_BACK);
2107  }
2108  // Create menu comands for all remove special lanes and disable it
2109  FXMenuCommand* removeSidewalk = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Sidewalk"), pedestrianIcon, &parent, MID_GNE_LANE_REMOVE_SIDEWALK);
2110  removeSidewalk->disable();
2111  FXMenuCommand* removeBikelane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Bike lane"), bikeIcon, &parent, MID_GNE_LANE_REMOVE_BIKE);
2112  removeBikelane->disable();
2113  FXMenuCommand* removeBuslane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Bus lane"), busIcon, &parent, MID_GNE_LANE_REMOVE_BUS);
2114  removeBuslane->disable();
2115  FXMenuCommand* removeGreenVerge = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Green verge"), greenVergeIcon, &parent, MID_GNE_LANE_REMOVE_GREENVERGE);
2116  removeGreenVerge->disable();
2117  // Create menu comands for all transform special lanes and disable it
2118  FXMenuCommand* transformLaneToSidewalk = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Sidewalk"), pedestrianIcon, &parent, MID_GNE_LANE_TRANSFORM_SIDEWALK);
2119  FXMenuCommand* transformLaneToBikelane = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Bike lane"), bikeIcon, &parent, MID_GNE_LANE_TRANSFORM_BIKE);
2120  FXMenuCommand* transformLaneToBuslane = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Bus lane"), busIcon, &parent, MID_GNE_LANE_TRANSFORM_BUS);
2121  FXMenuCommand* transformLaneToGreenVerge = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Green verge"), greenVergeIcon, &parent, MID_GNE_LANE_TRANSFORM_GREENVERGE);
2122  // add menuCascade for lane operations
2123  new FXMenuCascade(laneOperations, TLF("Add restricted %", toString(SUMO_TAG_LANE)).c_str(), nullptr, addSpecialLanes);
2124  FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(laneOperations, TLF("Remove restricted %", toString(SUMO_TAG_LANE)).c_str(), nullptr, removeSpecialLanes);
2125  new FXMenuCascade(laneOperations, TLF("Transform to restricted %", toString(SUMO_TAG_LANE)).c_str(), nullptr, transformSlanes);
2126  // Enable and disable options depending of current transform of the lane
2127  if (edgeHasSidewalk) {
2128  transformLaneToSidewalk->disable();
2129  addSidewalk->disable();
2130  removeSidewalk->enable();
2131  }
2132  if (edgeHasBikelane) {
2133  transformLaneToBikelane->disable();
2134  addBikelane->disable();
2135  removeBikelane->enable();
2136  }
2137  if (edgeHasBuslane) {
2138  transformLaneToBuslane->disable();
2139  addBuslane->disable();
2140  removeBuslane->enable();
2141  }
2142  if (isRestricted(SVC_IGNORING)) {
2143  transformLaneToGreenVerge->disable();
2144  removeGreenVerge->enable();
2145  }
2146  // Check if cascade menu must be disabled
2147  if (!edgeHasSidewalk && !edgeHasBikelane && !edgeHasBuslane && !isRestricted(SVC_IGNORING)) {
2148  cascadeRemoveSpecialLane->disable();
2149  }
2150  // for whatever reason, sonar complains in the next line that cascadeRemoveSpecialLane may leak, but fox does the cleanup
2151 } // NOSONAR
2152 
2153 
2154 void
2156  // Create basic commands
2157  std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
2159  if (edgeSelSize && myParentEdge->isAttributeCarrierSelected() && (edgeSelSize > 1)) {
2160  edgeDescPossibleMulti = toString(edgeSelSize) + " " + toString(SUMO_TAG_EDGE) + "s";
2161  }
2162  // create menu pane for edge operations
2163  FXMenuPane* edgeOperations = new FXMenuPane(ret);
2164  ret->insertMenuPaneChild(edgeOperations);
2165  if (edgeSelSize > 0) {
2166  new FXMenuCascade(ret, TLF("Template operations (% selected)", toString(edgeSelSize)).c_str(), nullptr, edgeOperations);
2167  } else {
2168  new FXMenuCascade(ret, TL("Template operations"), nullptr, edgeOperations);
2169  }
2170  // create menu commands for all edge operations
2171  GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Use edge as template"), nullptr, &parent, MID_GNE_EDGE_USEASTEMPLATE);
2172  auto applyTemplate = GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Apply template"), nullptr, &parent, MID_GNE_EDGE_APPLYTEMPLATE);
2173  // check if disable apply template
2175  applyTemplate->disable();
2176  }
2177 
2178 }
2179 
2180 
2181 void
2183  // addreachability menu
2184  FXMenuPane* reachableByClass = new FXMenuPane(ret);
2185  ret->insertMenuPaneChild(reachableByClass);
2186  if (myNet->isNetRecomputed()) {
2187  new FXMenuCascade(ret, TL("Select reachable"), GUIIconSubSys::getIcon(GUIIcon::MODEVEHICLE), reachableByClass);
2188  for (const auto& vClass : SumoVehicleClassStrings.getStrings()) {
2189  GUIDesigns::buildFXMenuCommand(reachableByClass, vClass.c_str(), VClassIcons::getVClassIcon(SumoVehicleClassStrings.get(vClass)), &parent, MID_REACHABILITY);
2190  }
2191  } else {
2192  FXMenuCommand* menuCommand = GUIDesigns::buildFXMenuCommand(ret, TL("Select reachable (compute junctions)"), nullptr, nullptr, 0);
2193  menuCommand->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
2194  }
2195 }
2196 
2197 /****************************************************************************/
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
@ DEMAND_PERSONPLAN
Mode for editing person plan.
@ DEMAND_CONTAINER
Mode for editing container.
@ DEMAND_PERSON
Mode for editing person.
@ DEMAND_CONTAINERPLAN
Mode for editing container plan.
@ MID_GNE_ADDSELECT_EDGE
Add edge to selected items - menu entry.
Definition: GUIAppEnum.h:841
@ MID_GNE_LANE_EDIT_SHAPE
edit lane shape
Definition: GUIAppEnum.h:1320
@ MID_GNE_LANE_TRANSFORM_BIKE
transform lane to bikelane
Definition: GUIAppEnum.h:1328
@ MID_GNE_EDGE_REVERSE
reverse an edge
Definition: GUIAppEnum.h:1230
@ MID_ADDSELECT
Add to selected items - menu entry.
Definition: GUIAppEnum.h:481
@ MID_GNE_LANE_ADD_BUS
add busLane
Definition: GUIAppEnum.h:1338
@ MID_GNE_REMOVESELECT_EDGE
Remove edge from selected items - Menu Entry.
Definition: GUIAppEnum.h:843
@ MID_GNE_EDGE_STRAIGHTEN_ELEVATION
interpolate z values linear between junctions
Definition: GUIAppEnum.h:1222
@ MID_GNE_EDGE_SMOOTH
smooth geometry
Definition: GUIAppEnum.h:1220
@ MID_GNE_LANE_RESET_CUSTOMSHAPE
reset custom shape
Definition: GUIAppEnum.h:1322
@ MID_GNE_EDGE_STRAIGHTEN
remove inner geometry
Definition: GUIAppEnum.h:1218
@ MID_GNE_LANE_TRANSFORM_BUS
transform lane to busLane
Definition: GUIAppEnum.h:1330
@ MID_COPY_EDGE_NAME
Copy edge name (for lanes only)
Definition: GUIAppEnum.h:455
@ MID_GNE_LANE_DUPLICATE
duplicate a lane
Definition: GUIAppEnum.h:1318
@ MID_GNE_LANE_ADD_GREENVERGE_FRONT
add greenVerge front of current lane
Definition: GUIAppEnum.h:1340
@ MID_GNE_LANE_REMOVE_GREENVERGE
remove greenVerge
Definition: GUIAppEnum.h:1350
@ MID_GNE_EDGE_ADD_REVERSE_DISCONNECTED
add reverse edge disconnected (used for for spreadtype center)
Definition: GUIAppEnum.h:1234
@ MID_GNE_EDGE_SPLIT_BIDI
split an edge
Definition: GUIAppEnum.h:1228
@ MID_GNE_LANE_REMOVE_BIKE
remove bikelane
Definition: GUIAppEnum.h:1346
@ MID_GNE_LANE_RESET_OPPOSITELANE
reset opposite lane
Definition: GUIAppEnum.h:1324
@ MID_REACHABILITY
show reachability from a given lane
Definition: GUIAppEnum.h:527
@ MID_GNE_EDGE_RESET_LENGTH
reset custom lengths
Definition: GUIAppEnum.h:1236
@ MID_GNE_LANE_REMOVE_BUS
remove busLane
Definition: GUIAppEnum.h:1348
@ MID_GNE_LANE_REMOVE_SIDEWALK
remove sidewalk
Definition: GUIAppEnum.h:1344
@ MID_GNE_EDGE_RESET_ENDPOINT
reset default geometry endpoints
Definition: GUIAppEnum.h:1216
@ MID_GNE_LANE_ADD_GREENVERGE_BACK
add greenVerge back of current lane
Definition: GUIAppEnum.h:1342
@ MID_GNE_EDGE_SMOOTH_ELEVATION
smooth elevation with regard to adjoining edges
Definition: GUIAppEnum.h:1224
@ MID_GNE_EDGE_ADD_REVERSE
add reverse edge
Definition: GUIAppEnum.h:1232
@ MID_GNE_EDGE_APPLYTEMPLATE
apply template
Definition: GUIAppEnum.h:1240
@ MID_GNE_EDGE_USEASTEMPLATE
use edge as tempalte
Definition: GUIAppEnum.h:1238
@ MID_GNE_LANE_ADD_SIDEWALK
add sidewalk
Definition: GUIAppEnum.h:1334
@ MID_GNE_RESET_GEOMETRYPOINT
reset geometry point
Definition: GUIAppEnum.h:1021
@ MID_GNE_LANE_TRANSFORM_SIDEWALK
transform lane to sidewalk
Definition: GUIAppEnum.h:1326
@ MID_GNE_LANE_ADD_BIKE
add bikelane
Definition: GUIAppEnum.h:1336
@ MID_GNE_EDGE_SPLIT
split an edge
Definition: GUIAppEnum.h:1226
@ MID_GNE_LANE_TRANSFORM_GREENVERGE
transform lane to greenVerge
Definition: GUIAppEnum.h:1332
@ MID_GNE_CUSTOM_GEOMETRYPOINT
set custom geometry point
Definition: GUIAppEnum.h:1019
@ MID_GNE_EDGE_EDIT_ENDPOINT
change default geometry endpoints
Definition: GUIAppEnum.h:1214
@ MID_REMOVESELECT
Remove from selected items - Menu Entry.
Definition: GUIAppEnum.h:483
@ 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 permission is a railway edge.
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
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_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
GNEPlanSelector * getPlanSelector() const
get containerPlan selector
GNEPlanSelector * getPlanSelector() const
get containerPlan selector
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:562
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:683
GNEEdge * getReverseEdge() const
get reverse edge (if exist)
Definition: GNEEdge.cpp:1706
bool clickedOverGeometryPoint(const Position &pos) const
return true if user clicked over a Geometry Point
Definition: GNEEdge.cpp:515
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:82
static const double SNAP_RADIUS
Definition: GNEEdge.h:302
bool hasCustomEndPoints() const
Definition: GNEEdge.cpp:479
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
Definition: GNEEdge.cpp:2240
std::vector< GNEEdge * > getOppositeEdges() const
get opposite edges
Definition: GNEEdge.cpp:624
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
Definition: GNEEdge.cpp:1053
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:360
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:214
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
Definition: GNELane.cpp:1906
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:684
~GNELane()
Destructor.
Definition: GNELane.cpp:188
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNELane.cpp:1900
std::string getAttribute(SumoXMLAttr key) const
Definition: GNELane.cpp:690
void drawLaneStopOffset(const GUIVisualizationSettings &s) const
draw laneStopOffset
Definition: GNELane.cpp:1682
void drawSelectedLane(const GUIVisualizationSettings &s) const
draw selected lane
Definition: GNELane.cpp:1072
bool checkDrawMoveContour() const
check if draw move contour (red)
Definition: GNELane.cpp:429
std::vector< double > myLaneRestrictedTextureRotations
Rotations of textures of restricted lanes.
Definition: GNELane.h:347
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:1138
const RGBColor * mySpecialColor
optional special color
Definition: GNELane.h:351
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNELane.cpp:319
bool isAttributeComputed(SumoXMLAttr key) const
Definition: GNELane.cpp:869
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
Definition: GNELane.cpp:1706
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
Definition: GNELane.cpp:393
double getLengthGeometryFactor() const
get length geometry factor
Definition: GNELane.cpp:1964
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNELane.cpp:855
void drawDirectionIndicators(const GUIVisualizationSettings &s) const
direction indicators for lanes
Definition: GNELane.cpp:1712
bool checkDrawSelectContour() const
check if draw select contour (blue)
Definition: GNELane.cpp:411
void updateGeometry()
update pre-computed geometry information
Definition: GNELane.cpp:242
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNELane.cpp:999
GNEEdge * myParentEdge
parent edge (GNELanes cannot use hierarchical structures)
Definition: GNELane.h:329
void deleteGLObject()
delete element
Definition: GNELane.cpp:498
std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
Definition: GNELane.cpp:749
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNELane.cpp:514
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:642
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNELane.cpp:624
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition: GNELane.cpp:452
GUIGeometry myLaneGeometry
lane geometry
Definition: GNELane.h:335
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:1091
void drawOverlappedRoutes(const int numRoutes) const
draw overlapped routes
Definition: GNELane.cpp:1665
void calculateLaneContour(const GUIVisualizationSettings &s) const
calculate contour
Definition: GNELane.cpp:1401
void updateGLObject()
update GLObject (geometry, ID, etc.)
Definition: GNELane.cpp:507
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNELane.cpp:440
void drawLane(const GUIVisualizationSettings &s) const
draw lane
Definition: GNELane.cpp:1017
void buildLaneOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build lane operations contextual menu
Definition: GNELane.cpp:2034
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:1934
DrawingConstants * myDrawingConstants
LaneDrawingConstants.
Definition: GNELane.h:338
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:2155
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:1529
void drawTLSLinkNo(const GUIVisualizationSettings &s) const
draw TLS link Number
Definition: GNELane.cpp:1228
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNELane.cpp:881
double getLaneParametricLength() const
returns the parameteric length of the lane
Definition: GNELane.cpp:661
RGBColor setLaneColor(const GUIVisualizationSettings &s) const
set color according to edit mode and visualisation settings
Definition: GNELane.cpp:1417
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNELane.cpp:790
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1913
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
Definition: GNELane.cpp:678
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:332
void drawLaneAsRailway() const
draw lane as railway
Definition: GNELane.cpp:1754
void setIndex(int index)
Definition: GNELane.cpp:648
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNELane.cpp:478
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:887
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:630
void drawArrows(const GUIVisualizationSettings &s) const
draw lane arrows
Definition: GNELane.cpp:1265
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNELane.cpp:636
double mySpecialColorValue
optional value that corresponds to which the special color corresponds
Definition: GNELane.h:354
void drawChildren(const GUIVisualizationSettings &s) const
draw children
Definition: GNELane.cpp:1117
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:344
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNELane.cpp:1008
double getLaneShapeLength() const
returns the length of the lane's shape
Definition: GNELane.cpp:672
void drawStartEndGeometryPoints(const GUIVisualizationSettings &s) const
draw start and end geometry points
Definition: GNELane.cpp:1832
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition: GNELane.h:357
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
return value for lane coloring according to the given scheme
Definition: GNELane.cpp:1553
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:1515
void updateConnectionIDs()
update IDs of incoming connections of this lane
Definition: GNELane.cpp:1949
void buildRechableOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build rechable operations contextual menu
Definition: GNELane.cpp:2182
void drawLane2LaneConnections() const
draw lane to lane connections
Definition: GNELane.cpp:1353
void buildEdgeOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build edge operations contextual menu
Definition: GNELane.cpp:1975
const std::vector< double > & getShapeLengths() const
get lengths of the single shape parts
Definition: GNELane.cpp:230
void drawLinkNo(const GUIVisualizationSettings &s) const
draw link Number
Definition: GNELane.cpp:1191
double getSpeed() const
returns the current speed of lane
Definition: GNELane.cpp:655
void drawTextures(const GUIVisualizationSettings &s) const
draw lane textures
Definition: GNELane.cpp:1800
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNELane.cpp:759
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:578
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:122
bool isNetRecomputed() const
check if net require recomputing
Definition: GNENet.cpp:1440
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:134
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
Definition: GNENet.cpp:2067
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2055
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
GNEPlanSelector * getPlanSelector() const
get personPlan selector
GNEPlanSelector * getPlanSelector() const
get personPlan selector
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 GUIGlObject * getGUIGlObjectFront() const
get front attribute carrier or a pointer to nullptr
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:703
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:715
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
bool isMovingElement() const
check if an element is being moved
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 GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
Definition: GNEViewNet.cpp:468
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
GNEPersonPlanFrame * getPersonPlanFrame() const
get frame for DEMAND_PERSONFRAME
GNEContainerPlanFrame * getContainerPlanFrame() const
get frame for DEMAND_CONTAINERFRAME
GNEDeleteFrame * getDeleteFrame() const
get frame for delete elements
GNEVehicleFrame * getVehicleFrame() const
get frame for DEMAND_VEHICLE
GNETLSEditorFrame * getTLSEditorFrame() const
get frame for NETWORK_TLS
GNEContainerFrame * getContainerFrame() const
get frame for DEMAND_CONTAINER
GNEPersonFrame * getPersonFrame() const
get frame for DEMAND_PERSON
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 isElementSelected(const GUIGlObject *GLObject) const
check if element was already selected
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:2160
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:4299
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:4308
double getDistancAt(double pos) const
get distance at the given offset
Definition: NBEdge.cpp:4846
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:4271
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:4223
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:1760
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition: NBEdge.cpp:730
const std::string & getID() const
Definition: NBEdge.h:1522
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:542
NBNode * myTo
Definition: NBEdge.h:1730
bool allowsChangingRight(int lane, SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
Definition: NBEdge.cpp:4455
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:4094
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
Definition: NBEdge.cpp:4255
bool isBidiEdge(bool checkPotential=false) const
whether this edge is part of a bidirectional edge pair
Definition: NBEdge.cpp:742
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:1252
void setFriction(int lane, double friction)
set lane specific friction (negative lane implies set for all lanes)
Definition: NBEdge.cpp:4239
std::string getLaneID(int lane) const
get lane ID
Definition: NBEdge.cpp:3946
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
Definition: NBEdge.cpp:4263
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:4177
bool allowsChangingLeft(int lane, SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
Definition: NBEdge.cpp:4449
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:1130
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:967
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1422
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition: NBEdge.cpp:583
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:4644
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:2349
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:2432
int getConnectionIndex(const NBEdge *from, const NBEdge::Connection &con) const
return the index of the given connection
Definition: NBNode.cpp:3921
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:281
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 reset()
reset stopOffset
void setExceptions(const std::string permissions)
set exceptions (used in netedit)
std::string getExceptions() const
get exceptions (used in netedit)
double getOffset() const
get offset
T get(const std::string &str) const
std::vector< std::string > getStrings() const
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
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
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