RoutingVisualization
public protocol RoutingVisualization
The RoutingVisualization
protocol sets how routes and traffic information are managed and displayed.
The conforming types are responsible for displaying routes, selecting a route, and
managing traffic incident visualization on the map.
Important
This is a Public Preview API. It may be changed or removed at any time.-
The list of routes displayed on the map contains the: - active route - alternative routes.
The active route is available after calling the
setActiveRoute(_:)
method. When a navigation session starts, the alternative routes are removed from this list. The list contains only the active route (activeRoute
). After callingclear()
, the list is empty.Declaration
Swift
var routes: [TomTomSDKMapDisplay.Route] { get }
-
The
TomTomSDKMapDisplay.Route
selected for navigation. This property contains the active route during a navigation session. This is nil before routes have been displayed withdisplayRoutePlan(_:)
, or after callingclear()
.Declaration
Swift
var activeRoute: TomTomSDKMapDisplay.Route? { get }
-
Enables or disables automatic zoom to routes when
displayRoutePlan(_:)
is invoked.The default is
true
.Declaration
Swift
var zoomToRoutesEnabled: Bool { get set }
-
Toggle the visibility of traffic incidents on route.
The default is
true
.Declaration
Swift
var trafficIncidentsEnabled: Bool { get set }
-
Displays a
RoutePlan
on the map. Adds aRoute
instance to the map for eachRoutePlan
contained in the route plan. By default, the first route of the plan is active, but you can set a different route usingsetActiveRoute(_:)
Consecutive calls of this method replace the previousRoutePlan
being displayed. If the providedRoutePlan
contains an empty collection of routes, then this method does nothing.Declaration
Swift
func displayRoutePlan(_ routePlan: RoutePlan)
-
Retrieves the collection of traffic incidents.
Declaration
Swift
func trafficOnRoute(route: TomTomSDKMapDisplay.Route) -> [TrafficIncident]
-
Set an active
TomTomSDKMapDisplay.Route
to be navigated, when a navigation session starts.If the provided
TomTomSDKMapDisplay.Route
is not a route displayed withdisplayRoutePlan(_:)
, then this method does nothing.Declaration
Swift
func setActiveRoute(_ route: TomTomSDKMapDisplay.Route)
Parameters
route
Route to be highlighted.
-
Removes every route added with
displayRoutePlan(_:)
from the map and clears the active route.Declaration
Swift
func clear()
-
Removes all alternative routes added with
displayRoutePlan(_:)
from the map.Declaration
Swift
func clearAlternativeRoutes()