SPDirectionsManager

@interface SPDirectionsManager : NSObject

Used for calculating directions between GPS points. To use this class you need to have a Steerpath API access token and provide it to the app according to the instructions in SPAccountManager.h.

Requires internet access to download directions data. After data is downloaded, directions can be used while offline.

Currently only works for routes inside indoor areas.

More detailed descriptions:

Routes are calculated based on a network of possible paths that can be taken. In this network, different route types are marked, such as elevators, escalators and even buses and trains. Each different type is assigned two different costs, a cost to enter it and a cost along it.

While cost is an abstract concept, for simplicity, cost in routing can be thought of as time spent, so the cost to enter is the time spent waiting and the cost along is the time it will take to walk a given length of on the path: e.g. the time spent waiting for an elevato and the time spent moving whilst on an elevator. However these costs are not the same as the estimated travel time shown to users. The reason why they differ is that in some cases a route segment may need to be made more or less attractive without affecting the shown estimated time. For example walking past a some waste disposal area may be a fast route, but one that should generally not be used unless the user is very near by.

The current default costs are as follows:

Elevator: 20 to enter, 0.5 per meter Stairs: 0 to enter, 3.0 per meter Escalator: 0 to enter, 3.0 per meter Train, bus: 10 to enter, 0.4 per meter

For the time estimation a much more simple system is currently used. This system estimates pedestrian movement to happen at 1 meter per second on average.

  • Declaration

    Objective-C

    + (nonnull instancetype)sharedInstance;

    Swift

    class func sharedInstance() -> Self

    Return Value

    singleton instance of SPDirectionsManager

  • Unavailable

    call sharedInstance instead

    unavailable method, do not use

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • If this is enabled, SPDirectionsManager will attempt to use wheelchair accessible paths when calculating a route. Wheelchair accessible routes will avoid stairs and escalators when possible.

    By default NO

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL useAccessibleNavigation;

    Swift

    var useAccessibleNavigation: Bool { get set }
  • Fetch directions between two or more points.

    Destinations are not concatenated. Directions/routes will be calculated individually from start to each end location.

    Declaration

    Objective-C

    - (void)getDirectionsWithRequest:(nonnull SPDirectionsRequest *)request
                          completion:(nullable void (^)(
                                         SPDirectionsResponse *_Nullable,
                                         NSError *_Nullable))completionBlock;

    Swift

    func getDirectionsWith(_ request: SPDirectionsRequest, completion completionBlock: ((SPDirectionsResponse?, Error?) -> Void)? = nil)

    Parameters

    request

    contains information about locations for route

    completionBlock

    called when directions have been calculated

  • Loads directions data from a local file.

    Declaration

    Objective-C

    - (void)read:(nonnull NSString *)filePath
        completion:(nullable void (^)(BOOL))completionBlock;

    Swift

    func read(_ filePath: String, completion completionBlock: ((Bool) -> Void)? = nil)

    Parameters

    filePath

    local filesystem filepath

    completionBlock

    called when reading is done

  • Generates errors based on type

    Declaration

    Objective-C

    + (nonnull NSError *)errorForType:(SPDirectionsErrorType)type;

    Swift

    class func error(for type: SPDirectionsErrorType) -> Error

    Parameters

    type

    directions error type

    Return Value

    error new instance