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:

  • NavigationStartedListener - Notifies Navigation Visualization when a navigation session starts. 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 val activeRoute: Route?

The active Route.

Link copied to clipboard

Tells if visualization of on-route traffic incidents is enabled.

Link copied to clipboard

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

Link copied to clipboard

Reports whether automatic zoom to routes is enabled.

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

The list of Routes displayed on the map.

Link copied to clipboard

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

Functions

Link copied to clipboard
abstract fun clearAlternativeRoutes()

Removes all alternatives routes and corresponding traffic incidents that have been added with displayRoutePlan from the map, and keeps the activeRoute.

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

Displays a RoutePlan on the map.

Link copied to clipboard

Gets the list of TrafficIncidents 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 setActiveRoute(route: Route)

Set as active a Route from the routes displayed in the map.

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

Configures the camera tracking mode and updates it if needed.

Link copied to clipboard
abstract fun setTrafficIncidentsEnabled(enabled: Boolean)

Enables or disables visualization of on-route traffic incidents.

Link copied to clipboard
abstract fun setZoomToRoutePlanEnabled(enabled: Boolean)

Enables or disables automatic zoom to routes when displayRoutePlan is invoked.

Inherited functions

Link copied to clipboard
abstract fun close()