Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEConnection.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 connections between lanes
19/****************************************************************************/
20#include <config.h>
21
23#include <netedit/GNENet.h>
24#include <netedit/GNEUndoList.h>
25#include <netedit/GNEViewNet.h>
35
36#include "GNEConnection.h"
37#include "GNEInternalLane.h"
38
39
40// ===========================================================================
41// static member definitions
42// ===========================================================================
43static const int NUM_POINTS = 5;
44
45// ===========================================================================
46// method definitions
47// ===========================================================================
48
50 GNENetworkElement(from->getNet(), "from" + from->getID() + "to" + to->getID(),
51 GLO_CONNECTION, SUMO_TAG_CONNECTION, GUIIconSubSys::getIcon(GUIIcon::CONNECTION), {}, {}, {}, {}, {}, {}),
52 myFromLane(from),
53 myToLane(to),
54 myLinkState(LINKSTATE_TL_OFF_NOSIGNAL),
55 mySpecialColor(nullptr),
56myShapeDeprecated(true) {
57 // update centering boundary without updating grid
58 updateCenteringBoundary(false);
59}
60
61
64
65
66const PositionVector&
68 if (myConnectionGeometry.getShape().size() > 0) {
70 } else {
72 }
73}
74
75
76void
79 // Get shape of from and to lanes
81 // obtain lane shape from
82 PositionVector laneShapeFrom;
83 if ((int)getEdgeFrom()->getNBEdge()->getLanes().size() > nbCon.fromLane) {
84 laneShapeFrom = getEdgeFrom()->getNBEdge()->getLanes().at(nbCon.fromLane).shape;
85 } else {
86 return;
87 }
88 // obtain lane shape to
89 PositionVector laneShapeTo;
90 if ((int)nbCon.toEdge->getLanes().size() > nbCon.toLane) {
91 laneShapeTo = nbCon.toEdge->getLanes().at(nbCon.toLane).shape;
92 } else {
93 return;
94 }
95 // Calculate shape of connection depending of the size of Junction shape
96 // value obtained from GNEJunction::drawgl
97 if (nbCon.customShape.size() != 0) {
99 } else {
100 if (nbCon.shape.size() > 1) {
101 PositionVector connectionShape;
102 if (nbCon.shape.front() == nbCon.shape.back()) {
103 laneShapeFrom.move2side(0.7);
104 laneShapeTo.move2side(0.7);
105 connectionShape.push_back(laneShapeFrom.back());
106 connectionShape.push_back(laneShapeTo.front());
107 } else {
108 connectionShape = nbCon.shape;
109 }
110 // only append via shape if it exists
111 if (nbCon.haveVia) {
112 connectionShape.append(nbCon.viaShape);
113 }
114 myConnectionGeometry.updateGeometry(connectionShape);
115 } else {
116 // Calculate shape so something can be drawn immediately
117 myConnectionGeometry.updateGeometry(getEdgeFrom()->getNBEdge()->getToNode()->computeSmoothShape(
118 laneShapeFrom, laneShapeTo, NUM_POINTS,
119 getEdgeFrom()->getNBEdge()->getTurnDestination() == nbCon.toEdge,
120 (double) 5. * (double) getEdgeFrom()->getNBEdge()->getNumLanes(),
121 (double) 5. * (double) nbCon.toEdge->getNumLanes()));
122 }
123 }
124 // check if internal junction marker must be calculated
125 if (nbCon.haveVia && (nbCon.shape.size() != 0)) {
126 // create marker for internal junction waiting position (contPos)
127 const double orthoLength = 0.5;
128 Position pos = nbCon.shape.back();
129 myInternalJunctionMarker = nbCon.shape.getOrthogonal(pos, 10, true, 0.1);
130 if (myInternalJunctionMarker.length() < orthoLength) {
132 }
133 } else {
135 }
136 // mark connection as non-deprecated
137 myShapeDeprecated = false;
138 }
139}
140
141
144 // currently unused
145 return Position(0, 0);
146}
147
148
149bool
151 return false;
152}
153
154
155bool
157 return false;
158}
159
160
161bool
163 return false;
164}
165
166
167bool
169 return false;
170}
171
172
173bool
175 // get edit modes
176 const auto& editModes = myNet->getViewNet()->getEditModes();
177 // check if we're in delete mode
178 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
180 } else {
181 return false;
182 }
183}
184
185
186bool
188 // get edit modes
189 const auto& editModes = myNet->getViewNet()->getEditModes();
190 // check if we're in select mode
191 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
193 } else {
194 return false;
195 }
196}
197
198
199bool
201 // get edit modes
202 const auto& editModes = myNet->getViewNet()->getEditModes();
203 // check if we're in move mode
204 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
205 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
206 // check if we're editing this network element
208 if (editedNetworkElement) {
209 return editedNetworkElement == this;
210 } else {
211 // only move the first element
213 }
214 } else {
215 return false;
216 }
217}
218
219
222 // edit depending if shape is being edited
223 if (isShapeEdited()) {
224 // get connection
225 const auto& connection = getNBEdgeConnection();
226 // calculate move shape operation
227 return calculateMoveShapeOperation(this, connection.customShape.size() > 0 ? connection.customShape : myConnectionGeometry.getShape(), false);
228 } else {
229 return nullptr;
230 }
231}
232
233
234void
235GNEConnection::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
236 // edit depending if shape is being edited
237 if (isShapeEdited()) {
238 // get connection
239 const auto& connection = getNBEdgeConnection();
240 // get original shape
241 PositionVector shape = connection.customShape.size() > 0 ? connection.customShape : connection.shape;
242 // check shape size
243 if (shape.size() > 2) {
244 // obtain index
245 int index = shape.indexOfClosest(clickedPosition);
246 // get snap radius
248 // check if we have to create a new index
249 if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
250 // remove geometry point
251 shape.erase(shape.begin() + index);
252 // commit new shape
253 undoList->begin(this, "remove geometry point of " + getTagStr());
255 undoList->end();
256 }
257 }
258 }
259}
260
261
262GNEEdge*
266
267
268GNEEdge*
270 return myToLane->getParentEdge();
271}
272
273
274GNELane*
276 return myFromLane;
277}
278
279
280GNELane*
282 return myToLane;
283}
284
285
286int
290
291
292int
294 return myToLane->getIndex();
295}
296
297
302
303
307 return NBConnection(getEdgeFrom()->getNBEdge(), getFromLaneIndex(),
308 getEdgeTo()->getNBEdge(), getToLaneIndex(),
309 (int)c.tlLinkIndex, (int)c.tlLinkIndex2);
310}
311
312
313void
317
318
321 return myLinkState;
322}
323
324
325void
329
330
331void
335 nbCon.toEdge,
336 nbCon.fromLane,
337 nbCon.toLane,
338 nbCon.mayDefinitelyPass,
339 nbCon.tlID);
340}
341
342
343void
345 auto shape = getConnectionShape();
346 shape = shape.bezier(5);
348}
349
350
353 if (myShapeEdited) {
354 return getShapeEditedPopUpMenu(app, parent, getNBEdgeConnection().customShape);
355 } else {
356 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
357 buildPopupHeader(ret, app);
360 // build selection and show parameters menu
363 // build position copy entry
364 buildPositionCopyEntry(ret, app);
365 // check if we're in supermode network
367 // create menu commands
368 FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, "Set custom connection shape", nullptr, &parent, MID_GNE_CONNECTION_EDIT_SHAPE);
369 GUIDesigns::buildFXMenuCommand(ret, "Smooth connection shape", nullptr, &parent, MID_GNE_CONNECTION_SMOOTH_SHAPE);
370 // check if menu commands has to be disabled
372 // check if we're in the correct edit mode
374 mcCustomShape->disable();
375 }
376 }
377 return ret;
378 }
379}
380
381
382double
386
387
392
393
394void
395GNEConnection::updateCenteringBoundary(const bool /*updateGrid*/) {
396 // nothing to update
397}
398
399
400void
402 // Check if connection must be drawed
403 if (checkDrawConnection()) {
404 // get connection exaggeration
405 const double connectionExaggeration = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
406 // get detail level
407 const auto d = s.getDetailLevel(connectionExaggeration);
408 // check if draw shape superposed (used in train lanes)
409 PositionVector shapeSuperposed = myConnectionGeometry.getShape();
411 shapeSuperposed.move2side(0.5);
412 }
413 // draw geometry only if we'rent in drawForObjectUnderCursor mode
415 // draw connection
416 drawConnection(s, d, shapeSuperposed, connectionExaggeration);
417 // draw lock icon
419 // draw dotted contour depending if we're editing the custom shape
421 if (editedNetworkElement && (editedNetworkElement == this)) {
422 // draw dotted contour geometry points
424 connectionExaggeration, s.dottedContourSettings.segmentWidthSmall);
425 } else {
426 // draw dotted contour
428 }
429 }
430 // calculate contour
431 calculateConnectionContour(s, d, shapeSuperposed, connectionExaggeration);
432 }
433}
434
435
436void
440
441
442void
446
447
448void
452
453
454std::string
456 // first get attributes in which nbConnection reference can be invalid
457 switch (key) {
458 case SUMO_ATTR_ID:
459 return getMicrosimID();
460 case SUMO_ATTR_FROM:
461 return myFromLane->getParentEdge()->getID();
462 case SUMO_ATTR_TO:
463 return myToLane->getParentEdge()->getID();
467 return myFromLane->getID();
471 return myToLane->getID();
474 case GNE_ATTR_PARENT:
475 return getEdgeFrom()->getToJunction()->getID();
476 default:
477 break;
478 }
479 // now continue with attributes that needs a nbConnection reference
481 switch (key) {
482 case SUMO_ATTR_PASS:
483 return toString(nbCon.mayDefinitelyPass);
485 return toString(nbCon.indirectLeft);
486 case SUMO_ATTR_TYPE:
487 return toString(nbCon.edgeType);
489 return toString(nbCon.keepClear);
491 return toString(nbCon.contPos);
493 return toString(nbCon.uncontrolled);
495 return toString(nbCon.visibility);
497 return toString(nbCon.tlLinkIndex);
499 return toString(nbCon.tlLinkIndex2);
500 case SUMO_ATTR_ALLOW:
501 if (nbCon.permissions == SVC_UNSPECIFIED) {
502 return getVehicleClassNames(nbCon.toEdge->getLanes()[nbCon.toLane].permissions);
503 } else {
504 return getVehicleClassNames(nbCon.permissions);
505 }
507 if (nbCon.permissions == SVC_UNSPECIFIED) {
508 return getVehicleClassNames(invertPermissions(nbCon.toEdge->getLanes()[nbCon.toLane].permissions));
509 } else {
511 }
513 if (nbCon.changeLeft == SVC_UNSPECIFIED) {
514 return "all";
515 } else {
516 return getVehicleClassNames(nbCon.changeLeft);
517 }
519 if (nbCon.changeRight == SVC_UNSPECIFIED) {
520 return "all";
521 } else {
522 return getVehicleClassNames(nbCon.changeRight);
523 }
524 case SUMO_ATTR_SPEED:
525 if (nbCon.speed == NBEdge::UNSPECIFIED_SPEED) {
526 return "default";
527 } else {
528 return toString(nbCon.speed);
529 }
530 case SUMO_ATTR_LENGTH:
531 return toString(nbCon.customLength);
532 case SUMO_ATTR_DIR:
533 return toString(getEdgeFrom()->getNBEdge()->getToNode()->getDirection(
534 getEdgeFrom()->getNBEdge(), nbCon.toEdge, OptionsCont::getOptions().getBool("lefthand")));
535 case SUMO_ATTR_STATE:
536 return toString(getEdgeFrom()->getNBEdge()->getToNode()->getLinkState(
537 getEdgeFrom()->getNBEdge(), nbCon.toEdge, nbCon.fromLane, nbCon.toLane, nbCon.mayDefinitelyPass, nbCon.tlID));
538 case SUMO_ATTR_SHAPE:
540 return toString(nbCon.customShape);
542 return nbCon.getParametersStr();
543 default:
544 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
545 }
546}
547
548
551 switch (key) {
552 case SUMO_ATTR_SHAPE:
555 default:
556 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
557 }
558}
559
560
561void
562GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
564 switch (key) {
565 case SUMO_ATTR_FROM:
566 case SUMO_ATTR_TO:
569 case SUMO_ATTR_PASS:
574 case SUMO_ATTR_ALLOW:
578 case SUMO_ATTR_SPEED:
579 case SUMO_ATTR_LENGTH:
580 case SUMO_ATTR_SHAPE:
582 case SUMO_ATTR_TYPE:
585 // no special handling
586 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
587 break;
589 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
590 changeTLIndex(key, parse<int>(value), c.tlLinkIndex2, undoList);
591 }
592 break;
594 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
595 changeTLIndex(key, c.tlLinkIndex, parse<int>(value), undoList);
596 }
597 break;
599 undoList->begin(this, "change attribute indirect for connection");
600 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
601 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
602 int linkIndex2 = -1;
603 if (parse<bool>(value)) {
604 // find straight connection with the same toEdge
605 std::set<NBTrafficLightDefinition*> defs = getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS();
606 NBEdge* from = getEdgeFrom()->getNBEdge();
607 for (NBTrafficLightDefinition* tlDef : defs) {
608 for (const NBConnection& c2 : tlDef->getControlledLinks()) {
609 if (c2.getTo() == c.toEdge && c2.getFrom() != from) {
610 LinkDirection dir = from->getToNode()->getDirection(c2.getFrom(), c2.getTo());
611 if (dir == LinkDirection::STRAIGHT) {
612 linkIndex2 = c2.getTLIndex();
613 break;
614 }
615 }
616 }
617 }
618 }
619 changeTLIndex(key, c.tlLinkIndex, linkIndex2, undoList);
620 }
621 undoList->end();
622 break;
623 case SUMO_ATTR_DIR:
624 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
625 case SUMO_ATTR_STATE:
626 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
627 default:
628 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
629 }
630}
631
632
633void
634GNEConnection::changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList* undoList) {
635 // trigger GNEChange_TLS
636 undoList->begin(this, "change tls linkIndex for connection");
637 // make a copy
638 std::set<NBTrafficLightDefinition*> defs = getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS();
639 for (const auto& tlDef : defs) {
640 NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
641 NBTrafficLightLogic* tllogic = sumoDef ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
642 if (tllogic != nullptr) {
643 NBLoadedSUMOTLDef* newDef = new NBLoadedSUMOTLDef(*tlDef, *tllogic);
644 newDef->addConnection(getEdgeFrom()->getNBEdge(), getEdgeTo()->getNBEdge(),
645 getLaneFrom()->getIndex(), getLaneTo()->getIndex(), tlIndex, tlIndex2, false);
646 // make a copy
647 std::vector<NBNode*> nodes = tlDef->getNodes();
648 for (const auto& node : nodes) {
649 GNEJunction* junction = getNet()->getAttributeCarriers()->retrieveJunction(node->getID());
650 undoList->add(new GNEChange_TLS(junction, tlDef, false), true);
651 undoList->add(new GNEChange_TLS(junction, newDef, true), true);
652 }
653 } else {
654 WRITE_ERRORF(TL("Could not set attribute '%' (tls is broken)"), toString(key));
655 }
656 }
657 undoList->end();
658}
659
660
661bool
665
666
667bool
669 // declare a flag to check if shape has to be draw (by deafult false)
670 bool drawConnection = false;
671 // only draw connections if shape isn't deprecated
677 } else {
678 drawConnection = false;
679 }
680 } else {
681 drawConnection = false;
682 }
683 // check if we're editing this connection
685 if (editedNetworkElement && (editedNetworkElement->getTagProperty().getTag() == SUMO_TAG_CONNECTION)) {
686 if (editedNetworkElement->getAttribute(GNE_ATTR_PARENT) == getAttribute(GNE_ATTR_PARENT)) {
687 drawConnection = true;
688 }
689 }
690 return drawConnection;
691}
692
693
696 // check conditions
697 if (myShapeEdited) {
698 // return shape edit color
700 } else if (drawUsingSelectColor()) {
701 // override with special colors (unless the color scheme is based on selection)
703 } else if (mySpecialColor != nullptr) {
704 // return special color
705 return *mySpecialColor;
706 } else {
707 // Set color depending of the link state
709 }
710}
711
712
713void
715 const PositionVector& shape, const double exaggeration) const {
716 // get color
717 RGBColor connectionColor = getConnectionColor(s);
718 // Push layer matrix
720 // translate to front
723 } else {
725 }
726 // Set color
727 GLHelper::setColor(connectionColor);
728 // continue depending of detail level
730 // draw geometry
732 s.connectionSettings.connectionWidth * exaggeration);
733 // draw arrows over connection
734 drawConnectionArrows(s, connectionColor);
735 // check if internal junction marker has to be drawn
736 if (myInternalJunctionMarker.size() > 0) {
738 }
739 // draw edge values
740 drawEdgeValues(s, shape);
741 // draw shape points only in Network supemode
743 // draw geometry points
747 }
748 } else {
750 }
751 // Pop layer matrix
753}
754
755
756void
758 if (s.showLaneDirection) {
759 // Push matrix
761 // move front
762 glTranslated(0, 0, 0.1);
763 // change color
765 // draw triangles
766 for (int i = 1; i < (int)myConnectionGeometry.getShape().size(); i++) {
767 const auto posA = myConnectionGeometry.getShape()[i - 1];
768 const auto posB = myConnectionGeometry.getShape()[i];
769 GLHelper::drawTriangleAtEnd(posA, posB, (double) 1, (double) .2);
770 }
771 // Pop matrix
773 }
774}
775
776
777void
779 // check if edge value has to be shown
780 if (s.edgeValue.show(this)) {
782 const std::string value = nbCon.getParameter(s.edgeParam, "");
783 if (value != "") {
784 int shapeIndex = (int)shape.size() / 2;
785 const Position p = (myConnectionGeometry.getShape().size() == 2) ? (shape.front() * 0.67 + shape.back() * 0.33) : shape[shapeIndex];
786 GLHelper::drawTextSettings(s.edgeValue, value, p, s.scale, 0);
787 }
788 }
789}
790
791
792void
794 const PositionVector& shape, const double exaggeration) const {
795 // first check if junction parent was inserted with full boundary
797 // calculate geometry points contour if we're editing shape
798 if (myShapeEdited) {
800 exaggeration, true);
801 } else {
802 // calculate connection shape contour
803 myNetworkElementContour.calculateContourExtrudedShape(s, d, this, shape, getType(), s.connectionSettings.connectionWidth, exaggeration, true, true, 0, nullptr);
804 }
805 }
806}
807
808
809bool
810GNEConnection::isValid(SumoXMLAttr key, const std::string& value) {
811 // Currently ignored before implementation to avoid warnings
812 switch (key) {
813 case SUMO_ATTR_FROM:
814 case SUMO_ATTR_TO:
817 return false;
818 case SUMO_ATTR_PASS:
819 return canParse<bool>(value);
821 return canParse<bool>(value);
822 case SUMO_ATTR_TYPE:
823 return true;
825 return canParse<bool>(value);
827 return canParse<double>(value) && (parse<double>(value) >= -1);
829 return canParse<bool>(value);
831 return canParse<double>(value) && (parse<double>(value) >= -1);
836 (getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS().size() > 0) &&
837 canParse<int>(value) &&
838 (parse<int>(value) >= 0 || parse<int>(value) == -1)) {
839 // obtain Traffic light definition
841 return def->getMaxValidIndex() >= parse<int>(value);
842 } else {
843 return false;
844 }
845 case SUMO_ATTR_ALLOW:
849 return canParseVehicleClasses(value);
850 case SUMO_ATTR_SPEED:
851 if (value.empty() || value == "default") {
852 return true;
853 } else {
854 return canParse<double>(value) && ((parse<double>(value) >= 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_SPEED));
855 }
856 case SUMO_ATTR_LENGTH:
857 return canParse<double>(value) && (parse<double>(value) >= -1);
858 case SUMO_ATTR_SHAPE:
860 // empty custom shapes are allowed
861 return canParse<PositionVector>(value);
862 case SUMO_ATTR_STATE:
863 return false;
864 case SUMO_ATTR_DIR:
865 return false;
867 return canParse<bool>(value);
870 default:
871 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
872 }
873}
874
875
876bool
878 switch (key) {
879 case SUMO_ATTR_FROM:
880 case SUMO_ATTR_TO:
883 case SUMO_ATTR_DIR:
884 case SUMO_ATTR_STATE:
885 // this attributes cannot be edited
886 return false;
889 // get Traffic Light definitions
890 if (getEdgeFrom()->getNBEdge()->getToNode()->isTLControlled()) {
892 NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
893 NBTrafficLightLogic* tllogic = sumoDef != nullptr ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
894 if (tllogic != nullptr) {
895 return true;
896 } else {
897 return false;
898 }
899 }
900 return false;
901 default:
902 return true;
903 }
904}
905
906
907bool
909 switch (key) {
910 case SUMO_ATTR_SPEED:
912 default:
913 return false;
914 }
915}
916
917
922
923// ===========================================================================
924// private
925// ===========================================================================
926
927void
928GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value) {
929 if (!existNBEdgeConnection()) {
930 WRITE_WARNINGF("Cannot restore attribute '%=%' for computed connection from lane '%'", toString(key), value, myFromLane->getID());
931 return;
932 }
934 switch (key) {
935 case SUMO_ATTR_PASS:
936 nbCon.mayDefinitelyPass = parse<bool>(value);
937 break;
939 nbCon.indirectLeft = parse<bool>(value);
940 break;
942 if (value == toString(KEEPCLEAR_UNSPECIFIED)) {
944 } else {
945 nbCon.keepClear = parse<bool>(value) ? KEEPCLEAR_TRUE : KEEPCLEAR_FALSE;
946 }
947 break;
949 nbCon.uncontrolled = parse<bool>(value);
950 break;
952 nbCon.contPos = parse<double>(value);
953 break;
955 nbCon.visibility = parse<double>(value);
956 break;
957 case SUMO_ATTR_SPEED:
958 if (value.empty() || (value == "default")) {
960 } else {
961 nbCon.speed = parse<double>(value);
962 }
963 break;
964 case SUMO_ATTR_LENGTH:
965 nbCon.customLength = parse<double>(value);
966 break;
967 case SUMO_ATTR_ALLOW:
968 nbCon.permissions = parseVehicleClasses(value);
969 break;
972 break;
974 nbCon.changeLeft = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
975 break;
977 nbCon.changeRight = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
978 break;
979 case SUMO_ATTR_STATE:
980 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
981 case SUMO_ATTR_DIR:
982 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
983 case SUMO_ATTR_SHAPE:
985 nbCon.customShape = parse<PositionVector>(value);
986 // update centering boundary
988 break;
989 case SUMO_ATTR_TYPE:
990 nbCon.edgeType = value;
991 break;
993 if (parse<bool>(value)) {
995 } else {
997 }
998 break;
1000 nbCon.setParametersStr(value);
1001 break;
1002 default:
1003 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1004 }
1005 // Update Geometry after setting a new attribute (but avoided for certain attributes)
1006 if ((key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
1009 }
1010 // invalidate demand path calculator
1012}
1013
1014
1015void
1017 // set custom shape
1019 // mark junction as deprecated
1020 myShapeDeprecated = true;
1021 // update geometry
1023}
1024
1025
1026void
1028 // commit new shape
1029 undoList->begin(this, "moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
1031 undoList->end();
1032}
1033
1034/****************************************************************************/
static const int NUM_POINTS
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_DELETE
mode for deleting network elements
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_CREATE_EDGE
mode for creating new edges
@ NETWORK_TLS
mode for editing tls
@ NETWORK_SELECT
mode for selecting network elements
@ NETWORK_CONNECT
mode for connecting lanes
@ MID_GNE_CONNECTION_SMOOTH_SHAPE
@ brief smooth connection shape
@ MID_GNE_CONNECTION_EDIT_SHAPE
edit connection shape
@ GLO_CONNECTION
a connection
GUIViewObjectsHandler gViewObjectsHandler
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:296
#define WRITE_ERRORF(...)
Definition MsgHandler.h:305
#define TL(string)
Definition MsgHandler.h:315
@ KEEPCLEAR_FALSE
Definition NBCont.h:59
@ KEEPCLEAR_TRUE
Definition NBCont.h:60
@ KEEPCLEAR_UNSPECIFIED
Definition NBCont.h:61
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
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.
@ SUMO_TAG_CONNECTION
connectioon between two lanes
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
@ STRAIGHT
The link is a straight direction.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
@ 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_TLLINKINDEX2
link: the index of the opposite direction link of a pedestrian crossing
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_INDIRECT
Whether this connection is an indirect (left) turn.
@ SUMO_ATTR_FROM_LANE
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_CUSTOMSHAPE
whether a given shape is user-defined
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_FROM_LANEID
from lane ID (used in GNEConnection)
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_CHANGE_LEFT
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_PASS
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ GNE_ATTR_TO_LANEID
to lane ID (used in GNEConnection)
@ SUMO_ATTR_CHANGE_RIGHT
@ SUMO_ATTR_TO_LANE
@ SUMO_ATTR_UNCONTROLLED
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_ID
@ SUMO_ATTR_VISIBILITY_DISTANCE
foe visibility distance of a link
@ SUMO_ATTR_CONTPOS
@ SUMO_ATTR_DIR
The abstract direction of a link.
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
@ SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
@ SUMO_ATTR_STATE
The state of a link.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition GLHelper.cpp:438
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:654
static void drawTriangleAtEnd(const Position &p1, const Position &p2, double tLength, double tWidth, const double extraOffset=0)
Draws a triangle at the end of the given line.
Definition GLHelper.cpp:629
static void popMatrix()
pop matrix
Definition GLHelper.cpp:130
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition GLHelper.cpp:347
static void pushMatrix()
push matrix
Definition GLHelper.cpp:117
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
Definition GLHelper.cpp:787
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void updateConnectionID()
update internal ID of Connection
NBConnection getNBConnection() const
get NBConnection
Position getPositionInView() const
Returns position of hierarchical element in view.
GNELane * getLaneFrom() const
@briefthe get lane of the incoming lane
void smootShape()
smoothShape
const PositionVector & getConnectionShape() const
get connection shape
bool checkDrawSelectContour() const
check if draw select contour (blue)
GNELane * getLaneTo() const
@briefthe get lane of the outgoing lane
GNELane * myFromLane
incoming lane of this connection
LinkState getLinkState() const
get LinkState
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
int getFromLaneIndex() const
@briefthe get lane index of the incoming lane
void deleteGLObject()
delete element
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
GUIGeometry myConnectionGeometry
connection geometry
GNELane * myToLane
outgoing lane of this connection
bool checkDrawOverContour() const
check if draw over contour (orange)
void drawEdgeValues(const GUIVisualizationSettings &s, const PositionVector &shape) const
draw edge value
bool checkDrawFromContour() const
check if draw from contour (green)
bool existNBEdgeConnection() const
check if the edgeConnection vinculated with this connection exists
std::string getAttribute(SumoXMLAttr key) const
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
bool isAttributeComputed(SumoXMLAttr key) const
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
PositionVector getAttributePositionVector(SumoXMLAttr key) const
GNEConnection(GNELane *from, GNELane *to)
void drawConnection(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const PositionVector &shape, const double exaggeration) const
draw connection
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
void setSpecialColor(const RGBColor *Color2)
void drawConnectionArrows(const GUIVisualizationSettings &s, const RGBColor &color) const
draw arrows over connections
GNEMoveOperation * getMoveOperation()
get move operation for the given shapeOffset (can be nullptr)
void updateGeometry()
update pre-computed geometry information
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
bool isValid(SumoXMLAttr key, const std::string &value)
const RGBColor * mySpecialColor
optional special color
~GNEConnection()
Destructor.
int getToLaneIndex() const
@briefthe get lane index of the outgoing lane
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool myShapeDeprecated
flag to indicate that connection's shape has to be updated
void calculateConnectionContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const PositionVector &shape, const double exaggeration) const
calculate connection contour
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
void updateLinkState()
recompute cached myLinkState
const Parameterised::Map & getACParametersMap() const
get parameters map
bool checkDrawConnection() const
check if draw connection
PositionVector myInternalJunctionMarker
waiting position for internal junction
RGBColor getConnectionColor(const GUIVisualizationSettings &s) const
get connection color
bool checkDrawMoveContour() const
check if draw move contour (red)
bool isAttributeEnabled(SumoXMLAttr key) const
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
LinkState myLinkState
Linkstate.
void updateGLObject()
update GLObject (geometry, ID, etc.)
bool checkDrawToContour() const
check if draw from contour (magenta)
void changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList *undoList)
manage change of tlLinkindices
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
calculate contour extruded (used in elements formed by a central shape)
void drawDottedContourGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const PositionVector &shape, const double radius, const double scale, const double lineWidth) const
draw dotted contour for geometry points
void 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...)
Boundary getContourBoundary() const
get contour boundary
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
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:781
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:82
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
bool drawSuperposed() const
draw superposed
Definition GNELane.cpp:154
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
std::string getAttribute(SumoXMLAttr key) const
Definition GNELane.cpp:668
int getIndex() const
returns the index of the lane
Definition GNELane.cpp:620
const DrawingConstants * getDrawingConstants() const
get lane drawing constants (previously calculated in drawGL())
Definition GNELane.cpp:236
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)
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
void deleteNetworkElement(GNENetworkElement *networkElement, GNEUndoList *undoList)
delete network element
Definition GNENet.cpp:345
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
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2155
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEContour myNetworkElementContour
network element contour
bool myShapeEdited
flag to check if element shape is being edited
GUIGLObjectPopupMenu * getShapeEditedPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, const PositionVector &shape)
get shape edited popup menu
void setNetworkElementID(const std::string &newID)
set network element id
bool isShapeEdited() const
check if shape is being edited
void invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
GNEUndoList * getUndoList() const
get the undoList object
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
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.
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
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,...
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
bool checkBoundaryParentObject(const GUIGlObject *GLObject, const GUIGlObject *parent, const double layer)
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings addSize
GUIVisualizationTextSettings edgeValue
Detail getDetailLevel(const double exaggeration) const
return the detail level
bool drawMovingGeometryPoint(const double exaggeration, const double radius) const
check if moving geometry point can be draw
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationConnectionSettings connectionSettings
connection settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
bool showLaneDirection
Whether to show direction indicators for lanes.
bool drawForViewObjectsHandler
whether drawing is performed for the purpose of selecting objects in view using ViewObjectsHandler
double selectorFrameScale
the current selection scaling in netedit (set in SelectorFrame)
std::string edgeParam
key for coloring by edge parameter
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
The representation of a single edge during network building.
Definition NBEdge.h:92
NBNode * getToNode() const
Returns the destination node of the edge.
Definition NBEdge.h:546
Connection & getConnectionRef(int fromLane, const NBEdge *to, int toLane)
Returns reference to the specified connection This method goes through "myConnections" and returns th...
Definition NBEdge.cpp:1312
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition NBEdge.h:730
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:1286
static const double UNSPECIFIED_SPEED
unspecified lane speed
Definition NBEdge.h:352
A loaded (complete) traffic light logic.
NBTrafficLightLogic * getLogic()
Returns the internal logic.
void addConnection(NBEdge *from, NBEdge *to, int fromLane, int toLane, int linkIndex, int linkIndex2, bool reconstruct=true)
Adds a connection and immediately informs the edges.
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
Definition NBNode.cpp:2358
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:2443
The base class for traffic light logic definitions.
NBTrafficLightLogic * compute(const OptionsCont &oc)
Computes the traffic light logic.
virtual int getMaxValidIndex()
Returns the maximum index controlled by this traffic light.
A SUMO-compliant built logic for a traffic light.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
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|....
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
A list of positions.
void append(const PositionVector &v, double sameThreshold=2.0)
double length() const
Returns the length.
PositionVector getOrthogonal(const Position &p, double extend, bool before, double length=1.0, double deg=90) const
return orthogonal through p (extending this vector if necessary)
int indexOfClosest(const Position &p, bool twoD=false) const
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition RGBColor.cpp:200
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
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 showConnections() const
check if select show connections checkbox is enabled
bool editingElevation() const
check if we're editing elevation
static const RGBColor editShapeColor
color for edited shapes (Junctions, crossings and connections)
RGBColor selectedConnectionColor
connection selection color
static const double connectionWidth
connection width
static const double segmentWidthSmall
width of small dotted contour segments
static const double segmentWidth
width of dotted contour segments
static const double connectionGeometryPointRadius
moving connection geometry point 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
A structure which describes a connection between edges or lanes.
Definition NBEdge.h:201
bool indirectLeft
Whether this connection is an indirect left turn.
Definition NBEdge.h:261
int fromLane
The lane the connections starts at.
Definition NBEdge.h:210
int toLane
The lane the connections yields in.
Definition NBEdge.h:216
SVCPermissions permissions
List of vehicle types that are allowed on this connection.
Definition NBEdge.h:252
double speed
custom speed for connection
Definition NBEdge.h:240
NBEdge * toEdge
The edge the connections yields in.
Definition NBEdge.h:213
KeepClear keepClear
whether the junction must be kept clear when using this connection
Definition NBEdge.h:231
double customLength
custom length for connection
Definition NBEdge.h:246
std::string edgeType
optional type of Connection
Definition NBEdge.h:264
bool uncontrolled
check if Connection is uncontrolled
Definition NBEdge.h:298
PositionVector customShape
custom shape for connection
Definition NBEdge.h:249
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition NBEdge.h:228
SVCPermissions changeLeft
List of vehicle types that are allowed to change Left from this connections internal lane(s)
Definition NBEdge.h:255
SVCPermissions changeRight
List of vehicle types that are allowed to change right from this connections internal lane(s)
Definition NBEdge.h:258
PositionVector viaShape
shape of via
Definition NBEdge.h:282
double contPos
custom position for internal junction on this connection
Definition NBEdge.h:234
std::string tlID
The id of the traffic light that controls this connection.
Definition NBEdge.h:219
double visibility
custom foe visiblity for connection
Definition NBEdge.h:237
int tlLinkIndex2
The index of the internal junction within the controlling traffic light (optional)
Definition NBEdge.h:225
PositionVector shape
shape of Connection
Definition NBEdge.h:270
bool haveVia
check if Connection have a Via
Definition NBEdge.h:276
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition NBEdge.h:222