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. | |
bool | isDivided (const NBEdge *e, std::set< NBEdge * > same, const PositionVector &ccw, const PositionVector &cw) const |
void | joinSameDirectionEdges (const EdgeVector &edges, std::map< NBEdge *, std::set< NBEdge * > > &same, bool useEndpoints) |
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 | divisionWidth (const NBEdge *e, std::set< NBEdge * > same, const Position &p, const Position &p2) |
compute the width of the divider space for divided roads | |
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 65 of file NBNodeShapeComputer.cpp.
|
private |
Definition at line 778 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(), NBEdge::hasDefaultGeometryEndpointAtNode(), 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 538 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 69 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 659 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 124 of file NBNodeShapeComputer.cpp.
References Position::add(), PositionVector::angleAt2D(), GeomHelper::angleDiff(), PositionVector::append(), closestIntersection(), computeEdgeBoundaries(), computeUniqueDirectionList(), DEBUGCOND, DEG2RAD, divisionWidth(), 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::getType(), NBNode::hasIncoming(), initNeighbors(), PositionVector::intersects(), PositionVector::intersectsAtLengths2D(), isDivided(), isRailway(), NBNode::isRoundabout(), OptionsCont::isSet(), joinNamedToStringSorting(), joinSameDirectionEdges(), PositionVector::length2D(), MAX2(), Position::mul(), myNode, myRadius, needsLargeTurn(), PositionVector::positionAtOffset2D(), PositionVector::push_back_noDoublePos(), PositionVector::push_front_noDoublePos(), RAD2DEG, RAIL_CROSSING, 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 951 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 101 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 835 of file NBNodeShapeComputer.cpp.
References computeSameEnd(), DEBUGCOND, and joinNamedToStringSorting().
Referenced by computeNodeShapeDefault().
|
staticprivate |
compute the width of the divider space for divided roads
Definition at line 1141 of file NBNodeShapeComputer.cpp.
References Position::distanceTo2D(), NBEdge::getTotalWidth(), and MAX2().
Referenced by computeNodeShapeDefault().
|
private |
determine the default radius appropriate for the current junction
Definition at line 985 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 1125 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 583 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 914 of file NBNodeShapeComputer.cpp.
References M_PI.
Referenced by computeNodeShapeDefault().
|
private |
Definition at line 1101 of file NBNodeShapeComputer.cpp.
References PositionVector::distances(), NBEdge::getEndpointAtNode(), NBEdge::getTotalWidth(), VectorHelper< T >::maxValue(), and myNode.
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 697 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 550 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 169 of file NBNodeShapeComputer.h.
Referenced by badIntersection(), computeEdgeBoundaries(), computeNodeShapeDefault(), computeSameEnd(), joinSameDirectionEdges(), and NBNodeShapeComputer().
|
private |
The node to compute the geometry for.
Definition at line 163 of file NBNodeShapeComputer.h.
Referenced by badIntersection(), compute(), computeEdgeBoundaries(), computeNodeShapeDefault(), computeNodeShapeSmall(), getDefaultRadius(), getSmoothCorner(), isDivided(), and joinSameDirectionEdges().
|
private |
the computed node radius
Definition at line 166 of file NBNodeShapeComputer.h.
Referenced by computeNodeShapeDefault(), and getRadius().
|
staticprivate |
Definition at line 171 of file NBNodeShapeComputer.h.
Referenced by getDefaultRadius(), and needsLargeTurn().