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 or 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 setTrafficIncidentsEnabled or traffic. 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 or traffic.
To support Android configuration changes properly, create a RoutingVisualization instance on the ViewModel and use replaceMap once the Activity/Fragment is recreated.
Properties
The active MapDisplayRoute.
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.
Tells if visualization of on-route traffic incidents is enabled.
Reports whether automatic zoom to routes is enabled.
The list of Routes that is being displayed after calling displayRoutePlan.
The list of MapDisplayRoutes that is being displayed on the map.
The selected Route.
Traffic-specific API used to manage traffic locations capabilities, e.g., traffic marker click listeners.
Controls whether automatic zoom to routes is enabled.
Functions
Adds a RouteClickedListener which will inform when a route primitive is clicked.
Removes all alternative routes and corresponding traffic incidents added with displayRoutePlan from the map and keeps the selectedRoute.
Clears RoutingVisualization.
Displays a RoutePlan on the map.
Gets the list of TrafficIncidents that are being displayed on a certain MapDisplayRoute.
Removes previous registered RouteClickedListener.
Replaces the current TomTomMap with a new one.
Select the given Route and bring it to the front.
Set as active a MapDisplayRoute from the routes displayed on the map.
Enables or disables visualization of on-route traffic incidents.
Enables or disables automatic zoom to routes when displayRoutePlan is invoked.