![]() |
MapLink Pro 11.2
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
This class encapsulates the route-traversal algorithms pertinent to the 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.
Classes | |
struct | Segment |
Public Member Functions | |
Segment | operator[] (int N) const |
void | destroy () |
TSLPolyline * | generatePolyline (int from=-1, int to=-1) |
double | get_cost (int N) const |
const TSLLink * | get_link (int N) const |
const TSLNode * | get_node (int N) const |
int | link_count () const |
int | node_count () const |
int | shortest_path (const TSLNetwork::node_iterator &from, const TSLNetwork::node_iterator &to, const TSLPathCost::distance_type &maxDist=TSLPathCost::infinity) const |
Static Public Member Functions | |
static TSLRouteFinder * | make (const TSLNetwork *nwk, const TSLPathCost &cost) |
void TSLRouteFinder::destroy | ( | ) |
Destroy the object.
TSLPolyline * TSLRouteFinder::generatePolyline | ( | int | from = -1, |
int | to = -1 ) |
Generates a TSLPolyline composed from the links between the node identified by the from index and the node identified by the to index (these indices relate to the node position in the route, e.g. 3rd node to 7th node). The client is responsible for managing any TSLPolylines created.
from | The index of the node to start the polyline from. |
to | The index of the node to end the polyline on. |
double TSLRouteFinder::get_cost | ( | int | N | ) | const |
Access method for the path cost.
N | The Nth node of the route. |
const TSLLink * TSLRouteFinder::get_link | ( | int | N | ) | const |
Access method for a link in the path.
N | The Nth link of the route. |
const TSLNode * TSLRouteFinder::get_node | ( | int | N | ) | const |
Access method for a node in the path.
N | The Nth node of the route. |
int TSLRouteFinder::link_count | ( | ) | const |
Query method for the number of links in the route.
|
static |
Create a TSLRouteFinder object, associating a network and cost object with it. The client is responsible for destroying the object.
NOTE: The TSLRouteFinder 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 TSLRouteFinder object.
nwk | The network for which routing will be performed. |
cost | The cost object. |
int TSLRouteFinder::node_count | ( | ) | const |
Query method for the number of nodes in the route.
Segment TSLRouteFinder::operator[] | ( | int | N | ) | const |
int TSLRouteFinder::shortest_path | ( | const TSLNetwork::node_iterator & | from, |
const TSLNetwork::node_iterator & | to, | ||
const TSLPathCost::distance_type & | maxDist = TSLPathCost::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. |