Eclipse 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-2022 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// The representation of a single node
22/****************************************************************************/
23#pragma once
24#include <config.h>
25
26#include <vector>
27#include <deque>
28#include <utility>
29#include <string>
30#include <set>
31#include <memory>
33#include <utils/common/Named.h>
37#include <utils/geom/Position.h>
40#include "NBEdge.h"
41#include "NBConnection.h"
42#include "NBConnectionDefs.h"
43#include "NBContHelper.h"
44
45
46// ===========================================================================
47// class declarations
48// ===========================================================================
49class NBRequest;
50class NBDistrict;
51class OptionsCont;
53class NBTypeCont;
55class NBDistrictCont;
56class OutputDevice;
57
58
59// ===========================================================================
60// class definitions
61// ===========================================================================
66class NBNode : public Named, public Parameterised {
67 friend class NBNodeCont;
68 friend class GNEJunction; // < used for visualization (NETEDIT)
69 friend class NBNodesEdgesSorter; // < sorts the edges
70 friend class NBNodeTypeComputer; // < computes type
71 friend class NBEdgePriorityComputer; // < computes priorities of edges per intersection
72
73public:
86 public:
91 ApproachingDivider(const EdgeVector& approaching, NBEdge* currentOutgoing);
92
95
97 int numAvailableLanes() const {
98 return (int)myAvailableLanes.size();
99 }
100
102 void execute(const int src, const int dest);
103
105 std::deque<int>* spread(const std::vector<int>& approachingLanes, int dest) const;
106
107 private:
110
113
115 std::vector<int> myAvailableLanes;
116
119
120 private:
123
124 };
125
129 class Crossing final : public Parameterised {
130 public:
132 Crossing(const NBNode* _node, const EdgeVector& _edges, double _width, bool _priority, int _customTLIndex, int _customTLIndex2, const PositionVector& _customShape);
134 const NBNode* node;
142 double width;
144 std::string id;
146 std::string prevWalkingArea;
148 std::string nextWalkingArea;
160 std::string tlID;
162 bool valid;
163 };
164
165
169 struct WalkingArea {
171 WalkingArea(const std::string& _id, double _width) :
172 id(_id),
173 width(_width) {
174 }
176 std::string id;
178 double width;
184 std::vector<std::string> nextCrossings;
186 std::vector<std::string> prevCrossings;
188 std::vector<std::string> nextSidewalks;
190 std::vector<std::string> prevSidewalks;
192 bool hasCustomShape = false;
194 int minNextCrossingEdges = std::numeric_limits<int>::max();
196 int minPrevCrossingEdges = std::numeric_limits<int>::max();
197 };
198
200 std::set<const NBEdge*, ComparatorIdLess> edges;
202 double width;
203 };
204
206 static const int FORWARD;
207 static const int BACKWARD;
208
210 static const double UNSPECIFIED_RADIUS;
211
213 static const int AVOID_WIDE_RIGHT_TURN;
214 static const int AVOID_WIDE_LEFT_TURN;
215 static const int FOUR_CONTROL_POINTS;
217 static const int SCURVE_IGNORE;
218 static const int INDIRECT_LEFT;
219
220public:
226 NBNode(const std::string& id, const Position& position, SumoXMLNodeType type);
227
233 NBNode(const std::string& id, const Position& position, NBDistrict* district = 0);
234
236 ~NBNode();
237
244 void reinit(const Position& position, SumoXMLNodeType type,
245 bool updateEdgeGeometries = false);
246
250 const Position& getPosition() const {
251 return myPosition;
252 }
253
255 Position getCenter() const;
256
259 return myIncomingEdges;
260 }
261
264 return myOutgoingEdges;
265 }
266
268 const EdgeVector& getEdges() const {
269 return myAllEdges;
270 }
271
276 return myType;
277 }
278
280 double getRadius() const {
281 return myRadius;
282 }
283
285 bool getKeepClear() const {
286 return myKeepClear;
287 }
288
291 return myRightOfWay;
292 }
293
296 return myFringeType;
297 }
298
300 const std::string& getName() const {
301 return myName;
302 }
304
307
311
314
316 void removeTrafficLights(bool setAsPriority = false);
317
321 bool isTLControlled() const {
322 return myTrafficLights.size() != 0;
323 }
324
326 const std::set<NBTrafficLightDefinition*>& getControllingTLS() const {
327 return myTrafficLights;
328 }
329
331 void invalidateTLS(NBTrafficLightLogicCont& tlCont, bool removedConnections, bool addedConnections);
332
334 void shiftTLConnectionLaneIndex(NBEdge* edge, int offset, int threshold = -1);
336
337
340
352
353
356
360 void reshiftPosition(double xoff, double yoff);
361
363 void mirrorX();
365
367 void addIncomingEdge(NBEdge* edge);
368
370 void addOutgoingEdge(NBEdge* edge);
371
373 void computeLanes2Lanes();
374
376 void computeLogic(const NBEdgeCont& ec);
377
379 void computeLogic2(bool checkLaneFoes);
380
382 void computeKeepClear();
383
385 bool writeLogic(OutputDevice& into) const;
386
388 const std::string getFoes(int linkIndex) const;
389
391 const std::string getResponse(int linkIndex) const;
392
394 bool hasConflict() const;
395
397 Position getEmptyDir() const;
398
403 bool hasIncoming(const NBEdge* const e) const;
404
409 bool hasOutgoing(const NBEdge* const e) const;
410
413
415 void invalidateIncomingConnections(bool reallowSetting = false);
416
418 void invalidateOutgoingConnections(bool reallowSetting = false);
419
421 void removeDoubleEdges();
422
424 NBEdge* getConnectionTo(NBNode* n) const;
425
427 void addSortedLinkFoes(const NBConnection& mayDrive, const NBConnection& mustStop);
428
430 NBEdge* getPossiblySplittedIncoming(const std::string& edgeid);
431
433 NBEdge* getPossiblySplittedOutgoing(const std::string& edgeid);
434
436 void removeEdge(NBEdge* edge, bool removeFromConnections = true);
437
447 bool isLeftMover(const NBEdge* const from, const NBEdge* const to) const;
448
457 bool mustBrake(const NBEdge* const from, const NBEdge* const to, int fromLane, int toLane, bool includePedCrossings) const;
458
465 bool mustBrakeForCrossing(const NBEdge* const from, const NBEdge* const to, const Crossing& crossing) const;
466
468 bool brakeForCrossingOnExit(const NBEdge* to) const;
469
471 static bool rightTurnConflict(const NBEdge* from, const NBEdge* to, int fromLane,
472 const NBEdge* prohibitorFrom, const NBEdge* prohibitorTo, int prohibitorFromLane);
473
475 bool mergeConflictYields(const NBEdge* from, int fromLane, int fromLaneFoe, NBEdge* to, int toLane) const;
476
478 bool mergeConflict(const NBEdge* from, const NBEdge::Connection& con,
479 const NBEdge* prohibitorFrom, const NBEdge::Connection& prohibitorCon, bool foes) const;
480
482 bool turnFoes(const NBEdge* from, const NBEdge* to, int fromLane,
483 const NBEdge* from2, const NBEdge* to2, int fromLane2,
484 bool lefthand = false) const;
485
494 bool forbids(const NBEdge* const possProhibitorFrom, const NBEdge* const possProhibitorTo,
495 const NBEdge* const possProhibitedFrom, const NBEdge* const possProhibitedTo,
496 bool regardNonSignalisedLowerPriority) const;
497
505 bool foes(const NBEdge* const from1, const NBEdge* const to1,
506 const NBEdge* const from2, const NBEdge* const to2) const;
507
514 LinkDirection getDirection(const NBEdge* const incoming, const NBEdge* const outgoing, bool leftHand = false) const;
515
517 LinkState getLinkState(const NBEdge* incoming, NBEdge* outgoing,
518 int fromLane, int toLane, bool mayDefinitelyPass, const std::string& tlID) const;
519
523 void computeNodeShape(double mismatchThreshold);
524
527
529 const PositionVector& getShape() const;
530
532 void setCustomShape(const PositionVector& shape);
533
535 void setRadius(double radius) {
536 myRadius = radius;
537 }
538
540 void setKeepClear(bool keepClear) {
541 myKeepClear = keepClear;
542 }
543
545 void setRightOfWay(RightOfWay rightOfWay) {
546 myRightOfWay = rightOfWay;
547 }
548
550 void setFringeType(FringeType fringeType) {
551 myFringeType = fringeType;
552 }
553
555 void setName(const std::string& name) {
556 myName = name;
557 }
558
560 bool hasCustomShape() const {
561 return myHaveCustomPoly;
562 }
563
565 bool checkIsRemovable() const;
566
568 bool checkIsRemovableReporting(std::string& reason) const;
569
571 std::vector<std::pair<NBEdge*, NBEdge*> > getEdgesToJoin() const;
572
574 bool isNearDistrict() const;
575
577 bool isDistrict() const;
578
580 bool needsCont(const NBEdge* fromE, const NBEdge* otherFromE,
581 const NBEdge::Connection& c, const NBEdge::Connection& otherC) const;
582
584 bool tlsContConflict(const NBEdge* from, const NBEdge::Connection& c,
585 const NBEdge* foeFrom, const NBEdge::Connection& foe) const;
586
587
595 PositionVector computeInternalLaneShape(const NBEdge* fromE, const NBEdge::Connection& con, int numPoints, NBNode* recordError = 0, int shapeFlag = 0) const;
596
607 PositionVector computeSmoothShape(const PositionVector& begShape, const PositionVector& endShape, int numPoints,
608 bool isTurnaround, double extrapolateBeg, double extrapolateEnd,
609 NBNode* recordError = 0, int shapeFlag = 0) const;
611 static PositionVector bezierControlPoints(const PositionVector& begShape, const PositionVector& endShape,
612 bool isTurnaround, double extrapolateBeg, double extrapolateEnd,
613 bool& ok, NBNode* recordError = 0, double straightThresh = DEG2RAD(5),
614 int shapeFlag = 0);
615
617 PositionVector indirectLeftShape(const PositionVector& begShape, const PositionVector& endShape, int numPoints) const;
618
620 double getDisplacementError() const {
621 return myDisplacementError;
622 }
623
625 void replaceIncoming(NBEdge* which, NBEdge* by, int laneOff);
626
628 void replaceIncoming(const EdgeVector& which, NBEdge* by);
629
631 void replaceOutgoing(NBEdge* which, NBEdge* by, int laneOff);
632
634 void replaceOutgoing(const EdgeVector& which, NBEdge* by);
635
637 int guessCrossings();
638
639 /* @brief check whether a crossing should be build for the candiate edges and build 0 to n crossings
640 * @param[in] candidates The candidate vector of edges to be crossed
641 * @return The number of crossings built
642 * */
643 int checkCrossing(EdgeVector candidates);
644
647
649 double buildInnerEdges();
650
654 int buildCrossings();
655
659 void buildWalkingAreas(int cornerDetail, double joinMinDist);
660
663
665 EdgeVector edgesBetween(const NBEdge* e1, const NBEdge* e2) const;
666
668 bool crossingBetween(const NBEdge* e1, const NBEdge* e2) const;
669
671 bool alreadyConnectedPaths(const NBEdge* e1, const NBEdge* e2, double dist) const;
672
674 bool crossesFringe(const NBEdge* e1, const NBEdge* e2) const;
675
679 }
680
682 bool geometryLike() const;
683 bool geometryLike(const EdgeVector& incoming, const EdgeVector& outgoing) const;
684
686 void setRoundabout();
687
689 bool isRoundabout() const;
690
692 NBNode::Crossing* addCrossing(EdgeVector edges, double width, bool priority, int tlIndex = -1, int tlIndex2 = -1,
693 const PositionVector& customShape = PositionVector::EMPTY, bool fromSumoNet = false);
694
696 void addWalkingAreaShape(EdgeVector edges, const PositionVector& shape, double width);
697
699 void removeCrossing(const EdgeVector& edges);
700
702 void discardAllCrossings(bool rejectAll);
703
705 void discardWalkingareas();
706
710 }
711
713 std::vector<Crossing*> getCrossings() const;
714 inline const std::vector<std::unique_ptr<Crossing> >& getCrossingsIncludingInvalid() const {
715 return myCrossings;
716 }
717
719 inline const std::vector<WalkingArea>& getWalkingAreas() const {
720 return myWalkingAreas;
721 }
722
723 const std::vector<WalkingAreaCustomShape>& getWalkingAreaCustomShapes() const {
725 }
726
728 Crossing* getCrossing(const std::string& id) const;
729
731 Crossing* getCrossing(const EdgeVector& edges, bool hardFail = true) const;
732
734 WalkingArea& getWalkingArea(const std::string& id);
735
736 /* @brief set tl indices of this nodes crossing starting at the given index
737 * @return Whether a custom index was used
738 */
739 bool setCrossingTLIndices(const std::string& tlID, int startIndex);
740
742 int numNormalConnections() const;
743
745 void avoidOverlap();
746
748 bool rightOnRedConflict(int index, int foeIndex) const;
749
751 void sortEdges(bool useNodeShape);
752
754 int getConnectionIndex(const NBEdge* from, const NBEdge::Connection& con) const;
755
761 public:
763 explicit nodes_by_id_sorter() { }
764
766 int operator()(NBNode* n1, NBNode* n2) const {
767 return n1->getID() < n2->getID();
768 }
769 };
770
775 public:
778
780 int operator()(NBEdge* e1, NBEdge* e2) const {
782 return e1->getFromNode() == myNode;
783 }
784
785 private:
788
789 };
790
792 static bool isTrafficLight(SumoXMLNodeType type);
793
795 bool isSimpleContinuation(bool checkLaneNumbers = true, bool checkWidth = false) const;
796
798 void markBentPriority(bool isBent) {
799 myIsBentPriority = isBent;
800 }
801
803 bool isBentPriority() const {
804 return myIsBentPriority;
805 }
806
808 bool typeWasGuessed() const {
809 return myTypeWasGuessed;
810 }
811
813 bool isConstantWidthTransition() const;
814
816 std::vector<std::pair<Position, std::string> > getEndPoints() const;
817
818private:
821
823 void getEdgesThatApproach(NBEdge* currentOutgoing, EdgeVector& approaching);
824
826 void replaceInConnectionProhibitions(NBEdge* which, NBEdge* by, int whichLaneOff, int byLaneOff);
827
829 void remapRemoved(NBTrafficLightLogicCont& tc, NBEdge* removed, const EdgeVector& incoming, const EdgeVector& outgoing);
830
832 bool forbidsPedestriansAfter(std::vector<std::pair<NBEdge*, bool> > normalizedLanes, int startIndex);
833
836
838 static bool isLongEnough(NBEdge* out, double minLength);
839
842
844 void displaceShapeAtWidthChange(const NBEdge* from, const NBEdge::Connection& con, PositionVector& fromShape, PositionVector& toShape) const;
845
847 static bool includes(const std::set<NBEdge*, ComparatorIdLess>& super,
848 const std::set<const NBEdge*, ComparatorIdLess>& sub);
849
850 NBEdge* getNextCompatibleOutgoing(const NBEdge* incoming, SVCPermissions vehPerm, EdgeVector::const_iterator start, bool clockwise) const;
851
853 void recheckVClassConnections(NBEdge* currentOutgoing);
854
856 void getReduction(const NBEdge* in, const NBEdge* out, int& inOffset, int& outOffset, int& reduction) const;
857
859 int addedLanesRight(NBEdge* out, int addedLanes) const;
860
862 bool isStraighter(const NBEdge* const incoming, const double angle, const SVCPermissions vehPerm, const int modeLanes, const NBEdge* const candidate) const;
863
864private:
867
870
873
876
878 std::vector<std::unique_ptr<Crossing> > myCrossings;
879
881 std::vector<WalkingArea> myWalkingAreas;
882
884 std::vector<WalkingAreaCustomShape> myWalkingAreaCustomShapes;
885
888
891
894
897
900
903
905 std::set<NBTrafficLightDefinition*> myTrafficLights;
906
908 double myRadius;
909
912
915
918
920 std::string myName;
921
924
927
930
931 /* @brief whether this junction is a bent priority junction (main direction turns)
932 * @note see NBEdgePriorityComputer
933 */
935
938
939private:
941 NBNode(const NBNode& s);
942
945};
#define DEG2RAD(x)
Definition: GeomHelper.h:35
std::map< NBConnection, NBConnectionVector > NBConnectionProhibits
Definition of a container for connection block dependencies Includes a list of all connections which ...
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:42
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
FringeType
classifying boundary nodes
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
RightOfWay
algorithms for computing right of way
const double INVALID_DOUBLE
Definition: StdDefs.h:60
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:30
A container for districts.
A class representing a single district.
Definition: NBDistrict.h:62
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:59
The representation of a single edge during network building.
Definition: NBEdge.h:92
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:545
Computes lane-2-lane connections.
Definition: NBNode.h:85
ApproachingDivider & operator=(const ApproachingDivider &)=delete
Invalidated assignment operator.
bool myIsBikeEdge
whether the outgoing edge is exclusively used by bikes
Definition: NBNode.h:118
ApproachingDivider(const EdgeVector &approaching, NBEdge *currentOutgoing)
Constructor.
Definition: NBNode.cpp:96
~ApproachingDivider()
Destructor.
Definition: NBNode.cpp:128
const EdgeVector & myApproaching
The list of edges that approach the current edge.
Definition: NBNode.h:109
int numAvailableLanes() const
@ get number of available lanes
Definition: NBNode.h:97
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:165
NBEdge * myCurrentOutgoing
The approached current edge.
Definition: NBNode.h:112
void execute(const int src, const int dest)
the bresenham-callback
Definition: NBNode.cpp:132
std::vector< int > myAvailableLanes
The available lanes to which connections shall be built.
Definition: NBNode.h:115
A definition of a pedestrian crossing.
Definition: NBNode.h:129
Crossing(const NBNode *_node, const EdgeVector &_edges, double _width, bool _priority, int _customTLIndex, int _customTLIndex2, const PositionVector &_customShape)
constructor
Definition: NBNode.cpp:237
const NBNode * node
The parent node of this crossing.
Definition: NBNode.h:134
int tlLinkIndex
the traffic light index of this crossing (if controlled)
Definition: NBNode.h:154
std::string tlID
The id of the traffic light that controls this connection.
Definition: NBNode.h:160
PositionVector customShape
optional customShape for this crossing
Definition: NBNode.h:152
std::string id
the (edge)-id of this crossing
Definition: NBNode.h:144
std::string prevWalkingArea
the lane-id of the previous walkingArea
Definition: NBNode.h:146
std::string nextWalkingArea
the lane-id of the next walkingArea
Definition: NBNode.h:148
PositionVector shape
The crossing's shape.
Definition: NBNode.h:138
int customTLIndex
the custom traffic light index of this crossing (if controlled)
Definition: NBNode.h:157
int customTLIndex2
Definition: NBNode.h:158
bool priority
whether the pedestrians have priority
Definition: NBNode.h:150
int tlLinkIndex2
Definition: NBNode.h:155
EdgeVector edges
The edges being crossed.
Definition: NBNode.h:136
double width
This crossing's width.
Definition: NBNode.h:142
bool valid
whether this crossing is valid (and can be written to the net.xml). This is needed for netedit becaus...
Definition: NBNode.h:162
double customWidth
This crossing's width.
Definition: NBNode.h:140
Sorts outgoing before incoming edges.
Definition: NBNode.h:774
NBNode * myNode
The node to compute the relative angle of.
Definition: NBNode.h:787
int operator()(NBEdge *e1, NBEdge *e2) const
operator of selection
Definition: NBNode.h:780
edge_by_direction_sorter(NBNode *n)
constructor
Definition: NBNode.h:777
Used for sorting the cells by the begin time they describe.
Definition: NBNode.h:760
nodes_by_id_sorter()
Constructor.
Definition: NBNode.h:763
int operator()(NBNode *n1, NBNode *n2) const
Comparing operator.
Definition: NBNode.h:766
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:58
Represents a single node (junction) during network building.
Definition: NBNode.h:66
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
get link state
Definition: NBNode.cpp:2294
void addIncomingEdge(NBEdge *edge)
adds an incoming edge
Definition: NBNode.cpp:459
void invalidateOutgoingConnections(bool reallowSetting=false)
invalidate outgoing connections
Definition: NBNode.cpp:1888
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
Definition: NBNode.cpp:2229
static const int FOUR_CONTROL_POINTS
Definition: NBNode.h:215
static const int AVOID_INTERSECTING_LEFT_TURNS
Definition: NBNode.h:216
bool hasIncoming(const NBEdge *const e) const
Returns whether the given edge ends at this node.
Definition: NBNode.cpp:1746
void addWalkingAreaShape(EdgeVector edges, const PositionVector &shape, double width)
add custom shape for walkingArea
Definition: NBNode.cpp:3458
void avoidOverlap()
fix overlap
Definition: NBNode.cpp:3674
void removeEdge(NBEdge *edge, bool removeFromConnections=true)
Removes edge from this node and optionally removes connections as well.
Definition: NBNode.cpp:1819
std::vector< WalkingAreaCustomShape > myWalkingAreaCustomShapes
Vector of custom walking areas shapes.
Definition: NBNode.h:884
double getDisplacementError() const
compute the displacement error during s-curve computation
Definition: NBNode.h:620
RightOfWay getRightOfWay() const
Returns hint on how to compute right of way.
Definition: NBNode.h:290
Position getCenter() const
Returns a position that is guaranteed to lie within the node shape.
Definition: NBNode.cpp:3634
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:1896
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:326
void removeCrossing(const EdgeVector &edges)
remove a pedestrian crossing from this node (identified by its edges)
Definition: NBNode.cpp:3536
NBEdge * getNextCompatibleOutgoing(const NBEdge *incoming, SVCPermissions vehPerm, EdgeVector::const_iterator start, bool clockwise) const
Definition: NBNode.cpp:2167
bool isSimpleContinuation(bool checkLaneNumbers=true, bool checkWidth=false) const
check if node is a simple continuation
Definition: NBNode.cpp:479
int getConnectionIndex(const NBEdge *from, const NBEdge::Connection &con) const
return the index of the given connection
Definition: NBNode.cpp:3619
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
Definition: NBNode.cpp:307
int numNormalConnections() const
return the number of lane-to-lane connections at this junction (excluding crossings)
Definition: NBNode.cpp:3604
bool setCrossingTLIndices(const std::string &tlID, int startIndex)
Definition: NBNode.cpp:3588
static const double UNSPECIFIED_RADIUS
unspecified lane width
Definition: NBNode.h:210
Crossing * getCrossing(const std::string &id) const
return the crossing with the given id
Definition: NBNode.cpp:3550
NBNode(const std::string &id, const Position &position, SumoXMLNodeType type)
Constructor.
Definition: NBNode.cpp:256
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:2718
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:875
void recheckVClassConnections(NBEdge *currentOutgoing)
ensure connectivity for all vClasses
Definition: NBNode.cpp:1405
FringeType getFringeType() const
Returns fringe type.
Definition: NBNode.h:295
void buildCrossingsAndWalkingAreas()
build crossings, and walkingareas. Also removes invalid loaded crossings if wished
Definition: NBNode.cpp:2729
std::string myName
The intersection name (or whatever arbitrary string you wish to attach)
Definition: NBNode.h:920
static const int BACKWARD
Definition: NBNode.h:207
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:3697
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:275
void computeLogic2(bool checkLaneFoes)
compute right-of-way logic for all lane-to-lane connections
Definition: NBNode.cpp:993
void setRightOfWay(RightOfWay rightOfWay)
set method for computing right-of-way
Definition: NBNode.h:545
bool myTypeWasGuessed
whether the node type was guessed rather than loaded
Definition: NBNode.h:937
void setCustomShape(const PositionVector &shape)
set the junction shape
Definition: NBNode.cpp:2453
void computeNodeShape(double mismatchThreshold)
Compute the junction shape for this node.
Definition: NBNode.cpp:1077
void buildWalkingAreas(int cornerDetail, double joinMinDist)
build pedestrian walking areas and set connections from/to walkingAreas
Definition: NBNode.cpp:2961
void remapRemoved(NBTrafficLightLogicCont &tc, NBEdge *removed, const EdgeVector &incoming, const EdgeVector &outgoing)
remap removed
Definition: NBNode.cpp:2086
int buildCrossings()
build pedestrian crossings
Definition: NBNode.cpp:2835
SumoXMLNodeType myType
The type of the junction.
Definition: NBNode.h:887
EdgeVector myOutgoingEdges
Vector of outgoing edges.
Definition: NBNode.h:872
bool myKeepClear
whether the junction area must be kept clear
Definition: NBNode.h:911
static bool isTrafficLight(SumoXMLNodeType type)
return whether the given type is a traffic light
Definition: NBNode.cpp:3689
void discardWalkingareas()
discard previously built walkingareas (required for repeated computation by netedit)
Definition: NBNode.cpp:2805
void computeLogic(const NBEdgeCont &ec)
computes the node's type, logic and traffic light
Definition: NBNode.cpp:954
void invalidateIncomingConnections(bool reallowSetting=false)
invalidate incoming connections
Definition: NBNode.cpp:1880
NBRequest * myRequest
Node requests.
Definition: NBNode.h:902
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
Definition: NBNode.h:258
void mirrorX()
mirror coordinates along the x-axis
Definition: NBNode.cpp:346
std::vector< std::pair< Position, std::string > > getEndPoints() const
return list of unique endpoint coordinates of all edges at this node
Definition: NBNode.cpp:3792
static bool rightTurnConflict(const NBEdge *from, const NBEdge *to, int fromLane, const NBEdge *prohibitorFrom, const NBEdge *prohibitorTo, int prohibitorFromLane)
return whether the given laneToLane connection is a right turn which must yield to a bicycle crossing...
Definition: NBNode.cpp:1933
std::vector< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
get edges to join
Definition: NBNode.cpp:2411
void setKeepClear(bool keepClear)
set the keepClear flag
Definition: NBNode.h:540
bool myHaveCustomPoly
whether this nodes shape was set by the user
Definition: NBNode.h:899
Position getEmptyDir() const
Returns something like the most unused direction Should only be used to add source or sink nodes.
Definition: NBNode.cpp:1855
PositionVector indirectLeftShape(const PositionVector &begShape, const PositionVector &endShape, int numPoints) const
compute shape of indirect left turn
Definition: NBNode.cpp:708
const std::vector< std::unique_ptr< Crossing > > & getCrossingsIncludingInvalid() const
Definition: NBNode.h:714
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:3524
static const int AVOID_WIDE_RIGHT_TURN
flags for controlling shape generation
Definition: NBNode.h:213
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
Definition: NBNode.h:263
int myCrossingsLoadedFromSumoNet
number of crossings loaded from a sumo net
Definition: NBNode.h:926
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:2069
bool alreadyConnectedPaths(const NBEdge *e1, const NBEdge *e2, double dist) const
return true if the given pedestrian paths are connected at another junction within dist
Definition: NBNode.cpp:3413
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:1914
bool hasConflict() const
whether there are conflicting streams of traffic at this node
Definition: NBNode.cpp:1058
void removeTrafficLights(bool setAsPriority=false)
Removes all references to traffic lights that control this tls.
Definition: NBNode.cpp:382
void replaceInConnectionProhibitions(NBEdge *which, NBEdge *by, int whichLaneOff, int byLaneOff)
replace incoming connections prohibitions
Definition: NBNode.cpp:1673
bool mergeConflictYields(const NBEdge *from, int fromLane, int fromLaneFoe, NBEdge *to, int toLane) const
whether one of multple connections from the same edge targeting the same lane must yield
Definition: NBNode.cpp:1984
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:1604
void getReduction(const NBEdge *in, const NBEdge *out, int &inOffset, int &outOffset, int &reduction) const
get the reduction in driving lanes at this junction
Definition: NBNode.cpp:1510
EdgeVector myAllEdges
Vector of incoming and outgoing edges.
Definition: NBNode.h:875
void computeKeepClear()
compute keepClear status for all connections
Definition: NBNode.cpp:1000
int numCrossingsFromSumoNet() const
get num of crossings from sumo net
Definition: NBNode.h:708
void sortEdges(bool useNodeShape)
sort all edge containers for this node
Definition: NBNode.cpp:3708
RightOfWay myRightOfWay
how to compute right of way for this node
Definition: NBNode.h:914
bool myIsBentPriority
Definition: NBNode.h:934
std::set< NBTrafficLightDefinition * > myTrafficLights
traffic lights of node
Definition: NBNode.h:905
double myRadius
the turning radius (for all corners) at this node in m.
Definition: NBNode.h:908
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:3379
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:514
bool hasCustomShape() const
return whether the shape was set by the user
Definition: NBNode.h:560
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:2050
int removeSelfLoops(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tc)
Removes edges which are both incoming and outgoing into this node.
Definition: NBNode.cpp:426
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
Definition: NBNode.cpp:2701
void setRoundabout()
update the type of this node as a roundabout
Definition: NBNode.cpp:3507
bool mergeConflict(const NBEdge *from, const NBEdge::Connection &con, const NBEdge *prohibitorFrom, const NBEdge::Connection &prohibitorCon, bool foes) const
whether multple connections from the same edge target the same lane
Definition: NBNode.cpp:1995
bool myDiscardAllCrossings
whether to discard all pedestrian crossings
Definition: NBNode.h:923
void invalidateTLS(NBTrafficLightLogicCont &tlCont, bool removedConnections, bool addedConnections)
causes the traffic light to be computed anew
Definition: NBNode.cpp:395
bool brakeForCrossingOnExit(const NBEdge *to) const
whether a connection to the given edge must brake for a crossing when leaving the intersection
Definition: NBNode.cpp:1919
std::vector< Crossing * > getCrossings() const
return this junctions pedestrian crossings
Definition: NBNode.cpp:2777
void addSortedLinkFoes(const NBConnection &mayDrive, const NBConnection &mustStop)
add shorted link FOES
Definition: NBNode.cpp:1776
Position myPosition
The position the node lies at.
Definition: NBNode.h:866
bool isBentPriority() const
return whether a priority road turns at this node
Definition: NBNode.h:803
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:1640
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:2004
const std::string & getName() const
Returns intersection name.
Definition: NBNode.h:300
void discardAllCrossings(bool rejectAll)
discard all current (and optionally future) crossings
Definition: NBNode.cpp:2795
bool hasOutgoing(const NBEdge *const e) const
Returns whether the given edge starts at this node.
Definition: NBNode.cpp:1752
bool writeLogic(OutputDevice &into) const
writes the XML-representation of the logic as a bitset-logic XML representation
Definition: NBNode.cpp:1029
void setRadius(double radius)
set the turning radius
Definition: NBNode.h:535
NBEdge * getPossiblySplittedOutgoing(const std::string &edgeid)
get possibly splitted outgoing edge
Definition: NBNode.cpp:1806
NBNode(const NBNode &s)
invalidated copy constructor
void addOutgoingEdge(NBEdge *edge)
adds an outgoing edge
Definition: NBNode.cpp:469
bool isConstantWidthTransition() const
detects whether a given junction splits or merges lanes while keeping constant road width
Definition: NBNode.cpp:818
std::vector< std::unique_ptr< Crossing > > myCrossings
Vector of crossings.
Definition: NBNode.h:878
bool isStraighter(const NBEdge *const incoming, const double angle, const SVCPermissions vehPerm, const int modeLanes, const NBEdge *const candidate) const
check whether the candidate edge is more likely to be the straight continuation
Definition: NBNode.cpp:2192
void removeJoinedTrafficLights()
remove all traffic light definitions that are part of a joined tls
Definition: NBNode.cpp:939
bool crossingBetween(const NBEdge *e1, const NBEdge *e2) const
return true if the given edges are connected by a crossing
Definition: NBNode.cpp:3392
bool isDistrict() const
check if node is a district
Definition: NBNode.cpp:2493
NBDistrict * myDistrict
The district the node is the centre of.
Definition: NBNode.h:893
void computeLanes2Lanes()
computes the connections of lanes to edges
Definition: NBNode.cpp:1116
void reshiftPosition(double xoff, double yoff)
Applies an offset to the node.
Definition: NBNode.cpp:333
void setName(const std::string &name)
set intersection name
Definition: NBNode.h:555
double myDisplacementError
geometry error after computation of internal lane shapes
Definition: NBNode.h:929
static const int AVOID_WIDE_LEFT_TURN
Definition: NBNode.h:214
const Position & getPosition() const
Definition: NBNode.h:250
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
Definition: NBNode.cpp:375
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node)
Definition: NBNode.h:268
void markBentPriority(bool isBent)
mark whether a priority road turns at this node
Definition: NBNode.h:798
bool typeWasGuessed() const
return whether a priority road turns at this node
Definition: NBNode.h:808
const std::string getResponse(int linkIndex) const
get the 'response' string (right-of-way bit set) of the right-of-way logic
Definition: NBNode.cpp:1049
const NBConnectionProhibits & getProhibitions()
get prohibitions (BLocked connections)
Definition: NBNode.h:677
static bool isLongEnough(NBEdge *out, double minLength)
check if is long enough
Definition: NBNode.cpp:1565
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:929
NBNode & operator=(const NBNode &s)
invalidated assignment operator
const PositionVector & getShape() const
retrieve the junction shape
Definition: NBNode.cpp:2447
void setPriorityJunctionPriorities()
sets the priorites in case of a priority junction
std::vector< WalkingArea > myWalkingAreas
Vector of walking areas.
Definition: NBNode.h:881
NBConnectionProhibits myBlockedConnections
The container for connection block dependencies.
Definition: NBNode.h:890
void updateSurroundingGeometry()
update geometry of node and surrounding edges
Definition: NBNode.cpp:1067
int addedLanesRight(NBEdge *out, int addedLanes) const
check whether this edge has extra lanes on the right side
Definition: NBNode.cpp:1518
FringeType myFringeType
fringe type of this node
Definition: NBNode.h:917
const std::vector< WalkingAreaCustomShape > & getWalkingAreaCustomShapes() const
Definition: NBNode.h:723
double getRadius() const
Returns the turning radius of this node.
Definition: NBNode.h:280
bool checkIsRemovable() const
check if node is removable
Definition: NBNode.cpp:2328
bool isRoundabout() const
return whether this node is part of a roundabout
Definition: NBNode.cpp:3514
static const int FORWARD
edge directions (for pedestrian related stuff)
Definition: NBNode.h:206
bool checkIsRemovableReporting(std::string &reason) const
check if node is removable and return reason if not
Definition: NBNode.cpp:2334
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:826
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:2079
const std::vector< WalkingArea > & getWalkingAreas() const
return this junctions pedestrian walking areas
Definition: NBNode.h:719
void removeDoubleEdges()
remove duble edges
Definition: NBNode.cpp:1708
double buildInnerEdges()
build internal lanes, pedestrian crossings and walking areas
Definition: NBNode.cpp:2811
PositionVector myPoly
the (outer) shape of the junction
Definition: NBNode.h:896
NBEdge * getConnectionTo(NBNode *n) const
get connection to certain node
Definition: NBNode.cpp:2465
bool crossesFringe(const NBEdge *e1, const NBEdge *e2) const
return true if the given sidewalks are separated by a fringe road
Definition: NBNode.cpp:3434
void getEdgesThatApproach(NBEdge *currentOutgoing, EdgeVector &approaching)
returns a list of edges which are connected to the given outgoing edge
Definition: NBNode.cpp:1582
void setFringeType(FringeType fringeType)
set method for computing right-of-way
Definition: NBNode.h:550
EdgeVector getEdgesSortedByAngleAtNodeCenter() const
returns the list of all edges sorted clockwise by getAngleAtNodeToCenter
Definition: NBNode.cpp:3651
EdgeVector edgesBetween(const NBEdge *e1, const NBEdge *e2) const
return all edges that lie clockwise between the given edges
Definition: NBNode.cpp:3442
PositionVector computeInternalLaneShape(const NBEdge *fromE, const NBEdge::Connection &con, int numPoints, NBNode *recordError=0, int shapeFlag=0) const
Compute the shape for an internal lane.
Definition: NBNode.cpp:733
~NBNode()
Destructor.
Definition: NBNode.cpp:301
NBEdge * getPossiblySplittedIncoming(const std::string &edgeid)
get possibly splitted incoming edge
Definition: NBNode.cpp:1793
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:418
bool geometryLike() const
whether this is structurally similar to a geometry node
Definition: NBNode.cpp:3468
bool isNearDistrict() const
@chech if node is near district
Definition: NBNode.cpp:2476
static const int INDIRECT_LEFT
Definition: NBNode.h:218
EdgeVector myIncomingEdges
Vector of incoming edges.
Definition: NBNode.h:869
int checkCrossing(EdgeVector candidates)
Definition: NBNode.cpp:2610
WalkingArea & getWalkingArea(const std::string &id)
return the walkingArea with the given ID
Definition: NBNode.cpp:3577
void addTrafficLight(NBTrafficLightDefinition *tlDef)
Adds a traffic light to the list of traffic lights that control this node.
Definition: NBNode.cpp:365
int guessCrossings()
guess pedestrian crossings and return how many were guessed
Definition: NBNode.cpp:2499
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Definition: NBNode.h:321
bool getKeepClear() const
Returns the keepClear flag.
Definition: NBNode.h:285
static const int SCURVE_IGNORE
Definition: NBNode.h:217
const std::string getFoes(int linkIndex) const
get the 'foes' string (conflict bit set) of the right-of-way logic
Definition: NBNode.cpp:1039
NBEdge * getOppositeIncoming(NBEdge *e) const
returns the opposite incoming edge of certain edge
Definition: NBNode.cpp:1758
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:544
The base class for traffic light logic definitions.
A container for traffic light definitions and built programs.
A storage for available edgeTypes of edges.
Definition: NBTypeCont.h:52
Base class for objects which have an id.
Definition: Named.h:54
const std::string & getID() const
Returns the id.
Definition: Named.h:74
A storage for options typed value containers)
Definition: OptionsCont.h:89
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.
static const PositionVector EMPTY
empty Vector
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:201
std::set< const NBEdge *, ComparatorIdLess > edges
Definition: NBNode.h:200
A definition of a pedestrian walking area.
Definition: NBNode.h:169
int minPrevCrossingEdges
minimum number of edges crossed by incoming crossings
Definition: NBNode.h:196
std::vector< std::string > nextSidewalks
the lane-id of the next sidewalk lane or ""
Definition: NBNode.h:188
std::vector< std::string > prevSidewalks
the lane-id of the previous sidewalk lane or ""
Definition: NBNode.h:190
std::string id
the (edge)-id of this walkingArea
Definition: NBNode.h:176
WalkingArea(const std::string &_id, double _width)
constructor
Definition: NBNode.h:171
bool hasCustomShape
whether this walkingArea has a custom shape
Definition: NBNode.h:192
double width
This lane's width.
Definition: NBNode.h:178
std::vector< std::string > nextCrossings
the lane-id of the next crossing(s)
Definition: NBNode.h:184
std::vector< std::string > prevCrossings
the lane-id of the previous crossing(s)
Definition: NBNode.h:186
PositionVector shape
The polygonal shape.
Definition: NBNode.h:182
double length
This lane's width.
Definition: NBNode.h:180
int minNextCrossingEdges
minimum number of edges crossed by nextCrossings
Definition: NBNode.h:194