![]() |
Eclipse SUMO - Simulation of Urban MObility
|
This class computes shapes of junctions. More...
#include <NBNodeShapeComputer.h>
Public Member Functions | |
PositionVector | compute () |
Computes the shape of the assigned junction. More... | |
double | getRadius () const |
get computed radius for node More... | |
NBNodeShapeComputer (const NBNode &node) | |
Constructor. More... | |
~NBNodeShapeComputer () | |
Destructor. More... | |
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 More... | |
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. More... | |
PositionVector | computeNodeShapeSmall () |
Computes the node geometry using normals. More... | |
EdgeVector | computeUniqueDirectionList (std::map< NBEdge *, std::set< NBEdge * > > &same, GeomsMap &geomsCCW, GeomsMap &geomsCW) |
Joins edges and computes ccw/cw boundaries. More... | |
double | getDefaultRadius (const OptionsCont &oc) |
determine the default radius appropriate for the current junction More... | |
PositionVector | getSmoothCorner (PositionVector begShape, PositionVector endShape, const Position &begPoint, const Position &endPoint, int cornerDetail) |
Compute smoothed corner shape. More... | |
void | joinSameDirectionEdges (std::map< NBEdge *, std::set< NBEdge * > > &same, GeomsMap &geomsCCW, GeomsMap &geomsCW) |
Joins edges and computes ccw/cw boundaries. More... | |
NBNodeShapeComputer & | operator= (const NBNodeShapeComputer &s) |
Invalidated assignment operator. More... | |
Static Private Member Functions | |
static double | getExtraWidth (const NBEdge *e, SVCPermissions exclude) |
compute with of rightmost lanes that exlude the given permissions More... | |
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. More... | |
Private Attributes | |
const NBNode & | myNode |
The node to compute the geometry for. More... | |
double | myRadius |
the computed node radius More... | |
This class computes shapes of junctions.
Definition at line 44 of file NBNodeShapeComputer.h.
|
private |
Definition at line 61 of file NBNodeShapeComputer.h.
NBNodeShapeComputer::NBNodeShapeComputer | ( | const NBNode & | node | ) |
Constructor.
Definition at line 49 of file NBNodeShapeComputer.cpp.
NBNodeShapeComputer::~NBNodeShapeComputer | ( | ) |
Destructor.
Definition at line 55 of file NBNodeShapeComputer.cpp.
|
private |
Definition at line 663 of file NBNodeShapeComputer.cpp.
References DEBUGCOND, PositionVector::distance2D(), PositionVector::distances(), EXT, PositionVector::extrapolate2D(), NBEdge::getGeometry(), NBEdge::getLaneSpreadFunction(), PositionVector::getSubpart2D(), NBEdge::getToNode(), NBEdge::getTotalWidth(), PositionVector::intersectionPosition2D(), Position::INVALID, LANESPREAD_RIGHT, PositionVector::length(), VectorHelper< T >::maxValue(), MIN3(), VectorHelper< T >::minValue(), PositionVector::move2side(), myNode, POSITION_EPS, and PositionVector::reverse().
Referenced by joinSameDirectionEdges().
|
private |
return the intersection point closest to the given offset
Definition at line 469 of file NBNodeShapeComputer.cpp.
References PositionVector::intersectsAtLengths2D().
Referenced by computeNodeShapeDefault().
PositionVector NBNodeShapeComputer::compute | ( | ) |
Computes the shape of the assigned junction.
Definition at line 59 of file NBNodeShapeComputer.cpp.
References computeNodeShapeDefault(), computeNodeShapeSmall(), DEBUGCOND, NBNode::getIncomingEdges(), GeomHelper::getMinAngleDiff(), NBNode::getOutgoingEdges(), NBNode::isSimpleContinuation(), MAX2(), NBNode::myAllEdges, myNode, NBEdge::setStreetName(), and toString().
Referenced by NBNode::computeNodeShape().
|
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 144 of file NBNodeShapeComputer.cpp.
References Position::add(), PositionVector::append(), closestIntersection(), computeUniqueDirectionList(), DEBUGCOND, DEG2RAD, OptionsCont::exists(), EXT, OptionsCont::getBool(), getDefaultRadius(), NBNode::getDisplacementError(), OptionsCont::getFloat(), Named::getID(), OptionsCont::getInt(), OptionsCont::getOptions(), NBNode::getPosition(), NBNode::getRadius(), getSmoothCorner(), NBNode::hasIncoming(), initNeighbors(), PositionVector::intersects(), PositionVector::intersectsAtLengths2D(), OptionsCont::isSet(), joinSameDirectionEdges(), PositionVector::length2D(), MAX2(), Position::mul(), NBNode::myAllEdges, myNode, myRadius, NUMERICAL_EPS, PositionVector::positionAtOffset2D(), PositionVector::push_back_noDoublePos(), PositionVector::push_front_noDoublePos(), RAD2DEG, NBHelpers::relAngle(), Position::setz(), SUMO_const_laneWidth, NBNode::UNSPECIFIED_RADIUS, WRITE_WARNING, 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 824 of file NBNodeShapeComputer.cpp.
References DEBUGCOND, PositionVector::extrapolate2D(), Named::getID(), NBNode::getPosition(), PositionVector::getSubpartByIndex(), PositionVector::intersectionPosition2D(), PositionVector::intersects(), NBNode::myAllEdges, myNode, PositionVector::push_back_noDoublePos(), Position::set(), Position::x(), Position::y(), and Position::z().
Referenced by compute().
|
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 708 of file NBNodeShapeComputer.cpp.
References computeSameEnd(), DEBUGCOND, joinNamedToStringSorting(), NBNode::myAllEdges, and myNode.
Referenced by computeNodeShapeDefault().
|
private |
determine the default radius appropriate for the current junction
Definition at line 859 of file NBNodeShapeComputer.cpp.
References GeomHelper::angleDiff(), DEBUGCOND, DEG2RAD, NBNode::getDirection(), NBNode::getEdges(), getExtraWidth(), OptionsCont::getFloat(), Named::getID(), NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), NBNode::isConstantWidthTransition(), LINKDIR_TURN, M_PI, MAX2(), MIN2(), myNode, NBContHelper::nextCW(), RAD2DEG, SVC_BICYCLE, SVC_DELIVERY, SVC_PEDESTRIAN, SVC_RAIL_CLASSES, and SVCAll.
Referenced by computeNodeShapeDefault().
|
staticprivate |
compute with of rightmost lanes that exlude the given permissions
Definition at line 952 of file NBNodeShapeComputer.cpp.
References NBEdge::getLaneWidth(), and NBEdge::getPermissions().
Referenced by getDefaultRadius().
|
inline |
get computed radius for node
Definition at line 56 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 482 of file NBNodeShapeComputer.cpp.
References PositionVector::angleAt2D(), GeomHelper::angleDiff(), NBNode::AVOID_WIDE_LEFT_TURN, NBNode::computeSmoothShape(), DEBUGCOND, DEG2RAD, Position::distanceTo2D(), NBNode::getPosition(), PositionVector::interpolateZ(), PositionVector::length2D(), MAX2(), myNode, PositionVector::nearest_offset_to_point2D(), NUMERICAL_EPS, POSITION_EPS, 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 787 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 558 of file NBNodeShapeComputer.cpp.
References PositionVector::angleAt2D(), GeomHelper::angleDiff(), badIntersection(), DEBUGCOND, DEG2RAD, EXT, PositionVector::extrapolate2D(), NBEdge::getCCWBoundaryLine(), NBEdge::getCWBoundaryLine(), NBEdge::getGeometry(), Named::getID(), NBNode::myAllEdges, myNode, NUMERICAL_EPS, and WRITE_WARNING.
Referenced by computeNodeShapeDefault().
|
private |
Invalidated assignment operator.
|
private |
The node to compute the geometry for.
Definition at line 152 of file NBNodeShapeComputer.h.
Referenced by badIntersection(), compute(), computeNodeShapeDefault(), computeNodeShapeSmall(), computeUniqueDirectionList(), getDefaultRadius(), getSmoothCorner(), and joinSameDirectionEdges().
|
private |
the computed node radius
Definition at line 155 of file NBNodeShapeComputer.h.
Referenced by computeNodeShapeDefault(), and getRadius().