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.dev/sumo
3 // Copyright (C) 2001-2024 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>
35 
36 #include "GNEConnection.h"
37 #include "GNEInternalLane.h"
38 
39 
40 // ===========================================================================
41 // static member definitions
42 // ===========================================================================
43 static const int NUM_POINTS = 5;
44 
45 // ===========================================================================
46 // method definitions
47 // ===========================================================================
48 
50  GNENetworkElement(from->getNet(), "from" + from->getID() + "to" + to->getID(),
51  GLO_CONNECTION, SUMO_TAG_CONNECTION, GUIIconSubSys::getIcon(GUIIcon::CONNECTION), {}, {}, {}, {}, {}, {}),
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
79  // Get shape of from and to lanes
80  const NBEdge::Connection& nbCon = getNBEdgeConnection();
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 obtained 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 immediately
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 internal 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 
152 bool
154  return false;
155 }
156 
157 
158 bool
160  return false;
161 }
162 
163 
164 bool
166  return false;
167 }
168 
169 
170 bool
172  return false;
173 }
174 
175 
176 bool
178  // get edit modes
179  const auto& editModes = myNet->getViewNet()->getEditModes();
180  // check if we're in delete mode
181  if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
183  } else {
184  return false;
185  }
186 }
187 
188 
189 bool
191  // get edit modes
192  const auto& editModes = myNet->getViewNet()->getEditModes();
193  // check if we're in select mode
194  if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
196  } else {
197  return false;
198  }
199 }
200 
201 
202 bool
204  // get edit modes
205  const auto& editModes = myNet->getViewNet()->getEditModes();
206  // check if we're in move mode
207  if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
208  (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
209  // check if we're editing this network element
211  if (editedNetworkElement) {
212  return editedNetworkElement == this;
213  } else {
214  // only move the first element
216  }
217  } else {
218  return false;
219  }
220 }
221 
222 
225  // edit depending if shape is being edited
226  if (isShapeEdited()) {
227  // get connection
228  const auto& connection = getNBEdgeConnection();
229  // calculate move shape operation
230  return calculateMoveShapeOperation(this, connection.customShape.size() > 0 ? connection.customShape : myConnectionGeometry.getShape(), false);
231  } else {
232  return nullptr;
233  }
234 }
235 
236 
237 void
238 GNEConnection::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
239  // edit depending if shape is being edited
240  if (isShapeEdited()) {
241  // get connection
242  const auto& connection = getNBEdgeConnection();
243  // get original shape
244  PositionVector shape = connection.customShape.size() > 0 ? connection.customShape : connection.shape;
245  // check shape size
246  if (shape.size() > 2) {
247  // obtain index
248  int index = shape.indexOfClosest(clickedPosition);
249  // get snap radius
251  // check if we have to create a new index
252  if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
253  // remove geometry point
254  shape.erase(shape.begin() + index);
255  // commit new shape
256  undoList->begin(this, "remove geometry point of " + getTagStr());
258  undoList->end();
259  }
260  }
261  }
262 }
263 
264 
265 GNEEdge*
267  return myFromLane->getParentEdge();
268 }
269 
270 
271 GNEEdge*
273  return myToLane->getParentEdge();
274 }
275 
276 
277 GNELane*
279  return myFromLane;
280 }
281 
282 
283 GNELane*
285  return myToLane;
286 }
287 
288 
289 int
291  return myFromLane->getIndex();
292 }
293 
294 
295 int
297  return myToLane->getIndex();
298 }
299 
300 
304 }
305 
306 
310  return NBConnection(getEdgeFrom()->getNBEdge(), getFromLaneIndex(),
311  getEdgeTo()->getNBEdge(), getToLaneIndex(),
312  (int)c.tlLinkIndex, (int)c.tlLinkIndex2);
313 }
314 
315 
316 void
319 }
320 
321 
322 LinkState
324  return myLinkState;
325 }
326 
327 
328 void
330  myShapeDeprecated = true;
331 }
332 
333 
334 void
336  const NBEdge::Connection& nbCon = getNBEdgeConnection();
338  nbCon.toEdge,
339  nbCon.fromLane,
340  nbCon.toLane,
341  nbCon.mayDefinitelyPass,
342  nbCon.tlID);
343 }
344 
345 
346 void
348  auto shape = getConnectionShape();
349  shape = shape.bezier(5);
351 }
352 
353 
356  if (myShapeEdited) {
357  return getShapeEditedPopUpMenu(app, parent, getNBEdgeConnection().customShape);
358  } else {
359  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
360  buildPopupHeader(ret, app);
363  // build selection and show parameters menu
366  // build position copy entry
367  buildPositionCopyEntry(ret, app);
368  // check if we're in supermode network
370  // create menu commands
371  FXMenuCommand* mcCustomShape = GUIDesigns::buildFXMenuCommand(ret, "Set custom connection shape", nullptr, &parent, MID_GNE_CONNECTION_EDIT_SHAPE);
372  GUIDesigns::buildFXMenuCommand(ret, "Smooth connection shape", nullptr, &parent, MID_GNE_CONNECTION_SMOOTH_SHAPE);
373  // check if menu commands has to be disabled
375  // check if we're in the correct edit mode
376  if ((editMode == NetworkEditMode::NETWORK_CONNECT) || (editMode == NetworkEditMode::NETWORK_TLS) || (editMode == NetworkEditMode::NETWORK_CREATE_EDGE)) {
377  mcCustomShape->disable();
378  }
379  }
380  return ret;
381  }
382 }
383 
384 
385 double
387  return s.addSize.getExaggeration(s, this);
388 }
389 
390 
391 Boundary
394 }
395 
396 
397 void
398 GNEConnection::updateCenteringBoundary(const bool /*updateGrid*/) {
399  // nothing to update
400 }
401 
402 
403 void
405  // Check if connection must be drawed
406  if (checkDrawConnection()) {
407  // get connection exaggeration
408  const double connectionExaggeration = isAttributeCarrierSelected() ? s.selectorFrameScale : 1;
409  // get detail level
410  const auto d = s.getDetailLevel(connectionExaggeration);
411  // check if draw shape superposed (used in train lanes)
412  PositionVector shapeSuperposed = myConnectionGeometry.getShape();
414  shapeSuperposed.move2side(0.5);
415  }
416  // draw geometry only if we'rent in drawForObjectUnderCursor mode
417  if (!s.drawForViewObjectsHandler) {
418  // draw connection
419  drawConnection(s, d, shapeSuperposed, connectionExaggeration);
420  // draw lock icon
422  // draw dotted contour depending if we're editing the custom shape
424  if (editedNetworkElement && (editedNetworkElement == this)) {
425  // draw dotted contour geometry points
427  connectionExaggeration, s.dottedContourSettings.segmentWidthSmall);
428  } else {
429  // draw dotted contour
431  }
432  }
433  // calculate contour
434  calculateConnectionContour(s, d, shapeSuperposed, connectionExaggeration);
435  }
436 }
437 
438 
439 void
442 }
443 
444 
445 void
447  updateGeometry();
448 }
449 
450 
451 void
453  mySpecialColor = color;
454 }
455 
456 
457 std::string
459  // first get attributes in which nbConnection reference can be invalid
460  switch (key) {
461  case SUMO_ATTR_ID:
462  return getMicrosimID();
463  case SUMO_ATTR_FROM:
464  return myFromLane->getParentEdge()->getID();
465  case SUMO_ATTR_TO:
466  return myToLane->getParentEdge()->getID();
467  case SUMO_ATTR_FROM_LANE:
470  return myFromLane->getID();
471  case SUMO_ATTR_TO_LANE:
473  case GNE_ATTR_TO_LANEID:
474  return myToLane->getID();
475  case GNE_ATTR_SELECTED:
477  case GNE_ATTR_PARENT:
478  return getEdgeFrom()->getToJunction()->getID();
479  default:
480  break;
481  }
482  // now continue with attributes that needs a nbConnection reference
483  const NBEdge::Connection& nbCon = getNBEdgeConnection();
484  switch (key) {
485  case SUMO_ATTR_PASS:
486  return toString(nbCon.mayDefinitelyPass);
487  case SUMO_ATTR_INDIRECT:
488  return toString(nbCon.indirectLeft);
489  case SUMO_ATTR_TYPE:
490  return toString(nbCon.edgeType);
492  return toString(nbCon.keepClear);
493  case SUMO_ATTR_CONTPOS:
494  return toString(nbCon.contPos);
496  return toString(nbCon.uncontrolled);
498  return toString(nbCon.visibility);
500  return toString(nbCon.tlLinkIndex);
502  return toString(nbCon.tlLinkIndex2);
503  case SUMO_ATTR_ALLOW:
504  if (nbCon.permissions == SVC_UNSPECIFIED) {
505  return getVehicleClassNames(nbCon.toEdge->getLanes()[nbCon.toLane].permissions);
506  } else {
507  return getVehicleClassNames(nbCon.permissions);
508  }
509  case SUMO_ATTR_DISALLOW:
510  if (nbCon.permissions == SVC_UNSPECIFIED) {
511  return getVehicleClassNames(invertPermissions(nbCon.toEdge->getLanes()[nbCon.toLane].permissions));
512  } else {
514  }
516  if (nbCon.changeLeft == SVC_UNSPECIFIED) {
517  return "all";
518  } else {
519  return getVehicleClassNames(nbCon.changeLeft);
520  }
522  if (nbCon.changeRight == SVC_UNSPECIFIED) {
523  return "all";
524  } else {
525  return getVehicleClassNames(nbCon.changeRight);
526  }
527  case SUMO_ATTR_SPEED:
528  if (nbCon.speed == NBEdge::UNSPECIFIED_SPEED) {
529  return "default";
530  } else {
531  return toString(nbCon.speed);
532  }
533  case SUMO_ATTR_LENGTH:
534  return toString(nbCon.customLength);
535  case SUMO_ATTR_DIR:
536  return toString(getEdgeFrom()->getNBEdge()->getToNode()->getDirection(
537  getEdgeFrom()->getNBEdge(), nbCon.toEdge, OptionsCont::getOptions().getBool("lefthand")));
538  case SUMO_ATTR_STATE:
539  return toString(getEdgeFrom()->getNBEdge()->getToNode()->getLinkState(
540  getEdgeFrom()->getNBEdge(), nbCon.toEdge, nbCon.fromLane, nbCon.toLane, nbCon.mayDefinitelyPass, nbCon.tlID));
541  case SUMO_ATTR_SHAPE:
543  return toString(nbCon.customShape);
544  case GNE_ATTR_PARAMETERS:
545  return nbCon.getParametersStr();
546  default:
547  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
548  }
549 }
550 
551 
554  switch (key) {
555  case SUMO_ATTR_SHAPE:
558  default:
559  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
560  }
561 }
562 
563 
564 void
565 GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
567  switch (key) {
568  case SUMO_ATTR_FROM:
569  case SUMO_ATTR_TO:
570  case SUMO_ATTR_FROM_LANE:
571  case SUMO_ATTR_TO_LANE:
572  case SUMO_ATTR_PASS:
574  case SUMO_ATTR_CONTPOS:
577  case SUMO_ATTR_ALLOW:
578  case SUMO_ATTR_DISALLOW:
581  case SUMO_ATTR_SPEED:
582  case SUMO_ATTR_LENGTH:
583  case SUMO_ATTR_SHAPE:
585  case SUMO_ATTR_TYPE:
586  case GNE_ATTR_SELECTED:
587  case GNE_ATTR_PARAMETERS:
588  // no special handling
589  GNEChange_Attribute::changeAttribute(this, key, value, undoList);
590  break;
592  if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
593  changeTLIndex(key, parse<int>(value), c.tlLinkIndex2, undoList);
594  }
595  break;
597  if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
598  changeTLIndex(key, c.tlLinkIndex, parse<int>(value), undoList);
599  }
600  break;
601  case SUMO_ATTR_INDIRECT:
602  undoList->begin(this, "change attribute indirect for connection");
603  if (isAttributeEnabled(SUMO_ATTR_TLLINKINDEX) && (value != getAttribute(key))) {
604  GNEChange_Attribute::changeAttribute(this, key, value, undoList);
605  int linkIndex2 = -1;
606  if (parse<bool>(value)) {
607  // find straight connection with the same toEdge
608  std::set<NBTrafficLightDefinition*> defs = getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS();
609  NBEdge* from = getEdgeFrom()->getNBEdge();
610  for (NBTrafficLightDefinition* tlDef : defs) {
611  for (const NBConnection& c2 : tlDef->getControlledLinks()) {
612  if (c2.getTo() == c.toEdge && c2.getFrom() != from) {
613  LinkDirection dir = from->getToNode()->getDirection(c2.getFrom(), c2.getTo());
614  if (dir == LinkDirection::STRAIGHT) {
615  linkIndex2 = c2.getTLIndex();
616  break;
617  }
618  }
619  }
620  }
621  }
622  changeTLIndex(key, c.tlLinkIndex, linkIndex2, undoList);
623  }
624  undoList->end();
625  break;
626  case SUMO_ATTR_DIR:
627  throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
628  case SUMO_ATTR_STATE:
629  throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
630  default:
631  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
632  }
633 }
634 
635 
636 void
637 GNEConnection::changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList* undoList) {
638  // trigger GNEChange_TLS
639  undoList->begin(this, "change tls linkIndex for connection");
640  // make a copy
641  std::set<NBTrafficLightDefinition*> defs = getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS();
642  for (const auto& tlDef : defs) {
643  NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
644  NBTrafficLightLogic* tllogic = sumoDef ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
645  if (tllogic != nullptr) {
646  NBLoadedSUMOTLDef* newDef = new NBLoadedSUMOTLDef(*tlDef, *tllogic);
647  newDef->addConnection(getEdgeFrom()->getNBEdge(), getEdgeTo()->getNBEdge(),
648  getLaneFrom()->getIndex(), getLaneTo()->getIndex(), tlIndex, tlIndex2, false);
649  // make a copy
650  std::vector<NBNode*> nodes = tlDef->getNodes();
651  for (const auto& node : nodes) {
652  GNEJunction* junction = getNet()->getAttributeCarriers()->retrieveJunction(node->getID());
653  undoList->add(new GNEChange_TLS(junction, tlDef, false), true);
654  undoList->add(new GNEChange_TLS(junction, newDef, true), true);
655  }
656  } else {
657  WRITE_ERRORF(TL("Could not set attribute '%' (tls is broken)"), toString(key));
658  }
659  }
660  undoList->end();
661 }
662 
663 
664 bool
666  return getEdgeFrom()->getNBEdge()->getConnectionsFromLane(getFromLaneIndex(), getEdgeTo()->getNBEdge(), getToLaneIndex()).size() > 0;
667 }
668 
669 
670 bool
672  // declare a flag to check if shape has to be draw (by deafult false)
673  bool drawConnection = false;
674  // only draw connections if shape isn't deprecated
680  } else {
681  drawConnection = false;
682  }
683  } else {
684  drawConnection = false;
685  }
686  // check if we're editing this connection
688  if (editedNetworkElement && (editedNetworkElement->getTagProperty().getTag() == SUMO_TAG_CONNECTION)) {
689  if (editedNetworkElement->getAttribute(GNE_ATTR_PARENT) == getAttribute(GNE_ATTR_PARENT)) {
690  drawConnection = true;
691  }
692  }
693  return drawConnection;
694 }
695 
696 
697 RGBColor
699  // check conditions
700  if (myShapeEdited) {
701  // return shape edit color
702  return s.colorSettings.editShapeColor;
703  } else if (drawUsingSelectColor()) {
704  // override with special colors (unless the color scheme is based on selection)
706  } else if (mySpecialColor != nullptr) {
707  // return special color
708  return *mySpecialColor;
709  } else {
710  // Set color depending of the link state
712  }
713 }
714 
715 
716 void
718  const PositionVector& shape, const double exaggeration) const {
719  // get color
720  RGBColor connectionColor = getConnectionColor(s);
721  // Push layer matrix
723  // translate to front
726  } else {
728  }
729  // Set color
730  GLHelper::setColor(connectionColor);
731  // continue depending of detail level
733  // draw geometry
735  s.connectionSettings.connectionWidth * exaggeration);
736  // draw arrows over connection
737  drawConnectionArrows(s, connectionColor);
738  // check if internal junction marker has to be drawn
739  if (myInternalJunctionMarker.size() > 0) {
741  }
742  // draw edge values
743  drawEdgeValues(s, shape);
744  // draw shape points only in Network supemode
746  // draw geometry points
750  }
751  } else {
753  }
754  // Pop layer matrix
756 }
757 
758 
759 void
761  if (s.showLaneDirection) {
762  // Push matrix
764  // move front
765  glTranslated(0, 0, 0.1);
766  // change color
768  // draw triangles
769  for (int i = 1; i < (int)myConnectionGeometry.getShape().size(); i++) {
770  const auto posA = myConnectionGeometry.getShape()[i - 1];
771  const auto posB = myConnectionGeometry.getShape()[i];
772  GLHelper::drawTriangleAtEnd(posA, posB, (double) 1, (double) .2);
773  }
774  // Pop matrix
776  }
777 }
778 
779 
780 void
782  // check if edge value has to be shown
783  if (s.edgeValue.show(this)) {
784  const NBEdge::Connection& nbCon = getNBEdgeConnection();
785  const std::string value = nbCon.getParameter(s.edgeParam, "");
786  if (value != "") {
787  int shapeIndex = (int)shape.size() / 2;
788  const Position p = (myConnectionGeometry.getShape().size() == 2) ? (shape.front() * 0.67 + shape.back() * 0.33) : shape[shapeIndex];
789  GLHelper::drawTextSettings(s.edgeValue, value, p, s.scale, 0);
790  }
791  }
792 }
793 
794 
795 void
797  const PositionVector& shape, const double exaggeration) const {
798  // first check if junction parent was inserted with full boundary
800  // calculate geometry points contour if we're editing shape
801  if (myShapeEdited) {
803  exaggeration, true);
804  } else {
805  // calculate connection shape contour
806  myNetworkElementContour.calculateContourExtrudedShape(s, d, this, shape, s.connectionSettings.connectionWidth, exaggeration, true, true, 0);
807  }
808  }
809 }
810 
811 
812 bool
813 GNEConnection::isValid(SumoXMLAttr key, const std::string& value) {
814  // Currently ignored before implementation to avoid warnings
815  switch (key) {
816  case SUMO_ATTR_FROM:
817  case SUMO_ATTR_TO:
818  case SUMO_ATTR_FROM_LANE:
819  case SUMO_ATTR_TO_LANE:
820  return false;
821  case SUMO_ATTR_PASS:
822  return canParse<bool>(value);
823  case SUMO_ATTR_INDIRECT:
824  return canParse<bool>(value);
825  case SUMO_ATTR_TYPE:
826  return true;
828  return canParse<bool>(value);
829  case SUMO_ATTR_CONTPOS:
830  return canParse<double>(value) && (parse<double>(value) >= -1);
832  return canParse<bool>(value);
834  return canParse<double>(value) && (parse<double>(value) >= -1);
839  (getEdgeFrom()->getNBEdge()->getToNode()->getControllingTLS().size() > 0) &&
840  canParse<int>(value) &&
841  (parse<int>(value) >= 0 || parse<int>(value) == -1)) {
842  // obtain Traffic light definition
844  return def->getMaxValidIndex() >= parse<int>(value);
845  } else {
846  return false;
847  }
848  case SUMO_ATTR_ALLOW:
849  case SUMO_ATTR_DISALLOW:
852  return canParseVehicleClasses(value);
853  case SUMO_ATTR_SPEED:
854  if (value.empty() || value == "default") {
855  return true;
856  } else {
857  return canParse<double>(value) && ((parse<double>(value) >= 0) || (parse<double>(value) == NBEdge::UNSPECIFIED_SPEED));
858  }
859  case SUMO_ATTR_LENGTH:
860  return canParse<double>(value) && (parse<double>(value) >= -1);
861  case SUMO_ATTR_SHAPE:
863  // empty custom shapes are allowed
864  return canParse<PositionVector>(value);
865  case SUMO_ATTR_STATE:
866  return false;
867  case SUMO_ATTR_DIR:
868  return false;
869  case GNE_ATTR_SELECTED:
870  return canParse<bool>(value);
871  case GNE_ATTR_PARAMETERS:
872  return Parameterised::areParametersValid(value);
873  default:
874  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
875  }
876 }
877 
878 
879 bool
881  switch (key) {
882  case SUMO_ATTR_FROM:
883  case SUMO_ATTR_TO:
884  case SUMO_ATTR_FROM_LANE:
885  case SUMO_ATTR_TO_LANE:
886  case SUMO_ATTR_DIR:
887  case SUMO_ATTR_STATE:
888  // this attributes cannot be edited
889  return false;
892  // get Traffic Light definitions
893  if (getEdgeFrom()->getNBEdge()->getToNode()->isTLControlled()) {
895  NBLoadedSUMOTLDef* sumoDef = dynamic_cast<NBLoadedSUMOTLDef*>(tlDef);
896  NBTrafficLightLogic* tllogic = sumoDef != nullptr ? sumoDef->getLogic() : tlDef->compute(OptionsCont::getOptions());
897  if (tllogic != nullptr) {
898  return true;
899  } else {
900  return false;
901  }
902  }
903  return false;
904  default:
905  return true;
906  }
907 }
908 
909 
910 bool
912  switch (key) {
913  case SUMO_ATTR_SPEED:
915  default:
916  return false;
917  }
918 }
919 
920 
921 const Parameterised::Map&
924 }
925 
926 // ===========================================================================
927 // private
928 // ===========================================================================
929 
930 void
931 GNEConnection::setAttribute(SumoXMLAttr key, const std::string& value) {
933  switch (key) {
934  case SUMO_ATTR_PASS:
935  nbCon.mayDefinitelyPass = parse<bool>(value);
936  break;
937  case SUMO_ATTR_INDIRECT:
938  nbCon.indirectLeft = parse<bool>(value);
939  break;
941  nbCon.keepClear = parse<bool>(value) ? KEEPCLEAR_TRUE : KEEPCLEAR_FALSE;
942  break;
944  nbCon.uncontrolled = parse<bool>(value);
945  break;
946  case SUMO_ATTR_CONTPOS:
947  nbCon.contPos = parse<double>(value);
948  break;
950  nbCon.visibility = parse<double>(value);
951  break;
952  case SUMO_ATTR_SPEED:
953  if (value.empty() || (value == "default")) {
955  } else {
956  nbCon.speed = parse<double>(value);
957  }
958  break;
959  case SUMO_ATTR_LENGTH:
960  nbCon.customLength = parse<double>(value);
961  break;
962  case SUMO_ATTR_ALLOW:
963  nbCon.permissions = parseVehicleClasses(value);
964  break;
965  case SUMO_ATTR_DISALLOW:
967  break;
969  nbCon.changeLeft = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
970  break;
972  nbCon.changeRight = value == "" ? SVC_UNSPECIFIED : parseVehicleClasses(value);
973  break;
974  case SUMO_ATTR_STATE:
975  throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
976  case SUMO_ATTR_DIR:
977  throw InvalidArgument("Attribute of '" + toString(key) + "' cannot be modified");
978  case SUMO_ATTR_SHAPE:
980  nbCon.customShape = parse<PositionVector>(value);
981  // update centering boundary
983  break;
984  case SUMO_ATTR_TYPE:
985  nbCon.edgeType = value;
986  break;
987  case GNE_ATTR_SELECTED:
988  if (parse<bool>(value)) {
990  } else {
992  }
993  break;
994  case GNE_ATTR_PARAMETERS:
995  nbCon.setParametersStr(value);
996  break;
997  default:
998  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
999  }
1000  // Update Geometry after setting a new attribute (but avoided for certain attributes)
1001  if ((key != SUMO_ATTR_ID) && (key != GNE_ATTR_PARAMETERS) && (key != GNE_ATTR_SELECTED)) {
1003  updateGeometry();
1004  }
1005  // invalidate path calculator
1007 }
1008 
1009 
1010 void
1012  // set custom shape
1014  // mark junction as deprecated
1015  myShapeDeprecated = true;
1016  // update geometry
1017  updateGeometry();
1018 }
1019 
1020 
1021 void
1023  // commit new shape
1024  undoList->begin(this, "moving " + toString(SUMO_ATTR_CUSTOMSHAPE) + " of " + getTagStr());
1026  undoList->end();
1027 }
1028 
1029 /****************************************************************************/
static const int NUM_POINTS
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
Definition: GUIAppEnum.h:1284
@ MID_GNE_CONNECTION_EDIT_SHAPE
edit connection shape
Definition: GUIAppEnum.h:1282
@ GLO_CONNECTION
a connection
GUIViewObjectsHandler gViewObjectsHandler
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
#define WRITE_ERRORF(...)
Definition: MsgHandler.h:305
#define TL(string)
Definition: MsgHandler.h:315
@ 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.
@ SUMO_TAG_CONNECTION
connectioon 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"
@ 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
@ 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:76
T MAX2(T a, T b)
Definition: StdDefs.h:82
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:438
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:654
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:629
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
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:347
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
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:787
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 (instead of GUIGlObjectStorage)
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
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
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 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
GNELane * myToLane
outgoing lane of this connection
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)
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)
void drawConnection(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const PositionVector &shape, const double exaggeration) const
draw connection
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)
void drawConnectionArrows(const GUIVisualizationSettings &s, const RGBColor &color) const
draw arrows over connections
GNEMoveOperation * getMoveOperation()
get move operation for the given shapeOffset (can be nullptr)
void updateGeometry()
update pre-computed geometry information
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
PositionVector myInternalJunctionMarker
waiting position for internal junction
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 extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const
calculate contour extruded (used in elements formed by a central shape)
Definition: GNEContour.cpp:88
void calculateContourAllGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double radius, const double scale, const bool calculatePosOverShape) const
calculate contour for all geometry points
Definition: GNEContour.cpp:192
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
Definition: GNEContour.cpp:307
void drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
drawing contour functions
Definition: GNEContour.cpp:265
Boundary getContourBoundary() const
get contour boundary
Definition: GNEContour.cpp:59
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:753
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:82
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
bool drawSuperposed() const
draw superposed
Definition: GNELane.cpp:154
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
std::string getAttribute(SumoXMLAttr key) const
Definition: GNELane.cpp:663
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:615
const DrawingConstants * getDrawingConstants() const
get lane drawing constants (previously calculated in drawGL())
Definition: GNELane.cpp:236
GNEEdge * getParentEdge() const
get parent edge
Definition: GNELane.cpp:196
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:329
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:123
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:135
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2136
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 attribute carrier or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:723
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
Definition: GNEViewNet.cpp:759
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:735
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
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
Definition: GNEViewNet.cpp:477
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:553
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
Definition: GUIDesigns.cpp:42
The popup menu of a globject.
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
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:59
const std::vector< double > & getShapeLengths() const
The lengths of the single shape parts.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
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.
Definition: GUIGlObject.h:156
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:143
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
bool checkBoundaryParentElement(const GUIGlObject *GLObject, const GUIGlObject *parent)
check boundary parent element
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
The representation of a single edge during network building.
Definition: NBEdge.h:92
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:1306
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:726
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:542
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:516
std::vector< Connection > getConnectionsFromLane(int lane, const NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1280
static const double UNSPECIFIED_SPEED
unspecified lane speed
Definition: NBEdge.h:348
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.
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:2358
LinkState getLinkState(const NBEdge *incoming, const NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:2441
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:336
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.
Definition: OptionsCont.cpp:60
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|....
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
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.
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
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".
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.
void append(const PositionVector &v, double sameThreshold=2.0)
double length() const
Returns the length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
PositionVector getOrthogonal(const Position &p, double extend, bool before, double length=1.0, double deg=90) const
return orthogonal through p (extending this vector if necessary)
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
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:297
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