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 displayRoutes(routes:), or after calling clear().

    Declaration

    Swift

    var activeRoute: TomTomSDKMapDisplay.Route? { get }
  • Retrieves the list of traffic incidents as Line objects.

    Declaration

    Swift

    var trafficOnRoutes: [UUID : [TrafficIncident]] { get }
  • Enables or disables automatic zoom to routes when displayRoutes(routes:_) 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 }
  • Display a list of routes on the map. By default, the first route in the list is set as active. You can select a different route using setActiveRoute.

    Declaration

    Swift

    func displayRoutes(routes: [TomTomSDKRoute.Route])

    Parameters

    routes

    Routes to be displayed.

  • Set an active TomTomSDKMapDisplay.Route to be navigated, when a navigation session starts.

    If the provided TomTomSDKMapDisplay.Route is not a route displayed with displayRoutes(routes:), then this method does nothing.

    Declaration

    Swift

    func setActiveRoute(_ route: TomTomSDKMapDisplay.Route)

    Parameters

    route

    Route to be highlighted.

  • Removes every route added with displayRoutes(routes:) from the map and clears the active route.

    Declaration

    Swift

    func clear()
  • Removes all alternative routes added with displayRoutes(routes:) from the map.

    Declaration

    Swift

    func clearAlternativeRoutes()