NavigationContext

Objective-C


@interface NavigationContext : NSObject

Swift

class NavigationContext : NSObject

This class handles the navigation.

  • Initializes and returns a newly allocated object using the route preferences object.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPreferences:
        (nonnull RoutePreferencesObject *)preferences;

    Swift

    init(preferences: RoutePreferencesObject)
  • The delegate for the navigation contex.

    Declaration

    Objective-C

    @property (nonatomic, weak) NSObject<NavigationContextDelegate> *_Nullable delegate;

    Swift

    weak var delegate: (any NavigationContextDelegate)? { get set }
  • Returns the route preferences object.

    Declaration

    Objective-C

    - (nonnull RoutePreferencesObject *)getRoutePreferencesObject;

    Swift

    func getRoutePreferencesObject() -> RoutePreferencesObject
  • Calculate a route between the specified waypoints.

    Declaration

    Objective-C

    - (void)calculateRouteWithWaypoints:(nonnull NSArray<LandmarkObject *> *)array
                      completionHandler:
                          (nonnull void (^)(NSArray<RouteObject *> *_Nonnull))
                              handler;

    Swift

    func calculateRoute(withWaypoints array: [LandmarkObject]) async -> [RouteObject]

    Parameters

    array

    The list of waypoints.

    handler

    The block to execute asynchronously with the route results.

  • Calculate a route between the specified waypoints.

    Declaration

    Objective-C

    - (void)calculateRouteWithWaypoints:(nonnull NSArray<LandmarkObject *> *)array
                          statusHandler:(nonnull void (^)(RouteStatus))statusHandler
                      completionHandler:
                          (nonnull void (^)(NSArray<RouteObject *> *_Nonnull,
                                            SDKErrorCode))completionHandler;

    Swift

    func calculateRoute(withWaypoints array: [LandmarkObject], statusHandler: @escaping (RouteStatus) -> Void) async -> ([RouteObject], SDKErrorCode)

    Parameters

    array

    The list of waypoints.

    statusHandler

    The block to execute asynchronously with operation status.

    completionHandler

    The block to execute asynchronously with the route results.

  • Calculate a route between the specified waypoints and data buffer.

    Declaration

    Objective-C

    - (void)calculateRouteWithStartWaypoints:
                (nonnull NSArray<LandmarkObject *> *)startArray
                                      buffer:(nonnull NSData *)data
                                endWaypoints:
                                    (nonnull NSArray<LandmarkObject *> *)endArray
                           completionHandler:
                               (nonnull void (^)(NSArray<RouteObject *> *_Nonnull))
                                   handler;

    Swift

    func calculateRoute(withStartWaypoints startArray: [LandmarkObject], buffer data: Data, endWaypoints endArray: [LandmarkObject]) async -> [RouteObject]

    Parameters

    startArray

    The list of start waypoints.

    data

    The data waypoints.

    endArray

    The list of end waypoints.

    handler

    The block to execute asynchronously with the route results.

  • Cancel the route calculation.

    Declaration

    Objective-C

    - (void)cancelCalculateRoute;

    Swift

    func cancelCalculateRoute()
  • Check if there is route calculation in progress.

    Declaration

    Objective-C

    - (BOOL)isCalculatingRoute;

    Swift

    func isCalculatingRoute() -> Bool
  • Set a user road block from the provided route instruction.

    Declaration

    Objective-C

    - (SDKErrorCode)setRouteRoadBlock:(nonnull RouteInstructionObject *)object;

    Swift

    func setRouteRoadBlock(_ object: RouteInstructionObject) -> SDKErrorCode
  • Reset the user road blocks.

    Declaration

    Objective-C

    - (void)resetRouteRoadBlocks;

    Swift

    func resetRouteRoadBlocks()
  • Get data transfer statistics for this service.

    Declaration

    Objective-C

    - (nonnull TransferStatisticsContext *)getTransferStatistics;

    Swift

    func getTransferStatistics() -> TransferStatisticsContext
  • Get the current route used for navigation.

    Declaration

    Objective-C

    - (nullable RouteObject *)getNavigationRoute;

    Swift

    func getNavigationRoute() -> RouteObject?
  • Start a route simulation.

    Declaration

    Objective-C

    - (void)simulateWithRoute:(nonnull RouteObject *)route
              speedMultiplier:(float)speed
            completionHandler:(nonnull void (^)(BOOL))handler;

    Swift

    func simulate(withRoute route: RouteObject, speedMultiplier speed: Float) async -> Bool

    Parameters

    route

    The route object.

    speed

    The route simulation speed multiplier.

    handler

    The block to execute asynchronously with the result.

  • Cancel the route simulation.

    Declaration

    Objective-C

    - (void)cancelSimulateRoute;

    Swift

    func cancelSimulateRoute()
  • Start a route navigation.

    Declaration

    Objective-C

    - (void)navigateWithRoute:(nonnull RouteObject *)route
            completionHandler:(nonnull void (^)(BOOL))handler;

    Swift

    func navigate(withRoute route: RouteObject) async -> Bool

    Parameters

    route

    The route object.

    handler

    The block to execute asynchronously with the result.

  • Cancel the route navigation.

    Declaration

    Objective-C

    - (void)cancelNavigateRoute;

    Swift

    func cancelNavigateRoute()
  • Set a roadblock on the current route having the length specified in meters starting from the current GPS position.

    Declaration

    Objective-C

    - (void)setRoadBlockWithLength:(NSInteger)length;

    Swift

    func setRoadBlockWithLength(_ length: Int)

    Parameters

    length

    The length specified in meters.

  • Set a roadblock on the current route having the length and distance specified in meters.

    Declaration

    Objective-C

    - (void)setRoadBlockWithLength:(NSInteger)length starting:(NSInteger)distance;

    Swift

    func setRoadBlockWithLength(_ length: Int, starting distance: Int)

    Parameters

    length

    The length specified in meters.

    distance

    The distance from start where the roadblock begins, defaults to -1 meaning the current navigation position.

  • Returns the minimum simulation speed multiplier.

    Declaration

    Objective-C

    - (float)getSimulationMinSpeedMultiplier;

    Swift

    func getSimulationMinSpeedMultiplier() -> Float
  • Returns the maximum simulation speed multiplier.

    Declaration

    Objective-C

    - (float)getSimulationMaxSpeedMultiplier;

    Swift

    func getSimulationMaxSpeedMultiplier() -> Float
  • Returns the current navigation instruction.

    Declaration

    Objective-C

    - (nullable NavigationInstructionObject *)getNavigationInstruction;

    Swift

    func getNavigationInstruction() -> NavigationInstructionObject?
  • Skip next intermediate destination on the navigation route. @details If there are no more intermediate waypoints on the route, KNotFound is returned. @details The route will be recalculated and an navigationRouteUpdated notification will be thrown.

    Declaration

    Objective-C

    - (SDKErrorCode)skipNextIntermediateDestination;

    Swift

    func skipNextIntermediateDestination() -> SDKErrorCode
  • Returns true if there is an active navigation in progress.

    Declaration

    Objective-C

    - (BOOL)isNavigationActive;

    Swift

    func isNavigationActive() -> Bool
  • Returns true if there is an active simulation in progress.

    Declaration

    Objective-C

    - (BOOL)isSimulationActive;

    Swift

    func isSimulationActive() -> Bool
  • Returns the estimate time of arrival formatted.

    Declaration

    Objective-C

    - (nonnull NSString *)getEstimateTimeOfArrivalFormatted;

    Swift

    func getEstimateTimeOfArrivalFormatted() -> String
  • Returns the estimate time of arrival unit formatted.

    Declaration

    Objective-C

    - (nonnull NSString *)getEstimateTimeOfArrivalUnitFormatted;

    Swift

    func getEstimateTimeOfArrivalUnitFormatted() -> String
  • Returns the remaining travel time formatted.

    Declaration

    Objective-C

    - (nonnull NSString *)getRemainingTravelTimeFormatted;

    Swift

    func getRemainingTravelTimeFormatted() -> String
  • Returns the remaining travel time unit formatted.

    Declaration

    Objective-C

    - (nonnull NSString *)getRemainingTravelTimeUnitFormatted;

    Swift

    func getRemainingTravelTimeUnitFormatted() -> String
  • Returns the remaining travel distance formatted.

    Declaration

    Objective-C

    - (nonnull NSString *)getRemainingTravelDistanceFormatted;

    Swift

    func getRemainingTravelDistanceFormatted() -> String
  • Returns the remaining travel distance unit formatted.

    Declaration

    Objective-C

    - (nonnull NSString *)getRemainingTravelDistanceUnitFormatted;

    Swift

    func getRemainingTravelDistanceUnitFormatted() -> String