SUMO - Simulation of Urban MObility
NBNode.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // The representation of a single node
19 /****************************************************************************/
20 #ifndef NBNode_h
21 #define NBNode_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <vector>
30 #include <deque>
31 #include <utility>
32 #include <string>
33 #include <set>
34 #include <utils/common/StdDefs.h>
35 #include <utils/common/Named.h>
36 #include <utils/geom/Bresenham.h>
37 #include <utils/geom/GeomHelper.h>
39 #include <utils/geom/Position.h>
42 #include "NBEdge.h"
43 #include "NBConnection.h"
44 #include "NBConnectionDefs.h"
45 #include "NBContHelper.h"
46 
47 
48 // ===========================================================================
49 // class declarations
50 // ===========================================================================
51 class NBRequest;
52 class NBDistrict;
53 class OptionsCont;
55 class NBTypeCont;
57 class NBDistrictCont;
58 class OutputDevice;
59 
60 
61 // ===========================================================================
62 // class definitions
63 // ===========================================================================
68 class NBNode : public Named, public Parameterised {
69  friend class NBNodeCont;
70  friend class GNEJunction; // < used for visualization (NETEDIT)
71  friend class NBNodesEdgesSorter; // < sorts the edges
72  friend class NBNodeTypeComputer; // < computes type
73  friend class NBEdgePriorityComputer; // < computes priorities of edges per intersection
74  friend class NBNodeShapeComputer; // < computes node's shape
75 
76 public:
89  private:
92 
95 
97  std::vector<int> myAvailableLanes;
98 
99  public:
104  ApproachingDivider(EdgeVector* approaching, NBEdge* currentOutgoing);
105 
108 
110  int numAvailableLanes() const {
111  return (int)myAvailableLanes.size();
112  }
113 
115  void execute(const int src, const int dest);
116 
118  std::deque<int>* spread(const std::vector<int>& approachingLanes, int dest) const;
119 
120  };
121 
125  struct Crossing : public Parameterised {
127  Crossing(const NBNode* _node, const EdgeVector& _edges, double _width, bool _priority, int _customTLIndex, int _customTLIndex2, const PositionVector& _customShape);
129  const NBNode* node;
135  double customWidth;
137  double width;
139  std::string id;
141  std::string prevWalkingArea;
143  std::string nextWalkingArea;
145  bool priority;
155  std::string tlID;
157  bool valid;
158  };
159 
160 
164  struct WalkingArea {
166  WalkingArea(const std::string& _id, double _width) :
167  id(_id),
168  width(_width),
169  hasCustomShape(false),
170  minNextCrossingEdges(std::numeric_limits<int>::max()),
171  minPrevCrossingEdges(std::numeric_limits<int>::max()) {
172  }
174  std::string id;
176  double width;
178  double length;
182  std::vector<std::string> nextCrossings;
184  std::vector<std::string> nextSidewalks;
186  std::vector<std::string> prevSidewalks;
193  };
194 
196  std::set<const NBEdge*, ComparatorIdLess> edges;
198  };
199 
201  static const int FORWARD;
202  static const int BACKWARD;
203 
205  static const double UNSPECIFIED_RADIUS;
206 
208  static const int AVOID_WIDE_RIGHT_TURN;
209  static const int AVOID_WIDE_LEFT_TURN;
210  static const int FOUR_CONTROL_POINTS;
211 
212 public:
218  NBNode(const std::string& id, const Position& position, SumoXMLNodeType type);
219 
225  NBNode(const std::string& id, const Position& position, NBDistrict* district = 0);
226 
228  ~NBNode();
229 
236  void reinit(const Position& position, SumoXMLNodeType type,
237  bool updateEdgeGeometries = false);
238 
242  const Position& getPosition() const {
243  return myPosition;
244  }
245 
247  Position getCenter() const;
248 
250  const EdgeVector& getIncomingEdges() const {
251  return myIncomingEdges;
252  }
253 
255  const EdgeVector& getOutgoingEdges() const {
256  return myOutgoingEdges;
257  }
258 
260  const EdgeVector& getEdges() const {
261  return myAllEdges;
262  }
263 
268  return myType;
269  }
270 
272  double getRadius() const {
273  return myRadius;
274  }
275 
277  bool getKeepClear() const {
278  return myKeepClear;
279  }
280 
283  return myRightOfWay;
284  }
286 
289 
293 
296 
298  void removeTrafficLights();
299 
303  bool isTLControlled() const {
304  return myTrafficLights.size() != 0;
305  }
306 
308  const std::set<NBTrafficLightDefinition*>& getControllingTLS() const {
309  return myTrafficLights;
310  }
311 
313  void invalidateTLS(NBTrafficLightLogicCont& tlCont, bool removedConnections, bool addedConnections);
314 
316  void shiftTLConnectionLaneIndex(NBEdge* edge, int offset, int threshold = -1);
318 
319 
322 
334 
335 
338 
342  void reshiftPosition(double xoff, double yoff);
343 
345  void mirrorX();
347 
349  void addIncomingEdge(NBEdge* edge);
350 
352  void addOutgoingEdge(NBEdge* edge);
353 
355  void computeLanes2Lanes();
356 
358  void computeLogic(const NBEdgeCont& ec, OptionsCont& oc);
359 
361  void computeLogic2(bool checkLaneFoes);
362 
364  bool writeLogic(OutputDevice& into) const;
365 
366  const std::string getFoes(int linkIndex) const;
367  const std::string getResponse(int linkIndex) const;
368 
370  Position getEmptyDir() const;
371 
376  bool hasIncoming(const NBEdge* const e) const;
377 
382  bool hasOutgoing(const NBEdge* const e) const;
383 
385  NBEdge* getOppositeIncoming(NBEdge* e) const;
386 
389 
392 
394  void removeDoubleEdges();
395 
397  NBEdge* getConnectionTo(NBNode* n) const;
398 
400  void addSortedLinkFoes(const NBConnection& mayDrive, const NBConnection& mustStop);
401 
403  NBEdge* getPossiblySplittedIncoming(const std::string& edgeid);
404 
406  NBEdge* getPossiblySplittedOutgoing(const std::string& edgeid);
407 
409  void removeEdge(NBEdge* edge, bool removeFromConnections = true);
410 
420  bool isLeftMover(const NBEdge* const from, const NBEdge* const to) const;
421 
430  bool mustBrake(const NBEdge* const from, const NBEdge* const to, int fromLane, int toLane, bool includePedCrossings) const;
431 
438  bool mustBrakeForCrossing(const NBEdge* const from, const NBEdge* const to, const Crossing& crossing) const;
439 
441  static bool rightTurnConflict(const NBEdge* from, const NBEdge* to, int fromLane,
442  const NBEdge* prohibitorFrom, const NBEdge* prohibitorTo, int prohibitorFromLane,
443  bool lefthand = false);
444 
446  bool turnFoes(const NBEdge* from, const NBEdge* to, int fromLane,
447  const NBEdge* from2, const NBEdge* to2, int fromLane2,
448  bool lefthand = false) const;
449 
458  bool forbids(const NBEdge* const possProhibitorFrom, const NBEdge* const possProhibitorTo,
459  const NBEdge* const possProhibitedFrom, const NBEdge* const possProhibitedTo,
460  bool regardNonSignalisedLowerPriority) const;
461 
469  bool foes(const NBEdge* const from1, const NBEdge* const to1,
470  const NBEdge* const from2, const NBEdge* const to2) const;
471 
478  LinkDirection getDirection(const NBEdge* const incoming, const NBEdge* const outgoing, bool leftHand = false) const;
479 
481  LinkState getLinkState(const NBEdge* incoming, NBEdge* outgoing,
482  int fromLane, int toLane, bool mayDefinitelyPass, const std::string& tlID) const;
483 
487  void computeNodeShape(double mismatchThreshold);
488 
490  const PositionVector& getShape() const;
491 
493  void setCustomShape(const PositionVector& shape);
494 
496  void setRadius(double radius) {
497  myRadius = radius;
498  }
499 
501  void setKeepClear(bool keepClear) {
502  myKeepClear = keepClear;
503  }
504 
506  void setRightOfWay(RightOfWay rightOfWay) {
507  myRightOfWay = rightOfWay;
508  }
509 
511  bool hasCustomShape() const {
512  return myHaveCustomPoly;
513  }
514 
516  bool checkIsRemovable() const;
517 
519  bool checkIsRemovableReporting(std::string& reason) const;
520 
522  std::vector<std::pair<NBEdge*, NBEdge*> > getEdgesToJoin() const;
523 
525  bool isNearDistrict() const;
526 
528  bool isDistrict() const;
529 
531  bool needsCont(const NBEdge* fromE, const NBEdge* otherFromE,
532  const NBEdge::Connection& c, const NBEdge::Connection& otherC) const;
533 
535  bool tlsContConflict(const NBEdge* from, const NBEdge::Connection& c,
536  const NBEdge* foeFrom, const NBEdge::Connection& foe) const;
537 
538 
546  PositionVector computeInternalLaneShape(NBEdge* fromE, const NBEdge::Connection& con, int numPoints, NBNode* recordError = 0) const;
547 
558  PositionVector computeSmoothShape(const PositionVector& begShape, const PositionVector& endShape, int numPoints,
559  bool isTurnaround, double extrapolateBeg, double extrapolateEnd,
560  NBNode* recordError = 0, int shapeFlag = 0) const;
562  static PositionVector bezierControlPoints(const PositionVector& begShape, const PositionVector& endShape,
563  bool isTurnaround, double extrapolateBeg, double extrapolateEnd,
564  bool& ok, NBNode* recordError = 0, double straightThresh = DEG2RAD(5),
565  int shapeFlag = 0);
566 
567 
569  double getDisplacementError() const {
570  return myDisplacementError;
571  }
572 
574  void replaceIncoming(NBEdge* which, NBEdge* by, int laneOff);
575 
577  void replaceIncoming(const EdgeVector& which, NBEdge* by);
578 
580  void replaceOutgoing(NBEdge* which, NBEdge* by, int laneOff);
581 
583  void replaceOutgoing(const EdgeVector& which, NBEdge* by);
584 
586  int guessCrossings();
587 
588  /* @brief check whether a crossing should be build for the candiate edges and build 0 to n crossings
589  * @param[in] candidates The candidate vector of edges to be crossed
590  * @return The number of crossings built
591  * */
592  int checkCrossing(EdgeVector candidates);
593 
596 
598  void buildInnerEdges();
599 
603  int buildCrossings();
604 
608  void buildWalkingAreas(int cornerDetail);
609 
612 
614  EdgeVector edgesBetween(const NBEdge* e1, const NBEdge* e2) const;
615 
617  bool crossingBetween(const NBEdge* e1, const NBEdge* e2) const;
618 
621  return myBlockedConnections;
622  }
623 
625  bool geometryLike() const;
626 
628  void setRoundabout();
629 
631  NBNode::Crossing* addCrossing(EdgeVector edges, double width, bool priority, int tlIndex = -1, int tlIndex2 = -1,
632  const PositionVector& customShape = PositionVector::EMPTY, bool fromSumoNet = false);
633 
635  void addWalkingAreaShape(EdgeVector edges, const PositionVector& shape);
636 
638  void removeCrossing(const EdgeVector& edges);
639 
641  void discardAllCrossings(bool rejectAll);
642 
644  void discardWalkingareas();
645 
649  }
650 
652  std::vector<Crossing*> getCrossings() const;
653  inline const std::vector<Crossing*>& getCrossingsIncludingInvalid() const {
654  return myCrossings;
655  }
656 
658  inline const std::vector<WalkingArea>& getWalkingAreas() const {
659  return myWalkingAreas;
660  }
661 
662  const std::vector<WalkingAreaCustomShape>& getWalkingAreaCustomShapes() const {
664  }
665 
667  Crossing* getCrossing(const std::string& id) const;
668 
670  Crossing* getCrossing(const EdgeVector& edges, bool hardFail = true) const;
671 
672  /* @brief set tl indices of this nodes crossing starting at the given index
673  * @return Whether a custom index was used
674  */
675  bool setCrossingTLIndices(const std::string& tlID, int startIndex);
676 
678  int numNormalConnections() const;
679 
681  void avoidOverlap();
682 
684  bool rightOnRedConflict(int index, int foeIndex) const;
685 
687  void sortEdges(bool useNodeShape);
688 
690  int getConnectionIndex(const NBEdge* from, const NBEdge::Connection& con) const;
691 
697  public:
699  explicit nodes_by_id_sorter() { }
700 
702  int operator()(NBNode* n1, NBNode* n2) const {
703  return n1->getID() < n2->getID();
704  }
705  };
706 
711  public:
713  explicit edge_by_direction_sorter(NBNode* n) : myNode(n) {}
714 
716  int operator()(NBEdge* e1, NBEdge* e2) const {
717  UNUSED_PARAMETER(e2);
718  return e1->getFromNode() == myNode;
719  }
720 
721  private:
724 
725  };
726 
728  static std::string getNodeIDFromInternalLane(const std::string id);
729 
730 
732  static bool isTrafficLight(SumoXMLNodeType type);
733 
735  bool isSimpleContinuation(bool checkLaneNumbers = true) const;
736 
738  void markBentPriority(bool isBent) {
739  myIsBentPriority = isBent;
740  }
741 
743  bool isBentPriority() {
744  return myIsBentPriority;
745  }
746 
748  bool isConstantWidthTransition() const;
749 
751  std::vector<Position> getEndPoints() const;
752 
753 private:
756 
758  EdgeVector* getEdgesThatApproach(NBEdge* currentOutgoing);
759 
761  void replaceInConnectionProhibitions(NBEdge* which, NBEdge* by, int whichLaneOff, int byLaneOff);
762 
764  void remapRemoved(NBTrafficLightLogicCont& tc, NBEdge* removed, const EdgeVector& incoming, const EdgeVector& outgoing);
765 
767  bool forbidsPedestriansAfter(std::vector<std::pair<NBEdge*, bool> > normalizedLanes, int startIndex);
768 
771 
773  static bool isLongEnough(NBEdge* out, double minLength);
774 
777 
779  void displaceShapeAtWidthChange(const NBEdge* from, const NBEdge::Connection& con, PositionVector& fromShape, PositionVector& toShape) const;
780 
782  static bool includes(const std::set<NBEdge*, ComparatorIdLess>& super,
783  const std::set<const NBEdge*, ComparatorIdLess>& sub);
784 
785 private:
788 
791 
794 
797 
799  std::vector<Crossing*> myCrossings;
800 
802  std::vector<WalkingArea> myWalkingAreas;
803 
805  std::vector<WalkingAreaCustomShape> myWalkingAreaCustomShapes;
806 
809 
812 
815 
818 
821 
824 
826  std::set<NBTrafficLightDefinition*> myTrafficLights;
827 
829  double myRadius;
830 
833 
836 
839 
842 
845 
846  /* @brief whether this junction is a bent priority junction (main direction turns)
847  * @note see NBEdgePriorityComputer
848  */
850 
851 
852 private:
854  NBNode(const NBNode& s);
855 
857  NBNode& operator=(const NBNode& s);
858 };
859 
860 
861 #endif
862 
863 /****************************************************************************/
864 
bool getKeepClear() const
Returns the keepClear flag.
Definition: NBNode.h:277
static const PositionVector EMPTY
empty Vector
int tlLinkIndex2
Definition: NBNode.h:150
int operator()(NBEdge *e1, NBEdge *e2) const
operator of selection
Definition: NBNode.h:716
int getConnectionIndex(const NBEdge *from, const NBEdge::Connection &con) const
return the index of the given connection
Definition: NBNode.cpp:3007
bool myIsBentPriority
Definition: NBNode.h:849
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:160
std::vector< WalkingAreaCustomShape > myWalkingAreaCustomShapes
Vector of custom walking areas shapes.
Definition: NBNode.h:805
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:1855
void setRoundabout()
update the type of this node as a roundabout
Definition: NBNode.cpp:2913
int numNormalConnections() const
return the number of lane-to-lane connections at this junction (excluding crossings) ...
Definition: NBNode.cpp:2992
WalkingArea(const std::string &_id, double _width)
constructor
Definition: NBNode.h:166
bool foes(const NBEdge *const from1, const NBEdge *const to1, const NBEdge *const from2, const NBEdge *const to2) const
Returns the information whether the given flows cross.
Definition: NBNode.cpp:1676
ApproachingDivider(EdgeVector *approaching, NBEdge *currentOutgoing)
Constructor.
Definition: NBNode.cpp:94
int buildCrossings()
build pedestrian crossings
Definition: NBNode.cpp:2351
void computeLogic2(bool checkLaneFoes)
compute right-of-way logic for all lane-to-lane connections
Definition: NBNode.cpp:909
RightOfWay myRightOfWay
how to compute right of way for this node
Definition: NBNode.h:835
void setRightOfWay(RightOfWay rightOfWay)
set method for computing right-of-way
Definition: NBNode.h:506
std::string id
the (edge)-id of this crossing
Definition: NBNode.h:139
PositionVector myPoly
the (outer) shape of the junction
Definition: NBNode.h:817
void execute(const int src, const int dest)
the bresenham-callback
Definition: NBNode.cpp:128
const NBConnectionProhibits & getProhibitions()
get prohibitions (BLocked connections)
Definition: NBNode.h:620
bool isDistrict() const
check if node is a district
Definition: NBNode.cpp:2039
SumoXMLNodeType myType
The type of the junction.
Definition: NBNode.h:808
A container for traffic light definitions and built programs.
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
Definition: NBNode.cpp:286
int minPrevCrossingEdges
minimum number of edges crossed by incoming crossings
Definition: NBNode.h:192
~NBNode()
Destructor.
Definition: NBNode.cpp:280
PositionVector computeInternalLaneShape(NBEdge *fromE, const NBEdge::Connection &con, int numPoints, NBNode *recordError=0) const
Compute the shape for an internal lane.
Definition: NBNode.cpp:660
int myCrossingsLoadedFromSumoNet
number of crossings loaded from a sumo net
Definition: NBNode.h:841
This class computes shapes of junctions.
std::vector< Crossing * > getCrossings() const
return this junctions pedestrian crossings
Definition: NBNode.cpp:2291
double length
This lane&#39;s width.
Definition: NBNode.h:178
void removeEdge(NBEdge *edge, bool removeFromConnections=true)
Removes edge from this node and optionally removes connections as well.
Definition: NBNode.cpp:1460
bool mustBrake(const NBEdge *const from, const NBEdge *const to, int fromLane, int toLane, bool includePedCrossings) const
Returns the information whether the described flow must let any other flow pass.
Definition: NBNode.cpp:1534
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
Definition: NBNode.cpp:427
bool hasCustomShape() const
return whether the shape was set by the user
Definition: NBNode.h:511
The representation of a single edge during network building.
Definition: NBEdge.h:65
void displaceShapeAtWidthChange(const NBEdge *from, const NBEdge::Connection &con, PositionVector &fromShape, PositionVector &toShape) const
displace lane shapes to account for change in lane width at this node
Definition: NBNode.cpp:742
static const double UNSPECIFIED_RADIUS
unspecified lane width
Definition: NBNode.h:205
Used for sorting the cells by the begin time they describe.
Definition: NBNode.h:696
A container for districts.
The base class for traffic light logic definitions.
static bool isLongEnough(NBEdge *out, double minLength)
check if is long enough
Definition: NBNode.cpp:1206
void removeDoubleEdges()
remove duble edges
Definition: NBNode.cpp:1349
bool hasCustomShape
whether this walkingArea has a custom shape
Definition: NBNode.h:188
void markBentPriority(bool isBent)
mark whether a priority road turns at this node
Definition: NBNode.h:738
bool rightOnRedConflict(int index, int foeIndex) const
whether the given index must yield to the foeIndex while turing right on a red light ...
Definition: NBNode.cpp:3110
Crossing * getCrossing(const std::string &id) const
return the crossing with the given id
Definition: NBNode.cpp:2948
PositionVector shape
The crossing&#39;s shape.
Definition: NBNode.h:133
edge_by_direction_sorter(NBNode *n)
constructor
Definition: NBNode.h:713
void buildWalkingAreas(int cornerDetail)
build pedestrian walking areas and set connections from/to walkingAreas
Definition: NBNode.cpp:2448
std::string id
the (edge)-id of this walkingArea
Definition: NBNode.h:174
const std::string & getID() const
Returns the id.
Definition: Named.h:78
void mirrorX()
mirror coordinates along the x-axis
Definition: NBNode.cpp:322
int numCrossingsFromSumoNet() const
get num of crossings from sumo net
Definition: NBNode.h:647
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
Definition: NBNode.cpp:347
void setCustomShape(const PositionVector &shape)
set the junction shape
Definition: NBNode.cpp:1985
NBConnectionProhibits myBlockedConnections
The container for connection block dependencies.
Definition: NBNode.h:811
void addOutgoingEdge(NBEdge *edge)
adds an outgoing edge
Definition: NBNode.cpp:437
RightOfWay
algorithms for computing right of way
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:33
void replaceOutgoing(NBEdge *which, NBEdge *by, int laneOff)
Replaces occurences of the first edge within the list of outgoing by the second Connections are remap...
Definition: NBNode.cpp:1245
void sortEdges(bool useNodeShape)
sort all edge containers for this node
Definition: NBNode.cpp:3123
static const int AVOID_WIDE_RIGHT_TURN
flags for controlling shape generation
Definition: NBNode.h:208
Position getCenter() const
Returns a position that is guaranteed to lie within the node shape.
Definition: NBNode.cpp:3026
static bool rightTurnConflict(const NBEdge *from, const NBEdge *to, int fromLane, const NBEdge *prohibitorFrom, const NBEdge *prohibitorTo, int prohibitorFromLane, bool lefthand=false)
return whether the given laneToLane connection is a right turn which must yield to a bicycle crossing...
Definition: NBNode.cpp:1554
const EdgeVector & getOutgoingEdges() const
Returns this node&#39;s outgoing edges (The edges which start at this node)
Definition: NBNode.h:255
bool priority
whether the pedestrians have priority
Definition: NBNode.h:145
NBRequest * myRequest
Node requests.
Definition: NBNode.h:823
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
NBDistrict * myDistrict
The district the node is the centre of.
Definition: NBNode.h:814
A class representing a single district.
Definition: NBDistrict.h:65
NBEdge * getConnectionTo(NBNode *n) const
get connection to certain node
Definition: NBNode.cpp:1997
bool tlsContConflict(const NBEdge *from, const NBEdge::Connection &c, const NBEdge *foeFrom, const NBEdge::Connection &foe) const
whether the connection must yield if the foe remains on the intersection after its phase ends ...
Definition: NBNode.cpp:840
EdgeVector myAllEdges
Vector of incoming and outgoing edges.
Definition: NBNode.h:796
void invalidateTLS(NBTrafficLightLogicCont &tlCont, bool removedConnections, bool addedConnections)
causes the traffic light to be computed anew
Definition: NBNode.cpp:363
void computeLanes2Lanes()
computes the connections of lanes to edges
Definition: NBNode.cpp:982
void setRadius(double radius)
set the turning radius
Definition: NBNode.h:496
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Definition: NBNode.h:303
void invalidateIncomingConnections()
invalidate incoming connections
Definition: NBNode.cpp:1518
void removeCrossing(const EdgeVector &edges)
remove a pedestrian crossing from this node (identified by its edges)
Definition: NBNode.cpp:2933
void setPriorityJunctionPriorities()
sets the priorites in case of a priority junction
void computeNodeShape(double mismatchThreshold)
Compute the junction shape for this node.
Definition: NBNode.cpp:947
std::string prevWalkingArea
the lane-id of the previous walkingArea
Definition: NBNode.h:141
NBEdge * getPossiblySplittedIncoming(const std::string &edgeid)
get possibly splitted incoming edge
Definition: NBNode.cpp:1434
int checkCrossing(EdgeVector candidates)
Definition: NBNode.cpp:2149
static const int FORWARD
edge directions (for pedestrian related stuff)
Definition: NBNode.h:201
bool writeLogic(OutputDevice &into) const
writes the XML-representation of the logic as a bitset-logic XML representation
Definition: NBNode.cpp:917
int minNextCrossingEdges
minimum number of edges crossed by nextCrossings
Definition: NBNode.h:190
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
A list of positions.
bool turnFoes(const NBEdge *from, const NBEdge *to, int fromLane, const NBEdge *from2, const NBEdge *to2, int fromLane2, bool lefthand=false) const
return whether the given laneToLane connection originate from the same edge and are in conflict due t...
Definition: NBNode.cpp:1601
void buildCrossingsAndWalkingAreas()
build crossings, and walkingareas. Also removes invalid loaded crossings if wished ...
Definition: NBNode.cpp:2268
bool crossingBetween(const NBEdge *e1, const NBEdge *e2) const
return true if the given edges are connected by a crossing
Definition: NBNode.cpp:2836
void invalidateOutgoingConnections()
invalidate outgoing connections
Definition: NBNode.cpp:1526
bool isConstantWidthTransition() const
detects whether a given junction splits or merges lanes while keeping constant road width ...
Definition: NBNode.cpp:734
void removeJoinedTrafficLights()
remove all traffic light definitions that are part of a joined tls
Definition: NBNode.cpp:850
int operator()(NBNode *n1, NBNode *n2) const
Comparing operator.
Definition: NBNode.h:702
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node) ...
Definition: NBNode.h:260
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
void removeTrafficLights()
Removes all references to traffic lights that control this tls.
Definition: NBNode.cpp:354
EdgeVector * getEdgesThatApproach(NBEdge *currentOutgoing)
returns a list of edges which are connected to the given outgoing edge
Definition: NBNode.cpp:1222
bool geometryLike() const
whether this is structurally similar to a geometry node
Definition: NBNode.cpp:2882
std::set< NBTrafficLightDefinition * > myTrafficLights
traffic lights of node
Definition: NBNode.h:826
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
std::set< const NBEdge *, ComparatorIdLess > edges
Definition: NBNode.h:196
bool hasOutgoing(const NBEdge *const e) const
Returns whether the given edge starts at this node.
Definition: NBNode.cpp:1393
static PositionVector bezierControlPoints(const PositionVector &begShape, const PositionVector &endShape, bool isTurnaround, double extrapolateBeg, double extrapolateEnd, bool &ok, NBNode *recordError=0, double straightThresh=DEG2RAD(5), int shapeFlag=0)
get bezier control points
Definition: NBNode.cpp:503
bool myDiscardAllCrossings
whether to discard all pedestrian crossings
Definition: NBNode.h:838
NBNode * myNode
The node to compute the relative angle of.
Definition: NBNode.h:723
void discardAllCrossings(bool rejectAll)
discard all current (and optionally future) crossings
Definition: NBNode.cpp:2309
#define DEG2RAD(x)
Definition: GeomHelper.h:38
const std::vector< WalkingAreaCustomShape > & getWalkingAreaCustomShapes() const
Definition: NBNode.h:662
void replaceInConnectionProhibitions(NBEdge *which, NBEdge *by, int whichLaneOff, int byLaneOff)
replace incoming connections prohibitions
Definition: NBNode.cpp:1314
An upper class for objects with additional parameters.
Definition: Parameterised.h:44
double myRadius
the turning radius (for all corners) at this node in m.
Definition: NBNode.h:829
EdgeVector myIncomingEdges
Vector of incoming edges.
Definition: NBNode.h:790
void setKeepClear(bool keepClear)
set the keepClear flag
Definition: NBNode.h:501
bool checkIsRemovableReporting(std::string &reason) const
check if node is removable and return reason if not
Definition: NBNode.cpp:1889
Base class for objects which have an id.
Definition: Named.h:58
bool hasIncoming(const NBEdge *const e) const
Returns whether the given edge ends at this node.
Definition: NBNode.cpp:1387
int customTLIndex2
Definition: NBNode.h:153
double getDisplacementError() const
compute the displacement error during s-curve computation
Definition: NBNode.h:569
bool setCrossingTLIndices(const std::string &tlID, int startIndex)
Definition: NBNode.cpp:2976
void avoidOverlap()
fix overlap
Definition: NBNode.cpp:3087
NBEdge * getPossiblySplittedOutgoing(const std::string &edgeid)
get possibly splitted outgoing edge
Definition: NBNode.cpp:1447
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream&#39;s direction.
Definition: NBNode.cpp:1764
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:1979
NBNode::Crossing * addCrossing(EdgeVector edges, double width, bool priority, int tlIndex=-1, int tlIndex2=-1, const PositionVector &customShape=PositionVector::EMPTY, bool fromSumoNet=false)
add a pedestrian crossing to this node
Definition: NBNode.cpp:2921
RightOfWay getRightOfWay() const
Returns hint on how to compute right of way.
Definition: NBNode.h:282
EdgeVector myOutgoingEdges
Vector of outgoing edges.
Definition: NBNode.h:793
std::vector< Crossing * > myCrossings
Vector of crossings.
Definition: NBNode.h:799
void addWalkingAreaShape(EdgeVector edges, const PositionVector &shape)
add custom shape for walkingArea
Definition: NBNode.cpp:2873
NBEdge * myCurrentOutgoing
The approached current edge.
Definition: NBNode.h:94
double myDisplacementError
geometry error after computation of internal lane shapes
Definition: NBNode.h:844
static const int BACKWARD
Definition: NBNode.h:202
bool isBentPriority()
return whether a priority road turns at this node
Definition: NBNode.h:743
nodes_by_id_sorter()
Constructor.
Definition: NBNode.h:699
void addTrafficLight(NBTrafficLightDefinition *tlDef)
Adds a traffic light to the list of traffic lights that control this node.
Definition: NBNode.cpp:337
double width
This crossing&#39;s width.
Definition: NBNode.h:137
bool myHaveCustomPoly
whether this nodes shape was set by the user
Definition: NBNode.h:820
int customTLIndex
the custom traffic light index of this crossing (if controlled)
Definition: NBNode.h:152
Position myPosition
The position the node lies at.
Definition: NBNode.h:787
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
Definition: NBNode.cpp:2240
std::map< NBConnection, NBConnectionVector > NBConnectionProhibits
Definition of a container for connection block dependencies Includes a list of all connections which ...
int removeSelfLoops(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tc)
Removes edges which are both incoming and outgoing into this node.
Definition: NBNode.cpp:394
double getRadius() const
Returns the turning radius of this node.
Definition: NBNode.h:272
void shiftTLConnectionLaneIndex(NBEdge *edge, int offset, int threshold=-1)
patches loaded signal plans by modifying lane indices above threshold by the given offset ...
Definition: NBNode.cpp:386
~ApproachingDivider()
Destructor.
Definition: NBNode.cpp:124
std::vector< WalkingArea > myWalkingAreas
Vector of walking areas.
Definition: NBNode.h:802
const EdgeVector & getIncomingEdges() const
Returns this node&#39;s incoming edges (The edges which yield in this node)
Definition: NBNode.h:250
PositionVector customShape
optional customShape for this crossing
Definition: NBNode.h:147
void replaceIncoming(NBEdge *which, NBEdge *by, int laneOff)
Replaces occurences of the first edge within the list of incoming by the second Connections are remap...
Definition: NBNode.cpp:1281
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
bool isNearDistrict() const
if node is near district
Definition: NBNode.cpp:2008
bool myKeepClear
whether the junction area must be kept clear
Definition: NBNode.h:832
std::vector< int > myAvailableLanes
The available lanes to which connections shall be built.
Definition: NBNode.h:97
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node) ...
Definition: NBNode.h:308
Sorts outgoing before incoming edges.
Definition: NBNode.h:710
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:34
bool forbids(const NBEdge *const possProhibitorFrom, const NBEdge *const possProhibitorTo, const NBEdge *const possProhibitedFrom, const NBEdge *const possProhibitedTo, bool regardNonSignalisedLowerPriority) const
Returns the information whether "prohibited" flow must let "prohibitor" flow pass.
Definition: NBNode.cpp:1666
void buildInnerEdges()
build internal lanes, pedestrian crossings and walking areas
Definition: NBNode.cpp:2328
std::vector< Position > getEndPoints() const
return list of unique endpoint coordinates of all edges at this node
Definition: NBNode.cpp:3207
static const int FOUR_CONTROL_POINTS
Definition: NBNode.h:210
NBNode & operator=(const NBNode &s)
invalidated assignment operator
double customWidth
This crossing&#39;s width.
Definition: NBNode.h:135
A definition of a pedestrian walking area.
Definition: NBNode.h:164
EdgeVector * myApproaching
The list of edges that approach the current edge.
Definition: NBNode.h:91
A storage for options typed value containers)
Definition: OptionsCont.h:92
const std::string getFoes(int linkIndex) const
Definition: NBNode.cpp:927
const NBNode * node
The parent node of this crossing.
Definition: NBNode.h:129
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:267
Position getEmptyDir() const
Returns something like the most unused direction Should only be used to add source or sink nodes...
Definition: NBNode.cpp:1490
bool needsCont(const NBEdge *fromE, const NBEdge *otherFromE, const NBEdge::Connection &c, const NBEdge::Connection &otherC) const
whether an internal junction should be built at from and respect other
Definition: NBNode.cpp:791
int numAvailableLanes() const
@ get number of avaliable lanes
Definition: NBNode.h:110
EdgeVector getEdgesSortedByAngleAtNodeCenter() const
returns the list of all edges sorted clockwise by getAngleAtNodeToCenter
Definition: NBNode.cpp:3044
int tlLinkIndex
the traffic light index of this crossing (if controlled)
Definition: NBNode.h:149
const Position & getPosition() const
Definition: NBNode.h:242
EdgeVector edges
The edges being crossed.
Definition: NBNode.h:131
Represents a single node (junction) during network building.
Definition: NBNode.h:68
int guessCrossings()
guess pedestrian crossings and return how many were guessed
Definition: NBNode.cpp:2045
A definition of a pedestrian crossing.
Definition: NBNode.h:125
const std::string getResponse(int linkIndex) const
Definition: NBNode.cpp:937
const std::vector< WalkingArea > & getWalkingAreas() const
return this junctions pedestrian walking areas
Definition: NBNode.h:658
void addSortedLinkFoes(const NBConnection &mayDrive, const NBConnection &mustStop)
add shorted link FOES
Definition: NBNode.cpp:1417
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
Computes lane-2-lane connections.
Definition: NBNode.h:88
bool mustBrakeForCrossing(const NBEdge *const from, const NBEdge *const to, const Crossing &crossing) const
Returns the information whether the described flow must brake for the given crossing.
Definition: NBNode.cpp:1548
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBNode.h:155
NBEdge * getOppositeIncoming(NBEdge *e) const
returns the opposite incoming edge of certain edge
Definition: NBNode.cpp:1399
const std::vector< Crossing * > & getCrossingsIncludingInvalid() const
Definition: NBNode.h:653
std::vector< std::string > nextCrossings
the lane-id of the next crossing(s)
Definition: NBNode.h:182
static bool includes(const std::set< NBEdge *, ComparatorIdLess > &super, const std::set< const NBEdge *, ComparatorIdLess > &sub)
returns whether sub is a subset of super
Definition: NBNode.cpp:2823
bool isLeftMover(const NBEdge *const from, const NBEdge *const to) const
Computes whether the given connection is a left mover across the junction.
Definition: NBNode.cpp:1647
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:434
void computeLogic(const NBEdgeCont &ec, OptionsCont &oc)
computes the node&#39;s type, logic and traffic light
Definition: NBNode.cpp:864
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
std::string nextWalkingArea
the lane-id of the next walkingArea
Definition: NBNode.h:143
std::deque< int > * spread(const std::vector< int > &approachingLanes, int dest) const
the method that spreads the wished number of lanes from the the lane given by the bresenham-call to b...
Definition: NBNode.cpp:152
bool checkIsRemovable() const
check if node is removable
Definition: NBNode.cpp:1883
NBNode(const std::string &id, const Position &position, SumoXMLNodeType type)
Constructor.
Definition: NBNode.cpp:239
std::vector< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
get edges to join
Definition: NBNode.cpp:1956
PositionVector computeSmoothShape(const PositionVector &begShape, const PositionVector &endShape, int numPoints, bool isTurnaround, double extrapolateBeg, double extrapolateEnd, NBNode *recordError=0, int shapeFlag=0) const
Compute a smooth curve between the given geometries.
Definition: NBNode.cpp:476
void discardWalkingareas()
discard previously built walkingareas (required for repeated computation by netedit) ...
Definition: NBNode.cpp:2322
std::vector< std::string > prevSidewalks
the lane-id of the previous sidewalk lane or ""
Definition: NBNode.h:186
static bool isTrafficLight(SumoXMLNodeType type)
return whether the given type is a traffic light
Definition: NBNode.cpp:3102
bool valid
whether this crossing is valid (and can be written to the net.xml). This is needed for netedit becaus...
Definition: NBNode.h:157
std::vector< std::string > nextSidewalks
the lane-id of the next sidewalk lane or ""
Definition: NBNode.h:184
bool isSimpleContinuation(bool checkLaneNumbers=true) const
check if node is a simple continuation
Definition: NBNode.cpp:447
void reshiftPosition(double xoff, double yoff)
Applies an offset to the node.
Definition: NBNode.cpp:312
void remapRemoved(NBTrafficLightLogicCont &tc, NBEdge *removed, const EdgeVector &incoming, const EdgeVector &outgoing)
remap removed
Definition: NBNode.cpp:1683
static const int AVOID_WIDE_LEFT_TURN
Definition: NBNode.h:209
PositionVector shape
The polygonal shape.
Definition: NBNode.h:180
A storage for available types of edges.
Definition: NBTypeCont.h:55
double width
This lane&#39;s width.
Definition: NBNode.h:176
bool forbidsPedestriansAfter(std::vector< std::pair< NBEdge *, bool > > normalizedLanes, int startIndex)
return whether there is a non-sidewalk lane after the given index;
Definition: NBNode.cpp:2257
EdgeVector edgesBetween(const NBEdge *e1, const NBEdge *e2) const
return all edges that lie clockwise between the given edges
Definition: NBNode.cpp:2857
static std::string getNodeIDFromInternalLane(const std::string id)
returns the node id for internal lanes, crossings and walkingareas
Definition: NBNode.cpp:3067