NavigationVisualization

Entry point for all methods related to the navigation visualization.

Instances of NavigationVisualization are created using NavigationVisualizationFactory.create. 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 to select a route to navigate. You can access the list of route primitives displayed on the map using routes. 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. 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. 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.

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

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.

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
abstract val trafficVisualization: TrafficVisualization
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
abstract fun addRouteClickListener(listener: RouteClickListener)
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
abstract fun removeRouteClickListener(listener: RouteClickListener)
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(route: Route)
Link copied to clipboard
abstract fun setActiveRoute(route: Route)
Link copied to clipboard
abstract fun setTrafficIncidentsEnabled(enabled: Boolean)
Link copied to clipboard
abstract fun setZoomToRoutePlanEnabled(enabled: Boolean)
Link copied to clipboard
abstract fun updateRouteData(route: Route)