Object TrimbleNativeNavigatorImpl
-
- All Implemented Interfaces:
-
com.trimblemaps.navigation.navigator.internal.TrimbleMapsNativeNavigator
public class TrimbleNativeNavigatorImpl implements TrimbleMapsNativeNavigator
Default implementation of TrimbleMapsNativeNavigator interface.
-
-
Field Summary
Fields Modifier and Type Field Description public final static TrimbleNativeNavigatorImplINSTANCE
-
Method Summary
Modifier and Type Method Description TrimbleNativeNavigatorImplcreate(DeviceProfile deviceProfile, NavigatorConfig navigatorConfig)Create or reset resources. UnitresetRideSession()Reset the navigator state with the same configuration. BooleanupdateLocation(Location rawLocation)Passes in the current raw location of the user. BooleanupdateSensorData(SensorData sensorData)Passes in the current sensor data of the user. BooleancheckInDataGrid(Location rawLocation)UnitonNetworkStatusChanged(Boolean network)UnitretryMapDownload()UnitsetRetryMapDownload(Boolean retry)UnitsetAvailableStorageMB(Double storageSpaceMB)TripStatusgetStatus(Long navigatorPredictionMillis)Gets the status as an offset in time from the last fixed location. RouteInitInfosetRoute(DirectionsRoute route, Integer legIndex)Sets the route path for the navigator to process. BooleanupdateAnnotations(String legAnnotationJson, Integer routeIndex, Integer legIndex, Integer geometryStartIndex, ArrayList<String> fasterAlternates, NavigatorCallback cb)Updates annotations so that subsequent calls to getStatus will reflect the most current annotations for the route. BannerInstructiongetBannerInstruction(Integer index)Gets the banner at a specific step index in the route. StringgetRouteGeometryWithBuffer(Float gridSize, Short bufferDilation)Gets a polygon around the currently loaded route. BooleanupdateLegIndex(Integer legIndex)Follows a new leg of the already loaded directions. UnitcacheLastRoute()Caches tiles around the last set route LongunpackTiles(String tarPath, String destinationPath)Passes in an input path to the tar file and output path. LongremoveTiles(String tilePath, Point southwest, Point northeast)Removes tiles wholly within the supplied bounding box. StringgetHistory()Gets the history of state-changing calls to the navigator. UnittoggleHistory(Boolean isEnabled)Toggles the recording of history on or off. UnitaddHistoryEvent(String eventType, String eventJsonProperties)Adds a custom event to the navigator's history. VoiceInstructiongetVoiceInstruction(Integer index)Gets the voice instruction at a specific step index in the route. UnitsetElectronicHorizonObserver(ElectronicHorizonObserver eHorizonObserver)Sets the Electronic Horizon observer final NativeFixLocationtoNativeFixLocation(Location $self)
-
-
-
Method Detail
-
create
TrimbleNativeNavigatorImpl create(DeviceProfile deviceProfile, NavigatorConfig navigatorConfig)
Create or reset resources. This must be called before calling any functions within TrimbleMapsNativeNavigatorImpl
-
resetRideSession
Unit resetRideSession()
Reset the navigator state with the same configuration. The location becomes unknown, but the NavigatorConfig stays the same. This can be used to transport the navigator to a new location.
-
updateLocation
Boolean updateLocation(Location rawLocation)
Passes in the current raw location of the user.
- Parameters:
rawLocation- The current raw Location of user.
-
updateSensorData
Boolean updateSensorData(SensorData sensorData)
Passes in the current sensor data of the user.
- Parameters:
sensorData- The current sensor data of user.
-
checkInDataGrid
Boolean checkInDataGrid(Location rawLocation)
-
onNetworkStatusChanged
Unit onNetworkStatusChanged(Boolean network)
-
retryMapDownload
Unit retryMapDownload()
-
setRetryMapDownload
Unit setRetryMapDownload(Boolean retry)
-
setAvailableStorageMB
Unit setAvailableStorageMB(Double storageSpaceMB)
-
getStatus
TripStatus getStatus(Long navigatorPredictionMillis)
Gets the status as an offset in time from the last fixed location. This allows the caller to get predicted statuses in the future along the route if the device is unable to get fixed locations. Poor reception would be one reason.
This method uses previous fixes to snap the user's location to the route and verify that the user is still on the route. This method also determines if an instruction needs to be called out for the user.
- Parameters:
navigatorPredictionMillis- millis for navigation status predictions.
-
setRoute
RouteInitInfo setRoute(DirectionsRoute route, Integer legIndex)
Sets the route path for the navigator to process. Returns initialized route state if no errors occurred. Otherwise, it returns a invalid route state.
- Parameters:
route- DirectionsRoute to follow.legIndex- Which leg to follow
-
updateAnnotations
Boolean updateAnnotations(String legAnnotationJson, Integer routeIndex, Integer legIndex, Integer geometryStartIndex, ArrayList<String> fasterAlternates, NavigatorCallback cb)
Updates annotations so that subsequent calls to getStatus will reflect the most current annotations for the route.
- Parameters:
legAnnotationJson- A string containing the json/pbf annotationsrouteIndex- Which route to apply the annotation update tolegIndex- Which leg to apply the annotation update to
-
getBannerInstruction
BannerInstruction getBannerInstruction(Integer index)
Gets the banner at a specific step index in the route. If there is no banner at the specified index method return null.
- Parameters:
index- Which step you want to get BannerInstruction for
-
getRouteGeometryWithBuffer
String getRouteGeometryWithBuffer(Float gridSize, Short bufferDilation)
Gets a polygon around the currently loaded route. The method uses a bitmap approach in which you specify a grid size (pixel size) and a dilation (how many pixels) to expand the initial grid cells that are intersected by the route.
- Parameters:
gridSize- the size of the individual grid cellsbufferDilation- the number of pixels to dilate the initial intersection by it can be thought of as controlling the halo thickness around the route
-
updateLegIndex
Boolean updateLegIndex(Integer legIndex)
Follows a new leg of the already loaded directions. Returns an initialized navigation status if no errors occurred otherwise, it returns an invalid navigation status state.
- Parameters:
legIndex- new leg index
-
cacheLastRoute
Unit cacheLastRoute()
Caches tiles around the last set route
-
unpackTiles
Long unpackTiles(String tarPath, String destinationPath)
Passes in an input path to the tar file and output path.
- Parameters:
tarPath- The path to the packed tiles.destinationPath- The path to the unpacked files.
-
removeTiles
Long removeTiles(String tilePath, Point southwest, Point northeast)
Removes tiles wholly within the supplied bounding box. If the tile is not contained completely within the bounding box, it will remain in the cache. After removing files from the cache, any routers should be reconfigured to synchronize their in-memory cache with the disk.
- Parameters:
tilePath- The path to the tiles.southwest- The lower left coord of the bounding box.northeast- The upper right coord of the bounding box.
-
getHistory
String getHistory()
Gets the history of state-changing calls to the navigator. This can be used to replay a sequence of events for the purpose of bug fixing.
-
toggleHistory
Unit toggleHistory(Boolean isEnabled)
Toggles the recording of history on or off. Toggling will reset all history calls getHistory first before toggling to retain a copy.
- Parameters:
isEnabled- set this to true to turn on history recording and false to turn it off
-
addHistoryEvent
Unit addHistoryEvent(String eventType, String eventJsonProperties)
Adds a custom event to the navigator's history. This can be useful to log things that happen during navigation that are specific to your application.
- Parameters:
eventType- the event type in the events log for your custom eventeventJsonProperties- the json to attach to the "properties" key of the event
-
getVoiceInstruction
VoiceInstruction getVoiceInstruction(Integer index)
Gets the voice instruction at a specific step index in the route. If there is no voice instruction at the specified index, null is returned.
- Parameters:
index- Which step you want to get VoiceInstruction for
-
setElectronicHorizonObserver
Unit setElectronicHorizonObserver(ElectronicHorizonObserver eHorizonObserver)
Sets the Electronic Horizon observer
-
toNativeFixLocation
final NativeFixLocation toNativeFixLocation(Location $self)
-
-