TTRouteManager

Objective-C

@protocol TTRouteManager <NSObject>

Swift

protocol TTRouteManager : NSObjectProtocol

TTRouteManager class to manage interactions with drawing routes on the map.

  • Array of routes that are present on the map.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSArray<TTMapRoute *> *_Nonnull routes;

    Swift

    var routes: [TTMapRoute] { get }
  • Draws a new route on the map.

    Declaration

    Objective-C

    - (void)addRoute:(TTMapRoute *_Nonnull)route;

    Swift

    func add(_ route: TTMapRoute)

    Parameters

    route

    The TTMapRoute object.

  • Public Preview

    This is under Public Preview and subject to change by the end of 2022.02. More information is available at: https://developer.tomtom.com/public-preview

    Draw the traffic on the route.

    Declaration

    Objective-C

    - (void)showTrafficOnRoute:(TTMapRoute *_Nonnull)route
                   withStyling:
                       (NSDictionary<TTRouteTrafficStyle *,
                                     NSArray<TTTrafficData *> *> *_Nonnull)style;

    Swift

    func showTraffic(on route: TTMapRoute, withStyling style: [TTRouteTrafficStyle : [TTTrafficData]])

    Parameters

    route

    The TTMapRoute object.

    style

    Dictionary objects of TTRouteTrafficStyle as the key and array with TTTrafficData as values.

  • Public Preview

    This is under Public Preview and subject to change by the end of 2022.02. More information is available at: https://developer.tomtom.com/public-preview

    Hides traffic on the route.

    Declaration

    Objective-C

    - (void)hideTrafficFromRoute:(TTMapRoute *_Nonnull)route;

    Swift

    func hideTraffic(from route: TTMapRoute)

    Parameters

    route

    The TTMapRoute object.

  • Public Preview

    This is under Public Preview and subject to change by the end of 2022.02. More information is available at: https://developer.tomtom.com/public-preview

    Activates the progress displaying along the route. NOTE: This method itself will not display anything. updateProgressAlongTheRoute needs to be called to update the current progress state and display it with the specified style.

    Declaration

    Objective-C

    - (void)activateProgressAlongTheRoute:(TTMapRoute *_Nonnull)route
                              withStyling:(TTMapRouteStyleLayer *_Nonnull)style;

    Swift

    func activateProgress(alongTheRoute route: TTMapRoute, withStyling style: TTMapRouteStyleLayer)

    Parameters

    route

    The TTMapRoute object.

    style

    Style representing attributes of multiple line layers rendered on top of the route with progress.

  • Public Preview

    This is under Public Preview and subject to change by the end of 2022.02. More information is available at: https://developer.tomtom.com/public-preview

    Deactivates the progress displaying along the route.

    Declaration

    Objective-C

    - (void)deactivateProgressAlongTheRoute:(TTMapRoute *_Nonnull)route;

    Swift

    func deactivateProgress(alongTheRoute route: TTMapRoute)

    Parameters

    route

    The TTMapRoute object.

  • Public Preview

    This is under Public Preview and subject to change by the end of 2022.02. More information is available at: https://developer.tomtom.com/public-preview

    Updates the state of progress along the specified route. NOTE: activateProgressAlongTheRoute needs to be called first to be able to update the current progress along the specified route.

    Declaration

    Objective-C

    - (void)updateProgressAlongTheRoute:(TTMapRoute *_Nonnull)route
                         withTTLocation:(id)location;

    Swift

    func updateProgress(alongTheRoute route: TTMapRoute, withTTLocation location: Any!)

    Parameters

    route

    The TTMapRoute object.

    location

    The TTLocation object.

  • Removes a given route from the map. Throws an exception if the route was not previously added to the map.

    Declaration

    Objective-C

    - (void)removeRoute:(TTMapRoute *_Nonnull)route;

    Swift

    func remove(_ route: TTMapRoute)

    Parameters

    route

    The TTMapRoute object.

  • Changes the style for a given route.

    Declaration

    Objective-C

    - (void)updateRoute:(TTMapRoute *_Nonnull)route
                  style:(TTMapRouteStyle *_Nonnull)style;

    Swift

    func update(_ route: TTMapRoute, style: TTMapRouteStyle)

    Parameters

    route

    The TTMapRoute object.

    style

    The TTMapRouteStyle object.

  • Changes the z-index of the route to present it on top of others. Crashes when the route is not attached to the map.

    Declaration

    Objective-C

    - (void)bringToFrontRoute:(TTMapRoute *_Nonnull)route;

    Swift

    func bring(toFrontRoute route: TTMapRoute)

    Parameters

    route

    The TTMapRoute object.

  • Removes all routes from the map.

    Declaration

    Objective-C

    - (void)removeAllRoutes;

    Swift

    func removeAllRoutes()
  • Finds best zoom level and bounding box to present the given route. Throws an exception if the route was not previously added to the map.

    Declaration

    Objective-C

    - (void)showRouteOverview:(TTMapRoute *_Nonnull)route;

    Swift

    func showRouteOverview(_ route: TTMapRoute)

    Parameters

    route

    The TTMapRoute object.

  • Finds the best zoom level and bounding box to present all routes that are added to the map.

    Declaration

    Objective-C

    - (void)showAllRoutesOverview;

    Swift

    func showAllRoutesOverview()