ROHelper Namespace Reference


Detailed Description

Some helping methods for router.


Functions

void recheckForLoops (std::vector< const ROEdge * > &edges) throw ()
 Computes the costs (travel time) for the given list of edges.


Function Documentation

void ROHelper::recheckForLoops ( std::vector< const ROEdge * > &  edges  )  throw ()

Computes the costs (travel time) for the given list of edges.

Parameters:
[in] edges The edges to pass
[in] v The vehicle that passes the edges
[in] time The time at which the vehicle begins to pass the edges
Returns:
The time needed by the vehicle to pass the edges (completely)
Todo:
Check whether vehicle's max speed is considered
Checks whether the given edge list contains loops and removes them
Parameters:
[in] edges The list of edges to remove loops from

Definition at line 58 of file ROHelper.cpp.

Referenced by RORoute::recheckForLoops().

00058                                                          {
00059     RONode* start = edges[0]->getFromNode();
00060     unsigned lastStart = 0;
00061     for (unsigned i=1; i<edges.size(); i++) {
00062         if (edges[i]->getFromNode() == start) {
00063             lastStart = i;
00064         }
00065     }
00066     if (lastStart > 0) {
00067         edges.erase(edges.begin(), edges.begin() + lastStart - 1);
00068     }
00069     RONode* end = edges.back()->getToNode();
00070     size_t firstEnd = edges.size()-1;
00071     for (unsigned i=0; i<firstEnd; i++) {
00072         if (edges[i]->getToNode() == end) {
00073             firstEnd = i;
00074         }
00075     }
00076     if (firstEnd < edges.size()-1) {
00077         edges.erase(edges.begin() + firstEnd + 2, edges.end());
00078     }
00079 }


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