![]() |
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... | |
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, const PositionVector &e1cw, const PositionVector &e2ccw, 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... | |
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 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... | |
This class computes shapes of junctions.
Definition at line 52 of file NBNodeShapeComputer.h.
|
private |
Definition at line 64 of file NBNodeShapeComputer.h.
NBNodeShapeComputer::NBNodeShapeComputer | ( | const NBNode & | node | ) |
Constructor.
Definition at line 52 of file NBNodeShapeComputer.cpp.
NBNodeShapeComputer::~NBNodeShapeComputer | ( | ) |
Destructor.
Definition at line 56 of file NBNodeShapeComputer.cpp.
|
private |
Definition at line 592 of file NBNodeShapeComputer.cpp.
References PositionVector::distances(), NBEdge::getGeometry(), NBEdge::getLaneSpreadFunction(), PositionVector::getSubpart2D(), NBEdge::getToNode(), NBEdge::getTotalWidth(), PositionVector::intersects(), 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 459 of file NBNodeShapeComputer.cpp.
References PositionVector::intersectsAtLengths2D().
Referenced by computeNodeShapeDefault().
PositionVector NBNodeShapeComputer::compute | ( | ) |
Computes the shape of the assigned junction.
Definition at line 60 of file NBNodeShapeComputer.cpp.
References computeNodeShapeDefault(), computeNodeShapeSmall(), NBNode::getIncomingEdges(), GeomHelper::getMinAngleDiff(), NBNode::getOutgoingEdges(), NBNode::isSimpleContinuation(), MAX2(), NBNode::myAllEdges, and myNode.
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 135 of file NBNodeShapeComputer.cpp.
References Position::add(), PositionVector::append(), closestIntersection(), computeUniqueDirectionList(), DEBUGCOND, DEG2RAD, OptionsCont::exists(), OptionsCont::getBool(), 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, 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 704 of file NBNodeShapeComputer.cpp.
References DEBUGCOND, PositionVector::extrapolate2D(), Named::getID(), NBNode::getPosition(), PositionVector::getSubpartByIndex(), 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 628 of file NBNodeShapeComputer.cpp.
References computeSameEnd(), NBNode::hasIncoming(), NBNode::myAllEdges, and myNode.
Referenced by computeNodeShapeDefault().
|
private |
Compute smoothed corner shape.
[in] | begShape | |
[in] | endShape | |
[in] | begPoint | |
[in] | endPoint | |
[in] | cornerDetail |
Definition at line 472 of file NBNodeShapeComputer.cpp.
References NBNode::computeSmoothShape(), myNode, and PositionVector::reverse().
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 667 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 490 of file NBNodeShapeComputer.cpp.
References PositionVector::angleAt2D(), GeomHelper::angleDiff(), badIntersection(), DEBUGCOND, DEG2RAD, NBNode::hasIncoming(), NBNode::myAllEdges, myNode, and WRITE_WARNING.
Referenced by computeNodeShapeDefault().
|
private |
Invalidated assignment operator.
|
private |
The node to compute the geometry for.
Definition at line 150 of file NBNodeShapeComputer.h.
Referenced by badIntersection(), compute(), computeNodeShapeDefault(), computeNodeShapeSmall(), computeUniqueDirectionList(), getSmoothCorner(), and joinSameDirectionEdges().