Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NBNodeShapeComputer Class Reference

This class computes shapes of junctions. More...

#include <NBNodeShapeComputer.h>

Collaboration diagram for NBNodeShapeComputer:
[legend]

Public Member Functions

const PositionVector compute (bool forceSmall)
 Computes the shape of the assigned junction.
 
double getRadius () const
 get computed radius for node
 
 NBNodeShapeComputer (const NBNode &node)
 Constructor.
 
 ~NBNodeShapeComputer ()
 Destructor.
 

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
 
void computeEdgeBoundaries (const EdgeVector &edges, GeomsMap &geomsCCW, GeomsMap &geomsCW)
 compute clockwise/counter-clockwise edge boundaries
 
const 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.
 
const PositionVector computeNodeShapeSmall ()
 Computes the node geometry using normals.
 
void computeSameEnd (PositionVector &l1, PositionVector &l2)
 
EdgeVector computeUniqueDirectionList (const EdgeVector &all, std::map< NBEdge *, std::set< NBEdge * > > &same, GeomsMap &geomsCCW, GeomsMap &geomsCW)
 Joins edges.
 
double getDefaultRadius (const OptionsCont &oc)
 determine the default radius appropriate for the current junction
 
PositionVector getSmoothCorner (PositionVector begShape, PositionVector endShape, const Position &begPoint, const Position &endPoint, int cornerDetail)
 Compute smoothed corner shape.
 
bool isDivided (const NBEdge *e, std::set< NBEdge * > same, const PositionVector &ccw, const PositionVector &cw) const
 
void joinSameDirectionEdges (const EdgeVector &edges, std::map< NBEdge *, std::set< NBEdge * > > &same, bool useEndpoints)
 Joins edges and computes ccw/cw boundaries.
 
bool needsLargeTurn (NBEdge *e1, NBEdge *e2, std::map< NBEdge *, std::set< NBEdge * > > &same) const
 whether the given edges (along with those in the same direction) requires a large turning radius
 
NBNodeShapeComputeroperator= (const NBNodeShapeComputer &s)
 Invalidated assignment operator.
 

Static Private Member Functions

static double divisionWidth (const NBEdge *e, std::set< NBEdge * > same, const Position &p, const Position &p2)
 compute the width of the divider space for divided roads
 
static double getExtraWidth (const NBEdge *e, SVCPermissions exclude)
 compute with of rightmost lanes that exlude the given permissions
 
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.
 

Private Attributes

double EXT
 the maximum distance to search for a place where neighboring edges intersect and do not overlap
 
const NBNodemyNode
 The node to compute the geometry for.
 
double myRadius
 the computed node radius
 

Static Private Attributes

static const SVCPermissions SVC_LARGE_TURN
 

Detailed Description

This class computes shapes of junctions.

Definition at line 42 of file NBNodeShapeComputer.h.

Member Typedef Documentation

◆ GeomsMap

Definition at line 59 of file NBNodeShapeComputer.h.

Constructor & Destructor Documentation

◆ NBNodeShapeComputer()

NBNodeShapeComputer::NBNodeShapeComputer ( const NBNode node)

Constructor.

Definition at line 54 of file NBNodeShapeComputer.cpp.

References EXT, NBNode::getEdges(), and NBNodeTypeComputer::isRailwayNode().

◆ ~NBNodeShapeComputer()

NBNodeShapeComputer::~NBNodeShapeComputer ( )

Destructor.

Definition at line 65 of file NBNodeShapeComputer.cpp.

Member Function Documentation

◆ badIntersection()

bool NBNodeShapeComputer::badIntersection ( const NBEdge e1,
const NBEdge e2,
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 538 of file NBNodeShapeComputer.cpp.

References PositionVector::intersectsAtLengths2D().

Referenced by computeNodeShapeDefault().

Here is the caller graph for this function:

◆ compute()

const PositionVector NBNodeShapeComputer::compute ( bool  forceSmall)

Computes the shape of the assigned junction.

Definition at line 69 of file NBNodeShapeComputer.cpp.

References computeNodeShapeDefault(), computeNodeShapeSmall(), DEBUGCOND, NBNode::getEdges(), NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), NBNode::isSimpleContinuation(), myNode, and toString().

Referenced by NBNode::computeNodeShape().

Here is the caller graph for this function:

◆ computeEdgeBoundaries()

void NBNodeShapeComputer::computeEdgeBoundaries ( const EdgeVector edges,
GeomsMap geomsCCW,
GeomsMap geomsCW 
)
private

