Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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>
37#include <netbuild/NBEdgeCont.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
58FXIMPLEMENT(GNELane, FXDelegator, 0, 0)
59
60// ===========================================================================
61// method definitions
62// ===========================================================================
63
64// ---------------------------------------------------------------------------
65// GNELane::LaneDrawingConstants - methods
66// ---------------------------------------------------------------------------
67
69 myLane(lane) {
70}
71
72
73void
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;
110 } else {
111 // restore offset
112 myOffset = 0;
113 }
114}
115
116
117double
119 return myExaggeration;
120}
121
122
123double
125 return myDrawingWidth;
126}
127
128
129double
131 return myInternalDrawingWidth;
132}
133
134
135double
137 return myOffset;
138}
139
140
143 return myDetail;
144}
145
146
147bool
149 return myDrawAsRailway;
150}
151
152
153bool
155 return myDrawSuperposed;
156}
157
158// ---------------------------------------------------------------------------
159// GNELane - methods
160// ---------------------------------------------------------------------------
161
162GNELane::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),
170myLane2laneConnections(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), {}, {}, {}, {}, {}, {}),
179myParentEdge(nullptr),
180myIndex(-1),
181myDrawingConstants(nullptr),
182mySpecialColor(nullptr),
183mySpecialColorValue(-1),
184myLane2laneConnections(this) {
185}
186
187
189 if (myDrawingConstants) {
190 delete myDrawingConstants;
191 }
192}
193
194
195GNEEdge*
197 return myParentEdge;
198}
199
200
201bool
205
206
207const GUIGeometry&
209 return myLaneGeometry;
210}
211
212
213const PositionVector&
221
222
223const std::vector<double>&
227
228
229const std::vector<double>&
233
234
239
240
241void
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
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
320 return getLaneShape().positionAtOffset2D(getLaneShape().length2D() * 0.5);
321}
322
323
324bool
326 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
327 // check if we're inspecting a connection
328 if (inspectedElements.isInspectingSingleElement() && (inspectedElements.getFirstAC()->getTagProperty().getTag() == SUMO_TAG_CONNECTION) &&
329 inspectedElements.getFirstAC()->getAttribute(GNE_ATTR_FROM_LANEID) == getID()) {
330 return true;
331 } else {
332 return false;
333 }
334}
335
336
337bool
339 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
340 // check if we're inspecting a connection
341 if (inspectedElements.isInspectingSingleElement() && (inspectedElements.getFirstAC()->getTagProperty().getTag() == SUMO_TAG_CONNECTION) &&
342 inspectedElements.getFirstAC()->getAttribute(GNE_ATTR_TO_LANEID) == getID()) {
343 return true;
344 } else {
345 return false;
346 }
347}
348
349
350bool
352 return false;
353}
354
355
356bool
358 return false;
359}
360
361
362bool
364 // first check if we're selecting edges or lanes
366 return false;
367 } else {
368 // get edit modes
369 const auto& editModes = myNet->getViewNet()->getEditModes();
370 // check if we're in delete mode
371 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
373 } else {
374 return false;
375 }
376 }
377}
378
379
380bool
382 // first check if we're selecting edges or lanes
384 return false;
385 } else {
386 // get edit modes
387 const auto& editModes = myNet->getViewNet()->getEditModes();
388 // check if we're in select mode
389 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
391 } else {
392 return false;
393 }
394 }
395}
396
397
398bool
400 // check if we're editing this network element
402 if (editedNetworkElement) {
403 return editedNetworkElement == this;
404 } else {
405 return false;
406 }
407}
408
409
412 // edit depending if shape is being edited
413 if (isShapeEdited()) {
414 // calculate move shape operation
415 return calculateMoveShapeOperation(this, getLaneShape(), false);
416 } else {
417 return nullptr;
418 }
419}
420
421
422void
423GNELane::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
424 // edit depending if shape is being edited
425 if (isShapeEdited()) {
426 // get original shape
428 // check shape size
429 if (shape.size() > 2) {
430 // obtain index
431 int index = shape.indexOfClosest(clickedPosition);
432 // get snap radius
434 // check if we have to create a new index
435 if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
436 // remove geometry point
437 shape.erase(shape.begin() + index);
438 // commit new shape
439 undoList->begin(this, "remove geometry point of " + getTagStr());
441 undoList->end();
442 }
443 }
444 }
445}
446
447
448void
450 // update lane drawing constan
452 // calculate layer
453 double layer = GLO_LANE;
455 layer = GLO_FRONTELEMENT;
457 layer = GLO_JUNCTION + 2;
458 }
459 // check drawing conditions
461 // draw lane
462 drawLane(s, layer);
463 // draw lock icon
465 // draw dotted contour
467 }
468 // calculate contour (always before children)
469 calculateLaneContour(s, layer);
470 // draw children
471 drawChildren(s);
472}
473
474
475void
477 // Check if edge can be deleted
479 myNet->deleteLane(this, myNet->getViewNet()->getUndoList(), false);
480 }
481}
482
483
484void
488
489
490
493 // first obtain edit mode (needed because certain Commands depend of current edit mode)
495 // get mouse position
496 const auto mousePosition = myNet->getViewNet()->getPositionInformation();
497 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
498 buildPopupHeader(ret, app);
500 // build copy names entry
501 if (editMode != NetworkEditMode::NETWORK_TLS) {
502 GUIDesigns::buildFXMenuCommand(ret, TL("Copy parent edge name to clipboard"), nullptr, ret, MID_COPY_EDGE_NAME);
504 }
505 // stop if we're in data mode
507 return ret;
508 }
509 // build lane selection
512 } else {
514 }
515 // build edge selection
518 } else {
520 }
521 // stop if we're in data mode
523 return ret;
524 }
525 // add separator
526 new FXMenuSeparator(ret);
527 if (editMode != NetworkEditMode::NETWORK_TLS) {
528 // build show parameters menu
530 // build position copy entry
531 buildPositionCopyEntry(ret, app);
532 }
533 // check if we're in supermode network
535 // create end point
536 FXMenuCommand* resetEndPoints = GUIDesigns::buildFXMenuCommand(ret, TL("Reset edge end points"), nullptr, &parent, MID_GNE_RESET_GEOMETRYPOINT);
537 // enable or disable reset end points
539 resetEndPoints->enable();
540 } else {
541 resetEndPoints->disable();
542 }
543 // check if we clicked over a geometry point
544 if ((editMode == NetworkEditMode::NETWORK_MOVE) && myParentEdge->clickedOverGeometryPoint(mousePosition)) {
545 GUIDesigns::buildFXMenuCommand(ret, TL("Set custom Geometry Point"), nullptr, &parent, MID_GNE_CUSTOM_GEOMETRYPOINT);
546 }
547 // add separator
548 new FXMenuSeparator(ret);
549 //build operations
550 if ((editMode != NetworkEditMode::NETWORK_CONNECT) && (editMode != NetworkEditMode::NETWORK_TLS)) {
551 // build edge operations
552 buildEdgeOperations(parent, ret);
553 // build lane operations
554 buildLaneOperations(parent, ret);
555 // build template operations
556 buildTemplateOperations(parent, ret);
557 // add separator
558 new FXMenuSeparator(ret);
559 // build rechable operations
560 buildRechableOperations(parent, ret);
561 } else if (editMode == NetworkEditMode::NETWORK_TLS) {
563 GUIDesigns::buildFXMenuCommand(ret, TL("Select state for all links from this edge:"), nullptr, nullptr, 0);
564 const std::vector<std::string> names = GNEInternalLane::LinkStateNames.getStrings();
565 for (auto it : names) {
566 FXuint state = GNEInternalLane::LinkStateNames.get(it);
567 FXMenuRadio* mc = new FXMenuRadio(ret, it.c_str(), this, FXDataTarget::ID_OPTION + state);
570 }
571 }
572 } else {
573 FXMenuCommand* mc = GUIDesigns::buildFXMenuCommand(ret, TL("Additional options available in 'Inspect Mode'"), nullptr, nullptr, 0);
574 mc->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
575 }
576 // build shape positions menu
577 if (editMode != NetworkEditMode::NETWORK_TLS) {
578 new FXMenuSeparator(ret);
579 // get lane shape
580 const auto& laneShape = myLaneGeometry.getShape();
581 // get variables
582 const double pos = laneShape.nearest_offset_to_point2D(mousePosition);
583 const Position firstAnglePos = laneShape.positionAtOffset2D(pos - 0.001);
584 const Position secondAnglePos = laneShape.positionAtOffset2D(pos);
585 const double angle = firstAnglePos.angleTo2D(secondAnglePos);
586
587 // build menu commands
588 GUIDesigns::buildFXMenuCommand(ret, TL("Shape pos: ") + toString(pos), nullptr, nullptr, 0);
589 GUIDesigns::buildFXMenuCommand(ret, TL("Length pos: ") + toString(pos * getLaneParametricLength() / getLaneShapeLength()), nullptr, nullptr, 0);
590 if (myParentEdge->getNBEdge()->getDistance() != 0) {
591 GUIDesigns::buildFXMenuCommand(ret, TL("Distance: ") + toString(myParentEdge->getNBEdge()->getDistancAt(pos)), nullptr, nullptr, 0);
592 }
593 GUIDesigns::buildFXMenuCommand(ret, TL("Height: ") + toString(firstAnglePos.z()), nullptr, nullptr, 0);
594 GUIDesigns::buildFXMenuCommand(ret, TL("Angle: ") + toString((GeomHelper::naviDegree(angle))), nullptr, nullptr, 0);
595 }
596 }
597 return ret;
598}
599
600
601double
603 return s.addSize.getExaggeration(s, this);
604}
605
606
611
612
613void
614GNELane::updateCenteringBoundary(const bool /*updateGrid*/) {
615 // nothing to update
616}
617
618
619int
621 return myIndex;
622}
623
624
625void
627 myIndex = index;
629}
630
631
632double
636
637
638double
640 double laneParametricLength = myParentEdge->getNBEdge()->getLoadedLength();
641 if (laneParametricLength > 0) {
642 return laneParametricLength;
643 } else {
644 throw ProcessError(TL("Lane Parametric Length cannot be never 0"));
645 }
646}
647
648
649double
653
654
655bool
659
660
665
666
667std::string
669 const NBEdge* edge = myParentEdge->getNBEdge();
670 switch (key) {
671 case SUMO_ATTR_ID:
672 return getMicrosimID();
676 return myParentEdge->getToJunction()->getID();
677 case SUMO_ATTR_SPEED:
678 return toString(edge->getLaneSpeed(myIndex));
679 case SUMO_ATTR_ALLOW:
687 case SUMO_ATTR_WIDTH:
689 return "default";
690 } else {
691 return toString(edge->getLaneStruct(myIndex).width);
692 }
694 return toString(edge->getLaneStruct(myIndex).friction);
699 case SUMO_ATTR_SHAPE:
704 case SUMO_ATTR_TYPE:
705 return edge->getLaneStruct(myIndex).type;
706 case SUMO_ATTR_INDEX:
707 return toString(myIndex);
713 } else {
714 return "";
715 }
716 case GNE_ATTR_PARENT:
717 return myParentEdge->getID();
720 default:
721 return getCommonAttribute(key);
722 }
723}
724
725
728 switch (key) {
729 case SUMO_ATTR_SHAPE:
732 default:
733 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
734 }
735}
736
737
738std::string
740 std::string result = getAttribute(key);
741 if ((key == SUMO_ATTR_ALLOW || key == SUMO_ATTR_DISALLOW) && result.find("all") != std::string::npos) {
742 result += " " + getVehicleClassNames(SVCAll, true);
743 }
744 return result;
745}
746
747
748void
749GNELane::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
750 switch (key) {
751 case SUMO_ATTR_ID:
752 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
753 case SUMO_ATTR_SPEED:
754 case SUMO_ATTR_ALLOW:
758 case SUMO_ATTR_WIDTH:
762 case SUMO_ATTR_SHAPE:
765 case SUMO_ATTR_TYPE:
766 case SUMO_ATTR_INDEX:
768 // special case for stop offset, because affects to stopOffsetExceptions (#15297)
769 if (canParse<double>(value) && (parse<double>(value) == 0)) {
771 }
772 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
773 break;
776 // no special handling
777 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
778 break;
779 default:
780 setCommonAttribute(key, value, undoList);
781 break;
782 }
783}
784
785
786bool
787GNELane::isValid(SumoXMLAttr key, const std::string& value) {
788 switch (key) {
789 case SUMO_ATTR_ID:
790 case SUMO_ATTR_INDEX:
791 return false;
792 case SUMO_ATTR_SPEED:
793 return canParse<double>(value);
794 case SUMO_ATTR_ALLOW:
798 return canParseVehicleClasses(value);
799 case SUMO_ATTR_WIDTH:
800 if (value.empty() || (value == "default")) {
801 return true;
802 } else {
803 return canParse<double>(value) && ((parse<double>(value) > 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_WIDTH));
804 }
807 return canParse<double>(value) && (parse<double>(value) >= 0);
809 return canParse<bool>(value);
810 case SUMO_ATTR_SHAPE:
812 // A lane shape can either be empty or have more than 1 element
813 if (value.empty()) {
814 return true;
815 } else if (canParse<PositionVector>(value)) {
816 return parse<PositionVector>(value).size() > 1;
817 }
818 return false;
819 case GNE_ATTR_OPPOSITE: {
820 if (value.empty()) {
821 return true;
822 } else {
823 NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
824 if (oppEdge == nullptr || oppEdge->getLaneID(oppEdge->getNumLanes() - 1) != value) {
825 return false;
826 }
827 NBEdge* edge = myParentEdge->getNBEdge();
828 if (oppEdge->getFromNode() != edge->getToNode() || oppEdge->getToNode() != edge->getFromNode()) {
829 WRITE_WARNINGF(TL("Opposite lane '%' does not connect the same nodes as edge '%'!"), value, edge->getID());
830 return false;
831 }
832 return true;
833 }
834 }
835 case SUMO_ATTR_TYPE:
836 return true;
838 return canParse<double>(value) && (parse<double>(value) >= 0);
840 return canParseVehicleClasses(value);
843 default:
844 return isCommonValid(key, value);
845 }
846}
847
848
849bool
851 switch (key) {
852 case SUMO_ATTR_ID:
853 case SUMO_ATTR_INDEX:
854 return false;
857 default:
858 return true;
859 }
860}
861
862
863bool
865 const NBEdge* edge = myParentEdge->getNBEdge();
866 switch (key) {
867 case SUMO_ATTR_WIDTH:
869 default:
870 return false;
871 }
872}
873
874
879
880
881void
882GNELane::setSpecialColor(const RGBColor* color, double colorValue) {
883 mySpecialColor = color;
884 mySpecialColorValue = colorValue;
885}
886
887// ===========================================================================
888// private
889// ===========================================================================
890
891void
892GNELane::setAttribute(SumoXMLAttr key, const std::string& value) {
893 // get parent edge
894 NBEdge* edge = myParentEdge->getNBEdge();
895 // get template editor
897 // check if we have to update template
898 const bool updateTemplate = templateEditor->getEdgeTemplate() ? (templateEditor->getEdgeTemplate()->getID() == myParentEdge->getID()) : false;
899 switch (key) {
900 case SUMO_ATTR_ID:
901 case SUMO_ATTR_INDEX:
902 throw InvalidArgument("Modifying attribute '" + toString(key) + "' of " + getTagStr() + " isn't allowed");
903 case SUMO_ATTR_SPEED:
904 edge->setSpeed(myIndex, parse<double>(value));
905 break;
906 case SUMO_ATTR_ALLOW:
908 break;
911 break;
914 break;
917 break;
918 case SUMO_ATTR_WIDTH:
919 if (value.empty() || (value == "default")) {
921 } else {
922 edge->setLaneWidth(myIndex, parse<double>(value));
923 }
924 // update edge parent boundary
926 break;
928 edge->setFriction(myIndex, parse<double>(value));
929 break;
931 edge->setEndOffset(myIndex, parse<double>(value));
932 break;
934 edge->setAcceleration(myIndex, parse<bool>(value));
935 break;
936 case SUMO_ATTR_SHAPE:
938 // set new shape
939 edge->setLaneShape(myIndex, parse<PositionVector>(value));
940 // update edge parent boundary
942 break;
943 case GNE_ATTR_OPPOSITE: {
944 if (value != "") {
945 NBEdge* oppEdge = myNet->getEdgeCont().retrieve(value.substr(0, value.rfind("_")));
946 oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = getID();
947 } else {
948 // reset prior oppEdge if existing
949 const std::string oldValue = myParentEdge->getNBEdge()->getLaneStruct(myIndex).oppositeID;
950 NBEdge* oppEdge = myNet->getEdgeCont().retrieve(oldValue.substr(0, oldValue.rfind("_")));
951 if (oppEdge != nullptr) {
952 oppEdge->getLaneStruct(oppEdge->getNumLanes() - 1).oppositeID = "";
953 }
954 }
956 break;
957 }
958 case SUMO_ATTR_TYPE:
959 edge->getLaneStruct(myIndex).type = value;
960 break;
962 if (value.empty()) {
964 } else {
965 edge->getLaneStruct(myIndex).laneStopOffset.setOffset(parse<double>(value));
966 }
967 break;
970 break;
973 break;
974 default:
975 setCommonAttribute(key, value);
976 break;
977 }
978 // update template
979 if (updateTemplate) {
980 templateEditor->setEdgeTemplate(myParentEdge);
981 }
982 // invalidate demand path calculator
984}
985
986
987void
989 // set custom shape
991 // update geometry
993}
994
995
996void
998 // commit new shape
999 undoList->begin(this, "moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
1001 undoList->end();
1002}
1003
1004
1005void
1006GNELane::drawLane(const GUIVisualizationSettings& s, const double layer) const {
1007 // Push layer matrix
1009 // translate to layer
1010 drawInLayer(layer);
1011 // set lane colors
1012 setLaneColor(s);
1013 // Check if lane has to be draw as railway and if isn't being drawn for selecting
1015 // draw as railway
1017 } else if (myShapeColors.size() > 0) {
1018 // draw geometry with own colors
1021 } else {
1022 // draw geometry with current color
1025 }
1026 // if lane is selected, draw a second lane over it
1028 // draw start end shape points
1030 // check if draw details
1032 // draw markings
1034 // Draw direction indicators
1036 // draw lane textures
1037 drawTextures(s);
1038 // draw lane arrows
1039 drawArrows(s);
1040 // draw link numbers
1041 drawLinkNo(s);
1042 // draw TLS link numbers
1043 drawTLSLinkNo(s);
1044 // draw stopOffsets
1046 }
1047 // draw shape edited
1048 drawShapeEdited(s);
1049 // Pop layer matrix
1051}
1052
1053
1054void
1056 // only draw if lane is selected
1057 if (drawUsingSelectColor()) {
1058 // Push matrix
1060 // move back
1061 glTranslated(0, 0, 0.1);
1062 // set selected edge color
1064 // draw geometry with current color
1067 // Pop matrix
1069 }
1070}
1071
1072
1073void
1075 // if shape is being edited, draw point and green line
1076 if (myShapeEdited) {
1077 // push shape edited matrix
1079 // translate
1081 // set selected edge color
1083 // draw shape around
1086 // move front
1087 glTranslated(0, 0, 1);
1088 // draw geometry points
1093 // Pop shape edited matrix
1095 }
1096}
1097
1098
1099void
1101 // draw additional children
1102 for (const auto& additional : getChildAdditionals()) {
1103 // check that ParkingAreas aren't draw two times
1104 additional->drawGL(s);
1105 }
1106 // draw demand element children
1107 for (const auto& demandElement : getChildDemandElements()) {
1108 if (!demandElement->getTagProperty().isPlacedInRTree()) {
1109 demandElement->drawGL(s);
1110 }
1111 }
1112 // draw path additional elements
1116}
1117
1118
1119void
1121 // check conditions
1123 // check if this is the last lane (note: First lane is the lane more far of the edge's center)
1124 const bool firstlane = (myIndex == 0);
1125 const bool lastLane = (myIndex == (myParentEdge->getNBEdge()->getNumLanes() - 1));
1126 // declare separator width
1127 const auto separatorWidth = SUMO_const_laneMarkWidth * 0.5;
1128 // get passengers change left and right for previous, current and next lane
1129 const bool changeRightTop = lastLane ? true : myParentEdge->getNBEdge()->allowsChangingRight(myIndex + 1, SVC_PASSENGER);
1130 const bool changeLeftCurrent = lastLane ? true : myParentEdge->getNBEdge()->allowsChangingLeft(myIndex, SVC_PASSENGER);
1131 const bool changeRightCurrent = firstlane ? true : myParentEdge->getNBEdge()->allowsChangingRight(myIndex, SVC_PASSENGER);
1132 const bool changeLeftBot = firstlane ? true : myParentEdge->getNBEdge()->allowsChangingLeft(myIndex - 1, SVC_PASSENGER);
1133 // save current color
1134 const auto currentColor = GLHelper::getColor();
1135 // separator offsets
1136 const double topSeparatorOffset = myDrawingConstants->getOffset() + (myDrawingConstants->getDrawingWidth() * -1) + separatorWidth;
1137 const double botSeparatorOffset = myDrawingConstants->getOffset() + myDrawingConstants->getDrawingWidth() - separatorWidth;
1138 // push matrix
1140 // translate
1141 glTranslated(0, 0, 0.1);
1142 // continue depending of lanes
1143 if (myDrawingConstants->drawSuperposed() || (firstlane && lastLane)) {
1144 // draw top and bot separator only
1146 GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, topSeparatorOffset);
1147 GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, botSeparatorOffset);
1148 } else if (firstlane) {
1149 // draw top separator
1150 GLHelper::setColor((changeLeftCurrent && changeRightTop) ? RGBColor::WHITE : RGBColor::ORANGE);
1151 GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, topSeparatorOffset);
1152 // check if draw inverse marking
1153 if (changeLeftCurrent) {
1154 GLHelper::setColor(currentColor);
1156 3, 6, topSeparatorOffset, true, true, s.lefthand, 1);
1157 }
1158 // draw bot separator
1160 GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, botSeparatorOffset);
1161 } else if (lastLane) {
1162 // draw top separator
1164 GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, topSeparatorOffset);
1165 // draw bot separator
1166 GLHelper::setColor((changeRightCurrent && changeLeftBot) ? RGBColor::WHITE : RGBColor::ORANGE);
1167 GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, botSeparatorOffset);
1168 // check if draw inverse marking
1169 if (changeRightCurrent) {
1170 GLHelper::setColor(currentColor);
1172 3, 6, botSeparatorOffset, true, true, s.lefthand, 1);
1173 }
1174 } else {
1175 // draw top separator
1176 GLHelper::setColor((changeLeftCurrent && changeRightTop) ? RGBColor::WHITE : RGBColor::ORANGE);
1177 GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, topSeparatorOffset);
1178 // check if draw inverse marking
1179 if (changeLeftCurrent) {
1180 GLHelper::setColor(currentColor);
1182 3, 6, topSeparatorOffset, true, true, s.lefthand, 1);
1183 }
1184 // draw bot separator
1185 GLHelper::setColor((changeRightCurrent && changeLeftBot) ? RGBColor::WHITE : RGBColor::ORANGE);
1186 GUIGeometry::drawGeometry(myDrawingConstants->getDetail(), myLaneGeometry, separatorWidth, botSeparatorOffset);
1187 // check if draw inverse marking
1188 if (changeRightCurrent) {
1189 GLHelper::setColor(currentColor);
1191 3, 6, botSeparatorOffset, true, true, s.lefthand, 1);
1192 }
1193 }
1194 // pop matrix
1196 }
1197}
1198
1199
1200void
1202 // check draw conditions
1204 // get connections
1205 const auto& connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
1206 // get number of links
1207 const int noLinks = (int)connections.size();
1208 // only continue if there is links
1209 if (noLinks > 0) {
1210 // push link matrix
1212 // move front
1213 glTranslated(0, 0, GLO_TEXTNAME);
1214 // calculate width
1215 const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
1216 // get X1
1217 double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
1218 // iterate over links
1219 for (int i = noLinks - 1; i >= 0; i--) {
1220 // calculate x2
1221 const double x2 = x1 - (double)(width / 2.);
1222 // get link index
1224 connections[s.lefthand ? noLinks - 1 - i : i]);
1225 // draw link index
1227 // update x1
1228 x1 -= width;
1229 }
1230 // pop link matrix
1232 }
1233 }
1234}
1235
1236
1237void
1239 // check conditions
1241 (myParentEdge->getToJunction()->getNBNode()->getControllingTLS().size() > 0)) {
1242 // get connections
1243 const auto& connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
1244 // get numer of links
1245 const int noLinks = (int)connections.size();
1246 // only continue if there are links
1247 if (noLinks > 0) {
1248 // push link matrix
1250 // move t front
1251 glTranslated(0, 0, GLO_TEXTNAME);
1252 // calculate width
1253 const double w = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / (double) noLinks;
1254 // calculate x1
1255 double x1 = myParentEdge->getNBEdge()->getLaneWidth(myIndex) / 2;
1256 // iterate over links
1257 for (int i = noLinks - 1; i >= 0; --i) {
1258 // calculate x2
1259 const double x2 = x1 - (double)(w / 2.);
1260 // get link number
1261 const int linkNo = connections[s.lefthand ? noLinks - 1 - i : i].tlLinkIndex;
1262 // draw link number
1264 // update x1
1265 x1 -= w;
1266 }
1267 // pop link matrix
1269 }
1270 }
1271}
1272
1273
1274void
1277 // calculate begin, end and rotation
1278 const Position& begin = myLaneGeometry.getShape()[-2];
1279 const Position& end = myLaneGeometry.getShape().back();
1280 const double rot = GUIGeometry::calculateRotation(begin, end);
1281 // push arrow matrix
1283 // move front (note: must draw on top of junction shape?
1284 glTranslated(0, 0, 3);
1285 // change color depending of spreadSuperposed
1288 } else {
1290 }
1291 // move to end
1292 glTranslated(end.x(), end.y(), 0);
1293 // rotate
1294 glRotated(rot, 0, 0, 1);
1295 const double width = myParentEdge->getNBEdge()->getLaneWidth(myIndex);
1296 if (width < SUMO_const_laneWidth) {
1298 }
1299 // apply offset
1300 glTranslated(myDrawingConstants->getOffset(), 0, 0);
1301 // get destination node
1302 const NBNode* dest = myParentEdge->getNBEdge()->myTo;
1303 // draw all links iterating over connections
1304 for (const auto& connection : myParentEdge->getNBEdge()->myConnections) {
1305 if (connection.fromLane == myIndex) {
1306 // get link direction
1307 LinkDirection dir = dest->getDirection(myParentEdge->getNBEdge(), connection.toEdge, s.lefthand);
1308 // draw depending of link direction
1309 switch (dir) {
1311 GLHelper::drawBoxLine(Position(0, 4), 0, 2, .05);
1312 GLHelper::drawTriangleAtEnd(Position(0, 4), Position(0, 1), (double) 1, (double) .25);
1313 break;
1315 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1316 GLHelper::drawBoxLine(Position(0, 2.5), 90, 1, .05);
1317 GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.5, 2.5), (double) 1, (double) .25);
1318 break;
1320 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1321 GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
1322 GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.5, 2.5), (double) 1, (double) .25);
1323 break;
1325 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1326 GLHelper::drawBoxLine(Position(0, 2.5), 90, .5, .05);
1327 GLHelper::drawBoxLine(Position(0.5, 2.5), 180, 1, .05);
1328 GLHelper::drawTriangleAtEnd(Position(0.5, 2.5), Position(0.5, 4), (double) 1, (double) .25);
1329 break;
1331 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1332 GLHelper::drawBoxLine(Position(0, 2.5), -90, 1, .05);
1333 GLHelper::drawBoxLine(Position(-0.5, 2.5), -180, 1, .05);
1334 GLHelper::drawTriangleAtEnd(Position(-0.5, 2.5), Position(-0.5, 4), (double) 1, (double) .25);
1335 break;
1337 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1338 GLHelper::drawBoxLine(Position(0, 2.5), 45, .7, .05);
1339 GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(1.2, 1.3), (double) 1, (double) .25);
1340 break;
1342 GLHelper::drawBoxLine(Position(0, 4), 0, 1.5, .05);
1343 GLHelper::drawBoxLine(Position(0, 2.5), -45, .7, .05);
1344 GLHelper::drawTriangleAtEnd(Position(0, 2.5), Position(-1.2, 1.3), (double) 1, (double) .25);
1345 break;
1347 GLHelper::drawBoxLine(Position(1, 5.8), 245, 2, .05);
1348 GLHelper::drawBoxLine(Position(-1, 5.8), 115, 2, .05);
1349 glTranslated(0, 5, 0);
1350 GLHelper::drawOutlineCircle(0.9, 0.8, 32);
1351 glTranslated(0, -5, 0);
1352 break;
1353 }
1354 }
1355 }
1356 // pop arrow matrix
1358 }
1359}
1360
1361
1362void
1365 glTranslated(0, 0, 0.1); // must draw on top of junction shape
1366 std::vector<NBEdge::Connection> connections = myParentEdge->getNBEdge()->getConnectionsFromLane(myIndex);
1367 NBNode* node = myParentEdge->getNBEdge()->getToNode();
1368 const Position& startPos = myLaneGeometry.getShape()[-1];
1369 for (auto it : connections) {
1370 const LinkState state = node->getLinkState(myParentEdge->getNBEdge(), it.toEdge, it.fromLane, it.toLane, it.mayDefinitelyPass, it.tlID);
1371 switch (state) {
1373 glColor3d(1, 1, 0);
1374 break;
1376 glColor3d(0, 1, 1);
1377 break;
1378 case LINKSTATE_MAJOR:
1379 glColor3d(1, 1, 1);
1380 break;
1381 case LINKSTATE_MINOR:
1382 glColor3d(.4, .4, .4);
1383 break;
1384 case LINKSTATE_STOP:
1385 glColor3d(.7, .4, .4);
1386 break;
1387 case LINKSTATE_EQUAL:
1388 glColor3d(.7, .7, .7);
1389 break;
1391 glColor3d(.7, .7, 1);
1392 break;
1393 case LINKSTATE_ZIPPER:
1394 glColor3d(.75, .5, 0.25);
1395 break;
1396 default:
1397 throw ProcessError(TLF("Unexpected LinkState '%'", toString(state)));
1398 }
1399 const Position& endPos = it.toEdge->getLaneShape(it.toLane)[0];
1400 glBegin(GL_LINES);
1401 glVertex2d(startPos.x(), startPos.y());
1402 glVertex2d(endPos.x(), endPos.y());
1403 glEnd();
1404 GLHelper::drawTriangleAtEnd(startPos, endPos, (double) 1.5, (double) .2);
1405 }
1407}
1408
1409
1410void
1411GNELane::calculateLaneContour(const GUIVisualizationSettings& s, const double layer) const {
1412 // first check if edge parent was inserted with full boundary
1414 // calculate contour
1417 true, true, myDrawingConstants->getOffset(), nullptr, myParentEdge);
1418 // calculate geometry points contour if we're editing shape
1419 if (myShapeEdited) {
1423 }
1424 }
1425}
1426
1427
1430 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
1431 // declare a RGBColor variable
1432 RGBColor color;
1433 // 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.
1434 if (inspectedElements.getFirstAC() &&
1435 !inspectedElements.getFirstAC()->isAttributeCarrierSelected() &&
1436 inspectedElements.getFirstAC()->getTagProperty().vehicleEdges()) {
1437 // obtain attribute "via"
1438 std::vector<std::string> viaEdges = parse<std::vector<std::string> >(inspectedElements.getFirstAC()->getAttribute(SUMO_ATTR_VIA));
1439 // iterate over viaEdges
1440 for (const auto& edge : viaEdges) {
1441 // check if parent edge is in the via edges
1442 if (myParentEdge->getID() == edge) {
1443 // set green color in GLHelper and return it
1444 color = RGBColor::GREEN;
1445 }
1446 }
1447 }
1448 if (mySpecialColor != nullptr) {
1449 // If special color is enabled, set it
1450 color = *mySpecialColor;
1451 } else if (myParentEdge->drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1452 // override with special colors (unless the color scheme is based on selection)
1454 } else {
1455 // Get normal lane color
1456 const GUIColorer& c = s.laneColorer;
1457 if (!setFunctionalColor(c.getActive(), color) && !setMultiColor(s, c, color)) {
1458 color = c.getScheme().getColor(getColorValue(s, c.getActive()));
1459 }
1460 }
1461 // special color for conflicted candidate edges
1463 // extra check for route frame
1466 }
1467 }
1468 // special color for special candidate edges
1470 // extra check for route frame
1473 }
1474 }
1475 // special color for candidate edges
1477 // extra check for route frame
1480 }
1481 }
1482 // special color for source candidate edges
1485 }
1486 // special color for target candidate edges
1489 }
1490 // special color for invalid candidate edges
1493 }
1494 // special color for source candidate lanes
1495 if (mySourceCandidate) {
1497 }
1498 // special color for target candidate lanes
1499 if (myTargetCandidate) {
1501 }
1502 // special color for special candidate lanes
1503 if (mySpecialCandidate) {
1505 }
1506 // special color for possible candidate lanes
1507 if (myPossibleCandidate) {
1509 }
1510 // special color for conflicted candidate lanes
1513 }
1514 // special color for invalid candidate lanes
1515 if (myInvalidCandidate) {
1517 }
1518 // set color in GLHelper
1519 GLHelper::setColor(color);
1520 return color;
1521}
1522
1523
1524bool
1525GNELane::setFunctionalColor(int activeScheme, RGBColor& col) const {
1526 switch (activeScheme) {
1527 case 6: {
1528 double hue = GeomHelper::naviDegree(myLaneGeometry.getShape().beginEndAngle()); // [0-360]
1529 col = RGBColor::fromHSV(hue, 1., 1.);
1530 return true;
1531 }
1532 default:
1533 return false;
1534 }
1535}
1536
1537
1538bool
1540 const int activeScheme = c.getActive();
1541 myShapeColors.clear();
1542 switch (activeScheme) {
1543 case 9: // color by height at segment start
1544 for (PositionVector::const_iterator ii = myLaneGeometry.getShape().begin(); ii != myLaneGeometry.getShape().end() - 1; ++ii) {
1545 myShapeColors.push_back(c.getScheme().getColor(ii->z()));
1546 }
1547 col = c.getScheme().getColor(getColorValue(s, 8));
1548 return true;
1549 case 11: // color by inclination at segment start
1550 for (int ii = 1; ii < (int)myLaneGeometry.getShape().size(); ++ii) {
1551 const double inc = (myLaneGeometry.getShape()[ii].z() - myLaneGeometry.getShape()[ii - 1].z()) / MAX2(POSITION_EPS, myLaneGeometry.getShape()[ii].distanceTo2D(myLaneGeometry.getShape()[ii - 1]));
1552 myShapeColors.push_back(c.getScheme().getColor(inc));
1553 }
1554 col = c.getScheme().getColor(getColorValue(s, 10));
1555 return true;
1556 default:
1557 return false;
1558 }
1559}
1560
1561
1562double
1563GNELane::getColorValue(const GUIVisualizationSettings& s, int activeScheme) const {
1564 const SVCPermissions myPermissions = myParentEdge->getNBEdge()->getPermissions(myIndex);
1565 if (mySpecialColor != nullptr && mySpecialColorValue != std::numeric_limits<double>::max()) {
1566 return mySpecialColorValue;
1567 }
1568 switch (activeScheme) {
1569 case 0:
1570 switch (myPermissions) {
1571 case SVC_PEDESTRIAN:
1572 return 1;
1573 case SVC_BICYCLE:
1574 return 2;
1575 case 0:
1576 // forbidden road or green verge
1577 return myParentEdge->getNBEdge()->getPermissions() == 0 ? 10 : 3;
1578 case SVC_SHIP:
1579 return 4;
1580 case SVC_AUTHORITY:
1581 return 8;
1582 case SVC_AIRCRAFT:
1583 case SVC_DRONE:
1584 return 12;
1585 default:
1586 break;
1587 }
1589 return 9;
1590 } else if (isRailway(myPermissions)) {
1591 if ((myPermissions & SVC_BUS) != 0) {
1592 return 6;
1593 } else {
1594 return 5;
1595 }
1596 } else if ((myPermissions & SVC_PASSENGER) != 0) {
1597 if ((myPermissions & (SVC_RAIL_CLASSES & ~SVC_RAIL_FAST)) != 0 && (myPermissions & SVC_SHIP) == 0) {
1598 return 6;
1599 } else {
1600 return 0;
1601 }
1602 } else {
1603 return 7;
1604 }
1605 case 1:
1607 case 2:
1608 return (double)myPermissions;
1609 case 3:
1611 case 4:
1612 return myParentEdge->getNBEdge()->getNumLanes();
1613 case 5: {
1615 }
1616 // case 6: by angle (functional)
1617 case 7: {
1618 return myParentEdge->getNBEdge()->getPriority();
1619 }
1620 case 8: {
1621 // color by z of first shape point
1622 return myLaneGeometry.getShape()[0].z();
1623 }
1624 // case 9: by segment height
1625 case 10: {
1626 // color by incline
1627 return (myLaneGeometry.getShape()[-1].z() - myLaneGeometry.getShape()[0].z()) / myParentEdge->getNBEdge()->getLength();
1628 }
1629 // case 11: by segment incline
1630
1631 case 12: {
1632 // by numerical edge param value
1634 try {
1636 } catch (NumberFormatException&) {
1637 try {
1639 } catch (BoolFormatException&) {
1640 return -1;
1641 }
1642 }
1643 } else {
1645 }
1646 }
1647 case 13: {
1648 // by numerical lane param value
1650 try {
1652 } catch (NumberFormatException&) {
1653 try {
1655 } catch (BoolFormatException&) {
1656 return -1;
1657 }
1658 }
1659 } else {
1661 }
1662 }
1663 case 14: {
1664 return myParentEdge->getNBEdge()->getDistance();
1665 }
1666 case 15: {
1667 return fabs(myParentEdge->getNBEdge()->getDistance());
1668 }
1669 }
1670 return 0;
1671}
1672
1673
1674void
1675GNELane::drawOverlappedRoutes(const int numRoutes) const {
1676 // get middle point and angle
1679 // Push route matrix
1681 // translate to front
1682 glTranslated(0, 0, GLO_ROUTE + 1);
1683 // get middle
1684 GLHelper::drawText(toString(numRoutes) + " routes", center, 0, 1.8, RGBColor::BLACK, angle + 90);
1685 // pop route matrix
1687
1688}
1689
1690
1691void
1693 const auto& laneStopOffset = myParentEdge->getNBEdge()->getLaneStruct(myIndex).laneStopOffset;
1694 // check conditions
1695 if (laneStopOffset.isDefined() && (laneStopOffset.getPermissions() & SVC_PASSENGER) != 0) {
1696 const Position& end = getLaneShape().back();
1697 const Position& f = getLaneShape()[-2];
1698 const double rot = RAD2DEG(atan2((end.x() - f.x()), (f.y() - end.y())));
1701 glTranslated(end.x(), end.y(), 1);
1702 glRotated(rot, 0, 0, 1);
1703 glTranslated(0, laneStopOffset.getOffset(), 0);
1704 glBegin(GL_QUADS);
1705 glVertex2d(-myDrawingConstants->getDrawingWidth(), 0.0);
1706 glVertex2d(-myDrawingConstants->getDrawingWidth(), 0.2);
1707 glVertex2d(myDrawingConstants->getDrawingWidth(), 0.2);
1708 glVertex2d(myDrawingConstants->getDrawingWidth(), 0.0);
1709 glEnd();
1711 }
1712}
1713
1714
1715bool
1717 return isWaterway(myParentEdge->getNBEdge()->getPermissions(myIndex)) && s.showRails; // reusing the showRails setting
1718}
1719
1720
1721void
1723 // Draw direction indicators if the correspondient option is enabled
1724 if (s.showLaneDirection) {
1725 // improve visibility of superposed rail edges
1727 glColor3d(0.3, 0.3, 0.3);
1728 }
1729 // get width and sideOffset
1730 const double width = MAX2(NUMERICAL_EPS, (myDrawingConstants->getDrawingWidth() * 2 * myDrawingConstants->getExaggeration()));
1731 // push direction indicator matrix
1733 // move to front
1734 glTranslated(0, 0, 0.1);
1735 // iterate over shape
1736 for (int i = 0; i < (int) myLaneGeometry.getShape().size() - 1; ++i) {
1737 // push triangle matrix
1739 // move front
1740 glTranslated(myLaneGeometry.getShape()[i].x(), myLaneGeometry.getShape()[i].y(), 0.1);
1741 // rotate
1742 glRotated(myLaneGeometry.getShapeRotations()[i], 0, 0, 1);
1743 // calculate subwidth
1744 for (double subWidth = 0; subWidth < myLaneGeometry.getShapeLengths()[i]; subWidth += width) {
1745 // calculate length
1746 const double length = MIN2(width * 0.5, myLaneGeometry.getShapeLengths()[i] - subWidth);
1747 // draw triangle
1748 glBegin(GL_TRIANGLES);
1749 glVertex2d(-myDrawingConstants->getOffset(), -subWidth - length);
1750 glVertex2d(-myDrawingConstants->getOffset() - width * 0.25, -subWidth);
1751 glVertex2d(-myDrawingConstants->getOffset() + width * 0.25, -subWidth);
1752 glEnd();
1753 }
1754 // pop triangle matrix
1756 }
1757 // pop direction indicator matrix
1759 }
1760}
1761
1762
1763void
1765 // draw foot width 150mm, assume that distance between rail feet inner sides is reduced on both sides by 39mm with regard to the gauge
1766 // assume crosstie length of 181% gauge (2600mm for standard gauge)
1767 // first save current color (obtained from view configuration)
1768 const auto currentLaneColor = GLHelper::getColor();
1769 // Set current color
1770 GLHelper::setColor(currentLaneColor);
1771 // continue depending of detail
1773 // move
1774 glTranslated(0, 0, 0.1);
1775 // draw external crossbar
1776 const double crossbarWidth = 0.2 * myDrawingConstants->getExaggeration();
1777 // draw geometry
1781 // move
1782 glTranslated(0, 0, 0.01);
1783 // Set color gray
1784 glColor3d(0.8, 0.8, 0.8);
1785 // draw geometry
1789 // move
1790 glTranslated(0, 0, 0.01);
1791 // Set current color
1792 GLHelper::setColor(currentLaneColor);
1793 // Draw crossties
1796 myDrawingConstants->getOffset(), false);
1797 } else if (myShapeColors.size() > 0) {
1798 // draw colored box lines
1801 } else {
1802 // draw geometry with current color
1805 }
1806}
1807
1808
1809void
1811 // check all conditions for drawing textures
1812 if (!s.disableLaneIcons && (myLaneRestrictedTexturePositions.size() > 0)) {
1813 // Declare default width of icon (3)
1814 const double iconWidth = myDrawingConstants->getDrawingWidth() * 0.6;
1815 // Draw list of icons
1816 for (int i = 0; i < (int)myLaneRestrictedTexturePositions.size(); i++) {
1817 // Push draw matrix 2
1819 // Set white color
1820 glColor3d(1, 1, 1);
1821 // Translate matrix 2
1822 glTranslated(myLaneRestrictedTexturePositions.at(i).x(), myLaneRestrictedTexturePositions.at(i).y(), 0.1);
1823 // Rotate matrix 2
1824 glRotated(myLaneRestrictedTextureRotations.at(i), 0, 0, -1);
1825 glRotated(90, 0, 0, 1);
1826 // draw texture box depending of type of restriction
1829 } else if (isRestricted(SVC_BICYCLE)) {
1831 } else if (isRestricted(SVC_BUS)) {
1833 }
1834 // Pop draw matrix 2
1836 }
1837 }
1838}
1839
1840
1841void
1843 // draw a Start/endPoints if lane has a custom shape
1845 // obtain circle width and resolution
1846 const double circleWidth = GNEEdge::SNAP_RADIUS * MIN2((double)1, s.laneWidthExaggeration) / 2;
1847 // obtain custom shape
1849 // set color (override with special colors unless the color scheme is based on selection)
1850 if (drawUsingSelectColor() && s.laneColorer.getActive() != 1) {
1852 } else {
1853 GLHelper::setColor(s.junctionColorer.getSchemes()[0].getColor(2));
1854 }
1855 // push start matrix
1857 // move to shape start position
1858 glTranslated(customShape.front().x(), customShape.front().y(), 0.1);
1859 // draw circle
1861 // draw s depending of detail
1863 // move top
1864 glTranslated(0, 0, 0.1);
1865 // draw "S"
1866 GLHelper::drawText("S", Position(), 0.1, circleWidth, RGBColor::WHITE);
1867 }
1868 // pop start matrix
1870 // draw line between junction and start position
1872 // move top
1873 glTranslated(0, 0, 0.1);
1874 // set line width
1875 glLineWidth(4);
1876 // draw line
1878 // pop line matrix
1880 // push start matrix
1882 // move to end position
1883 glTranslated(customShape.back().x(), customShape.back().y(), 0.1);
1884 // draw filled circle
1886 // draw "e" depending of detail
1888 // move top
1889 glTranslated(0, 0, 0.1);
1890 // draw "E"
1891 GLHelper::drawText("E", Position(), 0, circleWidth, RGBColor::WHITE);
1892 }
1893 // pop start matrix
1895 // draw line between Junction and end position
1897 // move top
1898 glTranslated(0, 0, 0.1);
1899 // set line width
1900 glLineWidth(4);
1901 // draw line
1903 // pop line matrix
1905 }
1906}
1907
1908
1909std::string
1911 return myParentEdge->getID();
1912}
1913
1914
1915long
1916GNELane::onDefault(FXObject* obj, FXSelector sel, void* data) {
1917 myNet->getViewNet()->getViewParent()->getTLSEditorFrame()->handleMultiChange(this, obj, sel, data);
1918 return 1;
1919}
1920
1921
1922std::vector<GNEConnection*>
1924 // Declare a vector to save incoming connections
1925 std::vector<GNEConnection*> incomingConnections;
1926 // Obtain incoming edges if junction source was already created
1927 GNEJunction* junctionSource = myParentEdge->getFromJunction();
1928 if (junctionSource) {
1929 // Iterate over incoming GNEEdges of junction
1930 for (const auto& incomingEdge : junctionSource->getGNEIncomingEdges()) {
1931 // Iterate over connection of incoming edges
1932 for (const auto& connection : incomingEdge->getGNEConnections()) {
1933 if (connection->getLaneTo()->getIndex() == getIndex()) {
1934 incomingConnections.push_back(connection);
1935 }
1936 }
1937 }
1938 }
1939 return incomingConnections;
1940}
1941
1942
1943std::vector<GNEConnection*>
1945 // Obtain GNEConnection of parent edge
1946 const std::vector<GNEConnection*>& edgeConnections = myParentEdge->getGNEConnections();
1947 std::vector<GNEConnection*> outcomingConnections;
1948 // Obtain outgoing connections
1949 for (const auto& connection : edgeConnections) {
1950 if (connection->getLaneFrom()->getIndex() == getIndex()) {
1951 outcomingConnections.push_back(connection);
1952 }
1953 }
1954 return outcomingConnections;
1955}
1956
1957
1958void
1960 // update incoming connections of lane
1961 std::vector<GNEConnection*> incomingConnections = getGNEIncomingConnections();
1962 for (const auto& incomingConnection : incomingConnections) {
1963 incomingConnection->updateConnectionID();
1964 }
1965 // update outcoming connections of lane
1966 std::vector<GNEConnection*> outcomingConnections = getGNEOutcomingConnections();
1967 for (const auto& outcomingConnection : outcomingConnections) {
1968 outcomingConnection->updateConnectionID();
1969 }
1970}
1971
1972
1973double
1975 // factor should not be 0
1976 if (myParentEdge->getNBEdge()->getFinalLength() > 0) {
1977 return MAX2(POSITION_EPS, (getLaneShape().length() / myParentEdge->getNBEdge()->getFinalLength()));
1978 } else {
1979 return POSITION_EPS;
1980 };
1981}
1982
1983
1984void
1986 // Create basic commands
1987 std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
1989 if (edgeSelSize && myParentEdge->isAttributeCarrierSelected() && (edgeSelSize > 1)) {
1990 edgeDescPossibleMulti = toString(edgeSelSize) + " " + toString(SUMO_TAG_EDGE) + "s";
1991 }
1992 // create menu pane for edge operations
1993 FXMenuPane* edgeOperations = new FXMenuPane(ret);
1994 ret->insertMenuPaneChild(edgeOperations);
1995 if (edgeSelSize > 0) {
1996 new FXMenuCascade(ret, TLF("Edge operations (% selected)", toString(edgeSelSize)).c_str(), nullptr, edgeOperations);
1997 } else {
1998 new FXMenuCascade(ret, TL("Edge operations"), nullptr, edgeOperations);
1999 }
2000 // create menu commands for all edge operations
2001 GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Split edge here"), nullptr, &parent, MID_GNE_EDGE_SPLIT);
2002 auto splitBothDirections = GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Split edge in both directions here (no symmetric opposite edge)"), nullptr, &parent, MID_GNE_EDGE_SPLIT_BIDI);
2003 // check if allow split edge in both directions
2004 splitBothDirections->disable();
2005 const auto oppositeEdges = myParentEdge->getOppositeEdges();
2006 if (oppositeEdges.size() == 0) {
2007 splitBothDirections->setText(TL("Split edge in both directions here (no opposite edge)"));
2008 } else {
2009 for (const auto& oppositeEdge : oppositeEdges) {
2010 // get reverse inner geometry
2011 const auto reverseGeometry = oppositeEdge->getNBEdge()->getInnerGeometry().reverse();
2012 if (reverseGeometry == myParentEdge->getNBEdge()->getInnerGeometry()) {
2013 splitBothDirections->enable();
2014 splitBothDirections->setText(TL("Split edge in both directions here"));
2015 }
2016 }
2017 }
2018 GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Set geometry endpoint here (shift-click)"), nullptr, &parent, MID_GNE_EDGE_EDIT_ENDPOINT);
2019 // restore geometry points depending of selection status
2021 if (edgeSelSize == 1) {
2022 GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Restore both geometry endpoints"), nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
2023 } else {
2024 GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Restore geometry endpoints of all selected edges"), nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
2025 }
2026 } else {
2027 GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Restore geometry endpoint (shift-click)"), nullptr, &parent, MID_GNE_EDGE_RESET_ENDPOINT);
2028 }
2029 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Reverse %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_REVERSE);
2030 auto reverse = GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Add reverse direction for %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE);
2031 if (myParentEdge->getReverseEdge() != nullptr) {
2032 reverse->disable();
2033 }
2034 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Add reverse disconnected direction for %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_ADD_REVERSE_DISCONNECTED);
2035 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Reset lengths for %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_RESET_LENGTH);
2036 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Straighten %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN);
2037 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Smooth %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_SMOOTH);
2038 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Straighten elevation of %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_STRAIGHTEN_ELEVATION);
2039 GUIDesigns::buildFXMenuCommand(edgeOperations, TLF("Smooth elevation of %", edgeDescPossibleMulti), nullptr, &parent, MID_GNE_EDGE_SMOOTH_ELEVATION);
2040}
2041
2042
2043void
2045 // Get icons
2046 FXIcon* pedestrianIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_PEDESTRIAN);
2047 FXIcon* bikeIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_BIKE);
2048 FXIcon* busIcon = GUIIconSubSys::getIcon(GUIIcon::LANE_BUS);
2049 FXIcon* greenVergeIcon = GUIIconSubSys::getIcon(GUIIcon::LANEGREENVERGE);
2050 // declare number of selected lanes
2051 int numSelectedLanes = 0;
2052 // if lane is selected, calculate number of restricted lanes
2053 bool edgeHasSidewalk = false;
2054 bool edgeHasBikelane = false;
2055 bool edgeHasBuslane = false;
2056 bool differentLaneShapes = false;
2058 const auto selectedLanes = myNet->getAttributeCarriers()->getSelectedLanes();
2059 // update numSelectedLanes
2060 numSelectedLanes = (int)selectedLanes.size();
2061 // iterate over selected lanes
2062 for (const auto& selectedLane : selectedLanes) {
2063 if (selectedLane->myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN)) {
2064 edgeHasSidewalk = true;
2065 }
2066 if (selectedLane->myParentEdge->hasRestrictedLane(SVC_BICYCLE)) {
2067 edgeHasBikelane = true;
2068 }
2069 if (selectedLane->myParentEdge->hasRestrictedLane(SVC_BUS)) {
2070 edgeHasBuslane = true;
2071 }
2072 if (selectedLane->myParentEdge->getNBEdge()->getLaneStruct(selectedLane->getIndex()).customShape.size() != 0) {
2073 differentLaneShapes = true;
2074 }
2075 }
2076 } else {
2077 edgeHasSidewalk = myParentEdge->hasRestrictedLane(SVC_PEDESTRIAN);
2078 edgeHasBikelane = myParentEdge->hasRestrictedLane(SVC_BICYCLE);
2079 edgeHasBuslane = myParentEdge->hasRestrictedLane(SVC_BUS);
2080 differentLaneShapes = myParentEdge->getNBEdge()->getLaneStruct(myIndex).customShape.size() != 0;
2081 }
2082 // create menu pane for lane operations
2083 FXMenuPane* laneOperations = new FXMenuPane(ret);
2084 ret->insertMenuPaneChild(laneOperations);
2085 if (numSelectedLanes > 0) {
2086 new FXMenuCascade(ret, TLF("Lane operations (% selected)", toString(numSelectedLanes)).c_str(), nullptr, laneOperations);
2087 } else {
2088 new FXMenuCascade(ret, TL("Lane operations"), nullptr, laneOperations);
2089 }
2090 GUIDesigns::buildFXMenuCommand(laneOperations, TL("Duplicate lane"), nullptr, &parent, MID_GNE_LANE_DUPLICATE);
2091 GUIDesigns::buildFXMenuCommand(laneOperations, TL("Set custom lane shape"), nullptr, &parent, MID_GNE_LANE_EDIT_SHAPE);
2092 FXMenuCommand* resetCustomShape = GUIDesigns::buildFXMenuCommand(laneOperations, TL("Reset custom shape"), nullptr, &parent, MID_GNE_LANE_RESET_CUSTOMSHAPE);
2093 if (!differentLaneShapes) {
2094 resetCustomShape->disable();
2095 }
2096 FXMenuCommand* resetOppositeLane = GUIDesigns::buildFXMenuCommand(laneOperations, TL("Reset opposite lane"), nullptr, &parent, MID_GNE_LANE_RESET_OPPOSITELANE);
2097 if (getAttribute(GNE_ATTR_OPPOSITE).empty()) {
2098 resetOppositeLane->disable();
2099 }
2100 // Create panel for lane operations and insert it in ret
2101 FXMenuPane* addSpecialLanes = new FXMenuPane(laneOperations);
2102 ret->insertMenuPaneChild(addSpecialLanes);
2103 FXMenuPane* removeSpecialLanes = new FXMenuPane(laneOperations);
2104 ret->insertMenuPaneChild(removeSpecialLanes);
2105 FXMenuPane* transformSlanes = new FXMenuPane(laneOperations);
2106 ret->insertMenuPaneChild(transformSlanes);
2107 // Create menu comands for all add special lanes
2108 FXMenuCommand* addSidewalk = GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Sidewalk"), pedestrianIcon, &parent, MID_GNE_LANE_ADD_SIDEWALK);
2109 FXMenuCommand* addBikelane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Bike lane"), bikeIcon, &parent, MID_GNE_LANE_ADD_BIKE);
2110 FXMenuCommand* addBuslane = GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Bus lane"), busIcon, &parent, MID_GNE_LANE_ADD_BUS);
2111 // if parent edge is selected, always add greenverge in front
2113 GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Green verge"), greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_FRONT);
2114 } else {
2115 GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Green verge (front)"), greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_FRONT);
2116 GUIDesigns::buildFXMenuCommand(addSpecialLanes, TL("Green verge (back)"), greenVergeIcon, &parent, MID_GNE_LANE_ADD_GREENVERGE_BACK);
2117 }
2118 // Create menu comands for all remove special lanes and disable it
2119 FXMenuCommand* removeSidewalk = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Sidewalk"), pedestrianIcon, &parent, MID_GNE_LANE_REMOVE_SIDEWALK);
2120 removeSidewalk->disable();
2121 FXMenuCommand* removeBikelane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Bike lane"), bikeIcon, &parent, MID_GNE_LANE_REMOVE_BIKE);
2122 removeBikelane->disable();
2123 FXMenuCommand* removeBuslane = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Bus lane"), busIcon, &parent, MID_GNE_LANE_REMOVE_BUS);
2124 removeBuslane->disable();
2125 FXMenuCommand* removeGreenVerge = GUIDesigns::buildFXMenuCommand(removeSpecialLanes, TL("Green verge"), greenVergeIcon, &parent, MID_GNE_LANE_REMOVE_GREENVERGE);
2126 removeGreenVerge->disable();
2127 // Create menu comands for all transform special lanes and disable it
2128 FXMenuCommand* transformLaneToSidewalk = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Sidewalk"), pedestrianIcon, &parent, MID_GNE_LANE_TRANSFORM_SIDEWALK);
2129 FXMenuCommand* transformLaneToBikelane = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Bike lane"), bikeIcon, &parent, MID_GNE_LANE_TRANSFORM_BIKE);
2130 FXMenuCommand* transformLaneToBuslane = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Bus lane"), busIcon, &parent, MID_GNE_LANE_TRANSFORM_BUS);
2131 FXMenuCommand* transformLaneToGreenVerge = GUIDesigns::buildFXMenuCommand(transformSlanes, TL("Green verge"), greenVergeIcon, &parent, MID_GNE_LANE_TRANSFORM_GREENVERGE);
2132 // add menuCascade for lane operations
2133 new FXMenuCascade(laneOperations, TLF("Add restricted %", toString(SUMO_TAG_LANE)).c_str(), nullptr, addSpecialLanes);
2134 FXMenuCascade* cascadeRemoveSpecialLane = new FXMenuCascade(laneOperations, TLF("Remove restricted %", toString(SUMO_TAG_LANE)).c_str(), nullptr, removeSpecialLanes);
2135 new FXMenuCascade(laneOperations, TLF("Transform to restricted %", toString(SUMO_TAG_LANE)).c_str(), nullptr, transformSlanes);
2136 // Enable and disable options depending of current transform of the lane
2137 if (edgeHasSidewalk) {
2138 transformLaneToSidewalk->disable();
2139 addSidewalk->disable();
2140 removeSidewalk->enable();
2141 }
2142 if (edgeHasBikelane) {
2143 transformLaneToBikelane->disable();
2144 addBikelane->disable();
2145 removeBikelane->enable();
2146 }
2147 if (edgeHasBuslane) {
2148 transformLaneToBuslane->disable();
2149 addBuslane->disable();
2150 removeBuslane->enable();
2151 }
2153 transformLaneToGreenVerge->disable();
2154 removeGreenVerge->enable();
2155 }
2156 // Check if cascade menu must be disabled
2157 if (!edgeHasSidewalk && !edgeHasBikelane && !edgeHasBuslane && !isRestricted(SVC_IGNORING)) {
2158 cascadeRemoveSpecialLane->disable();
2159 }
2160 // for whatever reason, sonar complains in the next line that cascadeRemoveSpecialLane may leak, but fox does the cleanup
2161} // NOSONAR
2162
2163
2164void
2166 // Create basic commands
2167 std::string edgeDescPossibleMulti = toString(SUMO_TAG_EDGE);
2169 if ((numSelectedEdges > 0) && myParentEdge->isAttributeCarrierSelected() && (numSelectedEdges > 1)) {
2170 edgeDescPossibleMulti = toString(numSelectedEdges) + " " + toString(SUMO_TAG_EDGE) + "s";
2171 }
2172 // create menu pane for edge operations
2173 FXMenuPane* edgeOperations = new FXMenuPane(ret);
2174 ret->insertMenuPaneChild(edgeOperations);
2175 if (numSelectedEdges > 0) {
2176 new FXMenuCascade(ret, TLF("Template operations (% selected)", toString(numSelectedEdges)).c_str(), nullptr, edgeOperations);
2177 } else {
2178 new FXMenuCascade(ret, TL("Template operations"), nullptr, edgeOperations);
2179 }
2180 // create menu commands for all edge operations
2181 GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Use edge as template"), nullptr, &parent, MID_GNE_EDGE_USEASTEMPLATE);
2182 auto applyTemplate = GUIDesigns::buildFXMenuCommand(edgeOperations, TL("Apply template"), nullptr, &parent, MID_GNE_EDGE_APPLYTEMPLATE);
2183 // check if disable apply template
2185 applyTemplate->disable();
2186 }
2187}
2188
2189
2190void
2192 // addreachability menu
2193 FXMenuPane* reachableByClass = new FXMenuPane(ret);
2194 ret->insertMenuPaneChild(reachableByClass);
2195 if (myNet->isNetRecomputed()) {
2196 new FXMenuCascade(ret, TL("Select reachable"), GUIIconSubSys::getIcon(GUIIcon::MODEVEHICLE), reachableByClass);
2197 for (const auto& vClass : SumoVehicleClassStrings.getStrings()) {
2198 GUIDesigns::buildFXMenuCommand(reachableByClass, vClass.c_str(), VClassIcons::getVClassIcon(SumoVehicleClassStrings.get(vClass)), &parent, MID_REACHABILITY);
2199 }
2200 } else {
2201 FXMenuCommand* menuCommand = GUIDesigns::buildFXMenuCommand(ret, TL("Select reachable (compute junctions)"), nullptr, nullptr, 0);
2202 menuCommand->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), nullptr);
2203 }
2204}
2205
2206/****************************************************************************/
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_DELETE
mode for deleting network elements
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_TLS
mode for editing tls
@ NETWORK_SELECT
mode for selecting network elements
@ NETWORK_CONNECT
mode for connecting lanes
@ MID_GNE_ADDSELECT_EDGE
Add edge to selected items - menu entry.
Definition GUIAppEnum.h:849
@ MID_GNE_LANE_EDIT_SHAPE
edit lane shape
@ MID_GNE_LANE_TRANSFORM_BIKE
transform lane to bikelane
@ MID_GNE_EDGE_REVERSE
reverse an edge
@ MID_ADDSELECT
Add to selected items - menu entry.
Definition GUIAppEnum.h:485
@ MID_GNE_LANE_ADD_BUS
add busLane
@ MID_GNE_REMOVESELECT_EDGE
Remove edge from selected items - Menu Entry.
Definition GUIAppEnum.h:851
@ MID_GNE_EDGE_STRAIGHTEN_ELEVATION
interpolate z values linear between junctions
@ MID_GNE_EDGE_SMOOTH
smooth geometry
@ MID_GNE_LANE_RESET_CUSTOMSHAPE
reset custom shape
@ MID_GNE_EDGE_STRAIGHTEN
remove inner geometry
@ MID_GNE_LANE_TRANSFORM_BUS
transform lane to busLane
@ MID_COPY_EDGE_NAME
Copy edge name (for lanes only)
Definition GUIAppEnum.h:459
@ MID_GNE_LANE_DUPLICATE
duplicate a lane
@ MID_GNE_LANE_ADD_GREENVERGE_FRONT
add greenVerge front of current lane
@ MID_GNE_LANE_REMOVE_GREENVERGE
remove greenVerge
@ MID_GNE_EDGE_ADD_REVERSE_DISCONNECTED
add reverse edge disconnected (used for for spreadtype center)
@ MID_GNE_EDGE_SPLIT_BIDI
split an edge
@ MID_GNE_LANE_REMOVE_BIKE
remove bikelane
@ MID_GNE_LANE_RESET_OPPOSITELANE
reset opposite lane
@ MID_REACHABILITY
show reachability from a given lane
Definition GUIAppEnum.h:531
@ MID_GNE_EDGE_RESET_LENGTH
reset custom lengths
@ MID_GNE_LANE_REMOVE_BUS
remove busLane
@ MID_GNE_LANE_REMOVE_SIDEWALK
remove sidewalk
@ MID_GNE_EDGE_RESET_ENDPOINT
reset default geometry endpoints
@ MID_GNE_LANE_ADD_GREENVERGE_BACK
add greenVerge back of current lane
@ MID_GNE_EDGE_SMOOTH_ELEVATION
smooth elevation with regard to adjoining edges
@ MID_GNE_EDGE_ADD_REVERSE
add reverse edge
@ MID_GNE_EDGE_APPLYTEMPLATE
apply template
@ MID_GNE_EDGE_USEASTEMPLATE
use edge as tempalte
@ MID_GNE_LANE_ADD_SIDEWALK
add sidewalk
@ MID_GNE_RESET_GEOMETRYPOINT
reset geometry point
@ MID_GNE_LANE_TRANSFORM_SIDEWALK
transform lane to sidewalk
@ MID_GNE_LANE_ADD_BIKE
add bikelane
@ MID_GNE_EDGE_SPLIT
split an edge
@ MID_GNE_LANE_TRANSFORM_GREENVERGE
transform lane to greenVerge
@ MID_GNE_CUSTOM_GEOMETRYPOINT
set custom geometry point
@ MID_GNE_EDGE_EDIT_ENDPOINT
change default geometry endpoints
@ MID_REMOVESELECT
Remove from selected items - Menu Entry.
Definition GUIAppEnum.h:487
@ GLO_ROUTE
a route
@ GLO_JUNCTION
a junction
@ GLO_FRONTELEMENT
front element (used in netedit)
@ GLO_LANE
a lane
@ GLO_TEXTNAME
text element (used in netedit)
GUIViewObjectsHandler gViewObjectsHandler
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
@ LANE_PEDESTRIAN
@ LANEGREENVERGE
#define RAD2DEG(x)
Definition GeomHelper.h:36
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:296
#define TL(string)
Definition MsgHandler.h:315
#define TLF(string,...)
Definition MsgHandler.h:317
const SVCPermissions SVCAll
all VClasses are allowed
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permissions is a railway edge.
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permissions is a waterway edge.
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
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.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
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_CONNECTION
connectioon between two lanes
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ 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
@ SUMO_ATTR_CUSTOMSHAPE
whether a given shape is user-defined
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_FROM_LANEID
from lane ID (used in GNEConnection)
@ GNE_ATTR_STOPOEXCEPTION
stop exceptions (virtual, used by edge and lanes)
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_CHANGE_LEFT
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_ENDOFFSET
@ SUMO_ATTR_ACCELERATION
@ GNE_ATTR_TO_LANEID
to lane ID (used in GNEConnection)
@ SUMO_ATTR_CHANGE_RIGHT
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_ID
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_FRICTION
const double SUMO_const_laneWidth
Definition StdDefs.h:48
T MIN2(T a, T b)
Definition StdDefs.h:76
const double SUMO_const_laneMarkWidth
Definition StdDefs.h:51
T MAX2(T a, T b)
Definition StdDefs.h:82
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition GLHelper.cpp:433
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
static void drawOutlineCircle(double radius, double iRadius, int steps=8)
Draws an unfilled circle around (0,0)
Definition GLHelper.cpp:591
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:624
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:833
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static RGBColor getColor()
gets the gl-color
Definition GLHelper.cpp:655
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition GLHelper.cpp:296
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:534
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
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:895
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:751
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:852
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool isMarkedForDrawingFront() const
check if this AC is marked for drawing front
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
bool isCommonValid(SumoXMLAttr key, const std::string &value)
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
std::string getCommonAttribute(SumoXMLAttr key) const
bool myPossibleCandidate
flag to mark this element as possible candidate
bool mySpecialCandidate
flag to mark this element as special candidate
bool myInvalidCandidate
flag to mark this element as invalid candidate
bool isSpecialCandidate() const
check if this element is a special candidate
bool isPossibleCandidate() const
check if this element is a possible candidate
bool isInvalidCandidate() const
check if this element is a invalid candidate
bool isTargetCandidate() const
check if this element is a target candidate
bool isSourceCandidate() const
check if this element is a source candidate
bool isConflictedCandidate() const
check if this element is a conflicted candidate
bool myTargetCandidate
flag to mark this element as target candidate
bool myConflictedCandidate
flag to mark this element as conflicted candidate
bool mySourceCandidate
flag to mark this element as source candidate
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset, const GNESegment *segment, const GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) const
calculate contour extruded (used in elements formed by a central shape)
Boundary getContourBoundary() const
get contour boundary
bool drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
void calculateContourAllGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale, const bool calculatePosOverShape) const
calculate contour for all geometry points
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:660
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:781
GNEEdge * getReverseEdge() const
get reverse edge (if exist)
Definition GNEEdge.cpp:1794
bool clickedOverGeometryPoint(const Position &pos) const
return true if user clicked over a Geometry Point
Definition GNEEdge.cpp:613
static const double SNAP_RADIUS
Definition GNEEdge.h:308
bool hasCustomEndPoints() const
Definition GNEEdge.cpp:577
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
Definition GNEEdge.cpp:2325
std::vector< GNEEdge * > getOppositeEdges() const
get opposite edges
Definition GNEEdge.cpp:715
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:77
const std::vector< GNEConnection * > & getGNEConnections() const
returns a reference to the GNEConnection vector
Definition GNEEdge.cpp:1124
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:82
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEGenericData * > & getParentGenericDatas() const
get parent demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
void setEdgeTemplate(const GNEEdge *edge)
set edge template
GNEEdgeTemplate * getEdgeTemplate() const
get edge template (to copy attributes from)
TemplateEditor * getTemplateEditor() const
get template editor
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
static const StringBijection< FXuint > LinkStateNames
long names for link states
const std::vector< GNEEdge * > & getGNEIncomingEdges() const
Returns incoming GNEEdges.
bool isLogicValid()
whether this junction has a valid logic
Position getPositionInView() const
Returns position of hierarchical element in view.
NBNode * getNBNode() const
Return net build node.
class lane2lane connection geometry
FOX-declaration.
Definition GNELane.h:52
const GNELane * myLane
lane
Definition GNELane.h:84
double myInternalDrawingWidth
internal lane drawing width (used for drawing selected lanes)
Definition GNELane.h:93
void update(const GUIVisualizationSettings &s)
update lane drawing constants
Definition GNELane.cpp:74
GUIVisualizationSettings::Detail myDetail
detail level
Definition GNELane.h:99
bool drawAsRailway() const
draw as railway
Definition GNELane.cpp:148
bool drawSuperposed() const
draw superposed
Definition GNELane.cpp:154
double getExaggeration() const
get exaggeration
Definition GNELane.cpp:118
double myExaggeration
exaggeration
Definition GNELane.h:87
double getDrawingWidth() const
get lane drawing width
Definition GNELane.cpp:124
double getInternalDrawingWidth() const
get internal lane drawing width
Definition GNELane.cpp:130
double myDrawingWidth
lane drawing width
Definition GNELane.h:90
bool myDrawAsRailway
draw as railway
Definition GNELane.h:102
double myOffset
lane offset
Definition GNELane.h:96
double getOffset() const
get lane offset
Definition GNELane.cpp:136
bool myDrawSuperposed
draw supersposed (reduced width so that the lane markings below are visible)
Definition GNELane.h:105
GUIVisualizationSettings::Detail getDetail() const
get detail
Definition GNELane.cpp:142
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
GNELane2laneConnection myLane2laneConnections
lane2lane connections
Definition GNELane.h:366
const PositionVector & getLaneShape() const
get elements shape
Definition GNELane.cpp:214
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
Definition GNELane.cpp:1916
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition GNELane.cpp:662
~GNELane()
Destructor.
Definition GNELane.cpp:188
std::string getParentName() const
Returns the name of the parent object (if any)
Definition GNELane.cpp:1910
std::string getAttribute(SumoXMLAttr key) const
Definition GNELane.cpp:668
void drawLaneStopOffset(const GUIVisualizationSettings &s) const
draw laneStopOffset
Definition GNELane.cpp:1692
void drawSelectedLane(const GUIVisualizationSettings &s) const
draw selected lane
Definition GNELane.cpp:1055
bool checkDrawMoveContour() const
check if draw move contour (red)
Definition GNELane.cpp:399
std::vector< double > myLaneRestrictedTextureRotations
Rotations of textures of restricted lanes.
Definition GNELane.h:353
bool allowPedestrians() const
check if current lane allow pedestrians
Definition GNELane.cpp:202
void drawMarkingsAndBoundings(const GUIVisualizationSettings &s) const
draw lane markings
Definition GNELane.cpp:1120
const RGBColor * mySpecialColor
optional special color
Definition GNELane.h:357
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition GNELane.cpp:319
bool isAttributeComputed(SumoXMLAttr key) const
Definition GNELane.cpp:864
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
Definition GNELane.cpp:1716
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
Definition GNELane.cpp:363
double getLengthGeometryFactor() const
get length geometry factor
Definition GNELane.cpp:1974
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNELane.cpp:850
void drawDirectionIndicators(const GUIVisualizationSettings &s) const
direction indicators for lanes
Definition GNELane.cpp:1722
bool checkDrawSelectContour() const
check if draw select contour (blue)
Definition GNELane.cpp:381
void updateGeometry()
update pre-computed geometry information
Definition GNELane.cpp:242
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNELane.cpp:988
GNEEdge * myParentEdge
parent edge (GNELanes cannot use hierarchical structures)
Definition GNELane.h:335
void deleteGLObject()
delete element
Definition GNELane.cpp:476
std::string getAttributeForSelection(SumoXMLAttr key) const
method for getting the attribute in the context of object selection
Definition GNELane.cpp:739
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition GNELane.cpp:492
int getIndex() const
returns the index of the lane
Definition GNELane.cpp:620
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition GNELane.cpp:602
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition GNELane.cpp:423
GUIGeometry myLaneGeometry
lane geometry
Definition GNELane.h:341
bool checkDrawOverContour() const
check if draw over contour (orange)
Definition GNELane.cpp:357
void drawShapeEdited(const GUIVisualizationSettings &s) const
draw shape edited
Definition GNELane.cpp:1074
void drawOverlappedRoutes(const int numRoutes) const
draw overlapped routes
Definition GNELane.cpp:1675
void updateGLObject()
update GLObject (geometry, ID, etc.)
Definition GNELane.cpp:485
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNELane.cpp:411
void buildLaneOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build lane operations contextual menu
Definition GNELane.cpp:2044
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:1944
DrawingConstants * myDrawingConstants
LaneDrawingConstants.
Definition GNELane.h:344
const std::vector< double > & getShapeRotations() const
get rotations of the single shape parts
Definition GNELane.cpp:224
void buildTemplateOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build template oerations contextual menu
Definition GNELane.cpp:2165
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:1539
void calculateLaneContour(const GUIVisualizationSettings &s, const double layer) const
calculate contour
Definition GNELane.cpp:1411
void drawTLSLinkNo(const GUIVisualizationSettings &s) const
draw TLS link Number
Definition GNELane.cpp:1238
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNELane.cpp:876
double getLaneParametricLength() const
returns the parameteric length of the lane
Definition GNELane.cpp:639
RGBColor setLaneColor(const GUIVisualizationSettings &s) const
set color according to edit mode and visualisation settings
Definition GNELane.cpp:1429
bool isValid(SumoXMLAttr key, const std::string &value)
Definition GNELane.cpp:787
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition GNELane.cpp:1923
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
Definition GNELane.cpp:656
const DrawingConstants * getDrawingConstants() const
get lane drawing constants (previously calculated in drawGL())
Definition GNELane.cpp:236
int myIndex
The index of this lane.
Definition GNELane.h:338
void drawLaneAsRailway() const
draw lane as railway
Definition GNELane.cpp:1764
void setIndex(int index)
Definition GNELane.cpp:626
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNELane.cpp:449
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:882
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:608
void drawArrows(const GUIVisualizationSettings &s) const
draw lane arrows
Definition GNELane.cpp:1275
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition GNELane.cpp:614
void drawLane(const GUIVisualizationSettings &s, const double layer) const
draw lane
Definition GNELane.cpp:1006
double mySpecialColorValue
optional value that corresponds to which the special color corresponds
Definition GNELane.h:360
void drawChildren(const GUIVisualizationSettings &s) const
draw children
Definition GNELane.cpp:1100
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
Definition GNELane.cpp:351
std::vector< Position > myLaneRestrictedTexturePositions
Position of textures of restricted lanes.
Definition GNELane.h:350
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition GNELane.cpp:997
double getLaneShapeLength() const
returns the length of the lane's shape
Definition GNELane.cpp:650
void drawStartEndGeometryPoints(const GUIVisualizationSettings &s) const
draw start and end geometry points
Definition GNELane.cpp:1842
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
Definition GNELane.h:363
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
return value for lane coloring according to the given scheme
Definition GNELane.cpp:1563
bool checkDrawToContour() const
check if draw from contour (magenta)
Definition GNELane.cpp:338
bool setFunctionalColor(int activeScheme, RGBColor &col) const
sets the color according to the current scheme index and some lane function
Definition GNELane.cpp:1525
void updateConnectionIDs()
update IDs of incoming connections of this lane
Definition GNELane.cpp:1959
void buildRechableOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build rechable operations contextual menu
Definition GNELane.cpp:2191
void drawLane2LaneConnections() const
draw lane to lane connections
Definition GNELane.cpp:1363
void buildEdgeOperations(GUISUMOAbstractView &parent, GUIGLObjectPopupMenu *ret)
build edge operations contextual menu
Definition GNELane.cpp:1985
const std::vector< double > & getShapeLengths() const
get lengths of the single shape parts
Definition GNELane.cpp:230
PositionVector getAttributePositionVector(SumoXMLAttr key) const
Definition GNELane.cpp:727
void drawLinkNo(const GUIVisualizationSettings &s) const
draw link Number
Definition GNELane.cpp:1201
double getSpeed() const
returns the current speed of lane
Definition GNELane.cpp:633
void drawTextures(const GUIVisualizationSettings &s) const
draw lane textures
Definition GNELane.cpp:1810
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition GNELane.cpp:749
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:601
GNEPathManager * getDataPathManager()
get data path manager
Definition GNENet.cpp:151
GNEPathManager * getDemandPathManager()
get demand path manager
Definition GNENet.cpp:145
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:127
bool isNetRecomputed() const
check if net require recomputing
Definition GNENet.cpp:1551
GNEPathManager * getNetworkPathManager()
get network path manager
Definition GNENet.cpp:139
NBEdgeCont & getEdgeCont()
returns the NBEdgeCont of the underlying netbuilder
Definition GNENet.cpp:2175
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2163
GNEContour myNetworkElementContour
network element contour
bool myShapeEdited
flag to check if element shape is being edited
void setNetworkElementID(const std::string &newID)
set network element id
bool isShapeEdited() const
check if shape is being edited
bool drawCandidateEdgesWithSpecialColor() const
draw candidate edges with special color (Only for candidates, special and conflicted)
void invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
void drawLanePathElements(const GUIVisualizationSettings &s, const GNELane *lane) const
draw lane path elements
GNEPathCreator * getPathCreator() const
get path creator module
bool controlsEdge(GNEEdge *edge) const
whether the given edge is controlled by the currently edited tlDef
void handleMultiChange(GNELane *lane, FXObject *obj, FXSelector sel, void *data)
update phase definition for the current traffic light and phase
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 GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
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
GNEDeleteFrame * getDeleteFrame() const
get frame for delete elements
GNETLSEditorFrame * getTLSEditorFrame() const
get frame for NETWORK_TLS
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
GNERouteFrame * getRouteFrame() const
get frame for DEMAND_ROUTE
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
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
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
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.
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 checkBoundaryParentObject(const GUIGlObject *GLObject, const double layer, const GUIGlObject *parent)
Stores the information about how to visualize structures.
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)
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.
The representation of a single edge during network building.
Definition NBEdge.h:92
double getLaneSpeed(int lane) const
get lane speed
Definition NBEdge.cpp:2209
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:4370
double getLength() const
Returns the computed length of the edge.
Definition NBEdge.h:593
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition NBEdge.cpp:4379
double getDistancAt(double pos) const
get distance at the given offset
Definition NBEdge.cpp:4917
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:4342
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
Definition NBEdge.h:602
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition NBEdge.cpp:4294
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition NBEdge.h:642
NBNode * getToNode() const
Returns the destination node of the edge.
Definition NBEdge.h:546
std::vector< Connection > myConnections
List of connections to following edges.
Definition NBEdge.h:1770
Lane & getLaneStruct(int lane)
Definition NBEdge.h:1428
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition NBEdge.cpp:749
NBNode * myTo
Definition NBEdge.h:1740
const std::string & getID() const
Definition NBEdge.h:1528
bool allowsChangingRight(int lane, SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
Definition NBEdge.cpp:4526
double getDistance() const
get distance
Definition NBEdge.h:679
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
Definition NBEdge.cpp:4165
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
Definition NBEdge.cpp:4326
bool isBidiEdge(bool checkPotential=false) const
whether this edge is part of a bidirectional edge pair
Definition NBEdge.cpp:761
int getNumLanes() const
Returns the number of lanes.
Definition NBEdge.h:520
std::vector< Connection > getConnectionsFromLane(int lane, const NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition NBEdge.cpp:1287
void setFriction(int lane, double friction)
set lane specific friction (negative lane implies set for all lanes)
Definition NBEdge.cpp:4310
std::string getLaneID(int lane) const
get lane ID
Definition NBEdge.cpp:4017
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
Definition NBEdge.cpp:4334
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition NBEdge.h:539
int getPriority() const
Returns the priority of the edge.
Definition NBEdge.h:527
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition NBEdge.h:346
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition NBEdge.cpp:4248
bool allowsChangingLeft(int lane, SUMOVehicleClass vclass) const
Returns whether the given vehicle class may change left from this lane.
Definition NBEdge.cpp:4520
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition NBEdge.h:1136
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition NBEdge.cpp:986
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition NBEdge.cpp:590
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition NBEdge.cpp:4715
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:2409
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
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:2494
int getConnectionIndex(const NBEdge *from, const NBEdge::Connection &con) const
return the index of the given connection
Definition NBNode.cpp:4004
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
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
double x() const
Returns the x-position.
Definition Position.h:55
double z() const
Returns the z-position.
Definition Position.h:65
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position (in radians bet...
Definition Position.h:286
double y() const
Returns the y-position.
Definition Position.h:60
A list of positions.
double length2D() const
Returns the length.
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position
double length() const
Returns the length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
int indexOfClosest(const Position &p, bool twoD=false) const
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor WHITE
Definition RGBColor.h:192
static const RGBColor ORANGE
Definition RGBColor.h:191
static const RGBColor CYAN
Definition RGBColor.h:189
static const RGBColor GREEN
Definition RGBColor.h:186
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb....
Definition RGBColor.cpp:371
static const RGBColor BLACK
Definition RGBColor.h:193
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition RGBColor.cpp:200
void setOffset(const double offset)
set offset
bool isDefined() const
check if stopOffset was defined
void setExceptions(const std::string permissions)
set exceptions (used in netedit)
std::string getExceptions() const
get exceptions (used in netedit)
double getOffset() const
get offset
std::vector< std::string > getStrings() const
T get(const std::string &str) 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
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool editingElevation() const
check if we're editing elevation
bool showDemandElements() const
check if show demand elements checkbox is enabled
static const RGBColor special
color for selected special candidate element (Usually selected using shift+click)
static const RGBColor conflict
color for selected conflict candidate element (Usually selected using ctrl+click)
static const RGBColor invalid
color for invalid elements
static const RGBColor target
color for selected candidate target
static const RGBColor possible
color for possible candidate element
static const RGBColor source
color for selected candidate source
RGBColor selectedEdgeColor
edge selection color
RGBColor selectedLaneColor
lane selection color
static const RGBColor editShapeColor
color for edited shapes (Junctions, crossings and connections)
static const double segmentWidth
width of dotted contour segments
static const double laneGeometryPointRadius
moving lane geometry point radius
static const double junctionBubbleRadius
junction bubble radius
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool show(const GUIGlObject *o) const
whether to show the text
double width
This lane's width.
Definition NBEdge.h:176
StopOffset laneStopOffset
stopOffsets.second - The stop offset for vehicles stopping at the lane's end. Applies if vClass is in...
Definition NBEdge.h:173
PositionVector customShape
A custom shape for this lane set by the user.
Definition NBEdge.h:189
double endOffset
This lane's offset to the intersection begin.
Definition NBEdge.h:169
std::string type
the type of this lane
Definition NBEdge.h:192
std::string oppositeID
An opposite lane ID, if given.
Definition NBEdge.h:179
SVCPermissions changeRight
List of vehicle types that are allowed to change right from this lane.
Definition NBEdge.h:166
double friction
The friction on this lane.
Definition NBEdge.h:154
SVCPermissions changeLeft
List of vehicle types that are allowed to change Left from this lane.
Definition NBEdge.h:163
bool accelRamp
Whether this lane is an acceleration lane.
Definition NBEdge.h:182
PositionVector shape
The lane's shape.
Definition NBEdge.h:148