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-2026 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
25#include <netedit/GNENet.h>
27#include <netedit/GNEUndoList.h>
34
35#include "GNEConnection.h"
36#include "GNEInternalLane.h"
37
38// ===========================================================================
39// method definitions
40// ===========================================================================
41
42#ifdef _MSC_VER
43#pragma warning(push)
44#pragma warning(disable: 4355) // mask warning about "this" in initializers
45#endif
47 GNENetworkElement(from->getNet(), "from" + from->getID() + "to" + to->getID(), SUMO_TAG_CONNECTION),
48 myMoveElementConnection(new GNEMoveElementConnection(this)),
49 myLinkState(LINKSTATE_TL_OFF_NOSIGNAL),
50 mySpecialColor(nullptr),
51 myShapeDeprecated(true) {
52 // set parents
53 setParents<GNELane*>({from, to});
54 setParents<GNEEdge*>({from->getParentEdge(), to->getParentEdge()});
55}
56#ifdef _MSC_VER
57#pragma warning(pop)
58#endif
59
60
63
64
69
70
75
76
77const Parameterised*
82
83
84const PositionVector&
86 if (myConnectionGeometry.getShape().size() > 0) {
88 } else {
90 }
91}
92
93
94void
96 // check if adjust shape
98 // Get shape of from and to lanes
100 // obtain lane shapes
101 PositionVector laneShapeFrom = getParentLanes().front()->getLaneShape();
102 PositionVector laneShapeTo = getParentLanes().back()->getLaneShape();
103 // Calculate shape of connection depending of the size of Junction shape
104 if (nbCon.customShape.size() > 0) {
106 } else if (nbCon.shape.size() > 1) {
107 PositionVector connectionShape;
108 if ((nbCon.shape.length() < 3) && !nbCon.haveVia) {
109 // apply offset to lane shape if we're in lane spread function center
110 if (getParentLanes().front()->getParentEdge()->getNBEdge()->getLaneSpreadFunction() == LaneSpreadFunction::CENTER) {
111 laneShapeFrom.move2side(0.3);
112 }
113 if (getParentLanes().back()->getParentEdge()->getNBEdge()->getLaneSpreadFunction() == LaneSpreadFunction::CENTER) {
114 laneShapeTo.move2side(0.3);
115 }
116 // check if this connetion is a turn around
117 bool turnAround = false;
118 const auto fromOppositeEdges = getParentLanes().front()->getParentEdge()->getOppositeEdges();
119 for (const auto& edge : fromOppositeEdges) {
120 if (edge == getParentLanes().back()->getParentEdge()) {
121 turnAround = true;
122 break;
123 }
124 }
125 // add from lane shape one step before
126 if (laneShapeFrom.length() > 1) {
127 // set length depending of turn arounds
128 if (turnAround) {
129 connectionShape.push_back(laneShapeFrom.positionAtOffset(laneShapeFrom.length() - 0.5));
130 } else {
131 connectionShape.push_back(laneShapeFrom.positionAtOffset(laneShapeFrom.length() - 1));
132 }
133 }
134 // add from lane shape
135 connectionShape.push_back(laneShapeFrom.back());
136 // add to lane shape
137 connectionShape.push_back(laneShapeTo.front());
138 // add to lane shape one step after
139 if (laneShapeTo.length() > 1) {
140 // set length depending of turn arounds
141 if (turnAround) {
142 connectionShape.push_back(laneShapeTo.positionAtOffset(0.5));
143 } else {
144 connectionShape.push_back(laneShapeTo.positionAtOffset(1));
145 }
146 }
147 } else {
148 connectionShape = nbCon.shape;
149 // only append via shape if it exists
150 if (nbCon.haveVia) {
151 connectionShape.append(nbCon.viaShape);
152 }
153 }
154 myConnectionGeometry.updateGeometry(connectionShape);
155 } else if (getParentLanes().front()->getLane2laneConnections().exist(getParentLanes().back())) {
156 myConnectionGeometry = getParentLanes().front()->getLane2laneConnections().getLane2laneGeometry(getParentLanes().back());
157 } else {
159 }
160 // check if internal junction marker must be calculated
161 if (nbCon.haveVia && (nbCon.shape.size() > 0)) {
162 // create marker for internal junction waiting position (contPos)
163 const double orthoLength = 0.5;
164 PositionVector internalJunctionMarker = nbCon.shape.getOrthogonal(nbCon.shape.back(), 10, true, 0.1);
165 if (internalJunctionMarker.length() < orthoLength) {
166 internalJunctionMarker.extrapolate(orthoLength - internalJunctionMarker.length());
167 }
168 myInternalJunctionMarkerGeometry.updateGeometry(internalJunctionMarker);
169 } else {
171 }
172 // mark connection as non-deprecated
173 myShapeDeprecated = false;
174 }
175}
176
177
180 // currently unused
181 return Position(0, 0);
182}
183
184
185bool
187 return false;
188}
189
190
191bool
193 return false;
194}
195
196
197bool
199 // check opened popup
200 if (myNet->getViewNet()->getPopup()) {
201 return myNet->getViewNet()->getPopup()->getGLObject() == this;
202 }
203 return false;
204}
205
206
207bool
209 return false;
210}
211
212
213bool
215 // get edit modes
216 const auto& editModes = myNet->getViewNet()->getEditModes();
217 // check if we're in delete mode
218 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
220 } else {
221 return false;
222 }
223}
224
225
226bool
228 return false;
229}
230
231
232bool
234 // get edit modes
235 const auto& editModes = myNet->getViewNet()->getEditModes();
236 // check if we're in select mode
237 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
239 } else {
240 return false;
241 }
242}
243
244
245bool
247 // get edit modes
248 const auto& editModes = myNet->getViewNet()->getEditModes();
249 // check if we're in move mode
250 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
251 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
252 // check if we're editing this network element
254 if (editedNetworkElement) {
255 return editedNetworkElement == this;
256 } else {
257 // only move the first element
259 }
260 } else {
261 return false;
262 }
263}
264
265
266GNEEdge*
268 return getParentEdges().front();
269}
270
271
272GNEEdge*
274 return getParentEdges().back();
275}
276
277
278GNELane*
280 return getParentLanes().front();
281}
282
283
284GNELane*
286 return getParentLanes().back();
287}
288
289
290int
292 return getParentLanes().front()->getIndex();
293}
294
295
296int
298 return getParentLanes().back()->getIndex();
299}
300
301
304 return getParentEdges().front()->getNBEdge()->getConnectionRef(getFromLaneIndex(), getParentEdges().back()->getNBEdge(), getToLaneIndex());
305}
306
307
311 return NBConnection(getParentEdges().front()->getNBEdge(), getFromLaneIndex(),
312 getParentEdges().back()->getNBEdge(), getToLaneIndex(),
313 (int)c.tlLinkIndex, (int)c.tlLinkIndex2);
314}
315
316
317void
321
322
325 return myLinkState;
326}
327
328
329void
333
334
335void
338 myLinkState = getParentEdges().front()->getNBEdge()->getToNode()->getLinkState(getParentEdges().front()->getNBEdge(),
339 nbCon.toEdge,
340 nbCon.fromLane,
341 nbCon.toLane,
342 nbCon.mayDefinitelyPass,
343 nbCon.tlID);
344}
345
346
347void
349 auto shape = getConnectionShape();
350 shape = shape.bezier(5);
352}
353
354
357 if (myShapeEdited) {
358 return getShapeEditedPopUpMenu(app, parent, getNBEdgeConnection().customShape);
359 } else {
360 // create popup
361 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
362 // check if allow delete connections
364 // build common options
365 buildPopUpMenuCommonOptions(ret, app, myNet->getViewNet(), myTagProperty->getTag(), mySelected, allowDelete, true);
366 // check if we're in supermode network
368 // create menu commands
369 FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, TL("Set custom connection shape"), nullptr, &parent, MID_GNE_CONNECTION_EDIT_SHAPE);
370 GUIDesigns::buildFXMenuCommand(ret, TL("Smooth connection shape"), nullptr, &parent, MID_GNE_CONNECTION_SMOOTH_SHAPE);
371 // check if menu commands has to be disabled
373 // check if we're in the correct edit mode
375 mcCustomShape->disable();
376 }
377 }
378 return ret;
379 }
380}
381
382
383double
387
388
393
394
395void
396GNEConnection::updateCenteringBoundary(const bool /*updateGrid*/) {
397 // nothing to update
398}
399
400
401void
403 // Check if connection must be drawed
404 if (checkDrawConnection()) {
405 // get connection exaggeration
406 const double connectionExaggeration = s.junctionSize.getExaggeration(s, this, 1);
407 // get detail level
408 const auto d = s.getDetailLevel(connectionExaggeration);
409 // check if draw shape superposed (used in train lanes)
410 PositionVector shapeSuperposed = myConnectionGeometry.getShape();
411 if (getParentLanes().front()->getDrawingConstants()->drawSuperposed()) {
412 shapeSuperposed.move2side(0.5);
413 }
414 GUIGeometry superposedGeometry(shapeSuperposed);
415 // draw geometry only if we are not in drawForObjectUnderCursor mode
417 // draw connection
418 drawConnection(s, d, superposedGeometry, connectionExaggeration);
419 // draw lock icon
421 // draw dotted contour depending if we're editing the custom shape
423 if (editedNetworkElement && (editedNetworkElement == this)) {
424 // draw dotted contour geometry points
426 connectionExaggeration, s.dottedContourSettings.segmentWidthSmall);
427 } else {
428 // draw dotted contour
430 }
431 }
432 // calculate contour
433 calculateConnectionContour(s, d, shapeSuperposed, connectionExaggeration);
434 }
435}
436
437
438void
442
443
444void
448
449
450void
454
455
456std::string
458 // first get attributes in which nbConnection reference can be invalid
459 switch (key) {
460 case SUMO_ATTR_ID:
461 return getMicrosimID();
462 case SUMO_ATTR_FROM:
463 return getParentLanes().front()->getParentEdge()->getID();
464 case SUMO_ATTR_TO:
465 return getParentLanes().back()->getParentEdge()->getID();
467 return getParentLanes().front()->getAttribute(SUMO_ATTR_INDEX);
469 return getParentLanes().front()->getID();
471 return getParentLanes().back()->getAttribute(SUMO_ATTR_INDEX);
473 return getParentLanes().back()->getID();
476 return getCommonAttribute(key);
477 case GNE_ATTR_PARENT:
478 return getParentEdges().front()->getToJunction()->getID();
479 default:
480 break;
481 }
482 // now continue with attributes that needs a nbConnection reference
484 switch (key) {
485 case SUMO_ATTR_PASS:
486 return toString(nbCon.mayDefinitelyPass);
488 return toString(nbCon.indirectLeft);
489 case SUMO_ATTR_TYPE:
490 return toString(nbCon.edgeType);
492 return toString(nbCon.keepClear);
494 return toString(nbCon.contPos);
496 return toString(nbCon.uncontrolled);
498 return toString(nbCon.visibility);
500 return toString(nbCon.tlLinkIndex);
502 return toString(nbCon.tlLinkIndex2);
503 case SUMO_ATTR_ALLOW:
504 if (nbCon.permissions == SVC_UNSPECIFIED) {
505 return getVehicleClassNames(nbCon.toEdge->getLanes()[nbCon.toLane].permissions);
506 } else {
507 return getVehicleClassNames(nbCon.permissions);
508 }
510 if (nbCon.permissions == SVC_UNSPECIFIED) {
511 return getVehicleClassNames(invertPermissions(nbCon.toEdge->getLanes()[nbCon.toLane].permissions));
512 } else {
514 }
516 if (nbCon.changeLeft == SVC_UNSPECIFIED) {
517 return "all";
518 } else {
519 return getVehicleClassNames(nbCon.changeLeft);
520 }
522 if (nbCon.changeRight == SVC_UNSPECIFIED) {
523 return "all";
524 } else {
525 return getVehicleClassNames(nbCon.changeRight);
526 }
527 case SUMO_ATTR_SPEED:
528 if (nbCon.speed == NBEdge::UNSPECIFIED_SPEED) {
529 return "default";
530 } else {
531 return toString(nbCon.speed);
532 }
533 case SUMO_ATTR_LENGTH:
534 return toString(nbCon.customLength);
535 case SUMO_ATTR_DIR:
536 return toString(getParentEdges().front()->getNBEdge()->getToNode()->getDirection(
537 getParentEdges().front()->getNBEdge(), nbCon.toEdge, OptionsCont::getOptions().getBool("lefthand")));
538 case SUMO_ATTR_STATE:
539 return toString(getParentEdges().front()->getNBEdge()->getToNode()->getLinkState(
540 getParentEdges().front()->getNBEdge(), nbCon.toEdge, nbCon.fromLane, nbCon.toLane, nbCon.mayDefinitelyPass, nbCon.tlID));
541 case SUMO_ATTR_SHAPE:
543 return toString(nbCon.customShape);
544 default:
545 return getCommonAttribute(key);
546 }
547}
548
549
550double
554
555
560
561
564 switch (key) {
565 case SUMO_ATTR_SHAPE:
568 default:
570 }
571}
572
573
574void
575GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
577 switch (key) {
578 case SUMO_ATTR_FROM:
579 case SUMO_ATTR_TO:
582 case SUMO_ATTR_PASS:
586 case SUMO_ATTR_ALLOW:
590 case SUMO_ATTR_SPEED:
591 case SUMO_ATTR_LENGTH:
592 case SUMO_ATTR_SHAPE:
594 case SUMO_ATTR_TYPE:
595 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
596 break;
598 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
599 changeTLIndex(key, parse<int>(value), c.tlLinkIndex2, undoList);
600 }
601 break;
603 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
604 changeTLIndex(key, c.tlLinkIndex, parse<int>(value), undoList);
605 }
606 break;
608 undoList->begin(this, "change attribute controlled for connection");
609 {
610 const bool wasUncontrolled = c.uncontrolled;
611 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
612 if (wasUncontrolled && !c.uncontrolled) {
613 GNEEdge* srcEdge = getParentEdges().front();
614 NBConnection newNBCon(srcEdge->getNBEdge(), c.fromLane, c.toEdge, c.toLane);
615 srcEdge->getToJunction()->invalidateTLS(undoList, NBConnection::InvalidConnection, newNBCon);
616 }
617 }
618 undoList->end();
619 break;
621 undoList->begin(this, "change attribute indirect for connection");
622 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
623 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
624 int linkIndex2 = -1;
625 if (parse<bool>(value)) {
626 // find straight connection with the same toEdge
627 std::set<NBTrafficLightDefinition*> defs = getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS();
628 NBEdge* from = getParentEdges().front()->getNBEdge();
629 for (NBTrafficLightDefinition* tlDef : defs) {
630 for (const NBConnection& c2 : tlDef->getControlledLinks()) {
631 if (c2.getTo() == c.toEdge && c2.getFrom() != from) {
632 if (from->getToNode()->getDirection(c2.getFrom(), c2.getTo()) == LinkDirection::STRAIGHT) {
633 linkIndex2 = c2.getTLIndex();
634 break;
635 }
636 }
637 }
638 }
639 }
640 changeTLIndex(key, c.tlLinkIndex, linkIndex2, undoList);
641 }
642 undoList->end();
643 break;
644 case SUMO_ATTR_DIR:
645 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
646 case SUMO_ATTR_STATE:
647 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
648 default:
649 setCommonAttribute(key, value, undoList);
650 break;
651 }
652}
653
654
655void
656GNEConnection::changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList* undoList) {
657 // trigger GNEChange_TLS
658 undoList->begin(this, "change tls linkIndex for connection");
659 // make a copy
660 std::set<NBTrafficLightDefinition*> defs = getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS();
661 for (const auto& tlDef : defs) {
662 NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
663 NBTrafficLightLogic* tllogic = sumoDef ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
664 if (tllogic != nullptr) {
665 NBLoadedSUMOTLDef* newDef = new NBLoadedSUMOTLDef(*tlDef, *tllogic);
666 newDef->addConnection(getParentEdges().front()->getNBEdge(), getParentEdges().back()->getNBEdge(),
667 getLaneFrom()->getIndex(), getLaneTo()->getIndex(), tlIndex, tlIndex2, false);
668 // make a copy
669 std::vector<NBNode*> nodes = tlDef->getNodes();
670 for (const auto& node : nodes) {
671 GNEJunction* junction = getNet()->getAttributeCarriers()->retrieveJunction(node->getID());
672 undoList->add(new GNEChange_TLS(junction, tlDef, false), true);
673 undoList->add(new GNEChange_TLS(junction, newDef, true), true);
674 }
675 } else {
676 WRITE_ERRORF(TL("Could not set attribute '%' (tls is broken)"), toString(key));
677 }
678 }
679 undoList->end();
680}
681
682
683bool
685 return getParentEdges().front()->getNBEdge()->getConnectionsFromLane(getFromLaneIndex(), getParentEdges().back()->getNBEdge(), getToLaneIndex()).size() > 0;
686}
687
688
689bool
691 // declare a flag to check if shape has to be draw (by deafult false)
692 bool drawConnection = false;
693 // only draw connections if shape isn't deprecated
699 } else if (myNet->getViewNet()->getInspectedElements().isACInspected(this)) {
700 drawConnection = true;
701 } else {
702 drawConnection = false;
703 }
704 } else {
705 drawConnection = false;
706 }
707 // check if we're editing this connection
709 if (editedNetworkElement && (editedNetworkElement->getTagProperty()->getTag() == SUMO_TAG_CONNECTION)) {
710 if (editedNetworkElement->getAttribute(GNE_ATTR_PARENT) == getAttribute(GNE_ATTR_PARENT)) {
711 drawConnection = true;
712 }
713 }
714 return drawConnection;
715}
716
717
720 // check conditions
721 if (myShapeEdited) {
722 // return shape edit color
724 } else if (drawUsingSelectColor()) {
725 // override with special colors (unless the color scheme is based on selection)
727 } else if (mySpecialColor != nullptr) {
728 // return special color
729 return *mySpecialColor;
730 } else {
731 // Set color depending of the link state
733 }
734}
735
736
737void
739 const GUIGeometry& superposedGeometry, const double exaggeration) const {
740 // get color
741 RGBColor connectionColor = getConnectionColor(s);
742 // Push layer matrix
744 // move top if is selected
745 if (mySelected) {
746 glTranslated(0, 0, 0.2);
747 }
748 // translate to front
751 } else {
753 }
754 // Set color
755 GLHelper::setColor(connectionColor);
756 // continue depending of detail level
758 // draw geometry
759 GLHelper::drawBoxLines(superposedGeometry.getShape(), superposedGeometry.getShapeRotations(), superposedGeometry.getShapeLengths(),
760 s.connectionSettings.connectionWidth * exaggeration);
761 // draw arrows over connection
762 drawConnectionArrows(s, superposedGeometry, connectionColor);
763 // check if internal junction marker has to be drawn
767 }
768 // draw edge values
769 drawEdgeValues(s, superposedGeometry.getShape());
770 // draw shape points only in Network supemode
772 // draw geometry points
773 GUIGeometry::drawGeometryPoints(d, superposedGeometry.getShape(), connectionColor.changedBrightness(-32),
776 }
777 } else {
778 GLHelper::drawLine(superposedGeometry.getShape());
779 }
780 // Pop layer matrix
782}
783
784
785void
787 const RGBColor& color) const {
788 if (s.showLaneDirection) {
789 // Push matrix
791 // move front
792 glTranslated(0, 0, 0.1);
793 // change color
795 // draw triangles
796 for (int i = 1; i < (int)superposedGeometry.getShape().size(); i++) {
797 const auto& posA = superposedGeometry.getShape()[i - 1];
798 const auto& posB = superposedGeometry.getShape()[i];
799 GLHelper::drawTriangleAtEnd(posA, posB, (double) .2, (double) .1);
800 }
801 // Pop matrix
803 }
804}
805
806
807void
809 // check if edge value has to be shown
810 if (s.edgeValue.show(this)) {
812 const std::string value = nbCon.getParameter(s.edgeParam, "");
813 if (value != "") {
814 int shapeIndex = (int)shape.size() / 2;
815 const Position p = (myConnectionGeometry.getShape().size() == 2) ? (shape.front() * 0.67 + shape.back() * 0.33) : shape[shapeIndex];
816 GLHelper::drawTextSettings(s.edgeValue, value, p, s.scale, 0);
817 }
818 }
819}
820
821
822void
824 const PositionVector& shape, const double exaggeration) const {
825 // first check if junction parent was inserted with full boundary
826 if (!gViewObjectsHandler.checkBoundaryParentObject(s, this, getType(), getParentLanes().front()->getParentEdge()->getToJunction())) {
827 // calculate geometry points contour if we're editing shape
828 if (myShapeEdited) {
830 exaggeration, true);
831 } else {
832 // in move mode, add to selected object if this is the edited element
833 const auto& editModes = myNet->getViewNet()->getEditModes();
834 const bool addToSelectedObjects = (editModes.isCurrentSupermodeNetwork() && editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) ?
836 // calculate connection shape contour
838 true, true, 0, nullptr, getParentLanes().front()->getParentEdge()->getToJunction(), addToSelectedObjects);
839 }
840 }
841}
842
843
844bool
845GNEConnection::isValid(SumoXMLAttr key, const std::string& value) {
846 // Currently ignored before implementation to avoid warnings
847 switch (key) {
848 case SUMO_ATTR_FROM:
849 case SUMO_ATTR_TO:
852 return false;
853 case SUMO_ATTR_PASS:
854 return canParse<bool>(value);
856 return canParse<bool>(value);
857 case SUMO_ATTR_TYPE:
858 return true;
860 return canParse<bool>(value);
862 return canParse<double>(value) && (parse<double>(value) >= -1);
864 return canParse<bool>(value);
866 return canParse<double>(value) && (parse<double>(value) >= -1);
871 (getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS().size() > 0) &&
872 canParse<int>(value) &&
873 (parse<int>(value) >= 0 || parse<int>(value) == -1)) {
874 // obtain Traffic light definition
875 NBTrafficLightDefinition* def = *getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS().begin();
876 return def->getMaxValidIndex() >= parse<int>(value);
877 } else {
878 return false;
879 }
880 case SUMO_ATTR_ALLOW:
884 return canParseVehicleClasses(value);
885 case SUMO_ATTR_SPEED:
886 if (value.empty() || value == "default") {
887 return true;
888 } else {
889 return canParse<double>(value) && ((parse<double>(value) >= 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_SPEED));
890 }
891 case SUMO_ATTR_LENGTH:
892 return canParse<double>(value) && (parse<double>(value) >= -1);
893 case SUMO_ATTR_SHAPE:
895 // empty custom shapes are allowed
896 return canParse<PositionVector>(value);
897 case SUMO_ATTR_STATE:
898 return false;
899 case SUMO_ATTR_DIR:
900 return false;
901 default:
902 return isCommonAttributeValid(key, value);
903 }
904}
905
906
907bool
909 switch (key) {
910 case SUMO_ATTR_FROM:
911 case SUMO_ATTR_TO:
914 case SUMO_ATTR_DIR:
915 case SUMO_ATTR_STATE:
916 // this attributes cannot be edited
917 return false;
920 // get Traffic Light definitions
921 if (getParentEdges().front()->getNBEdge()->getToNode()->isTLControlled()) {
922 NBTrafficLightDefinition* tlDef = *getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS().begin();
923 NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
924 NBTrafficLightLogic* tllogic = sumoDef != nullptr ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
925 if (tllogic != nullptr) {
926 return true;
927 } else {
928 return false;
929 }
930 }
931 return false;
932 default:
933 return true;
934 }
935}
936
937
938bool
940 switch (key) {
941 case SUMO_ATTR_SPEED:
943 default:
944 return false;
945 }
946}
947
948// ===========================================================================
949// private
950// ===========================================================================
951
952void
953GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value) {
954 if (!existNBEdgeConnection()) {
955 WRITE_WARNINGF(TL("Cannot restore attribute '%=%' for computed connection from lane '%'"), toString(key), value, getParentLanes().front()->getID());
956 return;
957 }
959 switch (key) {
960 case SUMO_ATTR_PASS:
961 nbCon.mayDefinitelyPass = parse<bool>(value);
962 break;
964 nbCon.indirectLeft = parse<bool>(value);
965 break;
967 if (value == toString(KEEPCLEAR_UNSPECIFIED)) {
969 } else {
970 nbCon.keepClear = parse<bool>(value) ? KEEPCLEAR_TRUE : KEEPCLEAR_FALSE;
971 }
972 break;
974 nbCon.uncontrolled = parse<bool>(value);
975 break;
977 nbCon.contPos = parse<double>(value);
978 break;
980 nbCon.visibility = parse<double>(value);
981 break;
982 case SUMO_ATTR_SPEED:
983 if (value.empty() || (value == "default")) {
985 } else {
986 nbCon.speed = parse<double>(value);
987 }
988 break;
989 case SUMO_ATTR_LENGTH:
990 nbCon.customLength = parse<double>(value);
991 break;
992 case SUMO_ATTR_ALLOW:
993 nbCon.permissions = parseVehicleClasses(value);
994 break;
997 break;
999 nbCon.changeLeft = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
1000 break;
1002 nbCon.changeRight = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
1003 break;
1004 case SUMO_ATTR_STATE:
1005 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
1006 case SUMO_ATTR_DIR:
1007 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
1008 case SUMO_ATTR_SHAPE:
1010 nbCon.customShape = parse<PositionVector>(value);
1011 break;
1012 case SUMO_ATTR_TYPE:
1013 nbCon.edgeType = value;
1014 break;
1015 default:
1016 setCommonAttribute(key, value);
1017 break;
1018 }
1019 // Update Geometry after setting a new attribute (but avoided for certain attributes)
1020 if ((key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
1023 }
1024 // invalidate demand path calculator
1026}
1027
1028/****************************************************************************/
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
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:287
#define WRITE_ERRORF(...)
Definition MsgHandler.h:296
#define TL(string)
Definition MsgHandler.h:304
@ 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
@ 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
@ GNE_ATTR_FRONTELEMENT
@ 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:49
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 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 popMatrix()
pop matrix
Definition GLHelper.cpp:131
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:348
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
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:773
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
double getCommonAttributeDouble(SumoXMLAttr key) const
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
const std::string getID() const override
get ID (all Attribute Carriers have one)
PositionVector getCommonAttributePositionVector(SumoXMLAttr key) const
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
Position getCommonAttributePosition(SumoXMLAttr key) const
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
bool isCommonAttributeValid(SumoXMLAttr key, const std::string &value) const
virtual std::string getAttribute(SumoXMLAttr key) const =0
std::string getCommonAttribute(SumoXMLAttr key) const
const GNETagProperties * myTagProperty
reference to tagProperty associated with this attribute carrier
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
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
double getAttributeDouble(SumoXMLAttr key) const override
Position getAttributePosition(SumoXMLAttr key) const override
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 override
check if draw select contour (blue)
bool checkDrawOverContour() const override
check if draw over contour (orange)
GNELane * getLaneTo() const
@briefthe get lane of the outgoing lane
LinkState getLinkState() const
get LinkState
bool isAttributeComputed(SumoXMLAttr key) const override
void drawConnectionArrows(const GUIVisualizationSettings &s, const GUIGeometry &superposedGeometry, const RGBColor &color) const
draw arrows over connections
int getFromLaneIndex() const
@briefthe get lane index of the incoming lane
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
GUIGeometry myConnectionGeometry
connection geometry
bool isValid(SumoXMLAttr key, const std::string &value) override
bool checkDrawFromContour() const override
check if draw from contour (green)
void drawEdgeValues(const GUIVisualizationSettings &s, const PositionVector &shape) const
draw edge value
void drawConnection(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGeometry &superposedGeometry, const double exaggeration) const
draw connection
Parameterised * getParameters() override
get parameters associated with this connection
bool existNBEdgeConnection() const
check if the edgeConnection vinculated with this connection exists
void updateGeometry() override
update pre-computed geometry information
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
void deleteGLObject() override
delete element
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
GNEConnection(GNELane *from, GNELane *to)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
void updateGLObject() override
update GLObject (geometry, ID, etc.)
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
bool checkDrawToContour() const override
check if draw from contour (magenta)
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
void setSpecialColor(const RGBColor *Color2)
bool checkDrawMoveContour() const override
check if draw move contour (red)
GUIGeometry myInternalJunctionMarkerGeometry
junction maker geometry
bool isAttributeEnabled(SumoXMLAttr key) const override
const RGBColor * mySpecialColor
optional special color
GNEMoveElementConnection * myMoveElementConnection
move element connection
~GNEConnection()
Destructor.
int getToLaneIndex() const
@briefthe get lane index of the outgoing lane
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this connection
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
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
void updateLinkState()
recompute cached myLinkState
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
bool checkDrawConnection() const
check if draw connection
RGBColor getConnectionColor(const GUIVisualizationSettings &s) const
get connection color
bool checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
LinkState myLinkState
Linkstate.
std::string getAttribute(SumoXMLAttr key) const override
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 GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) 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
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
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:773
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:92
const GNEHierarchicalContainerParents< GNEEdge * > & getParentEdges() const
get parent edges
const GNEHierarchicalContainerParents< GNELane * > & getParentLanes() const
get parent lanes
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
void invalidateTLS(GNEUndoList *undoList, const NBConnection &deletedConnection=NBConnection::InvalidConnection, const NBConnection &addedConnection=NBConnection::InvalidConnection)
int getIndex() const
returns the index of the lane
Definition GNELane.cpp:636
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:216
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:397
GNEPathManager * getDemandPathManager()
get demand path manager
Definition GNENet.cpp:198
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:174
GNEUndoList * getUndoList() const
get undo list(used for simplify code)
Definition GNENet.cpp:156
GNEViewNet * getViewNet() const
get view net (used for simplify code)
Definition GNENet.cpp:144
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
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...
bool isACInspected(GNEAttributeCarrier *AC) const
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
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
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.
GUIGlObject * getGLObject() const
The object that belongs to this popup-menu.
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
void clearGeometry()
clear geometry
static void drawGeometryPoints(const GUIVisualizationSettings::Detail d, const PositionVector &shape, const RGBColor &color, const double radius, const double exaggeration, const bool drawSymbols, const bool editingElevation)
draw geometry points
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
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.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildPopUpMenuCommonOptions(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, GUISUMOAbstractView *parent, const SumoXMLTag tag, const bool selected, const bool allowDelete, const bool addSeparator)
GUIGLObjectPopupMenu * getPopup() const
ge the current popup-menu
bool checkBoundaryParentObject(const GUIVisualizationSettings &s, const GUIGlObject *GLObject, const double layer, const GUIGlObject *parent)
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings junctionSize
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
std::string edgeParam
key for coloring by edge parameter
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
static const NBConnection InvalidConnection
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:552
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition NBEdge.h:736
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:2507
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.
An upper class for objects with additional parameters.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
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.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given 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)
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
static const RGBColor GREY
Definition RGBColor.h:207
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition RGBColor.cpp:210
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 editingElevation() const
check if we're editing elevation
bool showConnections(const GNEConnection *connection) const
check if select show connections checkbox is enabled
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 constantSizeSelected
whether only selected objects shall be drawn with constant
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