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 calling clear(), 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 with displayRoutePlan(_:), or after calling clear().

    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 a Route instance to the map for each RoutePlan contained in the route plan. By default, the first route of the plan is active, but you can set a different route using setActiveRoute(_:) Consecutive calls of this method replace the previous RoutePlan being displayed. If the provided RoutePlan 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 with displayRoutePlan(_:), 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()