VisioMove SDK (Android)  2.1.22
 All Classes Functions Variables Pages
VgIRoutingSolver Class Reference

Public Member Functions

VgIRouteRequest computeRoute (VgIRouteRequestParameters pParameters)
 
VgIRouteRefPtr computeRouteDirect (VgIRouteRequestParameters pParameters)
 
VgIRoutingNodeRefPtr getRoutingNode (VgPosition pPosition)
 
VgIRoutingNodeRefPtr getRoutingNode (VgPosition pPosition, VgIRoutingNodeParameters pParameters)
 
VgIRoutingNodeRefPtr getRoutingNode (String pPoiID)
 

Detailed Description

VgIRoutingSolver will calculate a route between several waypoints. It is obtained from VgRoutingModule::VgIRoutingModule::getRoutingSolver()

Version
1.1.6592
2.1.0 Updated documentations

Member Function Documentation

VgIRouteRequest VgIRoutingSolver.computeRoute ( VgIRouteRequestParameters  pParameters)

Computes a route given some parameters.

Remarks
The caller is responsible for deallocating VgRoutingModule::VgIRouteRequest
Calling this method often will result in poor performance of the map.
Note
Currently, all requests are handled synchronously.
Parameters
pParametersParameters to determine the route to be computed. A notify function will be called on callback within pParameters once the route has been computed.
Returns
VgRoutingModule::VgIRouteRequest, NULL if request is handled synchronously.
VgIRouteRefPtr VgIRoutingSolver.computeRouteDirect ( VgIRouteRequestParameters  pParameters)

Computes a route given some parameters.

// Example to find the closest toilet
//
VgRoutingModule::VgIRoutingModule* lRoutingModule = static_cast< VgRoutingModule::VgIRoutingModule* >(lApp->editModuleManager()->queryModule("Routing"));
VgRoutingModule::VgIRouteRequestParameters lParams;
lParams.mDestinationsOrder = VgRoutingModule::eClosest;
lParams.mOrigin = lRoutingModule->getRoutingSolver()->getRoutingNode("L25");
lParams.mRequestType = VgRoutingModule::eShortest; // shortest request are less computationally intensive than fastest request
lParams.mDestinations.push_back(lRoutingModule->getRoutingSolver()->getRoutingNode("UL01-WC1"));
lParams.mDestinations.push_back(lRoutingModule->getRoutingSolver()->getRoutingNode("UL01-WC2"));
lParams.mDestinations.push_back(lRoutingModule->getRoutingSolver()->getRoutingNode("UL02-WC1"));
VgEngine::VgRefPtr< VgRoutingModule::VgIRoute > lRoute = lRoutingModule->getRoutingSolver()->computeRouteDirect(lParams);
if (lRoute.isValid())
{
const std::vector< int >& lDestinationIndices = lRoute->getDestinationIndices();
const VgRoutingModule::VgIRouteRequestParameters& lRequest = lRoute->getRequestParameters();
VgEngine::VgRefPtr< VgRoutingModule::VgIRoutingNode > lClosestToiletNode = lRequest.mDestinations[lDestinationIndices[0]];
if (lClosestToiletNode.isValid() && lClosestToiletNode->hasPoiID())
{
printf("closest toilet is: %s\n",lClosestToiletNode->getPoiID().c_str());
}
}
Parameters
pParametersParameters to determine the route to be computed.
Version
2.1.8
Returns
VgRoutingModule::VgIRoute, A route object. If the route computation failed, the route object will be invalid.
VgIRoutingNodeRefPtr VgIRoutingSolver.getRoutingNode ( VgPosition  pPosition)

Gets the closest point on a routing edge to a given position.

Note the altitude/height of the position is used to determine the layer of the returned routing node. The routing node is searched within 200 meters from the position use getRoutingNode with options if you need a different threshold or if you want the closest access or node.

Note
The result of this function can only be used for the origin and final destination of a route. If you need to use intermediate waypoints using a position, you need to use getRoutingNode using the VgIRoutingNodeParameters and the option eRoutingNodeOptionsAnyNode or eRoutingNodeOptionsAccessOnly

Example:

...
// Need to update the lat/long for lMyPos.
VgEngine::VgPosition lMyPos;
std::string lLayerName = "0"; // For example
float lHeightMax;
float lHeightMin;
float lFloorHeight = 0.0;
if ( lMapModule->getHeightRangeForLayer(lLayerName, lHeightMax, lHeightMin) )
{
lFloorHeight = ((lHeightMax + lHeightMin) / 2);
}
// IMPORTANT:
// Set the floor height before requesting the routing node
lMyPos.mZOrAltitude = lFloorHeight;
VgEngine::VgRefPtr< VgRoutingModule::VgIRoutingNode > lRoutingNode = lRoutingModule->getRoutingSolver()->getRoutingNode(lMyPos);
if (lRoutingNode.isValid())
{
if (lRoutingNode->hasRoutePosition())
{
VgEngine::VgPosition lMySnappedPosition = lRoutingNode->getRoutePosition();
}
}
...
Parameters
pPositionA const reference on the position.
Returns
A valid opaque pointer on a VgRoutingNode, or NULL if no node was found.
VgIRoutingNodeRefPtr VgIRoutingSolver.getRoutingNode ( VgPosition  pPosition,
VgIRoutingNodeParameters  pParameters 
)

Gets the closest node or point on a routing edge to a given position with options.

The position's altitude/height will be used to determine the layer of the returned routing node.

Note
when using the default option: eRoutingNodeOptionsOnEdge, this can only be used for the origin and final destination of a route. If you need to use intermediate waypoints using a position, you need to use the option eRoutingNodeOptionsAnyNode or eRoutingNodeOptionsAccessOnly

Example:

...
// Need to update the lat/long for lMyPos.
VgEngine::VgPosition lMyPos;
VgRoutingModule::VgIRoutingNodeParameters lRoutingNodeParameters;
lRoutingNodeParameters.mLayerName = "0";
lRoutingNodeParameters.mOption = VgRoutingModule::eRoutingNodeOptionsOnEdge;
VgEngine::VgRefPtr< VgRoutingModule::VgIRoutingNode > lSrcNode =
lRoutingModule->getRoutingSolver()->getRoutingNode(lMyPos,lRoutingNodeParameters);
if (lSrcNode.isValid())
{
...
Parameters
pPositionA const reference on the position.
pParametersparameters what node to obtain
Version
2.1.4
Returns
A valid opaque pointer on a VgRoutingNode, or NULL if no node was found.
VgIRoutingNodeRefPtr VgIRoutingSolver.getRoutingNode ( String  pPoiID)

Gets the virtual node associated with a given poi. Note: A poi may have several access nodes. The poi's virtual node represents all these access nodes when a route is requested. However the computed route will use only one of the access nodes and never the virtual node.

Parameters
pPoiIDA const reference on a string containing the poi's ID.
Returns
A valid VgIRoutingNode pointer, or NULL if no node was found.

The documentation for this class was generated from the following file:
VisioMove 2.1.22, Visioglobe® 2016