GLRoute
Objective-C
@interface GLRoute : NSObject
Swift
class 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;
Swift
class func findInsertionIndex(_ point: UnsafeMutablePointer<GLMapPoint>, points: UnsafePointer<GLMapPoint>, pointsCount: Int) -> UInt
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;
Swift
func trackData(with trackColor: GLMapColor) -> GLMapTrackData?
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;
Swift
func trackData(callback colorBlock: @escaping GLMapTrackDataColorBlock) -> GLMapTrackData?
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;
Swift
func targetPoint(at index: UInt) -> GLRoutePoint
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;
Swift
var targetPointsCount: UInt { get }
-
Returns length of leg at given index
Declaration
Objective-C
- (double)lengthOfLeg:(NSUInteger)index;
Swift
func length(ofLeg index: UInt) -> Double
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;
Swift
func duration(ofLeg index: UInt) -> Double
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;
Swift
var legsCount: UInt { get }
-
Total length of route
Declaration
Objective-C
@property (readonly) double length;
Swift
var length: Double { get }
-
Estimated duration of the route
Declaration
Objective-C
@property (readonly) double duration;
Swift
var duration: Double { get }
-
Finds maneuver that go after given manuver
Declaration
Objective-C
- (GLRouteManeuver *_Nullable)getNextManeuver: (nonnull GLRouteManeuver *)maneuver;
Swift
func getNextManeuver(_ maneuver: GLRouteManeuver) -> GLRouteManeuver?
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;
Swift
func getPreviousManeuver(_ maneuver: GLRouteManeuver) -> GLRouteManeuver?
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;
Swift
func findNearestPoint(_ point: UnsafeMutablePointer<GLMapPoint>, height: UnsafeMutablePointer<CGFloat>)
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;
Swift
func enumManeuverPoints(_ maneuver: GLRouteManeuver, with block: @escaping GLRouteManeuverEnumPointsBlock)
Parameters
maneuver
Maneuver to enumerate
block
Enumerator block
-
Adds ‘In
’ before instruction Declaration
Objective-C
- (NSString *_Nullable)getApproachAlert:(nonnull NSString *)instruction distance:(double)distance;
Swift
func getApproachAlert(_ instruction: String, distance: Double) -> String?
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;
Swift
var allManeuvers: [GLRouteManeuver] { get }
-
Language of instructions in maneuvers
Declaration
Objective-C
@property (readonly) NSString *_Nullable language;
Swift
var language: String? { get }
-
Height data
Declaration
Objective-C
@property (readonly) GLRouteElevation *_Nullable heightData;
Swift
var heightData: GLRouteElevation? { get }
-
Alternative routes
Declaration
Objective-C
@property (readonly) NSArray<GLRoute *> *_Nullable alternates;
Swift
var alternates: [GLRoute]? { get }
-
Switch to alternative route
Declaration
Objective-C
- (void)switchToAlternative:(NSInteger)alternativeIndex;
Swift
func `switch`(toAlternative alternativeIndex: Int)
Parameters
alternativeIndex
index of alternative
-
Serialize all settings as json string.
Declaration
Objective-C
- (nonnull NSString *)toJSON;
Swift
func toJSON() -> String
Return Value
Returns json string with search settings.