SUMO - Simulation of Urban MObility
NBEdge.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // The representation of a single edge during network building
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef NBEdge_h
23 #define NBEdge_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <map>
36 #include <vector>
37 #include <string>
38 #include <set>
39 #include <utils/common/Named.h>
43 #include <utils/geom/Bresenham.h>
45 #include <utils/geom/Line.h>
48 #include "NBCont.h"
49 #include "NBHelpers.h"
50 #include "NBSign.h"
51 
52 
53 // ===========================================================================
54 // class declarations
55 // ===========================================================================
56 class NBNode;
57 class NBConnection;
58 class NBNodeCont;
59 class NBEdgeCont;
60 class OutputDevice;
61 class GNELane;
62 
63 
64 // ===========================================================================
65 // class definitions
66 // ===========================================================================
71 class NBEdge : public Named, public Parameterised {
73  friend class NBEdgeSuccessorBuilder;
74  friend class NBEdgeCont;
75 
77  friend class GNELane;
78  friend class GNEEdge;
79 
80 public:
81 
104  };
105 
106 
117  };
118 
119 
123  struct Lane {
124  Lane(NBEdge* e) :
126  endOffset(e->getEndOffset()), width(e->getLaneWidth()) {}
140  std::string origID;
141 
142  };
143 
144 
148  struct Connection {
154  Connection(int fromLane_, NBEdge* toEdge_, int toLane_)
155  : fromLane(fromLane_), toEdge(toEdge_), toLane(toLane_),
156  mayDefinitelyPass(false), haveVia(false) { }
157 
159 
160 
162  int fromLane;
166  int toLane;
168  std::string tlID;
170  unsigned int tlLinkNo;
173 
174 
175  std::string origID;
176 
177  std::string id;
180 
181  bool haveVia;
182  std::string viaID;
185 
186  std::vector<unsigned int> foeInternalLinks;
187  std::string foeIncomingLanes;
188 
190  unsigned int internalLaneIndex;
191 
192  std::string getInternalLaneID() const;
193 
194  };
195 
197  static std::pair<SUMOReal, SUMOReal> laneOffset(const Position& from,
198  const Position& to, SUMOReal laneCenterOffset, bool leftHand);
199 
209  static const SUMOReal ANGLE_LOOKAHEAD;
210 
211 public:
230  NBEdge(const std::string& id,
231  NBNode* from, NBNode* to, std::string type,
232  SUMOReal speed, unsigned int nolanes, int priority,
233  SUMOReal width, SUMOReal offset,
234  const std::string& streetName = "",
236 
237 
258  NBEdge(const std::string& id,
259  NBNode* from, NBNode* to, std::string type,
260  SUMOReal speed, unsigned int nolanes, int priority,
261  SUMOReal width, SUMOReal offset,
262  PositionVector geom,
263  const std::string& streetName = "",
265  bool tryIgnoreNodePositions = false);
266 
278  NBEdge(const std::string& id,
279  NBNode* from, NBNode* to,
280  NBEdge* tpl,
281  const PositionVector& geom = PositionVector(),
282  int numLanes = -1);
283 
284 
287  ~NBEdge();
288 
289 
305  void reinit(NBNode* from, NBNode* to, const std::string& type,
306  SUMOReal speed, unsigned int nolanes, int priority,
307  PositionVector geom, SUMOReal width, SUMOReal offset,
308  const std::string& streetName,
310  bool tryIgnoreNodePositions = false);
311 
316  void reinitNodes(NBNode* from, NBNode* to);
317 
318 
321 
326  void reshiftPosition(SUMOReal xoff, SUMOReal yoff);
328 
329 
330 
333  void setLeftHanded() {
334  myAmLeftHand = true;
335  }
336 
337 
339 
340 
344  unsigned int getNumLanes() const {
345  return (unsigned int) myLanes.size();
346  }
347 
348 
352  int getPriority() const {
353  return myPriority;
354  }
355 
356 
360  NBNode* getFromNode() const {
361  return myFrom;
362  }
363 
364 
368  NBNode* getToNode() const {
369  return myTo;
370  }
371 
372 
377  inline SUMOReal getStartAngle() const {
378  return myStartAngle;
379  }
380 
381 
386  inline SUMOReal getEndAngle() const {
387  return myEndAngle;
388  }
389 
390 
392 
396  inline SUMOReal getTotalAngle() const {
397  return myTotalAngle;
398  }
399 
403  SUMOReal getLength() const {
404  return myLength;
405  }
406 
407 
413  return myLoadedLength > 0 ? myLoadedLength : myLength;
414  }
415 
416 
420  bool hasLoadedLength() const {
421  return myLoadedLength > 0;
422  }
423 
424 
428  SUMOReal getSpeed() const {
429  return mySpeed;
430  }
431 
432 
439  return myStep;
440  }
441 
442 
447  return myLaneWidth;
448  }
449 
453  SUMOReal getLaneWidth(int lane) const;
454 
455 
458  const std::string& getStreetName() const {
459  return myStreetName;
460  }
461 
464  void setStreetName(const std::string& name) {
465  myStreetName = name;
466  }
467 
472  return myEndOffset;
473  }
474 
478  SUMOReal getEndOffset(int lane) const;
479 
483  return mySignalOffset;
484  }
485 
488  void setSignalOffset(SUMOReal offset) {
489  mySignalOffset = offset;
490  }
491 
495  const std::string& getTypeName() const {
496  return myType;
497  }
498 
499 
503  const std::vector<NBEdge::Lane>& getLanes() const {
504  return myLanes;
505  }
507 
509  int getFirstNonPedestrianLaneIndex(int direction) const;
510  NBEdge::Lane getFirstNonPedestrianLane(int direction) const;
511 
514 
516 
517 
521  const PositionVector& getGeometry() const {
522  return myGeom;
523  }
524 
525 
527  const PositionVector getInnerGeometry() const;
528 
529 
532  bool hasDefaultGeometry() const;
533 
534 
540  bool hasDefaultGeometryEndpoints() const;
541 
542 
553  void setGeometry(const PositionVector& g, bool inner = false);
554 
555 
565  void addGeometryPoint(int index, const Position& p);
566 
567 
577  void computeEdgeShape();
578 
579 
583  const PositionVector& getLaneShape(unsigned int i) const;
584 
585 
591 
592 
598  return myLaneSpreadFunction;
599  }
600 
601 
607  bool splitGeometry(NBEdgeCont& ec, NBNodeCont& nc);
608 
609 
613  void reduceGeometry(const SUMOReal minDist);
614 
615 
621  void checkGeometry(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix);
623 
624 
625 
628 
643  bool addEdge2EdgeConnection(NBEdge* dest);
644 
645 
666  bool addLane2LaneConnection(unsigned int fromLane, NBEdge* dest,
667  unsigned int toLane, Lane2LaneInfoType type,
668  bool mayUseSameDestination = false,
669  bool mayDefinitelyPass = false);
670 
671 
689  bool addLane2LaneConnections(unsigned int fromLane,
690  NBEdge* dest, unsigned int toLane, unsigned int no,
691  Lane2LaneInfoType type, bool invalidatePrevious = false,
692  bool mayDefinitelyPass = false);
693 
694 
705  void setConnection(unsigned int lane, NBEdge* destEdge,
706  unsigned int destLane,
707  Lane2LaneInfoType type,
708  bool mayUseSameDestination = false,
709  bool mayDefinitelyPass = false);
710 
711 
712 
721  std::vector<Connection> getConnectionsFromLane(unsigned int lane) const;
722 
723 
732  bool hasConnectionTo(NBEdge* destEdge, unsigned int destLane, int fromLane = -1) const;
733 
734 
741  bool isConnectedTo(NBEdge* e);
742 
743 
747  const std::vector<Connection>& getConnections() const {
748  return myConnections;
749  }
750 
751 
755  std::vector<Connection>& getConnections() {
756  return myConnections;
757  }
758 
759 
764 
765 
770 
771 
775  std::vector<int> getConnectionLanes(NBEdge* currentOutgoing) const;
776 
777 
781 
782 
786 
787 
793  void remapConnections(const EdgeVector& incoming);
794 
795 
802  void removeFromConnections(NBEdge* toEdge, int fromLane = -1, int toLane = -1, bool tryLater = false);
803 
804  void invalidateConnections(bool reallowSetting = false);
805 
806  void replaceInConnections(NBEdge* which, NBEdge* by, unsigned int laneOff);
807  void replaceInConnections(NBEdge* which, const std::vector<NBEdge::Connection>& origConns);
808  void copyConnectionsFrom(NBEdge* src);
809 
811  void shiftToLanesToEdge(NBEdge* to, unsigned int laneOff);
813 
814 
815 
821  bool isTurningDirectionAt(const NBNode* n, const NBEdge* const edge) const;
822  void setTurningDestination(NBEdge* e);
823 
824 
825 
828 
833  }
834 
835 
839  bool isMacroscopicConnector() const {
841  }
842 
843 
846  void setIsInnerEdge() {
847  myAmInnerEdge = true;
848  }
849 
850 
854  bool isInnerEdge() const {
855  return myAmInnerEdge;
856  }
858 
859 
860 
861 
867  void setJunctionPriority(const NBNode* const node, int prio);
868 
869 
879  int getJunctionPriority(const NBNode* const node) const;
880 
881  void setLoadedLength(SUMOReal val);
883 
884 
885  const std::string& getTypeID() const {
886  return myType;
887  }
888 
890  bool needsLaneSpecificOutput() const;
891 
893  bool hasRestrictions() const;
894 
896  bool hasLaneSpecificPermissions() const;
897 
899  bool hasLaneSpecificSpeed() const;
900 
902  bool hasLaneSpecificEndOffset() const;
903 
905  bool hasLaneSpecificWidth() const;
906 
908  bool computeEdge2Edges(bool noLeftMovers);
909 
911  bool computeLanes2Edges(const bool buildCrossingsAndWalkingAreas);
912 
915  bool recheckLanes(const bool buildCrossingsAndWalkingAreas);
916 
925  void appendTurnaround(bool noTLSControlled);
926 
927 
928 
932  NBNode* tryGetNodeAtPosition(SUMOReal pos, SUMOReal tolerance = 5.0) const;
933 
934 
936 
937  bool lanesWereAssigned() const;
938 
939  bool mayBeTLSControlled(int fromLane, NBEdge* toEdge, int toLane) const;
940 
942  bool setControllingTLInformation(const NBConnection& c, const std::string& tlID);
943 
946 
948  PositionVector& into);
949 
950  SUMOReal width() const;
951 
952  PositionVector getCWBoundaryLine(const NBNode& n, SUMOReal offset) const;
953  PositionVector getCCWBoundaryLine(const NBNode& n, SUMOReal offset) const;
954 
955  bool expandableBy(NBEdge* possContinuation) const;
956  void append(NBEdge* continuation);
957 
958  bool hasSignalisedConnectionTo(const NBEdge* const e) const;
959 
960 
961  void moveOutgoingConnectionsFrom(NBEdge* e, unsigned int laneOff);
962 
963  NBEdge* getTurnDestination() const;
964 
965  std::string getLaneID(unsigned int lane) const;
966 
967  std::string getLaneIDInsecure(unsigned int lane) const;
968 
969  SUMOReal getLaneSpeed(unsigned int lane) const;
970 
971  bool isNearEnough2BeJoined2(NBEdge* e, SUMOReal threshold) const;
972 
973 
981  SUMOReal getAngleAtNode(const NBNode* const node) const;
982 
983 
984  void incLaneNo(unsigned int by);
985 
986  void decLaneNo(unsigned int by, int dir = 0);
987 
988  void markAsInLane2LaneState();
989 
991  void addSidewalk(SUMOReal width);
992 
994  void setPermissions(SVCPermissions permissions, int lane = -1);
995 
996  void setPreferredVehicleClass(SVCPermissions permissions, int lane = -1);
997 
999  void allowVehicleClass(int lane, SUMOVehicleClass vclass);
1001  void disallowVehicleClass(int lane, SUMOVehicleClass vclass);
1002 
1003  void preferVehicleClass(int lane, SUMOVehicleClass vclass);
1004 
1005 
1007  void setLaneWidth(int lane, SUMOReal width);
1008 
1010  void setEndOffset(int lane, SUMOReal offset);
1011 
1013  void setSpeed(int lane, SUMOReal speed);
1014 
1016  SVCPermissions getPermissions(int lane = -1) const;
1017 
1018  void disableConnection4TLS(int fromLane, NBEdge* toEdge, int toLane);
1019 
1020 
1021  // returns a reference to the internal structure for the convenience of NETEDIT
1022  Lane& getLaneStruct(unsigned int lane) {
1023  return myLanes[lane];
1024  }
1025 
1026  // returns a reference to the internal structure for the convenience of NETEDIT
1027  const Lane& getLaneStruct(unsigned int lane) const {
1028  return myLanes[lane];
1029  }
1030 
1031  /* declares connections as fully loaded. This is needed to avoid recomputing connections
1032  * if an edge has no connections intentionally. */
1035  }
1036 
1037  /* @brief fill connection attributes shape, viaShape, ...
1038  *
1039  * @param[in,out] edgeIndex The number of connections already handled
1040  * @param[in,out] splitIndex The number of via edges already built
1041  * @param[in] tryIgnoreNodePositions Does not add node geometries if geom.size()>=2
1042  */
1043  void buildInnerEdges(const NBNode& n, unsigned int noInternalNoSplits, unsigned int& linkIndex, unsigned int& splitIndex);
1044 
1045  inline const std::vector<NBSign>& getSigns() const {
1046  return mySigns;
1047  }
1048 
1049  inline void addSign(NBSign sign) {
1050  mySigns.push_back(sign);
1051  }
1052 
1053 
1054 private:
1061  private:
1063  std::map<NBEdge*, std::vector<unsigned int> > myConnections;
1064 
1067 
1068  public:
1071  : myTransitions(transitions) { }
1072 
1075 
1077  void execute(const unsigned int lane, const unsigned int virtEdge);
1078 
1079  const std::map<NBEdge*, std::vector<unsigned int> >& getBuiltConnections() const {
1080  return myConnections;
1081  }
1082 
1083  private:
1086 
1089 
1090  };
1091 
1092 
1101  public:
1104 
1107  std::vector<Direction> myDirs;
1108 
1109  public:
1111  MainDirections(const EdgeVector& outgoing,
1112  NBEdge* parent, NBNode* to);
1113 
1115  ~MainDirections();
1116 
1119  bool empty() const;
1120 
1123  bool includes(Direction d) const;
1124 
1125  private:
1128 
1131 
1132  };
1133 
1135  PositionVector computeLaneShape(unsigned int lane, SUMOReal offset);
1136 
1138  //std::pair<SUMOReal, SUMOReal> laneOffset(const Position& from, const Position& to, SUMOReal laneCenterOffset);
1139 
1140  void computeLaneShapes();
1141 
1142 
1143 
1144 private:
1160  void init(unsigned int noLanes, bool tryIgnoreNodePositions);
1161 
1162 
1164  void divideOnEdges(const EdgeVector* outgoing, const bool buildCrossingsAndWalkingAreas);
1165 
1168  std::vector<unsigned int>* prepareEdgePriorities(
1169  const EdgeVector* outgoing);
1170 
1172  unsigned int computePrioritySum(std::vector<unsigned int>* priorities);
1173 
1174 
1177 
1180  void moveConnectionToLeft(unsigned int lane, const bool buildCrossingsAndWalkingAreas);
1181 
1184  void moveConnectionToRight(unsigned int lane, const bool buildCrossingsAndWalkingAreas);
1185 
1187  bool canMoveConnection(const Connection& con, unsigned int newFromLane, const bool buildCrossingsAndWalkingAreas) const;
1189 
1190 
1195  PositionVector startShapeAt(const PositionVector& laneShape, const NBNode* startNode) const;
1196 
1198  void computeAngle();
1199 
1200 private:
1205 
1207  std::string myType;
1208 
1211 
1214 
1219 
1222 
1225 
1229  std::vector<Connection> myConnections;
1230 
1233  std::vector<Connection> myConnectionsToDelete;
1234 
1237 
1240 
1243 
1246 
1249 
1252 
1255 
1259  std::vector<Lane> myLanes;
1260 
1263 
1266 
1267 
1270 
1273 
1277  int toLane;
1278  };
1279 
1280  std::vector<TLSDisabledConnection> myTLSDisabledConnections;
1281 
1282 
1284  std::string myStreetName;
1285 
1286 
1288  std::vector<NBSign> mySigns;
1289 
1292 
1293 public:
1298  public:
1301 
1302  bool operator()(const TLSDisabledConnection& e) const {
1303  if (e.to != myDefinition.to) {
1304  return false;
1305  }
1306  if (e.fromLane != myDefinition.fromLane) {
1307  return false;
1308  }
1309  if (e.toLane != myDefinition.toLane) {
1310  return false;
1311  }
1312  return true;
1313  }
1314 
1315  private:
1317 
1318  private:
1321 
1322  };
1323 
1324 
1325 
1330  public:
1332  connections_toedge_finder(NBEdge* const edge2find) : myEdge2Find(edge2find) { }
1333 
1334  bool operator()(const Connection& c) const {
1335  return c.toEdge == myEdge2Find;
1336  }
1337 
1338  private:
1340 
1341  private:
1344 
1345  };
1346 
1351  public:
1353  connections_toedgelane_finder(NBEdge* const edge2find, int lane2find, int fromLane2find) :
1354  myEdge2Find(edge2find),
1355  myLane2Find(lane2find),
1356  myFromLane2Find(fromLane2find) { }
1357 
1358  bool operator()(const Connection& c) const {
1359  return c.toEdge == myEdge2Find && c.toLane == myLane2Find && (myFromLane2Find < 0 || c.fromLane == myFromLane2Find);
1360  }
1361 
1362  private:
1366 
1367  private:
1370 
1371  };
1372 
1373 
1378  public:
1380  connections_finder(int fromLane, NBEdge* const edge2find, int lane2find) : myFromLane(fromLane), myEdge2Find(edge2find), myLane2Find(lane2find) { }
1381 
1382  bool operator()(const Connection& c) const {
1383  return c.fromLane == myFromLane && c.toEdge == myEdge2Find && c.toLane == myLane2Find;
1384  }
1385 
1386  private:
1390 
1391  private:
1394 
1395  };
1396 
1401  public:
1403  connections_fromlane_finder(int lane2find) : myLane2Find(lane2find) { }
1404 
1405  bool operator()(const Connection& c) const {
1406  return c.fromLane == myLane2Find;
1407  }
1408 
1409  private:
1411 
1412  private:
1415 
1416  };
1417 
1421  static bool connections_sorter(const Connection& c1, const Connection& c2);
1422 
1428  public:
1431 
1432  public:
1434  int operator()(const Connection& c1, const Connection& c2) const;
1435 
1436  private:
1439  };
1440 
1441 private:
1443  NBEdge(const NBEdge& s);
1444 
1446  NBEdge& operator=(const NBEdge& s);
1447 
1448 
1449 };
1450 
1451 
1452 #endif
1453 
1454 /****************************************************************************/
1455 
ToEdgeConnectionsAdder(const EdgeVector &transitions)
constructor
Definition: NBEdge.h:1070
NBEdge::Lane getFirstNonPedestrianLane(int direction) const
Definition: NBEdge.cpp:2228
std::string id
Definition: NBEdge.h:177
void invalidateConnections(bool reallowSetting=false)
Definition: NBEdge.cpp:863
const PositionVector & getLaneShape(unsigned int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:489
std::vector< Lane > myLanes
Lane information.
Definition: NBEdge.h:1259
bool includes(Direction d) const
Definition: NBEdge.cpp:160
bool hasConnectionTo(NBEdge *destEdge, unsigned int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
Definition: NBEdge.cpp:738
const std::string & getTypeID() const
Definition: NBEdge.h:885
bool setControllingTLInformation(const NBConnection &c, const std::string &tlID)
Returns if the link could be set as to be controlled.
Definition: NBEdge.cpp:1736
SUMOReal endOffset
This lane's offset to the intersection begin.
Definition: NBEdge.h:136
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:148
int toLane
The lane the connections yields in.
Definition: NBEdge.h:166
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:201
SUMOReal myTotalAngle
Definition: NBEdge.h:1218
A class representing a single street sign.
Definition: NBSign.h:51
connections_finder(int fromLane, NBEdge *const edge2find, int lane2find)
constructor
Definition: NBEdge.h:1380
std::string foeIncomingLanes
Definition: NBEdge.h:187
PositionVector shape
The lane's shape.
Definition: NBEdge.h:128
SUMOReal myEndOffset
This edges's offset to the intersection begin (will be applied to all lanes)
Definition: NBEdge.h:1251
std::vector< TLSDisabledConnection > myTLSDisabledConnections
Definition: NBEdge.h:1280
connections_relative_edgelane_sorter(NBEdge *e)
constructor
Definition: NBEdge.h:1430
~NBEdge()
Destructor.
Definition: NBEdge.cpp:354
static const SUMOReal UNSPECIFIED_SIGNAL_OFFSET
unspecified signal offset
Definition: NBEdge.h:205
LaneSpreadFunction myLaneSpreadFunction
The information about how to spread the lanes.
Definition: NBEdge.h:1248
SUMOReal viaVmax
Definition: NBEdge.h:183
void sortOutgoingConnectionsByAngle()
sorts the outgoing connections by their angle relative to their junction
Definition: NBEdge.cpp:811
const std::string & getTypeName() const
Returns the type name.
Definition: NBEdge.h:495
std::string viaID
Definition: NBEdge.h:182
void addSign(NBSign sign)
Definition: NBEdge.h:1049
NBEdge * toEdge
The edge the connections yields in.
Definition: NBEdge.h:164
bool hasDefaultGeometry() const
Returns whether the geometry consists only of the node positions.
Definition: NBEdge.cpp:379
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
NBNode * myTo
Definition: NBEdge.h:1210
The relationships between edges are computed/loaded.
Definition: NBEdge.h:95
bool empty() const
Definition: NBEdge.cpp:154
void appendTurnaround(bool noTLSControlled)
Add a connection to the previously computed turnaround, if wished.
Definition: NBEdge.cpp:1640
connections_toedge_finder & operator=(const connections_toedge_finder &s)
invalidated assignment operator
bool operator()(const TLSDisabledConnection &e) const
Definition: NBEdge.h:1302
PositionVector getCCWBoundaryLine(const NBNode &n, SUMOReal offset) const
Definition: NBEdge.cpp:1834
std::vector< NBSign > mySigns
the street signs along this edge
Definition: NBEdge.h:1288
bool hasLaneSpecificEndOffset() const
whether lanes differ in offset
Definition: NBEdge.cpp:1392
void setLaneWidth(int lane, SUMOReal width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2066
void moveConnectionToRight(unsigned int lane, const bool buildCrossingsAndWalkingAreas)
Definition: NBEdge.cpp:985
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2112
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:503
void moveOutgoingConnectionsFrom(NBEdge *e, unsigned int laneOff)
Definition: NBEdge.cpp:1697
~ToEdgeConnectionsAdder()
destructor
Definition: NBEdge.h:1074
void addSidewalk(SUMOReal width)
add a pedestrian sidewalk of the given width and shift existing connctions
Definition: NBEdge.cpp:2237
SUMOReal getEndAngle() const
Returns the angle at the end of the edge The angle is computed in computeAngle()
Definition: NBEdge.h:386
int SVCPermissions
The representation of a single edge during network building.
Definition: NBEdge.h:71
void reinitNodes(NBNode *from, NBNode *to)
Resets nodes but keeps all other values the same (used when joining)
Definition: NBEdge.cpp:290
void clearControllingTLInformation()
clears tlID for all connections
Definition: NBEdge.cpp:1801
Lane2LaneInfoType
Modes of setting connections between lanes.
Definition: NBEdge.h:110
void declareConnectionsAsLoaded()
Definition: NBEdge.h:1033
bool mayBeTLSControlled(int fromLane, NBEdge *toEdge, int toLane) const
Definition: NBEdge.cpp:1725
bool hasDefaultGeometryEndpoints() const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
Definition: NBEdge.cpp:385
bool operator()(const Connection &c) const
Definition: NBEdge.h:1358
void incLaneNo(unsigned int by)
Definition: NBEdge.cpp:1979
static std::pair< SUMOReal, SUMOReal > laneOffset(const Position &from, const Position &to, SUMOReal laneCenterOffset, bool leftHand)
Computes the offset from the edge shape on the current segment.
Definition: NBEdge.cpp:1293
bool addLane2LaneConnections(unsigned int fromLane, NBEdge *dest, unsigned int toLane, unsigned int no, Lane2LaneInfoType type, bool invalidatePrevious=false, bool mayDefinitelyPass=false)
Builds no connections starting at the given lanes.
Definition: NBEdge.cpp:650
void setStreetName(const std::string &name)
sets the street name of this edge
Definition: NBEdge.h:464
std::vector< Direction > myDirs
Definition: NBEdge.h:1107
void buildInnerEdges(const NBNode &n, unsigned int noInternalNoSplits, unsigned int &linkIndex, unsigned int &splitIndex)
Definition: NBEdge.cpp:1009
void markAsInLane2LaneState()
Definition: NBEdge.cpp:2020
bool addLane2LaneConnection(unsigned int fromLane, NBEdge *dest, unsigned int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false)
Adds a connection between the specified this edge's lane and an approached one.
Definition: NBEdge.cpp:628
Lanes to lanes - relationships are computed; should be recheked.
Definition: NBEdge.h:99
PositionVector computeLaneShape(unsigned int lane, SUMOReal offset)
Computes the shape for the given lane.
Definition: NBEdge.cpp:1232
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:446
std::string getLaneIDInsecure(unsigned int lane) const
Definition: NBEdge.cpp:1965
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:2128
int myFromJunctionPriority
The priority normalised for the node the edge is outgoing of.
Definition: NBEdge.h:1239
void computeLaneShapes()
Computes the offset from the edge shape on the current segment.
Definition: NBEdge.cpp:1186
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
Definition: NBEdge.h:172
tls_disable_finder(const TLSDisabledConnection &tpl)
constructor
Definition: NBEdge.h:1300
bool isInnerEdge() const
Returns whether this edge was marked as being within an intersection.
Definition: NBEdge.h:854
PositionVector myGeom
The geometry for the edge.
Definition: NBEdge.h:1245
void remapConnections(const EdgeVector &incoming)
Remaps the connection in a way that allows the removal of it.
Definition: NBEdge.cpp:823
bool isTurningDirectionAt(const NBNode *n, const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
Definition: NBEdge.cpp:1655
const SVCPermissions SVCAll
void divideOnEdges(const EdgeVector *outgoing, const bool buildCrossingsAndWalkingAreas)
Definition: NBEdge.cpp:1492
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:203
PositionVector getCWBoundaryLine(const NBNode &n, SUMOReal offset) const
Definition: NBEdge.cpp:1819
std::vector< Connection > getConnectionsFromLane(unsigned int lane) const
Returns connections from a given lane.
Definition: NBEdge.cpp:726
friend class GNEEdge
Definition: NBEdge.h:78
MainDirections & operator=(const MainDirections &)
Invalidated assignment operator.
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge's geometry
Definition: NBEdge.cpp:392
void setSignalOffset(SUMOReal offset)
sets the offset of a traffic signal from the end of this edge
Definition: NBEdge.h:488
void moveConnectionToLeft(unsigned int lane, const bool buildCrossingsAndWalkingAreas)
Definition: NBEdge.cpp:960
const EdgeVector & myTransitions
the transition from the virtual lane to the edge it belongs to
Definition: NBEdge.h:1066
The connection was computed and validated.
Definition: NBEdge.h:116
PositionVector startShapeAt(const PositionVector &laneShape, const NBNode *startNode) const
Definition: NBEdge.cpp:448
SUMOReal vmax
Definition: NBEdge.h:179
const std::vector< NBSign > & getSigns() const
Definition: NBEdge.h:1045
The edge has been loaded, nothing is computed yet.
Definition: NBEdge.h:93
int myToJunctionPriority
The priority normalised for the node the edge is incoming in.
Definition: NBEdge.h:1242
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
Definition: NBEdge.cpp:785
PositionVector shape
Definition: NBEdge.h:178
SUMOReal speed
The speed allowed on this lane.
Definition: NBEdge.h:130
void setTurningDestination(NBEdge *e)
Definition: NBEdge.cpp:1174
bool operator()(const Connection &c) const
Definition: NBEdge.h:1334
SUMOReal getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
Definition: NBEdge.h:412
An (internal) definition of a single lane of an edge.
Definition: NBEdge.h:123
SUMOReal mySpeed
The maximal speed.
Definition: NBEdge.h:1224
SVCPermissions permissions
List of vehicle types that are allowed on this lane.
Definition: NBEdge.h:132
bool addEdge2EdgeConnection(NBEdge *dest)
Adds a connection to another edge.
Definition: NBEdge.cpp:604
bool recheckLanes(const bool buildCrossingsAndWalkingAreas)
Definition: NBEdge.cpp:1455
bool myAmMacroscopicConnector
Information whether this edge is a (macroscopic) connector.
Definition: NBEdge.h:1272
bool isConnectedTo(NBEdge *e)
Returns the information whethe a connection to the given edge has been added (or computed) ...
Definition: NBEdge.cpp:744
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition: NBEdge.cpp:370
bool computeLanes2Edges(const bool buildCrossingsAndWalkingAreas)
computes the edge, step2: computation of which lanes approach the edges)
Definition: NBEdge.cpp:1431
void reshiftPosition(SUMOReal xoff, SUMOReal yoff)
Applies an offset to the edge.
Definition: NBEdge.cpp:359
NBEdge * myTurnDestination
The turn destination edge.
Definition: NBEdge.h:1236
const std::map< NBEdge *, std::vector< unsigned int > > & getBuiltConnections() const
Definition: NBEdge.h:1079
const Lane & getLaneStruct(unsigned int lane) const
Definition: NBEdge.h:1027
friend class NBEdgeSuccessorBuilder
Definition: NBEdge.h:73
Lanes to lanes - relationships are loaded; no recheck is necessary/wished.
Definition: NBEdge.h:103
int operator()(const Connection &c1, const Connection &c2) const
comparing operation
Definition: NBEdge.cpp:169
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
Definition: NBEdge.cpp:1381
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:352
void checkGeometry(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix)
Check the angles of successive geometry segments.
Definition: NBEdge.cpp:558
std::string getLaneID(unsigned int lane) const
Definition: NBEdge.cpp:1958
bool myAmLeftHand
Whether this edge is a left-hand edge.
Definition: NBEdge.h:1265
void addCrossingPointsAsIncomingWithGivenOutgoing(NBEdge *o, PositionVector &into)
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBEdge.h:168
SVCPermissions preferred
List of vehicle types that are preferred on this lane.
Definition: NBEdge.h:134
int getFirstNonPedestrianLaneIndex(int direction) const
return the first lane with permissions other than SVC_PEDESTRIAN
Definition: NBEdge.cpp:2198
std::string getInternalLaneID() const
Definition: NBEdge.cpp:74
int fromLane
The lane the connections starts at.
Definition: NBEdge.h:162
bool canMoveConnection(const Connection &con, unsigned int newFromLane, const bool buildCrossingsAndWalkingAreas) const
whether the connection can originate on newFromLane
Definition: NBEdge.cpp:951
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
TLSDisabledConnection myDefinition
Definition: NBEdge.h:1316
NBEdge & operator=(const NBEdge &s)
invalidated assignment operator
A list of positions.
SUMOReal myEndAngle
Definition: NBEdge.h:1217
tls_disable_finder & operator=(const tls_disable_finder &s)
invalidated assignment operator
bool hasLaneSpecificPermissions() const
whether lanes differ in allowed vehicle classes
Definition: NBEdge.cpp:1356
bool lanesWereAssigned() const
Definition: NBEdge.cpp:1713
static bool connections_sorter(const Connection &c1, const Connection &c2)
Definition: NBEdge.cpp:2186
std::vector< unsigned int > foeInternalLinks
Definition: NBEdge.h:186
std::vector< Connection > & getConnections()
Returns the connections.
Definition: NBEdge.h:755
unsigned int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:344
EdgeBuildingStep
Current state of the edge within the building process.
Definition: NBEdge.h:89
void setAsMacroscopicConnector()
Marks this edge as a macroscopic connector.
Definition: NBEdge.h:831
bool hasLoadedLength() const
Returns whether a length was set explicitly.
Definition: NBEdge.h:420
friend class GNELane
Definition: NBEdge.h:77
EdgeBuildingStep getStep() const
The building step of this edge.
Definition: NBEdge.h:438
void setLeftHanded()
Marks this edge to be left-handed.
Definition: NBEdge.h:333
SUMOReal myLaneWidth
This width of this edge's lanes.
Definition: NBEdge.h:1254
int myPriority
The priority of the edge.
Definition: NBEdge.h:1221
void init(unsigned int noLanes, bool tryIgnoreNodePositions)
Initialization routines common to all constructors.
Definition: NBEdge.cpp:310
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
std::string origID
Definition: NBEdge.h:175
bool needsLaneSpecificOutput() const
whether at least one lane has values differing from the edges values
Definition: NBEdge.cpp:1403
Connection(int fromLane_, NBEdge *toEdge_, int toLane_)
Constructor.
Definition: NBEdge.h:154
ToEdgeConnectionsAdder & operator=(const ToEdgeConnectionsAdder &)
Invalidated assignment operator.
EdgeBuildingStep myStep
The building step.
Definition: NBEdge.h:1204
unsigned int computePrioritySum(std::vector< unsigned int > *priorities)
Definition: NBEdge.cpp:1630
connections_toedge_finder(NBEdge *const edge2find)
constructor
Definition: NBEdge.h:1332
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1229
void setLoadedLength(SUMOReal val)
Definition: NBEdge.cpp:2171
connections_fromlane_finder(int lane2find)
constructor
Definition: NBEdge.h:1403
The connection was given by the user.
Definition: NBEdge.h:114
An upper class for objects with additional parameters.
Definition: Parameterised.h:47
SUMOReal getSignalOffset() const
Returns the offset of a traffic signal from the end of this edge.
Definition: NBEdge.h:482
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false)
Removes the specified connection(s)
Definition: NBEdge.cpp:839
connections_toedgelane_finder & operator=(const connections_toedgelane_finder &s)
invalidated assignment operator
SUMOReal getEndOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:471
bool myAmInnerEdge
Information whether this is a junction-inner edge.
Definition: NBEdge.h:1269
Base class for objects which have an id.
Definition: Named.h:45
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
Definition: NBEdge.cpp:1142
SUMOReal myLoadedLength
An optional length to use (-1 if not valid)
Definition: NBEdge.h:1262
std::string origID
An original ID, if given (.
Definition: NBEdge.h:140
bool hasRestrictions() const
whether at least one lane has restrictions
Definition: NBEdge.cpp:1345
std::map< NBEdge *, std::vector< unsigned int > > myConnections
map of edges to this edge's lanes that reach them
Definition: NBEdge.h:1063
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:2156
SUMOReal getCrossingAngle(NBNode *node)
return the angle for computing pedestrian crossings at the given node
Definition: NBEdge.cpp:2212
Lane(NBEdge *e)
Definition: NBEdge.h:124
void decLaneNo(unsigned int by, int dir=0)
Definition: NBEdge.cpp:1994
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:368
#define sign(a)
Definition: polyfonts.c:68
std::vector< int > getConnectionLanes(NBEdge *currentOutgoing) const
Returns the list of lanes that may be used to reach the given edge.
Definition: NBEdge.cpp:797
void execute(const unsigned int lane, const unsigned int virtEdge)
executes a bresenham - step
Definition: NBEdge.cpp:82
void computeEdgeShape()
Recomputeds the lane shapes to terminate at the node shape For every lane the intersection with the f...
Definition: NBEdge.cpp:406
void disableConnection4TLS(int fromLane, NBEdge *toEdge, int toLane)
Definition: NBEdge.cpp:1809
PositionVector viaShape
Definition: NBEdge.h:184
SUMOReal getMaxLaneOffset()
Definition: NBEdge.cpp:1719
static const SUMOReal UNSPECIFIED_LOADED_LENGTH
no length override given
Definition: NBEdge.h:207
std::vector< NBEdge * > EdgeVector
Definition: NBCont.h:38
std::vector< unsigned int > * prepareEdgePriorities(const EdgeVector *outgoing)
Definition: NBEdge.cpp:1588
NBEdge * myEdge
the edge to compute the relative angle of
Definition: NBEdge.h:1438
SUMOReal myLength
The length of the edge.
Definition: NBEdge.h:1213
void setPreferredVehicleClass(SVCPermissions permissions, int lane=-1)
Definition: NBEdge.cpp:2142
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:521
The edge has been loaded and connections shall not be added.
Definition: NBEdge.h:91
std::vector< Connection > myConnectionsToDelete
List of connections marked for delayed removal.
Definition: NBEdge.h:1233
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:839
connections_toedgelane_finder(NBEdge *const edge2find, int lane2find, int fromLane2find)
constructor
Definition: NBEdge.h:1353
void reduceGeometry(const SUMOReal minDist)
Removes points with a distance lesser than the given.
Definition: NBEdge.cpp:552
void setJunctionPriority(const NBNode *const node, int prio)
Sets the junction priority of the edge.
Definition: NBEdge.cpp:1152
void replaceInConnections(NBEdge *which, NBEdge *by, unsigned int laneOff)
Definition: NBEdge.cpp:875
const EdgeVector * getConnectedSorted()
Returns the list of outgoing edges without the turnaround sorted in clockwise direction.
Definition: NBEdge.cpp:757
NBEdge *const myEdge2Find
Definition: NBEdge.h:1388
void setIsInnerEdge()
Marks this edge being within an intersection.
Definition: NBEdge.h:846
void sortOutgoingConnectionsByIndex()
sorts the outgoing connections by their from-lane-index and their to-lane-index
Definition: NBEdge.cpp:817
std::string myType
The type of the edge.
Definition: NBEdge.h:1207
SUMOReal mySignalOffset
the offset of a traffic light signal from the end of this edge (-1 for None)
Definition: NBEdge.h:1291
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
void append(NBEdge *continuation)
Definition: NBEdge.cpp:1917
unsigned int tlLinkNo
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:170
connections_finder & operator=(const connections_finder &s)
invalidated assignment operator
SUMOReal getLaneSpeed(unsigned int lane) const
Definition: NBEdge.cpp:1180
void shiftToLanesToEdge(NBEdge *to, unsigned int laneOff)
modifify the toLane for all connections to the given edge
Definition: NBEdge.cpp:2264
NBNode * tryGetNodeAtPosition(SUMOReal pos, SUMOReal tolerance=5.0) const
Returns the node at the given edges length (using an epsilon) When no node is existing at the given p...
Definition: NBEdge.cpp:1683
The connection was computed.
Definition: NBEdge.h:112
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
Definition: NBEdge.h:597
SUMOReal myStartAngle
The angles of the edge.
Definition: NBEdge.h:1216
SUMOReal getTotalAngle() const
get the angle as measure from the start to the end of this edge
Definition: NBEdge.h:396
Represents a single node (junction) during network building.
Definition: NBNode.h:75
void dismissVehicleClassInformation()
Definition: NBEdge.cpp:2177
Lane & getLaneStruct(unsigned int lane)
Definition: NBEdge.h:1022
bool hasSignalisedConnectionTo(const NBEdge *const e) const
Definition: NBEdge.cpp:1941
Lanes to lanes - relationships are computed; no recheck is necessary/wished.
Definition: NBEdge.h:101
NBEdge * getTurnDestination() const
Definition: NBEdge.cpp:1952
bool hasLaneSpecificWidth() const
whether lanes differ in width
Definition: NBEdge.cpp:1370
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
void setEndOffset(int lane, SUMOReal offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2096
Direction
enum of possible directions
Definition: NBEdge.h:1103
#define SUMOReal
Definition: config.h:215
bool isNearEnough2BeJoined2(NBEdge *e, SUMOReal threshold) const
Definition: NBEdge.cpp:1971
void preferVehicleClass(int lane, SUMOVehicleClass vclass)
Definition: NBEdge.cpp:2053
void allowVehicleClass(int lane, SUMOVehicleClass vclass)
set allowed class for the given lane or for all lanes if -1 is given
Definition: NBEdge.cpp:2027
void addGeometryPoint(int index, const Position &p)
Adds a further geometry point.
Definition: NBEdge.cpp:501
connections_fromlane_finder & operator=(const connections_fromlane_finder &s)
invalidated assignment operator
void computeAngle()
computes the angle of this edge and stores it in myAngle
Definition: NBEdge.cpp:1304
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:428
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:64
SUMOReal getStartAngle() const
Returns the angle at the start of the edge The angle is computed in computeAngle() ...
Definition: NBEdge.h:377
bool computeEdge2Edges(bool noLeftMovers)
computes the edge (step1: computation of approached edges)
Definition: NBEdge.cpp:1410
SUMOReal width() const
Definition: NBEdge.cpp:1849
void setConnection(unsigned int lane, NBEdge *destEdge, unsigned int destLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false)
Adds a connection to a certain lane of a certain edge.
Definition: NBEdge.cpp:667
unsigned int internalLaneIndex
The lane index of this internal lane within the internal edge.
Definition: NBEdge.h:190
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
Definition: NBEdge.cpp:495
bool operator()(const Connection &c) const
Definition: NBEdge.h:1382
NBEdge(const std::string &id, NBNode *from, NBNode *to, std::string type, SUMOReal speed, unsigned int nolanes, int priority, SUMOReal width, SUMOReal offset, const std::string &streetName="", LaneSpreadFunction spread=LANESPREAD_RIGHT)
Constructor.
Definition: NBEdge.cpp:180
Lanes to edges - relationships are computed/loaded.
Definition: NBEdge.h:97
std::string myStreetName
The street name (or whatever arbitrary string you wish to attach)
Definition: NBEdge.h:1284
const std::string & getStreetName() const
Returns the street name of this edge.
Definition: NBEdge.h:458
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:747
NBNode * myFrom
The source and the destination node.
Definition: NBEdge.h:1210
bool expandableBy(NBEdge *possContinuation) const
Definition: NBEdge.cpp:1855
~MainDirections()
destructor
Definition: NBEdge.cpp:150
bool operator()(const Connection &c) const
Definition: NBEdge.h:1405
void disallowVehicleClass(int lane, SUMOVehicleClass vclass)
set disallowed class for the given lane or for all lanes if -1 is given
Definition: NBEdge.cpp:2040
MainDirections(const EdgeVector &outgoing, NBEdge *parent, NBNode *to)
constructor
Definition: NBEdge.cpp:113
SUMOReal width
This lane's width.
Definition: NBEdge.h:138
void copyConnectionsFrom(NBEdge *src)
Definition: NBEdge.cpp:944
void reinit(NBNode *from, NBNode *to, const std::string &type, SUMOReal speed, unsigned int nolanes, int priority, PositionVector geom, SUMOReal width, SUMOReal offset, const std::string &streetName, LaneSpreadFunction spread=LANESPREAD_RIGHT, bool tryIgnoreNodePositions=false)
Resets initial values.
Definition: NBEdge.cpp:258
static const SUMOReal ANGLE_LOOKAHEAD
the distance at which to take the default anglen
Definition: NBEdge.h:209
SUMOReal getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:403
SUMOReal getAngleAtNode(const NBNode *const node) const
Returns the angle of the edge's geometry at the given node.
Definition: NBEdge.cpp:1162
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:360
bool splitGeometry(NBEdgeCont &ec, NBNodeCont &nc)
Splits this edge at geometry points.
Definition: NBEdge.cpp:507