GLRoute


@interface GLRoute : NSObject

Class to load route data

  • Finds index where given point must be inserted to array of reference points. It’s used, for example, to add waypoint to route.

    Declaration

    Objective-C

    + (NSUInteger)findInsertionIndex:(nonnull GLMapPoint *)point
                              points:(nonnull const GLMapPoint *)points
                         pointsCount:(NSInteger)pointsCount;

    Parameters

    point

    At input defines point to insert. At output contains point that is located on route.

    points

    Array of reference GLMapPoints

    pointsCount

    Number of points in array

    Return Value

    NSNotFound if given point is too far from track.

  • Returns track data that can be used to display track of route

    Declaration

    Objective-C

    - (GLMapTrackData *_Nullable)trackDataWithColor:(GLMapColor)trackColor;

    Parameters

    trackColor

    color of route track

    Return Value

    track data of route

  • Returns track data that can be used to display track of route

    Declaration

    Objective-C

    - (GLMapTrackData *_Nullable)trackDataWithCallback:
        (nonnull GLMapTrackDataColorBlock)colorBlock;

    Parameters

    colorBlock

    block to generate gradient

    Return Value

    track data of route

  • Returns route target point at given index

    Declaration

    Objective-C

    - (GLRoutePoint)targetPointAtIndex:(NSUInteger)index;

    Parameters

    index

    Index of point in range [0 … targetPointsCount)

    Return Value

    target point t given index

  • Number of refrence points in route

    Declaration

    Objective-C

    @property (readonly) NSUInteger targetPointsCount;
  • Returns length of leg at given index

    Declaration

    Objective-C

    - (double)lengthOfLeg:(NSUInteger)index;

    Parameters

    index

    Index of point in range [0 … legsCount)

    Return Value

    length of leg at given index

  • Returns duration of leg at given index

    Declaration

    Objective-C

    - (double)durationOfLeg:(NSUInteger)index;

    Parameters

    index

    Index of point in range [0 … legsCount)

    Return Value

    duration of leg at given index

  • Number of legs

    Declaration

    Objective-C

    @property (readonly) NSUInteger legsCount;
  • Total length of route

    Declaration

    Objective-C

    @property (readonly) double length;
  • Estimated duration of the route

    Declaration

    Objective-C

    @property (readonly) double duration;
  • Finds maneuver that go after given manuver

    Declaration

    Objective-C

    - (GLRouteManeuver *_Nullable)getNextManeuver:
        (nonnull GLRouteManeuver *)maneuver;

    Parameters

    maneuver

    refrence maneuver

    Return Value

    next maneuver of the route

  • Finds maneuver that go before given manuver

    Declaration

    Objective-C

    - (GLRouteManeuver *_Nullable)getPreviousManeuver:
        (nonnull GLRouteManeuver *)maneuver;

    Parameters

    maneuver

    refrence maneuver

    Return Value

    previous maneuver of the route

  • Finds nearest point on route

    Declaration

    Objective-C

    - (void)findNearestPoint:(nonnull GLMapPoint *)point
                      height:(nonnull CGFloat *)height;

    Parameters

    point

    on input contains refrence point. on output contains nearest point

    height

    height in result point or NAN if heightData is nil

  • Enumerates points in maneuver

    Declaration

    Objective-C

    - (void)enumManeuverPoints:(nonnull GLRouteManeuver *)maneuver
                     withBlock:(nonnull GLRouteManeuverEnumPointsBlock)block;

    Parameters

    maneuver

    Maneuver to enumerate

    block

    Enumerator block

  • Adds ‘In ’ before instruction

    Declaration

    Objective-C

    - (NSString *_Nullable)getApproachAlert:(nonnull NSString *)instruction
                                   distance:(double)distance;

    Parameters

    instruction

    Instruction text

    distance

    in meters

    Return Value

    Instruction with approach alert

  • All maneuvers of the route

    Declaration

    Objective-C

    @property (readonly) NSArray<GLRouteManeuver *> *_Nonnull allManeuvers;
  • Language of instructions in maneuvers

    Declaration

    Objective-C

    @property (readonly) NSString *_Nullable language;
  • Height data

    Declaration

    Objective-C

    @property (readonly) GLRouteElevation *_Nullable heightData;
  • Alternative routes

    Declaration

    Objective-C

    @property (readonly) NSArray<GLRoute *> *_Nullable alternates;
  • Switch to alternative route

    Declaration

    Objective-C

    - (void)switchToAlternative:(NSInteger)alternativeIndex;

    Parameters

    alternativeIndex

    index of alternative