RoutingVisualization

Entry point for all methods related to the routing visualization.

Instances of RoutingVisualization are created using RoutingVisualizationFactory.create. RoutingVisualization 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 RoutingVisualization 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 selectRoute to select a route to be navigated on. You can access the list of route primitives displayed on the map using routes or plannedRoutes. The active route and the alternative routes are styled with the properties contained in the StyleConfiguration provided to RoutingVisualizationFactory.create. You can then call clearRoutePlan to remove all the primitives that have been added to the map by RoutingVisualization.

Visualization of on-route traffic incidents can be enabled or disabled using traffic. If a Route contained in the RoutePlan has traffic data available and TrafficVisualization.trafficIncidentsEnabled 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 traffic.

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

Properties

Link copied to clipboard

Sets whether the route instructions should be visible or hidden. This property can be used dynamically, such as before or after the route planning phase, which means the changes will be applied immediately.

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

The list of Routes that is being displayed after calling displayRoutePlan.

Link copied to clipboard
abstract val selectedRoute: Route?

The selected Route.

Link copied to clipboard

Traffic-specific API used to manage traffic locations capabilities, e.g., traffic marker click listeners.

Link copied to clipboard

Controls whether automatic zoom to routes is enabled.

Functions

Link copied to clipboard

Adds a RouteClickedListener which will inform when a route primitive is clicked.

Link copied to clipboard
abstract fun clearAlternativeRoutes()

Removes all alternative routes and corresponding traffic incidents added with displayRoutePlan from the map and keeps the selectedRoute.

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

Displays a RoutePlan on the map.

Link copied to clipboard

Removes previous registered RouteClickedListener.

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

Replaces the current TomTomMap with a new one.

Link copied to clipboard
abstract fun selectRoute(routeId: RouteId): Route?

Select the given Route and bring it to the front.

Inherited functions

Link copied to clipboard
abstract fun close()