SUMO - Simulation of Urban MObility
|
This class computes shapes of junctions. More...
#include <NBNodeShapeComputer.h>
Public Member Functions | |
PositionVector | compute (bool leftHand) |
Computes the shape of the assigned junction. | |
NBNodeShapeComputer (const NBNode &node) | |
Constructor. | |
~NBNodeShapeComputer () | |
Destructor. | |
Private Member Functions | |
PositionVector | computeContinuationNodeShape (bool simpleContinuation) |
PositionVector | computeNodeShapeByCrosses () |
Computes the node geometry using normals. | |
EdgeVector | computeUniqueDirectionList (const std::map< NBEdge *, EdgeVector > &same, std::map< NBEdge *, PositionVector > &geomsCCW, std::map< NBEdge *, PositionVector > &geomsCW, std::map< NBEdge *, NBEdge * > &ccwBoundary, std::map< NBEdge *, NBEdge * > &cwBoundary) |
Joins edges and computes ccw/cw boundaries. | |
void | joinSameDirectionEdges (std::map< NBEdge *, EdgeVector > &same, std::map< NBEdge *, PositionVector > &geomsCCW, std::map< NBEdge *, PositionVector > &geomsCW) |
Joins edges and computes ccw/cw boundaries. | |
void | replaceFirstChecking (PositionVector &g, bool decenter, PositionVector counter, size_t counterLanes, SUMOReal counterDist, int laneDiff) |
void | replaceLastChecking (PositionVector &g, bool decenter, PositionVector counter, size_t counterLanes, SUMOReal counterDist, int laneDiff) |
Private Attributes | |
const NBNode & | myNode |
The node to compute the geometry for. |
This class computes shapes of junctions.
Definition at line 52 of file NBNodeShapeComputer.h.
NBNodeShapeComputer::NBNodeShapeComputer | ( | const NBNode & | node | ) |
Constructor.
Definition at line 52 of file NBNodeShapeComputer.cpp.
Destructor.
Definition at line 56 of file NBNodeShapeComputer.cpp.
PositionVector NBNodeShapeComputer::compute | ( | bool | leftHand | ) |
Computes the shape of the assigned junction.
Definition at line 60 of file NBNodeShapeComputer.cpp.
References computeContinuationNodeShape(), computeNodeShapeByCrosses(), NBNode::getIncomingEdges(), GeomHelper::getMinAngleDiff(), NBNode::getOutgoingEdges(), NBNode::isSimpleContinuation(), MAX2(), NBNode::myAllEdges, myNode, PositionVector::size(), SUMOReal, and UNUSED_PARAMETER.
Referenced by NBNode::computeNodeShape().
PositionVector NBNodeShapeComputer::computeContinuationNodeShape | ( | bool | simpleContinuation | ) | [private] |
Definition at line 193 of file NBNodeShapeComputer.cpp.
References Position::add(), computeSameEnd(), computeUniqueDirectionList(), Line::extrapolateBy(), NBNode::hasIncoming(), NBNode::hasOutgoing(), joinSameDirectionEdges(), LANESPREAD_CENTER, PositionVector::length(), MIN2(), Position::mul(), NBNode::myAllEdges, myNode, PI, POSITION_EPS, PositionVector::positionAtLengthPosition2D(), PositionVector::push_back_noDoublePos(), PositionVector::push_front_noDoublePos(), replaceFirstChecking(), replaceLastChecking(), PositionVector::reverse(), SUMO_const_halfLaneWidth, and SUMOReal.
Referenced by compute().
PositionVector NBNodeShapeComputer::computeNodeShapeByCrosses | ( | ) | [private] |
Computes the node geometry using normals.
In the case the other method does not work, this method computes the geometry of a node by adding points to the polygon which are computed by building the normals of participating edges' geometry boundaries (cw/ccw) at the node's height (the length of the edge the edge would cross the node point).
Definition at line 710 of file NBNodeShapeComputer.cpp.
References Line::add(), Line::extrapolateBy(), NBNode::getPosition(), Line::intersects(), Line::intersectsAt(), NBNode::myAllEdges, myNode, Line::p1(), PI, PositionVector::push_back_noDoublePos(), Line::rotateAtP1(), and SUMO_const_halfLaneWidth.
Referenced by compute().
EdgeVector NBNodeShapeComputer::computeUniqueDirectionList | ( | const std::map< NBEdge *, EdgeVector > & | same, |
std::map< NBEdge *, PositionVector > & | geomsCCW, | ||
std::map< NBEdge *, PositionVector > & | geomsCW, | ||
std::map< NBEdge *, NBEdge * > & | ccwBoundary, | ||
std::map< NBEdge *, NBEdge * > & | cwBoundary | ||
) | [private] |
Joins edges and computes ccw/cw boundaries.
This methods joins edges which are in marked as being "same" in the means as given by joinSameDirectionEdges. The result (list of so-to-say "directions" is returned; additionally, the boundaries of these directions are stored in ccwBoundary/cwBoundary.
Definition at line 662 of file NBNodeShapeComputer.cpp.
References computeSameEnd(), NBNode::hasIncoming(), NBNode::myAllEdges, and myNode.
Referenced by computeContinuationNodeShape().
void NBNodeShapeComputer::joinSameDirectionEdges | ( | std::map< NBEdge *, EdgeVector > & | same, |
std::map< NBEdge *, PositionVector > & | geomsCCW, | ||
std::map< NBEdge *, PositionVector > & | geomsCW | ||
) | [private] |
Joins edges and computes ccw/cw boundaries.
This method goes through all edges and stores each edge's ccw and cw boundary in geomsCCW/geomsCW. This boundary is extrapolated by 100m at the node's position. In addition, "same" is filled so that this map contains a list of all edges within the value-vector which direction at the node differs less than 1 from the key-edge's direction.
Definition at line 607 of file NBNodeShapeComputer.cpp.
References Line::atan2DegreeAngle(), Line::extrapolateBy(), NBNode::hasIncoming(), PositionVector::lineAt(), NBNode::myAllEdges, myNode, Line::p1(), and SUMO_const_halfLaneWidth.
Referenced by computeContinuationNodeShape().
void NBNodeShapeComputer::replaceFirstChecking | ( | PositionVector & | g, |
bool | decenter, | ||
PositionVector | counter, | ||
size_t | counterLanes, | ||
SUMOReal | counterDist, | ||
int | laneDiff | ||
) | [private] |
Definition at line 165 of file NBNodeShapeComputer.cpp.
References PositionVector::extrapolate(), Line::move2side(), PositionVector::nearest_position_on_line_to_point2D(), Line::p1(), PositionVector::positionAtLengthPosition2D(), PositionVector::push_front_noDoublePos(), PositionVector::replaceAt(), SUMO_const_halfLaneAndOffset, SUMO_const_laneWidth, SUMO_const_laneWidthAndOffset, and SUMOReal.
Referenced by computeContinuationNodeShape().
void NBNodeShapeComputer::replaceLastChecking | ( | PositionVector & | g, |
bool | decenter, | ||
PositionVector | counter, | ||
size_t | counterLanes, | ||
SUMOReal | counterDist, | ||
int | laneDiff | ||
) | [private] |
Definition at line 138 of file NBNodeShapeComputer.cpp.
References PositionVector::extrapolate(), Line::move2side(), PositionVector::nearest_position_on_line_to_point2D(), Line::p2(), PositionVector::positionAtLengthPosition2D(), PositionVector::push_back_noDoublePos(), PositionVector::replaceAt(), PositionVector::size(), SUMO_const_halfLaneAndOffset, SUMO_const_laneWidth, SUMO_const_laneWidthAndOffset, and SUMOReal.
Referenced by computeContinuationNodeShape().
const NBNode& NBNodeShapeComputer::myNode [private] |
The node to compute the geometry for.
Definition at line 116 of file NBNodeShapeComputer.h.
Referenced by compute(), computeContinuationNodeShape(), computeNodeShapeByCrosses(), computeUniqueDirectionList(), and joinSameDirectionEdges().