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::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 
207  static const SUMOReal ANGLE_LOOKAHEAD;
208 
209 public:
228  NBEdge(const std::string& id,
229  NBNode* from, NBNode* to, std::string type,
230  SUMOReal speed, unsigned int nolanes, int priority,
231  SUMOReal width, SUMOReal offset,
232  const std::string& streetName = "",
234 
235 
256  NBEdge(const std::string& id,
257  NBNode* from, NBNode* to, std::string type,
258  SUMOReal speed, unsigned int nolanes, int priority,
259  SUMOReal width, SUMOReal offset,
260  PositionVector geom,
261  const std::string& streetName = "",
263  bool tryIgnoreNodePositions = false);
264 
274  NBEdge(const std::string& id,
275  NBNode* from, NBNode* to,
276  NBEdge* tpl);
277 
278 
281  ~NBEdge();
282 
283 
299  void reinit(NBNode* from, NBNode* to, const std::string& type,
300  SUMOReal speed, unsigned int nolanes, int priority,
301  PositionVector geom, SUMOReal width, SUMOReal offset,
302  const std::string& streetName,
304  bool tryIgnoreNodePositions = false);
305 
310  void reinitNodes(NBNode* from, NBNode* to);
311 
312 
315 
320  void reshiftPosition(SUMOReal xoff, SUMOReal yoff);
322 
323 
324 
327  void setLeftHanded() {
328  myAmLeftHand = true;
329  }
330 
331 
333 
334 
338  unsigned int getNumLanes() const {
339  return (unsigned int) myLanes.size();
340  }
341 
342 
346  int getPriority() const {
347  return myPriority;
348  }
349 
350 
354  NBNode* getFromNode() const {
355  return myFrom;
356  }
357 
358 
362  NBNode* getToNode() const {
363  return myTo;
364  }
365 
366 
371  inline SUMOReal getStartAngle() const {
372  return myStartAngle;
373  }
374 
375 
380  inline SUMOReal getEndAngle() const {
381  return myEndAngle;
382  }
383 
384 
386 
390  inline SUMOReal getTotalAngle() const {
391  return myTotalAngle;
392  }
393 
397  SUMOReal getLength() const {
398  return myLength;
399  }
400 
401 
407  return myLoadedLength > 0 ? myLoadedLength : myLength;
408  }
409 
410 
414  bool hasLoadedLength() const {
415  return myLoadedLength > 0;
416  }
417 
418 
422  SUMOReal getSpeed() const {
423  return mySpeed;
424  }
425 
426 
433  return myStep;
434  }
435 
436 
441  return myLaneWidth;
442  }
443 
447  SUMOReal getLaneWidth(int lane) const;
448 
449 
452  const std::string& getStreetName() const {
453  return myStreetName;
454  }
455 
458  void setStreetName(const std::string& name) {
459  myStreetName = name;
460  }
461 
465  SUMOReal getOffset() const {
466  return myOffset;
467  }
468 
472  SUMOReal getOffset(int lane) const;
473 
474 
478  const std::string& getTypeName() const {
479  return myType;
480  }
481 
482 
486  const std::vector<NBEdge::Lane>& getLanes() const {
487  return myLanes;
488  }
490 
491 
492 
494 
495 
499  const PositionVector& getGeometry() const {
500  return myGeom;
501  }
502 
503 
505  const PositionVector getInnerGeometry() const;
506 
507 
510  bool hasDefaultGeometry() const;
511 
512 
518  bool hasDefaultGeometryEndpoints() const;
519 
520 
531  void setGeometry(const PositionVector& g, bool inner = false);
532 
533 
543  void addGeometryPoint(int index, const Position& p);
544 
545 
555  void computeEdgeShape();
556 
557 
561  const PositionVector& getLaneShape(unsigned int i) const;
562 
563 
569 
570 
576  return myLaneSpreadFunction;
577  }
578 
579 
585  bool splitGeometry(NBEdgeCont& ec, NBNodeCont& nc);
586 
587 
591  void reduceGeometry(const SUMOReal minDist);
592 
593 
599  void checkGeometry(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix);
601 
602 
603 
606 
621  bool addEdge2EdgeConnection(NBEdge* dest);
622 
623 
644  bool addLane2LaneConnection(unsigned int fromLane, NBEdge* dest,
645  unsigned int toLane, Lane2LaneInfoType type,
646  bool mayUseSameDestination = false,
647  bool mayDefinitelyPass = false);
648 
649 
667  bool addLane2LaneConnections(unsigned int fromLane,
668  NBEdge* dest, unsigned int toLane, unsigned int no,
669  Lane2LaneInfoType type, bool invalidatePrevious = false,
670  bool mayDefinitelyPass = false);
671 
672 
683  void setConnection(unsigned int lane, NBEdge* destEdge,
684  unsigned int destLane,
685  Lane2LaneInfoType type,
686  bool mayUseSameDestination = false,
687  bool mayDefinitelyPass = false);
688 
689 
690 
699  std::vector<Connection> getConnectionsFromLane(unsigned int lane) const;
700 
701 
709  bool hasConnectionTo(NBEdge* destEdge, unsigned int destLane) const;
710 
711 
718  bool isConnectedTo(NBEdge* e);
719 
720 
724  const std::vector<Connection>& getConnections() const {
725  return myConnections;
726  }
727 
728 
732  std::vector<Connection>& getConnections() {
733  return myConnections;
734  }
735 
736 
741 
742 
747 
748 
752  std::vector<int> getConnectionLanes(NBEdge* currentOutgoing) const;
753 
754 
758 
759 
763 
764 
770  void remapConnections(const EdgeVector& incoming);
771 
772 
779  void removeFromConnections(NBEdge* toEdge, int fromLane = -1, int toLane = -1, bool tryLater = false);
780 
781  void invalidateConnections(bool reallowSetting = false);
782 
783  void replaceInConnections(NBEdge* which, NBEdge* by, unsigned int laneOff);
784  void replaceInConnections(NBEdge* which, const std::vector<NBEdge::Connection>& origConns);
785  void copyConnectionsFrom(NBEdge* src);
787 
788 
789 
795  bool isTurningDirectionAt(const NBNode* n, const NBEdge* const edge) const;
796  void setTurningDestination(NBEdge* e);
797 
798 
799 
802 
807  }
808 
809 
813  bool isMacroscopicConnector() const {
815  }
816 
817 
820  void setIsInnerEdge() {
821  myAmInnerEdge = true;
822  }
823 
824 
828  bool isInnerEdge() const {
829  return myAmInnerEdge;
830  }
832 
833 
834 
835 
841  void setJunctionPriority(const NBNode* const node, int prio);
842 
843 
853  int getJunctionPriority(const NBNode* const node) const;
854 
855  void setLoadedLength(SUMOReal val);
857 
858 
859  const std::string& getTypeID() const {
860  return myType;
861  }
862 
864  bool needsLaneSpecificOutput() const;
865 
867  bool hasRestrictions() const;
868 
870  bool hasLaneSpecificPermissions() const;
871 
873  bool hasLaneSpecificSpeed() const;
874 
876  bool hasLaneSpecificOffset() const;
877 
879  bool hasLaneSpecificWidth() const;
880 
882  bool computeEdge2Edges(bool noLeftMovers);
883 
885  bool computeLanes2Edges();
886 
889  bool recheckLanes();
890 
899  void appendTurnaround(bool noTLSControlled);
900 
901 
902 
906  NBNode* tryGetNodeAtPosition(SUMOReal pos, SUMOReal tolerance = 5.0) const;
907 
908 
910 
911  bool lanesWereAssigned() const;
912 
913  bool mayBeTLSControlled(int fromLane, NBEdge* toEdge, int toLane) const;
914 
916  bool setControllingTLInformation(const NBConnection& c, const std::string& tlID);
917 
920 
922  PositionVector& into);
923 
924  SUMOReal width() const;
925 
926  PositionVector getCWBoundaryLine(const NBNode& n, SUMOReal offset) const;
927  PositionVector getCCWBoundaryLine(const NBNode& n, SUMOReal offset) const;
928 
929  bool expandableBy(NBEdge* possContinuation) const;
930  void append(NBEdge* continuation);
931 
932  bool hasSignalisedConnectionTo(const NBEdge* const e) const;
933 
934 
935  void moveOutgoingConnectionsFrom(NBEdge* e, unsigned int laneOff);
936 
937  NBEdge* getTurnDestination() const;
938 
939  std::string getLaneID(unsigned int lane) const;
940 
941  std::string getLaneIDInsecure(unsigned int lane) const;
942 
943  SUMOReal getLaneSpeed(unsigned int lane) const;
944 
945  bool isNearEnough2BeJoined2(NBEdge* e, SUMOReal threshold) const;
946 
947 
955  SUMOReal getAngleAtNode(const NBNode* const node) const;
956 
957 
958  void incLaneNo(unsigned int by);
959 
960  void decLaneNo(unsigned int by, int dir = 0);
961 
962  void markAsInLane2LaneState();
963 
965  void setPermissions(SVCPermissions permissions, int lane = -1);
966 
967  void setPreferredVehicleClass(SVCPermissions permissions, int lane = -1);
968 
970  void allowVehicleClass(int lane, SUMOVehicleClass vclass);
972  void disallowVehicleClass(int lane, SUMOVehicleClass vclass);
973 
974  void preferVehicleClass(int lane, SUMOVehicleClass vclass);
975 
976 
977 
979  void setLaneWidth(int lane, SUMOReal width);
980 
982  void setOffset(int lane, SUMOReal offset);
983 
985  void setSpeed(int lane, SUMOReal speed);
986 
988  SVCPermissions getPermissions(int lane = -1) const;
989 
990  void disableConnection4TLS(int fromLane, NBEdge* toEdge, int toLane);
991 
992 
993  // returns a reference to the internal structure for the convenience of NETEDIT
994  Lane& getLaneStruct(unsigned int lane) {
995  return myLanes[lane];
996  }
997 
998  // returns a reference to the internal structure for the convenience of NETEDIT
999  const Lane& getLaneStruct(unsigned int lane) const {
1000  return myLanes[lane];
1001  }
1002 
1003  /* declares connections as fully loaded. This is needed to avoid recomputing connections
1004  * if an edge has no connections intentionally. */
1007  }
1008 
1009  /* @brief fill connection attributes shape, viaShape, ...
1010  *
1011  * @param[in,out] edgeIndex The number of connections already handled
1012  * @param[in,out] splitIndex The number of via edges already built
1013  * @param[in] tryIgnoreNodePositions Does not add node geometries if geom.size()>=2
1014  */
1015  void buildInnerEdges(const NBNode& n, unsigned int noInternalNoSplits, unsigned int& linkIndex, unsigned int& splitIndex);
1016 
1017  inline const std::vector<NBSign>& getSigns() const {
1018  return mySigns;
1019  }
1020 
1021  inline void addSign(NBSign sign) {
1022  mySigns.push_back(sign);
1023  }
1024 
1025 
1026 private:
1033  private:
1035  std::map<NBEdge*, std::vector<unsigned int> > myConnections;
1036 
1039 
1040  public:
1043  : myTransitions(transitions) { }
1044 
1047 
1049  void execute(const unsigned int lane, const unsigned int virtEdge);
1050 
1051  const std::map<NBEdge*, std::vector<unsigned int> >& getBuiltConnections() const {
1052  return myConnections;
1053  }
1054 
1055  private:
1058 
1061 
1062  };
1063 
1064 
1073  public:
1076 
1079  std::vector<Direction> myDirs;
1080 
1081  public:
1083  MainDirections(const EdgeVector& outgoing,
1084  NBEdge* parent, NBNode* to);
1085 
1087  ~MainDirections();
1088 
1091  bool empty() const;
1092 
1095  bool includes(Direction d) const;
1096 
1097  private:
1100 
1103 
1104  };
1105 
1107  PositionVector computeLaneShape(unsigned int lane, SUMOReal offset);
1108 
1110  //std::pair<SUMOReal, SUMOReal> laneOffset(const Position& from, const Position& to, SUMOReal laneCenterOffset);
1111 
1112  void computeLaneShapes();
1113 
1114 
1115 
1116 private:
1132  void init(unsigned int noLanes, bool tryIgnoreNodePositions);
1133 
1134 
1136  void divideOnEdges(const EdgeVector* outgoing);
1137 
1140  std::vector<unsigned int>* preparePriorities(
1141  const EdgeVector* outgoing);
1142 
1144  unsigned int computePrioritySum(std::vector<unsigned int>* priorities);
1145 
1146 
1149 
1152  void moveConnectionToLeft(unsigned int lane);
1153 
1156  void moveConnectionToRight(unsigned int lane);
1158 
1159 
1164  PositionVector startShapeAt(const PositionVector& laneShape, const NBNode* startNode) const;
1165 
1167  void computeAngle();
1168 
1169 private:
1174 
1176  std::string myType;
1177 
1180 
1183 
1188 
1191 
1194 
1198  std::vector<Connection> myConnections;
1199 
1202  std::vector<Connection> myConnectionsToDelete;
1203 
1206 
1209 
1212 
1215 
1218 
1221 
1224 
1228  std::vector<Lane> myLanes;
1229 
1232 
1235 
1236 
1239 
1242 
1246  int toLane;
1247  };
1248 
1249  std::vector<TLSDisabledConnection> myTLSDisabledConnections;
1250 
1251 
1253  std::string myStreetName;
1254 
1255 
1257  std::vector<NBSign> mySigns;
1258 
1259 
1260 public:
1265  public:
1268 
1269  bool operator()(const TLSDisabledConnection& e) const {
1270  if (e.to != myDefinition.to) {
1271  return false;
1272  }
1273  if (e.fromLane != myDefinition.fromLane) {
1274  return false;
1275  }
1276  if (e.toLane != myDefinition.toLane) {
1277  return false;
1278  }
1279  return true;
1280  }
1281 
1282  private:
1284 
1285  private:
1288 
1289  };
1290 
1291 
1292 
1297  public:
1299  connections_toedge_finder(NBEdge* const edge2find) : myEdge2Find(edge2find) { }
1300 
1301  bool operator()(const Connection& c) const {
1302  return c.toEdge == myEdge2Find;
1303  }
1304 
1305  private:
1307 
1308  private:
1311 
1312  };
1313 
1318  public:
1320  connections_toedgelane_finder(NBEdge* const edge2find, int lane2find) : myEdge2Find(edge2find), myLane2Find(lane2find) { }
1321 
1322  bool operator()(const Connection& c) const {
1323  return c.toEdge == myEdge2Find && c.toLane == myLane2Find;
1324  }
1325 
1326  private:
1329 
1330  private:
1333 
1334  };
1335 
1336 
1341  public:
1343  connections_finder(int fromLane, NBEdge* const edge2find, int lane2find) : myFromLane(fromLane), myEdge2Find(edge2find), myLane2Find(lane2find) { }
1344 
1345  bool operator()(const Connection& c) const {
1346  return c.fromLane == myFromLane && c.toEdge == myEdge2Find && c.toLane == myLane2Find;
1347  }
1348 
1349  private:
1353 
1354  private:
1357 
1358  };
1359 
1364  public:
1366  connections_fromlane_finder(int lane2find) : myLane2Find(lane2find) { }
1367 
1368  bool operator()(const Connection& c) const {
1369  return c.fromLane == myLane2Find;
1370  }
1371 
1372  private:
1374 
1375  private:
1378 
1379  };
1380 
1384  static bool connections_sorter(const Connection& c1, const Connection& c2) {
1385  if (c1.fromLane != c2.fromLane) {
1386  return c1.fromLane < c2.fromLane;
1387  }
1388  if (c1.toEdge != c2.toEdge) {
1389  return c1.toEdge->getID().compare(c1.toEdge->getID()) < 0;
1390  }
1391  return c1.toLane < c2.toLane;
1392  }
1393 
1399  public:
1402 
1403  public:
1405  int operator()(const Connection& c1, const Connection& c2) const;
1406 
1407  private:
1410  };
1411 
1412 private:
1414  NBEdge(const NBEdge& s);
1415 
1417  NBEdge& operator=(const NBEdge& s);
1418 
1419 
1420 };
1421 
1422 
1423 #endif
1424 
1425 /****************************************************************************/
1426 
ToEdgeConnectionsAdder(const EdgeVector &transitions)
constructor
Definition: NBEdge.h:1042
std::string id
Definition: NBEdge.h:177
void invalidateConnections(bool reallowSetting=false)
Definition: NBEdge.cpp:848
const PositionVector & getLaneShape(unsigned int i) const
Returns the shape of the nth lane.
Definition: NBEdge.cpp:474
std::vector< Lane > myLanes
Lane information.
Definition: NBEdge.h:1228
bool includes(Direction d) const
Definition: NBEdge.cpp:159
const std::string & getTypeID() const
Definition: NBEdge.h:859
bool setControllingTLInformation(const NBConnection &c, const std::string &tlID)
Returns if the link could be set as to be controlled.
Definition: NBEdge.cpp:1650
void divideOnEdges(const EdgeVector *outgoing)
Definition: NBEdge.cpp:1425
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:1187
A class representing a single street sign.
Definition: NBSign.h:50
connections_finder(int fromLane, NBEdge *const edge2find, int lane2find)
constructor
Definition: NBEdge.h:1343
std::vector< unsigned int > * preparePriorities(const EdgeVector *outgoing)
Definition: NBEdge.cpp:1503
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:1249
connections_relative_edgelane_sorter(NBEdge *e)
constructor
Definition: NBEdge.h:1401
~NBEdge()
Destructor.
Definition: NBEdge.cpp:341
LaneSpreadFunction myLaneSpreadFunction
The information about how to spread the lanes.
Definition: NBEdge.h:1217
SUMOReal viaVmax
Definition: NBEdge.h:183
void sortOutgoingConnectionsByAngle()
sorts the outgoing connections by their angle relative to their junction
Definition: NBEdge.cpp:796
const std::string & getTypeName() const
Returns the type name.
Definition: NBEdge.h:478
std::string viaID
Definition: NBEdge.h:182
void addSign(NBSign sign)
Definition: NBEdge.h:1021
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:365
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
NBNode * myTo
Definition: NBEdge.h:1179
The relationships between edges are computed/loaded.
Definition: NBEdge.h:95
bool empty() const
Definition: NBEdge.cpp:153
void appendTurnaround(bool noTLSControlled)
Add a connection to the previously computed turnaround, if wished.
Definition: NBEdge.cpp:1555
connections_toedge_finder & operator=(const connections_toedge_finder &s)
invalidated assignment operator
bool operator()(const TLSDisabledConnection &e) const
Definition: NBEdge.h:1269
PositionVector getCCWBoundaryLine(const NBNode &n, SUMOReal offset) const
Definition: NBEdge.cpp:1748
std::vector< NBSign > mySigns
the street signs along this edge
Definition: NBEdge.h:1257
void setLaneWidth(int lane, SUMOReal width)
set lane specific width (negative lane implies set for all lanes)
Definition: NBEdge.cpp:1977
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2023
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:486
void setOffset(int lane, SUMOReal offset)
set lane specific end-offset (negative lane implies set for all lanes)
Definition: NBEdge.cpp:2007
void moveOutgoingConnectionsFrom(NBEdge *e, unsigned int laneOff)
Definition: NBEdge.cpp:1612
~ToEdgeConnectionsAdder()
destructor
Definition: NBEdge.h:1046
SUMOReal getEndAngle() const
Returns the angle at the end of the edge The angle is computed in computeAngle()
Definition: NBEdge.h:380
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:278
void clearControllingTLInformation()
clears tlID for all connections
Definition: NBEdge.cpp:1715
Lane2LaneInfoType
Modes of setting connections between lanes.
Definition: NBEdge.h:110
void declareConnectionsAsLoaded()
Definition: NBEdge.h:1005
bool mayBeTLSControlled(int fromLane, NBEdge *toEdge, int toLane) const
Definition: NBEdge.cpp:1639
bool hasDefaultGeometryEndpoints() const
Returns whether the geometry is terminated by the node positions This default may be violated by init...
Definition: NBEdge.cpp:371
bool operator()(const Connection &c) const
Definition: NBEdge.h:1322
void incLaneNo(unsigned int by)
Definition: NBEdge.cpp:1890
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:1248
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:635
void setStreetName(const std::string &name)
sets the street name of this edge
Definition: NBEdge.h:458
std::vector< Direction > myDirs
Definition: NBEdge.h:1079
void buildInnerEdges(const NBNode &n, unsigned int noInternalNoSplits, unsigned int &linkIndex, unsigned int &splitIndex)
Definition: NBEdge.cpp:983
void markAsInLane2LaneState()
Definition: NBEdge.cpp:1931
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:613
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:1187
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:440
std::string getLaneIDInsecure(unsigned int lane) const
Definition: NBEdge.cpp:1876
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:2039
int myFromJunctionPriority
The priority normalised for the node the edge is outgoing of.
Definition: NBEdge.h:1208
void computeLaneShapes()
Computes the offset from the edge shape on the current segment.
Definition: NBEdge.cpp:1140
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:1267
bool isInnerEdge() const
Returns whether this edge was marked as being within an intersection.
Definition: NBEdge.h:828
PositionVector myGeom
The geometry for the edge.
Definition: NBEdge.h:1214
void remapConnections(const EdgeVector &incoming)
Remaps the connection in a way that allows the removal of it.
Definition: NBEdge.cpp:808
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:1570
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:203
PositionVector getCWBoundaryLine(const NBNode &n, SUMOReal offset) const
Definition: NBEdge.cpp:1733
std::vector< Connection > getConnectionsFromLane(unsigned int lane) const
Returns connections from a given lane.
Definition: NBEdge.cpp:711
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:378
const EdgeVector & myTransitions
the transition from the virtual lane to the edge it belongs to
Definition: NBEdge.h:1038
The connection was computed and validated.
Definition: NBEdge.h:116
PositionVector startShapeAt(const PositionVector &laneShape, const NBNode *startNode) const
Definition: NBEdge.cpp:433
SUMOReal vmax
Definition: NBEdge.h:179
const std::vector< NBSign > & getSigns() const
Definition: NBEdge.h:1017
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:1211
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
Definition: NBEdge.cpp:770
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:959
void setTurningDestination(NBEdge *e)
Definition: NBEdge.cpp:1128
bool operator()(const Connection &c) const
Definition: NBEdge.h:1301
SUMOReal getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn&#39;t set.
Definition: NBEdge.h:406
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:1193
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:589
bool myAmMacroscopicConnector
Information whether this edge is a (macroscopic) connector.
Definition: NBEdge.h:1241
bool isConnectedTo(NBEdge *e)
Returns the information whethe a connection to the given edge has been added (or computed) ...
Definition: NBEdge.cpp:729
const PositionVector getInnerGeometry() const
Returns the geometry of the edge without the endpoints.
Definition: NBEdge.cpp:356
void reshiftPosition(SUMOReal xoff, SUMOReal yoff)
Applies an offset to the edge.
Definition: NBEdge.cpp:346
bool computeLanes2Edges()
computes the edge, step2: computation of which lanes approach the edges)
Definition: NBEdge.cpp:1364
NBEdge * myTurnDestination
The turn destination edge.
Definition: NBEdge.h:1205
const std::map< NBEdge *, std::vector< unsigned int > > & getBuiltConnections() const
Definition: NBEdge.h:1051
const Lane & getLaneStruct(unsigned int lane) const
Definition: NBEdge.h:999
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:168
bool hasLaneSpecificSpeed() const
whether lanes differ in speed
Definition: NBEdge.cpp:1314
int getPriority() const
Returns the priority of the edge.
Definition: NBEdge.h:346
void checkGeometry(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix)
Check the angles of successive geometry segments.
Definition: NBEdge.cpp:543
std::string getLaneID(unsigned int lane) const
Definition: NBEdge.cpp:1869
void moveConnectionToLeft(unsigned int lane)
Definition: NBEdge.cpp:936
bool myAmLeftHand
Whether this edge is a left-hand edge.
Definition: NBEdge.h:1234
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
std::string getInternalLaneID() const
Definition: NBEdge.cpp:73
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:1283
NBEdge & operator=(const NBEdge &s)
invalidated assignment operator
A list of positions.
SUMOReal myEndAngle
Definition: NBEdge.h:1186
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:1289
bool lanesWereAssigned() const
Definition: NBEdge.cpp:1627
std::vector< unsigned int > foeInternalLinks
Definition: NBEdge.h:186
std::vector< Connection > & getConnections()
Returns the connections.
Definition: NBEdge.h:732
unsigned int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:338
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:805
bool hasLoadedLength() const
Returns whether a length was set explicitly.
Definition: NBEdge.h:414
friend class GNELane
Definition: NBEdge.h:77
EdgeBuildingStep getStep() const
The building step of this edge.
Definition: NBEdge.h:432
void setLeftHanded()
Marks this edge to be left-handed.
Definition: NBEdge.h:327
SUMOReal myLaneWidth
This width of this edge&#39;s lanes.
Definition: NBEdge.h:1223
int myPriority
The priority of the edge.
Definition: NBEdge.h:1190
void init(unsigned int noLanes, bool tryIgnoreNodePositions)
Initialization routines common to all constructors.
Definition: NBEdge.cpp:297
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:1336
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:1173
unsigned int computePrioritySum(std::vector< unsigned int > *priorities)
Definition: NBEdge.cpp:1545
SUMOReal myOffset
This edges&#39;s offset to the intersection begin (will be applied to all lanes)
Definition: NBEdge.h:1220
connections_toedge_finder(NBEdge *const edge2find)
constructor
Definition: NBEdge.h:1299
std::vector< Connection > myConnections
List of connections to following edges.
Definition: NBEdge.h:1198
void setLoadedLength(SUMOReal val)
Definition: NBEdge.cpp:2082
connections_fromlane_finder(int lane2find)
constructor
Definition: NBEdge.h:1366
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:824
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:1238
Base class for objects which have an id.
Definition: Named.h:45
bool recheckLanes()
Definition: NBEdge.cpp:1388
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
Definition: NBEdge.cpp:1096
SUMOReal myLoadedLength
An optional length to use (-1 if not valid)
Definition: NBEdge.h:1231
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:1278
std::map< NBEdge *, std::vector< unsigned int > > myConnections
map of edges to this edge&#39;s lanes that reach them
Definition: NBEdge.h:1035
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:2067
Lane(NBEdge *e)
Definition: NBEdge.h:124
void decLaneNo(unsigned int by, int dir=0)
Definition: NBEdge.cpp:1905
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:362
#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:782
void execute(const unsigned int lane, const unsigned int virtEdge)
executes a bresenham - step
Definition: NBEdge.cpp:81
void computeEdgeShape()
Recomputeds the lane shapes to terminate at the node shape For every lane the intersection with the f...
Definition: NBEdge.cpp:392
void disableConnection4TLS(int fromLane, NBEdge *toEdge, int toLane)
Definition: NBEdge.cpp:1723
PositionVector viaShape
Definition: NBEdge.h:184
bool hasLaneSpecificOffset() const
whether lanes differ in offset
Definition: NBEdge.cpp:1325
SUMOReal getMaxLaneOffset()
Definition: NBEdge.cpp:1633
static bool connections_sorter(const Connection &c1, const Connection &c2)
Definition: NBEdge.h:1384
static const SUMOReal UNSPECIFIED_LOADED_LENGTH
no length override given
Definition: NBEdge.h:205
std::vector< NBEdge * > EdgeVector
Definition: NBCont.h:38
NBEdge * myEdge
the edge to compute the relative angle of
Definition: NBEdge.h:1409
SUMOReal myLength
The length of the edge.
Definition: NBEdge.h:1182
void setPreferredVehicleClass(SVCPermissions permissions, int lane=-1)
Definition: NBEdge.cpp:2053
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:499
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:1202
bool isMacroscopicConnector() const
Returns whether this edge was marked as a macroscopic connector.
Definition: NBEdge.h:813
void reduceGeometry(const SUMOReal minDist)
Removes points with a distance lesser than the given.
Definition: NBEdge.cpp:537
void setJunctionPriority(const NBNode *const node, int prio)
Sets the junction priority of the edge.
Definition: NBEdge.cpp:1106
void replaceInConnections(NBEdge *which, NBEdge *by, unsigned int laneOff)
Definition: NBEdge.cpp:860
const EdgeVector * getConnectedSorted()
Returns the list of outgoing edges without the turnaround sorted in clockwise direction.
Definition: NBEdge.cpp:742
NBEdge *const myEdge2Find
Definition: NBEdge.h:1351
void setIsInnerEdge()
Marks this edge being within an intersection.
Definition: NBEdge.h:820
void sortOutgoingConnectionsByIndex()
sorts the outgoing connections by their from-lane-index and their to-lane-index
Definition: NBEdge.cpp:802
std::string myType
The type of the edge.
Definition: NBEdge.h:1176
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge&#39;s lateral offset shal...
void append(NBEdge *continuation)
Definition: NBEdge.cpp:1831
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:1134
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:1598
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:575
SUMOReal myStartAngle
The angles of the edge.
Definition: NBEdge.h:1185
SUMOReal getTotalAngle() const
get the angle as measure from the start to the end of this edge
Definition: NBEdge.h:390
Represents a single node (junction) during network building.
Definition: NBNode.h:74
void dismissVehicleClassInformation()
Definition: NBEdge.cpp:2088
Lane & getLaneStruct(unsigned int lane)
Definition: NBEdge.h:994
bool hasSignalisedConnectionTo(const NBEdge *const e) const
Definition: NBEdge.cpp:1852
Lanes to lanes - relationships are computed; no recheck is necessary/wished.
Definition: NBEdge.h:101
NBEdge * getTurnDestination() const
Definition: NBEdge.cpp:1863
bool hasLaneSpecificWidth() const
whether lanes differ in width
Definition: NBEdge.cpp:1303
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
Direction
enum of possible directions
Definition: NBEdge.h:1075
#define SUMOReal
Definition: config.h:215
bool isNearEnough2BeJoined2(NBEdge *e, SUMOReal threshold) const
Definition: NBEdge.cpp:1882
void preferVehicleClass(int lane, SUMOVehicleClass vclass)
Definition: NBEdge.cpp:1964
void allowVehicleClass(int lane, SUMOVehicleClass vclass)
set allowed class for the given lane or for all lanes if -1 is given
Definition: NBEdge.cpp:1938
void addGeometryPoint(int index, const Position &p)
Adds a further geometry point.
Definition: NBEdge.cpp:486
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:1259
bool hasConnectionTo(NBEdge *destEdge, unsigned int destLane) const
Retrieves info about a connection to a certain lane of a certain edge.
Definition: NBEdge.cpp:723
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:422
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:371
bool computeEdge2Edges(bool noLeftMovers)
computes the edge (step1: computation of approached edges)
Definition: NBEdge.cpp:1343
SUMOReal width() const
Definition: NBEdge.cpp:1763
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:652
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:480
bool operator()(const Connection &c) const
Definition: NBEdge.h:1345
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:179
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:1253
const std::string & getStreetName() const
Returns the street name of this edge.
Definition: NBEdge.h:452
connections_toedgelane_finder(NBEdge *const edge2find, int lane2find)
constructor
Definition: NBEdge.h:1320
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:724
NBNode * myFrom
The source and the destination node.
Definition: NBEdge.h:1179
bool expandableBy(NBEdge *possContinuation) const
Definition: NBEdge.cpp:1769
SUMOReal getOffset() const
Returns the offset to the destination node.
Definition: NBEdge.h:465
~MainDirections()
destructor
Definition: NBEdge.cpp:149
bool operator()(const Connection &c) const
Definition: NBEdge.h:1368
void disallowVehicleClass(int lane, SUMOVehicleClass vclass)
set disallowed class for the given lane or for all lanes if -1 is given
Definition: NBEdge.cpp:1951
MainDirections(const EdgeVector &outgoing, NBEdge *parent, NBNode *to)
constructor
Definition: NBEdge.cpp:112
SUMOReal width
This lane&#39;s width.
Definition: NBEdge.h:138
void copyConnectionsFrom(NBEdge *src)
Definition: NBEdge.cpp:929
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:246
static const SUMOReal ANGLE_LOOKAHEAD
the distance at which to take the default anglen
Definition: NBEdge.h:207
SUMOReal getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:397
SUMOReal getAngleAtNode(const NBNode *const node) const
Returns the angle of the edge&#39;s geometry at the given node.
Definition: NBEdge.cpp:1116
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:354
bool splitGeometry(NBEdgeCont &ec, NBNodeCont &nc)
Splits this edge at geometry points.
Definition: NBEdge.cpp:492