SUMO - Simulation of Urban MObility
NBEdge.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // The representation of a single edge during network building
18 /****************************************************************************/
19 #ifndef NBEdge_h
20 #define NBEdge_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <map>
29 #include <vector>
30 #include <string>
31 #include <set>
32 #include <cassert>
33 #include <utils/common/Named.h>
37 #include <utils/geom/Bresenham.h>
41 #include "NBCont.h"
42 #include "NBHelpers.h"
43 #include "NBSign.h"
44 
45 
46 // ===========================================================================
47 // class declarations
48 // ===========================================================================
49 class NBNode;
50 class NBConnection;
51 class NBNodeCont;
52 class NBEdgeCont;
53 class OutputDevice;
54 class GNELane;
55 class NBVehicle;
56 
57 
58 // ===========================================================================
59 // class definitions
60 // ===========================================================================
65 class NBEdge : public Named, public Parameterised {
66  friend class NBEdgeCont;
67 
69  friend class GNELane;
70  friend class GNEEdge;
71  friend class GNEJunction;
72 
73 public:
74 
97  };
98 
99 
110  };
111 
112 
116  struct Lane : public Parameterised {
118  Lane(NBEdge* e, const std::string& _origID);
119 
122 
124  double speed;
125 
128 
131 
133  double endOffset;
134 
137  std::map<int, double> stopOffsets;
138 
140  double width;
141 
143  std::string oppositeID;
144 
146  bool accelRamp;
147 
149  // @note (see NIImporter_DlrNavteq::ConnectedLanesHandler)
151 
154  };
155 
156 
160  struct Connection : public Parameterised {
166  Connection(int fromLane_, NBEdge* toEdge_, int toLane_);
167 
169  Connection(int fromLane_, NBEdge* toEdge_, int toLane_, bool mayDefinitelyPass_,
170  bool keepClear_ = true,
171  double contPos_ = UNSPECIFIED_CONTPOS,
172  double visibility_ = UNSPECIFIED_VISIBILITY_DISTANCE,
173  double speed_ = UNSPECIFIED_SPEED,
174  bool haveVia_ = false,
175  bool uncontrolled_ = false,
176  const PositionVector& customShape_ = PositionVector::EMPTY);
177 
180 
182  int fromLane;
183 
186 
188  int toLane;
189 
191  std::string tlID;
192 
195 
198 
200  bool keepClear;
201 
203  double contPos;
204 
206  double visibility;
207 
209  double speed;
210 
213 
215  std::string id;
216 
219 
221  double vmax;
222 
224  bool haveVia;
225 
227  std::string viaID;
228 
231 
233  std::vector<int> foeInternalLinks;
234 
236  std::vector<std::string> foeIncomingLanes;
237 
240 
243 
245  std::string getInternalLaneID() const;
246 
248  std::string getDescription(const NBEdge* parent) const;
249 
251  double length;
252  };
253 
254 
256  static const double UNSPECIFIED_WIDTH;
257 
259  static const double UNSPECIFIED_OFFSET;
260 
262  static const double UNSPECIFIED_SPEED;
263 
265  static const double UNSPECIFIED_CONTPOS;
266 
268  static const double UNSPECIFIED_VISIBILITY_DISTANCE;
269 
271  static const double UNSPECIFIED_LOADED_LENGTH;
272 
274  static const double UNSPECIFIED_SIGNAL_OFFSET;
275 
277  static const double ANGLE_LOOKAHEAD;
278 
281 
284 
289  ROUNDABOUT = 1000
290  };
291 
292 public:
311  NBEdge(const std::string& id,
312  NBNode* from, NBNode* to, std::string type,
313  double speed, int nolanes, int priority,
314  double width, double endOffset,
315  const std::string& streetName = "",
317 
318 
340  NBEdge(const std::string& id,
341  NBNode* from, NBNode* to, std::string type,
342  double speed, int nolanes, int priority,
343  double width, double endOffset,
344  PositionVector geom,
345  const std::string& streetName = "",
346  const std::string& origID = "",
348  bool tryIgnoreNodePositions = false);
349 
361  NBEdge(const std::string& id,
362  NBNode* from, NBNode* to,
363  const NBEdge* tpl,
364  const PositionVector& geom = PositionVector(),
365  int numLanes = -1);
366 
367 
369  ~NBEdge();
370 
371 
387  void reinit(NBNode* from, NBNode* to, const std::string& type,
388  double speed, int nolanes, int priority,
389  PositionVector geom, double width, double endOffset,
390  const std::string& streetName,
392  bool tryIgnoreNodePositions = false);
393 
398  void reinitNodes(NBNode* from, NBNode* to);
399 
402 
406  void reshiftPosition(double xoff, double yoff);
407 
409  void mirrorX();
411 
413 
414 
418  int getNumLanes() const {
419  return (int)myLanes.size();
420  }
421 
425  int getPriority() const {
426  return myPriority;
427  }
428 
432  NBNode* getFromNode() const {
433  return myFrom;
434  }
435 
439  NBNode* getToNode() const {
440  return myTo;
441  }
442 
448  inline double getStartAngle() const {
449  return myStartAngle;
450  }
451 
457  inline double getEndAngle() const {
458  return myEndAngle;
459  }
460 
465  double getShapeStartAngle() const;
466 
467 
473  double getShapeEndAngle() const;
474 
479  inline double getTotalAngle() const {
480  return myTotalAngle;
481  }
482 
486  double getLength() const {
487  return myLength;
488  }
489 
490 
495  double getLoadedLength() const {
496  return myLoadedLength > 0 ? myLoadedLength : myLength;
497  }
498 
500  double getFinalLength() const;
501 
505  bool hasLoadedLength() const {
506  return myLoadedLength > 0;
507  }
508 
512  double getSpeed() const {
513  return mySpeed;
514  }
515 
522  return myStep;
523  }
524 
528  double getLaneWidth() const {
529  return myLaneWidth;
530  }
531 
535  double getLaneWidth(int lane) const;
536 
538  double getTotalWidth() const;
539 
541  const std::string& getStreetName() const {
542  return myStreetName;
543  }
544 
546  void setStreetName(const std::string& name) {
547  myStreetName = name;
548  }
549 
553  double getEndOffset() const {
554  return myEndOffset;
555  }
556 
560  const std::map<int, double>& getStopOffsets() const {
561  return myStopOffsets;
562  }
563 
567  double getEndOffset(int lane) const;
568 
572  const std::map<int, double>& getStopOffsets(int lane) const;
573 
575  double getSignalOffset() const {
576  return mySignalOffset;
577  }
578 
580  void setSignalOffset(double offset) {
581  mySignalOffset = offset;
582  }
583 
587  const std::vector<NBEdge::Lane>& getLanes() const {
588  return myLanes;
589  }
591 
596  int getFirstNonPedestrianLaneIndex(int direction, bool exclusive = false) const;
597 
601  int getFirstAllowedLaneIndex(int direction) const;
602 
604  NBEdge::Lane getFirstNonPedestrianLane(int direction) const;
605 
607  std::set<SVCPermissions> getPermissionVariants(int iStart, int iEnd) const;
608 
610  double getCrossingAngle(NBNode* node);
611 
613  std::string getSidewalkID();
614 
616 
617 
620  const PositionVector& getGeometry() const {
621  return myGeom;
622  }
623 
625  const PositionVector getInnerGeometry() const;
626 
628  bool hasDefaultGeometry() const;
629 
635  bool hasDefaultGeometryEndpoints() const;
636 
642  bool hasDefaultGeometryEndpointAtNode(const NBNode* node) const;
643 
654  void setGeometry(const PositionVector& g, bool inner = false);
655 
665  void addGeometryPoint(int index, const Position& p);
666 
668  void extendGeometryAtNode(const NBNode* node, double maxExtent);
669 
671  void shortenGeometryAtNode(const NBNode* node, double reduction);
672 
674  void shiftPositionAtNode(NBNode* node, NBEdge* opposite);
675 
685  void computeEdgeShape();
686 
690  const PositionVector& getLaneShape(int i) const;
691 
697 
703  return myLaneSpreadFunction;
704  }
705 
711  bool splitGeometry(NBEdgeCont& ec, NBNodeCont& nc);
712 
716  void reduceGeometry(const double minDist);
717 
723  void checkGeometry(const double maxAngle, const double minRadius, bool fix);
725 
728 
742  bool addEdge2EdgeConnection(NBEdge* dest);
743 
764  bool addLane2LaneConnection(int fromLane, NBEdge* dest,
765  int toLane, Lane2LaneInfoType type,
766  bool mayUseSameDestination = false,
767  bool mayDefinitelyPass = false,
768  bool keepClear = true,
769  double contPos = UNSPECIFIED_CONTPOS,
770  double visibility = UNSPECIFIED_VISIBILITY_DISTANCE,
771  double speed = UNSPECIFIED_SPEED,
773  const bool uncontrolled = UNSPECIFIED_CONNECTION_UNCONTROLLED);
774 
792  bool addLane2LaneConnections(int fromLane,
793  NBEdge* dest, int toLane, int no,
794  Lane2LaneInfoType type, bool invalidatePrevious = false,
795  bool mayDefinitelyPass = false);
796 
807  bool setConnection(int lane, NBEdge* destEdge,
808  int destLane,
809  Lane2LaneInfoType type,
810  bool mayUseSameDestination = false,
811  bool mayDefinitelyPass = false,
812  bool keepClear = true,
813  double contPos = UNSPECIFIED_CONTPOS,
814  double visibility = UNSPECIFIED_VISIBILITY_DISTANCE,
815  double speed = UNSPECIFIED_SPEED,
817  const bool uncontrolled = UNSPECIFIED_CONNECTION_UNCONTROLLED);
818 
820  void insertConnection(NBEdge::Connection connection);
821 
830  std::vector<Connection> getConnectionsFromLane(int lane) const;
831 
836  Connection getConnection(int fromLane, const NBEdge* to, int toLane) const;
837 
842  Connection& getConnectionRef(int fromLane, const NBEdge* to, int toLane);
843 
852  bool hasConnectionTo(NBEdge* destEdge, int destLane, int fromLane = -1) const;
853 
860  bool isConnectedTo(const NBEdge* e) const;
861 
865  const std::vector<Connection>& getConnections() const {
866  return myConnections;
867  }
868 
872  std::vector<Connection>& getConnections() {
873  return myConnections;
874  }
875 
880 
885 
890 
894  std::vector<int> getConnectionLanes(NBEdge* currentOutgoing) const;
895 
898 
901 
907  void remapConnections(const EdgeVector& incoming);
908 
916  void removeFromConnections(NBEdge* toEdge, int fromLane = -1, int toLane = -1, bool tryLater = false, const bool adaptToLaneRemoval = false);
917 
919  bool removeFromConnections(NBEdge::Connection connectionToRemove);
920 
922  void invalidateConnections(bool reallowSetting = false);
923 
925  void replaceInConnections(NBEdge* which, NBEdge* by, int laneOff);
926 
928  void replaceInConnections(NBEdge* which, const std::vector<NBEdge::Connection>& origConns);
929 
931  void copyConnectionsFrom(NBEdge* src);
932 
934  void shiftToLanesToEdge(NBEdge* to, int laneOff);
936 
942  bool isTurningDirectionAt(const NBEdge* const edge) const;
943 
948  void setTurningDestination(NBEdge* e, bool onlyPossible = false);
949 
955  }
956 
960  bool isMacroscopicConnector() const {
962  }
963 
965  void setIsInnerEdge() {
966  myAmInnerEdge = true;
967  }
968 
972  bool isInnerEdge() const {
973  return myAmInnerEdge;
974  }
976 
982  void setJunctionPriority(const NBNode* const node, int prio);
983 
993  int getJunctionPriority(const NBNode* const node) const;
994 
996  void setLoadedLength(double val);
997 
1000 
1002  const std::string& getTypeID() const {
1003  return myType;
1004  }
1005 
1007  bool needsLaneSpecificOutput() const;
1008 
1010  bool hasPermissions() const;
1011 
1013  bool hasLaneSpecificPermissions() const;
1014 
1016  bool hasLaneSpecificSpeed() const;
1017 
1019  bool hasLaneSpecificWidth() const;
1020 
1022  bool hasLaneSpecificEndOffset() const;
1023 
1025  bool hasLaneSpecificStopOffsets() const;
1026 
1028  bool hasAccelLane() const;
1029 
1031  bool hasCustomLaneShape() const;
1032 
1034  bool hasLaneParams() const;
1035 
1037  bool computeEdge2Edges(bool noLeftMovers);
1038 
1040  bool computeLanes2Edges();
1041 
1043  bool recheckLanes();
1044 
1053  void appendTurnaround(bool noTLSControlled, bool onlyDeadends, bool checkPermissions);
1054 
1058  NBNode* tryGetNodeAtPosition(double pos, double tolerance = 5.0) const;
1059 
1061  double getMaxLaneOffset();
1062 
1064  bool lanesWereAssigned() const;
1065 
1067  bool mayBeTLSControlled(int fromLane, NBEdge* toEdge, int toLane) const;
1068 
1070  bool setControllingTLInformation(const NBConnection& c, const std::string& tlID);
1071 
1074 
1077 
1079  PositionVector getCWBoundaryLine(const NBNode& n) const;
1080 
1082  PositionVector getCCWBoundaryLine(const NBNode& n) const;
1083 
1085  bool expandableBy(NBEdge* possContinuation, std::string& reason) const;
1086 
1088  void append(NBEdge* continuation);
1089 
1091  bool hasSignalisedConnectionTo(const NBEdge* const e) const;
1092 
1094  void moveOutgoingConnectionsFrom(NBEdge* e, int laneOff);
1095 
1096  /* @brief return the turn destination if it exists
1097  * @param[in] possibleDestination Wether myPossibleTurnDestination should be returned if no turnaround connection
1098  * exists
1099  */
1100  NBEdge* getTurnDestination(bool possibleDestination = false) const;
1101 
1103  std::string getLaneID(int lane) const;
1104 
1106  std::string getLaneIDInsecure(int lane) const;
1107 
1109  double getLaneSpeed(int lane) const;
1110 
1112  bool isNearEnough2BeJoined2(NBEdge* e, double threshold) const;
1113 
1121  double getAngleAtNode(const NBNode* const node) const;
1122 
1131  double getAngleAtNodeToCenter(const NBNode* const node) const;
1132 
1134  void incLaneNo(int by);
1135 
1137  void decLaneNo(int by);
1138 
1140  void deleteLane(int index, bool recompute, bool shiftIndices);
1141 
1143  void addLane(int index, bool recomputeShape, bool recomputeConnections, bool shiftIndices);
1144 
1146  void markAsInLane2LaneState();
1147 
1149  void addSidewalk(double width);
1150 
1152  void restoreSidewalk(std::vector<NBEdge::Lane> oldLanes, PositionVector oldGeometry, std::vector<NBEdge::Connection> oldConnections);
1153 
1155  void addBikeLane(double width);
1156 
1158  void restoreBikelane(std::vector<NBEdge::Lane> oldLanes, PositionVector oldGeometry, std::vector<NBEdge::Connection> oldConnections);
1159 
1161  void setPermissions(SVCPermissions permissions, int lane = -1);
1162 
1164  void setPreferredVehicleClass(SVCPermissions permissions, int lane = -1);
1165 
1167  void allowVehicleClass(int lane, SUMOVehicleClass vclass);
1168 
1170  void disallowVehicleClass(int lane, SUMOVehicleClass vclass);
1171 
1173  void preferVehicleClass(int lane, SUMOVehicleClass vclass);
1174 
1176  void setLaneWidth(int lane, double width);
1177 
1179  void setEndOffset(int lane, double offset);
1180 
1182  void setSpeed(int lane, double speed);
1183 
1186  bool setStopOffsets(int lane, std::map<int, double> offsets, bool overwrite = false);
1187 
1189  void setAcceleration(int lane, bool accelRamp);
1190 
1192  void setLaneShape(int lane, const PositionVector& shape);
1193 
1195  SVCPermissions getPermissions(int lane = -1) const;
1196 
1198  void setOrigID(const std::string origID);
1199 
1201  void disableConnection4TLS(int fromLane, NBEdge* toEdge, int toLane);
1202 
1203  // @brief returns a reference to the internal structure for the convenience of NETEDIT
1204  Lane& getLaneStruct(int lane) {
1205  assert(lane >= 0);
1206  assert(lane < (int)myLanes.size());
1207  return myLanes[lane];
1208  }
1209 
1210  // @brief returns a reference to the internal structure for the convenience of NETEDIT
1211  const Lane& getLaneStruct(int lane) const {
1212  assert(lane >= 0);
1213  assert(lane < (int)myLanes.size());
1214  return myLanes[lane];
1215  }
1216 
1219  myStep = step;
1220  }
1221 
1222  /* @brief fill connection attributes shape, viaShape, ...
1223  *
1224  * @param[in,out] edgeIndex The number of connections already handled
1225  * @param[in,out] splitIndex The number of via edges already built
1226  * @param[in] tryIgnoreNodePositions Does not add node geometries if geom.size()>=2
1227  */
1228  void buildInnerEdges(const NBNode& n, int noInternalNoSplits, int& linkIndex, int& splitIndex);
1229 
1231  inline const std::vector<NBSign>& getSigns() const {
1232  return mySigns;
1233  }
1234 
1236  inline void addSign(NBSign sign) {
1237  mySigns.push_back(sign);
1238  }
1239 
1242 
1244  void setNodeBorder(const NBNode* node, const Position& p, const Position& p2, bool rectangularCut);
1245  void resetNodeBorder(const NBNode* node);
1246 
1248  bool isBidiRail(bool ignoreSpread = false) const;
1249 
1251  bool isRailDeadEnd() const;
1252 
1254  void debugPrintConnections(bool outgoing = true, bool incoming = false) const;
1255 
1257  static double firstIntersection(const PositionVector& v1, const PositionVector& v2, double width2);
1258 
1260 
1261 
1262  static inline double getTravelTimeStatic(const NBEdge* const edge, const NBVehicle* const /*veh*/, double /*time*/) {
1263  return edge->getLength() / edge->getSpeed();
1264  }
1265 
1266  static int getLaneIndexFromLaneID(const std::string laneID);
1267 
1269  void setNumericalID(int index) {
1270  myIndex = index;
1271  }
1272 
1277  int getNumericalID() const {
1278  return myIndex;
1279  }
1280 
1283  const EdgeVector& getSuccessors(SUMOVehicleClass vClass = SVC_IGNORING) const;
1284 
1285 
1289 
1290 
1292 
1293 private:
1298  private:
1300  std::map<NBEdge*, std::vector<int> > myConnections;
1301 
1304 
1305  public:
1308  : myTransitions(transitions) { }
1309 
1312 
1314  void execute(const int lane, const int virtEdge);
1315 
1317  const std::map<NBEdge*, std::vector<int> >& getBuiltConnections() const {
1318  return myConnections;
1319  }
1320 
1321  private:
1324 
1327  };
1328 
1329 
1338  public:
1340  enum Direction { DIR_RIGHTMOST, DIR_LEFTMOST, DIR_FORWARD };
1341 
1343  std::vector<Direction> myDirs;
1344 
1345  public:
1347  MainDirections(const EdgeVector& outgoing, NBEdge* parent, NBNode* to, int indexOfStraightest);
1348 
1350  ~MainDirections();
1351 
1353  bool empty() const;
1354 
1356  bool includes(Direction d) const;
1357 
1358  private:
1361 
1364  };
1365 
1367  PositionVector computeLaneShape(int lane, double offset) const;
1368 
1370  void computeLaneShapes();
1371 
1372 private:
1389  void init(int noLanes, bool tryIgnoreNodePositions, const std::string& origID);
1390 
1392  void divideOnEdges(const EdgeVector* outgoing);
1393 
1395  void divideSelectedLanesOnEdges(const EdgeVector* outgoing, const std::vector<int>& availableLanes, const std::vector<int>* priorities);
1396 
1398  void addStraightConnections(const EdgeVector* outgoing, const std::vector<int>& availableLanes, const std::vector<int>* priorities);
1399 
1401  std::vector<int>* prepareEdgePriorities(const EdgeVector* outgoing);
1402 
1404  static int computePrioritySum(const std::vector<int>& priorities);
1405 
1408 
1411  void moveConnectionToLeft(int lane);
1412 
1416  void moveConnectionToRight(int lane);
1417 
1419  bool canMoveConnection(const Connection& con, int newFromLane) const;
1421 
1425  PositionVector startShapeAt(const PositionVector& laneShape, const NBNode* startNode, PositionVector nodeShape) const;
1426 
1428  void computeAngle();
1429 
1431  bool bothLeftIntersect(const NBNode& n, const PositionVector& shape, LinkDirection dir, NBEdge* otherFrom, const NBEdge::Connection& otherCon, int numPoints, double width2) const;
1432 
1434  void addRestrictedLane(double width, SUMOVehicleClass vclass);
1435 
1437  void restoreRestrictedLane(SUMOVehicleClass vclass, std::vector<NBEdge::Lane> oldLanes, PositionVector oldGeometry, std::vector<NBEdge::Connection> oldConnections);
1438 
1440  void assignInternalLaneLength(std::vector<Connection>::iterator i, int numLanes, double lengthSum);
1441 
1442 private:
1447 
1449  std::string myType;
1450 
1453 
1455  double myLength;
1456 
1460  double myEndAngle;
1463 
1466 
1468  double mySpeed;
1469 
1473  std::vector<Connection> myConnections;
1474 
1476  std::vector<Connection> myConnectionsToDelete;
1477 
1480 
1483 
1486 
1489 
1492 
1495 
1497  double myEndOffset;
1498 
1503  std::map<int, double> myStopOffsets;
1504 
1506  double myLaneWidth;
1507 
1511  std::vector<Lane> myLanes;
1512 
1515 
1518 
1521 
1526  int toLane;
1527  };
1528 
1530  std::vector<TLSDisabledConnection> myTLSDisabledConnections;
1531 
1533  std::string myStreetName;
1534 
1536  std::vector<NBSign> mySigns;
1537 
1540 
1546 
1547 
1549  int myIndex;
1550 
1551  // @brief a static list of successor edges. Set by NBEdgeCont and requires reset when the network changes
1553 
1554  // @brief a static list of successor edges. Set by NBEdgeCont and requires reset when the network changes
1556 
1557 public:
1560  public:
1562  tls_disable_finder(const TLSDisabledConnection& tpl) : myDefinition(tpl) { }
1563 
1565  bool operator()(const TLSDisabledConnection& e) const {
1566  if (e.to != myDefinition.to) {
1567  return false;
1568  }
1569  if (e.fromLane != myDefinition.fromLane) {
1570  return false;
1571  }
1572  if (e.toLane != myDefinition.toLane) {
1573  return false;
1574  }
1575  return true;
1576  }
1577 
1578  private:
1581 
1582  private:
1585  };
1586 
1587 
1590  public:
1592  connections_toedge_finder(const NBEdge* const edge2find, bool hasFromLane = false) :
1593  myHasFromLane(hasFromLane),
1594  myEdge2Find(edge2find) { }
1595 
1597  bool operator()(const Connection& c) const {
1598  return c.toEdge == myEdge2Find && (!myHasFromLane || c.fromLane != -1);
1599  }
1600 
1601  private:
1603  const bool myHasFromLane;
1604 
1606  const NBEdge* const myEdge2Find;
1607 
1608  private:
1611  };
1612 
1615  public:
1617  connections_toedgelane_finder(NBEdge* const edge2find, int lane2find, int fromLane2find) :
1618  myEdge2Find(edge2find),
1619  myLane2Find(lane2find),
1620  myFromLane2Find(fromLane2find) { }
1621 
1623  bool operator()(const Connection& c) const {
1624  return c.toEdge == myEdge2Find && c.toLane == myLane2Find && (myFromLane2Find < 0 || c.fromLane == myFromLane2Find);
1625  }
1626 
1627  private:
1630 
1633 
1636 
1637  private:
1640 
1641  };
1642 
1645  public:
1647  connections_finder(int fromLane, NBEdge* const edge2find, int lane2find, bool invertEdge2find = false) :
1648  myFromLane(fromLane), myEdge2Find(edge2find), myLane2Find(lane2find), myInvertEdge2find(invertEdge2find) { }
1649 
1651  bool operator()(const Connection& c) const {
1652  return ((c.fromLane == myFromLane || myFromLane == -1)
1653  && ((!myInvertEdge2find && c.toEdge == myEdge2Find) || (myInvertEdge2find && c.toEdge != myEdge2Find))
1654  && (c.toLane == myLane2Find || myLane2Find == -1));
1655  }
1656 
1657  private:
1660 
1663 
1666 
1669 
1670  private:
1673 
1674  };
1675 
1678  public:
1680  connections_conflict_finder(int fromLane, NBEdge* const edge2find, bool checkRight) :
1681  myFromLane(fromLane), myEdge2Find(edge2find), myCheckRight(checkRight) { }
1682 
1684  bool operator()(const Connection& c) const {
1685  return (((myCheckRight && c.fromLane < myFromLane) || (!myCheckRight && c.fromLane > myFromLane))
1686  && c.fromLane >= 0 // already assigned
1687  && c.toEdge == myEdge2Find);
1688  }
1689 
1690  private:
1693 
1696 
1699 
1700  private:
1703 
1704  };
1705 
1708  public:
1710  connections_fromlane_finder(int lane2find) : myLane2Find(lane2find) { }
1711 
1713  bool operator()(const Connection& c) const {
1714  return c.fromLane == myLane2Find;
1715  }
1716 
1717  private:
1720 
1721  private:
1724 
1725  };
1726 
1728  static bool connections_sorter(const Connection& c1, const Connection& c2);
1729 
1735  public:
1737  explicit connections_relative_edgelane_sorter(NBEdge* e) : myEdge(e) {}
1738 
1739  public:
1741  int operator()(const Connection& c1, const Connection& c2) const;
1742 
1743  private:
1746  };
1747 
1748 private:
1750  NBEdge(const NBEdge& s);
1751 
1753  NBEdge& operator=(const NBEdge& s);
1754 };
1755 
1756 
1757 #endif
1758 
1759 /****************************************************************************/
1760 
ToEdgeConnectionsAdder(const EdgeVector &transitions)
constructor
Definition: NBEdge.h:1307
bool mayBeTLSControlled(int fromLane, NBEdge *toEdge, int toLane) const
return true if certain connection must be controlled by TLS
Definition: NBEdge.cpp:2705
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge&#39;s lanes&#39; lateral offset is computed.
Definition: NBEdge.h:702
static const PositionVector EMPTY
empty Vector
std::string id
id of Connection
Definition: NBEdge.h:215
void moveConnectionToRight(int lane)
Definition: NBEdge.cpp:1434
void invalidateConnections(bool reallowSetting=false)
invalidate current connections of edge
Definition: NBEdge.cpp:1316
bool bothLeftIntersect(const NBNode &n, const PositionVector &shape, LinkDirection dir, NBEdge *otherFrom, const NBEdge::Connection &otherCon, int numPoints, double width2) const
determine conflict between opposite left turns
Definition: NBEdge.cpp:1726
bool expandableBy(NBEdge *possContinuation, std::string &reason) const
Check if Node is expandable.
Definition: NBEdge.cpp:2839
void init(int noLanes, bool tryIgnoreNodePositions, const std::string &origID)
Initialization routines common to all constructors.
Definition: NBEdge.cpp:418
void appendTurnaround(bool noTLSControlled, bool onlyDeadends, bool checkPermissions)
Add a connection to the previously computed turnaround, if wished.
Definition: NBEdge.cpp:2608
static const bool UNSPECIFIED_CONNECTION_UNCONTROLLED
TLS-controlled despite its node controlled not specified.
Definition: NBEdge.h:283
std::vector< Lane > myLanes
Lane information.
Definition: NBEdge.h:1511
double vmax
maximum velocity
Definition: NBEdge.h:221
double getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:486
double getAngleAtNodeToCenter(const NBNode *const node) const
Returns the angle of from the node shape center to where the edge meets the node shape.
Definition: NBEdge.cpp:1781
bool setControllingTLInformation(const NBConnection &c, const std::string &tlID)
Returns if the link could be set as to be controlled.
Definition: NBEdge.cpp:2716
void divideOnEdges(const EdgeVector *outgoing)
divides the lanes on the outgoing edges
Definition: NBEdge.cpp:2232
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:160
int getFirstAllowedLaneIndex(int direction) const
return the first lane that permits at least 1 vClass or the last lane if search direction of there is...
Definition: NBEdge.cpp:3358
int toLane
The lane the connections yields in.
Definition: NBEdge.h:188
A class representing a single street sign.
Definition: NBSign.h:44
void debugPrintConnections(bool outgoing=true, bool incoming=false) const
debugging helper to print all connections
Definition: NBEdge.cpp:3606
connections_conflict_finder(int fromLane, NBEdge *const edge2find, bool checkRight)
constructor
Definition: NBEdge.h:1680
PositionVector shape
The lane&#39;s shape.
Definition: NBEdge.h:121
static const double UNSPECIFIED_LOADED_LENGTH
no length override given
Definition: NBEdge.h:271
std::vector< TLSDisabledConnection > myTLSDisabledConnections
vector with the disabled connections
Definition: NBEdge.h:1530
const std::map< int, double > & getStopOffsets() const
Returns the stopOffset to the end of the edge.
Definition: NBEdge.h:560
connections_relative_edgelane_sorter(NBEdge *e)
constructor
Definition: NBEdge.h:1737
~NBEdge()
Destructor.
Definition: NBEdge.cpp:489
LaneSpreadFunction myLaneSpreadFunction
The information about how to spread the lanes.
Definition: NBEdge.h:1494
void sortOutgoingConnectionsByAngle()
sorts the outgoing connections by their angle relative to their junction
Definition: NBEdge.cpp:1221
std::string viaID
if Connection have a via, ID of it
Definition: NBEdge.h:227
void addSign(NBSign sign)
add Sign
Definition: NBEdge.h:1236
NBEdge * toEdge
The edge the connections yields in.
Definition: NBEdge.h:185
EdgeVector getIncomingEdges() const
Returns the list of incoming edges unsorted.
Definition: NBEdge.cpp:1194
void mirrorX()
mirror coordinates along the x-axis
Definition: NBEdge.cpp:507
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
NBNode * myTo
Definition: NBEdge.h:1452
static const double UNSPECIFIED_VISIBILITY_DISTANCE
unspecified foe visibility for connections
Definition: NBEdge.h:268
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3190
bool setConnection(int lane, NBEdge *destEdge, int destLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE, double speed=UNSPECIFIED_SPEED, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED)
Adds a connection to a certain lane of a certain edge.
Definition: NBEdge.cpp:1010
The relationships between edges are computed/loaded.
Definition: NBEdge.h:88
double getLaneSpeed(int lane) const
get lane speed
Definition: NBEdge.cpp:1805
bool hasPermissions() const
whether at least one lane has restrictions
Definition: NBEdge.cpp:1935
bool isConnectedTo(const NBEdge *e) const
Returns the information whethe a connection to the given edge has been added (or computed) ...
Definition: NBEdge.cpp:1132
void reduceGeometry(const double minDist)
Removes points with a distance lesser than the given.
Definition: NBEdge.cpp:890
bool hasSignalisedConnectionTo(const NBEdge *const e) const
Check if edge has signalised connections.
Definition: NBEdge.cpp:2970
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1713
NBEdge(const std::string &id, NBNode *from, NBNode *to, std::string type, double speed, int nolanes, int priority, double width, double endOffset, const std::string &streetName="", LaneSpreadFunction spread=LANESPREAD_RIGHT)
Constructor.
Definition: NBEdge.cpp:254
std::vector< std::pair< const NBEdge *, const NBEdge * > > NBConstEdgePairVector
Definition: NBCont.h:43
double myLaneWidth
This width of this edge&#39;s lanes.
Definition: NBEdge.h:1506
std::map< int, double > myStopOffsets
A vClass specific stop offset - assumed of length 0 (unspecified) or 1. For the latter case the int i...
Definition: NBEdge.h:1503
std::vector< NBSign > mySigns
the street signs along this edge
Definition: NBEdge.h:1536
double myEndOffset
This edges&#39;s offset to the intersection begin (will be applied to all lanes)
Definition: NBEdge.h:1497
void addLane(int index, bool recomputeShape, bool recomputeConnections, bool shiftIndices)
add lane
Definition: NBEdge.cpp:3010
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3240
Holds (- relative to the edge it is build from -!!!) the list of main directions a vehicle that drive...
Definition: NBEdge.h:1337
double getSignalOffset() const
Returns the offset of a traffic signal from the end of this edge.
Definition: NBEdge.h:575
static const double ANGLE_LOOKAHEAD
the distance at which to take the default angle
Definition: NBEdge.h:277
int myLane2Find
lane to find
Definition: NBEdge.h:1665
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
Definition: NBEdge.cpp:1749
void moveConnectionToLeft(int lane)
Definition: NBEdge.cpp:1419
~ToEdgeConnectionsAdder()
destructor
Definition: NBEdge.h:1311
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:425
const std::string & getTypeID() const
get ID of type
Definition: NBEdge.h:1002
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::vector< NBSign > & getSigns() const
get Signs
Definition: NBEdge.h:1231
int myFromLane2Find
from lane to find
Definition: NBEdge.h:1635
std::map< NBEdge *, std::vector< int > > myConnections
map of edges to this edge&#39;s lanes that reach them
Definition: NBEdge.h:1300
The representation of a single edge during network building.
Definition: NBEdge.h:65
void reinitNodes(NBNode *from, NBNode *to)
Resets nodes but keeps all other values the same (used when joining)
Definition: NBEdge.cpp:392
void clearControllingTLInformation()
clears tlID for all connections
Definition: NBEdge.cpp:2781
void setNodeBorder(const NBNode *node, const Position &p, const Position &p2, bool rectangularCut)
Set Node border.
Definition: NBEdge.cpp:603
Lane2LaneInfoType
Modes of setting connections between lanes.
Definition: NBEdge.h:103
std::vector< int > * prepareEdgePriorities(const EdgeVector *outgoing)
recomputes the edge priorities and manipulates them for a distribution of lanes on edges which is mor...
Definition: NBEdge.cpp:2508
Lane(NBEdge *e, const std::string &_origID)
constructor
Definition: NBEdge.cpp:126
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
Definition: NBEdge.cpp:1960
static const double UNSPECIFIED_SIGNAL_OFFSET
unspecified signal offset
Definition: NBEdge.h:274
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition: NBEdge.cpp:650
void setStreetName(const std::string &name)
sets the street name of this edge
Definition: NBEdge.h:546
std::vector< Direction > myDirs
list of the main direction within the following junction relative to the edge
Definition: NBEdge.h:1343
void markAsInLane2LaneState()
mark edge as in lane to state lane
Definition: NBEdge.cpp:3096
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:259
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false, const bool adaptToLaneRemoval=false)
Removes the specified connection(s)
Definition: NBEdge.cpp:1249
double getMaxLaneOffset()
get max lane offset
Definition: NBEdge.cpp:2699
TLS Disabled Connections.
Definition: NBEdge.h:1523
bool isInnerEdge() const
Returns whether this edge was marked as being within an intersection.
Definition: NBEdge.h:972
Lanes to lanes - relationships are computed; should be recheked.
Definition: NBEdge.h:92
double length
computed length (average of all internal lane shape lengths that share an internal edge) ...
Definition: NBEdge.h:251
bool hasLoadedLength() const
Returns whether a length was set explicitly.
Definition: NBEdge.h:505
NBEdge * getTurnDestination(bool possibleDestination=false) const
Definition: NBEdge.cpp:2981
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given ...
Definition: NBEdge.cpp:3271
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:47
int myFromJunctionPriority
The priority normalised for the node the edge is outgoing of.
Definition: NBEdge.h:1485
void setLoadedLength(double val)
set loaded lenght
Definition: NBEdge.cpp:3314
void computeLaneShapes()
compute lane shapes
Definition: NBEdge.cpp:1811
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:587
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:197
tls_disable_finder(const TLSDisabledConnection &tpl)
constructor
Definition: NBEdge.h:1562
double endOffset
This lane&#39;s offset to the intersection begin.
Definition: NBEdge.h:133
PositionVector myGeom
The geometry for the edge.
Definition: NBEdge.h:1491
double visibility
custom foe visiblity for connection
Definition: NBEdge.h:206
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1597
void remapConnections(const EdgeVector &incoming)
Remaps the connection in a way that allows the removal of it.
Definition: NBEdge.cpp:1233
const NBEdge *const myEdge2Find
edge to find
Definition: NBEdge.h:1606
bool connectionsDone
Whether connection information for this lane is already completed.
Definition: NBEdge.h:150
std::vector< int > getConnectionLanes(NBEdge *currentOutgoing) const
Returns the list of lanes that may be used to reach the given edge.
Definition: NBEdge.cpp:1207
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1204
PositionVector myFromBorder
intersection borders (because the node shape might be invalid)
Definition: NBEdge.h:1543
void restoreBikelane(std::vector< NBEdge::Lane > oldLanes, PositionVector oldGeometry, std::vector< NBEdge::Connection > oldConnections)
restore an previously added BikeLane
Definition: NBEdge.cpp:3444
bool isRailDeadEnd() const
whether this edge is a railway edge that does not continue
Definition: NBEdge.cpp:661
bool setStopOffsets(int lane, std::map< int, double > offsets, bool overwrite=false)
set lane and vehicle class specific stopOffset (negative lane implies set for all lanes) ...
Definition: NBEdge.cpp:3206
void addSidewalk(double width)
add a pedestrian sidewalk of the given width and shift existing connctions
Definition: NBEdge.cpp:3426
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge&#39;s geometry
Definition: NBEdge.cpp:552
bool hasLaneSpecificStopOffsets() const
whether lanes differ in stopOffsets
Definition: NBEdge.cpp:1993
double getShapeStartAngle() const
Returns the angle at the start of the edge.
Definition: NBEdge.cpp:1919
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:256
const EdgeVector & myTransitions
the transition from the virtual lane to the edge it belongs to
Definition: NBEdge.h:1303
void assignInternalLaneLength(std::vector< Connection >::iterator i, int numLanes, double lengthSum)
assign length to all lanes of an internal edge
Definition: NBEdge.cpp:1688
PositionVector customShape
custom shape for connection
Definition: NBEdge.h:212
The connection was computed and validated.
Definition: NBEdge.h:109
bool hasDefaultGeometryEndpoints() const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
Definition: NBEdge.cpp:534
void shortenGeometryAtNode(const NBNode *node, double reduction)
linearly extend the geometry at the given node
Definition: NBEdge.cpp:589
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
Definition: NBEdge.cpp:3263
bool accelRamp
Whether this lane is an acceleration lane.
Definition: NBEdge.h:146
void setAcceleration(int lane, bool accelRamp)
marks one lane as acceleration lane
Definition: NBEdge.cpp:3255
PositionVector cutAtIntersection(const PositionVector &old) const
cut shape at the intersection shapes
Definition: NBEdge.cpp:676
The edge has been loaded, nothing is computed yet.
Definition: NBEdge.h:86
NBNode * tryGetNodeAtPosition(double pos, double tolerance=5.0) const
Returns the node at the given edges length (using an epsilon)
Definition: NBEdge.cpp:2665
int getFirstNonPedestrianLaneIndex(int direction, bool exclusive=false) const
return the first lane with permissions other than SVC_PEDESTRIAN and 0
Definition: NBEdge.cpp:3341
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
bool myInvertEdge2find
invert edge to find
Definition: NBEdge.h:1668
int myToJunctionPriority
The priority normalised for the node the edge is incoming in.
Definition: NBEdge.h:1488
PositionVector shape
shape of Connection
Definition: NBEdge.h:218
static const double UNSPECIFIED_SPEED
unspecified lane speed
Definition: NBEdge.h:262
void restoreSidewalk(std::vector< NBEdge::Lane > oldLanes, PositionVector oldGeometry, std::vector< NBEdge::Connection > oldConnections)
restore an previously added sidewalk
Definition: NBEdge.cpp:3432
bool addLane2LaneConnection(int fromLane, NBEdge *dest, int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE, double speed=UNSPECIFIED_SPEED, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED)
Adds a connection between the specified this edge&#39;s lane and an approached one.
Definition: NBEdge.cpp:966
bool keepClear
whether the junction must be kept clear when using this connection
Definition: NBEdge.h:200
void addRestrictedLane(double width, SUMOVehicleClass vclass)
add a lane of the given width, restricted to the given class and shift existing connections ...
Definition: NBEdge.cpp:3450
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1085
An (internal) definition of a single lane of an edge.
Definition: NBEdge.h:116
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
Definition: NBEdge.h:127
bool addEdge2EdgeConnection(NBEdge *dest)
Adds a connection to another edge.
Definition: NBEdge.cpp:942
void incLaneNo(int by)
increment lane
Definition: NBEdge.cpp:3053
bool myAmMacroscopicConnector
Information whether this edge is a (macroscopic) connector.
Definition: NBEdge.h:1520
bool computeLanes2Edges()
computes the edge, step2: computation of which lanes approach the edges)
Definition: NBEdge.cpp:2079
NBEdge * myTurnDestination
The turn destination edge (if a connection exists)
Definition: NBEdge.h:1479
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1623
double myStartAngle
The angles of the edge.
Definition: NBEdge.h:1459
bool hasLaneSpecificWidth() const
whether lanes differ in width
Definition: NBEdge.cpp:1971
connections_finder(int fromLane, NBEdge *const edge2find, int lane2find, bool invertEdge2find=false)
constructor
Definition: NBEdge.h:1647
double speed
custom speed for connection
Definition: NBEdge.h:209
Lanes to lanes - relationships are loaded; no recheck is necessary/wished.
Definition: NBEdge.h:96
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
Definition: NBEdge.cpp:1982
void addCrossingPointsAsIncomingWithGivenOutgoing(NBEdge *o, PositionVector &into)
add crossing points as incoming with given outgoing
~Connection()
destructor
Definition: NBEdge.h:179
bool hasDefaultGeometryEndpointAtNode(const NBNode *node) const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
Definition: NBEdge.cpp:541
void decLaneNo(int by)
decrement lane
Definition: NBEdge.cpp:3084
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBEdge.h:191
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
Definition: NBEdge.h:130
std::string getLaneID(int lane) const
get Lane ID (Secure)
Definition: NBEdge.cpp:2990
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:418
int fromLane
The lane the connections starts at.
Definition: NBEdge.h:182
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
TLSDisabledConnection myDefinition
definition of disable connection
Definition: NBEdge.h:1580
NBEdge & operator=(const NBEdge &s)
invalidated assignment operator
A list of positions.
int getNumericalID() const
Returns the index (numeric id) of the edge.
Definition: NBEdge.h:1277
bool addLane2LaneConnections(int fromLane, NBEdge *dest, int toLane, int no, Lane2LaneInfoType type, bool invalidatePrevious=false, bool mayDefinitelyPass=false)
Builds no connections starting at the given lanes.
Definition: NBEdge.cpp:993
void setOrigID(const std::string origID)
set origID for all lanes
Definition: NBEdge.cpp:3556
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition: NBEdge.cpp:522
void moveOutgoingConnectionsFrom(NBEdge *e, int laneOff)
move outgoing connection
Definition: NBEdge.cpp:2679
static int computePrioritySum(const std::vector< int > &priorities)
computes the sum of the given list&#39;s entries (sic!)
Definition: NBEdge.cpp:2598
static bool connections_sorter(const Connection &c1, const Connection &c2)
connections_sorter sort by fromLane, toEdge and toLane
Definition: NBEdge.cpp:3329
void resetNodeBorder(const NBNode *node)
Definition: NBEdge.cpp:639
static const double UNSPECIFIED_CONTPOS
unspecified internal junction position
Definition: NBEdge.h:265
bool needsLaneSpecificOutput() const
whether at least one lane has values differing from the edges values
Definition: NBEdge.cpp:2039
connections_toedge_finder(const NBEdge *const edge2find, bool hasFromLane=false)
constructor
Definition: NBEdge.h:1592
std::vector< Connection > & getConnections()
Returns the connections.
Definition: NBEdge.h:872
const Lane & getLaneStruct(int lane) const
Definition: NBEdge.h:1211
void deleteLane(int index, bool recompute, bool shiftIndices)
delete lane
Definition: NBEdge.cpp:3064
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
Definition: NBEdge.cpp:1126
EdgeBuildingStep
Current state of the edge within the building process.
Definition: NBEdge.h:82
bool operator()(const TLSDisabledConnection &e) const
operator ()
Definition: NBEdge.h:1565
NBEdge * myPossibleTurnDestination
The edge that would be the turn destination if there was one.
Definition: NBEdge.h:1482
void setAsMacroscopicConnector()
Definition: NBEdge.h:953
bool hasDefaultGeometry() const
Returns whether the geometry consists only of the node positions.
Definition: NBEdge.cpp:528
void setSignalOffset(double offset)
sets the offset of a traffic signal from the end of this edge
Definition: NBEdge.h:580
static int getLaneIndexFromLaneID(const std::string laneID)
Definition: NBEdge.cpp:3625
int myPriority
The priority of the edge.
Definition: NBEdge.h:1465
static double firstIntersection(const PositionVector &v1, const PositionVector &v2, double width2)
compute the first intersection point between the given lane geometries considering their rspective wi...
Definition: NBEdge.cpp:1700
NBConstEdgePairVector myViaSuccessors
Definition: NBEdge.h:1555
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
std::string getSidewalkID()
get the lane id for the canonical sidewalk lane
Definition: NBEdge.cpp:3410
EdgeBuildingStep myStep
The building step.
Definition: NBEdge.h:1446
EdgeBuildingStep getStep() const
The building step of this edge.
Definition: NBEdge.h:521
const bool myHasFromLane
check if has from lane
Definition: NBEdge.h:1603
const std::string & getStreetName() const
Returns the street name of this edge.
Definition: NBEdge.h:541
double getAngleAtNode(const NBNode *const node) const
Returns the angle of the edge&#39;s geometry at the given node.
Definition: NBEdge.cpp:1769
Class to sort edges by their angle.
Definition: NBEdge.h:1734
A vehicle as used by router.
Definition: NBVehicle.h:44
void buildInnerEdges(const NBNode &n, int noInternalNoSplits, int &linkIndex, int &splitIndex)
Definition: NBEdge.cpp:1447
double myTotalAngle
Definition: NBEdge.h:1461
PositionVector getCWBoundaryLine(const NBNode &n) const
get the outer boundary of this edge when going clock-wise around the given node
Definition: NBEdge.cpp:2799
double getEndOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:553
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1473
PositionVector startShapeAt(const PositionVector &laneShape, const NBNode *startNode, PositionVector nodeShape) const
Definition: NBEdge.cpp:757
std::string getLaneIDInsecure(int lane) const
get Lane ID (Insecure)
Definition: NBEdge.cpp:2996
connections_fromlane_finder(int lane2find)
Definition: NBEdge.h:1710
The connection was given by the user.
Definition: NBEdge.h:107
An upper class for objects with additional parameters.
Definition: Parameterised.h:44
double speed
The speed allowed on this lane.
Definition: NBEdge.h:124
double width
This lane&#39;s width.
Definition: NBEdge.h:140
std::set< SVCPermissions > getPermissionVariants(int iStart, int iEnd) const
return all permission variants within the specified lane range [iStart, iEnd[
Definition: NBEdge.cpp:3372
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3299
bool lanesWereAssigned() const
Check if lanes were assigned.
Definition: NBEdge.cpp:2693
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:3543
bool myAmInnerEdge
Information whether this is a junction-inner edge.
Definition: NBEdge.h:1517
int myIndex
the index of the edge in the list of all edges. Set by NBEdgeCont and requires re-set whenever the li...
Definition: NBEdge.h:1549
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:194
bool hasLaneSpecificPermissions() const
whether lanes differ in allowed vehicle classes
Definition: NBEdge.cpp:1946
Base class for objects which have an id.
Definition: Named.h:49
double myEndAngle
Definition: NBEdge.h:1460
bool recheckLanes()
recheck whether all lanes within the edge are all right and optimises the connections once again ...
Definition: NBEdge.cpp:2103
int myLane2Find
index of lane to find
Definition: NBEdge.h:1719
bool hasLaneParams() const
whether one of the lanes has parameters set
Definition: NBEdge.cpp:2029
void reinit(NBNode *from, NBNode *to, const std::string &type, double speed, int nolanes, int priority, PositionVector geom, double width, double endOffset, const std::string &streetName, LaneSpreadFunction spread=LANESPREAD_RIGHT, bool tryIgnoreNodePositions=false)
Resets initial values.
Definition: NBEdge.cpp:344
double mySpeed
The maximal speed.
Definition: NBEdge.h:1468
double getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:512
int internalLaneIndex
The lane index of this internal lane within the internal edge.
Definition: NBEdge.h:239
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:620
void extendGeometryAtNode(const NBNode *node, double maxExtent)
linearly extend the geometry at the given node
Definition: NBEdge.cpp:566
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
bool myCheckRight
check if is right
Definition: NBEdge.h:1698
JunctionPriority
junction priority values set by setJunctionPriority
Definition: NBEdge.h:286
Connection getConnection(int fromLane, const NBEdge *to, int toLane) const
Returns the specified connection This method goes through "myConnections" and returns the specified o...
Definition: NBEdge.cpp:1097
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:528
double getTotalAngle() const
Returns the angle at the start of the edge.
Definition: NBEdge.h:479
void setTurningDestination(NBEdge *e, bool onlyPossible=false)
Sets the turing destination at the given edge.
Definition: NBEdge.cpp:1796
int myFromLane
index of from lane
Definition: NBEdge.h:1659
void computeEdgeShape()
Recomputeds the lane shapes to terminate at the node shape For every lane the intersection with the f...
Definition: NBEdge.cpp:742
void addStraightConnections(const EdgeVector *outgoing, const std::vector< int > &availableLanes, const std::vector< int > *priorities)
add some straight connections
Definition: NBEdge.cpp:2426
void disableConnection4TLS(int fromLane, NBEdge *toEdge, int toLane)
disable connections for TLS
Definition: NBEdge.cpp:2789
PositionVector viaShape
shape of via
Definition: NBEdge.h:230
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:143
bool hasAccelLane() const
whether one of the lanes is an acceleration lane
Definition: NBEdge.cpp:2007
EdgeVector mySuccessors
Definition: NBEdge.h:1552
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:823
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:865
PositionVector myToBorder
Definition: NBEdge.h:1544
std::map< int, double > stopOffsets
stopOffsets.second - The stop offset for vehicles stopping at the lane&#39;s end. Applies if vClass is in...
Definition: NBEdge.h:137
double getCrossingAngle(NBNode *node)
return the angle for computing pedestrian crossings at the given node
Definition: NBEdge.cpp:3385
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:34
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
Definition: NBEdge.cpp:3166
static const int UNSPECIFIED_INTERNAL_LANE_INDEX
internal lane computation not yet done
Definition: NBEdge.h:280
NBEdge * myEdge
the edge to compute the relative angle of
Definition: NBEdge.h:1745
void setPreferredVehicleClass(SVCPermissions permissions, int lane=-1)
set preferred Vehicle Class
Definition: NBEdge.cpp:3285
double mySignalOffset
the offset of a traffic light signal from the end of this edge (-1 for None)
Definition: NBEdge.h:1539
The edge has been loaded and connections shall not be added.
Definition: NBEdge.h:84
bool hasCustomLaneShape() const
whether one of the lanes has a custom shape
Definition: NBEdge.cpp:2018
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1684
std::vector< Connection > myConnectionsToDelete
List of connections marked for delayed removal.
Definition: NBEdge.h:1476
double contPos
custom position for internal junction on this connection
Definition: NBEdge.h:203
std::vector< std::string > foeIncomingLanes
FOE Incomings lanes.
Definition: NBEdge.h:236
bool uncontrolled
check if Connection is uncontrolled
Definition: NBEdge.h:242
connections_toedgelane_finder(NBEdge *const edge2find, int lane2find, int fromLane2find)
constructor
Definition: NBEdge.h:1617
void setJunctionPriority(const NBNode *const node, int prio)
Sets the junction priority of the edge.
Definition: NBEdge.cpp:1759
void addBikeLane(double width)
add a bicycle lane of the given width and shift existing connctions
Definition: NBEdge.cpp:3438
const EdgeVector * getConnectedSorted()
Returns the list of outgoing edges without the turnaround sorted in clockwise direction.
Definition: NBEdge.cpp:1145
static double getTravelTimeStatic(const NBEdge *const edge, const NBVehicle *const, double)
Definition: NBEdge.h:1262
NBEdge *const myEdge2Find
edge to find
Definition: NBEdge.h:1662
void setIsInnerEdge()
Marks this edge being within an intersection.
Definition: NBEdge.h:965
void restoreRestrictedLane(SUMOVehicleClass vclass, std::vector< NBEdge::Lane > oldLanes, PositionVector oldGeometry, std::vector< NBEdge::Connection > oldConnections)
restore a restricted lane
Definition: NBEdge.cpp:3484
void sortOutgoingConnectionsByIndex()
sorts the outgoing connections by their from-lane-index and their to-lane-index
Definition: NBEdge.cpp:1227
NBEdge *const myEdge2Find
edge to find
Definition: NBEdge.h:1629
std::string myType
The type of the edge.
Definition: NBEdge.h:1449
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge&#39;s lateral offset shal...
void append(NBEdge *continuation)
append another edge
Definition: NBEdge.cpp:2935
double getStartAngle() const
Returns the angle at the start of the edge (relative to the node shape center) The angle is computed ...
Definition: NBEdge.h:448
bool isTurningDirectionAt(const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
Definition: NBEdge.cpp:2652
void declareConnectionsAsLoaded(EdgeBuildingStep step=LANES2LANES_USER)
declares connections as fully loaded. This is needed to avoid recomputing connections if an edge has ...
Definition: NBEdge.h:1218
The connection was computed.
Definition: NBEdge.h:105
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1651
Represents a single node (junction) during network building.
Definition: NBNode.h:68
void dismissVehicleClassInformation()
dimiss vehicle class information
Definition: NBEdge.cpp:3320
Lanes to lanes - relationships are computed; no recheck is necessary/wished.
Definition: NBEdge.h:94
const NBConstEdgePairVector & getViaSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges for the given vClass.
Definition: NBEdge.cpp:3589
void replaceInConnections(NBEdge *which, NBEdge *by, int laneOff)
replace in current connections of edge
Definition: NBEdge.cpp:1328
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
Definition: NBEdge.cpp:1182
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
Direction
enum of possible directions
Definition: NBEdge.h:1340
const EdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges for the given vClass.
Definition: NBEdge.cpp:3571
void preferVehicleClass(int lane, SUMOVehicleClass vclass)
prefer certain vehicle class
Definition: NBEdge.cpp:3129
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:960
void checkGeometry(const double maxAngle, const double minRadius, bool fix)
Check the angles of successive geometry segments.
Definition: NBEdge.cpp:896
void allowVehicleClass(int lane, SUMOVehicleClass vclass)
set allowed class for the given lane or for all lanes if -1 is given
Definition: NBEdge.cpp:3103
void insertConnection(NBEdge::Connection connection)
insert a previously created NBEdge::connection
Definition: NBEdge.cpp:1079
void addGeometryPoint(int index, const Position &p)
Adds a further geometry point.
Definition: NBEdge.cpp:835
void shiftToLanesToEdge(NBEdge *to, int laneOff)
modifify the toLane for all connections to the given edge
Definition: NBEdge.cpp:3507
void computeAngle()
computes the angle of this edge and stores it in myAngle
Definition: NBEdge.cpp:1867
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:432
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
bool computeEdge2Edges(bool noLeftMovers)
computes the edge (step1: computation of approached edges)
Definition: NBEdge.cpp:2054
PositionVector getCCWBoundaryLine(const NBNode &n) const
get the outer boundary of this edge when going counter-clock-wise around the given node ...
Definition: NBEdge.cpp:2819
int myFromLane
index of from lane
Definition: NBEdge.h:1692
bool haveVia
check if Connection have a Via
Definition: NBEdge.h:224
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn&#39;t set.
Definition: NBEdge.h:495
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
Definition: NBEdge.cpp:829
double myLength
The length of the edge.
Definition: NBEdge.h:1455
void divideSelectedLanesOnEdges(const EdgeVector *outgoing, const std::vector< int > &availableLanes, const std::vector< int > *priorities)
divide selected lanes on edges
Definition: NBEdge.cpp:2312
PositionVector computeLaneShape(int lane, double offset) const
Computes the shape for the given lane.
Definition: NBEdge.cpp:1855
double getShapeEndAngle() const
Returns the angle at the end of the edge.
Definition: NBEdge.cpp:1927
double myLoadedLength
An optional length to use (-1 if not valid)
Definition: NBEdge.h:1514
Lanes to edges - relationships are computed/loaded.
Definition: NBEdge.h:90
std::string myStreetName
The street name (or whatever arbitrary string you wish to attach)
Definition: NBEdge.h:1533
PositionVector customShape
A custom shape for this lane set by the user.
Definition: NBEdge.h:153
NBNode * myFrom
The source and the destination node.
Definition: NBEdge.h:1452
bool canMoveConnection(const Connection &con, int newFromLane) const
whether the connection can originate on newFromLane
Definition: NBEdge.cpp:1410
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:1111
bool isNearEnough2BeJoined2(NBEdge *e, double threshold) const
Check if edge is near enought to be joined to another edge.
Definition: NBEdge.cpp:3002
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:439
std::vector< int > foeInternalLinks
FOE Internal links.
Definition: NBEdge.h:233
void setNumericalID(int index)
sets the index of the edge in the list of all network edges
Definition: NBEdge.h:1269
void shiftPositionAtNode(NBNode *node, NBEdge *opposite)
shift geometry at the given node to avoid overlap
Definition: NBEdge.cpp:3518
NBEdge *const myEdge2Find
edge to find
Definition: NBEdge.h:1695
vehicles ignoring classes
void disallowVehicleClass(int lane, SUMOVehicleClass vclass)
set disallowed class for the given lane or for all lanes if -1 is given
Definition: NBEdge.cpp:3116
void copyConnectionsFrom(NBEdge *src)
copy connections from antoher edge
Definition: NBEdge.cpp:1403
A class that being a bresenham-callback assigns the incoming lanes to the edges.
Definition: NBEdge.h:1297
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3142
double getEndAngle() const
Returns the angle at the end of the edge (relative to the node shape center) The angle is computed in...
Definition: NBEdge.h:457
void reshiftPosition(double xoff, double yoff)
Applies an offset to the edge.
Definition: NBEdge.cpp:494
const std::map< NBEdge *, std::vector< int > > & getBuiltConnections() const
get built connections
Definition: NBEdge.h:1317
NBEdge::Lane getFirstNonPedestrianLane(int direction) const
get first non-pedestrian lane
Definition: NBEdge.cpp:3401
bool splitGeometry(NBEdgeCont &ec, NBNodeCont &nc)
Splits this edge at geometry points.
Definition: NBEdge.cpp:845