NBContHelper Class Reference

#include <NBContHelper.h>


Detailed Description

NBContHelper Some static helper methods that traverse a sorted list of edges in both directions

Definition at line 53 of file NBContHelper.h.


Static Public Member Functions

static NBEdgefindConnectingEdge (const EdgeVector &edges, NBNode *from, NBNode *to)
static SUMOReal getMaxSpeed (const EdgeVector &edges)
static SUMOReal getMinSpeed (const EdgeVector &edges)
static SUMOReal maxSpeed (const EdgeVector &ev)
static void nextCCW (const EdgeVector *edges, EdgeVector::const_iterator &from)
static void nextCW (const EdgeVector *edges, EdgeVector::const_iterator &from)
static std::ostream & out (std::ostream &os, const std::vector< bool > &v)

Friends

std::ostream & operator<< (std::ostream &os, const EdgeVector &ev)

Data Structures

class  edge_by_junction_angle_sorter
class  edge_by_priority_sorter
class  edge_opposite_direction_sorter
class  edge_similar_direction_sorter
class  edge_with_destination_finder
class  node_with_incoming_finder
class  node_with_outgoing_finder
class  opposite_finder
class  relative_edge_sorter
class  same_connection_edge_sorter

Member Function Documentation

NBEdge * NBContHelper::findConnectingEdge ( const EdgeVector edges,
NBNode from,
NBNode to 
) [static]

Tries to return the first edge within the given container which connects both given nodes

Definition at line 76 of file NBContHelper.cpp.

00077                                                            {
00078     for (EdgeVector::const_iterator i=edges.begin(); i!=edges.end(); i++) {
00079         if ((*i)->getToNode()==to && (*i)->getFromNode()==from) {
00080             return *i;
00081         }
00082     }
00083     return 0;
00084 }

SUMOReal NBContHelper::getMaxSpeed ( const EdgeVector edges  )  [static]

Definition at line 193 of file NBContHelper.cpp.

References SUMOReal.

00193                                                  {
00194     if (edges.size()==0) {
00195         return -1;
00196     }
00197     SUMOReal ret = (*(edges.begin()))->getSpeed();
00198     for (EdgeVector::const_iterator i=edges.begin()+1; i!=edges.end(); i++) {
00199         if ((*i)->getSpeed()>ret) {
00200             ret = (*i)->getSpeed();
00201         }
00202     }
00203     return ret;
00204 }

SUMOReal NBContHelper::getMinSpeed ( const EdgeVector edges  )  [static]

Definition at line 208 of file NBContHelper.cpp.

References SUMOReal.

00208                                                  {
00209     if (edges.size()==0) {
00210         return -1;
00211     }
00212     SUMOReal ret = (*(edges.begin()))->getSpeed();
00213     for (EdgeVector::const_iterator i=edges.begin()+1; i!=edges.end(); i++) {
00214         if ((*i)->getSpeed()<ret) {
00215             ret = (*i)->getSpeed();
00216         }
00217     }
00218     return ret;
00219 }

SUMOReal NBContHelper::maxSpeed ( const EdgeVector ev  )  [static]

returns the maximum speed allowed on the edges

Definition at line 89 of file NBContHelper.cpp.

References max, and SUMOReal.

Referenced by NBTrafficLightDefinition::computeBrakingTime().

00089                                            {
00090     assert(ev.size()>0);
00091     SUMOReal max = (*(ev.begin()))->getSpeed();
00092     for (EdgeVector::const_iterator i=ev.begin()+1; i!=ev.end(); i++) {
00093         max =
00094             max > (*i)->getSpeed()
00095             ? max : (*i)->getSpeed();
00096     }
00097     return max;
00098 }

void NBContHelper::nextCCW ( const EdgeVector edges,
EdgeVector::const_iterator &  from 
) [static]

Moves the given iterator counter clockwise within the given container of edges sorted clockwise

Definition at line 57 of file NBContHelper.cpp.

Referenced by NBNode::checkIsRemovable(), NBRequest::computeRightOutgoingLinkCrossings(), NBNode::getEdgesToJoin(), and NBNode::getMMLDirection().

00057                                                                               {
00058     if (from==edges->begin()) {
00059         from = edges->end() - 1;
00060     } else {
00061         --from;
00062     }
00063 }

void NBContHelper::nextCW ( const EdgeVector edges,
EdgeVector::const_iterator &  from 
) [static]

Moves the given iterator clockwise within the given container of edges sorted clockwise

Definition at line 48 of file NBContHelper.cpp.

Referenced by NBRequest::computeLeftOutgoingLinkCrossings(), NBNode::getEdgesThatApproach(), NBNode::getMMLDirection(), NBEdgeCont::guessRoundabouts(), NBNode::isSimpleContinuation(), and NBRequest::setBlocking().

00048                                                                              {
00049     from++;
00050     if (from==edges->end()) {
00051         from = edges->begin();
00052     }
00053 }

std::ostream & NBContHelper::out ( std::ostream &  os,
const std::vector< bool > &  v 
) [static]

writes the vector of bools to the given stream

Definition at line 67 of file NBContHelper.cpp.

00067                                                           {
00068     for (std::vector<bool>::const_iterator i=v.begin(); i!=v.end(); i++) {
00069         os << *i;
00070     }
00071     return os;
00072 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const EdgeVector ev 
) [friend]

Definition at line 179 of file NBContHelper.cpp.

00179                                                  {
00180     for (EdgeVector::const_iterator i=ev.begin(); i!=ev.end(); i++) {
00181         if (i!=ev.begin()) {
00182             os << ", ";
00183         }
00184         os << (*i)->getID();
00185     }
00186     return os;
00187 }


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

Generated on Wed May 5 00:06:51 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6