MapLink Pro 11.2
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLRouteFinder Class Reference

Detailed Description

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 ()
 
TSLPolylinegeneratePolyline (int from=-1, int to=-1)
 
double get_cost (int N) const
 
const TSLLinkget_link (int N) const
 
const TSLNodeget_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 TSLRouteFindermake (const TSLNetwork *nwk, const TSLPathCost &cost)
 

Member Function Documentation

◆ destroy()

void TSLRouteFinder::destroy ( )

Destroy the object.

◆ generatePolyline()

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.

Parameters
fromThe index of the node to start the polyline from.
toThe index of the node to end the polyline on.
Returns
a pointer to a TSLPolyline object if generation was successful, 0 otherwise.

◆ get_cost()

double TSLRouteFinder::get_cost ( int N) const

Access method for the path cost.

Parameters
NThe Nth node of the route.
Returns
the path's cost to the given node in the route.

◆ get_link()

const TSLLink * TSLRouteFinder::get_link ( int N) const

Access method for a link in the path.

Parameters
NThe Nth link of the route.
Returns
the path's link at the given position in the route.

◆ get_node()

const TSLNode * TSLRouteFinder::get_node ( int N) const

Access method for a node in the path.

Parameters
NThe Nth node of the route.
Returns
the path's node at the given position in the route.

◆ link_count()

int TSLRouteFinder::link_count ( ) const

Query method for the number of links in the route.

◆ make()

static TSLRouteFinder * TSLRouteFinder::make ( const TSLNetwork * nwk,
const TSLPathCost & cost )
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.

Parameters
nwkThe network for which routing will be performed.
costThe cost object.

◆ node_count()

int TSLRouteFinder::node_count ( ) const

Query method for the number of nodes in the route.

◆ operator[]()

Segment TSLRouteFinder::operator[] ( int N) const

Access method for the path.

Parameters
NThe index.
Returns
the path's Segment at the given index.

◆ shortest_path()

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.

Parameters
fromA reference to the network node_iterator pointing to the start node.
toA reference to the network node_iterator pointing to the finish node.
maxDistAn upper bound for the cost of a path. Links from nodes whose cost exceeds maxDist will not be traversed.
Returns
the number of Segments that the path is made up of.