![]() |
Eclipse SUMO - Simulation of Urban MObility
|
This class computes shapes of junctions. More...
#include <NBNodeShapeComputer.h>
Public Member Functions | |
const PositionVector | compute (bool forceSmall) |
Computes the shape of the assigned junction. | |
double | getRadius () const |
get computed radius for node | |
NBNodeShapeComputer (const NBNode &node) | |
Constructor. | |
~NBNodeShapeComputer () | |
Destructor. | |
Private Types | |
typedef std::map< NBEdge *, PositionVector > | GeomsMap |
Private Member Functions | |
bool | badIntersection (const NBEdge *e1, const NBEdge *e2, double distance) |
double | closestIntersection (const PositionVector &geom1, const PositionVector &geom2, double offset) |
return the intersection point closest to the given offset | |
void | computeEdgeBoundaries (const EdgeVector &edges, GeomsMap &geomsCCW, GeomsMap &geomsCW) |
compute clockwise/counter-clockwise edge boundaries | |
const PositionVector | computeNodeShapeDefault (bool simpleContinuation) |
Computes the node geometry Edges with the same direction are grouped. Then the node geometry is built from intersection between the borders of adjacent edge groups. | |
const PositionVector | computeNodeShapeSmall () |
Computes the node geometry using normals. | |
void | computeSameEnd (PositionVector &l1, PositionVector &l2) |
EdgeVector | computeUniqueDirectionList (const EdgeVector &all, std::map< NBEdge *, std::set< NBEdge * > > &same, GeomsMap &geomsCCW, GeomsMap &geomsCW) |
Joins edges. | |
double | getDefaultRadius (const OptionsCont &oc) |
determine the default radius appropriate for the current junction | |
PositionVector | getSmoothCorner (PositionVector begShape, PositionVector endShape, const Position &begPoint, const Position &endPoint, int cornerDetail) |
Compute smoothed corner shape. | |
void | joinSameDirectionEdges (const EdgeVector &edges, std::map< NBEdge *, std::set< NBEdge * > > &same) |
Joins edges and computes ccw/cw boundaries. | |
bool | needsLargeTurn (NBEdge *e1, NBEdge *e2, std::map< NBEdge *, std::set< NBEdge * > > &same) const |
whether the given edges (along with those in the same direction) requires a large turning radius | |
NBNodeShapeComputer & | operator= (const NBNodeShapeComputer &s) |
Invalidated assignment operator. | |
Static Private Member Functions | |
static double | getExtraWidth (const NBEdge *e, SVCPermissions exclude) |
compute with of rightmost lanes that exlude the given permissions | |
static void | initNeighbors (const EdgeVector &edges, const EdgeVector::const_iterator ¤t, GeomsMap &geomsCW, GeomsMap &geomsCCW, EdgeVector::const_iterator &cwi, EdgeVector::const_iterator &ccwi, double &cad, double &ccad) |
Initialize neighbors and angles. | |
Private Attributes | |
double | EXT |
the maximum distance to search for a place where neighboring edges intersect and do not overlap | |
const NBNode & | myNode |
The node to compute the geometry for. | |
double | myRadius |
the computed node radius | |
Static Private Attributes | |
static const SVCPermissions | SVC_LARGE_TURN |
This class computes shapes of junctions.
Definition at line 42 of file NBNodeShapeComputer.h.
|
private |
Definition at line 59 of file NBNodeShapeComputer.h.
NBNodeShapeComputer::NBNodeShapeComputer | ( | const NBNode & | node | ) |
Constructor.
Definition at line 54 of file NBNodeShapeComputer.cpp.
References EXT, NBNode::getEdges(), and NBNodeTypeComputer::isRailwayNode().
NBNodeShapeComputer::~NBNodeShapeComputer | ( | ) |
Destructor.
Definition at line 66 of file NBNodeShapeComputer.cpp.
|
private |
Definition at line 720 of file NBNodeShapeComputer.cpp.
References PositionVector::angleAt2D(), GeomHelper::angleDiff(), DEBUGCOND, PositionVector::distance2D(), PositionVector::distances(), EXT, PositionVector::extrapolate2D(), NBEdge::getGeometry(), NBEdge::getLaneSpreadFunction(), PositionVector::getSubpart2D(), NBEdge::getToNode(), NBEdge::getTotalWidth(), PositionVector::intersectionPosition2D(), Position::INVALID, PositionVector::length(), VectorHelper< T >::maxValue(), MIN3(), VectorHelper< T >::minValue(), PositionVector::move2side(), myNode, RAD2DEG, PositionVector::reverse(), RIGHT, and toString().
Referenced by joinSameDirectionEdges().
|
private |
return the intersection point closest to the given offset
Definition at line 485 of file NBNodeShapeComputer.cpp.
References PositionVector::intersectsAtLengths2D().
Referenced by computeNodeShapeDefault().
const PositionVector NBNodeShapeComputer::compute | ( | bool | forceSmall | ) |
Computes the shape of the assigned junction.
Definition at line 70 of file NBNodeShapeComputer.cpp.
References computeNodeShapeDefault(), computeNodeShapeSmall(), DEBUGCOND, NBNode::getEdges(), NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), NBNode::isSimpleContinuation(), myNode, and toString().
Referenced by NBNode::computeNodeShape().
|
private |
compute clockwise/counter-clockwise edge boundaries
Definition at line 606 of file NBNodeShapeComputer.cpp.
References EXT, EXT2, Named::getID(), MAX2(), myNode, and WRITE_WARNING.
Referenced by computeNodeShapeDefault().
|
private |
Computes the node geometry Edges with the same direction are grouped. Then the node geometry is built from intersection between the borders of adjacent edge groups.
Definition at line 125 of file NBNodeShapeComputer.cpp.
References Position::add(), PositionVector::append(), closestIntersection(), computeEdgeBoundaries(), computeUniqueDirectionList(), DEBUGCOND, DEG2RAD, OptionsCont::exists(), EXT, OptionsCont::getBool(), NBNode::getCrossings(), getDefaultRadius(), NBNode::getDisplacementError(), NBNode::getEdges(), OptionsCont::getFloat(), Named::getID(), OptionsCont::getInt(), OptionsCont::getOptions(), NBNode::getPosition(), NBNode::getRadius(), getSmoothCorner(), NBNode::hasIncoming(), initNeighbors(), PositionVector::intersects(), PositionVector::intersectsAtLengths2D(), isRailway(), OptionsCont::isSet(), joinSameDirectionEdges(), PositionVector::length2D(), MAX2(), Position::mul(), myNode, myRadius, needsLargeTurn(), PositionVector::positionAtOffset2D(), PositionVector::push_back_noDoublePos(), PositionVector::push_front_noDoublePos(), RAD2DEG, NBHelpers::relAngle(), Position::setz(), SUMO_const_laneWidth, TL, NBNode::UNSPECIFIED_RADIUS, NBEdge::UNSPECIFIED_WIDTH, WRITE_WARNINGF, and Position::z().
Referenced by compute().
|
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 889 of file NBNodeShapeComputer.cpp.
References DEBUGCOND, PositionVector::extrapolate2D(), NBNode::getEdges(), Named::getID(), NBNode::getPosition(), PositionVector::getSubpartByIndex(), PositionVector::intersectionPosition2D(), PositionVector::intersects(), myNode, PositionVector::push_back_noDoublePos(), Position::set(), Position::x(), Position::y(), and Position::z().
Referenced by compute().
|
private |
Definition at line 102 of file NBNodeShapeComputer.cpp.
References PositionVector::add(), EXT, PositionVector::extrapolate2D(), PositionVector::getSubpart2D(), PositionVector::intersects(), PositionVector::intersectsAtLengths2D(), PositionVector::length2D(), PositionVector::positionAtOffset2D(), and PositionVector::sub().
Referenced by computeUniqueDirectionList().
|
private |
Joins edges.
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;
Definition at line 773 of file NBNodeShapeComputer.cpp.
References computeSameEnd(), DEBUGCOND, and joinNamedToStringSorting().
Referenced by computeNodeShapeDefault().
|
private |
determine the default radius appropriate for the current junction
Definition at line 923 of file NBNodeShapeComputer.cpp.
References GeomHelper::angleDiff(), DEBUGCOND, DEG2RAD, NBNode::getDirection(), NBNode::getEdges(), getExtraWidth(), OptionsCont::getFloat(), Named::getID(), NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), NBNode::isConstantWidthTransition(), M_PI, MAX2(), MIN2(), myNode, NBContHelper::nextCW(), RAD2DEG, SVC_LARGE_TURN, and TURN.
Referenced by computeNodeShapeDefault().
|
staticprivate |
compute with of rightmost lanes that exlude the given permissions
Definition at line 1039 of file NBNodeShapeComputer.cpp.
References NBEdge::getLaneWidth(), and NBEdge::getPermissions().
Referenced by getDefaultRadius().
|
inline |
get computed radius for node
Definition at line 54 of file NBNodeShapeComputer.h.
References myRadius.
Referenced by NBNode::computeNodeShape().
|
private |
Compute smoothed corner shape.
[in] | begShape | |
[in] | endShape | |
[in] | begPoint | |
[in] | endPoint | |
[in] | cornerDetail |
Definition at line 530 of file NBNodeShapeComputer.cpp.
References PositionVector::angleAt2D(), GeomHelper::angleDiff(), NBNode::AVOID_WIDE_LEFT_TURN, NBNode::computeSmoothShape(), DEBUGCOND, DEG2RAD, Position::distanceTo2D(), EXT2, NBNode::getPosition(), PositionVector::getSubpart(), PositionVector::getSubpart2D(), PositionVector::interpolateZ(), PositionVector::length(), PositionVector::length2D(), MAX2(), myNode, PositionVector::nearest_offset_to_point2D(), RAD2DEG, PositionVector::reverse(), PositionVector::splitAt(), and Position::z().
Referenced by computeNodeShapeDefault().
|
staticprivate |
Initialize neighbors and angles.
[in] | edges | The list of edges sorted in clockwise direction |
[in] | current | An iterator to the current edge |
[in] | geomsCW | geometry map |
[in] | geomsCCW | geometry map |
[out] | cwi | An iterator to the clockwise neighbor |
[out] | ccwi | An iterator to the counter-clockwise neighbor |
[out] | cad | The angle difference to the clockwise neighbor |
[out] | ccad | The angle difference to the counter-clockwise neighbor |
Definition at line 852 of file NBNodeShapeComputer.cpp.
References M_PI.
Referenced by computeNodeShapeDefault().
|
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 644 of file NBNodeShapeComputer.cpp.
References PositionVector::angleAt2D(), GeomHelper::angleDiff(), badIntersection(), DEBUGCOND, DEG2RAD, OptionsCont::exists(), EXT, OptionsCont::getOptions(), OptionsCont::isSet(), and myNode.
Referenced by computeNodeShapeDefault().
|
private |
whether the given edges (along with those in the same direction) requires a large turning radius
Definition at line 497 of file NBNodeShapeComputer.cpp.
References NBEdge::getFromNode(), NBEdge::getPermissions(), NBEdge::getToNode(), and SVC_LARGE_TURN.
Referenced by computeNodeShapeDefault().
|
private |
Invalidated assignment operator.
|
private |
the maximum distance to search for a place where neighboring edges intersect and do not overlap
Definition at line 164 of file NBNodeShapeComputer.h.
Referenced by badIntersection(), computeEdgeBoundaries(), computeNodeShapeDefault(), computeSameEnd(), joinSameDirectionEdges(), and NBNodeShapeComputer().
|
private |
The node to compute the geometry for.
Definition at line 158 of file NBNodeShapeComputer.h.
Referenced by badIntersection(), compute(), computeEdgeBoundaries(), computeNodeShapeDefault(), computeNodeShapeSmall(), getDefaultRadius(), getSmoothCorner(), and joinSameDirectionEdges().
|
private |
the computed node radius
Definition at line 161 of file NBNodeShapeComputer.h.
Referenced by computeNodeShapeDefault(), and getRadius().
|
staticprivate |
Definition at line 166 of file NBNodeShapeComputer.h.
Referenced by getDefaultRadius(), and needsLargeTurn().