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 
256 
258  static const double UNSPECIFIED_WIDTH;
259 
261  static const double UNSPECIFIED_OFFSET;
262 
264  static const double UNSPECIFIED_SPEED;
265 
267  static const double UNSPECIFIED_CONTPOS;
268 
270  static const double UNSPECIFIED_VISIBILITY_DISTANCE;
271 
273  static const double UNSPECIFIED_LOADED_LENGTH;
274 
276  static const double UNSPECIFIED_SIGNAL_OFFSET;
277 
279  static const double ANGLE_LOOKAHEAD;
280 
283 
286 
291  ROUNDABOUT = 1000
292  };
293 
294 public:
313  NBEdge(const std::string& id,
314  NBNode* from, NBNode* to, std::string type,
315  double speed, int nolanes, int priority,
316  double width, double endOffset,
317  const std::string& streetName = "",
319 
320 
342  NBEdge(const std::string& id,
343  NBNode* from, NBNode* to, std::string type,
344  double speed, int nolanes, int priority,
345  double width, double endOffset,
346  PositionVector geom,
347  const std::string& streetName = "",
348  const std::string& origID = "",
350  bool tryIgnoreNodePositions = false);
351 
363  NBEdge(const std::string& id,
364  NBNode* from, NBNode* to,
365  const NBEdge* tpl,
366  const PositionVector& geom = PositionVector(),
367  int numLanes = -1);
368 
369 
371  ~NBEdge();
372 
373 
389  void reinit(NBNode* from, NBNode* to, const std::string& type,
390  double speed, int nolanes, int priority,
391  PositionVector geom, double width, double endOffset,
392  const std::string& streetName,
394  bool tryIgnoreNodePositions = false);
395 
400  void reinitNodes(NBNode* from, NBNode* to);
401 
404 
408  void reshiftPosition(double xoff, double yoff);
409 
411  void mirrorX();
413 
415 
416 
420  int getNumLanes() const {
421  return (int)myLanes.size();
422  }
423 
427  int getPriority() const {
428  return myPriority;
429  }
430 
434  NBNode* getFromNode() const {
435  return myFrom;
436  }
437 
441  NBNode* getToNode() const {
442  return myTo;
443  }
444 
450  inline double getStartAngle() const {
451  return myStartAngle;
452  }
453 
459  inline double getEndAngle() const {
460  return myEndAngle;
461  }
462 
467  double getShapeStartAngle() const;
468 
469 
475  double getShapeEndAngle() const;
476 
481  inline double getTotalAngle() const {
482  return myTotalAngle;
483  }
484 
488  double getLength() const {
489  return myLength;
490  }
491 
492 
497  double getLoadedLength() const {
498  return myLoadedLength > 0 ? myLoadedLength : myLength;
499  }
500 
502  double getFinalLength() const;
503 
507  bool hasLoadedLength() const {
508  return myLoadedLength > 0;
509  }
510 
514  double getSpeed() const {
515  return mySpeed;
516  }
517 
524  return myStep;
525  }
526 
530  double getLaneWidth() const {
531  return myLaneWidth;
532  }
533 
537  double getLaneWidth(int lane) const;
538 
540  double getTotalWidth() const;
541 
543  const std::string& getStreetName() const {
544  return myStreetName;
545  }
546 
548  void setStreetName(const std::string& name) {
549  myStreetName = name;
550  }
551 
555  double getEndOffset() const {
556  return myEndOffset;
557  }
558 
562  const std::map<int, double>& getStopOffsets() const {
563  return myStopOffsets;
564  }
565 
569  double getEndOffset(int lane) const;
570 
574  const std::map<int, double>& getStopOffsets(int lane) const;
575 
577  double getSignalOffset() const {
578  return mySignalOffset;
579  }
580 
582  void setSignalOffset(double offset) {
583  mySignalOffset = offset;
584  }
585 
589  const std::vector<NBEdge::Lane>& getLanes() const {
590  return myLanes;
591  }
593 
598  int getFirstNonPedestrianLaneIndex(int direction, bool exclusive = false) const;
599 
603  int getFirstAllowedLaneIndex(int direction) const;
604 
606  NBEdge::Lane getFirstNonPedestrianLane(int direction) const;
607 
609  std::set<SVCPermissions> getPermissionVariants(int iStart, int iEnd) const;
610 
612  double getCrossingAngle(NBNode* node);
613 
615  std::string getSidewalkID();
616 
618 
619 
622  const PositionVector& getGeometry() const {
623  return myGeom;
624  }
625 
627  const PositionVector getInnerGeometry() const;
628 
630  bool hasDefaultGeometry() const;
631 
637  bool hasDefaultGeometryEndpoints() const;
638 
644  bool hasDefaultGeometryEndpointAtNode(const NBNode* node) const;
645 
656  void setGeometry(const PositionVector& g, bool inner = false);
657 
667  void addGeometryPoint(int index, const Position& p);
668 
670  void extendGeometryAtNode(const NBNode* node, double maxExtent);
671 
673  void shortenGeometryAtNode(const NBNode* node, double reduction);
674 
676  void shiftPositionAtNode(NBNode* node, NBEdge* opposite);
677 
687  void computeEdgeShape(double smoothElevationThreshold=-1);
688 
692  const PositionVector& getLaneShape(int i) const;
693 
699 
705  return myLaneSpreadFunction;
706  }
707 
713  bool splitGeometry(NBEdgeCont& ec, NBNodeCont& nc);
714 
718  void reduceGeometry(const double minDist);
719 
725  void checkGeometry(const double maxAngle, const double minRadius, bool fix);
727 
730 
744  bool addEdge2EdgeConnection(NBEdge* dest);
745 
766  bool addLane2LaneConnection(int fromLane, NBEdge* dest,
767  int toLane, Lane2LaneInfoType type,
768  bool mayUseSameDestination = false,
769  bool mayDefinitelyPass = false,
770  bool keepClear = true,
771  double contPos = UNSPECIFIED_CONTPOS,
772  double visibility = UNSPECIFIED_VISIBILITY_DISTANCE,
773  double speed = UNSPECIFIED_SPEED,
775  const bool uncontrolled = UNSPECIFIED_CONNECTION_UNCONTROLLED);
776 
794  bool addLane2LaneConnections(int fromLane,
795  NBEdge* dest, int toLane, int no,
796  Lane2LaneInfoType type, bool invalidatePrevious = false,
797  bool mayDefinitelyPass = false);
798 
809  bool setConnection(int lane, NBEdge* destEdge,
810  int destLane,
811  Lane2LaneInfoType type,
812  bool mayUseSameDestination = false,
813  bool mayDefinitelyPass = false,
814  bool keepClear = true,
815  double contPos = UNSPECIFIED_CONTPOS,
816  double visibility = UNSPECIFIED_VISIBILITY_DISTANCE,
817  double speed = UNSPECIFIED_SPEED,
819  const bool uncontrolled = UNSPECIFIED_CONNECTION_UNCONTROLLED);
820 
822  void insertConnection(NBEdge::Connection connection);
823 
832  std::vector<Connection> getConnectionsFromLane(int lane) const;
833 
838  Connection getConnection(int fromLane, const NBEdge* to, int toLane) const;
839 
844  Connection& getConnectionRef(int fromLane, const NBEdge* to, int toLane);
845 
854  bool hasConnectionTo(NBEdge* destEdge, int destLane, int fromLane = -1) const;
855 
862  bool isConnectedTo(const NBEdge* e) const;
863 
867  const std::vector<Connection>& getConnections() const {
868  return myConnections;
869  }
870 
874  std::vector<Connection>& getConnections() {
875  return myConnections;
876  }
877 
882 
887 
892 
896  std::vector<int> getConnectionLanes(NBEdge* currentOutgoing) const;
897 
900 
903 
909  void remapConnections(const EdgeVector& incoming);
910 
918  void removeFromConnections(NBEdge* toEdge, int fromLane = -1, int toLane = -1, bool tryLater = false, const bool adaptToLaneRemoval = false);
919 
921  bool removeFromConnections(NBEdge::Connection connectionToRemove);
922 
924  void invalidateConnections(bool reallowSetting = false);
925 
927  void replaceInConnections(NBEdge* which, NBEdge* by, int laneOff);
928 
930  void replaceInConnections(NBEdge* which, const std::vector<NBEdge::Connection>& origConns);
931 
933  void copyConnectionsFrom(NBEdge* src);
934 
936  void shiftToLanesToEdge(NBEdge* to, int laneOff);
938 
944  bool isTurningDirectionAt(const NBEdge* const edge) const;
945 
950  void setTurningDestination(NBEdge* e, bool onlyPossible = false);
951 
957  }
958 
962  bool isMacroscopicConnector() const {
964  }
965 
967  void setInternal() {
968  myAmInnerEdge = true;
969  }
970 
974  bool isInternal() const {
975  return myAmInnerEdge;
976  }
978 
984  void setJunctionPriority(const NBNode* const node, int prio);
985 
995  int getJunctionPriority(const NBNode* const node) const;
996 
998  void setLoadedLength(double val);
999 
1002 
1004  const std::string& getTypeID() const {
1005  return myType;
1006  }
1007 
1009  bool needsLaneSpecificOutput() const;
1010 
1012  bool hasPermissions() const;
1013 
1015  bool hasLaneSpecificPermissions() const;
1016 
1018  bool hasLaneSpecificSpeed() const;
1019 
1021  bool hasLaneSpecificWidth() const;
1022 
1024  bool hasLaneSpecificEndOffset() const;
1025 
1027  bool hasLaneSpecificStopOffsets() const;
1028 
1030  bool hasAccelLane() const;
1031 
1033  bool hasCustomLaneShape() const;
1034 
1036  bool hasLaneParams() const;
1037 
1039  bool computeEdge2Edges(bool noLeftMovers);
1040 
1042  bool computeLanes2Edges();
1043 
1045  bool recheckLanes();
1046 
1055  void appendTurnaround(bool noTLSControlled, bool onlyDeadends, bool checkPermissions);
1056 
1060  NBNode* tryGetNodeAtPosition(double pos, double tolerance = 5.0) const;
1061 
1063  double getMaxLaneOffset();
1064 
1066  bool lanesWereAssigned() const;
1067 
1069  bool mayBeTLSControlled(int fromLane, NBEdge* toEdge, int toLane) const;
1070 
1072  bool setControllingTLInformation(const NBConnection& c, const std::string& tlID);
1073 
1076 
1079 
1081  PositionVector getCWBoundaryLine(const NBNode& n) const;
1082 
1084  PositionVector getCCWBoundaryLine(const NBNode& n) const;
1085 
1087  bool expandableBy(NBEdge* possContinuation, std::string& reason) const;
1088 
1090  void append(NBEdge* continuation);
1091 
1093  bool hasSignalisedConnectionTo(const NBEdge* const e) const;
1094 
1096  void moveOutgoingConnectionsFrom(NBEdge* e, int laneOff);
1097 
1098  /* @brief return the turn destination if it exists
1099  * @param[in] possibleDestination Wether myPossibleTurnDestination should be returned if no turnaround connection
1100  * exists
1101  */
1102  NBEdge* getTurnDestination(bool possibleDestination = false) const;
1103 
1105  std::string getLaneID(int lane) const;
1106 
1108  std::string getLaneIDInsecure(int lane) const;
1109 
1111  double getLaneSpeed(int lane) const;
1112 
1114  bool isNearEnough2BeJoined2(NBEdge* e, double threshold) const;
1115 
1123  double getAngleAtNode(const NBNode* const node) const;
1124 
1133  double getAngleAtNodeToCenter(const NBNode* const node) const;
1134 
1136  void incLaneNo(int by);
1137 
1139  void decLaneNo(int by);
1140 
1142  void deleteLane(int index, bool recompute, bool shiftIndices);
1143 
1145  void addLane(int index, bool recomputeShape, bool recomputeConnections, bool shiftIndices);
1146 
1148  void markAsInLane2LaneState();
1149 
1151  void addSidewalk(double width);
1152 
1154  void restoreSidewalk(std::vector<NBEdge::Lane> oldLanes, PositionVector oldGeometry, std::vector<NBEdge::Connection> oldConnections);
1155 
1157  void addBikeLane(double width);
1158 
1160  void restoreBikelane(std::vector<NBEdge::Lane> oldLanes, PositionVector oldGeometry, std::vector<NBEdge::Connection> oldConnections);
1161 
1163  void setPermissions(SVCPermissions permissions, int lane = -1);
1164 
1166  void setPreferredVehicleClass(SVCPermissions permissions, int lane = -1);
1167 
1169  void allowVehicleClass(int lane, SUMOVehicleClass vclass);
1170 
1172  void disallowVehicleClass(int lane, SUMOVehicleClass vclass);
1173 
1175  void preferVehicleClass(int lane, SUMOVehicleClass vclass);
1176 
1178  void setLaneWidth(int lane, double width);
1179 
1181  void setEndOffset(int lane, double offset);
1182 
1184  void setSpeed(int lane, double speed);
1185 
1188  bool setStopOffsets(int lane, std::map<int, double> offsets, bool overwrite = false);
1189 
1191  void setAcceleration(int lane, bool accelRamp);
1192 
1194  void setLaneShape(int lane, const PositionVector& shape);
1195 
1197  SVCPermissions getPermissions(int lane = -1) const;
1198 
1200  void setOrigID(const std::string origID);
1201 
1203  void disableConnection4TLS(int fromLane, NBEdge* toEdge, int toLane);
1204 
1205  // @brief returns a reference to the internal structure for the convenience of NETEDIT
1206  Lane& getLaneStruct(int lane) {
1207  assert(lane >= 0);
1208  assert(lane < (int)myLanes.size());
1209  return myLanes[lane];
1210  }
1211 
1212  // @brief returns a reference to the internal structure for the convenience of NETEDIT
1213  const Lane& getLaneStruct(int lane) const {
1214  assert(lane >= 0);
1215  assert(lane < (int)myLanes.size());
1216  return myLanes[lane];
1217  }
1218 
1221  myStep = step;
1222  }
1223 
1224  /* @brief fill connection attributes shape, viaShape, ...
1225  *
1226  * @param[in,out] edgeIndex The number of connections already handled
1227  * @param[in,out] splitIndex The number of via edges already built
1228  * @param[in] tryIgnoreNodePositions Does not add node geometries if geom.size()>=2
1229  */
1230  void buildInnerEdges(const NBNode& n, int noInternalNoSplits, int& linkIndex, int& splitIndex);
1231 
1233  inline const std::vector<NBSign>& getSigns() const {
1234  return mySigns;
1235  }
1236 
1238  inline void addSign(NBSign sign) {
1239  mySigns.push_back(sign);
1240  }
1241 
1244 
1246  void setNodeBorder(const NBNode* node, const Position& p, const Position& p2, bool rectangularCut);
1247  const PositionVector& getNodeBorder(const NBNode* node);
1248  void resetNodeBorder(const NBNode* node);
1249 
1251  bool isBidiRail(bool ignoreSpread = false) const;
1252 
1254  bool isRailDeadEnd() const;
1255 
1257  void debugPrintConnections(bool outgoing = true, bool incoming = false) const;
1258 
1260  static double firstIntersection(const PositionVector& v1, const PositionVector& v2, double width2);
1261 
1265  static PositionVector startShapeAt(const PositionVector& laneShape, const NBNode* startNode, PositionVector nodeShape);
1266 
1268 
1269 
1270  static inline double getTravelTimeStatic(const NBEdge* const edge, const NBVehicle* const /*veh*/, double /*time*/) {
1271  return edge->getLength() / edge->getSpeed();
1272  }
1273 
1274  static int getLaneIndexFromLaneID(const std::string laneID);
1275 
1277  void setNumericalID(int index) {
1278  myIndex = index;
1279  }
1280 
1285  int getNumericalID() const {
1286  return myIndex;
1287  }
1288 
1291  const EdgeVector& getSuccessors(SUMOVehicleClass vClass = SVC_IGNORING) const;
1292 
1293 
1297 
1299 
1300 private:
1305  private:
1307  std::map<NBEdge*, std::vector<int> > myConnections;
1308 
1311 
1312  public:
1315  : myTransitions(transitions) { }
1316 
1319 
1321  void execute(const int lane, const int virtEdge);
1322 
1324  const std::map<NBEdge*, std::vector<int> >& getBuiltConnections() const {
1325  return myConnections;
1326  }
1327 
1328  private:
1331 
1334  };
1335 
1336 
1345  public:
1347  enum Direction { DIR_RIGHTMOST, DIR_LEFTMOST, DIR_FORWARD };
1348 
1350  std::vector<Direction> myDirs;
1351 
1352  public:
1354  MainDirections(const EdgeVector& outgoing, NBEdge* parent, NBNode* to, int indexOfStraightest);
1355 
1357  ~MainDirections();
1358 
1360  bool empty() const;
1361 
1363  bool includes(Direction d) const;
1364 
1365  private:
1368 
1371  };
1372 
1374  PositionVector computeLaneShape(int lane, double offset) const;
1375 
1377  void computeLaneShapes();
1378 
1379 private:
1396  void init(int noLanes, bool tryIgnoreNodePositions, const std::string& origID);
1397 
1399  void divideOnEdges(const EdgeVector* outgoing);
1400 
1402  void divideSelectedLanesOnEdges(const EdgeVector* outgoing, const std::vector<int>& availableLanes, const std::vector<int>* priorities);
1403 
1405  void addStraightConnections(const EdgeVector* outgoing, const std::vector<int>& availableLanes, const std::vector<int>* priorities);
1406 
1408  std::vector<int>* prepareEdgePriorities(const EdgeVector* outgoing);
1409 
1411  static int computePrioritySum(const std::vector<int>& priorities);
1412 
1415 
1418  void moveConnectionToLeft(int lane);
1419 
1423  void moveConnectionToRight(int lane);
1424 
1426  bool canMoveConnection(const Connection& con, int newFromLane) const;
1428 
1430  void computeAngle();
1431 
1433  bool bothLeftIntersect(const NBNode& n, const PositionVector& shape, LinkDirection dir, NBEdge* otherFrom, const NBEdge::Connection& otherCon, int numPoints, double width2) const;
1434 
1436  void addRestrictedLane(double width, SUMOVehicleClass vclass);
1437 
1439  void restoreRestrictedLane(SUMOVehicleClass vclass, std::vector<NBEdge::Lane> oldLanes, PositionVector oldGeometry, std::vector<NBEdge::Connection> oldConnections);
1440 
1442  void assignInternalLaneLength(std::vector<Connection>::iterator i, int numLanes, double lengthSum);
1443 
1444 private:
1449 
1451  std::string myType;
1452 
1455 
1457  double myLength;
1458 
1462  double myEndAngle;
1465 
1468 
1470  double mySpeed;
1471 
1475  std::vector<Connection> myConnections;
1476 
1478  std::vector<Connection> myConnectionsToDelete;
1479 
1482 
1485 
1488 
1491 
1494 
1497 
1499  double myEndOffset;
1500 
1505  std::map<int, double> myStopOffsets;
1506 
1508  double myLaneWidth;
1509 
1513  std::vector<Lane> myLanes;
1514 
1517 
1520 
1523 
1528  int toLane;
1529  };
1530 
1532  std::vector<TLSDisabledConnection> myTLSDisabledConnections;
1533 
1535  std::string myStreetName;
1536 
1538  std::vector<NBSign> mySigns;
1539 
1542 
1548 
1549 
1551  int myIndex;
1552 
1553  // @brief a static list of successor edges. Set by NBEdgeCont and requires reset when the network changes
1555 
1556  // @brief a static list of successor edges. Set by NBEdgeCont and requires reset when the network changes
1558 
1559 public:
1562  public:
1564  tls_disable_finder(const TLSDisabledConnection& tpl) : myDefinition(tpl) { }
1565 
1567  bool operator()(const TLSDisabledConnection& e) const {
1568  if (e.to != myDefinition.to) {
1569  return false;
1570  }
1571  if (e.fromLane != myDefinition.fromLane) {
1572  return false;
1573  }
1574  if (e.toLane != myDefinition.toLane) {
1575  return false;
1576  }
1577  return true;
1578  }
1579 
1580  private:
1583 
1584  private:
1587  };
1588 
1589 
1592  public:
1594  connections_toedge_finder(const NBEdge* const edge2find, bool hasFromLane = false) :
1595  myHasFromLane(hasFromLane),
1596  myEdge2Find(edge2find) { }
1597 
1599  bool operator()(const Connection& c) const {
1600  return c.toEdge == myEdge2Find && (!myHasFromLane || c.fromLane != -1);
1601  }
1602 
1603  private:
1605  const bool myHasFromLane;
1606 
1608  const NBEdge* const myEdge2Find;
1609 
1610  private:
1613  };
1614 
1617  public:
1619  connections_toedgelane_finder(NBEdge* const edge2find, int lane2find, int fromLane2find) :
1620  myEdge2Find(edge2find),
1621  myLane2Find(lane2find),
1622  myFromLane2Find(fromLane2find) { }
1623 
1625  bool operator()(const Connection& c) const {
1626  return c.toEdge == myEdge2Find && c.toLane == myLane2Find && (myFromLane2Find < 0 || c.fromLane == myFromLane2Find);
1627  }
1628 
1629  private:
1632 
1635 
1638 
1639  private:
1642 
1643  };
1644 
1647  public:
1649  connections_finder(int fromLane, NBEdge* const edge2find, int lane2find, bool invertEdge2find = false) :
1650  myFromLane(fromLane), myEdge2Find(edge2find), myLane2Find(lane2find), myInvertEdge2find(invertEdge2find) { }
1651 
1653  bool operator()(const Connection& c) const {
1654  return ((c.fromLane == myFromLane || myFromLane == -1)
1655  && ((!myInvertEdge2find && c.toEdge == myEdge2Find) || (myInvertEdge2find && c.toEdge != myEdge2Find))
1656  && (c.toLane == myLane2Find || myLane2Find == -1));
1657  }
1658 
1659  private:
1662 
1665 
1668 
1671 
1672  private:
1675 
1676  };
1677 
1680  public:
1682  connections_conflict_finder(int fromLane, NBEdge* const edge2find, bool checkRight) :
1683  myFromLane(fromLane), myEdge2Find(edge2find), myCheckRight(checkRight) { }
1684 
1686  bool operator()(const Connection& c) const {
1687  return (((myCheckRight && c.fromLane < myFromLane) || (!myCheckRight && c.fromLane > myFromLane))
1688  && c.fromLane >= 0 // already assigned
1689  && c.toEdge == myEdge2Find);
1690  }
1691 
1692  private:
1695 
1698 
1701 
1702  private:
1705 
1706  };
1707 
1710  public:
1712  connections_fromlane_finder(int lane2find) : myLane2Find(lane2find) { }
1713 
1715  bool operator()(const Connection& c) const {
1716  return c.fromLane == myLane2Find;
1717  }
1718 
1719  private:
1722 
1723  private:
1726 
1727  };
1728 
1730  static bool connections_sorter(const Connection& c1, const Connection& c2);
1731 
1737  public:
1739  explicit connections_relative_edgelane_sorter(NBEdge* e) : myEdge(e) {}
1740 
1741  public:
1743  int operator()(const Connection& c1, const Connection& c2) const;
1744 
1745  private:
1748  };
1749 
1750 private:
1752  NBEdge(const NBEdge& s);
1753 
1755  NBEdge& operator=(const NBEdge& s);
1756 
1758  NBEdge();
1759 
1760 };
1761 
1762 
1763 #endif
1764 
1765 /****************************************************************************/
1766 
ToEdgeConnectionsAdder(const EdgeVector &transitions)
constructor
Definition: NBEdge.h:1314
bool mayBeTLSControlled(int fromLane, NBEdge *toEdge, int toLane) const
return true if certain connection must be controlled by TLS
Definition: NBEdge.cpp:2737
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge&#39;s lanes&#39; lateral offset is computed.
Definition: NBEdge.h:704
static const PositionVector EMPTY
empty Vector
std::string id
id of Connection
Definition: NBEdge.h:215
void moveConnectionToRight(int lane)
Definition: NBEdge.cpp:1466
void invalidateConnections(bool reallowSetting=false)
invalidate current connections of edge
Definition: NBEdge.cpp:1348
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:1758
bool expandableBy(NBEdge *possContinuation, std::string &reason) const
Check if Node is expandable.
Definition: NBEdge.cpp:2871
void init(int noLanes, bool tryIgnoreNodePositions, const std::string &origID)
Initialization routines common to all constructors.
Definition: NBEdge.cpp:425
void appendTurnaround(bool noTLSControlled, bool onlyDeadends, bool checkPermissions)
Add a connection to the previously computed turnaround, if wished.
Definition: NBEdge.cpp:2640
static const bool UNSPECIFIED_CONNECTION_UNCONTROLLED
TLS-controlled despite its node controlled not specified.
Definition: NBEdge.h:285
std::vector< Lane > myLanes
Lane information.
Definition: NBEdge.h:1513
double vmax
maximum velocity
Definition: NBEdge.h:221
double getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:488
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:1813
bool setControllingTLInformation(const NBConnection &c, const std::string &tlID)
Returns if the link could be set as to be controlled.
Definition: NBEdge.cpp:2748
void divideOnEdges(const EdgeVector *outgoing)
divides the lanes on the outgoing edges
Definition: NBEdge.cpp:2264
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:3390
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:3638
connections_conflict_finder(int fromLane, NBEdge *const edge2find, bool checkRight)
constructor
Definition: NBEdge.h:1682
PositionVector shape
The lane&#39;s shape.
Definition: NBEdge.h:121
static const double UNSPECIFIED_LOADED_LENGTH
no length override given
Definition: NBEdge.h:273
std::vector< TLSDisabledConnection > myTLSDisabledConnections
vector with the disabled connections
Definition: NBEdge.h:1532
const std::map< int, double > & getStopOffsets() const
Returns the stopOffset to the end of the edge.
Definition: NBEdge.h:562
connections_relative_edgelane_sorter(NBEdge *e)
constructor
Definition: NBEdge.h:1739
~NBEdge()
Destructor.
Definition: NBEdge.cpp:496
LaneSpreadFunction myLaneSpreadFunction
The information about how to spread the lanes.
Definition: NBEdge.h:1496
void sortOutgoingConnectionsByAngle()
sorts the outgoing connections by their angle relative to their junction
Definition: NBEdge.cpp:1253
std::string viaID
if Connection have a via, ID of it
Definition: NBEdge.h:227
void addSign(NBSign sign)
add Sign
Definition: NBEdge.h:1238
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:1226
void mirrorX()
mirror coordinates along the x-axis
Definition: NBEdge.cpp:514
static PositionVector startShapeAt(const PositionVector &laneShape, const NBNode *startNode, PositionVector nodeShape)
Definition: NBEdge.cpp:801
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
static NBEdge DummyEdge
Dummy edge to use when a reference must be supplied in the no-arguments constructor (FOX technicality...
Definition: NBEdge.h:255
NBNode * myTo
Definition: NBEdge.h:1454
static const double UNSPECIFIED_VISIBILITY_DISTANCE
unspecified foe visibility for connections
Definition: NBEdge.h:270
void setEndOffset(int lane, double offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3222
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:1042
The relationships between edges are computed/loaded.
Definition: NBEdge.h:88
double getLaneSpeed(int lane) const
get lane speed
Definition: NBEdge.cpp:1837
void computeEdgeShape(double smoothElevationThreshold=-1)
Recomputeds the lane shapes to terminate at the node shape For every lane the intersection with the f...
Definition: NBEdge.cpp:760
bool hasPermissions() const
whether at least one lane has restrictions
Definition: NBEdge.cpp:1967
bool isConnectedTo(const NBEdge *e) const
Returns the information whethe a connection to the given edge has been added (or computed) ...
Definition: NBEdge.cpp:1164
void reduceGeometry(const double minDist)
Removes points with a distance lesser than the given.
Definition: NBEdge.cpp:922
bool hasSignalisedConnectionTo(const NBEdge *const e) const
Check if edge has signalised connections.
Definition: NBEdge.cpp:3002
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1715
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:1508
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:1505
std::vector< NBSign > mySigns
the street signs along this edge
Definition: NBEdge.h:1538
double myEndOffset
This edges&#39;s offset to the intersection begin (will be applied to all lanes)
Definition: NBEdge.h:1499
void addLane(int index, bool recomputeShape, bool recomputeConnections, bool shiftIndices)
add lane
Definition: NBEdge.cpp:3042
void setSpeed(int lane, double speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3272
Holds (- relative to the edge it is build from -!!!) the list of main directions a vehicle that drive...
Definition: NBEdge.h:1344
double getSignalOffset() const
Returns the offset of a traffic signal from the end of this edge.
Definition: NBEdge.h:577
static const double ANGLE_LOOKAHEAD
the distance at which to take the default angle
Definition: NBEdge.h:279
int myLane2Find
lane to find
Definition: NBEdge.h:1667
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
Definition: NBEdge.cpp:1781
void moveConnectionToLeft(int lane)
Definition: NBEdge.cpp:1451
~ToEdgeConnectionsAdder()
destructor
Definition: NBEdge.h:1318
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:427
const std::string & getTypeID() const
get ID of type
Definition: NBEdge.h:1004
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:1233
int myFromLane2Find
from lane to find
Definition: NBEdge.h:1637
std::map< NBEdge *, std::vector< int > > myConnections
map of edges to this edge&#39;s lanes that reach them
Definition: NBEdge.h:1307
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:399
void clearControllingTLInformation()
clears tlID for all connections
Definition: NBEdge.cpp:2813
void setNodeBorder(const NBNode *node, const Position &p, const Position &p2, bool rectangularCut)
Set Node border.
Definition: NBEdge.cpp:610
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:2540
Lane(NBEdge *e, const std::string &_origID)
constructor
Definition: NBEdge.cpp:128
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
Definition: NBEdge.cpp:1992
static const double UNSPECIFIED_SIGNAL_OFFSET
unspecified signal offset
Definition: NBEdge.h:276
bool isBidiRail(bool ignoreSpread=false) const
whether this edge is part of a bidirectional railway
Definition: NBEdge.cpp:668
void setStreetName(const std::string &name)
sets the street name of this edge
Definition: NBEdge.h:548
std::vector< Direction > myDirs
list of the main direction within the following junction relative to the edge
Definition: NBEdge.h:1350
void markAsInLane2LaneState()
mark edge as in lane to state lane
Definition: NBEdge.cpp:3128
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:261
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:1281
double getMaxLaneOffset()
get max lane offset
Definition: NBEdge.cpp:2731
TLS Disabled Connections.
Definition: NBEdge.h:1525
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:507
NBEdge * getTurnDestination(bool possibleDestination=false) const
Definition: NBEdge.cpp:3013
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:3303
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:1487
void setLoadedLength(double val)
set loaded lenght
Definition: NBEdge.cpp:3346
void computeLaneShapes()
compute lane shapes
Definition: NBEdge.cpp:1843
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:589
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:1564
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:1493
double visibility
custom foe visiblity for connection
Definition: NBEdge.h:206
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1599
void remapConnections(const EdgeVector &incoming)
Remaps the connection in a way that allows the removal of it.
Definition: NBEdge.cpp:1265
const NBEdge *const myEdge2Find
edge to find
Definition: NBEdge.h:1608
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:1239
Lane & getLaneStruct(int lane)
Definition: NBEdge.h:1206
PositionVector myFromBorder
intersection borders (because the node shape might be invalid)
Definition: NBEdge.h:1545
void restoreBikelane(std::vector< NBEdge::Lane > oldLanes, PositionVector oldGeometry, std::vector< NBEdge::Connection > oldConnections)
restore an previously added BikeLane
Definition: NBEdge.cpp:3476
bool isRailDeadEnd() const
whether this edge is a railway edge that does not continue
Definition: NBEdge.cpp:679
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:3238
void addSidewalk(double width)
add a pedestrian sidewalk of the given width and shift existing connctions
Definition: NBEdge.cpp:3458
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge&#39;s geometry
Definition: NBEdge.cpp:559
bool hasLaneSpecificStopOffsets() const
whether lanes differ in stopOffsets
Definition: NBEdge.cpp:2025
double getShapeStartAngle() const
Returns the angle at the start of the edge.
Definition: NBEdge.cpp:1951
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:258
void setInternal()
Marks this edge being within an intersection.
Definition: NBEdge.h:967
const EdgeVector & myTransitions
the transition from the virtual lane to the edge it belongs to
Definition: NBEdge.h:1310
void assignInternalLaneLength(std::vector< Connection >::iterator i, int numLanes, double lengthSum)
assign length to all lanes of an internal edge
Definition: NBEdge.cpp:1720
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:541
void shortenGeometryAtNode(const NBNode *node, double reduction)
linearly extend the geometry at the given node
Definition: NBEdge.cpp:596
void setLaneShape(int lane, const PositionVector &shape)
sets a custom lane shape
Definition: NBEdge.cpp:3295
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:3287
PositionVector cutAtIntersection(const PositionVector &old) const
cut shape at the intersection shapes
Definition: NBEdge.cpp:694
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:2697
int getFirstNonPedestrianLaneIndex(int direction, bool exclusive=false) const
return the first lane with permissions other than SVC_PEDESTRIAN and 0
Definition: NBEdge.cpp:3373
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:1670
int myToJunctionPriority
The priority normalised for the node the edge is incoming in.
Definition: NBEdge.h:1490
PositionVector shape
shape of Connection
Definition: NBEdge.h:218
static const double UNSPECIFIED_SPEED
unspecified lane speed
Definition: NBEdge.h:264
void restoreSidewalk(std::vector< NBEdge::Lane > oldLanes, PositionVector oldGeometry, std::vector< NBEdge::Connection > oldConnections)
restore an previously added sidewalk
Definition: NBEdge.cpp:3464
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:998
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:3482
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1117
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:974
void incLaneNo(int by)
increment lane
Definition: NBEdge.cpp:3085
bool myAmMacroscopicConnector
Information whether this edge is a (macroscopic) connector.
Definition: NBEdge.h:1522
bool computeLanes2Edges()
computes the edge, step2: computation of which lanes approach the edges)
Definition: NBEdge.cpp:2111
NBEdge * myTurnDestination
The turn destination edge (if a connection exists)
Definition: NBEdge.h:1481
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1625
double myStartAngle
The angles of the edge.
Definition: NBEdge.h:1461
bool hasLaneSpecificWidth() const
whether lanes differ in width
Definition: NBEdge.cpp:2003
connections_finder(int fromLane, NBEdge *const edge2find, int lane2find, bool invertEdge2find=false)
constructor
Definition: NBEdge.h:1649
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:2014
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:548
void decLaneNo(int by)
decrement lane
Definition: NBEdge.cpp:3116
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:3022
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:420
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
NBEdge()
constructor for dummy edge
Definition: NBEdge.cpp:345
TLSDisabledConnection myDefinition
definition of disable connection
Definition: NBEdge.h:1582
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:1285
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:1025
void setOrigID(const std::string origID)
set origID for all lanes
Definition: NBEdge.cpp:3588
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition: NBEdge.cpp:529
void moveOutgoingConnectionsFrom(NBEdge *e, int laneOff)
move outgoing connection
Definition: NBEdge.cpp:2711
static int computePrioritySum(const std::vector< int > &priorities)
computes the sum of the given list&#39;s entries (sic!)
Definition: NBEdge.cpp:2630
static bool connections_sorter(const Connection &c1, const Connection &c2)
connections_sorter sort by fromLane, toEdge and toLane
Definition: NBEdge.cpp:3361
void resetNodeBorder(const NBNode *node)
Definition: NBEdge.cpp:657
static const double UNSPECIFIED_CONTPOS
unspecified internal junction position
Definition: NBEdge.h:267
bool needsLaneSpecificOutput() const
whether at least one lane has values differing from the edges values
Definition: NBEdge.cpp:2071
connections_toedge_finder(const NBEdge *const edge2find, bool hasFromLane=false)
constructor
Definition: NBEdge.h:1594
std::vector< Connection > & getConnections()
Returns the connections.
Definition: NBEdge.h:874
const Lane & getLaneStruct(int lane) const
Definition: NBEdge.h:1213
void deleteLane(int index, bool recompute, bool shiftIndices)
delete lane
Definition: NBEdge.cpp:3096
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:1158
EdgeBuildingStep
Current state of the edge within the building process.
Definition: NBEdge.h:82
bool operator()(const TLSDisabledConnection &e) const
operator ()
Definition: NBEdge.h:1567
NBEdge * myPossibleTurnDestination
The edge that would be the turn destination if there was one.
Definition: NBEdge.h:1484
void setAsMacroscopicConnector()
Definition: NBEdge.h:955
bool hasDefaultGeometry() const
Returns whether the geometry consists only of the node positions.
Definition: NBEdge.cpp:535
void setSignalOffset(double offset)
sets the offset of a traffic signal from the end of this edge
Definition: NBEdge.h:582
static int getLaneIndexFromLaneID(const std::string laneID)
Definition: NBEdge.cpp:3657
int myPriority
The priority of the edge.
Definition: NBEdge.h:1467
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:1732
NBConstEdgePairVector myViaSuccessors
Definition: NBEdge.h:1557
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:3442
EdgeBuildingStep myStep
The building step.
Definition: NBEdge.h:1448
EdgeBuildingStep getStep() const
The building step of this edge.
Definition: NBEdge.h:523
const bool myHasFromLane
check if has from lane
Definition: NBEdge.h:1605
const std::string & getStreetName() const
Returns the street name of this edge.
Definition: NBEdge.h:543
double getAngleAtNode(const NBNode *const node) const
Returns the angle of the edge&#39;s geometry at the given node.
Definition: NBEdge.cpp:1801
Class to sort edges by their angle.
Definition: NBEdge.h:1736
A vehicle as used by router.
Definition: NBVehicle.h:44
void buildInnerEdges(const NBNode &n, int noInternalNoSplits, int &linkIndex, int &splitIndex)
Definition: NBEdge.cpp:1479
double myTotalAngle
Definition: NBEdge.h:1463
PositionVector getCWBoundaryLine(const NBNode &n) const
get the outer boundary of this edge when going clock-wise around the given node
Definition: NBEdge.cpp:2831
double getEndOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:555
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1475
std::string getLaneIDInsecure(int lane) const
get Lane ID (Insecure)
Definition: NBEdge.cpp:3028
connections_fromlane_finder(int lane2find)
Definition: NBEdge.h:1712
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:3404
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:3331
bool lanesWereAssigned() const
Check if lanes were assigned.
Definition: NBEdge.cpp:2725
double getFinalLength() const
get length that will be assigned to the lanes in the final network
Definition: NBEdge.cpp:3575
bool myAmInnerEdge
Information whether this is a junction-inner edge.
Definition: NBEdge.h:1519
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:1551
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:1978
Base class for objects which have an id.
Definition: Named.h:58
double myEndAngle
Definition: NBEdge.h:1462
bool recheckLanes()
recheck whether all lanes within the edge are all right and optimises the connections once again ...
Definition: NBEdge.cpp:2135
int myLane2Find
index of lane to find
Definition: NBEdge.h:1721
bool hasLaneParams() const
whether one of the lanes has parameters set
Definition: NBEdge.cpp:2061
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:351
double mySpeed
The maximal speed.
Definition: NBEdge.h:1470
double getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:514
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:622
void extendGeometryAtNode(const NBNode *node, double maxExtent)
linearly extend the geometry at the given node
Definition: NBEdge.cpp:573
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
bool myCheckRight
check if is right
Definition: NBEdge.h:1700
JunctionPriority
junction priority values set by setJunctionPriority
Definition: NBEdge.h:288
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:1129
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:530
double getTotalAngle() const
Returns the angle at the start of the edge.
Definition: NBEdge.h:481
void setTurningDestination(NBEdge *e, bool onlyPossible=false)
Sets the turing destination at the given edge.
Definition: NBEdge.cpp:1828
int myFromLane
index of from lane
Definition: NBEdge.h:1661
void addStraightConnections(const EdgeVector *outgoing, const std::vector< int > &availableLanes, const std::vector< int > *priorities)
add some straight connections
Definition: NBEdge.cpp:2458
void disableConnection4TLS(int fromLane, NBEdge *toEdge, int toLane)
disable connections for TLS
Definition: NBEdge.cpp:2821
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:2039
EdgeVector mySuccessors
Definition: NBEdge.h:1554
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:855
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:867
PositionVector myToBorder
Definition: NBEdge.h:1546
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:3417
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:3198
static const int UNSPECIFIED_INTERNAL_LANE_INDEX
internal lane computation not yet done
Definition: NBEdge.h:282
NBEdge * myEdge
the edge to compute the relative angle of
Definition: NBEdge.h:1747
void setPreferredVehicleClass(SVCPermissions permissions, int lane=-1)
set preferred Vehicle Class
Definition: NBEdge.cpp:3317
const PositionVector & getNodeBorder(const NBNode *node)
Definition: NBEdge.cpp:646
double mySignalOffset
the offset of a traffic light signal from the end of this edge (-1 for None)
Definition: NBEdge.h:1541
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:2050
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1686
std::vector< Connection > myConnectionsToDelete
List of connections marked for delayed removal.
Definition: NBEdge.h:1478
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:1619
void setJunctionPriority(const NBNode *const node, int prio)
Sets the junction priority of the edge.
Definition: NBEdge.cpp:1791
void addBikeLane(double width)
add a bicycle lane of the given width and shift existing connctions
Definition: NBEdge.cpp:3470
const EdgeVector * getConnectedSorted()
Returns the list of outgoing edges without the turnaround sorted in clockwise direction.
Definition: NBEdge.cpp:1177
static double getTravelTimeStatic(const NBEdge *const edge, const NBVehicle *const, double)
Definition: NBEdge.h:1270
NBEdge *const myEdge2Find
edge to find
Definition: NBEdge.h:1664
void restoreRestrictedLane(SUMOVehicleClass vclass, std::vector< NBEdge::Lane > oldLanes, PositionVector oldGeometry, std::vector< NBEdge::Connection > oldConnections)
restore a restricted lane
Definition: NBEdge.cpp:3516
void sortOutgoingConnectionsByIndex()
sorts the outgoing connections by their from-lane-index and their to-lane-index
Definition: NBEdge.cpp:1259
NBEdge *const myEdge2Find
edge to find
Definition: NBEdge.h:1631
std::string myType
The type of the edge.
Definition: NBEdge.h:1451
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:2967
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:450
bool isTurningDirectionAt(const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
Definition: NBEdge.cpp:2684
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:1220
The connection was computed.
Definition: NBEdge.h:105
bool operator()(const Connection &c) const
operator ()
Definition: NBEdge.h:1653
Represents a single node (junction) during network building.
Definition: NBNode.h:68
bool isInternal() const
Returns whether this edge was marked as being within an intersection.
Definition: NBEdge.h:974
void dismissVehicleClassInformation()
dimiss vehicle class information
Definition: NBEdge.cpp:3352
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:3621
void replaceInConnections(NBEdge *which, NBEdge *by, int laneOff)
replace in current connections of edge
Definition: NBEdge.cpp:1360
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
Definition: NBEdge.cpp:1214
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
Direction
enum of possible directions
Definition: NBEdge.h:1347
const EdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges for the given vClass.
Definition: NBEdge.cpp:3603
void preferVehicleClass(int lane, SUMOVehicleClass vclass)
prefer certain vehicle class
Definition: NBEdge.cpp:3161
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:962
void checkGeometry(const double maxAngle, const double minRadius, bool fix)
Check the angles of successive geometry segments.
Definition: NBEdge.cpp:928
void allowVehicleClass(int lane, SUMOVehicleClass vclass)
set allowed class for the given lane or for all lanes if -1 is given
Definition: NBEdge.cpp:3135
void insertConnection(NBEdge::Connection connection)
insert a previously created NBEdge::connection
Definition: NBEdge.cpp:1111
void addGeometryPoint(int index, const Position &p)
Adds a further geometry point.
Definition: NBEdge.cpp:867
void shiftToLanesToEdge(NBEdge *to, int laneOff)
modifify the toLane for all connections to the given edge
Definition: NBEdge.cpp:3539
void computeAngle()
computes the angle of this edge and stores it in myAngle
Definition: NBEdge.cpp:1899
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:434
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:2086
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:2851
int myFromLane
index of from lane
Definition: NBEdge.h:1694
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:497
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
Definition: NBEdge.cpp:861
double myLength
The length of the edge.
Definition: NBEdge.h:1457
void divideSelectedLanesOnEdges(const EdgeVector *outgoing, const std::vector< int > &availableLanes, const std::vector< int > *priorities)
divide selected lanes on edges
Definition: NBEdge.cpp:2344
PositionVector computeLaneShape(int lane, double offset) const
Computes the shape for the given lane.
Definition: NBEdge.cpp:1887
double getShapeEndAngle() const
Returns the angle at the end of the edge.
Definition: NBEdge.cpp:1959
double myLoadedLength
An optional length to use (-1 if not valid)
Definition: NBEdge.h:1516
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:1535
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:1454
bool canMoveConnection(const Connection &con, int newFromLane) const
whether the connection can originate on newFromLane
Definition: NBEdge.cpp:1442
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:1143
bool isNearEnough2BeJoined2(NBEdge *e, double threshold) const
Check if edge is near enought to be joined to another edge.
Definition: NBEdge.cpp:3034
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:441
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:1277
void shiftPositionAtNode(NBNode *node, NBEdge *opposite)
shift geometry at the given node to avoid overlap
Definition: NBEdge.cpp:3550
NBEdge *const myEdge2Find
edge to find
Definition: NBEdge.h:1697
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:3148
void copyConnectionsFrom(NBEdge *src)
copy connections from antoher edge
Definition: NBEdge.cpp:1435
A class that being a bresenham-callback assigns the incoming lanes to the edges.
Definition: NBEdge.h:1304
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:3174
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:459
void reshiftPosition(double xoff, double yoff)
Applies an offset to the edge.
Definition: NBEdge.cpp:501
const std::map< NBEdge *, std::vector< int > > & getBuiltConnections() const
get built connections
Definition: NBEdge.h:1324
NBEdge::Lane getFirstNonPedestrianLane(int direction) const
get first non-pedestrian lane
Definition: NBEdge.cpp:3433
bool splitGeometry(NBEdgeCont &ec, NBNodeCont &nc)
Splits this edge at geometry points.
Definition: NBEdge.cpp:877