SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-2013 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  offset(e->getOffset()), 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::string foeInternalLanes;
187  std::string foeIncomingLanes;
188 
189  };
190 
192  static std::pair<SUMOReal, SUMOReal> laneOffset(const Position& from,
193  const Position& to, SUMOReal laneCenterOffset, bool leftHand);
194 
202  static const SUMOReal ANGLE_LOOKAHEAD;
203 
204 public:
223  NBEdge(const std::string& id,
224  NBNode* from, NBNode* to, std::string type,
225  SUMOReal speed, unsigned int nolanes, int priority,
226  SUMOReal width, SUMOReal offset,
227  const std::string& streetName = "",
229 
230 
251  NBEdge(const std::string& id,
252  NBNode* from, NBNode* to, std::string type,
253  SUMOReal speed, unsigned int nolanes, int priority,
254  SUMOReal width, SUMOReal offset,
255  PositionVector geom,
256  const std::string& streetName = "",
258  bool tryIgnoreNodePositions = false);
259 
269  NBEdge(const std::string& id,
270  NBNode* from, NBNode* to,
271  NBEdge* tpl);
272 
273 
276  ~NBEdge();
277 
278 
294  void reinit(NBNode* from, NBNode* to, const std::string& type,
295  SUMOReal speed, unsigned int nolanes, int priority,
296  PositionVector geom, SUMOReal width, SUMOReal offset,
297  const std::string& streetName,
299  bool tryIgnoreNodePositions = false);
300 
305  void reinitNodes(NBNode* from, NBNode* to);
306 
307 
310 
315  void reshiftPosition(SUMOReal xoff, SUMOReal yoff);
317 
318 
319 
322  void setLeftHanded() {
323  myAmLeftHand = true;
324  }
325 
326 
328 
329 
333  unsigned int getNumLanes() const {
334  return (unsigned int) myLanes.size();
335  }
336 
337 
341  int getPriority() const {
342  return myPriority;
343  }
344 
345 
349  NBNode* getFromNode() const {
350  return myFrom;
351  }
352 
353 
357  NBNode* getToNode() const {
358  return myTo;
359  }
360 
361 
366  inline SUMOReal getStartAngle() const {
367  return myStartAngle;
368  }
369 
370 
375  inline SUMOReal getEndAngle() const {
376  return myEndAngle;
377  }
378 
379 
381 
385  inline SUMOReal getTotalAngle() const {
386  return myTotalAngle;
387  }
388 
392  SUMOReal getLength() const {
393  return myLength;
394  }
395 
396 
402  return myLoadedLength > 0 ? myLoadedLength : myLength;
403  }
404 
405 
409  bool hasLoadedLength() const {
410  return myLoadedLength > 0;
411  }
412 
413 
417  SUMOReal getSpeed() const {
418  return mySpeed;
419  }
420 
421 
428  return myStep;
429  }
430 
431 
436  return myLaneWidth;
437  }
438 
442  SUMOReal getLaneWidth(int lane) const;
443 
444 
447  const std::string& getStreetName() const {
448  return myStreetName;
449  }
450 
453  void setStreetName(const std::string& name) {
454  myStreetName = name;
455  }
456 
460  SUMOReal getOffset() const {
461  return myOffset;
462  }
463 
467  SUMOReal getOffset(int lane) const;
468 
469 
473  const std::string& getTypeName() const {
474  return myType;
475  }
476 
477 
481  const std::vector<NBEdge::Lane>& getLanes() const {
482  return myLanes;
483  }
485 
486 
487 
489 
490 
494  const PositionVector& getGeometry() const {
495  return myGeom;
496  }
497 
498 
500  const PositionVector getInnerGeometry() const;
501 
502 
505  bool hasDefaultGeometry() const;
506 
507 
513  bool hasDefaultGeometryEndpoints() const;
514 
515 
526  void setGeometry(const PositionVector& g, bool inner = false);
527 
528 
538  void addGeometryPoint(int index, const Position& p);
539 
540 
550  void computeEdgeShape();
551 
552 
556  const PositionVector& getLaneShape(unsigned int i) const;
557 
558 
564 
565 
571  return myLaneSpreadFunction;
572  }
573 
574 
580  bool splitGeometry(NBEdgeCont& ec, NBNodeCont& nc);
581 
582 
586  void reduceGeometry(const SUMOReal minDist);
587 
588 
594  void checkGeometry(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix);
596 
597 
598 
601 
616  bool addEdge2EdgeConnection(NBEdge* dest);
617 
618 
639  bool addLane2LaneConnection(unsigned int fromLane, NBEdge* dest,
640  unsigned int toLane, Lane2LaneInfoType type,
641  bool mayUseSameDestination = false,
642  bool mayDefinitelyPass = false);
643 
644 
662  bool addLane2LaneConnections(unsigned int fromLane,
663  NBEdge* dest, unsigned int toLane, unsigned int no,
664  Lane2LaneInfoType type, bool invalidatePrevious = false,
665  bool mayDefinitelyPass = false);
666 
667 
678  void setConnection(unsigned int lane, NBEdge* destEdge,
679  unsigned int destLane,
680  Lane2LaneInfoType type,
681  bool mayUseSameDestination = false,
682  bool mayDefinitelyPass = false);
683 
684 
685 
694  std::vector<Connection> getConnectionsFromLane(unsigned int lane) const;
695 
696 
704  bool hasConnectionTo(NBEdge* destEdge, unsigned int destLane) const;
705 
706 
713  bool isConnectedTo(NBEdge* e);
714 
715 
719  const std::vector<Connection>& getConnections() const {
720  return myConnections;
721  }
722 
723 
727  std::vector<Connection>& getConnections() {
728  return myConnections;
729  }
730 
731 
736 
737 
742 
743 
747  std::vector<int> getConnectionLanes(NBEdge* currentOutgoing) const;
748 
749 
753 
754 
758 
759 
765  void remapConnections(const EdgeVector& incoming);
766 
767 
774  void removeFromConnections(NBEdge* toEdge, int fromLane = -1, int toLane = -1, bool tryLater = false);
775 
776  void invalidateConnections(bool reallowSetting = false);
777 
778  void replaceInConnections(NBEdge* which, NBEdge* by, unsigned int laneOff);
779  void replaceInConnections(NBEdge* which, const std::vector<NBEdge::Connection>& origConns);
780  void copyConnectionsFrom(NBEdge* src);
782 
783 
784 
790  bool isTurningDirectionAt(const NBNode* n, const NBEdge* const edge) const;
791  void setTurningDestination(NBEdge* e);
792 
793 
794 
797 
802  }
803 
804 
808  bool isMacroscopicConnector() const {
810  }
811 
812 
815  void setIsInnerEdge() {
816  myAmInnerEdge = true;
817  }
818 
819 
823  bool isInnerEdge() const {
824  return myAmInnerEdge;
825  }
827 
828 
829 
830 
836  void setJunctionPriority(const NBNode* const node, int prio);
837 
838 
848  int getJunctionPriority(const NBNode* const node) const;
849 
850  void setLoadedLength(SUMOReal val);
852 
853 
854  const std::string& getTypeID() const {
855  return myType;
856  }
857 
859  bool needsLaneSpecificOutput() const;
860 
862  bool hasRestrictions() const;
863 
865  bool hasLaneSpecificPermissions() const;
866 
868  bool hasLaneSpecificSpeed() const;
869 
871  bool hasLaneSpecificOffset() const;
872 
874  bool hasLaneSpecificWidth() const;
875 
877  bool computeEdge2Edges(bool noLeftMovers);
878 
880  bool computeLanes2Edges();
881 
884  bool recheckLanes();
885 
894  void appendTurnaround(bool noTLSControlled);
895 
896 
897 
901  NBNode* tryGetNodeAtPosition(SUMOReal pos, SUMOReal tolerance = 5.0) const;
902 
903 
905 
906  bool lanesWereAssigned() const;
907 
908  bool mayBeTLSControlled(int fromLane, NBEdge* toEdge, int toLane) const;
909 
911  bool setControllingTLInformation(const NBConnection& c, const std::string& tlID);
912 
915 
917  PositionVector& into);
918 
919  SUMOReal width() const;
920 
921  PositionVector getCWBoundaryLine(const NBNode& n, SUMOReal offset) const;
922  PositionVector getCCWBoundaryLine(const NBNode& n, SUMOReal offset) const;
923 
924  bool expandableBy(NBEdge* possContinuation) const;
925  void append(NBEdge* continuation);
926 
927  bool hasSignalisedConnectionTo(const NBEdge* const e) const;
928 
929 
930  void moveOutgoingConnectionsFrom(NBEdge* e, unsigned int laneOff);
931 
932  NBEdge* getTurnDestination() const;
933 
934  std::string getLaneID(unsigned int lane) const;
935 
936  std::string getLaneIDInsecure(unsigned int lane) const;
937 
938  SUMOReal getLaneSpeed(unsigned int lane) const;
939 
940  bool isNearEnough2BeJoined2(NBEdge* e, SUMOReal threshold) const;
941 
942 
950  SUMOReal getAngleAtNode(const NBNode* const node) const;
951 
952 
953  void incLaneNo(unsigned int by);
954 
955  void decLaneNo(unsigned int by, int dir = 0);
956 
957  void markAsInLane2LaneState();
958 
960  void setPermissions(SVCPermissions permissions, int lane = -1);
961 
962  void setPreferredVehicleClass(SVCPermissions permissions, int lane = -1);
963 
965  void allowVehicleClass(int lane, SUMOVehicleClass vclass);
967  void disallowVehicleClass(int lane, SUMOVehicleClass vclass);
968 
969  void preferVehicleClass(int lane, SUMOVehicleClass vclass);
970 
971 
972 
974  void setLaneWidth(int lane, SUMOReal width);
975 
977  void setOffset(int lane, SUMOReal offset);
978 
980  void setSpeed(int lane, SUMOReal speed);
981 
983  SVCPermissions getPermissions(int lane = -1) const;
984 
985  void disableConnection4TLS(int fromLane, NBEdge* toEdge, int toLane);
986 
987 
988  // returns a reference to the internal structure for the convenience of NETEDIT
989  Lane& getLaneStruct(unsigned int lane) {
990  return myLanes[lane];
991  }
992 
993  // returns a reference to the internal structure for the convenience of NETEDIT
994  const Lane& getLaneStruct(unsigned int lane) const {
995  return myLanes[lane];
996  }
997 
998  /* declares connections as fully loaded. This is needed to avoid recomputing connections
999  * if an edge has no connections intentionally. */
1002  }
1003 
1004  void buildInnerEdges(const NBNode& n, unsigned int noInternalNoSplits, unsigned int& lno, unsigned int& splitNo);
1005 
1006  inline const std::vector<NBSign>& getSigns() const {
1007  return mySigns;
1008  }
1009 
1010  inline void addSign(NBSign sign) {
1011  mySigns.push_back(sign);
1012  }
1013 
1014 
1015 private:
1022  private:
1024  std::map<NBEdge*, std::vector<unsigned int> > myConnections;
1025 
1028 
1029  public:
1032  : myTransitions(transitions) { }
1033 
1036 
1038  void execute(const unsigned int lane, const unsigned int virtEdge);
1039 
1040  const std::map<NBEdge*, std::vector<unsigned int> >& getBuiltConnections() const {
1041  return myConnections;
1042  }
1043 
1044  private:
1047 
1050 
1051  };
1052 
1053 
1062  public:
1065 
1068  std::vector<Direction> myDirs;
1069 
1070  public:
1072  MainDirections(const EdgeVector& outgoing,
1073  NBEdge* parent, NBNode* to);
1074 
1076  ~MainDirections();
1077 
1080  bool empty() const;
1081 
1084  bool includes(Direction d) const;
1085 
1086  private:
1089 
1092 
1093  };
1094 
1096  PositionVector computeLaneShape(unsigned int lane, SUMOReal offset);
1097 
1099  //std::pair<SUMOReal, SUMOReal> laneOffset(const Position& from, const Position& to, SUMOReal laneCenterOffset);
1100 
1101  void computeLaneShapes();
1102 
1103 
1104 
1105 private:
1121  void init(unsigned int noLanes, bool tryIgnoreNodePositions);
1122 
1123 
1125  void divideOnEdges(const EdgeVector* outgoing);
1126 
1129  std::vector<unsigned int>* preparePriorities(
1130  const EdgeVector* outgoing);
1131 
1133  unsigned int computePrioritySum(std::vector<unsigned int>* priorities);
1134 
1135 
1138 
1141  void moveConnectionToLeft(unsigned int lane);
1142 
1145  void moveConnectionToRight(unsigned int lane);
1147 
1148 
1153  PositionVector startShapeAt(const PositionVector& laneShape, const NBNode* startNode) const;
1154 
1156  void computeAngle();
1157 
1158 private:
1163 
1165  std::string myType;
1166 
1169 
1172 
1177 
1180 
1183 
1187  std::vector<Connection> myConnections;
1188 
1191  std::vector<Connection> myConnectionsToDelete;
1192 
1195 
1198 
1201 
1204 
1207 
1210 
1213 
1217  std::vector<Lane> myLanes;
1218 
1221 
1224 
1225 
1228 
1231 
1235  int toLane;
1236  };
1237 
1238  std::vector<TLSDisabledConnection> myTLSDisabledConnections;
1239 
1240 
1242  std::string myStreetName;
1243 
1244 
1246  std::vector<NBSign> mySigns;
1247 
1248 
1249 public:
1254  public:
1257 
1258  bool operator()(const TLSDisabledConnection& e) const {
1259  if (e.to != myDefinition.to) {
1260  return false;
1261  }
1262  if (e.fromLane != myDefinition.fromLane) {
1263  return false;
1264  }
1265  if (e.toLane != myDefinition.toLane) {
1266  return false;
1267  }
1268  return true;
1269  }
1270 
1271  private:
1273 
1274  private:
1277 
1278  };
1279 
1280 
1281 
1286  public:
1288  connections_toedge_finder(NBEdge* const edge2find) : myEdge2Find(edge2find) { }
1289 
1290  bool operator()(const Connection& c) const {
1291  return c.toEdge == myEdge2Find;
1292  }
1293 
1294  private:
1296 
1297  private:
1300 
1301  };
1302 
1307  public:
1309  connections_toedgelane_finder(NBEdge* const edge2find, int lane2find) : myEdge2Find(edge2find), myLane2Find(lane2find) { }
1310 
1311  bool operator()(const Connection& c) const {
1312  return c.toEdge == myEdge2Find && c.toLane == myLane2Find;
1313  }
1314 
1315  private:
1318 
1319  private:
1322 
1323  };
1324 
1325 
1330  public:
1332  connections_finder(int fromLane, NBEdge* const edge2find, int lane2find) : myFromLane(fromLane), myEdge2Find(edge2find), myLane2Find(lane2find) { }
1333 
1334  bool operator()(const Connection& c) const {
1335  return c.fromLane == myFromLane && c.toEdge == myEdge2Find && c.toLane == myLane2Find;
1336  }
1337 
1338  private:
1342 
1343  private:
1346 
1347  };
1348 
1353  public:
1355  connections_fromlane_finder(int lane2find) : myLane2Find(lane2find) { }
1356 
1357  bool operator()(const Connection& c) const {
1358  return c.fromLane == myLane2Find;
1359  }
1360 
1361  private:
1363 
1364  private:
1367 
1368  };
1369 
1373  static bool connections_sorter(const Connection& c1, const Connection& c2) {
1374  if (c1.fromLane != c2.fromLane) {
1375  return c1.fromLane < c2.fromLane;
1376  }
1377  if (c1.toEdge != c2.toEdge) {
1378  return c1.toEdge->getID().compare(c1.toEdge->getID()) < 0;
1379  }
1380  return c1.toLane < c2.toLane;
1381  }
1382 
1388  public:
1391 
1392  public:
1394  int operator()(const Connection& c1, const Connection& c2) const;
1395 
1396  private:
1399  };
1400 
1401 private:
1403  NBEdge(const NBEdge& s);
1404 
1406  NBEdge& operator=(const NBEdge& s);
1407 
1408 
1409 };
1410 
1411 
1412 #endif
1413 
1414 /****************************************************************************/
1415 
ToEdgeConnectionsAdder(const EdgeVector &transitions)
constructor
Definition: NBEdge.h:1031
std::string id
Definition: NBEdge.h:177
void invalidateConnections(bool reallowSetting=false)
Definition: NBEdge.cpp:843
const PositionVector & getLaneShape(unsigned int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:469
std::vector< Lane > myLanes
Lane information.
Definition: NBEdge.h:1217
bool includes(Direction d) const
Definition: NBEdge.cpp:154
const std::string & getTypeID() const
Definition: NBEdge.h:854
bool setControllingTLInformation(const NBConnection &c, const std::string &tlID)
Returns if the link could be set as to be controlled.
Definition: NBEdge.cpp:1655
void divideOnEdges(const EdgeVector *outgoing)
Definition: NBEdge.cpp:1430
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:196
SUMOReal myTotalAngle
Definition: NBEdge.h:1176
A class representing a single street sign.
Definition: NBSign.h:50
connections_finder(int fromLane, NBEdge *const edge2find, int lane2find)
constructor
Definition: NBEdge.h:1332
std::vector< unsigned int > * preparePriorities(const EdgeVector *outgoing)
Definition: NBEdge.cpp:1508
std::string foeIncomingLanes
Definition: NBEdge.h:187
PositionVector shape
The lane&#39;s shape.
Definition: NBEdge.h:128
std::vector< TLSDisabledConnection > myTLSDisabledConnections
Definition: NBEdge.h:1238
connections_relative_edgelane_sorter(NBEdge *e)
constructor
Definition: NBEdge.h:1390
~NBEdge()
Destructor.
Definition: NBEdge.cpp:336
std::string foeInternalLanes
Definition: NBEdge.h:186
LaneSpreadFunction myLaneSpreadFunction
The information about how to spread the lanes.
Definition: NBEdge.h:1206
SUMOReal viaVmax
Definition: NBEdge.h:183
void sortOutgoingConnectionsByAngle()
sorts the outgoing connections by their angle relative to their junction
Definition: NBEdge.cpp:791
const std::string & getTypeName() const
Returns the type name.
Definition: NBEdge.h:473
std::string viaID
Definition: NBEdge.h:182
void addSign(NBSign sign)
Definition: NBEdge.h:1010
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:360
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
NBNode * myTo
Definition: NBEdge.h:1168
The relationships between edges are computed/loaded.
Definition: NBEdge.h:95
bool empty() const
Definition: NBEdge.cpp:148
void appendTurnaround(bool noTLSControlled)
Add a connection to the previously computed turnaround, if wished.
Definition: NBEdge.cpp:1560
connections_toedge_finder & operator=(const connections_toedge_finder &s)
invalidated assignment operator
bool operator()(const TLSDisabledConnection &e) const
Definition: NBEdge.h:1258
PositionVector getCCWBoundaryLine(const NBNode &n, SUMOReal offset) const
Definition: NBEdge.cpp:1753
std::vector< NBSign > mySigns
the street signs along this edge
Definition: NBEdge.h:1246
void setLaneWidth(int lane, SUMOReal width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:1982
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2028
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:481
void setOffset(int lane, SUMOReal offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2012
void moveOutgoingConnectionsFrom(NBEdge *e, unsigned int laneOff)
Definition: NBEdge.cpp:1617
~ToEdgeConnectionsAdder()
destructor
Definition: NBEdge.h:1035
SUMOReal getEndAngle() const
Returns the angle at the end of the edge The angle is computed in computeAngle()
Definition: NBEdge.h:375
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:273
void clearControllingTLInformation()
clears tlID for all connections
Definition: NBEdge.cpp:1720
Lane2LaneInfoType
Modes of setting connections between lanes.
Definition: NBEdge.h:110
void declareConnectionsAsLoaded()
Definition: NBEdge.h:1000
bool mayBeTLSControlled(int fromLane, NBEdge *toEdge, int toLane) const
Definition: NBEdge.cpp:1644
bool hasDefaultGeometryEndpoints() const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
Definition: NBEdge.cpp:366
bool operator()(const Connection &c) const
Definition: NBEdge.h:1311
void incLaneNo(unsigned int by)
Definition: NBEdge.cpp:1895
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:1253
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:630
void setStreetName(const std::string &name)
sets the street name of this edge
Definition: NBEdge.h:453
std::vector< Direction > myDirs
Definition: NBEdge.h:1068
void markAsInLane2LaneState()
Definition: NBEdge.cpp:1936
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&#39;s lane and an approached one.
Definition: NBEdge.cpp:608
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:1192
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:435
std::string getLaneIDInsecure(unsigned int lane) const
Definition: NBEdge.cpp:1881
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:2044
int myFromJunctionPriority
The priority normalised for the node the edge is outgoing of.
Definition: NBEdge.h:1197
void computeLaneShapes()
Computes the offset from the edge shape on the current segment.
Definition: NBEdge.cpp:1145
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:1256
bool isInnerEdge() const
Returns whether this edge was marked as being within an intersection.
Definition: NBEdge.h:823
PositionVector myGeom
The geometry for the edge.
Definition: NBEdge.h:1203
void remapConnections(const EdgeVector &incoming)
Remaps the connection in a way that allows the removal of it.
Definition: NBEdge.cpp:803
void buildInnerEdges(const NBNode &n, unsigned int noInternalNoSplits, unsigned int &lno, unsigned int &splitNo)
Definition: NBEdge.cpp:986
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:1575
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:198
PositionVector getCWBoundaryLine(const NBNode &n, SUMOReal offset) const
Definition: NBEdge.cpp:1738
std::vector< Connection > getConnectionsFromLane(unsigned int lane) const
Returns connections from a given lane.
Definition: NBEdge.cpp:706
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&#39;s geometry
Definition: NBEdge.cpp:373
const EdgeVector & myTransitions
the transition from the virtual lane to the edge it belongs to
Definition: NBEdge.h:1027
The connection was computed and validated.
Definition: NBEdge.h:116
PositionVector startShapeAt(const PositionVector &laneShape, const NBNode *startNode) const
Definition: NBEdge.cpp:428
SUMOReal vmax
Definition: NBEdge.h:179
const std::vector< NBSign > & getSigns() const
Definition: NBEdge.h:1006
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:1200
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
Definition: NBEdge.cpp:765
PositionVector shape
Definition: NBEdge.h:178
SUMOReal speed
The speed allowed on this lane.
Definition: NBEdge.h:130
void moveConnectionToRight(unsigned int lane)
Definition: NBEdge.cpp:954
void setTurningDestination(NBEdge *e)
Definition: NBEdge.cpp:1133
bool operator()(const Connection &c) const
Definition: NBEdge.h:1290
SUMOReal getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn&#39;t set.
Definition: NBEdge.h:401
An (internal) definition of a single lane of an edge.
Definition: NBEdge.h:123
const std::string & getID() const
Returns the id.
Definition: Named.h:60
SUMOReal mySpeed
The maximal speed.
Definition: NBEdge.h:1182
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:584
bool myAmMacroscopicConnector
Information whether this edge is a (macroscopic) connector.
Definition: NBEdge.h:1230
bool isConnectedTo(NBEdge *e)
Returns the information whethe a connection to the given edge has been added (or computed) ...
Definition: NBEdge.cpp:724
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition: NBEdge.cpp:351
void reshiftPosition(SUMOReal xoff, SUMOReal yoff)
Applies an offset to the edge.
Definition: NBEdge.cpp:341
bool computeLanes2Edges()
computes the edge, step2: computation of which lanes approach the edges)
Definition: NBEdge.cpp:1369
NBEdge * myTurnDestination
The turn destination edge.
Definition: NBEdge.h:1194
const std::map< NBEdge *, std::vector< unsigned int > > & getBuiltConnections() const
Definition: NBEdge.h:1040
const Lane & getLaneStruct(unsigned int lane) const
Definition: NBEdge.h:994
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:163
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
Definition: NBEdge.cpp:1319
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:341
void checkGeometry(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix)
Check the angles of successive geometry segments.
Definition: NBEdge.cpp:538
std::string getLaneID(unsigned int lane) const
Definition: NBEdge.cpp:1874
void moveConnectionToLeft(unsigned int lane)
Definition: NBEdge.cpp:931
bool myAmLeftHand
Whether this edge is a left-hand edge.
Definition: NBEdge.h:1223
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 fromLane
The lane the connections starts at.
Definition: NBEdge.h:162
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
TLSDisabledConnection myDefinition
Definition: NBEdge.h:1272
NBEdge & operator=(const NBEdge &s)
invalidated assignment operator
A list of positions.
SUMOReal myEndAngle
Definition: NBEdge.h:1175
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:1294
bool lanesWereAssigned() const
Definition: NBEdge.cpp:1632
std::vector< Connection > & getConnections()
Returns the connections.
Definition: NBEdge.h:727
unsigned int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:333
EdgeBuildingStep
Current state of the edge within the building process.
Definition: NBEdge.h:89
SUMOReal offset
This lane&#39;s offset to the intersection begin.
Definition: NBEdge.h:136
void setAsMacroscopicConnector()
Marks this edge as a macroscopic connector.
Definition: NBEdge.h:800
bool hasLoadedLength() const
Returns whether a length was set explicitly.
Definition: NBEdge.h:409
friend class GNELane
Definition: NBEdge.h:77
EdgeBuildingStep getStep() const
The building step of this edge.
Definition: NBEdge.h:427
void setLeftHanded()
Marks this edge to be left-handed.
Definition: NBEdge.h:322
SUMOReal myLaneWidth
This width of this edge&#39;s lanes.
Definition: NBEdge.h:1212
int myPriority
The priority of the edge.
Definition: NBEdge.h:1179
void init(unsigned int noLanes, bool tryIgnoreNodePositions)
Initialization routines common to all constructors.
Definition: NBEdge.cpp:292
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:1341
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:1162
unsigned int computePrioritySum(std::vector< unsigned int > *priorities)
Definition: NBEdge.cpp:1550
SUMOReal myOffset
This edges&#39;s offset to the intersection begin (will be applied to all lanes)
Definition: NBEdge.h:1209
connections_toedge_finder(NBEdge *const edge2find)
constructor
Definition: NBEdge.h:1288
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1187
void setLoadedLength(SUMOReal val)
Definition: NBEdge.cpp:2087
connections_fromlane_finder(int lane2find)
constructor
Definition: NBEdge.h:1355
The connection was given by the user.
Definition: NBEdge.h:114
An upper class for objects with additional parameters.
Definition: Parameterised.h:46
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false)
Removes the specified connection(s)
Definition: NBEdge.cpp:819
const SVCPermissions SVCFreeForAll
connections_toedgelane_finder & operator=(const connections_toedgelane_finder &s)
invalidated assignment operator
bool myAmInnerEdge
Information whether this is a junction-inner edge.
Definition: NBEdge.h:1227
Base class for objects which have an id.
Definition: Named.h:45
bool recheckLanes()
Definition: NBEdge.cpp:1393
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
Definition: NBEdge.cpp:1101
SUMOReal myLoadedLength
An optional length to use (-1 if not valid)
Definition: NBEdge.h:1220
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:1283
std::map< NBEdge *, std::vector< unsigned int > > myConnections
map of edges to this edge&#39;s lanes that reach them
Definition: NBEdge.h:1024
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:2072
Lane(NBEdge *e)
Definition: NBEdge.h:124
void decLaneNo(unsigned int by, int dir=0)
Definition: NBEdge.cpp:1910
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:357
#define sign(a)
Definition: polyfonts.c:64
std::vector< int > getConnectionLanes(NBEdge *currentOutgoing) const
Returns the list of lanes that may be used to reach the given edge.
Definition: NBEdge.cpp:777
void execute(const unsigned int lane, const unsigned int virtEdge)
executes a bresenham - step
Definition: NBEdge.cpp:76
void computeEdgeShape()
Recomputeds the lane shapes to terminate at the node shape For every lane the intersection with the f...
Definition: NBEdge.cpp:387
void disableConnection4TLS(int fromLane, NBEdge *toEdge, int toLane)
Definition: NBEdge.cpp:1728
PositionVector viaShape
Definition: NBEdge.h:184
bool hasLaneSpecificOffset() const
whether lanes differ in offset
Definition: NBEdge.cpp:1330
SUMOReal getMaxLaneOffset()
Definition: NBEdge.cpp:1638
static bool connections_sorter(const Connection &c1, const Connection &c2)
Definition: NBEdge.h:1373
static const SUMOReal UNSPECIFIED_LOADED_LENGTH
no length override given
Definition: NBEdge.h:200
std::vector< NBEdge * > EdgeVector
Definition: NBCont.h:38
NBEdge * myEdge
the edge to compute the relative angle of
Definition: NBEdge.h:1398
SUMOReal myLength
The length of the edge.
Definition: NBEdge.h:1171
void setPreferredVehicleClass(SVCPermissions permissions, int lane=-1)
Definition: NBEdge.cpp:2058
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:494
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:1191
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:808
void reduceGeometry(const SUMOReal minDist)
Removes points with a distance lesser than the given.
Definition: NBEdge.cpp:532
void setJunctionPriority(const NBNode *const node, int prio)
Sets the junction priority of the edge.
Definition: NBEdge.cpp:1111
void replaceInConnections(NBEdge *which, NBEdge *by, unsigned int laneOff)
Definition: NBEdge.cpp:855
const EdgeVector * getConnectedSorted()
Returns the list of outgoing edges without the turnaround sorted in clockwise direction.
Definition: NBEdge.cpp:737
NBEdge *const myEdge2Find
Definition: NBEdge.h:1340
void setIsInnerEdge()
Marks this edge being within an intersection.
Definition: NBEdge.h:815
void sortOutgoingConnectionsByIndex()
sorts the outgoing connections by their from-lane-index and their to-lane-index
Definition: NBEdge.cpp:797
std::string myType
The type of the edge.
Definition: NBEdge.h:1165
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge&#39;s lateral offset shal...
void append(NBEdge *continuation)
Definition: NBEdge.cpp:1836
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:1139
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:1603
The connection was computed.
Definition: NBEdge.h:112
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge&#39;s lanes&#39; lateral offset is computed.
Definition: NBEdge.h:570
SUMOReal myStartAngle
The angles of the edge.
Definition: NBEdge.h:1174
SUMOReal getTotalAngle() const
get the angle as measure from the start to the end of this edge
Definition: NBEdge.h:385
Represents a single node (junction) during network building.
Definition: NBNode.h:74
void dismissVehicleClassInformation()
Definition: NBEdge.cpp:2093
Lane & getLaneStruct(unsigned int lane)
Definition: NBEdge.h:989
bool hasSignalisedConnectionTo(const NBEdge *const e) const
Definition: NBEdge.cpp:1857
Lanes to lanes - relationships are computed; no recheck is necessary/wished.
Definition: NBEdge.h:101
NBEdge * getTurnDestination() const
Definition: NBEdge.cpp:1868
bool hasLaneSpecificWidth() const
whether lanes differ in width
Definition: NBEdge.cpp:1308
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
Direction
enum of possible directions
Definition: NBEdge.h:1064
#define SUMOReal
Definition: config.h:221
bool isNearEnough2BeJoined2(NBEdge *e, SUMOReal threshold) const
Definition: NBEdge.cpp:1887
void preferVehicleClass(int lane, SUMOVehicleClass vclass)
Definition: NBEdge.cpp:1969
void allowVehicleClass(int lane, SUMOVehicleClass vclass)
set allowed class for the given lane or for all lanes if -1 is given
Definition: NBEdge.cpp:1943
void addGeometryPoint(int index, const Position &p)
Adds a further geometry point.
Definition: NBEdge.cpp:481
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:1264
bool hasConnectionTo(NBEdge *destEdge, unsigned int destLane) const
Retrieves info about a connection to a certain lane of a certain edge.
Definition: NBEdge.cpp:718
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:417
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:63
SUMOReal getStartAngle() const
Returns the angle at the start of the edge The angle is computed in computeAngle() ...
Definition: NBEdge.h:366
bool computeEdge2Edges(bool noLeftMovers)
computes the edge (step1: computation of approached edges)
Definition: NBEdge.cpp:1348
SUMOReal width() const
Definition: NBEdge.cpp:1768
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:647
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
Definition: NBEdge.cpp:475
bool operator()(const Connection &c) const
Definition: NBEdge.h:1334
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:174
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:1242
const std::string & getStreetName() const
Returns the street name of this edge.
Definition: NBEdge.h:447
connections_toedgelane_finder(NBEdge *const edge2find, int lane2find)
constructor
Definition: NBEdge.h:1309
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:719
NBNode * myFrom
The source and the destination node.
Definition: NBEdge.h:1168
bool expandableBy(NBEdge *possContinuation) const
Definition: NBEdge.cpp:1774
SUMOReal getOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:460
~MainDirections()
destructor
Definition: NBEdge.cpp:144
bool operator()(const Connection &c) const
Definition: NBEdge.h:1357
void disallowVehicleClass(int lane, SUMOVehicleClass vclass)
set disallowed class for the given lane or for all lanes if -1 is given
Definition: NBEdge.cpp:1956
MainDirections(const EdgeVector &outgoing, NBEdge *parent, NBNode *to)
constructor
Definition: NBEdge.cpp:107
SUMOReal width
This lane&#39;s width.
Definition: NBEdge.h:138
void copyConnectionsFrom(NBEdge *src)
Definition: NBEdge.cpp:924
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:241
static const SUMOReal ANGLE_LOOKAHEAD
the distance at which to take the default anglen
Definition: NBEdge.h:202
SUMOReal getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:392
SUMOReal getAngleAtNode(const NBNode *const node) const
Returns the angle of the edge&#39;s geometry at the given node.
Definition: NBEdge.cpp:1121
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:349
bool splitGeometry(NBEdgeCont &ec, NBNodeCont &nc)
Splits this edge at geometry points.
Definition: NBEdge.cpp:487