compute clockwise/counter-clockwise edge boundaries

Definition at line 659 of file NBNodeShapeComputer.cpp.

References EXT, EXT2, Named::getID(), MAX2(), myNode, and WRITE_WARNING.

Referenced by computeNodeShapeDefault().

Here is the caller graph for this function:

◆ computeNodeShapeDefault()

const PositionVector NBNodeShapeComputer::computeNodeShapeDefault ( bool  simpleContinuation)
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 124 of file NBNodeShapeComputer.cpp.

References Position::add(), PositionVector::angleAt2D(), GeomHelper::angleDiff(), PositionVector::append(), closestIntersection(), computeEdgeBoundaries(), computeUniqueDirectionList(), DEBUGCOND, DEG2RAD, divisionWidth(), OptionsCont::exists(), EXT, OptionsCont::getBool(), NBNode::getCrossings(), getDefaultRadius(), NBNode::getDisplacementError(), NBNode::getEdges(), OptionsCont::getFloat(), Named::getID(), OptionsCont::getInt(), OptionsCont::getOptions(), NBNode::getPosition(), NBNode::getRadius(), getSmoothCorner(), NBNode::getType(), NBNode::hasIncoming(), initNeighbors(), PositionVector::intersects(), PositionVector::intersectsAtLengths2D(), isDivided(), isRailway(), NBNode::isRoundabout(), OptionsCont::isSet(), joinNamedToStringSorting(), joinSameDirectionEdges(), PositionVector::length2D(), MAX2(), Position::mul(), myNode, myRadius, needsLargeTurn(), PositionVector::positionAtOffset2D(), PositionVector::push_back_noDoublePos(), PositionVector::push_front_noDoublePos(), RAD2DEG, RAIL_CROSSING, NBHelpers::relAngle(), Position::setz(), SUMO_const_laneWidth, TL, NBNode::UNSPECIFIED_RADIUS, NBEdge::UNSPECIFIED_WIDTH, WRITE_WARNINGF, and Position::z().

Referenced by compute().

Here is the caller graph for this function:

◆ computeNodeShapeSmall()

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

References DEBUGCOND, PositionVector::extrapolate2D(), NBNode::getEdges(), Named::getID(), NBNode::getPosition(), PositionVector::getSubpartByIndex(), PositionVector::intersectionPosition2D(), PositionVector::intersects(), myNode, PositionVector::push_back_noDoublePos(), Position::set(), Position::x(), Position::y(), and Position::z().

Referenced by compute().

Here is the caller graph for this function:

◆ computeSameEnd()

void NBNodeShapeComputer::computeSameEnd ( PositionVector l1,
PositionVector l2 
)
private

Definition at line 101 of file NBNodeShapeComputer.cpp.

References PositionVector::add(), EXT, PositionVector::extrapolate2D(), PositionVector::getSubpart2D(), PositionVector::intersects(), PositionVector::intersectsAtLengths2D(), PositionVector::length2D(), PositionVector::positionAtOffset2D(), and PositionVector::sub().

Referenced by computeUniqueDirectionList().

Here is the caller graph for this function:

◆ computeUniqueDirectionList()

EdgeVector NBNodeShapeComputer::computeUniqueDirectionList ( const EdgeVector all,
std::map< NBEdge *, std::set< NBEdge * > > &  same,
GeomsMap geomsCCW,
GeomsMap geomsCW 
)
private

Joins edges.

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;

Definition at line 835 of file NBNodeShapeComputer.cpp.

References computeSameEnd(), DEBUGCOND, and joinNamedToStringSorting().

Referenced by computeNodeShapeDefault().

Here is the caller graph for this function:

◆ divisionWidth()

double NBNodeShapeComputer::divisionWidth ( const NBEdge e,
std::set< NBEdge * >  same,
const Position p,
const Position p2 
)
staticprivate

compute the width of the divider space for divided roads

Definition at line 1141 of file NBNodeShapeComputer.cpp.

References Position::distanceTo2D(), NBEdge::getTotalWidth(), and MAX2().

Referenced by computeNodeShapeDefault().

Here is the caller graph for this function:

◆ getDefaultRadius()

double NBNodeShapeComputer::getDefaultRadius ( const OptionsCont oc)
private

determine the default radius appropriate for the current junction

Definition at line 985 of file NBNodeShapeComputer.cpp.

