NavigationVisualization

interface NavigationVisualization : Disposable

Entry point for all methods related to the navigation visualization add-on.

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 the displayRoutePlan method. After that, the routes contained in the RoutePlan are displayed on the map, and you can use selectRoute to select a route to be navigated on. 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 selectGuidanceType, you can start the navigation session with NavigationController.start. Once the navigation session is started, the route that is selected becomes the active route. When you're done using NavigationVisualization, call NavigationController.stop. You can then call clear to remove all the primitives that have been added to the map by the add-on.

If a Route contained in the RoutePlan has traffic data available, 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.

The navigation visualization add-on subscribes to certain listeners during its life cycle, so that it can react automatically to important events:

  • OnNavigationStartedListener - Notifies the add-on when a navigation session starts. The add-on reacts by removing the alternative routes from the map, setting the camera tracking mode to CameraTrackingMode.FOLLOW_ROUTE, and setting a default tilt angle.

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

  • OnRouteUpdatedListener - Notifies the add-on if the driver deviates from the current route. A new route is provided along with the notification. The add-on reacts by replacing the current route with the new one.

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

  • OnDestinationReachedListener - Notifies the add-on when the driver reaches the destination. The add-on reacts by removing the route from the map, setting camera tracking mode to CameraTrackingMode.FOLLOW, and setting the default 2D view.

Important: This is a Public Preview API. It may be changed or removed at any time.

Functions

Link copied to clipboard
abstract fun clear()
Link copied to clipboard
abstract fun displayRoutePlan(routePlan: RoutePlan)

Displays a RoutePlan on the map.

Link copied to clipboard
abstract fun dispose()
Link copied to clipboard
abstract fun getTrafficIncidents(route: Route): List<TrafficIncident>?

Gets the list of traffic incidents that are being displayed on a certain Route.

Link copied to clipboard
abstract fun replaceMap(tomtomMap: TomTomMap)

Replaces the current TomTomMap with a new one.

Link copied to clipboard
abstract fun selectGuidanceType(guidanceType: GuidanceType)

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

Link copied to clipboard
abstract fun selectRoute(route: Route)

Selects a Route to be navigated when a navigation session starts.

Properties

Link copied to clipboard
abstract val guidanceType: GuidanceType

The type of navigation guidance selected.

Link copied to clipboard
abstract val routes: List<Route>

The list of routes that is being displayed on the map.

Link copied to clipboard
abstract val selectedRoute: Route?

The Route selected for navigation.