VisioMove SDK (Android)  2.1.22
 All Classes Functions Variables Pages
VgINavigation Class Reference
Inheritance diagram for VgINavigation:
Inheritance graph

Public Member Functions

void addListener (VgINavigationListenerRefPtr pListener)
void removeListener (VgINavigationListenerRefPtr pListener)
VgINavigationInstructionConstRefPtr getInstruction (long pIndex)
long getNumInstructions ()
void updateCurrentPosition (VgPosition pPosition, double pTime)
VgPosition getCurrentPosition ()
long getCurrentInstructionIndex ()
VgPosition getClosestPositionOnRoute ()
double getDistanceFromRoute ()
long getCurrentInstructionClosestPositionNextSubIndex ()
void setInstructionGeofenceDistance (double pDistanceInMeters)
double getInstructionGeofenceDistance ()
VgINavigationRequestParameters getRequestParameters ()
- Public Member Functions inherited from VgReferenced
synchronized void release ()
 VgReferenced ()
 VgReferenced (VgReferenced pThis)
void ref ()
int unref ()
int getNbReferences ()

Detailed Description

VgINavigation represents a Navigation object

Member Function Documentation

void VgINavigation.addListener ( VgINavigationListenerRefPtr  pListener)

Adds a listener to the navgiation object. If the listener already exists, it does not add it.

pListenerThe navigation listener to be added.
VgPosition VgINavigation.getClosestPositionOnRoute ( )

Calculates the closest position on the route, given the current position ( VgINavigation::getCurrentPosition() ).

you can use VgRoutingModule::VgIRoutingSolver::getRoutingNode and VgRoutingModule::VgIRoutingNode::getPosition to obtain the position on the routing network where there is no navigation.
See also
Position on route, if no position has been injected, it will return the first position of the navigation.
long VgINavigation.getCurrentInstructionClosestPositionNextSubIndex ( )

Used to determine where on the current instruction the closest position on route is.

// Example how to draw a line while doing a Navigation from the closest position on the route to the end of the current instruction
void MyDrawNavigationListener::notifyPositionUpdated (VgEngine::VgConstRefPtr< VgNavigationModule::VgINavigation >
const& pNavigation
const VgEngine::VgPosition &,double)
// hide previous line
unsigned int lNbInstructions = pNavigation->getNumInstructions();
unsigned int lCurrentInstructnionIndex = pNavigation->getCurrentInstructionIndex();
// This is the next index on the current instruction positions after the closest position.
unsigned int lPositionNextSubIndex = pNavigation->getCurrentInstructionClosestPositionNextSubIndex();
VgEngine::VgConstRefPtr< VgNavigationModule::VgINavigationInstruction > mInstruction;
mInstruction = pNavigation->getInstruction(lCurrentInstructnionIndex);
VgEngine::VgPosition lClosestPosition = pNavigation->getClosestPositionOnRoute();
const std::vector<VgEngine::VgPosition>& lInstructionPositions = mInstruction->getInstructionPositions();
VgEngine::VgRefPtr< Vg3DModule::VgLineDescriptor > lCurrentLD = Vg3DModule::VgLineDescriptor::create();
// Push closest position
lClosestPosition.mZOrAltitude = lLineAltitude;
// For each position, flatten height, and add it to line descriptor
std::vector<VgEngine::VgPosition>::const_iterator lPosIter;
for (lPosIter = (lInstructionPositions.begin() + lPositionNextSubIndex);
lPosIter != lInstructionPositions.end();
VgEngine::VgPosition lPosition = *lPosIter;
lPosition.mZOrAltitude = lLineAltitude;
// Complete the line descriptor e.g. color and width information
// Instantiate the line descriptor, and show it (set its layer)
the index of the next position in VgINavigationInstruction::getInstructionPositions after the getClosestPositionOnRoute(). Initial value is 1, maximum value is currentInstruction getPositions().size()
long VgINavigation.getCurrentInstructionIndex ( )

Gets the index of the active instruction. The value will be the same as the last value given by VgINavigationListener::notifyNewInstruction() .

The index of the active instruction, initial value is 0.
VgPosition VgINavigation.getCurrentPosition ( )

Gets the last position that was notified. This value will be the same as the last value given by VgINavigationListener::notifyPositionUpdated() .

2.1.3 Updated default value when it has not been initialized.
Last injected position, if no position has been injected, it will return the first position of the navigation.
double VgINavigation.getDistanceFromRoute ( )

Gets the distance between current position ( VgINavigation::getCurrentPosition() ) and closest position on route

2.1.3 Updated default value when it has not been initialized.
Distance in meters from route. If no position has been injected, it will return 0.
VgINavigationInstructionConstRefPtr VgINavigation.getInstruction ( long  pIndex)

Gets a navigation instruction

pIndexindex of instruction
Instruction with index pIndex, or NULL if pIndex >+ VgINavigation::getNumInstructions ()
double VgINavigation.getInstructionGeofenceDistance ( )

Gets the distance in meters of the threshold when to switch instructions.

the radius distance in meters. Default value is 2.5 meters
long VgINavigation.getNumInstructions ( )

Gets the number of navigation instructions

Number of instructions
VgINavigationRequestParameters VgINavigation.getRequestParameters ( )
2.1.8 cleared mCallback to avoid possible circular dependencies.
the NavigationRequest parameters with which the request was made, without the callback.
void VgINavigation.removeListener ( VgINavigationListenerRefPtr  pListener)

Removes a listener from the navigation object.

pListenerThe navigation listener to be removed.
void VgINavigation.setInstructionGeofenceDistance ( double  pDistanceInMeters)

Sets the distance in meters of the threshold when to switch instructions. this number is a function of the accuracy of the position information. If too large, instructions will switch rapidly, if too small, instructions will not change.

This function should be called at the moment the application is notified of the result of a navigation computation.
pDistanceInMetersRadius distance in meters. Initial value is 2.5 meters.
void VgINavigation.updateCurrentPosition ( VgPosition  pPosition,
double  pTime 

Injects new position. This will trigger a VgINavigationListener::notifyPositionUpdated() event. This method can be used to connect a location provider service to the navigation object.

This method must be called within the GL Thread. The SDK is not thread-safe and the resulting call to VgINavigationListener::notifyPositionUpdated() might interact with the engine.
pPositionThe new current position. The attribute mZOrAltitude of this parameter will be used to determine the corresponding layer within the map. In order for pPosition to be valid it must fall within the boundary of the map ( VgEngine::VgIDatabaseDatasetDescriptor ) and the mZOrAltitude must fall within a layer range ( VgMapModule::VgIMapModule::getHeightRangeForLayer )
pTimeTime of the position capture. Will be used when notifying any registered navigation listeners, ( VgNavigationModule::VgINavigationListener::notifyPositionUpdated ). If unknown, use 0.

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