RoutingVisualization

Entry point for all methods related to the routing visualization.

Instances of RoutingVisualization are created using RoutingVisualizationFactory.create. 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 setActiveRoute to select a route to be navigated on. You can access the list of route primitives displayed on the map using routes. 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 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 RoutingVisualization instance on the ViewModel and use replaceMap once the Activity/Fragment is recreated.

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

Reports whether automatic zoom to routes is enabled.

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

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

Functions

Link copied to clipboard
abstract fun clearAlternativeRoutes()

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

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

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 on the map.

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.

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

Update the data associated to the RoutingRoute that are being displayed.