NBEdge::MainDirections Class Reference


Detailed Description

MainDirections Holds (- relative to the edge it is build from -!!!) the list of main directions a vehicle that drives on this street may take on the junction the edge ends in The back direction is not regarded

Definition at line 757 of file NBEdge.h.


Public Types

enum  Direction { DIR_RIGHTMOST, DIR_LEFTMOST, DIR_FORWARD }
 enum of possible directions More...

Public Member Functions

bool empty () const
bool includes (Direction d) const
 MainDirections (const std::vector< NBEdge * > &outgoing, NBEdge *parent, NBNode *to)
 constructor
 ~MainDirections ()
 destructor

Data Fields

std::vector< DirectionmyDirs

Private Member Functions

 MainDirections (const MainDirections &)
 Invalidated copy constructor.
MainDirectionsoperator= (const MainDirections &)
 Invalidated assignment operator.

Member Enumeration Documentation

enum of possible directions

Enumerator:
DIR_RIGHTMOST 
DIR_LEFTMOST 
DIR_FORWARD 

Definition at line 760 of file NBEdge.h.


Constructor & Destructor Documentation

NBEdge::MainDirections::MainDirections ( const std::vector< NBEdge * > &  outgoing,
NBEdge parent,
NBNode to 
)

constructor

Definition at line 97 of file NBEdge.cpp.

References DIR_FORWARD, DIR_LEFTMOST, DIR_RIGHTMOST, NBEdge::getJunctionPriority(), NBNode::getMMLDirection(), MMLDIR_STRAIGHT, and myDirs.

00098                                                                    {
00099     if (outgoing.size()==0) {
00100         return;
00101     }
00102     // check whether the right turn has a higher priority
00103     assert(outgoing.size()>0);
00104     if (outgoing[0]->getJunctionPriority(to)==1) {
00105         myDirs.push_back(MainDirections::DIR_RIGHTMOST);
00106     }
00107     // check whether the left turn has a higher priority
00108     if (outgoing.back()->getJunctionPriority(to)==1) {
00109         // ok, the left turn belongs to the higher priorised edges on the junction
00110         //  let's check, whether it has also a higher priority (lane number/speed)
00111         //  than the current
00112         std::vector<NBEdge*> tmp(outgoing);
00113         sort(tmp.begin(), tmp.end(), NBContHelper::edge_similar_direction_sorter(parent));
00114         if (outgoing.back()->getPriority()>tmp[0]->getPriority()) {
00115             myDirs.push_back(MainDirections::DIR_LEFTMOST);
00116         } else {
00117             if (outgoing.back()->getNoLanes()>tmp[0]->getNoLanes()) {
00118                 myDirs.push_back(MainDirections::DIR_LEFTMOST);
00119             }
00120         }
00121     }
00122     // check whether the forward direction has a higher priority
00123     //  try to get the forward direction
00124     std::vector<NBEdge*> tmp(outgoing);
00125     sort(tmp.begin(), tmp.end(), NBContHelper::edge_similar_direction_sorter(parent));
00126     NBEdge *edge = *(tmp.begin());
00127     // check whether it has a higher priority and is going straight
00128     if (edge->getJunctionPriority(to)==1 && to->getMMLDirection(parent, edge)==MMLDIR_STRAIGHT) {
00129         myDirs.push_back(MainDirections::DIR_FORWARD);
00130     }
00131 }

NBEdge::MainDirections::~MainDirections (  ) 

destructor

Definition at line 134 of file NBEdge.cpp.

00134 {}

NBEdge::MainDirections::MainDirections ( const MainDirections  )  [private]

Invalidated copy constructor.


Member Function Documentation

bool NBEdge::MainDirections::empty (  )  const

returns the information whether no following street has a higher priority

Definition at line 138 of file NBEdge.cpp.

References myDirs.

Referenced by NBEdge::preparePriorities().

00138                                   {
00139     return myDirs.empty();
00140 }

bool NBEdge::MainDirections::includes ( Direction  d  )  const

returns the information whether the street in the given direction has a higher priority

Definition at line 144 of file NBEdge.cpp.

References myDirs.

Referenced by NBEdge::preparePriorities().

00144                                                 {
00145     return find(myDirs.begin(), myDirs.end(), d)!=myDirs.end();
00146 }

MainDirections& NBEdge::MainDirections::operator= ( const MainDirections  )  [private]

Invalidated assignment operator.


Field Documentation

list of the main direction within the following junction relative to the edge

Definition at line 764 of file NBEdge.h.

Referenced by empty(), includes(), and MainDirections().


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