22 #ifndef NBContHelper_h 23 #define NBContHelper_h 61 EdgeVector::const_iterator& from);
66 EdgeVector::const_iterator& from);
73 static std::ostream&
out(std::ostream& os,
const std::vector<bool>& v);
108 myRefIncoming(e->getToNode() == n) {
186 myAngle = getEdgeAngleAt(e, n);
195 return getDiff(e1) > getDiff(e2);
246 : myAngle(e->getTotalAngle()) {}
342 std::pair<SUMOReal, SUMOReal> mm1 = getMinMaxRelAngles(e1);
343 std::pair<SUMOReal, SUMOReal> mm2 = getMinMaxRelAngles(e2);
344 if (mm1.first == mm2.first && mm1.second == mm2.second) {
350 (mm1.first <= mm2.first && mm1.second <= mm2.second)
352 (mm1.first >= mm2.first && mm1.second >= mm2.second));
353 return (mm1.first >= mm2.first && mm1.second >= mm2.second);
363 for (EdgeVector::const_iterator i = ev.begin(); i != ev.end(); ++i) {
366 if (min == 360 || min > angle) {
369 if (max == 360 || max < angle) {
373 return std::pair<SUMOReal, SUMOReal>(
min,
max);
384 : myReferenceEdge(edge) { }
388 myReferenceEdge->isTurningDirectionAt(e);
SUMOReal getEdgeAngleAt(const NBEdge *const e, const NBNode *const n) const
Returns the given edge's angle at the given node.
SUMOReal getShapeStartAngle() const
Returns the angle at the start of the edge.
NBEdge * myEdge
the edge to compute the relative angle of
static SUMOReal normRelAngle(SUMOReal angle1, SUMOReal angle2)
ensure that reverse relAngles (>=179.999) always count as turnarounds (-180)
SUMOReal myAngle
the angle to find the edge with the opposite direction
const NBNode *const myNode
The related node.
int getPriority() const
Returns the priority of the edge.
const NBEdge *const myEdge
friend std::ostream & operator<<(std::ostream &os, const EdgeVector &ev)
The representation of a single edge during network building.
Class to sort edges by their angle in relation to the given edge.
opposite_finder(NBEdge *edge)
constructor
int operator()(NBEdge *e1, NBEdge *e2) const
Comparing operation.
static void nextCW(const EdgeVector &edges, EdgeVector::const_iterator &from)
const std::string & getID() const
Returns the id.
static SUMOReal angleDiff(const SUMOReal angle1, const SUMOReal angle2)
Returns the difference of the second angle to the first angle in radiants.
SUMOReal getDiff(const NBEdge *const e) const
Computes the angle difference between the related and the given edge.
relative_outgoing_edge_sorter(NBEdge *e)
constructor
bool operator()(NBEdge *e) const
NBNode * myDestinationNode
straightness_sorter(const NBNode *n, const NBEdge *e)
constructor
std::pair< SUMOReal, SUMOReal > getMinMaxRelAngles(NBEdge *e) const
edge_similar_direction_sorter(const NBEdge *const e)
constructor
edge_opposite_direction_sorter(const NBEdge *const e, const NBNode *const n)
Constructor.
SUMOReal angleAt2D(int pos) const
get angle in certain position of position vector
static std::ostream & out(std::ostream &os, const std::vector< bool > &v)
SUMOReal getShapeEndAngle() const
Returns the angle at the end of the edge.
int getNumLanes() const
Returns the number of lanes.
A point in 2D or 3D with translation and scaling methods.
SUMOReal myReferenceAngle
int operator()(NBEdge *e1, NBEdge *e2) const
comparing operation
static SUMOReal maxSpeed(const EdgeVector &ev)
NBEdge * myEdge
the edge to compute the relative angle of
int operator()(NBEdge *e1, NBEdge *e2) const
comparing operation
edge_by_angle_to_nodeShapeCentroid_sorter(const NBNode *n)
constructor
int operator()(NBEdge *e1, NBEdge *e2) const
comparing operation
const PositionVector & getGeometry() const
Returns the geometry of the edge.
static SUMOReal getMaxSpeed(const EdgeVector &edges)
int operator()(NBEdge *e1, NBEdge *e2) const
comparing operator
SUMOReal getTotalAngle() const
Returns the angle at the start of the edge.
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
same_connection_edge_sorter()
constructor
std::vector< NBEdge * > EdgeVector
const NBEdge *const myEdge
const NBNode * myNode
the edge to compute the relative angle of
static SUMOReal getMinAngleDiff(SUMOReal angle1, SUMOReal angle2)
Returns the minimum distance (clockwise/counter-clockwise) between both angles.
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
bool isTurningDirectionAt(const NBEdge *const edge) const
Returns whether the given edge is the opposite direction to this edge.
Represents a single node (junction) during network building.
EdgeVector getConnectedEdges() const
Returns the list of outgoing edges unsorted.
NBNode * getFromNode() const
Returns the origin node of the edge.
relative_incoming_edge_sorter(NBEdge *e)
constructor
static SUMOReal getMinSpeed(const EdgeVector &edges)
static void nextCCW(const EdgeVector &edges, EdgeVector::const_iterator &from)
SUMOReal myAngle
The angle of the related edge at the given node.
static NBEdge * findConnectingEdge(const EdgeVector &edges, NBNode *from, NBNode *to)