SUMO - Simulation of Urban MObility
NBNode.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // The representation of a single node
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef NBNode_h
24 #define NBNode_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <vector>
37 #include <deque>
38 #include <utility>
39 #include <string>
40 #include <set>
41 #include <utils/common/StdDefs.h>
42 #include <utils/common/Named.h>
43 #include <utils/geom/Bresenham.h>
44 #include <utils/geom/GeomHelper.h>
46 #include <utils/geom/Position.h>
49 #include "NBEdge.h"
50 #include "NBConnection.h"
51 #include "NBConnectionDefs.h"
52 #include "NBContHelper.h"
53 
54 
55 // ===========================================================================
56 // class declarations
57 // ===========================================================================
58 class NBRequest;
59 class NBDistrict;
60 class OptionsCont;
62 class NBTypeCont;
64 class NBDistrictCont;
65 class OutputDevice;
66 
67 
68 // ===========================================================================
69 // class definitions
70 // ===========================================================================
75 class NBNode : public Named {
76  friend class NBNodeCont;
77  friend class GNEJunction; // < used for visualization (NETEDIT)
78  friend class NBNodesEdgesSorter; // < sorts the edges
79  friend class NBNodeTypeComputer; // < computes type
80  friend class NBEdgePriorityComputer; // < computes priorities of edges per intersection
81  friend class NBNodeShapeComputer; // < computes node's shape
82 
83 public:
85  typedef std::map<std::string, PositionVector> CustomShapeMap;
86 
99  private:
102 
105 
107  std::vector<int> myAvailableLanes;
108 
109  public:
114  ApproachingDivider(EdgeVector* approaching, NBEdge* currentOutgoing);
115 
118 
120  int numAvailableLanes() const {
121  return (int)myAvailableLanes.size();
122  }
123 
125  void execute(const int src, const int dest);
126 
128  std::deque<int>* spread(const std::vector<int>& approachingLanes, int dest) const;
129 
130  };
131 
135  struct Crossing {
137  Crossing(const NBNode* _node, const EdgeVector& _edges, double _width, bool _priority) :
138  node(_node),
139  edges(_edges),
140  width(_width),
141  priority(_priority),
142  tlLinkNo(-1),
143  valid(true) {
144  }
146  const NBNode* node;
152  double width;
154  std::string id;
156  std::string prevWalkingArea;
158  std::string nextWalkingArea;
160  bool priority;
162  int tlLinkNo;
164  std::string tlID;
166  bool valid;
167  };
168 
169 
173  struct WalkingArea {
175  WalkingArea(const std::string& _id, double _width) :
176  id(_id),
177  width(_width),
178  nextCrossing("") {
179  }
181  std::string id;
183  double width;
185  double length;
189  std::string nextCrossing;
191  std::vector<std::string> nextSidewalks;
193  std::vector<std::string> prevSidewalks;
194  };
195 
197  static const int FORWARD;
198  static const int BACKWARD;
200  static const double DEFAULT_CROSSING_WIDTH;
201 
203  static const double UNSPECIFIED_RADIUS;
204 
205 public:
211  NBNode(const std::string& id, const Position& position, SumoXMLNodeType type);
212 
218  NBNode(const std::string& id, const Position& position, NBDistrict* district = 0);
219 
221  ~NBNode();
222 
229  void reinit(const Position& position, SumoXMLNodeType type,
230  bool updateEdgeGeometries = false);
231 
235  const Position& getPosition() const {
236  return myPosition;
237  }
238 
240  Position getCenter() const;
241 
243  const EdgeVector& getIncomingEdges() const {
244  return myIncomingEdges;
245  }
246 
248  const EdgeVector& getOutgoingEdges() const {
249  return myOutgoingEdges;
250  }
251 
253  const EdgeVector& getEdges() const {
254  return myAllEdges;
255  }
256 
261  return myType;
262  }
263 
265  double getRadius() const {
266  return myRadius;
267  }
268 
270  bool getKeepClear() const {
271  return myKeepClear;
272  }
274 
277 
281 
284 
286  void removeTrafficLights();
287 
291  bool isTLControlled() const {
292  return myTrafficLights.size() != 0;
293  }
294 
296  const std::set<NBTrafficLightDefinition*>& getControllingTLS() const {
297  return myTrafficLights;
298  }
299 
301  void invalidateTLS(NBTrafficLightLogicCont& tlCont, bool removedConnections, bool addedConnections);
302 
304  void shiftTLConnectionLaneIndex(NBEdge* edge, int offset);
306 
307 
310 
322 
323 
326 
330  void reshiftPosition(double xoff, double yoff);
331 
333  void mirrorX();
335 
337  void addIncomingEdge(NBEdge* edge);
338 
340  void addOutgoingEdge(NBEdge* edge);
341 
343  void computeLanes2Lanes();
344 
346  void computeLogic(const NBEdgeCont& ec, OptionsCont& oc);
347 
349  bool writeLogic(OutputDevice& into, const bool checkLaneFoes) const;
350 
352  Position getEmptyDir() const;
353 
358  bool hasIncoming(const NBEdge* const e) const;
359 
364  bool hasOutgoing(const NBEdge* const e) const;
365 
367  NBEdge* getOppositeIncoming(NBEdge* e) const;
368 
371 
374 
376  void removeDoubleEdges();
377 
379  NBEdge* getConnectionTo(NBNode* n) const;
380 
382  void addSortedLinkFoes(const NBConnection& mayDrive, const NBConnection& mustStop);
383 
385  NBEdge* getPossiblySplittedIncoming(const std::string& edgeid);
386 
388  NBEdge* getPossiblySplittedOutgoing(const std::string& edgeid);
389 
391  void removeEdge(NBEdge* edge, bool removeFromConnections = true);
392 
402  bool isLeftMover(const NBEdge* const from, const NBEdge* const to) const;
403 
412  bool mustBrake(const NBEdge* const from, const NBEdge* const to, int fromLane, int toLane, bool includePedCrossings) const;
413 
420  bool mustBrakeForCrossing(const NBEdge* const from, const NBEdge* const to, const Crossing& crossing) const;
421 
423  static bool rightTurnConflict(const NBEdge* from, const NBEdge* to, int fromLane,
424  const NBEdge* prohibitorFrom, const NBEdge* prohibitorTo, int prohibitorFromLane,
425  bool lefthand = false);
426 
435  bool forbids(const NBEdge* const possProhibitorFrom, const NBEdge* const possProhibitorTo,
436  const NBEdge* const possProhibitedFrom, const NBEdge* const possProhibitedTo,
437  bool regardNonSignalisedLowerPriority) const;
438 
446  bool foes(const NBEdge* const from1, const NBEdge* const to1,
447  const NBEdge* const from2, const NBEdge* const to2) const;
448 
455  LinkDirection getDirection(const NBEdge* const incoming, const NBEdge* const outgoing, bool leftHand = false) const;
456 
458  LinkState getLinkState(const NBEdge* incoming, NBEdge* outgoing,
459  int fromLane, int toLane, bool mayDefinitelyPass, const std::string& tlID) const;
460 
464  void computeNodeShape(double mismatchThreshold);
465 
467  const PositionVector& getShape() const;
468 
470  void setCustomShape(const PositionVector& shape);
471 
473  void setCustomLaneShape(const std::string& laneID, const PositionVector& shape);
474 
476  const CustomShapeMap& getCustomLaneShapes() const {
477  return myCustomLaneShapes;
478  }
479 
481  void setRadius(double radius) {
482  myRadius = radius;
483  }
484 
486  void setKeepClear(bool keepClear) {
487  myKeepClear = keepClear;
488  }
489 
491  bool hasCustomShape() const {
492  return myHaveCustomPoly;
493  }
494 
496  bool checkIsRemovable() const;
497 
499  bool checkIsRemovableReporting(std::string& reason) const;
500 
502  std::vector<std::pair<NBEdge*, NBEdge*> > getEdgesToJoin() const;
503 
505  bool isNearDistrict() const;
506 
508  bool isDistrict() const;
509 
511  bool needsCont(const NBEdge* fromE, const NBEdge* otherFromE,
512  const NBEdge::Connection& c, const NBEdge::Connection& otherC) const;
513 
521  PositionVector computeInternalLaneShape(NBEdge* fromE, const NBEdge::Connection& con, int numPoints, NBNode* recordError = 0) const;
522 
533  PositionVector computeSmoothShape(const PositionVector& begShape, const PositionVector& endShape, int numPoints,
534  bool isTurnaround, double extrapolateBeg, double extrapolateEnd,
535  NBNode* recordError = 0) const;
537  static PositionVector bezierControlPoints(const PositionVector& begShape, const PositionVector& endShape,
538  bool isTurnaround, double extrapolateBeg, double extrapolateEnd,
539  bool& ok, NBNode* recordError = 0, double straightThresh = DEG2RAD(5));
540 
541 
543  double getDisplacementError() const {
544  return myDisplacementError;
545  }
546 
548  void replaceIncoming(NBEdge* which, NBEdge* by, int laneOff);
549 
551  void replaceIncoming(const EdgeVector& which, NBEdge* by);
552 
554  void replaceOutgoing(NBEdge* which, NBEdge* by, int laneOff);
555 
557  void replaceOutgoing(const EdgeVector& which, NBEdge* by);
558 
560  int guessCrossings();
561 
562  /* @brief check whether a crossing should be build for the candiate edges and build 0 to n crossings
563  * @param[in] candidates The candidate vector of edges to be crossed
564  * @return The number of crossings built
565  * */
566  int checkCrossing(EdgeVector candidates);
567 
570 
572  void buildInnerEdges();
573 
577  int buildCrossings();
578 
582  void buildWalkingAreas(int cornerDetail);
583 
586 
588  EdgeVector edgesBetween(const NBEdge* e1, const NBEdge* e2) const;
589 
591  bool crossingBetween(const NBEdge* e1, const NBEdge* e2) const;
592 
595  return myBlockedConnections;
596  }
597 
599  bool geometryLike() const;
600 
602  void setRoundabout();
603 
605  void addCrossing(EdgeVector edges, double width, bool priority, bool fromSumoNet = false);
606 
608  void removeCrossing(const EdgeVector& edges);
609 
611  void discardAllCrossings(bool rejectAll);
612 
616  }
617 
619  std::vector<Crossing*> getCrossings() const;
620  inline const std::vector<Crossing*>& getCrossingsIncludingInvalid() const {
621  return myCrossings;
622  }
623 
625  inline const std::vector<WalkingArea>& getWalkingAreas() const {
626  return myWalkingAreas;
627  }
628 
630  Crossing* getCrossing(const std::string& id) const;
631 
633  void setCrossingTLIndices(const std::string& tlID, int startIndex);
634 
636  int numNormalConnections() const;
637 
639  void avoidOverlap();
640 
642  bool rightOnRedConflict(int index, int foeIndex) const;
643 
645  void sortEdges(bool useNodeShape);
646 
648  int getConnectionIndex(const NBEdge* from, const NBEdge::Connection& con) const;
649 
655  public:
657  explicit nodes_by_id_sorter() { }
658 
660  int operator()(NBNode* n1, NBNode* n2) const {
661  return n1->getID() < n2->getID();
662  }
663  };
664 
669  public:
671  explicit edge_by_direction_sorter(NBNode* n) : myNode(n) {}
672 
674  int operator()(NBEdge* e1, NBEdge* e2) const {
675  UNUSED_PARAMETER(e2);
676  return e1->getFromNode() == myNode;
677  }
678 
679  private:
682 
683  };
684 
686  static std::string getNodeIDFromInternalLane(const std::string id);
687 
688 
690  static bool isTrafficLight(SumoXMLNodeType type);
691 
693  bool isSimpleContinuation(bool checkLaneNumbers = true) const;
694 
695 
696 private:
699 
701  EdgeVector* getEdgesThatApproach(NBEdge* currentOutgoing);
702 
704  void replaceInConnectionProhibitions(NBEdge* which, NBEdge* by, int whichLaneOff, int byLaneOff);
705 
707  void remapRemoved(NBTrafficLightLogicCont& tc, NBEdge* removed, const EdgeVector& incoming, const EdgeVector& outgoing);
708 
710  bool forbidsPedestriansAfter(std::vector<std::pair<NBEdge*, bool> > normalizedLanes, int startIndex);
711 
714 
716  static bool isLongEnough(NBEdge* out, double minLength);
717 
718 private:
721 
724 
727 
730 
732  std::vector<Crossing*> myCrossings;
733 
735  std::vector<WalkingArea> myWalkingAreas;
736 
739 
742 
745 
748 
751 
754 
756  std::set<NBTrafficLightDefinition*> myTrafficLights;
757 
759  double myRadius;
760 
763 
765  CustomShapeMap myCustomLaneShapes;
766 
769 
772 
775 
776 private:
778  NBNode(const NBNode& s);
779 
781  NBNode& operator=(const NBNode& s);
782 };
783 
784 
785 #endif
786 
787 /****************************************************************************/
788 
const EdgeVector & getIncomingEdges() const
Returns this node&#39;s incoming edges (The edges which yield in this node)
Definition: NBNode.h:243
Position getEmptyDir() const
Returns something like the most unused direction Should only be used to add source or sink nodes...
Definition: NBNode.cpp:1311
bool getKeepClear() const
Returns the keepClear flag.
Definition: NBNode.h:270
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:165
int numAvailableLanes() const
@ get number of avaliable lanes
Definition: NBNode.h:120
void setRoundabout()
update the type of this node as a roundabout
Definition: NBNode.cpp:2589
Position getCenter() const
Returns a position that is guaranteed to lie within the node shape.
Definition: NBNode.cpp:2666
WalkingArea(const std::string &_id, double _width)
constructor
Definition: NBNode.h:175
ApproachingDivider(EdgeVector *approaching, NBEdge *currentOutgoing)
Constructor.
Definition: NBNode.cpp:96
int buildCrossings()
build pedestrian crossings
Definition: NBNode.cpp:2109
void shiftTLConnectionLaneIndex(NBEdge *edge, int offset)
patches loaded signal plans by modifying lane indices
Definition: NBNode.cpp:361
std::string id
the (edge)-id of this crossing
Definition: NBNode.h:154
bool isDistrict() const
check if node is a district
Definition: NBNode.cpp:1796
PositionVector myPoly
the (outer) shape of the junction
Definition: NBNode.h:747
void execute(const int src, const int dest)
the bresenham-callback
Definition: NBNode.cpp:130
NBEdge * getOppositeIncoming(NBEdge *e) const
returns the opposite incoming edge of certain edge
Definition: NBNode.cpp:1220
const NBConnectionProhibits & getProhibitions()
get prohibitions (BLocked connections)
Definition: NBNode.h:594
SumoXMLNodeType myType
The type of the junction.
Definition: NBNode.h:738
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:264
int getConnectionIndex(const NBEdge *from, const NBEdge::Connection &con) const
return the index of the given connection
Definition: NBNode.cpp:2647
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Definition: NBNode.h:291
~NBNode()
Destructor.
Definition: NBNode.cpp:258
int myCrossingsLoadedFromSumoNet
number of crossings loaded from a sumo net
Definition: NBNode.h:771
This class computes shapes of junctions.
double length
This lane&#39;s width.
Definition: NBNode.h:185
void removeEdge(NBEdge *edge, bool removeFromConnections=true)
Removes edge from this node and optionally removes connections as well.
Definition: NBNode.cpp:1281
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
Definition: NBNode.cpp:402
The representation of a single edge during network building.
Definition: NBEdge.h:71
static const double DEFAULT_CROSSING_WIDTH
default width of pedetrian crossings
Definition: NBNode.h:200
int numNormalConnections() const
return the number of lane-to-lane connections at this junction (excluding crossings) ...
Definition: NBNode.cpp:2641
static const double UNSPECIFIED_RADIUS
unspecified lane width
Definition: NBNode.h:203
Used for sorting the cells by the begin time they describe.
Definition: NBNode.h:654
bool hasOutgoing(const NBEdge *const e) const
Returns whether the given edge starts at this node.
Definition: NBNode.cpp:1214
A container for districts.
The base class for traffic light logic definitions.
EdgeVector edgesBetween(const NBEdge *e1, const NBEdge *e2) const
return all edges that lie clockwise between the given edges
Definition: NBNode.cpp:2548
static bool isLongEnough(NBEdge *out, double minLength)
check if is long enough
Definition: NBNode.cpp:1027
PositionVector computeInternalLaneShape(NBEdge *fromE, const NBEdge::Connection &con, int numPoints, NBNode *recordError=0) const
Compute the shape for an internal lane.
Definition: NBNode.cpp:617
void removeDoubleEdges()
remove duble edges
Definition: NBNode.cpp:1170
PositionVector shape
The lane&#39;s shape.
Definition: NBNode.h:150
edge_by_direction_sorter(NBNode *n)
constructor
Definition: NBNode.h:671
bool hasCustomShape() const
return whether the shape was set by the user
Definition: NBNode.h:491
void buildWalkingAreas(int cornerDetail)
build pedestrian walking areas and set connections from/to walkingAreas
Definition: NBNode.cpp:2194
std::string id
the (edge)-id of this walkingArea
Definition: NBNode.h:181
EdgeVector getEdgesSortedByAngleAtNodeCenter() const
returns the list of all edges sorted clockwise by getAngleAtNodeToCenter
Definition: NBNode.cpp:2684
bool checkIsRemovable() const
check if node is removable
Definition: NBNode.cpp:1634
void mirrorX()
mirror coordinates along the x-axis
Definition: NBNode.cpp:297
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
Definition: NBNode.cpp:322
void setCustomShape(const PositionVector &shape)
set the junction shape
Definition: NBNode.cpp:1732
NBConnectionProhibits myBlockedConnections
The container for connection block dependencies.
Definition: NBNode.h:741
bool hasIncoming(const NBEdge *const e) const
Returns whether the given edge ends at this node.
Definition: NBNode.cpp:1208
int numCrossingsFromSumoNet() const
get num of crossings from sumo net
Definition: NBNode.h:614
void addOutgoingEdge(NBEdge *edge)
adds an outgoing edge
Definition: NBNode.cpp:412
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:40
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:1066
void sortEdges(bool useNodeShape)
sort all edge containers for this node
Definition: NBNode.cpp:2763
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:1375
bool priority
whether the pedestrians have priority
Definition: NBNode.h:160
NBRequest * myRequest
Node requests.
Definition: NBNode.h:753
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
CustomShapeMap myCustomLaneShapes
custom lane shapes
Definition: NBNode.h:765
NBDistrict * myDistrict
The district the node is the centre of.
Definition: NBNode.h:744
A class representing a single district.
Definition: NBDistrict.h:72
std::map< std::string, PositionVector > CustomShapeMap
map for custon shapes
Definition: NBNode.h:85
const EdgeVector & getOutgoingEdges() const
Returns this node&#39;s outgoing edges (The edges which start at this node)
Definition: NBNode.h:248
const std::string & getID() const
Returns the id.
Definition: Named.h:66
EdgeVector myAllEdges
Vector of incoming and outgoing edges.
Definition: NBNode.h:729
void invalidateTLS(NBTrafficLightLogicCont &tlCont, bool removedConnections, bool addedConnections)
causes the traffic light to be computed anew
Definition: NBNode.cpp:338
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:658
void computeLanes2Lanes()
computes the connections of lanes to edges
Definition: NBNode.cpp:803
void setRadius(double radius)
set the turning radius
Definition: NBNode.h:481
void invalidateIncomingConnections()
invalidate incoming connections
Definition: NBNode.cpp:1339
void removeCrossing(const EdgeVector &edges)
remove a pedestrian crossing from this node (identified by its edges)
Definition: NBNode.cpp:2606
void setPriorityJunctionPriorities()
sets the priorites in case of a priority junction
const Position & getPosition() const
Definition: NBNode.h:235
void computeNodeShape(double mismatchThreshold)
Compute the junction shape for this node.
Definition: NBNode.cpp:771
std::string prevWalkingArea
the lane-id of the previous walkingArea
Definition: NBNode.h:156
NBEdge * getPossiblySplittedIncoming(const std::string &edgeid)
get possibly splitted incoming edge
Definition: NBNode.cpp:1255
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:296
int checkCrossing(EdgeVector candidates)
Definition: NBNode.cpp:1906
static const int FORWARD
edge directions (for pedestrian related stuff)
Definition: NBNode.h:197
int operator()(NBNode *n1, NBNode *n2) const
Comparing operator.
Definition: NBNode.h:660
void setCrossingTLIndices(const std::string &tlID, int startIndex)
set tl indices of this nodes crossing starting at the given index
Definition: NBNode.cpp:2632
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
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:1369
Crossing * getCrossing(const std::string &id) const
return the crossing with the given id
Definition: NBNode.cpp:2621
A list of positions.
void buildCrossingsAndWalkingAreas()
build crossings, and walkingareas. Also removes invalid loaded crossings if wished ...
Definition: NBNode.cpp:2025
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:260
bool geometryLike() const
whether this is structurally similar to a geometry node
Definition: NBNode.cpp:2564
void invalidateOutgoingConnections()
invalidate outgoing connections
Definition: NBNode.cpp:1347
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:329
EdgeVector * getEdgesThatApproach(NBEdge *currentOutgoing)
returns a list of edges which are connected to the given outgoing edge
Definition: NBNode.cpp:1043
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node) ...
Definition: NBNode.h:253
std::set< NBTrafficLightDefinition * > myTrafficLights
traffic lights of node
Definition: NBNode.h:756
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
void setCustomLaneShape(const std::string &laneID, const PositionVector &shape)
sets a custom shape for an internal lane
Definition: NBNode.cpp:1744
std::string nextCrossing
the lane-id of the next crossing
Definition: NBNode.h:189
const CustomShapeMap & getCustomLaneShapes() const
sets a custom shape for an internal lane
Definition: NBNode.h:476
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:1606
Crossing(const NBNode *_node, const EdgeVector &_edges, double _width, bool _priority)
constructor
Definition: NBNode.h:137
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:2750
bool myDiscardAllCrossings
whether to discard all pedestrian crossings
Definition: NBNode.h:768
NBNode * myNode
The node to compute the relative angle of.
Definition: NBNode.h:681
void discardAllCrossings(bool rejectAll)
discard all current (and optionally future) crossings
Definition: NBNode.cpp:2065
#define DEG2RAD(x)
Definition: GeomHelper.h:45
void replaceInConnectionProhibitions(NBEdge *which, NBEdge *by, int whichLaneOff, int byLaneOff)
replace incoming connections prohibitions
Definition: NBNode.cpp:1135
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:1539
bool checkIsRemovableReporting(std::string &reason) const
check if node is removable and return reason if not
Definition: NBNode.cpp:1640
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:1726
double myRadius
the turning radius (for all corners) at this node in m.
Definition: NBNode.h:759
NBEdge * getConnectionTo(NBNode *n) const
get connection to certain node
Definition: NBNode.cpp:1754
EdgeVector myIncomingEdges
Vector of incoming edges.
Definition: NBNode.h:723
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:1422
void setKeepClear(bool keepClear)
set the keepClear flag
Definition: NBNode.h:486
Base class for objects which have an id.
Definition: Named.h:46
std::vector< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
get edges to join
Definition: NBNode.cpp:1703
int operator()(NBEdge *e1, NBEdge *e2) const
operator of selection
Definition: NBNode.h:674
void avoidOverlap()
fix overlap
Definition: NBNode.cpp:2727
NBEdge * getPossiblySplittedOutgoing(const std::string &edgeid)
get possibly splitted outgoing edge
Definition: NBNode.cpp:1268
EdgeVector myOutgoingEdges
Vector of outgoing edges.
Definition: NBNode.h:726
std::vector< Crossing * > myCrossings
Vector of crossings.
Definition: NBNode.h:732
NBEdge * myCurrentOutgoing
The approached current edge.
Definition: NBNode.h:104
double myDisplacementError
geometry error after computation of internal lane shapes
Definition: NBNode.h:774
static const int BACKWARD
Definition: NBNode.h:198
nodes_by_id_sorter()
Constructor.
Definition: NBNode.h:657
void addTrafficLight(NBTrafficLightDefinition *tlDef)
Adds a traffic light to the list of traffic lights that control this node.
Definition: NBNode.cpp:312
bool isNearDistrict() const
if node is near district
Definition: NBNode.cpp:1765
double width
This lane&#39;s width.
Definition: NBNode.h:152
bool myHaveCustomPoly
whether this nodes shape was set by the user
Definition: NBNode.h:750
Position myPosition
The position the node lies at.
Definition: NBNode.h:720
bool checkCrossingDuplicated(EdgeVector edges)
return true if already exist a crossing with the same edges as the input
Definition: NBNode.cpp:1997
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:369
~ApproachingDivider()
Destructor.
Definition: NBNode.cpp:126
std::vector< WalkingArea > myWalkingAreas
Vector of walking areas.
Definition: NBNode.h:735
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:1102
PositionVector computeSmoothShape(const PositionVector &begShape, const PositionVector &endShape, int numPoints, bool isTurnaround, double extrapolateBeg, double extrapolateEnd, NBNode *recordError=0) const
Compute a smooth curve between the given geometries.
Definition: NBNode.cpp:451
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
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:1355
bool myKeepClear
whether the junction area must be kept clear
Definition: NBNode.h:762
std::vector< int > myAvailableLanes
The available lanes to which connections shall be built.
Definition: NBNode.h:107
Sorts outgoing before incoming edges.
Definition: NBNode.h:668
int tlLinkNo
the traffic light index of this crossing (if controlled)
Definition: NBNode.h:162
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:41
void buildInnerEdges()
build internal lanes, pedestrian crossings and walking areas
Definition: NBNode.cpp:2077
NBNode & operator=(const NBNode &s)
invalidated assignment operator
A definition of a pedestrian walking area.
Definition: NBNode.h:173
EdgeVector * myApproaching
The list of edges that approach the current edge.
Definition: NBNode.h:101
A storage for options typed value containers)
Definition: OptionsCont.h:99
const NBNode * node
The parent node of this crossing.
Definition: NBNode.h:146
double getRadius() const
Returns the turning radius of this node.
Definition: NBNode.h:265
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:154
EdgeVector edges
The edges being crossed.
Definition: NBNode.h:148
bool crossingBetween(const NBEdge *e1, const NBEdge *e2) const
return true if the given edges are connected by a crossing
Definition: NBNode.cpp:2531
Represents a single node (junction) during network building.
Definition: NBNode.h:75
bool isSimpleContinuation(bool checkLaneNumbers=true) const
check if node is a simple continuation
Definition: NBNode.cpp:422
void addCrossing(EdgeVector edges, double width, bool priority, bool fromSumoNet=false)
add a pedestrian crossing to this node
Definition: NBNode.cpp:2597
int guessCrossings()
guess pedestrian crossings and return how many were guessed
Definition: NBNode.cpp:1802
A definition of a pedestrian crossing.
Definition: NBNode.h:135
void addSortedLinkFoes(const NBConnection &mayDrive, const NBConnection &mustStop)
add shorted link FOES
Definition: NBNode.cpp:1238
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
Computes lane-2-lane connections.
Definition: NBNode.h:98
bool writeLogic(OutputDevice &into, const bool checkLaneFoes) const
writes the XML-representation of the logic as a bitset-logic XML representation
Definition: NBNode.cpp:761
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBNode.h:164
void computeLogic(const NBEdgeCont &ec, OptionsCont &oc)
computes the node&#39;s type, logic and traffic light
Definition: NBNode.cpp:708
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:63
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:1451
std::vector< Crossing * > getCrossings() const
return this junctions pedestrian crossings
Definition: NBNode.cpp:2047
const std::vector< WalkingArea > & getWalkingAreas() const
return this junctions pedestrian walking areas
Definition: NBNode.h:625
std::string nextWalkingArea
the lane-id of the next walkingArea
Definition: NBNode.h:158
NBNode(const std::string &id, const Position &position, SumoXMLNodeType type)
Constructor.
Definition: NBNode.cpp:227
const std::vector< Crossing * > & getCrossingsIncludingInvalid() const
Definition: NBNode.h:620
double getDisplacementError() const
compute the displacement error during s-curve computation
Definition: NBNode.h:543
static PositionVector bezierControlPoints(const PositionVector &begShape, const PositionVector &endShape, bool isTurnaround, double extrapolateBeg, double extrapolateEnd, bool &ok, NBNode *recordError=0, double straightThresh=DEG2RAD(5))
get bezier control points
Definition: NBNode.cpp:477
std::vector< std::string > prevSidewalks
the lane-id of the previous sidewalk lane or ""
Definition: NBNode.h:193
static bool isTrafficLight(SumoXMLNodeType type)
return whether the given type is a traffic light
Definition: NBNode.cpp:2742
bool valid
whether this crossing is valid (and can be written to the net.xml). This is needed for netedit becaus...
Definition: NBNode.h:166
std::vector< std::string > nextSidewalks
the lane-id of the next sidewalk lane or ""
Definition: NBNode.h:191
void reshiftPosition(double xoff, double yoff)
Applies an offset to the node.
Definition: NBNode.cpp:290
void remapRemoved(NBTrafficLightLogicCont &tc, NBEdge *removed, const EdgeVector &incoming, const EdgeVector &outgoing)
remap removed
Definition: NBNode.cpp:1458
PositionVector shape
The polygonal shape.
Definition: NBNode.h:187
A storage for available types of edges.
Definition: NBTypeCont.h:62
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:1441
double width
This lane&#39;s width.
Definition: NBNode.h:183
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:2014
static std::string getNodeIDFromInternalLane(const std::string id)
returns the node id for internal lanes, crossings and walkingareas
Definition: NBNode.cpp:2707
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:428