Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
22#include <netedit/GNENet.h>
24#include <netedit/GNEUndoList.h>
25#include <netedit/GNEViewNet.h>
35
36#include "GNEConnection.h"
37#include "GNEInternalLane.h"
38
39// ===========================================================================
40// method definitions
41// ===========================================================================
42
44 GNENetworkElement(from->getNet(), "from" + from->getID() + "to" + to->getID(), SUMO_TAG_CONNECTION),
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
58const PositionVector&
60 if (myConnectionGeometry.getShape().size() > 0) {
62 } else {
64 }
65}
66
67
68void
70 // check if adjust shape
72 // Get shape of from and to lanes
74 // obtain lane shapes
75 const auto& laneShapeFrom = getParentLanes().front()->getLaneShape();
76 const auto& laneShapeTo = getParentLanes().back()->getLaneShape();
77 // Calculate shape of connection depending of the size of Junction shape
78 if (nbCon.customShape.size() > 0) {
80 } else if (nbCon.shape.size() > 1) {
81 PositionVector connectionShape;
82 if ((nbCon.shape.length() < 3) && !nbCon.haveVia) {
83 if (laneShapeFrom.length() > 1) {
84 connectionShape.push_back(laneShapeFrom.positionAtOffset(laneShapeFrom.length() - 1));
85 }
86 connectionShape.push_back(laneShapeFrom.back());
87 connectionShape.push_back(laneShapeTo.front());
88 if (laneShapeTo.length() > 1) {
89 connectionShape.push_back(laneShapeTo.positionAtOffset(1));
90 }
91 } else {
92 connectionShape = nbCon.shape;
93 // only append via shape if it exists
94 if (nbCon.haveVia) {
95 connectionShape.append(nbCon.viaShape);
96 }
97 }
98 myConnectionGeometry.updateGeometry(connectionShape);
99 } else if (getParentLanes().front()->getLane2laneConnections().exist(getParentLanes().back())) {
100 myConnectionGeometry = getParentLanes().front()->getLane2laneConnections().getLane2laneGeometry(getParentLanes().back());
101 } else {
103 }
104 // check if internal junction marker must be calculated
105 if (nbCon.haveVia && (nbCon.shape.size() > 0)) {
106 // create marker for internal junction waiting position (contPos)
107 const double orthoLength = 0.5;
108 PositionVector internalJunctionMarker = nbCon.shape.getOrthogonal(nbCon.shape.back(), 10, true, 0.1);
109 if (internalJunctionMarker.length() < orthoLength) {
110 internalJunctionMarker.extrapolate(orthoLength - internalJunctionMarker.length());
111 }
112 myInternalJunctionMarkerGeometry.updateGeometry(internalJunctionMarker);
113 } else {
115 }
116 // mark connection as non-deprecated
117 myShapeDeprecated = false;
118 }
119}
120
121
124 // currently unused
125 return Position(0, 0);
126}
127
128
129bool
131 return false;
132}
133
134
135bool
137 return false;
138}
139
140
141bool
143 // check opened popup
144 if (myNet->getViewNet()->getPopup()) {
145 return myNet->getViewNet()->getPopup()->getGLObject() == this;
146 }
147 return false;
148}
149
150
151bool
153 return false;
154}
155
156
157bool
159 // get edit modes
160 const auto& editModes = myNet->getViewNet()->getEditModes();
161 // check if we're in delete mode
162 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
164 } else {
165 return false;
166 }
167}
168
169
170bool
172 return false;
173}
174
175
176bool
178 // get edit modes
179 const auto& editModes = myNet->getViewNet()->getEditModes();
180 // check if we're in select mode
181 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
183 } else {
184 return false;
185 }
186}
187
188
189bool
191 // get edit modes
192 const auto& editModes = myNet->getViewNet()->getEditModes();
193 // check if we're in move mode
194 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
195 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
196 // check if we're editing this network element
198 if (editedNetworkElement) {
199 return editedNetworkElement == this;
200 } else {
201 // only move the first element
203 }
204 } else {
205 return false;
206 }
207}
208
209
212 // edit depending if shape is being edited
213 if (isShapeEdited()) {
214 // get connection
215 const auto& connection = getNBEdgeConnection();
216 // calculate move shape operation
217 return calculateMoveShapeOperation(this, connection.customShape.size() > 0 ? connection.customShape : myConnectionGeometry.getShape(), false);
218 } else {
219 return nullptr;
220 }
221}
222
223
224void
225GNEConnection::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
226 // edit depending if shape is being edited
227 if (isShapeEdited()) {
228 // get connection
229 const auto& connection = getNBEdgeConnection();
230 // get original shape
231 PositionVector shape = connection.customShape.size() > 0 ? connection.customShape : connection.shape;
232 // check shape size
233 if (shape.size() > 2) {
234 // obtain index
235 int index = shape.indexOfClosest(clickedPosition);
236 // get snap radius
238 // check if we have to create a new index
239 if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
240 // remove geometry point
241 shape.erase(shape.begin() + index);
242 // commit new shape
243 undoList->begin(this, "remove geometry point of " + getTagStr());
245 undoList->end();
246 }
247 }
248 }
249}
250
251
252GNEEdge*
254 return getParentEdges().front();
255}
256
257
258GNEEdge*
260 return getParentEdges().back();
261}
262
263
264GNELane*
266 return getParentLanes().front();
267}
268
269
270GNELane*
272 return getParentLanes().back();
273}
274
275
276int
278 return getParentLanes().front()->getIndex();
279}
280
281
282int
284 return getParentLanes().back()->getIndex();
285}
286
287
290 return getParentEdges().front()->getNBEdge()->getConnectionRef(getFromLaneIndex(), getParentEdges().back()->getNBEdge(), getToLaneIndex());
291}
292
293
297 return NBConnection(getParentEdges().front()->getNBEdge(), getFromLaneIndex(),
298 getParentEdges().back()->getNBEdge(), getToLaneIndex(),
299 (int)c.tlLinkIndex, (int)c.tlLinkIndex2);
300}
301
302
303void
307
308
311 return myLinkState;
312}
313
314
315void
319
320
321void
324 myLinkState = getParentEdges().front()->getNBEdge()->getToNode()->getLinkState(getParentEdges().front()->getNBEdge(),
325 nbCon.toEdge,
326 nbCon.fromLane,
327 nbCon.toLane,
328 nbCon.mayDefinitelyPass,
329 nbCon.tlID);
330}
331
332
333void
335 auto shape = getConnectionShape();
336 shape = shape.bezier(5);
338}
339
340
343 if (myShapeEdited) {
344 return getShapeEditedPopUpMenu(app, parent, getNBEdgeConnection().customShape);
345 } else {
346 // create popup
347 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
348 // build common options
350 // check if we're in supermode network
352 // create menu commands
353 FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, "Set custom connection shape", nullptr, &parent, MID_GNE_CONNECTION_EDIT_SHAPE);
354 GUIDesigns::buildFXMenuCommand(ret, "Smooth connection shape", nullptr, &parent, MID_GNE_CONNECTION_SMOOTH_SHAPE);
355 // check if menu commands has to be disabled
357 // check if we're in the correct edit mode
359 mcCustomShape->disable();
360 }
361 }
362 return ret;
363 }
364}
365
366
367double
371
372
377
378
379void
380GNEConnection::updateCenteringBoundary(const bool /*updateGrid*/) {
381 // nothing to update
382}
383
384
385void
387 // Check if connection must be drawed
388 if (checkDrawConnection()) {
389 // get connection exaggeration
390 const double connectionExaggeration = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
391 // get detail level
392 const auto d = s.getDetailLevel(connectionExaggeration);
393 // check if draw shape superposed (used in train lanes)
394 PositionVector shapeSuperposed = myConnectionGeometry.getShape();
395 if (getParentLanes().front()->getDrawingConstants()->drawSuperposed()) {
396 shapeSuperposed.move2side(0.5);
397 }
398 GUIGeometry superposedGeometry(shapeSuperposed);
399 // draw geometry only if we'rent in drawForObjectUnderCursor mode
401 // draw connection
402 drawConnection(s, d, superposedGeometry, connectionExaggeration);
403 // draw lock icon
405 // draw dotted contour depending if we're editing the custom shape
407 if (editedNetworkElement && (editedNetworkElement == this)) {
408 // draw dotted contour geometry points
410 connectionExaggeration, s.dottedContourSettings.segmentWidthSmall);
411 } else {
412 // draw dotted contour
414 }
415 }
416 // calculate contour
417 calculateConnectionContour(s, d, shapeSuperposed, connectionExaggeration);
418 }
419}
420
421
422void
426
427
428void
432
433
434void
438
439
440std::string
442 // first get attributes in which nbConnection reference can be invalid
443 switch (key) {
444 case SUMO_ATTR_ID:
445 return getMicrosimID();
446 case SUMO_ATTR_FROM:
447 return getParentLanes().front()->getParentEdge()->getID();
448 case SUMO_ATTR_TO:
449 return getParentLanes().back()->getParentEdge()->getID();
451 return getParentLanes().front()->getAttribute(SUMO_ATTR_INDEX);
453 return getParentLanes().front()->getID();
455 return getParentLanes().back()->getAttribute(SUMO_ATTR_INDEX);
457 return getParentLanes().back()->getID();
460 return getCommonAttribute(nullptr, key);
461 case GNE_ATTR_PARENT:
462 return getParentEdges().front()->getToJunction()->getID();
463 default:
464 break;
465 }
466 // now continue with attributes that needs a nbConnection reference
468 switch (key) {
469 case SUMO_ATTR_PASS:
470 return toString(nbCon.mayDefinitelyPass);
472 return toString(nbCon.indirectLeft);
473 case SUMO_ATTR_TYPE:
474 return toString(nbCon.edgeType);
476 return toString(nbCon.keepClear);
478 return toString(nbCon.contPos);
480 return toString(nbCon.uncontrolled);
482 return toString(nbCon.visibility);
484 return toString(nbCon.tlLinkIndex);
486 return toString(nbCon.tlLinkIndex2);
487 case SUMO_ATTR_ALLOW:
488 if (nbCon.permissions == SVC_UNSPECIFIED) {
489 return getVehicleClassNames(nbCon.toEdge->getLanes()[nbCon.toLane].permissions);
490 } else {
491 return getVehicleClassNames(nbCon.permissions);
492 }
494 if (nbCon.permissions == SVC_UNSPECIFIED) {
495 return getVehicleClassNames(invertPermissions(nbCon.toEdge->getLanes()[nbCon.toLane].permissions));
496 } else {
498 }
500 if (nbCon.changeLeft == SVC_UNSPECIFIED) {
501 return "all";
502 } else {
503 return getVehicleClassNames(nbCon.changeLeft);
504 }
506 if (nbCon.changeRight == SVC_UNSPECIFIED) {
507 return "all";
508 } else {
509 return getVehicleClassNames(nbCon.changeRight);
510 }
511 case SUMO_ATTR_SPEED:
512 if (nbCon.speed == NBEdge::UNSPECIFIED_SPEED) {
513 return "default";
514 } else {
515 return toString(nbCon.speed);
516 }
517 case SUMO_ATTR_LENGTH:
518 return toString(nbCon.customLength);
519 case SUMO_ATTR_DIR:
520 return toString(getParentEdges().front()->getNBEdge()->getToNode()->getDirection(
521 getParentEdges().front()->getNBEdge(), nbCon.toEdge, OptionsCont::getOptions().getBool("lefthand")));
522 case SUMO_ATTR_STATE:
523 return toString(getParentEdges().front()->getNBEdge()->getToNode()->getLinkState(
524 getParentEdges().front()->getNBEdge(), nbCon.toEdge, nbCon.fromLane, nbCon.toLane, nbCon.mayDefinitelyPass, nbCon.tlID));
525 case SUMO_ATTR_SHAPE:
527 return toString(nbCon.customShape);
528 default:
529 return getCommonAttribute(&nbCon, key);
530 }
531}
532
533
536 switch (key) {
537 case SUMO_ATTR_SHAPE:
540 default:
541 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
542 }
543}
544
545
546void
547GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
549 switch (key) {
550 case SUMO_ATTR_FROM:
551 case SUMO_ATTR_TO:
554 case SUMO_ATTR_PASS:
558 case SUMO_ATTR_ALLOW:
562 case SUMO_ATTR_SPEED:
563 case SUMO_ATTR_LENGTH:
564 case SUMO_ATTR_SHAPE:
566 case SUMO_ATTR_TYPE:
567 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
568 break;
570 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
571 changeTLIndex(key, parse<int>(value), c.tlLinkIndex2, undoList);
572 }
573 break;
575 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
576 changeTLIndex(key, c.tlLinkIndex, parse<int>(value), undoList);
577 }
578 break;
580 undoList->begin(this, "change attribute controlled for connection");
581 {
582 const bool wasUncontrolled = c.uncontrolled;
583 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
584 if (wasUncontrolled && !c.uncontrolled) {
585 GNEEdge* srcEdge = getParentEdges().front();
586 NBConnection newNBCon(srcEdge->getNBEdge(), c.fromLane, c.toEdge, c.toLane);
587 srcEdge->getToJunction()->invalidateTLS(undoList, NBConnection::InvalidConnection, newNBCon);
588 }
589 }
590 undoList->end();
591 break;
593 undoList->begin(this, "change attribute indirect for connection");
594 if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
595 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
596 int linkIndex2 = -1;
597 if (parse<bool>(value)) {
598 // find straight connection with the same toEdge
599 std::set<NBTrafficLightDefinition*> defs = getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS();
600 NBEdge* from = getParentEdges().front()->getNBEdge();
601 for (NBTrafficLightDefinition* tlDef : defs) {
602 for (const NBConnection& c2 : tlDef->getControlledLinks()) {
603 if (c2.getTo() == c.toEdge && c2.getFrom() != from) {
604 if (from->getToNode()->getDirection(c2.getFrom(), c2.getTo()) == LinkDirection::STRAIGHT) {
605 linkIndex2 = c2.getTLIndex();
606 break;
607 }
608 }
609 }
610 }
611 }
612 changeTLIndex(key, c.tlLinkIndex, linkIndex2, undoList);
613 }
614 undoList->end();
615 break;
616 case SUMO_ATTR_DIR:
617 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
618 case SUMO_ATTR_STATE:
619 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
620 default:
621 setCommonAttribute(key, value, undoList);
622 break;
623 }
624}
625
626
627void
628GNEConnection::changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList* undoList) {
629 // trigger GNEChange_TLS
630 undoList->begin(this, "change tls linkIndex for connection");
631 // make a copy
632 std::set<NBTrafficLightDefinition*> defs = getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS();
633 for (const auto& tlDef : defs) {
634 NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
635 NBTrafficLightLogic* tllogic = sumoDef ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
636 if (tllogic != nullptr) {
637 NBLoadedSUMOTLDef* newDef = new NBLoadedSUMOTLDef(*tlDef, *tllogic);
638 newDef->addConnection(getParentEdges().front()->getNBEdge(), getParentEdges().back()->getNBEdge(),
639 getLaneFrom()->getIndex(), getLaneTo()->getIndex(), tlIndex, tlIndex2, false);
640 // make a copy
641 std::vector<NBNode*> nodes = tlDef->getNodes();
642 for (const auto& node : nodes) {
643 GNEJunction* junction = getNet()->getAttributeCarriers()->retrieveJunction(node->getID());
644 undoList->add(new GNEChange_TLS(junction, tlDef, false), true);
645 undoList->add(new GNEChange_TLS(junction, newDef, true), true);
646 }
647 } else {
648 WRITE_ERRORF(TL("Could not set attribute '%' (tls is broken)"), toString(key));
649 }
650 }
651 undoList->end();
652}
653
654
655bool
657 return getParentEdges().front()->getNBEdge()->getConnectionsFromLane(getFromLaneIndex(), getParentEdges().back()->getNBEdge(), getToLaneIndex()).size() > 0;
658}
659
660
661bool
663 // declare a flag to check if shape has to be draw (by deafult false)
664 bool drawConnection = false;
665 // only draw connections if shape isn't deprecated
671 } else {
672 drawConnection = false;
673 }
674 } else {
675 drawConnection = false;
676 }
677 // check if we're editing this connection
679 if (editedNetworkElement && (editedNetworkElement->getTagProperty()->getTag() == SUMO_TAG_CONNECTION)) {
680 if (editedNetworkElement->getAttribute(GNE_ATTR_PARENT) == getAttribute(GNE_ATTR_PARENT)) {
681 drawConnection = true;
682 }
683 }
684 return drawConnection;
685}
686
687
690 // check conditions
691 if (myShapeEdited) {
692 // return shape edit color
694 } else if (drawUsingSelectColor()) {
695 // override with special colors (unless the color scheme is based on selection)
697 } else if (mySpecialColor != nullptr) {
698 // return special color
699 return *mySpecialColor;
700 } else {
701 // Set color depending of the link state
703 }
704}
705
706
707void
709 const GUIGeometry& superposedGeometry, const double exaggeration) const {
710 // get color
711 RGBColor connectionColor = getConnectionColor(s);
712 // Push layer matrix
714 // translate to front
717 } else {
719 }
720 // Set color
721 GLHelper::setColor(connectionColor);
722 // continue depending of detail level
724 // draw geometry
725 GLHelper::drawBoxLines(superposedGeometry.getShape(), superposedGeometry.getShapeRotations(), superposedGeometry.getShapeLengths(),
726 s.connectionSettings.connectionWidth * exaggeration);
727 // draw arrows over connection
728 drawConnectionArrows(s, superposedGeometry, connectionColor);
729 // check if internal junction marker has to be drawn
733 }
734 // draw edge values
735 drawEdgeValues(s, superposedGeometry.getShape());
736 // draw shape points only in Network supemode
738 // draw geometry points
739 GUIGeometry::drawGeometryPoints(d, superposedGeometry.getShape(), connectionColor.changedBrightness(-32),
742 }
743 } else {
744 GLHelper::drawLine(superposedGeometry.getShape());
745 }
746 // Pop layer matrix
748}
749
750
751void
753 const RGBColor& color) const {
754 if (s.showLaneDirection) {
755 // Push matrix
757 // move front
758 glTranslated(0, 0, 0.1);
759 // change color
761 // draw triangles
762 for (int i = 1; i < (int)superposedGeometry.getShape().size(); i++) {
763 const auto posA = superposedGeometry.getShape()[i - 1];
764 const auto posB = superposedGeometry.getShape()[i];
765 GLHelper::drawTriangleAtEnd(posA, posB, (double) 1, (double) .2);
766 }
767 // Pop matrix
769 }
770}
771
772
773void
775 // check if edge value has to be shown
776 if (s.edgeValue.show(this)) {
778 const std::string value = nbCon.getParameter(s.edgeParam, "");
779 if (value != "") {
780 int shapeIndex = (int)shape.size() / 2;
781 const Position p = (myConnectionGeometry.getShape().size() == 2) ? (shape.front() * 0.67 + shape.back() * 0.33) : shape[shapeIndex];
782 GLHelper::drawTextSettings(s.edgeValue, value, p, s.scale, 0);
783 }
784 }
785}
786
787
788void
790 const PositionVector& shape, const double exaggeration) const {
791 // first check if junction parent was inserted with full boundary
792 if (!gViewObjectsHandler.checkBoundaryParentObject(this, getType(), getParentLanes().front()->getParentEdge()->getToJunction())) {
793 // calculate geometry points contour if we're editing shape
794 if (myShapeEdited) {
796 exaggeration, true);
797 } else {
798 // in move mode, add to selected object if this is the edited element
799 const auto& editModes = myNet->getViewNet()->getEditModes();
800 const bool addToSelectedObjects = (editModes.isCurrentSupermodeNetwork() && editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) ?
802 // calculate connection shape contour
804 true, true, 0, nullptr, getParentLanes().front()->getParentEdge()->getToJunction(), addToSelectedObjects);
805 }
806 }
807}
808
809
810bool
811GNEConnection::isValid(SumoXMLAttr key, const std::string& value) {
812 // Currently ignored before implementation to avoid warnings
813 switch (key) {
814 case SUMO_ATTR_FROM:
815 case SUMO_ATTR_TO:
818 return false;
819 case SUMO_ATTR_PASS:
820 return canParse<bool>(value);
822 return canParse<bool>(value);
823 case SUMO_ATTR_TYPE:
824 return true;
826 return canParse<bool>(value);
828 return canParse<double>(value) && (parse<double>(value) >= -1);
830 return canParse<bool>(value);
832 return canParse<double>(value) && (parse<double>(value) >= -1);
837 (getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS().size() > 0) &&
838 canParse<int>(value) &&
839 (parse<int>(value) >= 0 || parse<int>(value) == -1)) {
840 // obtain Traffic light definition
841 NBTrafficLightDefinition* def = *getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS().begin();
842 return def->getMaxValidIndex() >= parse<int>(value);
843 } else {
844 return false;
845 }
846 case SUMO_ATTR_ALLOW:
850 return canParseVehicleClasses(value);
851 case SUMO_ATTR_SPEED:
852 if (value.empty() || value == "default") {
853 return true;
854 } else {
855 return canParse<double>(value) && ((parse<double>(value) >= 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_SPEED));
856 }
857 case SUMO_ATTR_LENGTH:
858 return canParse<double>(value) && (parse<double>(value) >= -1);
859 case SUMO_ATTR_SHAPE:
861 // empty custom shapes are allowed
862 return canParse<PositionVector>(value);
863 case SUMO_ATTR_STATE:
864 return false;
865 case SUMO_ATTR_DIR:
866 return false;
867 default:
868 return isCommonValid(key, value);
869 }
870}
871
872
873bool
875 switch (key) {
876 case SUMO_ATTR_FROM:
877 case SUMO_ATTR_TO:
880 case SUMO_ATTR_DIR:
881 case SUMO_ATTR_STATE:
882 // this attributes cannot be edited
883 return false;
886 // get Traffic Light definitions
887 if (getParentEdges().front()->getNBEdge()->getToNode()->isTLControlled()) {
888 NBTrafficLightDefinition* tlDef = *getParentEdges().front()->getNBEdge()->getToNode()->getControllingTLS().begin();
889 NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
890 NBTrafficLightLogic* tllogic = sumoDef != nullptr ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
891 if (tllogic != nullptr) {
892 return true;
893 } else {
894 return false;
895 }
896 }
897 return false;
898 default:
899 return true;
900 }
901}
902
903
904bool
906 switch (key) {
907 case SUMO_ATTR_SPEED:
909 default:
910 return false;
911 }
912}
913
914
919
920// ===========================================================================
921// private
922// ===========================================================================
923
924void
925GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value) {
926 if (!existNBEdgeConnection()) {
927 WRITE_WARNINGF("Cannot restore attribute '%=%' for computed connection from lane '%'", toString(key), value, getParentLanes().front()->getID());
928 return;
929 }
931 switch (key) {
932 case SUMO_ATTR_PASS:
933 nbCon.mayDefinitelyPass = parse<bool>(value);
934 break;
936 nbCon.indirectLeft = parse<bool>(value);
937 break;
939 if (value == toString(KEEPCLEAR_UNSPECIFIED)) {
941 } else {
942 nbCon.keepClear = parse<bool>(value) ? KEEPCLEAR_TRUE : KEEPCLEAR_FALSE;
943 }
944 break;
946 nbCon.uncontrolled = parse<bool>(value);
947 break;
949 nbCon.contPos = parse<double>(value);
950 break;
952 nbCon.visibility = parse<double>(value);
953 break;
954 case SUMO_ATTR_SPEED:
955 if (value.empty() || (value == "default")) {
957 } else {
958 nbCon.speed = parse<double>(value);
959 }
960 break;
961 case SUMO_ATTR_LENGTH:
962 nbCon.customLength = parse<double>(value);
963 break;
964 case SUMO_ATTR_ALLOW:
965 nbCon.permissions = parseVehicleClasses(value);
966 break;
969 break;
971 nbCon.changeLeft = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
972 break;
974 nbCon.changeRight = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
975 break;
976 case SUMO_ATTR_STATE:
977 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
978 case SUMO_ATTR_DIR:
979 throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
980 case SUMO_ATTR_SHAPE:
982 nbCon.customShape = parse<PositionVector>(value);
983 break;
984 case SUMO_ATTR_TYPE:
985 nbCon.edgeType = value;
986 break;
987 default:
988 setCommonAttribute(&nbCon, key, value);
989 break;
990 }
991 // Update Geometry after setting a new attribute (but avoided for certain attributes)
992 if ((key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
995 }
996 // invalidate demand path calculator
998}
999
1000
1001void
1003 // set custom shape
1005 // mark junction as deprecated
1006 myShapeDeprecated = true;
1007 // update geometry
1009}
1010
1011
1012void
1014 // commit new shape
1015 undoList->begin(this, "moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
1017 undoList->end();
1018}
1019
1020/****************************************************************************/
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:288
#define WRITE_ERRORF(...)
Definition MsgHandler.h:297
#define TL(string)
Definition MsgHandler.h:305
@ 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
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
std::string getCommonAttribute(const Parameterised *parameterised, SumoXMLAttr key) const
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * myNet
pointer to net
bool isCommonValid(SumoXMLAttr key, const std::string &value) const
GNENet * getNet() const
get pointer to net
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
NBConnection getNBConnection() const
get NBConnection
Position getPositionInView() const
Returns position of hierarchical element in view.
GNELane * getLaneFrom() const
@briefthe get lane of the incoming lane
void smootShape()
smoothShape
const PositionVector & getConnectionShape() const
get connection shape
bool checkDrawSelectContour() const
check if draw select contour (blue)
GNELane * getLaneTo() const
@briefthe get lane of the outgoing lane
LinkState getLinkState() const
get LinkState
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
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 commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
GUIGeometry myConnectionGeometry
connection geometry
bool checkDrawOverContour() const
check if draw over contour (orange)
void drawEdgeValues(const GUIVisualizationSettings &s, const PositionVector &shape) const
draw edge value
bool checkDrawFromContour() const
check if draw from contour (green)
void drawConnection(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGeometry &superposedGeometry, const double exaggeration) const
draw connection
bool existNBEdgeConnection() const
check if the edgeConnection vinculated with this connection exists
std::string getAttribute(SumoXMLAttr key) const
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
bool isAttributeComputed(SumoXMLAttr key) const
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
PositionVector getAttributePositionVector(SumoXMLAttr key) const
GNEConnection(GNELane *from, GNELane *to)
bool checkDrawDeleteContourSmall() const
check if draw delete contour small (pink/white)
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)
GNEMoveOperation * getMoveOperation()
get move operation for the given shapeOffset (can be nullptr)
void updateGeometry()
update pre-computed geometry information
GUIGeometry myInternalJunctionMarkerGeometry
junction maker geometry
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
bool isValid(SumoXMLAttr key, const std::string &value)
const RGBColor * mySpecialColor
optional special color
~GNEConnection()
Destructor.
int getToLaneIndex() const
@briefthe get lane index of the outgoing lane
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool myShapeDeprecated
flag to indicate that connection's shape has to be updated
void calculateConnectionContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const PositionVector &shape, const double exaggeration) const
calculate connection contour
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
void updateLinkState()
recompute cached myLinkState
const Parameterised::Map & getACParametersMap() const
get parameters map
bool checkDrawConnection() const
check if draw connection
RGBColor getConnectionColor(const GUIVisualizationSettings &s) const
get connection color
bool checkDrawMoveContour() const
check if draw move contour (red)
bool isAttributeEnabled(SumoXMLAttr key) const
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
LinkState myLinkState
Linkstate.
void updateGLObject()
update GLObject (geometry, ID, etc.)
bool checkDrawToContour() const
check if draw from contour (magenta)
void changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList *undoList)
manage change of tlLinkindices
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset, const GNESegment *segment, const 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
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:829
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition GNEEdge.h:79
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)
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
int getIndex() const
returns the index of the lane
Definition GNELane.cpp:650
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:202
GNEMoveOperation * calculateMoveShapeOperation(const GUIGlObject *obj, const PositionVector originalShape, const bool maintainShapeClosed)
calculate move shape operation
move operation
move result
PositionVector shapeToUpdate
shape to update (edited in moveElement)
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
void deleteNetworkElement(GNENetworkElement *networkElement, GNEUndoList *undoList)
delete network element
Definition GNENet.cpp:373
GNEPathManager * getDemandPathManager()
get demand path manager
Definition GNENet.cpp:177
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:147
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2195
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEContour myNetworkElementContour
network element contour
bool myShapeEdited
flag to check if element shape is being edited
GUIGLObjectPopupMenu * getShapeEditedPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, const PositionVector &shape)
get shape edited popup menu
void setNetworkElementID(const std::string &newID)
set network element id
bool isShapeEdited() const
check if shape is being edited
void invalidatePathCalculator()
invalidate pathCalculator
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
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)
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
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:546
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition NBEdge.h:730
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:2472
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.
std::map< std::string, std::string > Map
parameters map
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.
void append(const PositionVector &v, double sameThreshold=2.0)
double length() const
Returns the length.
PositionVector getOrthogonal(const Position &p, double extend, bool before, double length=1.0, double deg=90) const
return orthogonal through p (extending this vector if necessary)
int indexOfClosest(const Position &p, bool twoD=false) const
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
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