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 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 plannedRoutes: List<Route>

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

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 selected RoutingRoute.

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 RouteClickListener which will inform when a route primitive is clicked. Important: This is a Public Preview API. It may be changed or removed at any time.

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

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

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)

Select the given RoutingRoute and bring it to the front.

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.

Inherited functions

Link copied to clipboard
abstract fun close()