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

Detailed Description

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 TSLOptLinkgetLink (int N) const
 
const TSLOptNodegetNode (int N) const
 
TSLCoordSetgetPoints () const
 
TSLCoordSetgetPoints (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 TSLOptimizedRouteQuerymake (const TSLOptimizedNetwork *nwk, const TSLOptPathCost &cost)
 

Member Function Documentation

◆ destroy()

void TSLOptimizedRouteQuery::destroy ( )

Destroy the object.

◆ getCost()

double TSLOptimizedRouteQuery::getCost ( 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.

◆ getLink()

const TSLOptLink * TSLOptimizedRouteQuery::getLink ( 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.

◆ getNode()

const TSLOptNode * TSLOptimizedRouteQuery::getNode ( 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.

◆ getPoints() [1/2]

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.

◆ getPoints() [2/2]

TSLCoordSet * TSLOptimizedRouteQuery::getPoints ( int from,
int to ) const

Queries the route for its sub-points.

Parameters
fromThe index of the node to start from.
toThe index of the node to end on.
Returns
a TSLCoordSet* that references the points from the links between the specified node indices (these indices relate to the node position in the route, e.g. 3rd node to 7th node) 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 = get Points[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.

◆ linkCount()

int TSLOptimizedRouteQuery::linkCount ( ) const

Query method for the number of links in the route.

◆ make()

static TSLOptimizedRouteQuery * TSLOptimizedRouteQuery::make ( const TSLOptimizedNetwork * nwk,
const TSLOptPathCost & cost )
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.

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

◆ nodeCount()

int TSLOptimizedRouteQuery::nodeCount ( ) const

Query method for the number of nodes in the route.

◆ shortestPath()

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.

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.