Eclipse SUMO - Simulation of Urban MObility
NBNodeShapeComputer Class Reference

This class computes shapes of junctions. More...

#include <NBNodeShapeComputer.h>

Collaboration diagram for NBNodeShapeComputer:

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

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...
 
NBNodeShapeComputeroperator= (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 &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...
 
double myRadius
 the computed node radius More...
 

Detailed Description

This class computes shapes of junctions.

Definition at line 45 of file NBNodeShapeComputer.h.

Member Typedef Documentation

◆ GeomsMap

Definition at line 62 of file NBNodeShapeComputer.h.

Constructor & Destructor Documentation

◆ NBNodeShapeComputer()

NBNodeShapeComputer::NBNodeShapeComputer ( const NBNode node)

Constructor.

Definition at line 50 of file NBNodeShapeComputer.cpp.

◆ ~NBNodeShapeComputer()

NBNodeShapeComputer::~NBNodeShapeComputer ( )

Destructor.

Definition at line 56 of file NBNodeShapeComputer.cpp.

Member Function Documentation

◆ badIntersection()

◆ 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 470 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 825 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 709 of file NBNodeShapeComputer.cpp.

References computeSameEnd(), DEBUGCOND, joinNamedToStringSorting(), NBNode::myAllEdges, and myNode.

Referenced by computeNodeShapeDefault().

◆ getDefaultRadius()

◆ getExtraWidth()

double NBNodeShapeComputer::getExtraWidth ( const NBEdge e,
SVCPermissions  exclude 
)
staticprivate

compute with of rightmost lanes that exlude the given permissions

Definition at line 953 of file NBNodeShapeComputer.cpp.

References NBEdge::getLaneWidth(), and NBEdge::getPermissions().

Referenced by getDefaultRadius().

◆ getRadius()

double NBNodeShapeComputer::getRadius ( ) const
inline

get computed radius for node

Definition at line 57 of file NBNodeShapeComputer.h.

References myRadius.

Referenced by NBNode::computeNodeShape().

◆ getSmoothCorner()

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

◆ 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 788 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 559 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().

◆ operator=()

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

Invalidated assignment operator.

Field Documentation

◆ myNode

const NBNode& NBNodeShapeComputer::myNode
private

◆ myRadius

double NBNodeShapeComputer::myRadius
private

the computed node radius

Definition at line 156 of file NBNodeShapeComputer.h.

Referenced by computeNodeShapeDefault(), and getRadius().


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