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-2025 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
43 GNENetworkElement(from->getNet(), "from" + from->getID() + "to" + to->getID(), SUMO_TAG_CONNECTION),
44 myMoveElementConnection(new GNEMoveElementConnection(this)),
45 myLinkState(LINKSTATE_TL_OFF_NOSIGNAL),
46 mySpecialColor(nullptr),
47 myShapeDeprecated(true) {
48 // set parents
49 setParents<GNELane*>({from, to});
50 setParents<GNEEdge*>({from->getParentEdge(), to->getParentEdge()});
51}
52
53
56
57
62
63
68
69
70const Parameterised*
75
76
77const PositionVector&
79 if (myConnectionGeometry.getShape().size() > 0) {
81 } else {
83 }
84}
85
86
87void
89 // check if adjust shape
91 // Get shape of from and to lanes
93 // obtain lane shapes
94 PositionVector laneShapeFrom = getParentLanes().front()->getLaneShape();
95 PositionVector laneShapeTo = getParentLanes().back()->getLaneShape();
96 // Calculate shape of connection depending of the size of Junction shape
97 if (nbCon.customShape.size() > 0) {
99 } else if (nbCon.shape.size() > 1) {
100 PositionVector connectionShape;
101 if ((nbCon.shape.length() < 3) && !nbCon.haveVia) {
102 // apply offset to lane shape if we're in lane spread function center
103 if (getParentLanes().front()->getParentEdge()->getNBEdge()->getLaneSpreadFunction() == LaneSpreadFunction::CENTER) {
104 laneShapeFrom.move2side(0.3);
105 }
106 if (getParentLanes().back()->getParentEdge()->getNBEdge()->getLaneSpreadFunction() == LaneSpreadFunction::CENTER) {
107 laneShapeTo.move2side(0.3);
108 }
109 // check if this connetion is a turn around
110 bool turnAround = false;
111 const auto fromOppositeEdges = getParentLanes().front()->getParentEdge()->getOppositeEdges();
112 for (const auto& edge : fromOppositeEdges) {
113 if (edge == getParentLanes().back()->getParentEdge()) {
114 turnAround = true;
115 break;
116 }
117 }
118 // add from lane shape one step before
119 if (laneShapeFrom.length() > 1) {
120 // set length depending of turn arounds
121 if (turnAround) {
122 connectionShape.push_back(laneShapeFrom.positionAtOffset(laneShapeFrom.length() - 0.5));
123 } else {
124 connectionShape.push_back(laneShapeFrom.positionAtOffset(laneShapeFrom.length() - 1));
125 }
126 }
127 // add from lane shape
128 connectionShape.push_back(laneShapeFrom.back());
129 // add to lane shape
130 connectionShape.push_back(laneShapeTo.front());
131 // add to lane shape one step after
132 if (laneShapeTo.length() > 1) {
133 // set length depending of turn arounds
134 if (turnAround) {
135 connectionShape.push_back(laneShapeTo.positionAtOffset(0.5));
136 } else {
137 connectionShape.push_back(laneShapeTo.positionAtOffset(1));
138 }
139 }
140 } else {
141 connectionShape = nbCon.shape;
142 // only append via shape if it exists
143 if (nbCon.haveVia) {
144 connectionShape.append(nbCon.viaShape);
145 }
146 }
147 myConnectionGeometry.updateGeometry(connectionShape);
148 } else if (getParentLanes().front()->getLane2laneConnections().exist(getParentLanes().back())) {
149 myConnectionGeometry = getParentLanes().front()->getLane2laneConnections().getLane2laneGeometry(getParentLanes().back());
150 } else {
152 }
153 // check if internal junction marker must be calculated
154 if (nbCon.haveVia && (nbCon.shape.size() > 0)) {
155 // create marker for internal junction waiting position (contPos)
156 const double orthoLength = 0.5;
157 PositionVector internalJunctionMarker = nbCon.shape.getOrthogonal(nbCon.shape.back(), 10, true, 0.1);
158 if (internalJunctionMarker.length() < orthoLength) {
159 internalJunctionMarker.extrapolate(orthoLength - internalJunctionMarker.length());
160 }
161 myInternalJunctionMarkerGeometry.updateGeometry(internalJunctionMarker);
162 } else {
164 }
165 // mark connection as non-deprecated
166 myShapeDeprecated = false;
167 }
168}
169
170
173 // currently unused
174 return Position(0, 0);
175}
176
177
178bool
180 return false;
181}
182
183
184bool
186 return false;
187}
188
189
190bool
192 // check opened popup
193 if (myNet->getViewNet()->getPopup()) {
194 return myNet->getViewNet()->getPopup()->getGLObject() == this;
195 }
196 return false;
197}
198
199
200bool
202 return false;
203}
204
205
206bool
208 // get edit modes
209 const auto& editModes = myNet->getViewNet()->getEditModes();
210 // check if we're in delete mode
211 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
213 } else {
214 return false;
215 }
216}
217
218
219bool
221 return false;
222}
223
224
225bool
227 // get edit modes
228 const auto& editModes = myNet->getViewNet()->getEditModes();
229 // check if we're in select mode
230 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
232 } else {
233 return false;
234 }
235}
236
237
238bool
240 // get edit modes
241 const auto& editModes = myNet->getViewNet()->getEditModes();
242 // check if we're in move mode
243 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
244 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
245 // check if we're editing this network element
247 if (editedNetworkElement) {
248 return editedNetworkElement == this;
249 } else {
250 // only move the first element
252 }
253 } else {
254 return false;
255 }
256}
257
258
259GNEEdge*
261 return getParentEdges().front();
262}
263
264
265GNEEdge*
267 return getParentEdges().back();
268}
269
270
271GNELane*
273 return getParentLanes().front();
274}
275
276
277GNELane*
279 return getParentLanes().back();
280}
281
282
283int
285 return getParentLanes().front()->getIndex();
286}
287
288
289int
291 return getParentLanes().back()->getIndex();
292}
293
294
297 return getParentEdges().front()->getNBEdge()->getConnectionRef(getFromLaneIndex(), getParentEdges().back()->getNBEdge(), getToLaneIndex());
298}
299
300
304 return NBConnection(getParentEdges().front()->getNBEdge(), getFromLaneIndex(),
305 getParentEdges().back()->getNBEdge(), getToLaneIndex(),
306 (int)c.tlLinkIndex, (int)c.tlLinkIndex2);
307}
308
309
310void
314
315
318 return myLinkState;
319}
320
321
322void
326
327
328void
331 myLinkState = getParentEdges().front()->getNBEdge()->getToNode()->getLinkState(getParentEdges().front()->getNBEdge(),
332 nbCon.toEdge,
333 nbCon.fromLane,
334 nbCon.toLane,
335 nbCon.mayDefinitelyPass,
336 nbCon.tlID);
337}
338
339
340void
342 auto shape = getConnectionShape();
343 shape = shape.bezier(5);
345}
346
347
350 if (myShapeEdited) {
351 return getShapeEditedPopUpMenu(app, parent, getNBEdgeConnection().customShape);
352 } else {
353 // create popup
354 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
355 // build common options
357 // check if we're in supermode network
359 // create menu commands
360 FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, TL("Set custom connection shape"), nullptr, &parent, MID_GNE_CONNECTION_EDIT_SHAPE);
361 GUIDesigns::buildFXMenuCommand(ret, TL("Smooth connection shape"), nullptr, &parent, MID_GNE_CONNECTION_SMOOTH_SHAPE);
362 // check if menu commands has to be disabled
364 // check if we're in the correct edit mode
366 mcCustomShape->disable();
367 }
368 }
369 return ret;
370 }
371}
372
373
374double
378
379
384
385
386void
387GNEConnection::updateCenteringBoundary(const bool /*updateGrid*/) {
388 // nothing to update
389}
390
391
392void
394 // Check if connection must be drawed
395 if (checkDrawConnection()) {
396 // get connection exaggeration
397 const double connectionExaggeration = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
398 // get detail level
399 const auto d = s.getDetailLevel(connectionExaggeration);
400 // check if draw shape superposed (used in train lanes)
401 PositionVector shapeSuperposed = myConnectionGeometry.getShape();
402 if (getParentLanes().front()->getDrawingConstants()->drawSuperposed()) {
403 shapeSuperposed.move2side(0.5);
404 }
405 GUIGeometry superposedGeometry(shapeSuperposed);
406 // draw geometry only if we'rent in drawForObjectUnderCursor mode
408 // draw connection
409 drawConnection(s, d, superposedGeometry, connectionExaggeration);
410 // draw lock icon
412 // draw dotted contour depending if we're editing the custom shape
414 if (editedNetworkElement && (editedNetworkElement == this)) {
415 // draw dotted contour geometry points
417 connectionExaggeration, s.dottedContourSettings.segmentWidthSmall);
418 } else {
419 // draw dotted contour
421 }
422 }
423 // calculate contour
424 calculateConnectionContour(s, d, shapeSuperposed, connectionExaggeration);
425 }
426}
427
428
429void
433
434
435void
439
440
441void
445
446
447std::string
449 // first get attributes in which nbConnection reference can be invalid
450 switch (key) {
451 case SUMO_ATTR_ID:
452 return getMicrosimID();
453 case SUMO_ATTR_FROM:
454 return getParentLanes().front()->getParentEdge()->getID();
455 case SUMO_ATTR_TO:
456 return getParentLanes().back()->getParentEdge()->getID();
458 return getParentLanes().front()->getAttribute(SUMO_ATTR_INDEX);
460 return getParentLanes().front()->getID();
462 return getParentLanes().back()->getAttribute(SUMO_ATTR_INDEX);
464 return getParentLanes().back()->getID();
467 return getCommonAttribute(key);
468 case GNE_ATTR_PARENT:
469 return getParentEdges().front()->getToJunction()->getID();
470 default:
471 break;
472 }
473 // now continue with attributes that needs a nbConnection reference
475 switch (key) {
476 case SUMO_ATTR_PASS:
477 return toString(nbCon.mayDefinitelyPass);
479 return toString(nbCon.indirectLeft);
480 case SUMO_ATTR_TYPE:
481 return toString(nbCon.edgeType);
483 return toString(nbCon.keepClear);
485 return toString(nbCon.contPos);
487 return toString(nbCon.uncontrolled);
489 return toString(nbCon.visibility);
491 return toString(nbCon.tlLinkIndex);
493 return toString(nbCon.tlLinkIndex2);
494 case SUMO_ATTR_ALLOW:
495 if (nbCon.permissions == SVC_UNSPECIFIED) {
496 return getVehicleClassNames(nbCon.toEdge->getLanes()[nbCon.toLane].permissions);
497 } else {
498 return getVehicleClassNames(nbCon.permissions);
499 }
501 if (nbCon.permissions == SVC_UNSPECIFIED) {
502 return getVehicleClassNames(invertPermissions(nbCon.toEdge->getLanes()[nbCon.toLane].permissions));
503 } else {
505 }
507 if (nbCon.changeLeft == SVC_UNSPECIFIED) {
508 return "all";
509 } else {
510 return getVehicleClassNames(nbCon.changeLeft);
511 }
513 if (nbCon.changeRight == SVC_UNSPECIFIED) {
514 return "all";
515 } else {
516 return getVehicleClassNames(nbCon.changeRight);
517 }
518 case SUMO_ATTR_SPEED:
519 if (nbCon.speed == NBEdge::UNSPECIFIED_SPEED) {
520 return "default";
521 } else {
522 return toString(nbCon.speed);
523 }
524 case SUMO_ATTR_LENGTH:
525 return toString(nbCon.customLength);
526 case SUMO_ATTR_DIR:
527 return toString(getParentEdges().front()->getNBEdge()->getToNode()->getDirection(
528 getParentEdges().front()->getNBEdge(), nbCon.toEdge, OptionsCont::getOptions().getBool("lefthand")));
529 case SUMO_ATTR_STATE:
530 return toString(getParentEdges().front()->getNBEdge()->getToNode()->getLinkState(
531 getParentEdges().front()->getNBEdge(), nbCon.toEdge, nbCon.fromLane, nbCon.toLane, nbCon.mayDefinitelyPass, nbCon.tlID));
532 case SUMO_ATTR_SHAPE:
534 return toString(nbCon.customShape);
535 default:
536 return getCommonAttribute(key);
537 }
538}
539
540
541double
545
546
551
552
555 switch (key) {
556 case SUMO_ATTR_SHAPE:
559 default:
561 }
562}
563
564
565void
566GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
568 switch (key) {
569 case SUMO_ATTR_FROM:
570 case SUMO_ATTR_TO:
573 case SUMO_ATTR_PASS:
577 case SUMO_ATTR_ALLOW:
581 case SUMO_ATTR_SPEED:
582 case SUMO_ATTR_LENGTH:
583 case SUMO_ATTR_SHAPE:
585 case SUMO_ATTR_TYPE:
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 controlled for connection");
600 {
601 const bool wasUncontrolled = c.uncontrolled;
602 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
603 if (wasUncontrolled && !c.uncontrolled) {
604 GNEEdge* srcEdge = getParentEdges().front();
605 NBConnection newNBCon(srcEdge->getNBEdge(), c.fromLane, c.toEdge, c.toLane);
606 srcEdge->getToJunction()->invalidateTLS(undoList, NBConnection::InvalidConnection, newNBCon);
607 }
608 }
609 undoList->end();
610 break;
612 undoList->begin(this, "change attribute indirect for connection");
613 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
614 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
615 int linkIndex2 = -1;
616 if (parse<bool>(value)) {
617 // find straight connection with the same toEdge
618 std::set<NBTrafficLightDefinition*> defs = getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS();
619 NBEdge* from = getParentEdges().front()->getNBEdge();
620 for (NBTrafficLightDefinition* tlDef : defs) {
621 for (const NBConnection& c2 : tlDef->getControlledLinks()) {
622 if (c2.getTo() == c.toEdge && c2.getFrom() != from) {
623 if (from->getToNode()->getDirection(c2.getFrom(), c2.getTo()) == LinkDirection::STRAIGHT) {
624 linkIndex2 = c2.getTLIndex();
625 break;
626 }
627 }
628 }
629 }
630 }
631 changeTLIndex(key, c.tlLinkIndex, linkIndex2, undoList);
632 }
633 undoList->end();
634 break;
635 case SUMO_ATTR_DIR:
636 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
637 case SUMO_ATTR_STATE:
638 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
639 default:
640 setCommonAttribute(key, value, undoList);
641 break;
642 }
643}
644
645
646void
647GNEConnection::changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList* undoList) {
648 // trigger GNEChange_TLS
649 undoList->begin(this, "change tls linkIndex for connection");
650 // make a copy
651 std::set<NBTrafficLightDefinition*> defs = getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS();
652 for (const auto& tlDef : defs) {
653 NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
654 NBTrafficLightLogic* tllogic = sumoDef ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
655 if (tllogic != nullptr) {
656 NBLoadedSUMOTLDef* newDef = new NBLoadedSUMOTLDef(*tlDef, *tllogic);
657 newDef->addConnection(getParentEdges().front()->getNBEdge(), getParentEdges().back()->getNBEdge(),
658 getLaneFrom()->getIndex(), getLaneTo()->getIndex(), tlIndex, tlIndex2, false);
659 // make a copy
660 std::vector<NBNode*> nodes = tlDef->getNodes();
661 for (const auto& node : nodes) {
662 GNEJunction* junction = getNet()->getAttributeCarriers()->retrieveJunction(node->getID());
663 undoList->add(new GNEChange_TLS(junction, tlDef, false), true);
664 undoList->add(new GNEChange_TLS(junction, newDef, true), true);
665 }
666 } else {
667 WRITE_ERRORF(TL("Could not set attribute '%' (tls is broken)"), toString(key));
668 }
669 }
670 undoList->end();
671}
672
673
674bool
676 return getParentEdges().front()->getNBEdge()->getConnectionsFromLane(getFromLaneIndex(), getParentEdges().back()->getNBEdge(), getToLaneIndex()).size() > 0;
677}
678
679
680bool
682 // declare a flag to check if shape has to be draw (by deafult false)
683 bool drawConnection = false;
684 // only draw connections if shape isn't deprecated
690 } else {
691 drawConnection = false;
692 }
693 } else {
694 drawConnection = false;
695 }
696 // check if we're editing this connection
698 if (editedNetworkElement && (editedNetworkElement->getTagProperty()->getTag() == SUMO_TAG_CONNECTION)) {
699 if (editedNetworkElement->getAttribute(GNE_ATTR_PARENT) == getAttribute(GNE_ATTR_PARENT)) {
700 drawConnection = true;
701 }
702 }
703 return drawConnection;
704}
705
706
709 // check conditions
710 if (myShapeEdited) {
711 // return shape edit color
713 } else if (drawUsingSelectColor()) {
714 // override with special colors (unless the color scheme is based on selection)
716 } else if (mySpecialColor != nullptr) {
717 // return special color
718 return *mySpecialColor;
719 } else {
720 // Set color depending of the link state
722 }
723}
724
725
726void
728 const GUIGeometry& superposedGeometry, const double exaggeration) const {
729 // get color
730 RGBColor connectionColor = getConnectionColor(s);
731 // Push layer matrix
733 // move top if is selected
734 if (mySelected) {
735 glTranslated(0, 0, 0.2);
736 }
737 // translate to front
740 } else {
742 }
743 // Set color
744 GLHelper::setColor(connectionColor);
745 // continue depending of detail level
747 // draw geometry
748 GLHelper::drawBoxLines(superposedGeometry.getShape(), superposedGeometry.getShapeRotations(), superposedGeometry.getShapeLengths(),
749 s.connectionSettings.connectionWidth * exaggeration);
750 // draw arrows over connection
751 drawConnectionArrows(s, superposedGeometry, connectionColor);
752 // check if internal junction marker has to be drawn
756 }
757 // draw edge values
758 drawEdgeValues(s, superposedGeometry.getShape());
759 // draw shape points only in Network supemode
761 // draw geometry points
762 GUIGeometry::drawGeometryPoints(d, superposedGeometry.getShape(), connectionColor.changedBrightness(-32),
765 }
766 } else {
767 GLHelper::drawLine(superposedGeometry.getShape());
768 }
769 // Pop layer matrix
771}
772
773
774void
776 const RGBColor& color) const {
777 if (s.showLaneDirection) {
778 // Push matrix
780 // move front
781 glTranslated(0, 0, 0.1);
782 // change color
784 // draw triangles
785 for (int i = 1; i < (int)superposedGeometry.getShape().size(); i++) {
786 const auto& posA = superposedGeometry.getShape()[i - 1];
787 const auto& posB = superposedGeometry.getShape()[i];
788 GLHelper::drawTriangleAtEnd(posA, posB, (double) .2, (double) .1);
789 }
790 // Pop matrix
792 }
793}
794
795
796void
798 // check if edge value has to be shown
799 if (s.edgeValue.show(this)) {
801 const std::string value = nbCon.getParameter(s.edgeParam, "");
802 if (value != "") {
803 int shapeIndex = (int)shape.size() / 2;
804 const Position p = (myConnectionGeometry.getShape().size() == 2) ? (shape.front() * 0.67 + shape.back() * 0.33) : shape[shapeIndex];
805 GLHelper::drawTextSettings(s.edgeValue, value, p, s.scale, 0);
806 }
807 }
808}
809
810
811void
813 const PositionVector& shape, const double exaggeration) const {
814 // first check if junction parent was inserted with full boundary
815 if (!gViewObjectsHandler.checkBoundaryParentObject(this, getType(), getParentLanes().front()->getParentEdge()->getToJunction())) {
816 // calculate geometry points contour if we're editing shape
817 if (myShapeEdited) {
819 exaggeration, true);
820 } else {
821 // in move mode, add to selected object if this is the edited element
822 const auto& editModes = myNet->getViewNet()->getEditModes();
823 const bool addToSelectedObjects = (editModes.isCurrentSupermodeNetwork() && editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) ?
825 // calculate connection shape contour
827 true, true, 0, nullptr, getParentLanes().front()->getParentEdge()->getToJunction(), addToSelectedObjects);
828 }
829 }
830}
831
832
833bool
834GNEConnection::isValid(SumoXMLAttr key, const std::string& value) {
835 // Currently ignored before implementation to avoid warnings
836 switch (key) {
837 case SUMO_ATTR_FROM:
838 case SUMO_ATTR_TO:
841 return false;
842 case SUMO_ATTR_PASS:
843 return canParse<bool>(value);
845 return canParse<bool>(value);
846 case SUMO_ATTR_TYPE:
847 return true;
849 return canParse<bool>(value);
851 return canParse<double>(value) && (parse<double>(value) >= -1);
853 return canParse<bool>(value);
855 return canParse<double>(value) && (parse<double>(value) >= -1);
860 (getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS().size() > 0) &&
861 canParse<int>(value) &&
862 (parse<int>(value) >= 0 || parse<int>(value) == -1)) {
863 // obtain Traffic light definition
864 NBTrafficLightDefinition* def = *getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS().begin();
865 return def->getMaxValidIndex() >= parse<int>(value);
866 } else {
867 return false;
868 }
869 case SUMO_ATTR_ALLOW:
873 return canParseVehicleClasses(value);
874 case SUMO_ATTR_SPEED:
875 if (value.empty() || value == "default") {
876 return true;
877 } else {
878 return canParse<double>(value) && ((parse<double>(value) >= 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_SPEED));
879 }
880 case SUMO_ATTR_LENGTH:
881 return canParse<double>(value) && (parse<double>(value) >= -1);
882 case SUMO_ATTR_SHAPE:
884 // empty custom shapes are allowed
885 return canParse<PositionVector>(value);
886 case SUMO_ATTR_STATE:
887 return false;
888 case SUMO_ATTR_DIR:
889 return false;
890 default:
891 return isCommonAttributeValid(key, value);
892 }
893}
894
895
896bool
898 switch (key) {
899 case SUMO_ATTR_FROM:
900 case SUMO_ATTR_TO:
903 case SUMO_ATTR_DIR:
904 case SUMO_ATTR_STATE:
905 // this attributes cannot be edited
906 return false;
909 // get Traffic Light definitions
910 if (getParentEdges().front()->getNBEdge()->getToNode()->isTLControlled()) {
911 NBTrafficLightDefinition* tlDef = *getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS().begin();
912 NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
913 NBTrafficLightLogic* tllogic = sumoDef != nullptr ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
914 if (tllogic != nullptr) {
915 return true;
916 } else {
917 return false;
918 }
919 }
920 return false;
921 default:
922 return true;
923 }
924}
925
926
927bool
929 switch (key) {
930 case SUMO_ATTR_SPEED:
932 default:
933 return false;
934 }
935}
936
937// ===========================================================================
938// private
939// ===========================================================================
940
941void
942GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value) {
943 if (!existNBEdgeConnection()) {
944 WRITE_WARNINGF(TL("Cannot restore attribute '%=%' for computed connection from lane '%'"), toString(key), value, getParentLanes().front()->getID());
945 return;
946 }
948 switch (key) {
949 case SUMO_ATTR_PASS:
950 nbCon.mayDefinitelyPass = parse<bool>(value);
951 break;
953 nbCon.indirectLeft = parse<bool>(value);
954 break;
956 if (value == toString(KEEPCLEAR_UNSPECIFIED)) {
958 } else {
959 nbCon.keepClear = parse<bool>(value) ? KEEPCLEAR_TRUE : KEEPCLEAR_FALSE;
960 }
961 break;
963 nbCon.uncontrolled = parse<bool>(value);
964 break;
966 nbCon.contPos = parse<double>(value);
967 break;
969 nbCon.visibility = parse<double>(value);
970 break;
971 case SUMO_ATTR_SPEED:
972 if (value.empty() || (value == "default")) {
974 } else {
975 nbCon.speed = parse<double>(value);
976 }
977 break;
978 case SUMO_ATTR_LENGTH:
979 nbCon.customLength = parse<double>(value);
980 break;
981 case SUMO_ATTR_ALLOW:
982 nbCon.permissions = parseVehicleClasses(value);
983 break;
986 break;
988 nbCon.changeLeft = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
989 break;
991 nbCon.changeRight = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
992 break;
993 case SUMO_ATTR_STATE:
994 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
995 case SUMO_ATTR_DIR:
996 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
997 case SUMO_ATTR_SHAPE:
999 nbCon.customShape = parse<PositionVector>(value);
1000 break;
1001 case SUMO_ATTR_TYPE:
1002 nbCon.edgeType = value;
1003 break;
1004 default:
1005 setCommonAttribute(key, value);
1006 break;
1007 }
1008 // Update Geometry after setting a new attribute (but avoided for certain attributes)
1009 if ((key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
1012 }
1013 // invalidate demand path calculator
1015}
1016
1017/****************************************************************************/
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:46
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition GLHelper.cpp:433
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
static void 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:755
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:624
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:214
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:394
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...
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
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.
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
void clearGeometry()
clear geometry
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, bool addSeparator=true)
GUIGLObjectPopupMenu * getPopup() const
ge the current popup-menu
bool checkBoundaryParentObject(const GUIGlObject *GLObject, const double layer, const GUIGlObject *parent)
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
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:2498
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:197
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