RouteActions

public protocol RouteActions

Protocol allowing management of the route representation on the map.

  • Method to add a route on the map.

    Throws

    LayerServiceError.failedToCreateAnnotationLayer if it fails to create a given route layer.

    Example:

     let routeOption: RouteOptions = RouteOptions(coordinates: route.geometry)
     guard let mapRoute = try? self.mapView.map.addRoute(routeOption) else { return }
    

    Declaration

    Swift

    func addRoute(_ options: RouteOptions) throws -> Route

    Parameters

    options

    object RouteOptions

    Return Value

    Route object used for further manipulation.

  • Method to remove a route from the map.

    Declaration

    Swift

    func removeRoute(_ route: Route)

    Parameters

    route

    Route object created by func addRoute(_ options: RouteOptions) throws -> Route.

  • Method to remove all routes from the map.

    Declaration

    Swift

    func removeRoutes()
  • Method to move a route to the highest Z position.

    Declaration

    Swift

    func bringToFront(route: Route)

    Parameters

    route

    Route object created by func addRoute(_ options: RouteOptions) throws -> Route.

  • Method to zoom and center to all routes currently visible on the map, including padding. Padding centers the start coordinates, end coordinates and location chevron inside the mapview.

    Declaration

    Swift

    func zoomToRoutes(padding: UInt)

    Parameters

    padding

    Padding from the edges of the map.

  • Method to access all visible routes on the map.

    Declaration

    Swift

    var allRoutes: [Route] { get }