SITRoute

Objective-C

@interface SITRoute : NSObject <SITMapperProtocol>

Swift

class SITRoute : NSObject, SITMapperProtocol

Route between two points. From and destination must be inside the same building.

Initializers

  • Constructor.

    Note

    You should not use this method. Instead you should user the route objects provided by SITDirectionsManager.

    Declaration

    Objective-C

    - (instancetype _Nonnull)initWithOrigin:(SITPoint *_Nonnull)origin
                                destination:(SITPoint *_Nonnull)destination
                              routeSegments:(NSArray *_Nonnull)routeSegments
                                 routeSteps:(NSArray *_Nonnull)routeSteps
                                indications:(NSArray *_Nonnull)indications
                                   distance:(float)distance
                                    options:(NSDictionary *_Nullable)options;

    Swift

    init(origin: SITPoint, destination: SITPoint, routeSegments: [Any], routeSteps: [Any], indications: [Any], distance: Float, options: [AnyHashable : Any]? = nil)

    Parameters

    origin

    from point.

    destination

    destination point.

    routeSegments

    segments to arrive from origin to destination.

    routeSteps

    steps to arrive from origin to destination.

    indications

    indications the user should follow to arrive from origin to destination.

    distance

    distance of the whole route

    options

    additional information of the route.

    Return Value

    initialized object.

  • Constructor.

    Note

    You should not use this method. Instead you should user the route objects provided by SITDirectionsManager.

    Declaration

    Objective-C

    - (instancetype _Nonnull)initWithOrigin:(SITPoint *_Nonnull)origin
                                destination:(SITPoint *_Nonnull)destination
                                      poiTo:(SITPOI *_Nonnull)poiTo
                              routeSegments:(NSArray *_Nonnull)routeSegments
                                 routeSteps:(NSArray *_Nonnull)routeSteps
                                indications:(NSArray *_Nonnull)indications
                                   distance:(float)distance
                                    options:(NSDictionary *_Nullable)options;

    Swift

    init(origin: SITPoint, destination: SITPoint, poiTo: SITPOI, routeSegments: [Any], routeSteps: [Any], indications: [Any], distance: Float, options: [AnyHashable : Any]? = nil)

    Parameters

    origin

    from point.

    destination

    destination point.

    poiTo

    destination POI, it can be null.

    routeSegments

    segments to arrive from origin to destination.

    routeSteps

    steps to arrive from origin to destination.

    indications

    indications the user should follow to arrive from origin to destination.

    distance

    distance of the whole route

    options

    additional information of the route.

    Return Value

    initialized object.

Properties

  • The initial point of the route.

    Declaration

    Objective-C

    @property (nonatomic, readonly) SITPoint *_Nonnull origin;

    Swift

    var origin: SITPoint { get }
  • The destination point of the route.

    Declaration

    Objective-C

    @property (nonatomic, readonly) SITPoint *_Nonnull destination;

    Swift

    var destination: SITPoint { get }
  • The destination POI of the route.

    Declaration

    Objective-C

    @property (nonatomic, readonly) SITPOI *_Nonnull poiTo;

    Swift

    var poiTo: SITPOI { get }
  • Parameters associated with the request. Use accessible key to see if the route has been

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSDictionary *_Nullable options;

    Swift

    var options: [AnyHashable : Any]? { get }
  • Steps of the route to arrive from origin to destination.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSArray *_Nonnull routeSteps;

    Swift

    var routeSteps: [Any] { get }
  • Indications to follow.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSArray *_Nonnull indications;

    Swift

    var indications: [Any] { get }
  • Returns list of ordered points of the route.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSArray<SITPoint *> *_Nonnull points;

    Swift

    var points: [SITPoint] { get }
  • The time interval since 1970 at which this route was created, expressed in milliseconds

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSTimeInterval timestamp;

    Swift

    var timestamp: TimeInterval { get }

Methods

  • Retrieve the indication for a particular step of the route.

    Declaration

    Objective-C

    - (SITIndication *_Nullable)indicationForStep:(SITRouteStep *_Nonnull)step;

    Swift

    func indication(for step: SITRouteStep) -> SITIndication?

    Parameters

    step

    step inside the route

    Return Value

    indication associated with the step (if valid step).

  • Retrieve the next indication for a particular step of the route.

    Declaration

    Objective-C

    - (SITIndication *_Nonnull)indicationForNextStep:(SITRouteStep *_Nonnull)step;

    Swift

    func indication(forNextStep step: SITRouteStep) -> SITIndication

    Parameters

    step

    step inside the route

    Return Value

    next indication associated with the step (if valid step).

  • Retrieve if the current route object has indications

    Declaration

    Objective-C

    - (BOOL)hasIndications;

    Swift

    func hasIndications() -> Bool

    Return Value

    true if this route has indications inside, false otherwise

  • Complete distance of the route.

    Declaration

    Objective-C

    - (float)distance;

    Swift

    func distance() -> Float

    Return Value

    distance of the route (meters).

  • Estimated time of the route.

    Declaration

    Objective-C

    - (float)timeToGoal;

    Swift

    func timeToGoal() -> Float

    Return Value

    time to the goal (seconds)

  • Return list of ordered points split by floor, each list contains points from one floor, but can have multiple lists of the same floor. Use this method to display segments in a map, each list should be a polyline. For example, if there is no path to go to the other side of the same floor and you need to go up one floor and then go down again to the original floor, this method will return one segment on the current floor, one segment on the upper floor and one more segment in the current floor. Drawing example: if you want to draw all the points of a floor, you should draw a polyline for each list that contains the floor you want to show.

    Declaration

    Objective-C

    - (NSArray<SITRouteSegment *> *_Nonnull)segments;

    Swift

    func segments() -> [SITRouteSegment]

    Return Value

    Return list of ordered points split by floor.