NavigationVisualization

Entry point for all methods related to the navigation visualization.

Instances of NavigationVisualization are created using NavigationVisualizationFactory.create. NavigationVisualization shouldn't be conformed outside the TomTomSDK modules. You should call methods on these instances from the main thread only, otherwise an exception can occur.

A NavigationVisualization instance is used by first providing a RoutePlan with displayRoutePlan. After that, the Routes contained in the RoutePlan are displayed on the map, and you can use setActiveRoute or selectRoute to select a route to navigate. You can access the list of route primitives displayed on the map using routes or plannedRoutes. The selected route and the alternative routes are styled with the properties contained in the StyleConfiguration provided to NavigationVisualizationFactory.create. After selecting the type of navigation guidance with guidanceType, you can start the navigation session with TomTomNavigation.start. Once the navigation session is started, the route that is selected becomes the active route. When you're finished using NavigationVisualization, call TomTomNavigation.stop. TomTomNavigation should not be closed before NavigationVisualization. Only after NavigationVisualization.close is called, you can then call close TomTomNavigation. You can then call clearRoutePlan to remove all the primitives that have been added to the map by displayRoutePlan.

Visualization of on-route traffic incidents can be enabled or disabled using setTrafficIncidentsEnabled or traffic API. If a Route contained in the RoutePlan has traffic data available and areTrafficIncidentsEnabled is true, traffic incidents are displayed on the map on top of that Route. You can access the list of traffic incidents that are on a route using getTrafficIncidents or traffic API.

To support Android configuration changes properly, create a NavigationVisualization instance on the ViewModel and use replaceMap once the Activity/Fragment is recreated.

Navigation Visualization subscribes to certain listeners during its life cycle, so that it can react automatically to important events:

  • NavigationStateChangedListener - Notifies Navigation Visualization when a navigation session state changes. Navigation Visualization reacts by removing the alternative routes from the map, setting the camera tracking mode to CameraTrackingMode.FollowRouteDirection, and setting a default tilt angle.

  • ProgressUpdatedListener - Notifies Navigation Visualization as the driver progresses on the route. Navigation Visualization reacts by updating the visual cue of the progress on the route (i.e., the grayed-out region behind the vehicle).

  • RouteUpdatedListener - Notifies Navigation Visualization if the route data has been updated (i.e., traffic data).

  • ActiveRouteChangedListener - Notifies Navigation Visualization that the active route has changed. A new route is provided along with the notification. Navigation Visualization reacts by replacing the current route with the new one.

  • GuidanceUpdatedListener - Notifies Navigation Visualization when new on-route instructions are available. The new instructions are provided along with the notification. Navigation Visualization reacts by updating the route with the new instructions.

  • DestinationArrivalListener - Notifies Navigation Visualization when the driver arrives at the destination. Navigation Visualization reacts by removing the route from the map, setting camera tracking mode to CameraTrackingMode.FollowNorthUp, and setting the default 2D view.

  • CameraChangeListener - Notifies Navigation Visualization when a parameter of the camera changes. Navigation Visualization reacts by, for example, showing or hiding certain traffic markers (see RouteTrafficIncidentStyle.markerVisibilityByCategory).

Properties

Link copied to clipboard
abstract override var areRouteInstructionsVisible: Boolean

Sets whether the route instructions should be visible or hidden during navigating on route. This property can be used dynamically, such as before or after the route planning phase, which means the changes will be applied immediately. The route instructions are never visible outside NavigationState.ActiveGuidance.

Link copied to clipboard

Manages the visualization of better route proposals, e.g., visibility.

Link copied to clipboard

Selects the type of guidance to be used when a navigation session starts.

Link copied to clipboard

Safety Locations-specific API used to manage safety locations capabilities, e.g., safety cameras visibility.

Link copied to clipboard
abstract var unitSystem: UnitSystem

Selects the preferred system of measurement within NavigationVisualization.

Inherited properties

Link copied to clipboard
abstract val activeRoute: Route?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract val plannedRoutes: List<Route>
Link copied to clipboard
abstract val routes: List<Route>
Link copied to clipboard
abstract val selectedRoute: Route?
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
abstract fun setCameraTrackingMode(trackingMode: CameraTrackingMode)

Configures the camera tracking mode and updates it if needed.

Inherited functions

Link copied to clipboard
Link copied to clipboard
abstract fun clearAlternativeRoutes()
Link copied to clipboard
abstract fun clearRoutePlan()
Link copied to clipboard
abstract fun close()
Link copied to clipboard
abstract fun displayRoutePlan(routePlan: RoutePlan)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun replaceActiveRoute(route: Route)
Link copied to clipboard
abstract fun replaceMap(tomtomMap: TomTomMap)
Link copied to clipboard
abstract fun selectRoute(routeId: RouteId): Route?
Link copied to clipboard
abstract fun setActiveRoute(route: Route)
Link copied to clipboard
abstract fun setDeviceOrientation(orientation: DeviceOrientation)
Link copied to clipboard
abstract fun setTrafficIncidentsEnabled(enabled: Boolean)
Link copied to clipboard
abstract fun setZoomToRoutePlanEnabled(enabled: Boolean)
Link copied to clipboard
abstract fun updateCameraConfiguration(cameraConfiguration: CameraConfiguration)
Link copied to clipboard
abstract fun updateRouteData(route: Route, routeUpdatedReason: RoutingRouteUpdatedReason)