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>
33
34#include "GNEConnection.h"
35#include "GNEInternalLane.h"
36
37// ===========================================================================
38// method definitions
39// ===========================================================================
40
42 GNENetworkElement(from->getNet(), "from" + from->getID() + "to" + to->getID(), SUMO_TAG_CONNECTION),
43 myMoveElementConnection(new GNEMoveElementConnection(this)),
44 myLinkState(LINKSTATE_TL_OFF_NOSIGNAL),
45 mySpecialColor(nullptr),
46 myShapeDeprecated(true) {
47 // set parents
48 setParents<GNELane*>({from, to});
49 setParents<GNEEdge*>({from->getParentEdge(), to->getParentEdge()});
50}
51
52
55
56
61
62
67
68
69const Parameterised*
74
75
76const PositionVector&
78 if (myConnectionGeometry.getShape().size() > 0) {
80 } else {
82 }
83}
84
85
86void
88 // check if adjust shape
90 // Get shape of from and to lanes
92 // obtain lane shapes
93 PositionVector laneShapeFrom = getParentLanes().front()->getLaneShape();
94 PositionVector laneShapeTo = getParentLanes().back()->getLaneShape();
95 // Calculate shape of connection depending of the size of Junction shape
96 if (nbCon.customShape.size() > 0) {
98 } else if (nbCon.shape.size() > 1) {
99 PositionVector connectionShape;
100 if ((nbCon.shape.length() < 3) && !nbCon.haveVia) {
101 // apply offset to lane shape if we're in lane spread function center
102 if (getParentLanes().front()->getParentEdge()->getNBEdge()->getLaneSpreadFunction() == LaneSpreadFunction::CENTER) {
103 laneShapeFrom.move2side(0.3);
104 }
105 if (getParentLanes().back()->getParentEdge()->getNBEdge()->getLaneSpreadFunction() == LaneSpreadFunction::CENTER) {
106 laneShapeTo.move2side(0.3);
107 }
108 // check if this connetion is a turn around
109 bool turnAround = false;
110 const auto fromOppositeEdges = getParentLanes().front()->getParentEdge()->getOppositeEdges();
111 for (const auto& edge : fromOppositeEdges) {
112 if (edge == getParentLanes().back()->getParentEdge()) {
113 turnAround = true;
114 break;
115 }
116 }
117 // add from lane shape one step before
118 if (laneShapeFrom.length() > 1) {
119 // set length depending of turn arounds
120 if (turnAround) {
121 connectionShape.push_back(laneShapeFrom.positionAtOffset(laneShapeFrom.length() - 0.5));
122 } else {
123 connectionShape.push_back(laneShapeFrom.positionAtOffset(laneShapeFrom.length() - 1));
124 }
125 }
126 // add from lane shape
127 connectionShape.push_back(laneShapeFrom.back());
128 // add to lane shape
129 connectionShape.push_back(laneShapeTo.front());
130 // add to lane shape one step after
131 if (laneShapeTo.length() > 1) {
132 // set length depending of turn arounds
133 if (turnAround) {
134 connectionShape.push_back(laneShapeTo.positionAtOffset(0.5));
135 } else {
136 connectionShape.push_back(laneShapeTo.positionAtOffset(1));
137 }
138 }
139 } else {
140 connectionShape = nbCon.shape;
141 // only append via shape if it exists
142 if (nbCon.haveVia) {
143 connectionShape.append(nbCon.viaShape);
144 }
145 }
146 myConnectionGeometry.updateGeometry(connectionShape);
147 } else if (getParentLanes().front()->getLane2laneConnections().exist(getParentLanes().back())) {
148 myConnectionGeometry = getParentLanes().front()->getLane2laneConnections().getLane2laneGeometry(getParentLanes().back());
149 } else {
151 }
152 // check if internal junction marker must be calculated
153 if (nbCon.haveVia && (nbCon.shape.size() > 0)) {
154 // create marker for internal junction waiting position (contPos)
155 const double orthoLength = 0.5;
156 PositionVector internalJunctionMarker = nbCon.shape.getOrthogonal(nbCon.shape.back(), 10, true, 0.1);
157 if (internalJunctionMarker.length() < orthoLength) {
158 internalJunctionMarker.extrapolate(orthoLength - internalJunctionMarker.length());
159 }
160 myInternalJunctionMarkerGeometry.updateGeometry(internalJunctionMarker);
161 } else {
163 }
164 // mark connection as non-deprecated
165 myShapeDeprecated = false;
166 }
167}
168
169
172 // currently unused
173 return Position(0, 0);
174}
175
176
177bool
179 return false;
180}
181
182
183bool
185 return false;
186}
187
188
189bool
191 // check opened popup
192 if (myNet->getViewNet()->getPopup()) {
193 return myNet->getViewNet()->getPopup()->getGLObject() == this;
194 }
195 return false;
196}
197
198
199bool
201 return false;
202}
203
204
205bool
207 // get edit modes
208 const auto& editModes = myNet->getViewNet()->getEditModes();
209 // check if we're in delete mode
210 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
212 } else {
213 return false;
214 }
215}
216
217
218bool
220 return false;
221}
222
223
224bool
226 // get edit modes
227 const auto& editModes = myNet->getViewNet()->getEditModes();
228 // check if we're in select mode
229 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
231 } else {
232 return false;
233 }
234}
235
236
237bool
239 // get edit modes
240 const auto& editModes = myNet->getViewNet()->getEditModes();
241 // check if we're in move mode
242 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
243 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
244 // check if we're editing this network element
246 if (editedNetworkElement) {
247 return editedNetworkElement == this;
248 } else {
249 // only move the first element
251 }
252 } else {
253 return false;
254 }
255}
256
257
258GNEEdge*
260 return getParentEdges().front();
261}
262
263
264GNEEdge*
266 return getParentEdges().back();
267}
268
269
270GNELane*
272 return getParentLanes().front();
273}
274
275
276GNELane*
278 return getParentLanes().back();
279}
280
281
282int
284 return getParentLanes().front()->getIndex();
285}
286
287
288int
290 return getParentLanes().back()->getIndex();
291}
292
293
296 return getParentEdges().front()->getNBEdge()->getConnectionRef(getFromLaneIndex(), getParentEdges().back()->getNBEdge(), getToLaneIndex());
297}
298
299
303 return NBConnection(getParentEdges().front()->getNBEdge(), getFromLaneIndex(),
304 getParentEdges().back()->getNBEdge(), getToLaneIndex(),
305 (int)c.tlLinkIndex, (int)c.tlLinkIndex2);
306}
307
308
309void
313
314
317 return myLinkState;
318}
319
320
321void
325
326
327void
330 myLinkState = getParentEdges().front()->getNBEdge()->getToNode()->getLinkState(getParentEdges().front()->getNBEdge(),
331 nbCon.toEdge,
332 nbCon.fromLane,
333 nbCon.toLane,
334 nbCon.mayDefinitelyPass,
335 nbCon.tlID);
336}
337
338
339void
341 auto shape = getConnectionShape();
342 shape = shape.bezier(5);
344}
345
346
349 if (myShapeEdited) {
350 return getShapeEditedPopUpMenu(app, parent, getNBEdgeConnection().customShape);
351 } else {
352 // create popup
353 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
354 // build common options
356 // check if we're in supermode network
358 // create menu commands
359 FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, "Set custom connection shape", nullptr, &parent, MID_GNE_CONNECTION_EDIT_SHAPE);
360 GUIDesigns::buildFXMenuCommand(ret, "Smooth connection shape", nullptr, &parent, MID_GNE_CONNECTION_SMOOTH_SHAPE);
361 // check if menu commands has to be disabled
363 // check if we're in the correct edit mode
365 mcCustomShape->disable();
366 }
367 }
368 return ret;
369 }
370}
371
372
373double
377
378
383
384
385void
386GNEConnection::updateCenteringBoundary(const bool /*updateGrid*/) {
387 // nothing to update
388}
389
390
391void
393 // Check if connection must be drawed
394 if (checkDrawConnection()) {
395 // get connection exaggeration
396 const double connectionExaggeration = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
397 // get detail level
398 const auto d = s.getDetailLevel(connectionExaggeration);
399 // check if draw shape superposed (used in train lanes)
400 PositionVector shapeSuperposed = myConnectionGeometry.getShape();
401 if (getParentLanes().front()->getDrawingConstants()->drawSuperposed()) {
402 shapeSuperposed.move2side(0.5);
403 }
404 GUIGeometry superposedGeometry(shapeSuperposed);
405 // draw geometry only if we'rent in drawForObjectUnderCursor mode
407 // draw connection
408 drawConnection(s, d, superposedGeometry, connectionExaggeration);
409 // draw lock icon
411 // draw dotted contour depending if we're editing the custom shape
413 if (editedNetworkElement && (editedNetworkElement == this)) {
414 // draw dotted contour geometry points
416 connectionExaggeration, s.dottedContourSettings.segmentWidthSmall);
417 } else {
418 // draw dotted contour
420 }
421 }
422 // calculate contour
423 calculateConnectionContour(s, d, shapeSuperposed, connectionExaggeration);
424 }
425}
426
427
428void
432
433
434void
438
439
440void
444
445
446std::string
448 // first get attributes in which nbConnection reference can be invalid
449 switch (key) {
450 case SUMO_ATTR_ID:
451 return getMicrosimID();
452 case SUMO_ATTR_FROM:
453 return getParentLanes().front()->getParentEdge()->getID();
454 case SUMO_ATTR_TO:
455 return getParentLanes().back()->getParentEdge()->getID();
457 return getParentLanes().front()->getAttribute(SUMO_ATTR_INDEX);
459 return getParentLanes().front()->getID();
461 return getParentLanes().back()->getAttribute(SUMO_ATTR_INDEX);
463 return getParentLanes().back()->getID();
466 return getCommonAttribute(key);
467 case GNE_ATTR_PARENT:
468 return getParentEdges().front()->getToJunction()->getID();
469 default:
470 break;
471 }
472 // now continue with attributes that needs a nbConnection reference
474 switch (key) {
475 case SUMO_ATTR_PASS:
476 return toString(nbCon.mayDefinitelyPass);
478 return toString(nbCon.indirectLeft);
479 case SUMO_ATTR_TYPE:
480 return toString(nbCon.edgeType);
482 return toString(nbCon.keepClear);
484 return toString(nbCon.contPos);
486 return toString(nbCon.uncontrolled);
488 return toString(nbCon.visibility);
490 return toString(nbCon.tlLinkIndex);
492 return toString(nbCon.tlLinkIndex2);
493 case SUMO_ATTR_ALLOW:
494 if (nbCon.permissions == SVC_UNSPECIFIED) {
495 return getVehicleClassNames(nbCon.toEdge->getLanes()[nbCon.toLane].permissions);
496 } else {
497 return getVehicleClassNames(nbCon.permissions);
498 }
500 if (nbCon.permissions == SVC_UNSPECIFIED) {
501 return getVehicleClassNames(invertPermissions(nbCon.toEdge->getLanes()[nbCon.toLane].permissions));
502 } else {
504 }
506 if (nbCon.changeLeft == SVC_UNSPECIFIED) {
507 return "all";
508 } else {
509 return getVehicleClassNames(nbCon.changeLeft);
510 }
512 if (nbCon.changeRight == SVC_UNSPECIFIED) {
513 return "all";
514 } else {
515 return getVehicleClassNames(nbCon.changeRight);
516 }
517 case SUMO_ATTR_SPEED:
518 if (nbCon.speed == NBEdge::UNSPECIFIED_SPEED) {
519 return "default";
520 } else {
521 return toString(nbCon.speed);
522 }
523 case SUMO_ATTR_LENGTH:
524 return toString(nbCon.customLength);
525 case SUMO_ATTR_DIR:
526 return toString(getParentEdges().front()->getNBEdge()->getToNode()->getDirection(
527 getParentEdges().front()->getNBEdge(), nbCon.toEdge, OptionsCont::getOptions().getBool("lefthand")));
528 case SUMO_ATTR_STATE:
529 return toString(getParentEdges().front()->getNBEdge()->getToNode()->getLinkState(
530 getParentEdges().front()->getNBEdge(), nbCon.toEdge, nbCon.fromLane, nbCon.toLane, nbCon.mayDefinitelyPass, nbCon.tlID));
531 case SUMO_ATTR_SHAPE:
533 return toString(nbCon.customShape);
534 default:
535 return getCommonAttribute(key);
536 }
537}
538
539
540double
544
545
550
551
554 switch (key) {
555 case SUMO_ATTR_SHAPE:
558 default:
560 }
561}
562
563
564void
565GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
567 switch (key) {
568 case SUMO_ATTR_FROM:
569 case SUMO_ATTR_TO:
572 case SUMO_ATTR_PASS:
576 case SUMO_ATTR_ALLOW:
580 case SUMO_ATTR_SPEED:
581 case SUMO_ATTR_LENGTH:
582 case SUMO_ATTR_SHAPE:
584 case SUMO_ATTR_TYPE:
585 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
586 break;
588 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
589 changeTLIndex(key, parse<int>(value), c.tlLinkIndex2, undoList);
590 }
591 break;
593 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
594 changeTLIndex(key, c.tlLinkIndex, parse<int>(value), undoList);
595 }
596 break;
598 undoList->begin(this, "change attribute controlled for connection");
599 {
600 const bool wasUncontrolled = c.uncontrolled;
601 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
602 if (wasUncontrolled && !c.uncontrolled) {
603 GNEEdge* srcEdge = getParentEdges().front();
604 NBConnection newNBCon(srcEdge->getNBEdge(), c.fromLane, c.toEdge, c.toLane);
605 srcEdge->getToJunction()->invalidateTLS(undoList, NBConnection::InvalidConnection, newNBCon);
606 }
607 }
608 undoList->end();
609 break;
611 undoList->begin(this, "change attribute indirect for connection");
612 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
613 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
614 int linkIndex2 = -1;
615 if (parse<bool>(value)) {
616 // find straight connection with the same toEdge
617 std::set<NBTrafficLightDefinition*> defs = getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS();
618 NBEdge* from = getParentEdges().front()->getNBEdge();
619 for (NBTrafficLightDefinition* tlDef : defs) {
620 for (const NBConnection& c2 : tlDef->getControlledLinks()) {
621 if (c2.getTo() == c.toEdge && c2.getFrom() != from) {
622 if (from->getToNode()->getDirection(c2.getFrom(), c2.getTo()) == LinkDirection::STRAIGHT) {
623 linkIndex2 = c2.getTLIndex();
624 break;
625 }
626 }
627 }
628 }
629 }
630 changeTLIndex(key, c.tlLinkIndex, linkIndex2, undoList);
631 }
632 undoList->end();
633 break;
634 case SUMO_ATTR_DIR:
635 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
636 case SUMO_ATTR_STATE:
637 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
638 default:
639 setCommonAttribute(key, value, undoList);
640 break;
641 }
642}
643
644
645void
646GNEConnection::changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList* undoList) {
647 // trigger GNEChange_TLS
648 undoList->begin(this, "change tls linkIndex for connection");
649 // make a copy
650 std::set<NBTrafficLightDefinition*> defs = getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS();
651 for (const auto& tlDef : defs) {
652 NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
653 NBTrafficLightLogic* tllogic = sumoDef ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
654 if (tllogic != nullptr) {
655 NBLoadedSUMOTLDef* newDef = new NBLoadedSUMOTLDef(*tlDef, *tllogic);
656 newDef->addConnection(getParentEdges().front()->getNBEdge(), getParentEdges().back()->getNBEdge(),
657 getLaneFrom()->getIndex(), getLaneTo()->getIndex(), tlIndex, tlIndex2, false);
658 // make a copy
659 std::vector<NBNode*> nodes = tlDef->getNodes();
660 for (const auto& node : nodes) {
661 GNEJunction* junction = getNet()->getAttributeCarriers()->retrieveJunction(node->getID());
662 undoList->add(new GNEChange_TLS(junction, tlDef, false), true);
663 undoList->add(new GNEChange_TLS(junction, newDef, true), true);
664 }
665 } else {
666 WRITE_ERRORF(TL("Could not set attribute '%' (tls is broken)"), toString(key));
667 }
668 }
669 undoList->end();
670}
671
672
673bool
675 return getParentEdges().front()->getNBEdge()->getConnectionsFromLane(getFromLaneIndex(), getParentEdges().back()->getNBEdge(), getToLaneIndex()).size() > 0;
676}
677
678
679bool
681 // declare a flag to check if shape has to be draw (by deafult false)
682 bool drawConnection = false;
683 // only draw connections if shape isn't deprecated
689 } else {
690 drawConnection = false;
691 }
692 } else {
693 drawConnection = false;
694 }
695 // check if we're editing this connection
697 if (editedNetworkElement && (editedNetworkElement->getTagProperty()->getTag() == SUMO_TAG_CONNECTION)) {
698 if (editedNetworkElement->getAttribute(GNE_ATTR_PARENT) == getAttribute(GNE_ATTR_PARENT)) {
699 drawConnection = true;
700 }
701 }
702 return drawConnection;
703}
704
705
708 // check conditions
709 if (myShapeEdited) {
710 // return shape edit color
712 } else if (drawUsingSelectColor()) {
713 // override with special colors (unless the color scheme is based on selection)
715 } else if (mySpecialColor != nullptr) {
716 // return special color
717 return *mySpecialColor;
718 } else {
719 // Set color depending of the link state
721 }
722}
723
724
725void
727 const GUIGeometry& superposedGeometry, const double exaggeration) const {
728 // get color
729 RGBColor connectionColor = getConnectionColor(s);
730 // Push layer matrix
732 // move top if is selected
733 if (mySelected) {
734 glTranslated(0, 0, 0.2);
735 }
736 // translate to front
739 } else {
741 }
742 // Set color
743 GLHelper::setColor(connectionColor);
744 // continue depending of detail level
746 // draw geometry
747 GLHelper::drawBoxLines(superposedGeometry.getShape(), superposedGeometry.getShapeRotations(), superposedGeometry.getShapeLengths(),
748 s.connectionSettings.connectionWidth * exaggeration);
749 // draw arrows over connection
750 drawConnectionArrows(s, superposedGeometry, connectionColor);
751 // check if internal junction marker has to be drawn
755 }
756 // draw edge values
757 drawEdgeValues(s, superposedGeometry.getShape());
758 // draw shape points only in Network supemode
760 // draw geometry points
761 GUIGeometry::drawGeometryPoints(d, superposedGeometry.getShape(), connectionColor.changedBrightness(-32),
764 }
765 } else {
766 GLHelper::drawLine(superposedGeometry.getShape());
767 }
768 // Pop layer matrix
770}
771
772
773void
775 const RGBColor& color) const {
776 if (s.showLaneDirection) {
777 // Push matrix
779 // move front
780 glTranslated(0, 0, 0.1);
781 // change color
783 // draw triangles
784 for (int i = 1; i < (int)superposedGeometry.getShape().size(); i++) {
785 const auto& posA = superposedGeometry.getShape()[i - 1];
786 const auto& posB = superposedGeometry.getShape()[i];
787 GLHelper::drawTriangleAtEnd(posA, posB, (double) .2, (double) .1);
788 }
789 // Pop matrix
791 }
792}
793
794
795void
797 // check if edge value has to be shown
798 if (s.edgeValue.show(this)) {
800 const std::string value = nbCon.getParameter(s.edgeParam, "");
801 if (value != "") {
802 int shapeIndex = (int)shape.size() / 2;
803 const Position p = (myConnectionGeometry.getShape().size() == 2) ? (shape.front() * 0.67 + shape.back() * 0.33) : shape[shapeIndex];
804 GLHelper::drawTextSettings(s.edgeValue, value, p, s.scale, 0);
805 }
806 }
807}
808
809
810void
812 const PositionVector& shape, const double exaggeration) const {
813 // first check if junction parent was inserted with full boundary
814 if (!gViewObjectsHandler.checkBoundaryParentObject(this, getType(), getParentLanes().front()->getParentEdge()->getToJunction())) {
815 // calculate geometry points contour if we're editing shape
816 if (myShapeEdited) {
818 exaggeration, true);
819 } else {
820 // in move mode, add to selected object if this is the edited element
821 const auto& editModes = myNet->getViewNet()->getEditModes();
822 const bool addToSelectedObjects = (editModes.isCurrentSupermodeNetwork() && editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) ?
824 // calculate connection shape contour
826 true, true, 0, nullptr, getParentLanes().front()->getParentEdge()->getToJunction(), addToSelectedObjects);
827 }
828 }
829}
830
831
832bool
833GNEConnection::isValid(SumoXMLAttr key, const std::string& value) {
834 // Currently ignored before implementation to avoid warnings
835 switch (key) {
836 case SUMO_ATTR_FROM:
837 case SUMO_ATTR_TO:
840 return false;
841 case SUMO_ATTR_PASS:
842 return canParse<bool>(value);
844 return canParse<bool>(value);
845 case SUMO_ATTR_TYPE:
846 return true;
848 return canParse<bool>(value);
850 return canParse<double>(value) && (parse<double>(value) >= -1);
852 return canParse<bool>(value);
854 return canParse<double>(value) && (parse<double>(value) >= -1);
859 (getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS().size() > 0) &&
860 canParse<int>(value) &&
861 (parse<int>(value) >= 0 || parse<int>(value) == -1)) {
862 // obtain Traffic light definition
863 NBTrafficLightDefinition* def = *getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS().begin();
864 return def->getMaxValidIndex() >= parse<int>(value);
865 } else {
866 return false;
867 }
868 case SUMO_ATTR_ALLOW:
872 return canParseVehicleClasses(value);
873 case SUMO_ATTR_SPEED:
874 if (value.empty() || value == "default") {
875 return true;
876 } else {
877 return canParse<double>(value) && ((parse<double>(value) >= 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_SPEED));
878 }
879 case SUMO_ATTR_LENGTH:
880 return canParse<double>(value) && (parse<double>(value) >= -1);
881 case SUMO_ATTR_SHAPE:
883 // empty custom shapes are allowed
884 return canParse<PositionVector>(value);
885 case SUMO_ATTR_STATE:
886 return false;
887 case SUMO_ATTR_DIR:
888 return false;
889 default:
890 return isCommonAttributeValid(key, value);
891 }
892}
893
894
895bool
897 switch (key) {
898 case SUMO_ATTR_FROM:
899 case SUMO_ATTR_TO:
902 case SUMO_ATTR_DIR:
903 case SUMO_ATTR_STATE:
904 // this attributes cannot be edited
905 return false;
908 // get Traffic Light definitions
909 if (getParentEdges().front()->getNBEdge()->getToNode()->isTLControlled()) {
910 NBTrafficLightDefinition* tlDef = *getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS().begin();
911 NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
912 NBTrafficLightLogic* tllogic = sumoDef != nullptr ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
913 if (tllogic != nullptr) {
914 return true;
915 } else {
916 return false;
917 }
918 }
919 return false;
920 default:
921 return true;
922 }
923}
924
925
926bool
928 switch (key) {
929 case SUMO_ATTR_SPEED:
931 default:
932 return false;
933 }
934}
935
936// ===========================================================================
937// private
938// ===========================================================================
939
940void
941GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value) {
942 if (!existNBEdgeConnection()) {
943 WRITE_WARNINGF("Cannot restore attribute '%=%' for computed connection from lane '%'", toString(key), value, getParentLanes().front()->getID());
944 return;
945 }
947 switch (key) {
948 case SUMO_ATTR_PASS:
949 nbCon.mayDefinitelyPass = parse<bool>(value);
950 break;
952 nbCon.indirectLeft = parse<bool>(value);
953 break;
955 if (value == toString(KEEPCLEAR_UNSPECIFIED)) {
957 } else {
958 nbCon.keepClear = parse<bool>(value) ? KEEPCLEAR_TRUE : KEEPCLEAR_FALSE;
959 }
960 break;
962 nbCon.uncontrolled = parse<bool>(value);
963 break;
965 nbCon.contPos = parse<double>(value);
966 break;
968 nbCon.visibility = parse<double>(value);
969 break;
970 case SUMO_ATTR_SPEED:
971 if (value.empty() || (value == "default")) {
973 } else {
974 nbCon.speed = parse<double>(value);
975 }
976 break;
977 case SUMO_ATTR_LENGTH:
978 nbCon.customLength = parse<double>(value);
979 break;
980 case SUMO_ATTR_ALLOW:
981 nbCon.permissions = parseVehicleClasses(value);
982 break;
985 break;
987 nbCon.changeLeft = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
988 break;
990 nbCon.changeRight = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
991 break;
992 case SUMO_ATTR_STATE:
993 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
994 case SUMO_ATTR_DIR:
995 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
996 case SUMO_ATTR_SHAPE:
998 nbCon.customShape = parse<PositionVector>(value);
999 break;
1000 case SUMO_ATTR_TYPE:
1001 nbCon.edgeType = value;
1002 break;
1003 default:
1004 setCommonAttribute(key, value);
1005 break;
1006 }
1007 // Update Geometry after setting a new attribute (but avoided for certain attributes)
1008 if ((key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
1011 }
1012 // invalidate demand path calculator
1014}
1015
1016/****************************************************************************/
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
const std::string getID() const
get ID (all Attribute Carriers have one)
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)
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
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
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 deleteGLObject()
delete element
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
bool isAttributeComputed(SumoXMLAttr key) const
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
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)
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"
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
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
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
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool myShapeDeprecated
flag to indicate that connection's shape has to be updated
void calculateConnectionContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const PositionVector &shape, const double exaggeration) const
calculate connection contour
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)
bool isAttributeEnabled(SumoXMLAttr key) const
LinkState myLinkState
Linkstate.
void updateGLObject()
update GLObject (geometry, ID, etc.)
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:753
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:370
GNEPathManager * getDemandPathManager()
get demand path manager
Definition GNENet.cpp:174
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:144
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
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)
GNEUndoList * getUndoList() const
get the undoList object
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:2496
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