References GeomHelper::angleDiff(), DEBUGCOND, DEG2RAD, NBNode::getDirection(), NBNode::getEdges(), getExtraWidth(), OptionsCont::getFloat(), Named::getID(), NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), NBNode::isConstantWidthTransition(), M_PI, MAX2(), MIN2(), myNode, NBContHelper::nextCW(), RAD2DEG, SVC_LARGE_TURN, and TURN.

Referenced by computeNodeShapeDefault().

Here is the caller graph for this function:

◆ getExtraWidth()

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

compute with of rightmost lanes that exlude the given permissions

Definition at line 1125 of file NBNodeShapeComputer.cpp.

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

Referenced by getDefaultRadius().

Here is the caller graph for this function:

◆ getRadius()

double NBNodeShapeComputer::getRadius ( ) const
inline

get computed radius for node

Definition at line 54 of file NBNodeShapeComputer.h.

References myRadius.

Referenced by NBNode::computeNodeShape().

Here is the caller graph for this function:

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

References PositionVector::angleAt2D(), GeomHelper::angleDiff(), NBNode::AVOID_WIDE_LEFT_TURN, NBNode::computeSmoothShape(), DEBUGCOND, DEG2RAD, Position::distanceTo2D(), EXT2, NBNode::getPosition(), PositionVector::getSubpart(), PositionVector::getSubpart2D(), PositionVector::interpolateZ(), PositionVector::length(), PositionVector::length2D(), MAX2(), myNode, PositionVector::nearest_offset_to_point2D(), RAD2DEG, PositionVector::reverse(), PositionVector::splitAt(), and Position::z().

Referenced by computeNodeShapeDefault().

Here is the caller graph for this function:

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

References M_PI.

Referenced by computeNodeShapeDefault().

Here is the caller graph for this function:

◆ isDivided()

bool NBNodeShapeComputer::isDivided ( const NBEdge e,
std::set< NBEdge * >  same,
const PositionVector ccw,
const PositionVector cw 
) const
private

Definition at line 1101 of file NBNodeShapeComputer.cpp.

References PositionVector::distances(), NBEdge::getEndpointAtNode(), NBEdge::getTotalWidth(), VectorHelper< T >::maxValue(), and myNode.

Referenced by computeNodeShapeDefault().

Here is the caller graph for this function:

◆ joinSameDirectionEdges()

void NBNodeShapeComputer::joinSameDirectionEdges ( const EdgeVector edges,
std::map< NBEdge *, std::set< NBEdge * > > &  same,
bool  useEndpoints 
)
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 697 of file NBNodeShapeComputer.cpp.

References PositionVector::angleAt2D(), GeomHelper::angleDiff(), badIntersection(), DEBUGCOND, DEG2RAD, OptionsCont::exists(), EXT, OptionsCont::getOptions(), OptionsCont::isSet(), and myNode.

Referenced by computeNodeShapeDefault().

Here is the caller graph for this function:

◆ needsLargeTurn()

bool NBNodeShapeComputer::needsLargeTurn ( NBEdge e1,
NBEdge e2,
std::map< NBEdge *, std::set< NBEdge * > > &  same 
) const
private

whether the given edges (along with those in the same direction) requires a large turning radius

Definition at line 550 of file NBNodeShapeComputer.cpp.

References NBEdge::getFromNode(), NBEdge::getPermissions(), NBEdge::getToNode(), and SVC_LARGE_TURN.

Referenced by computeNodeShapeDefault().

Here is the caller graph for this function:

◆ operator=()

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

Invalidated assignment operator.

Field Documentation

◆ EXT

double NBNodeShapeComputer::EXT
private

the maximum distance to search for a place where neighboring edges intersect and do not overlap

Definition at line 169 of file NBNodeShapeComputer.h.

Referenced by badIntersection(), computeEdgeBoundaries(), computeNodeShapeDefault(), computeSameEnd(), joinSameDirectionEdges(), and NBNodeShapeComputer().

◆ myNode

const NBNode& NBNodeShapeComputer::myNode
private

◆ myRadius

double NBNodeShapeComputer::myRadius
private

the computed node radius

Definition at line 166 of file NBNodeShapeComputer.h.

Referenced by computeNodeShapeDefault(), and getRadius().

◆ SVC_LARGE_TURN

const SVCPermissions NBNodeShapeComputer::SVC_LARGE_TURN
staticprivate

Definition at line 171 of file NBNodeShapeComputer.h.

Referenced by getDefaultRadius(), and needsLargeTurn().


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