SUMO - Simulation of Urban MObility
NBNodeShapeComputer Class Reference

This class computes shapes of junctions. More...

#include <NBNodeShapeComputer.h>

Collaboration diagram for NBNodeShapeComputer:
Collaboration graph

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 *, PositionVectorGeomsMap
 

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...
 
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, double &cad, double &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

◆ GeomsMap

Definition at line 64 of file NBNodeShapeComputer.h.

Constructor & Destructor Documentation

◆ NBNodeShapeComputer()

NBNodeShapeComputer::NBNodeShapeComputer ( const NBNode node)

Constructor.

Definition at line 52 of file NBNodeShapeComputer.cpp.

◆ ~NBNodeShapeComputer()

NBNodeShapeComputer::~NBNodeShapeComputer ( )

Destructor.

Definition at line 56 of file NBNodeShapeComputer.cpp.

Member Function Documentation

◆ badIntersection()

bool NBNodeShapeComputer::badIntersection ( const NBEdge e1,
const NBEdge e2,
const PositionVector e1cw,
const PositionVector e2ccw,
double  distance 
)
private

◆ closestIntersection()

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

return the intersection point closest to the given offset

Definition at line 459 of file NBNodeShapeComputer.cpp.

References PositionVector::intersectsAtLengths2D().

Referenced by computeNodeShapeDefault().

◆ compute()

◆ computeNodeShapeDefault()

◆ computeNodeShapeSmall()

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 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().

◆ computeUniqueDirectionList()

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

◆ getSmoothCorner()

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 472 of file NBNodeShapeComputer.cpp.

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

Referenced by computeNodeShapeDefault().

◆ initNeighbors()

void NBNodeShapeComputer::initNeighbors ( const EdgeVector edges,
const EdgeVector::const_iterator &  current,
GeomsMap geomsCW,
GeomsMap geomsCCW,
EdgeVector::const_iterator &  cwi,
EdgeVector::const_iterator &  ccwi,
double &  cad,
double &  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 667 of file NBNodeShapeComputer.cpp.

References M_PI.

Referenced by computeNodeShapeDefault().

◆ joinSameDirectionEdges()

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 490 of file NBNodeShapeComputer.cpp.

References PositionVector::angleAt2D(), GeomHelper::angleDiff(), badIntersection(), DEBUGCOND, DEG2RAD, NBNode::hasIncoming(), NBNode::myAllEdges, myNode, and WRITE_WARNING.

Referenced by computeNodeShapeDefault().

◆ operator=()

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

Invalidated assignment operator.

Field Documentation

◆ myNode

const NBNode& NBNodeShapeComputer::myNode
private

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