Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NBContHelper::edge_opposite_direction_sorter Class Reference

Class to sort edges by their angle in relation to the given edge. More...

#include <NBContHelper.h>

Collaboration diagram for NBContHelper::edge_opposite_direction_sorter:
[legend]

Public Member Functions

 edge_opposite_direction_sorter (const NBEdge *const e, const NBNode *const n, bool regardPriority)
 Constructor.
 
int operator() (NBEdge *e1, NBEdge *e2) const
 Comparing operation.
 

Protected Member Functions

double getDiff (const NBEdge *const e) const
 Computes the angle difference between the related and the given edge.
 
double getEdgeAngleAt (const NBEdge *const e, const NBNode *const n) const
 Returns the given edge's angle at the given node.
 

Private Attributes

double myAngle
 The angle of the related edge at the given node.
 
const NBEdge *const myEdge
 the reference edge
 
const NBNode *const myNode
 The related node.
 
bool myRegardPriority
 Whether edge priority may override closer angles.
 

Detailed Description

Class to sort edges by their angle in relation to the given edge.

The resulting sorted list has the edge in the most opposite direction to the given edge as her first entry.

Definition at line 142 of file NBContHelper.h.

Constructor & Destructor Documentation

◆ edge_opposite_direction_sorter()

NBContHelper::edge_opposite_direction_sorter::edge_opposite_direction_sorter ( const NBEdge *const  e,
const NBNode *const  n,
bool  regardPriority 
)
inlineexplicit

Constructor.

Parameters
[in]eThe edge to which the sorting relates
[in]nThe node to consider

Definition at line 148 of file NBContHelper.h.

References getEdgeAngleAt(), and myAngle.

Member Function Documentation

◆ getDiff()

double NBContHelper::edge_opposite_direction_sorter::getDiff ( const NBEdge *const  e) const
inlineprotected

Computes the angle difference between the related and the given edge.

Parameters
[in]eThe edge to compare the angle difference of
Returns
The angle difference

Definition at line 173 of file NBContHelper.h.

References GeomHelper::angleDiff(), getEdgeAngleAt(), myAngle, and myNode.

Referenced by operator()().

Here is the caller graph for this function:

◆ getEdgeAngleAt()

double NBContHelper::edge_opposite_direction_sorter::getEdgeAngleAt ( const NBEdge *const  e,
const NBNode *const  n 
) const
inlineprotected

Returns the given edge's angle at the given node.

Please note that we always consider the "outgoing direction".

Parameters
[in]eThe edge to which the sorting relates
[in]nThe node to consider

Definition at line 183 of file NBContHelper.h.

References PositionVector::angleAt2D(), NBEdge::getFromNode(), and NBEdge::getGeometry().

Referenced by edge_opposite_direction_sorter(), and getDiff().

Here is the caller graph for this function:

◆ operator()()

int NBContHelper::edge_opposite_direction_sorter::operator() ( NBEdge e1,
NBEdge e2 
) const
inline

Comparing operation.

Parameters
[in]e1The first edge to compare
[in]e2The second edge to compare
Returns
Which edge is more opposite to the related one

Definition at line 160 of file NBContHelper.h.

References getDiff(), NBEdge::getPriority(), myEdge, and myRegardPriority.

Field Documentation

◆ myAngle

double NBContHelper::edge_opposite_direction_sorter::myAngle
private

The angle of the related edge at the given node.

Definition at line 200 of file NBContHelper.h.

Referenced by edge_opposite_direction_sorter(), and getDiff().

◆ myEdge

const NBEdge* const NBContHelper::edge_opposite_direction_sorter::myEdge
private

the reference edge

Definition at line 197 of file NBContHelper.h.

Referenced by operator()().

◆ myNode

const NBNode* const NBContHelper::edge_opposite_direction_sorter::myNode
private

The related node.

Definition at line 194 of file NBContHelper.h.

Referenced by getDiff().

◆ myRegardPriority

bool NBContHelper::edge_opposite_direction_sorter::myRegardPriority
private

Whether edge priority may override closer angles.

Definition at line 203 of file NBContHelper.h.

Referenced by operator()().


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