![]() |
MapLink Pro 11.2
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
This class encapsulates the route-traversal algorithms pertinent to the optimized network.
Clients supply cost methods that are called by the traversal algorithms. Thus, clients are fully in charge of what the meaning of cost is for their application. This could simply be the distance travelled via a link; or it could be the time taken to travel, or the fuel cost, or whatever else. The traversal algorithms simply supply the cost object with the current link and turn; it is up to the cost object how it uses these to compute the real cost of traversal. For example, if an application is routing lorries and links contain information about height restrictions (e.g. low bridges), then clients could initialise a cost object with the type of vehicle that is being routed; the cost object can then determine if the vehicle's height prohibits it travelling down particular links and assign costs accordingly.
Public Member Functions | |
void | destroy () |
double | getCost (int N) const |
const TSLOptLink * | getLink (int N) const |
const TSLOptNode * | getNode (int N) const |
TSLCoordSet * | getPoints () const |
TSLCoordSet * | getPoints (int from, int to) const |
int | linkCount () const |
int | nodeCount () const |
int | shortestPath (const TSLOptimizedNetwork::const_node_iterator &from, const TSLOptimizedNetwork::const_node_iterator &to, const TSLOptPathCost::distance_type &maxDist=TSLOptPathCost::infinity) const |
Static Public Member Functions | |
static TSLOptimizedRouteQuery * | make (const TSLOptimizedNetwork *nwk, const TSLOptPathCost &cost) |
void TSLOptimizedRouteQuery::destroy | ( | ) |
Destroy the object.
double TSLOptimizedRouteQuery::getCost | ( | int | N | ) | const |
Access method for the path cost.
N | The Nth node of the route. |
const TSLOptLink * TSLOptimizedRouteQuery::getLink | ( | int | N | ) | const |
Access method for a link in the path.
N | The Nth link of the route. |
const TSLOptNode * TSLOptimizedRouteQuery::getNode | ( | int | N | ) | const |
Access method for a node in the path.
N | The Nth node of the route. |
TSLCoordSet * TSLOptimizedRouteQuery::getPoints | ( | ) | const |
Queries the route for its points.
Returns a TSLCoordSet* that references the points comprising the route. Each member of the TSLCoordSet is a point which represents the position. If isLatLong() returns true, then the position is a scaled longitude and latitude pair, where scaled longitude = getPoints[i].x() and scaled latitude = getPoints[i].y(). In order to get true latitude / longitude, divide the relevant values by TSLOptimizedNetwork::coordinateScaleFactor().
The TSLCoordSet does not contain duplicate matching end/start link points.
NOTE: the user is responsible for destroying the returned pointer.
TSLCoordSet * TSLOptimizedRouteQuery::getPoints | ( | int | from, |
int | to ) const |
Queries the route for its sub-points.
from | The index of the node to start from. |
to | The index of the node to end on. |
The TSLCoordSet does not contain duplicate matching end/start link points.
int TSLOptimizedRouteQuery::linkCount | ( | ) | const |
Query method for the number of links in the route.
|
static |
Create a TSLOptimizedRouteQuery object, associating a network and cost object with it. The client is responsible for destroying the object.
NOTE: The TSLOptimizedRouteQuery object does NOT make a copy of the cost object passed to it. Therefore the client must ensure that the cost object remains valid for the lifetime of the TSLOptimizedRouteQuery object.
nwk | The optimized network for which routing will be performed. |
cost | The cost object. |
int TSLOptimizedRouteQuery::nodeCount | ( | ) | const |
Query method for the number of nodes in the route.
int TSLOptimizedRouteQuery::shortestPath | ( | const TSLOptimizedNetwork::const_node_iterator & | from, |
const TSLOptimizedNetwork::const_node_iterator & | to, | ||
const TSLOptPathCost::distance_type & | maxDist = TSLOptPathCost::infinity ) const |
Find the shortest-path through the network given the start and end points. The optional maxDist argument specifies an effective radius (from the start) beyond which links & nodes are not searched.
from | A reference to the network node_iterator pointing to the start node. |
to | A reference to the network node_iterator pointing to the finish node. |
maxDist | An upper bound for the cost of a path. Links from nodes whose cost exceeds maxDist will not be traversed. |