Eclipse SUMO - Simulation of Urban MObility
GNEConnection.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A class for visualizing connections between lanes
19 /****************************************************************************/
20 #include <config.h>
21 
23 #include <netedit/GNENet.h>
24 #include <netedit/GNEUndoList.h>
25 #include <netedit/GNEViewNet.h>
28 #include <utils/gui/div/GLHelper.h>
34 
35 #include "GNEConnection.h"
36 #include "GNEInternalLane.h"
37 
38 
39 // ===========================================================================
40 // static member definitions
41 // ===========================================================================
42 static const int NUM_POINTS = 5;
43 
44 // ===========================================================================
45 // method definitions
46 // ===========================================================================
47 
49  GNENetworkElement(from->getNet(), "from" + from->getID() + "to" + to->getID(),
51 {}, {}, {}, {}, {}, {}, {}, {}),
52 myFromLane(from),
53 myToLane(to),
54 myLinkState(LINKSTATE_TL_OFF_NOSIGNAL),
55 mySpecialColor(nullptr),
56 myShapeDeprecated(true) {
57  // update centering boundary without updating grid
58  updateCenteringBoundary(false);
59 }
60 
61 
63 }
64 
65 
66 const PositionVector&
68  if (myConnectionGeometry.getShape().size() > 0) {
70  } else {
72  }
73 }
74 
75 
76 void
78  // Get shape of from and to lanes
80  if (myShapeDeprecated) {
81  // obtain lane shape from
82  PositionVector laneShapeFrom;
83  if ((int)getEdgeFrom()->getNBEdge()->getLanes().size() > nbCon.fromLane) {
84  laneShapeFrom = getEdgeFrom()->getNBEdge()->getLanes().at(nbCon.fromLane).shape;
85  } else {
86  return;
87  }
88  // obtain lane shape to
89  PositionVector laneShapeTo;
90  if ((int)nbCon.toEdge->getLanes().size() > nbCon.toLane) {
91  laneShapeTo = nbCon.toEdge->getLanes().at(nbCon.toLane).shape;
92  } else {
93  return;
94  }
95  // Calculate shape of connection depending of the size of Junction shape
96  // value obtanied from GNEJunction::drawgl
97  if (nbCon.customShape.size() != 0) {
99  } else if (getEdgeFrom()->getNBEdge()->getToNode()->getShape().area() > 4) {
100  if (nbCon.shape.size() > 1) {
101  PositionVector connectionShape;
102  if (nbCon.shape.front() == nbCon.shape.back()) {
103  laneShapeFrom.move2side(0.7);
104  laneShapeTo.move2side(0.7);
105  connectionShape.push_back(laneShapeFrom.back());
106  connectionShape.push_back(laneShapeTo.front());
107  } else {
108  connectionShape = nbCon.shape;
109  }
110  // only append via shape if it exists
111  if (nbCon.haveVia) {
112  connectionShape.append(nbCon.viaShape);
113  }
114  myConnectionGeometry.updateGeometry(connectionShape);
115  } else {
116  // Calculate shape so something can be drawn immidiately
117  myConnectionGeometry.updateGeometry(getEdgeFrom()->getNBEdge()->getToNode()->computeSmoothShape(
118  laneShapeFrom, laneShapeTo, NUM_POINTS,
119  getEdgeFrom()->getNBEdge()->getTurnDestination() == nbCon.toEdge,
120  (double) 5. * (double) getEdgeFrom()->getNBEdge()->getNumLanes(),
121  (double) 5. * (double) nbCon.toEdge->getNumLanes()));
122  }
123  } else {
124  myConnectionGeometry.updateGeometry({laneShapeFrom.positionAtOffset(MAX2(0.0, laneShapeFrom.length() - 1)),
125  laneShapeTo.positionAtOffset(MIN2(1.0, laneShapeFrom.length()))});
126  }
127  // check if internal junction marker must be calculated
128  if (nbCon.haveVia && (nbCon.shape.size() != 0)) {
129  // create marker for interal junction waiting position (contPos)
130  const double orthoLength = 0.5;
131  Position pos = nbCon.shape.back();
132  myInternalJunctionMarker = nbCon.shape.getOrthogonal(pos, 10, true, 0.1);
133  if (myInternalJunctionMarker.length() < orthoLength) {
135  }
136  } else {
137  myInternalJunctionMarker.clear();
138  }
139  // mark connection as non-deprecated
140  myShapeDeprecated = false;
141  }
142 }
143 
144 
145 Position
147  // currently unused
148  return Position(0, 0);
149 }
150 
151 
154  // edit depending if shape is being edited
155  if (isShapeEdited()) {
156  // get connection
157  const auto& connection = getNBEdgeConnection();
158  // calculate move shape operation
159  return calculateMoveShapeOperation(connection.customShape.size() > 0 ? connection.customShape : myConnectionGeometry.getShape(),
162  } else {
163  return nullptr;
164  }
165 }
166 
167 
168 void
169 GNEConnection::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
170  // edit depending if shape is being edited
171  if (isShapeEdited()) {
172  // get connection
173  const auto& connection = getNBEdgeConnection();
174  // get original shape
175  PositionVector shape = connection.customShape.size() > 0 ? connection.customShape : connection.shape;
176  // check shape size
177  if (shape.size() > 2) {
178  // obtain index
179  int index = shape.indexOfClosest(clickedPosition);
180  // get snap radius
182  // check if we have to create a new index
183  if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
184  // remove geometry point
185  shape.erase(shape.begin() + index);
186  // commit new shape
187  undoList->begin(GUIIcon::CONNECTION, "remove geometry point of " + getTagStr());
189  undoList->end();
190  }
191  }
192  }
193 }
194 
195 
196 GNEEdge*
198  return myFromLane->getParentEdge();
199 }
200 
201 
202 GNEEdge*
204  return myToLane->getParentEdge();
205 }
206 
207 
208 GNELane*
210  return myFromLane;
211 }
212 
213 
214 GNELane*
216  return myToLane;
217 }
218 
219 
220 int
222  return myFromLane->getIndex();
223 }
224 
225 
226 int
228  return myToLane->getIndex();
229 }
230 
231 
235 }
236 
237 
241  return NBConnection(getEdgeFrom()->getNBEdge(), getFromLaneIndex(),
242  getEdgeTo()->getNBEdge(), getToLaneIndex(),
243  (int)c.tlLinkIndex, (int)c.tlLinkIndex2);
244 }
245 
246 
247 void
249  setMicrosimID(myFromLane->getID() + " -> " + myToLane->getID());
250 }
251 
252 
253 LinkState
255  return myLinkState;
256 }
257 
258 
259 void
261  myShapeDeprecated = true;
262 }
263 
264 
265 void
269  nbCon.toEdge,
270  nbCon.fromLane,
271  nbCon.toLane,
272  nbCon.mayDefinitelyPass,
273  nbCon.tlID);
274 }
275 
276 
279  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
280  buildPopupHeader(ret, app);
283  // build selection and show parameters menu
286  // build position copy entry
287  buildPositionCopyEntry(ret, false);
288  // check if we're in supermode network
290  // create menu commands
291  FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, "Set custom connection shape", nullptr, &parent, MID_GNE_CONNECTION_EDIT_SHAPE);
292  // check if menu commands has to be disabled
294  // check if we're in the correct edit mode
295  if ((editMode == NetworkEditMode::NETWORK_CONNECT) || (editMode == NetworkEditMode::NETWORK_TLS) || (editMode == NetworkEditMode::NETWORK_CREATE_EDGE)) {
296  mcCustomShape->disable();
297  }
298  }
299  return ret;
300 }
301 
302 
303 double
305  return s.addSize.getExaggeration(s, this);
306 }
307 
308 
309 void
310 GNEConnection::updateCenteringBoundary(const bool /*updateGrid*/) {
311  // calculate boundary
312  if (myConnectionGeometry.getShape().size() == 0) {
313  // we need to use the center of junction parent as boundary if shape is empty
314  const Position junctionParentPosition = myFromLane->getParentEdge()->getToJunction()->getPositionInView();
315  myBoundary = Boundary(junctionParentPosition.x() - 0.1, junctionParentPosition.y() - 0.1,
316  junctionParentPosition.x() + 0.1, junctionParentPosition.x() + 0.1);
317  } else {
319  }
320  // grow
321  myBoundary.grow(10);
322 }
323 
324 
325 void
327  // check if draw start und end
328  const bool drawExtremeSymbols = myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
330  // get edited network element
332  // declare a flag to check if shape has to be draw
333  bool drawConnection = true;
334  // declare flag to check if push glID
335  bool pushGLID = true;
339  drawConnection = !myShapeDeprecated;
342  drawConnection = !myShapeDeprecated;
343  } else {
344  drawConnection = false;
345  }
346  // check if we're editing this connection
347  if (editedNetworkElement && (editedNetworkElement->getTagProperty().getTag() == SUMO_TAG_CONNECTION)) {
348  if (editedNetworkElement->getAttribute(GNE_ATTR_PARENT) == getAttribute(GNE_ATTR_PARENT)) {
349  drawConnection = true;
350  }
351  if (editedNetworkElement != this) {
352  pushGLID = false;
353  }
354  }
355  // Check if connection must be drawed
356  if (drawConnection) {
357  // draw connection checking whether it is not too small if isn't being drawn for selecting
358  const double selectionScale = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
359  // get color
360  RGBColor connectionColor;
361  // first check if we're editing shape
362  if (myShapeEdited) {
363  connectionColor = s.colorSettings.editShapeColor;
364  } else if (drawUsingSelectColor()) {
365  // override with special colors (unless the color scheme is based on selection)
366  connectionColor = s.colorSettings.selectedConnectionColor;
367  } else if (mySpecialColor != nullptr) {
368  connectionColor = *mySpecialColor;
369  } else {
370  // Set color depending of the link state
372  }
373  // check if boundary has to be drawn
374  if (s.drawBoundaries) {
376  }
377  // Push name
378  if (pushGLID) {
380  }
381  // Push layer matrix
383  // translate to front
384  myNet->getViewNet()->drawTranslateFrontAttributeCarrier(this, GLO_CONNECTION, (editedNetworkElement == this) ? 1 : 0);
385  // Set color
386  GLHelper::setColor(connectionColor);
387  if ((s.scale * selectionScale < 5.) && !s.drawForRectangleSelection) {
388  // If it's small, draw a simple line
390  } else {
391  // draw a list of lines
392  const bool spreadSuperposed = s.scale >= 1 && s.spreadSuperposed && myFromLane->drawAsRailway(s) && getEdgeFrom()->getNBEdge()->isBidiRail();
393  PositionVector shapeSuperposed = myConnectionGeometry.getShape();
394  if (spreadSuperposed) {
395  shapeSuperposed.move2side(0.5);
396  }
398  glTranslated(0, 0, 0.1);
399  GLHelper::setColor(GLHelper::getColor().changedBrightness(51));
400  // check if internal junction marker has to be drawn
401  if (myInternalJunctionMarker.size() > 0) {
403  }
404  // draw shape points only in Network supemode
406  // color
407  const RGBColor darkerColor = connectionColor.changedBrightness(-32);
408  // draw geometry points
411  myNet->getViewNet()->getNetworkViewOptions().editingElevation(), drawExtremeSymbols);
412  // draw moving hint
416  }
417  }
418  // Pop layer matrix
420  // check if edge value has to be shown
421  if (s.edgeValue.show(this)) {
423  std::string value = nbCon.getParameter(s.edgeParam, "");
424  if (value != "") {
425  int shapeIndex = (int)myConnectionGeometry.getShape().size() / 2;
426  Position p = (myConnectionGeometry.getShape().size() == 2
427  ? (myConnectionGeometry.getShape().front() * 0.67 + myConnectionGeometry.getShape().back() * 0.33)
428  : myConnectionGeometry.getShape()[shapeIndex]);
429  GLHelper::drawTextSettings(s.edgeValue, value, p, s.scale, 0);
430  }
431  }
432  // Pop name
433  if (pushGLID) {
435  }
436  // draw lock icon
438  // check if dotted contour has to be drawn (not useful at high zoom)
440  // use drawDottedContourGeometry to draw it
442  }
443  // check if front contour has to be drawn (not useful at high zoom)
444  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this)) {
445  // use drawDottedContourGeometry to draw it
447  }
448  }
449  }
450 }
451 
452 
453 void
455  mySpecialColor = color;
456 }
457 
458 
459 std::string
461  if (key == SUMO_ATTR_ID) {
462  // used by GNEReferenceCounter
463  // @note: may be called for connections without a valid nbCon reference
464  return getID();
465  }
467  switch (key) {
468  case SUMO_ATTR_FROM:
469  return getEdgeFrom()->getID();
470  case SUMO_ATTR_TO:
471  return nbCon.toEdge->getID();
472  case SUMO_ATTR_FROM_LANE:
473  return toString(nbCon.fromLane);
474  case SUMO_ATTR_TO_LANE:
475  return toString(nbCon.toLane);
476  case SUMO_ATTR_PASS:
477  return toString(nbCon.mayDefinitelyPass);
478  case SUMO_ATTR_INDIRECT:
479  return toString(nbCon.indirectLeft);
480  case SUMO_ATTR_TYPE:
481  return toString(nbCon.edgeType);
483  return toString(nbCon.keepClear);
484  case SUMO_ATTR_CONTPOS:
485  return toString(nbCon.contPos);
487  return toString(nbCon.uncontrolled);
489  return toString(nbCon.visibility);
491  return toString(nbCon.tlLinkIndex);
493  return toString(nbCon.tlLinkIndex2);
494  case SUMO_ATTR_ALLOW:
495  if (nbCon.permissions == SVC_UNSPECIFIED) {
496  return getVehicleClassNames(nbCon.toEdge->getLanes()[nbCon.toLane].permissions);
497  } else {
498  return getVehicleClassNames(nbCon.permissions);
499  }
500  case SUMO_ATTR_DISALLOW:
501  if (nbCon.permissions == SVC_UNSPECIFIED) {
502  return getVehicleClassNames(invertPermissions(nbCon.toEdge->getLanes()[nbCon.toLane].permissions));
503  } else {
505  }
507  if (nbCon.changeLeft == SVC_UNSPECIFIED) {
508  return "all";
509  } else {
510  return getVehicleClassNames(nbCon.changeLeft);
511  }
513  if (nbCon.changeRight == SVC_UNSPECIFIED) {
514  return "all";
515  } else {
516  return getVehicleClassNames(nbCon.changeRight);
517  }
518  case SUMO_ATTR_SPEED:
519  if (nbCon.speed == NBEdge::UNSPECIFIED_SPEED) {
520  return "default";
521  } else {
522  return toString(nbCon.speed);
523  }
524  case SUMO_ATTR_LENGTH:
525  return toString(nbCon.customLength);
526  case SUMO_ATTR_DIR:
527  return toString(getEdgeFrom()->getNBEdge()->getToNode()->getDirection(
528  getEdgeFrom()->getNBEdge(), nbCon.toEdge, OptionsCont::getOptions().getBool("lefthand")));
529  case SUMO_ATTR_STATE:
530  return toString(getEdgeFrom()->getNBEdge()->getToNode()->getLinkState(
531  getEdgeFrom()->getNBEdge(), nbCon.toEdge, nbCon.fromLane, nbCon.toLane, nbCon.mayDefinitelyPass, nbCon.tlID));
533  return toString(nbCon.customShape);
534  case GNE_ATTR_SELECTED:
536  case GNE_ATTR_PARAMETERS:
537  return nbCon.getParametersStr();
538  case GNE_ATTR_PARENT:
539  return getEdgeFrom()->getToJunction()->getID();
540  default:
541  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
542  }
543 }
544 
545 
546 void
547 GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
549  switch (key) {
550  case SUMO_ATTR_FROM:
551  case SUMO_ATTR_TO:
552  case SUMO_ATTR_FROM_LANE:
553  case SUMO_ATTR_TO_LANE:
554  case SUMO_ATTR_PASS:
556  case SUMO_ATTR_CONTPOS:
559  case SUMO_ATTR_ALLOW:
560  case SUMO_ATTR_DISALLOW:
563  case SUMO_ATTR_SPEED:
564  case SUMO_ATTR_LENGTH:
566  case SUMO_ATTR_TYPE:
567  case GNE_ATTR_SELECTED:
568  case GNE_ATTR_PARAMETERS:
569  // no special handling
570  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
571  break;
573  if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
574  changeTLIndex(key, parse<int>(value), c.tlLinkIndex2, undoList);
575  }
576  break;
578  if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
579  changeTLIndex(key, c.tlLinkIndex, parse<int>(value), undoList);
580  }
581  break;
582  case SUMO_ATTR_INDIRECT:
583  undoList->begin(GUIIcon::CONNECTION, "change attribute indirect for connection");
584  if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
585  undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
586  int linkIndex2 = -1;
587  if (parse<bool>(value)) {
588  // find straight connection with the same toEdge
589  std::set<NBTrafficLightDefinition*> defs = getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS();
590  NBEdge* from = getEdgeFrom()->getNBEdge();
591  for (NBTrafficLightDefinition* tlDef : defs) {
592  for (const NBConnection& c2 : tlDef->getControlledLinks()) {
593  if (c2.getTo() == c.toEdge && c2.getFrom() != from) {
594  LinkDirection dir = from->getToNode()->getDirection(c2.getFrom(), c2.getTo());
595  if (dir == LinkDirection::STRAIGHT) {
596  linkIndex2 = c2.getTLIndex();
597  break;
598  }
599  }
600  }
601  }
602  }
603  changeTLIndex(key, c.tlLinkIndex, linkIndex2, undoList);
604  }
605  undoList->end();
606  break;
607  case SUMO_ATTR_DIR:
608  throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
609  case SUMO_ATTR_STATE:
610  throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
611  default:
612  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
613  }
614 }
615 
616 
617 void
618 GNEConnection::changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList* undoList) {
619  // trigger GNEChange_TLS
620  undoList->begin(GUIIcon::CONNECTION, "change tls linkIndex for connection");
621  // make a copy
622  std::set<NBTrafficLightDefinition*> defs = getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS();
623  for (NBTrafficLightDefinition* tlDef : defs) {
624  NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
625  NBTrafficLightLogic* tllogic = sumoDef ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
626  if (tllogic != nullptr) {
627  NBLoadedSUMOTLDef* newDef = new NBLoadedSUMOTLDef(*tlDef, *tllogic);
628  newDef->addConnection(getEdgeFrom()->getNBEdge(), getEdgeTo()->getNBEdge(),
629  getLaneFrom()->getIndex(), getLaneTo()->getIndex(), tlIndex, tlIndex2, false);
630  // make a copy
631  std::vector<NBNode*> nodes = tlDef->getNodes();
632  for (NBNode* node : nodes) {
633  GNEJunction* junction = getNet()->getAttributeCarriers()->retrieveJunction(node->getID());
634  undoList->add(new GNEChange_TLS(junction, tlDef, false), true);
635  undoList->add(new GNEChange_TLS(junction, newDef, true), true);
636  }
637  } else {
638  WRITE_ERROR("Could not set attribute '" + toString(key) + "' (tls is broken)");
639  }
640  }
641  undoList->end();
642 }
643 
644 bool
645 GNEConnection::isValid(SumoXMLAttr key, const std::string& value) {
646  // Currently ignored before implementation to avoid warnings
647  switch (key) {
648  case SUMO_ATTR_FROM:
649  case SUMO_ATTR_TO:
650  case SUMO_ATTR_FROM_LANE:
651  case SUMO_ATTR_TO_LANE:
652  return false;
653  case SUMO_ATTR_PASS:
654  return canParse<bool>(value);
655  case SUMO_ATTR_INDIRECT:
656  return canParse<bool>(value);
657  case SUMO_ATTR_TYPE:
658  return true;
660  return canParse<bool>(value);
661  case SUMO_ATTR_CONTPOS:
662  return canParse<double>(value) && (parse<double>(value) >= -1);
664  return canParse<bool>(value);
666  return canParse<double>(value) && (parse<double>(value) >= -1);
670  (getNBEdgeConnection().uncontrolled == false) &&
671  (getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS().size() > 0) &&
672  canParse<int>(value) &&
673  (parse<int>(value) >= 0 || parse<int>(value) == -1)) {
674  // obtan Traffic light definition
676  return def->getMaxValidIndex() >= parse<int>(value);
677  } else {
678  return false;
679  }
680  case SUMO_ATTR_ALLOW:
681  case SUMO_ATTR_DISALLOW:
684  return canParseVehicleClasses(value);
685  case SUMO_ATTR_SPEED:
686  if (value.empty() || value == "default") {
687  return true;
688  } else {
689  return canParse<double>(value) && ((parse<double>(value) >= 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_SPEED));
690  }
691  case SUMO_ATTR_LENGTH:
692  return canParse<double>(value) && (parse<double>(value) >= -1);
693  case SUMO_ATTR_CUSTOMSHAPE: {
694  // empty custom shapes are allowed
695  return canParse<PositionVector>(value);
696  }
697  case SUMO_ATTR_STATE:
698  return false;
699  case SUMO_ATTR_DIR:
700  return false;
701  case GNE_ATTR_SELECTED:
702  return canParse<bool>(value);
703  case GNE_ATTR_PARAMETERS:
704  return Parameterised::areParametersValid(value);
705  default:
706  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
707  }
708 }
709 
710 
711 bool
713  switch (key) {
714  case SUMO_ATTR_FROM:
715  case SUMO_ATTR_TO:
716  case SUMO_ATTR_FROM_LANE:
717  case SUMO_ATTR_TO_LANE:
718  case SUMO_ATTR_DIR:
719  case SUMO_ATTR_STATE:
720  // this attributes cannot be edited
721  return false;
724  // get Traffic Light definitions
725  if (getEdgeFrom()->getNBEdge()->getToNode()->isTLControlled()) {
727  NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
728  NBTrafficLightLogic* tllogic = sumoDef != nullptr ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
729  if (tllogic != nullptr) {
730  return true;
731  } else {
732  return false;
733  }
734  }
735  return false;
736  default:
737  return true;
738  }
739 }
740 
741 
742 bool
744  switch (key) {
745  case SUMO_ATTR_SPEED:
747  default:
748  return false;
749  }
750 }
751 
752 
753 const std::map<std::string, std::string>&
756 }
757 
758 // ===========================================================================
759 // private
760 // ===========================================================================
761 
762 void
763 GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value) {
765  switch (key) {
766  case SUMO_ATTR_PASS:
767  nbCon.mayDefinitelyPass = parse<bool>(value);
768  break;
769  case SUMO_ATTR_INDIRECT:
770  nbCon.indirectLeft = parse<bool>(value);
771  break;
773  nbCon.keepClear = parse<bool>(value) ? KEEPCLEAR_TRUE : KEEPCLEAR_FALSE;
774  break;
776  nbCon.uncontrolled = parse<bool>(value);
777  break;
778  case SUMO_ATTR_CONTPOS:
779  nbCon.contPos = parse<double>(value);
780  break;
782  nbCon.visibility = parse<double>(value);
783  break;
784  case SUMO_ATTR_SPEED:
785  if (value.empty() || (value == "default")) {
787  } else {
788  nbCon.speed = parse<double>(value);
789  }
790  break;
791  case SUMO_ATTR_LENGTH:
792  nbCon.customLength = parse<double>(value);
793  break;
794  case SUMO_ATTR_ALLOW: {
795  const SVCPermissions successorAllows = nbCon.toEdge->getLanes()[nbCon.toLane].permissions;
796  SVCPermissions customPermissions = parseVehicleClasses(value);
797  if (successorAllows != customPermissions) {
798  nbCon.permissions = customPermissions;
799  }
800  break;
801  }
802  case SUMO_ATTR_DISALLOW: {
803  const SVCPermissions successorDisallows = invertPermissions(nbCon.toEdge->getLanes()[nbCon.toLane].permissions);
804  SVCPermissions customPermissions = invertPermissions(parseVehicleClasses(value));
805  if (successorDisallows != customPermissions) {
806  nbCon.permissions = customPermissions;
807  }
808  break;
809  }
810  case SUMO_ATTR_CHANGE_LEFT: {
811  nbCon.changeLeft = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
812  break;
813  }
814  case SUMO_ATTR_CHANGE_RIGHT: {
815  nbCon.changeRight = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
816  break;
817  }
818  case SUMO_ATTR_STATE:
819  throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
820  case SUMO_ATTR_DIR:
821  throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
822  case SUMO_ATTR_CUSTOMSHAPE: {
823  nbCon.customShape = parse<PositionVector>(value);
824  // update centering boundary
826  break;
827  }
828  case SUMO_ATTR_TYPE: {
829  nbCon.edgeType = value;
830  break;
831  }
832  case GNE_ATTR_SELECTED:
833  if (parse<bool>(value)) {
835  } else {
837  }
838  break;
839  case GNE_ATTR_PARAMETERS:
840  nbCon.setParametersStr(value);
841  break;
842  default:
843  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
844  }
845  // Update Geometry after setting a new attribute (but avoided for certain attributes)
846  if ((key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
848  updateGeometry();
849  }
850  // invalidate path calculator
852 }
853 
854 
855 void
857  // set custom shape
859  // mark junction as deprecated
860  myShapeDeprecated = true;
861  // update geometry
862  updateGeometry();
863 }
864 
865 
866 void
868  // commit new shape
869  undoList->begin(GUIIcon::CONNECTION, "moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
871  undoList->end();
872 }
873 
874 /****************************************************************************/
static const int NUM_POINTS
NetworkEditMode
@brie enum for network edit modes
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_CREATE_EDGE
mode for creating new edges
@ NETWORK_TLS
mode for editing tls
@ NETWORK_CONNECT
mode for connecting lanes
@ MID_GNE_CONNECTION_EDIT_SHAPE
edit junction shape
Definition: GUIAppEnum.h:1094
@ GLO_CONNECTION
a connection
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:288
@ KEEPCLEAR_FALSE
Definition: NBCont.h:59
@ KEEPCLEAR_TRUE
Definition: NBCont.h:60
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.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SUMO_TAG_CONNECTION
connectio between two lanes
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
@ STRAIGHT
The link is a straight direction.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
@ LINKSTATE_TL_OFF_NOSIGNAL
The link is controlled by a tls which is off, not blinking, may pass.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_DISALLOW
@ SUMO_ATTR_ALLOW
@ SUMO_ATTR_TLLINKINDEX2
link: the index of the opposite direction link of a pedestrian crossing
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_INDIRECT
Whether this connection is an indirect (left) turn.
@ SUMO_ATTR_FROM_LANE
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_CUSTOMSHAPE
whether a given shape is user-defined
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_CHANGE_LEFT
@ SUMO_ATTR_PASS
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_CHANGE_RIGHT
@ SUMO_ATTR_TO_LANE
@ SUMO_ATTR_UNCONTROLLED
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_ID
@ SUMO_ATTR_VISIBILITY_DISTANCE
foe visibility distance of a link
@ SUMO_ATTR_CONTPOS
@ SUMO_ATTR_DIR
The abstract direction of a link.
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
@ SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
@ SUMO_ATTR_STATE
The state of a link.
T MIN2(T a, T b)
Definition: StdDefs.h:74
T MAX2(T a, T b)
Definition: StdDefs.h:80
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
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:299
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:801
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:369
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:507
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:132
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
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:277
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:513
static void popName()
pop Name
Definition: GLHelper.cpp:141
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
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:640
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
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
const PositionVector & getConnectionShape() const
GNELane * getLaneTo() const
@briefthe get lane of the outgoing lane
GNELane * myFromLane
incoming lane of this connection
LinkState getLinkState() const
get LinkState
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
int getFromLaneIndex() const
@briefthe get lane index of the incoming lane
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
GUIGeometry myConnectionGeometry
connection geometry
GNELane * myToLane
outgoing lane of this connection
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
GNEConnection(GNELane *from, GNELane *to)
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
void updateGeometry()
update pre-computed geometry information
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated 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.
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 updateLinkState()
recompute cached myLinkState
PositionVector myInternalJunctionMarker
waiting position for internal junction
bool isAttributeEnabled(SumoXMLAttr key) const
LinkState myLinkState
Linkstate.
void updateID()
update internal ID of Connection
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList *undoList)
manage change of tlLinkindices
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:435
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:82
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
Position getPositionInView() const
Returns position of hierarchical element in view.
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:797
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition: GNELane.cpp:1390
GNEEdge * getParentEdge() const
get arent edge
Definition: GNELane.cpp:113
GNEMoveOperation * calculateMoveShapeOperation(const PositionVector originalShape, const Position mousePosition, const double snapRadius, const bool onlyContour)
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
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:131
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
virtual std::string getAttribute(SumoXMLAttr key) const =0
bool myShapeEdited
flag to check if element shape is being edited
bool isShapeEdited() const
check if shape is being edited
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
const std::string & getID() const
get ID
Boundary myBoundary
object boundary
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...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:513
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape modul
Definition: GNEViewNet.cpp:549
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:525
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:432
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem, const double lineWidth=-1)
draw dotted contour for the given shape (used by additionals)
The popup menu of a globject.
static void drawGeometryPoints(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &geometryPointColor, const RGBColor &textColor, const double radius, const double exaggeration, const bool editingElevation, const bool drawExtremeSymbols)
draw geometry points
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:58
static void drawMovingHint(const GUIVisualizationSettings &s, const Position &mousePos, const PositionVector &shape, const RGBColor &hintColor, const double radius, const double exaggeration)
draw moving hint
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
bool drawBoundaries
enable or disable draw boundaries
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationDetailSettings detailSettings
detail settings
GUIVisualizationSizeSettings addSize
GUIVisualizationTextSettings edgeValue
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
double scale
information about a lane's width (temporary, used for a single view)
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
double selectorFrameScale
the current selection scaling in NETEDIT (set in SelectorFrame)
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
std::string edgeParam
key for coloring by edge parameter
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
The representation of a single edge during network building.
Definition: NBEdge.h:91
Connection & getConnectionRef(int fromLane, const NBEdge *to, int toLane)
Returns reference to the specified connection This method goes through "myConnections" and returns th...
Definition: NBEdge.cpp:1234
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition: NBEdge.cpp:742
const std::string & getID() const
Definition: NBEdge.h:1465
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:701
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:541
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:515
static const double UNSPECIFIED_SPEED
unspecified lane speed
Definition: NBEdge.h:355
A loaded (complete) traffic light 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.
NBTrafficLightLogic * getLogic()
Returns the internal logic.
Represents a single node (junction) during network building.
Definition: NBNode.h:66
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:2286
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:2221
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
Definition: NBNode.h:324
The base class for traffic light logic definitions.
NBTrafficLightLogic * compute(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.
Definition: OptionsCont.cpp:58
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double x() const
Returns the x-position.
Definition: Position.h:55
double y() const
Returns the y-position.
Definition: Position.h:60
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)
int indexOfClosest(const Position &p, bool twoD=false) const
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
static const RGBColor BLACK
Definition: RGBColor.h:193
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:197
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 GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, 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 connectionsDemandMode
draw connections in demand mode
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:197
bool indirectLeft
Whether this connection is an indirect left turn.
Definition: NBEdge.h:270
int fromLane
The lane the connections starts at.
Definition: NBEdge.h:222
int toLane
The lane the connections yields in.
Definition: NBEdge.h:228
SVCPermissions permissions
List of vehicle types that are allowed on this connection.
Definition: NBEdge.h:261
double speed
custom speed for connection
Definition: NBEdge.h:252
NBEdge * toEdge
The edge the connections yields in.
Definition: NBEdge.h:225
KeepClear keepClear
whether the junction must be kept clear when using this connection
Definition: NBEdge.h:243
double customLength
custom length for connection
Definition: NBEdge.h:255
std::string edgeType
optional type of Connection
Definition: NBEdge.h:273
bool uncontrolled
check if Connection is uncontrolled
Definition: NBEdge.h:306
PositionVector customShape
custom shape for connection
Definition: NBEdge.h:258
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:240
SVCPermissions changeLeft
List of vehicle types that are allowed to change Left from this connections internal lane(s)
Definition: NBEdge.h:264
SVCPermissions changeRight
List of vehicle types that are allowed to change right from this connections internal lane(s)
Definition: NBEdge.h:267
PositionVector viaShape
shape of via
Definition: NBEdge.h:291
double contPos
custom position for internal junction on this connection
Definition: NBEdge.h:246
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBEdge.h:231
double visibility
custom foe visiblity for connection
Definition: NBEdge.h:249
int tlLinkIndex2
The index of the internal junction within the controlling traffic light (optional)
Definition: NBEdge.h:237
PositionVector shape
shape of Connection
Definition: NBEdge.h:279
bool haveVia
check if Connection have a Via
Definition: NBEdge.h:285
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:234