SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
NBNodeShapeComputer Class Reference

This class computes shapes of junctions. More...

#include <NBNodeShapeComputer.h>

Public Member Functions

PositionVector compute (bool leftHand)
 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, SUMOReal distance)
 
SUMOReal closestIntersection (const PositionVector &geom1, const PositionVector &geom2, SUMOReal 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, std::map< NBEdge *, NBEdge * > &ccwBoundary, std::map< NBEdge *, NBEdge * > &cwBoundary)
 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...
 
NBNodeShapeComputeroperator= (const NBNodeShapeComputer &s)
 Invalidated assignment operator. More...
 

Static Private Member Functions

static void initNeighbors (const EdgeVector &edges, const EdgeVector::const_iterator &current, GeomsMap &geomsCW, GeomsMap &geomsCCW, EdgeVector::const_iterator &cwi, EdgeVector::const_iterator &ccwi, SUMOReal &cad, SUMOReal &ccad)
 Initialize neighbors and angles. More...
 

Private Attributes

const NBNodemyNode
 The node to compute the geometry for. More...
 

Detailed Description

This class computes shapes of junctions.

Definition at line 52 of file NBNodeShapeComputer.h.

Member Typedef Documentation

Definition at line 64 of file NBNodeShapeComputer.h.

Constructor & Destructor Documentation

NBNodeShapeComputer::NBNodeShapeComputer ( const NBNode node)

Constructor.

Definition at line 54 of file NBNodeShapeComputer.cpp.

NBNodeShapeComputer::~NBNodeShapeComputer ( )

Destructor.

Definition at line 58 of file NBNodeShapeComputer.cpp.

Member Function Documentation

SUMOReal NBNodeShapeComputer::closestIntersection ( const PositionVector geom1,
const PositionVector geom2,
SUMOReal  offset 
)
private

return the intersection point closest to the given offset

Definition at line 337 of file NBNodeShapeComputer.cpp.

References PositionVector::intersectsAtLengths2D(), and SUMOReal.

Referenced by computeNodeShapeDefault().

PositionVector NBNodeShapeComputer::computeNodeShapeSmall ( )
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).

Note
This usually gives a very small node shape, appropriate for dead-ends or turn-around-only situations

Definition at line 609 of file NBNodeShapeComputer.cpp.

References Line::add(), Line::extrapolateBy2D(), NBNode::getPosition(), Line::intersects(), Line::intersectsAt(), M_PI, NBNode::myAllEdges, myNode, Line::p1(), PositionVector::push_back_noDoublePos(), Line::rotateAtP1(), Position::set(), Position::x(), Position::y(), and Position::z().

Referenced by compute().

EdgeVector NBNodeShapeComputer::computeUniqueDirectionList ( std::map< NBEdge *, std::set< NBEdge * > > &  same,
GeomsMap geomsCCW,
GeomsMap 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 511 of file NBNodeShapeComputer.cpp.

References computeSameEnd(), NBNode::hasIncoming(), NBNode::myAllEdges, and myNode.

Referenced by computeNodeShapeDefault().

PositionVector NBNodeShapeComputer::getSmoothCorner ( PositionVector  begShape,
PositionVector  endShape,
const Position begPoint,
const Position endPoint,
int  cornerDetail 
)
private

Compute smoothed corner shape.

Parameters
[in]begShape
[in]endShape
[in]begPoint
[in]endPoint
[in]cornerDetail
Returns
shape to be appended between begPoint and endPoint

Definition at line 350 of file NBNodeShapeComputer.cpp.

References NBNode::computeSmoothShape(), PositionVector::eraseAt(), myNode, and PositionVector::reverse().

Referenced by computeNodeShapeDefault().

void NBNodeShapeComputer::initNeighbors ( const EdgeVector edges,
const EdgeVector::const_iterator &  current,
GeomsMap geomsCW,
GeomsMap geomsCCW,
EdgeVector::const_iterator &  cwi,
EdgeVector::const_iterator &  ccwi,
SUMOReal cad,
SUMOReal ccad 
)
staticprivate

Initialize neighbors and angles.

Parameters
[in]edgesThe list of edges sorted in clockwise direction
[in]currentAn iterator to the current edge
[in]geomsCWgeometry map
[in]geomsCCWgeometry map
[out]cwiAn iterator to the clockwise neighbor
[out]ccwiAn iterator to the counter-clockwise neighbor
[out]cadThe angle difference to the clockwise neighbor
[out]ccadThe angle difference to the counter-clockwise neighbor

Definition at line 556 of file NBNodeShapeComputer.cpp.

References M_PI, and SUMOReal.

Referenced by computeNodeShapeDefault().

void NBNodeShapeComputer::joinSameDirectionEdges ( std::map< NBEdge *, std::set< NBEdge * > > &  same,
GeomsMap geomsCCW,
GeomsMap 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 368 of file NBNodeShapeComputer.cpp.

References Line::atan2DegreeAngle(), badIntersection(), Line::extrapolateBy2D(), NBNode::hasIncoming(), Line::length2D(), PositionVector::lineAt(), NBNode::myAllEdges, myNode, Line::p1(), NBHelpers::relAngle(), SUMOReal, and WRITE_WARNING.

Referenced by computeNodeShapeDefault().

NBNodeShapeComputer& NBNodeShapeComputer::operator= ( const NBNodeShapeComputer s)
private

Invalidated assignment operator.

Field Documentation

const NBNode& NBNodeShapeComputer::myNode
private

The documentation for this class was generated from the following files: