Eclipse 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-2019 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 NBRouterEdge {
66 public:
67  virtual const std::string& getID() const = 0;
68  virtual double getSpeed() const = 0;
69  virtual double getLength() const = 0;
70  virtual int getNumericalID() const = 0;
72  virtual bool isInternal() const {
73  return false;
74  }
75 
76  static inline double getTravelTimeStatic(const NBRouterEdge* const edge, const NBVehicle* const /*veh*/, double /*time*/) {
77  return edge->getLength() / edge->getSpeed();
78  }
79 };
80 
81 
86 class NBEdge : public Named, public Parameterised, public NBRouterEdge {
87  friend class NBEdgeCont;
88 
90  friend class GNELane;
91  friend class GNEEdge;
92  friend class GNEJunction;
93 
94 public:
95 
117  LANES2LANES_USER
118  };
119 
120 
130  L2L_VALIDATED
131  };
132 
133 
137  struct Lane final : public Parameterised {
139  Lane(NBEdge* e, const std::string& _origID);
140 
143 
145  double speed;
146 
149 
152 
154  double endOffset;
155 
158  std::map<int, double> stopOffsets;
159 
161  double width;
162 
164  std::string oppositeID;
165 
167  bool accelRamp;
168 
170  // @note (see NIImporter_DlrNavteq::ConnectedLanesHandler)
172 
175 
177  std::string type;
178  };
179 
180 
184  struct Connection final : public Parameterised, public NBRouterEdge {
190  Connection(int fromLane_, NBEdge* toEdge_, int toLane_);
191 
193  Connection(int fromLane_, NBEdge* toEdge_, int toLane_, bool mayDefinitelyPass_,
194  bool keepClear_ = true,
195  double contPos_ = UNSPECIFIED_CONTPOS,
196  double visibility_ = UNSPECIFIED_VISIBILITY_DISTANCE,
197  double speed_ = UNSPECIFIED_SPEED,
198  bool haveVia_ = false,
199  bool uncontrolled_ = false,
200  const PositionVector& customShape_ = PositionVector::EMPTY);
201 
203  int fromLane;
204 
207 
209  int toLane;
210 
212  std::string tlID;
213 
216 
219 
221  bool keepClear;
222 
224  double contPos;
225 
227  double visibility;
228 
230  double speed;
231 
234 
236  std::string id;
237 
240 
242  double vmax;
243 
245  bool haveVia;
246 
248  std::string viaID;
249 
252 
254  std::vector<int> foeInternalLinks;
255 
257  std::vector<std::string> foeIncomingLanes;
258 
261 
264 
266  std::string getInternalLaneID() const;
267 
269  std::string getDescription(const NBEdge* parent) const;
270 
272  double length;
273 
277  const std::string& getID() const {
278  return id;
279  }
280  double getSpeed() const {
281  return vmax;
282  }
283  double getLength() const {
284  return shape.length() + viaShape.length();
285  }
286  int getNumericalID() const {
287  throw ProcessError("NBEdge::Connection does not implement getNumericalID()");
288  }
289  bool isInternal() const {
290  return true;
291  }
293  UNUSED_PARAMETER(vClass);
294  return myViaSuccessors;
295  }
297  };
298 
301 
303  static const double UNSPECIFIED_WIDTH;
304 
306  static const double UNSPECIFIED_OFFSET;
307 
309  static const double UNSPECIFIED_SPEED;
310 
312  static const double UNSPECIFIED_CONTPOS;
313 
315  static const double UNSPECIFIED_VISIBILITY_DISTANCE;
316 
318  static const double UNSPECIFIED_LOADED_LENGTH;
319 
321  static const double UNSPECIFIED_SIGNAL_OFFSET;
322 
324  static const double ANGLE_LOOKAHEAD;
325 
328 
331 
334  MINOR_ROAD = 0,
335  PRIORITY_ROAD = 1,
336  ROUNDABOUT = 1000
337  };
338 
339 public:
358  NBEdge(const std::string& id,
359  NBNode* from, NBNode* to, std::string type,
360  double speed, int nolanes, int priority,
361  double width, double endOffset,
362  const std::string& streetName = "",
364 
365 
387  NBEdge(const std::string& id,
388  NBNode* from, NBNode* to, std::string type,
389  double speed, int nolanes, int priority,
390  double width, double endOffset,
391  PositionVector geom,
392  const std::string& streetName = "",
393  const std::string& origID = "",
395  bool tryIgnoreNodePositions = false);
396 
408  NBEdge(const std::string& id,
409  NBNode* from, NBNode* to,
410  const NBEdge* tpl,
411  const PositionVector& geom = PositionVector(),
412  int numLanes = -1);
413 
414 
416  ~NBEdge();
417 
418 
434  void reinit(NBNode* from, NBNode* to, const std::string& type,
435  double speed, int nolanes, int priority,
436  PositionVector geom, double width, double endOffset,
437  const std::string& streetName,
439  bool tryIgnoreNodePositions = false);
440 
445  void reinitNodes(NBNode* from, NBNode* to);
446 
449 
453  void reshiftPosition(double xoff, double yoff);
454 
456  void mirrorX();
458 
460 
461 
465  int getNumLanes() const {
466  return (int)myLanes.size();
467  }
468 
472  int getPriority() const {
473  return myPriority;
474  }
475 
479  NBNode* getFromNode() const {
480  return myFrom;
481  }
482 
486  NBNode* getToNode() const {
487  return myTo;
488  }
489 
495  inline double getStartAngle() const {
496  return myStartAngle;
497  }
498 
504  inline double getEndAngle() const {
505  return myEndAngle;
506  }
507 
512  double getShapeStartAngle() const;
513 
514 
520  double getShapeEndAngle() const;
521 
526  inline double getTotalAngle() const {
527  return myTotalAngle;
528  }
529 
533  double getLength() const {
534  return myLength;
535  }
536 
537 
542  double getLoadedLength() const {
543  return myLoadedLength > 0 ? myLoadedLength : myLength;
544  }
545 
547  double getFinalLength() const;
548 
552  bool hasLoadedLength() const {
553  return myLoadedLength > 0;
554  }
555 
559  double getSpeed() const {
560  return mySpeed;
561  }
562 
569  return myStep;
570  }
571 
575  double getLaneWidth() const {
576  return myLaneWidth;
577  }
578 
582  double getLaneWidth(int lane) const;
583 
585  double getTotalWidth() const;
586 
588  const std::string& getStreetName() const {
589  return myStreetName;
590  }
591 
593  void setStreetName(const std::string& name) {
594  myStreetName = name;
595  }
596 
600  double getEndOffset() const {
601  return myEndOffset;
602  }
603 
604  double getDistance() const {
605  return myDistance;
606  }
607 
611  const std::map<int, double>& getStopOffsets() const {
612  return myStopOffsets;
613  }
614 
618  double getEndOffset(int lane) const;
619 
623  const std::map<int, double>& getStopOffsets(int lane) const;
624 
626  double getSignalOffset() const {
627  return mySignalOffset;
628  }
629 
632  return mySignalNode;
633  }
634 
636  void setSignalOffset(double offset, NBNode* signalNode) {
637  mySignalOffset = offset;
638  mySignalNode = signalNode;
639  }
640 
644  const std::vector<NBEdge::Lane>& getLanes() const {
645  return myLanes;
646  }
648 
653  int getFirstNonPedestrianLaneIndex(int direction, bool exclusive = false) const;
654 
656  int getSpecialLane(SVCPermissions permissions) const;
657 
661  int getFirstAllowedLaneIndex(int direction) const;
662 
664  NBEdge::Lane getFirstNonPedestrianLane(int direction) const;
665 
667  std::set<SVCPermissions> getPermissionVariants(int iStart, int iEnd) const;
668 
670  double getCrossingAngle(NBNode* node);
671 
673  std::string getSidewalkID();
674 
676 
677 
680  const PositionVector& getGeometry() const {
681  return myGeom;
682  }
683 
685  const PositionVector getInnerGeometry() const;
686 
688  bool hasDefaultGeometry() const;
689 
695  bool hasDefaultGeometryEndpoints() const;
696 
702  bool hasDefaultGeometryEndpointAtNode(const NBNode* node) const;
703 
714  void setGeometry(const PositionVector& g, bool inner = false);
715 
725  void addGeometryPoint(int index, const Position& p);
726 
728  void extendGeometryAtNode(const NBNode* node, double maxExtent);
729 
731  void shortenGeometryAtNode(const NBNode* node, double reduction);
732 
734  void shiftPositionAtNode(NBNode* node, NBEdge* opposite);
735 
745  void computeEdgeShape(double smoothElevationThreshold = -1);
746 
750  const PositionVector& getLaneShape(int i) const;
751 
756  void setLaneSpreadFunction(LaneSpreadFunction spread);
757 
763  return myLaneSpreadFunction;
764  }
765 
771  bool splitGeometry(NBEdgeCont& ec, NBNodeCont& nc);
772 
776  void reduceGeometry(const double minDist);
777 
783  void checkGeometry(const double maxAngle, const double minRadius, bool fix);
785 
788 
802  bool addEdge2EdgeConnection(NBEdge* dest);
803 
824  bool addLane2LaneConnection(int fromLane, NBEdge* dest,
825  int toLane, Lane2LaneInfoType type,
826  bool mayUseSameDestination = false,
827  bool mayDefinitelyPass = false,
828  bool keepClear = true,
829  double contPos = UNSPECIFIED_CONTPOS,
830  double visibility = UNSPECIFIED_VISIBILITY_DISTANCE,
831  double speed = UNSPECIFIED_SPEED,
832  const PositionVector& customShape = PositionVector::EMPTY,
833  const bool uncontrolled = UNSPECIFIED_CONNECTION_UNCONTROLLED);
834 
852  bool addLane2LaneConnections(int fromLane,
853  NBEdge* dest, int toLane, int no,
854  Lane2LaneInfoType type, bool invalidatePrevious = false,
855  bool mayDefinitelyPass = false);
856 
867  bool setConnection(int lane, NBEdge* destEdge,
868  int destLane,
869  Lane2LaneInfoType type,
870  bool mayUseSameDestination = false,
871  bool mayDefinitelyPass = false,
872  bool keepClear = true,
873  double contPos = UNSPECIFIED_CONTPOS,
874  double visibility = UNSPECIFIED_VISIBILITY_DISTANCE,
875  double speed = UNSPECIFIED_SPEED,
876  const PositionVector& customShape = PositionVector::EMPTY,
877  const bool uncontrolled = UNSPECIFIED_CONNECTION_UNCONTROLLED);
878 
889  std::vector<Connection> getConnectionsFromLane(int lane, NBEdge* to = nullptr, int toLane = -1) const;
890 
895  Connection getConnection(int fromLane, const NBEdge* to, int toLane) const;
896 
901  Connection& getConnectionRef(int fromLane, const NBEdge* to, int toLane);
902 
911  bool hasConnectionTo(NBEdge* destEdge, int destLane, int fromLane = -1) const;
912 
919  bool isConnectedTo(const NBEdge* e) const;
920 
924  const std::vector<Connection>& getConnections() const {
925  return myConnections;
926  }
927 
931  std::vector<Connection>& getConnections() {
932  return myConnections;
933  }
934 
938  const EdgeVector* getConnectedSorted();
939 
943  EdgeVector getConnectedEdges() const;
944 
948  EdgeVector getIncomingEdges() const;
949 
953  std::vector<int> getConnectionLanes(NBEdge* currentOutgoing, bool withBikes = true) const;
954 
956  void sortOutgoingConnectionsByAngle();
957 
959  void sortOutgoingConnectionsByIndex();
960 
966  void remapConnections(const EdgeVector& incoming);
967 
975  void removeFromConnections(NBEdge* toEdge, int fromLane = -1, int toLane = -1, bool tryLater = false, const bool adaptToLaneRemoval = false, const bool keepPossibleTurns = false);
976 
978  bool removeFromConnections(NBEdge::Connection connectionToRemove);
979 
981  void invalidateConnections(bool reallowSetting = false);
982 
984  void replaceInConnections(NBEdge* which, NBEdge* by, int laneOff);
985 
987  void replaceInConnections(NBEdge* which, const std::vector<NBEdge::Connection>& origConns);
988 
990  void copyConnectionsFrom(NBEdge* src);
991 
993  void shiftToLanesToEdge(NBEdge* to, int laneOff);
995 
1001  bool isTurningDirectionAt(const NBEdge* const edge) const;
1002 
1007  void setTurningDestination(NBEdge* e, bool onlyPossible = false);
1008 
1013  myAmMacroscopicConnector = true;
1014  }
1015 
1019  bool isMacroscopicConnector() const {
1020  return myAmMacroscopicConnector;
1021  }
1022 
1024  void setInsideTLS() {
1025  myAmInTLS = true;
1026  }
1027 
1031  bool isInsideTLS() const {
1032  return myAmInTLS;
1033  }
1035 
1041  void setJunctionPriority(const NBNode* const node, int prio);
1042 
1052  int getJunctionPriority(const NBNode* const node) const;
1053 
1055  void setLoadedLength(double val);
1056 
1058  void dismissVehicleClassInformation();
1059 
1061  const std::string& getTypeID() const {
1062  return myType;
1063  }
1064 
1066  bool needsLaneSpecificOutput() const;
1067 
1069  bool hasPermissions() const;
1070 
1072  bool hasLaneSpecificPermissions() const;
1073 
1075  bool hasLaneSpecificSpeed() const;
1076 
1078  bool hasLaneSpecificWidth() const;
1079 
1081  bool hasLaneSpecificType() const;
1082 
1084  bool hasLaneSpecificEndOffset() const;
1085 
1087  bool hasLaneSpecificStopOffsets() const;
1088 
1090  bool hasAccelLane() const;
1091 
1093  bool hasCustomLaneShape() const;
1094 
1096  bool hasLaneParams() const;
1097 
1099  bool computeEdge2Edges(bool noLeftMovers);
1100 
1102  bool computeLanes2Edges();
1103 
1105  bool recheckLanes();
1106 
1115  void appendTurnaround(bool noTLSControlled, bool onlyDeadends, bool noGeometryLike, bool checkPermissions);
1116 
1120  NBNode* tryGetNodeAtPosition(double pos, double tolerance = 5.0) const;
1121 
1123  double getMaxLaneOffset();
1124 
1126  bool lanesWereAssigned() const;
1127 
1129  bool mayBeTLSControlled(int fromLane, NBEdge* toEdge, int toLane) const;
1130 
1132  bool setControllingTLInformation(const NBConnection& c, const std::string& tlID);
1133 
1135  void clearControllingTLInformation();
1136 
1138  void addCrossingPointsAsIncomingWithGivenOutgoing(NBEdge* o, PositionVector& into);
1139 
1141  PositionVector getCWBoundaryLine(const NBNode& n) const;
1142 
1144  PositionVector getCCWBoundaryLine(const NBNode& n) const;
1145 
1147  bool expandableBy(NBEdge* possContinuation, std::string& reason) const;
1148 
1150  void append(NBEdge* continuation);
1151 
1153  bool hasSignalisedConnectionTo(const NBEdge* const e) const;
1154 
1156  void moveOutgoingConnectionsFrom(NBEdge* e, int laneOff);
1157 
1158  /* @brief return the turn destination if it exists
1159  * @param[in] possibleDestination Wether myPossibleTurnDestination should be returned if no turnaround connection
1160  * exists
1161  */
1162  NBEdge* getTurnDestination(bool possibleDestination = false) const;
1163 
1165  std::string getLaneID(int lane) const;
1166 
1168  double getLaneSpeed(int lane) const;
1169 
1171  bool isNearEnough2BeJoined2(NBEdge* e, double threshold) const;
1172 
1180  double getAngleAtNode(const NBNode* const node) const;
1181 
1190  double getAngleAtNodeToCenter(const NBNode* const node) const;
1191 
1193  void incLaneNo(int by);
1194 
1196  void decLaneNo(int by);
1197 
1199  void deleteLane(int index, bool recompute, bool shiftIndices);
1200 
1202  void addLane(int index, bool recomputeShape, bool recomputeConnections, bool shiftIndices);
1203 
1205  void markAsInLane2LaneState();
1206 
1208  void addSidewalk(double width);
1209 
1211  void restoreSidewalk(std::vector<NBEdge::Lane> oldLanes, PositionVector oldGeometry, std::vector<NBEdge::Connection> oldConnections);
1212 
1214  void addBikeLane(double width);
1215 
1217  void restoreBikelane(std::vector<NBEdge::Lane> oldLanes, PositionVector oldGeometry, std::vector<NBEdge::Connection> oldConnections);
1218 
1220  void setPermissions(SVCPermissions permissions, int lane = -1);
1221 
1223  void setPreferredVehicleClass(SVCPermissions permissions, int lane = -1);
1224 
1226  void allowVehicleClass(int lane, SUMOVehicleClass vclass);
1227 
1229  void disallowVehicleClass(int lane, SUMOVehicleClass vclass);
1230 
1232  void preferVehicleClass(int lane, SUMOVehicleClass vclass);
1233 
1235  void setLaneWidth(int lane, double width);
1236 
1238  void setLaneType(int lane, const std::string& type);
1239 
1241  void setEndOffset(int lane, double offset);
1242 
1244  void setSpeed(int lane, double speed);
1245 
1248  bool setStopOffsets(int lane, std::map<int, double> offsets, bool overwrite = false);
1249 
1251  void setAcceleration(int lane, bool accelRamp);
1252 
1254  void setLaneShape(int lane, const PositionVector& shape);
1255 
1257  SVCPermissions getPermissions(int lane = -1) const;
1258 
1260  void setOrigID(const std::string origID);
1261 
1263  void setDistance(double distance) {
1264  myDistance = distance;
1265  }
1266 
1268  void disableConnection4TLS(int fromLane, NBEdge* toEdge, int toLane);
1269 
1270  // @brief returns a reference to the internal structure for the convenience of NETEDIT
1271  Lane& getLaneStruct(int lane) {
1272  assert(lane >= 0);
1273  assert(lane < (int)myLanes.size());
1274  return myLanes[lane];
1275  }
1276 
1277  // @brief returns a reference to the internal structure for the convenience of NETEDIT
1278  const Lane& getLaneStruct(int lane) const {
1279  assert(lane >= 0);
1280  assert(lane < (int)myLanes.size());
1281  return myLanes[lane];
1282  }
1283 
1285  void declareConnectionsAsLoaded(EdgeBuildingStep step = LANES2LANES_USER) {
1286  myStep = step;
1287  }
1288 
1289  /* @brief fill connection attributes shape, viaShape, ...
1290  *
1291  * @param[in,out] edgeIndex The number of connections already handled
1292  * @param[in,out] splitIndex The number of via edges already built
1293  * @param[in] tryIgnoreNodePositions Does not add node geometries if geom.size()>=2
1294  */
1295  void buildInnerEdges(const NBNode& n, int noInternalNoSplits, int& linkIndex, int& splitIndex);
1296 
1298  inline const std::vector<NBSign>& getSigns() const {
1299  return mySigns;
1300  }
1301 
1303  inline void addSign(NBSign sign) {
1304  mySigns.push_back(sign);
1305  }
1306 
1308  PositionVector cutAtIntersection(const PositionVector& old) const;
1309 
1311  void setNodeBorder(const NBNode* node, const Position& p, const Position& p2, bool rectangularCut);
1312  const PositionVector& getNodeBorder(const NBNode* node);
1313  void resetNodeBorder(const NBNode* node);
1314 
1316  bool isBidiRail(bool ignoreSpread = false) const;
1317 
1319  bool isRailDeadEnd() const;
1320 
1322  void debugPrintConnections(bool outgoing = true, bool incoming = false) const;
1323 
1325  static double firstIntersection(const PositionVector& v1, const PositionVector& v2, double width2, const std::string& error = "");
1326 
1330  static PositionVector startShapeAt(const PositionVector& laneShape, const NBNode* startNode, PositionVector nodeShape);
1331 
1333 
1334 
1335  static inline double getTravelTimeStatic(const NBEdge* const edge, const NBVehicle* const /*veh*/, double /*time*/) {
1336  return edge->getLength() / edge->getSpeed();
1337  }
1338 
1339  static int getLaneIndexFromLaneID(const std::string laneID);
1340 
1342  void setNumericalID(int index) {
1343  myIndex = index;
1344  }
1345 
1350  int getNumericalID() const {
1351  return myIndex;
1352  }
1353 
1356  const EdgeVector& getSuccessors(SUMOVehicleClass vClass = SVC_IGNORING) const;
1357 
1358 
1362 
1364  const std::string& getID() const {
1365  return Named::getID();
1366  }
1367 
1369  bool joinLanes(SVCPermissions perms);
1370 
1371 private:
1376  private:
1378  std::map<NBEdge*, std::vector<int> > myConnections;
1379 
1382 
1383  public:
1386  : myTransitions(transitions) { }
1387 
1390 
1392  void execute(const int lane, const int virtEdge);
1393 
1395  const std::map<NBEdge*, std::vector<int> >& getBuiltConnections() const {
1396  return myConnections;
1397  }
1398 
1399  private:
1402 
1405  };
1406 
1407 
1416  public:
1418  enum Direction { DIR_RIGHTMOST, DIR_LEFTMOST, DIR_FORWARD };
1419 
1420  public:
1422  MainDirections(const EdgeVector& outgoing, NBEdge* parent, NBNode* to, const std::vector<int>& availableLanes);
1423 
1425  ~MainDirections();
1426 
1428  int getStraightest() const {
1429  return myStraightest;
1430  }
1431 
1433  bool empty() const;
1434 
1436  bool includes(Direction d) const;
1437 
1438  private:
1441 
1443  std::vector<Direction> myDirs;
1444 
1447 
1449  MainDirections& operator=(const MainDirections&);
1450  };
1451 
1453  PositionVector computeLaneShape(int lane, double offset) const;
1454 
1456  void computeLaneShapes();
1457 
1458 private:
1475  void init(int noLanes, bool tryIgnoreNodePositions, const std::string& origID);
1476 
1478  void divideOnEdges(const EdgeVector* outgoing);
1479 
1481  void divideSelectedLanesOnEdges(const EdgeVector* outgoing, const std::vector<int>& availableLanes);
1482 
1484  void addStraightConnections(const EdgeVector* outgoing, const std::vector<int>& availableLanes, const std::vector<int>& priorities);
1485 
1487  const std::vector<int> prepareEdgePriorities(const EdgeVector* outgoing, const std::vector<int>& availableLanes);
1488 
1491 
1494  void moveConnectionToLeft(int lane);
1495 
1499  void moveConnectionToRight(int lane);
1500 
1502  bool canMoveConnection(const Connection& con, int newFromLane) const;
1504 
1506  void computeAngle();
1507 
1509  bool bothLeftIntersect(const NBNode& n, const PositionVector& shape, LinkDirection dir, NBEdge* otherFrom, const NBEdge::Connection& otherCon, int numPoints, double width2, int shapeFlag = 0) const;
1510 
1512  bool hasRestrictedLane(SUMOVehicleClass vclass) const;
1513 
1515  void addRestrictedLane(double width, SUMOVehicleClass vclass);
1516 
1518  void restoreRestrictedLane(SUMOVehicleClass vclass, std::vector<NBEdge::Lane> oldLanes, PositionVector oldGeometry, std::vector<NBEdge::Connection> oldConnections);
1519 
1521  void assignInternalLaneLength(std::vector<Connection>::iterator i, int numLanes, double lengthSum);
1522 
1523 private:
1528 
1530  std::string myType;
1531 
1533  NBNode* myFrom, *myTo;
1534 
1536  double myLength;
1537 
1541  double myEndAngle;
1544 
1547 
1549  double mySpeed;
1550 
1552  double myDistance;
1553 
1557  std::vector<Connection> myConnections;
1558 
1560  std::vector<Connection> myConnectionsToDelete;
1561 
1564 
1567 
1570 
1573 
1576 
1579 
1581  double myEndOffset;
1582 
1587  std::map<int, double> myStopOffsets;
1588 
1590  double myLaneWidth;
1591 
1595  std::vector<Lane> myLanes;
1596 
1599 
1602 
1605 
1607  std::string myStreetName;
1608 
1610  std::vector<NBSign> mySigns;
1611 
1615 
1621 
1622 
1624  int myIndex;
1625 
1626  // @brief a static list of successor edges. Set by NBEdgeCont and requires reset when the network changes
1628 
1629  // @brief a static list of successor edges. Set by NBEdgeCont and requires reset when the network changes
1631 
1632 public:
1633 
1636  public:
1638  connections_toedge_finder(const NBEdge* const edge2find, bool hasFromLane = false) :
1639  myHasFromLane(hasFromLane),
1640  myEdge2Find(edge2find) { }
1641 
1643  bool operator()(const Connection& c) const {
1644  return c.toEdge == myEdge2Find && (!myHasFromLane || c.fromLane != -1);
1645  }
1646 
1647  private:
1649  const bool myHasFromLane;
1650 
1652  const NBEdge* const myEdge2Find;
1653 
1654  private:
1657  };
1658 
1661  public:
1663  connections_toedgelane_finder(NBEdge* const edge2find, int lane2find, int fromLane2find) :
1664  myEdge2Find(edge2find),
1665  myLane2Find(lane2find),
1666  myFromLane2Find(fromLane2find) { }
1667 
1669  bool operator()(const Connection& c) const {
1670  return c.toEdge == myEdge2Find && c.toLane == myLane2Find && (myFromLane2Find < 0 || c.fromLane == myFromLane2Find);
1671  }
1672 
1673  private:
1676 
1679 
1682 
1683  private:
1686 
1687  };
1688 
1691  public:
1693  connections_finder(int fromLane, NBEdge* const edge2find, int lane2find, bool invertEdge2find = false) :
1694  myFromLane(fromLane), myEdge2Find(edge2find), myLane2Find(lane2find), myInvertEdge2find(invertEdge2find) { }
1695 
1697  bool operator()(const Connection& c) const {
1698  return ((c.fromLane == myFromLane || myFromLane == -1)
1699  && ((!myInvertEdge2find && c.toEdge == myEdge2Find) || (myInvertEdge2find && c.toEdge != myEdge2Find))
1700  && (c.toLane == myLane2Find || myLane2Find == -1));
1701  }
1702 
1703  private:
1706 
1709 
1712 
1715 
1716  private:
1718  connections_finder& operator=(const connections_finder& s);
1719 
1720  };
1721 
1724  public:
1726  connections_conflict_finder(int fromLane, NBEdge* const edge2find, bool checkRight) :
1727  myFromLane(fromLane), myEdge2Find(edge2find), myCheckRight(checkRight) { }
1728 
1730  bool operator()(const Connection& c) const {
1731  return (((myCheckRight && c.fromLane < myFromLane) || (!myCheckRight && c.fromLane > myFromLane))
1732  && c.fromLane >= 0 // already assigned
1733  && c.toEdge == myEdge2Find);
1734  }
1735 
1736  private:
1739 
1742 
1745 
1746  private:
1749 
1750  };
1751 
1754  public:
1756  connections_fromlane_finder(int lane2find) : myLane2Find(lane2find) { }
1757 
1759  bool operator()(const Connection& c) const {
1760  return c.fromLane == myLane2Find;
1761  }
1762 
1763  private:
1766 
1767  private:
1770 
1771  };
1772 
1774  static bool connections_sorter(const Connection& c1, const Connection& c2);
1775 
1781  public:
1783  explicit connections_relative_edgelane_sorter(NBEdge* e) : myEdge(e) {}
1784 
1785  public:
1787  int operator()(const Connection& c1, const Connection& c2) const;
1788 
1789  private:
1792  };
1793 
1794 private:
1796  NBEdge(const NBEdge& s);
1797 
1799  NBEdge& operator=(const NBEdge& s);
1800 
1802  NBEdge();
1803 
1804 };
1805 
1806 
1807 #endif
1808 
1809 /****************************************************************************/
1810 
ToEdgeConnectionsAdder(const EdgeVector &transitions)
constructor
Definition: NBEdge.h:1385
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge&#39;s lanes&#39; lateral offset is computed.
Definition: NBEdge.h:762
static const PositionVector EMPTY
empty Vector
std::string id
id of Connection
Definition: NBEdge.h:236
static const bool UNSPECIFIED_CONNECTION_UNCONTROLLED
TLS-controlled despite its node controlled not specified.
Definition: NBEdge.h:330
std::vector< Lane > myLanes
Lane information.
Definition: NBEdge.h:1595
double vmax
maximum velocity
Definition: NBEdge.h:242
double getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:533
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:184
int toLane
The lane the connections yields in.
Definition: NBEdge.h:209
void setInsideTLS()
Marks this edge being within an intersection.
Definition: NBEdge.h:1024
Superclass for NBEdge and NBEdge::Connection to initialize Router.
Definition: NBEdge.h:65
std::vector< std::pair< const NBRouterEdge *, const NBRouterEdge * > > ConstRouterEdgePairVector
Definition: NBCont.h:46
A class representing a single street sign.
Definition: NBSign.h:44
connections_conflict_finder(int fromLane, NBEdge *const edge2find, bool checkRight)
constructor
Definition: NBEdge.h:1726
PositionVector shape
The lane&#39;s shape.
Definition: NBEdge.h:142
static const double UNSPECIFIED_LOADED_LENGTH
no length override given
Definition: NBEdge.h:318
const std::map< int, double > & getStopOffsets() const
Returns the stopOffset to the end of the edge.
Definition: NBEdge.h:611
double getSpeed() const
Definition: NBEdge.h:280
connections_relative_edgelane_sorter(NBEdge *e)
constructor
Definition: NBEdge.h:1783
const std::string & getID() const
Definition: NBEdge.h:277
LaneSpreadFunction myLaneSpreadFunction
The information about how to spread the lanes.
Definition: NBEdge.h:1578
std::string viaID
if Connection have a via, ID of it
Definition: NBEdge.h:248
void addSign(NBSign sign)
add Sign
Definition: NBEdge.h:1303
NBEdge * toEdge
The edge the connections yields in.
Definition: NBEdge.h:206
std::string type
the type of this lane
Definition: NBEdge.h:177
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
static ConstRouterEdgePairVector myViaSuccessors
Definition: NBEdge.h:276
static NBEdge DummyEdge
Dummy edge to use when a reference must be supplied in the no-arguments constructor (FOX technicality...
Definition: NBEdge.h:300
NBNode * myTo
Definition: NBEdge.h:1533
static const double UNSPECIFIED_VISIBILITY_DISTANCE
unspecified foe visibility for connections
Definition: NBEdge.h:315
The relationships between edges are computed/loaded.
Definition: NBEdge.h:109
bool isInsideTLS() const
Returns whether this edge was marked as being within an intersection.
Definition: NBEdge.h:1031
double getLength() const
Definition: NBEdge.h:283
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1759
double myLaneWidth
This width of this edge&#39;s lanes.
Definition: NBEdge.h:1590
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:1587
std::vector< NBSign > mySigns
the street signs along this edge
Definition: NBEdge.h:1610
double myEndOffset
This edges&#39;s offset to the intersection begin (will be applied to all lanes)
Definition: NBEdge.h:1581
Holds (- relative to the edge it is build from -!!!) the list of main directions a vehicle that drive...
Definition: NBEdge.h:1415
double getSignalOffset() const
Returns the offset of a traffic signal from the end of this edge.
Definition: NBEdge.h:626
static const double ANGLE_LOOKAHEAD
the distance at which to take the default angle
Definition: NBEdge.h:324
int myLane2Find
lane to find
Definition: NBEdge.h:1711
~ToEdgeConnectionsAdder()
destructor
Definition: NBEdge.h:1389
virtual const std::string & getID() const =0
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:472
const std::string & getTypeID() const
get ID of type
Definition: NBEdge.h:1061
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:1298
int myFromLane2Find
from lane to find
Definition: NBEdge.h:1681
std::map< NBEdge *, std::vector< int > > myConnections
map of edges to this edge&#39;s lanes that reach them
Definition: NBEdge.h:1378
The representation of a single edge during network building.
Definition: NBEdge.h:86
Lane2LaneInfoType
Modes of setting connections between lanes.
Definition: NBEdge.h:124
static const double UNSPECIFIED_SIGNAL_OFFSET
unspecified signal offset
Definition: NBEdge.h:321
void setStreetName(const std::string &name)
sets the street name of this edge
Definition: NBEdge.h:593
ConstRouterEdgePairVector myViaSuccessors
Definition: NBEdge.h:1630
std::vector< Direction > myDirs
list of the main direction within the following junction relative to the edge
Definition: NBEdge.h:1443
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:306
Lanes to lanes - relationships are computed; should be recheked.
Definition: NBEdge.h:113
double length
computed length (average of all internal lane shape lengths that share an internal edge) ...
Definition: NBEdge.h:272
bool hasLoadedLength() const
Returns whether a length was set explicitly.
Definition: NBEdge.h:552
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
int myFromJunctionPriority
The priority normalised for the node the edge is outgoing of.
Definition: NBEdge.h:1569
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:644
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:218
double endOffset
This lane&#39;s offset to the intersection begin.
Definition: NBEdge.h:154
PositionVector myGeom
The geometry for the edge.
Definition: NBEdge.h:1575
bool isInternal() const
Definition: NBEdge.h:289
double visibility
custom foe visiblity for connection
Definition: NBEdge.h:227
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1643
const NBEdge *const myEdge2Find
edge to find
Definition: NBEdge.h:1652
bool connectionsDone
Whether connection information for this lane is already completed.
Definition: NBEdge.h:171
const std::string & getID() const
Returns the id.
Definition: Named.h:77
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1271
PositionVector myFromBorder
intersection borders (because the node shape might be invalid)
Definition: NBEdge.h:1618
NBNode * getSignalNode() const
Returns the node that (possibly) represents a traffic signal controlling at the end of this edge...
Definition: NBEdge.h:631
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:303
double myDistance
The mileage/kilometrage at the start of this edge in a linear coordination system.
Definition: NBEdge.h:1552
const EdgeVector & myTransitions
the transition from the virtual lane to the edge it belongs to
Definition: NBEdge.h:1381
PositionVector customShape
custom shape for connection
Definition: NBEdge.h:233
double getDistance() const
Definition: NBEdge.h:604
bool accelRamp
Whether this lane is an acceleration lane.
Definition: NBEdge.h:167
The edge has been loaded, nothing is computed yet.
Definition: NBEdge.h:107
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:1714
int myToJunctionPriority
The priority normalised for the node the edge is incoming in.
Definition: NBEdge.h:1572
static const double UNSPECIFIED_SPEED
unspecified lane speed
Definition: NBEdge.h:309
PositionVector shape
shape of Connection
Definition: NBEdge.h:239
bool keepClear
whether the junction must be kept clear when using this connection
Definition: NBEdge.h:221
int myStraightest
the index of the straightmost among the given outgoing edges
Definition: NBEdge.h:1440
An (internal) definition of a single lane of an edge.
Definition: NBEdge.h:137
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
Definition: NBEdge.h:148
bool myAmMacroscopicConnector
Information whether this edge is a (macroscopic) connector.
Definition: NBEdge.h:1604
NBEdge * myTurnDestination
The turn destination edge (if a connection exists)
Definition: NBEdge.h:1563
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1669
double myStartAngle
The angles of the edge.
Definition: NBEdge.h:1540
connections_finder(int fromLane, NBEdge *const edge2find, int lane2find, bool invertEdge2find=false)
constructor
Definition: NBEdge.h:1693
static double getTravelTimeStatic(const NBRouterEdge *const edge, const NBVehicle *const, double)
Definition: NBEdge.h:76
double speed
custom speed for connection
Definition: NBEdge.h:230
bool myAmInTLS
Information whether this is lies within a joined tls.
Definition: NBEdge.h:1601
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBEdge.h:212
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
Definition: NBEdge.h:151
const ConstRouterEdgePairVector & getViaSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Definition: NBEdge.h:292
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:465
int fromLane
The lane the connections starts at.
Definition: NBEdge.h:203
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
A list of positions.
int getNumericalID() const
Returns the index (numeric id) of the edge.
Definition: NBEdge.h:1350
virtual double getLength() const =0
NBNode * mySignalNode
Definition: NBEdge.h:1614
static const double UNSPECIFIED_CONTPOS
unspecified internal junction position
Definition: NBEdge.h:312
connections_toedge_finder(const NBEdge *const edge2find, bool hasFromLane=false)
constructor
Definition: NBEdge.h:1638
std::vector< Connection > & getConnections()
Returns the connections.
Definition: NBEdge.h:931
const Lane & getLaneStruct(int lane) const
Definition: NBEdge.h:1278
EdgeBuildingStep
Current state of the edge within the building process.
Definition: NBEdge.h:103
NBEdge * myPossibleTurnDestination
The edge that would be the turn destination if there was one.
Definition: NBEdge.h:1566
void setAsMacroscopicConnector()
Definition: NBEdge.h:1012
const std::string & getID() const
Definition: NBEdge.h:1364
int myPriority
The priority of the edge.
Definition: NBEdge.h:1546
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
EdgeBuildingStep myStep
The building step.
Definition: NBEdge.h:1527
EdgeBuildingStep getStep() const
The building step of this edge.
Definition: NBEdge.h:568
const bool myHasFromLane
check if has from lane
Definition: NBEdge.h:1649
const std::string & getStreetName() const
Returns the street name of this edge.
Definition: NBEdge.h:588
Class to sort edges by their angle.
Definition: NBEdge.h:1780
A vehicle as used by router.
Definition: NBVehicle.h:44
double myTotalAngle
Definition: NBEdge.h:1542
double getEndOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:600
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1557
connections_fromlane_finder(int lane2find)
Definition: NBEdge.h:1756
The connection was given by the user.
Definition: NBEdge.h:128
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
double speed
The speed allowed on this lane.
Definition: NBEdge.h:145
double width
This lane&#39;s width.
Definition: NBEdge.h:161
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:1624
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:215
Base class for objects which have an id.
Definition: Named.h:57
double myEndAngle
Definition: NBEdge.h:1541
int myLane2Find
index of lane to find
Definition: NBEdge.h:1765
double mySpeed
The maximal speed.
Definition: NBEdge.h:1549
double getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:559
int internalLaneIndex
The lane index of this internal lane within the internal edge.
Definition: NBEdge.h:260
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:680
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
bool myCheckRight
check if is right
Definition: NBEdge.h:1744
JunctionPriority
junction priority values set by setJunctionPriority
Definition: NBEdge.h:333
virtual bool isInternal() const
Definition: NBEdge.h:72
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:575
double getTotalAngle() const
Returns the angle at the start of the edge.
Definition: NBEdge.h:526
int myFromLane
index of from lane
Definition: NBEdge.h:1705
virtual double getSpeed() const =0
double length() const
Returns the length.
PositionVector viaShape
shape of via
Definition: NBEdge.h:251
std::string oppositeID
An opposite lane ID, if given.
Definition: NBEdge.h:164
EdgeVector mySuccessors
Definition: NBEdge.h:1627
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:924
PositionVector myToBorder
Definition: NBEdge.h:1619
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:158
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:35
static const int UNSPECIFIED_INTERNAL_LANE_INDEX
internal lane computation not yet done
Definition: NBEdge.h:327
NBEdge * myEdge
the edge to compute the relative angle of
Definition: NBEdge.h:1791
double mySignalOffset
the offset of a traffic light signal from the end of this edge (-1 for None)
Definition: NBEdge.h:1613
The edge has been loaded and connections shall not be added.
Definition: NBEdge.h:105
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1730
std::vector< Connection > myConnectionsToDelete
List of connections marked for delayed removal.
Definition: NBEdge.h:1560
double contPos
custom position for internal junction on this connection
Definition: NBEdge.h:224
std::vector< std::string > foeIncomingLanes
FOE Incomings lanes.
Definition: NBEdge.h:257
bool uncontrolled
check if Connection is uncontrolled
Definition: NBEdge.h:263
connections_toedgelane_finder(NBEdge *const edge2find, int lane2find, int fromLane2find)
constructor
Definition: NBEdge.h:1663
static double getTravelTimeStatic(const NBEdge *const edge, const NBVehicle *const, double)
Definition: NBEdge.h:1335
NBEdge *const myEdge2Find
edge to find
Definition: NBEdge.h:1708
NBEdge *const myEdge2Find
edge to find
Definition: NBEdge.h:1675
std::string myType
The type of the edge.
Definition: NBEdge.h:1530
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge&#39;s lateral offset shal...
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:495
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:1285
The connection was computed.
Definition: NBEdge.h:126
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1697
Represents a single node (junction) during network building.
Definition: NBNode.h:68
Lanes to lanes - relationships are computed; no recheck is necessary/wished.
Definition: NBEdge.h:115
virtual int getNumericalID() const =0
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
Direction
enum of possible directions
Definition: NBEdge.h:1418
int getNumericalID() const
Definition: NBEdge.h:286
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:1019
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:479
int getStraightest() const
returns the index of the straightmost among the given outgoing edges
Definition: NBEdge.h:1428
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
void setDistance(double distance)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.h:1263
int myFromLane
index of from lane
Definition: NBEdge.h:1738
bool haveVia
check if Connection have a Via
Definition: NBEdge.h:245
double getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn&#39;t set.
Definition: NBEdge.h:542
double myLength
The length of the edge.
Definition: NBEdge.h:1536
double myLoadedLength
An optional length to use (-1 if not valid)
Definition: NBEdge.h:1598
Lanes to edges - relationships are computed/loaded.
Definition: NBEdge.h:111
std::string myStreetName
The street name (or whatever arbitrary string you wish to attach)
Definition: NBEdge.h:1607
PositionVector customShape
A custom shape for this lane set by the user.
Definition: NBEdge.h:174
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:486
std::vector< int > foeInternalLinks
FOE Internal links.
Definition: NBEdge.h:254
void setNumericalID(int index)
sets the index of the edge in the list of all network edges
Definition: NBEdge.h:1342
NBEdge *const myEdge2Find
edge to find
Definition: NBEdge.h:1741
vehicles ignoring classes
virtual const ConstRouterEdgePairVector & getViaSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const =0
void setSignalOffset(double offset, NBNode *signalNode)
sets the offset of a traffic signal from the end of this edge
Definition: NBEdge.h:636
A class that being a bresenham-callback assigns the incoming lanes to the edges.
Definition: NBEdge.h:1375
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:504
const std::map< NBEdge *, std::vector< int > > & getBuiltConnections() const
get built connections
Definition: NBEdge.h:1395