MQShape
@interface MQShape : NSObject
An object that describes the shape of a specific route. Used to draw polylines as overlays on a map
-
Coordinate array count
Declaration
Objective-C
- (NSUInteger)coordinateCount;
Swift
func coordinateCount() -> UInt
Return Value
Coordinate array count
-
A C-style array of coordinates that defines route shape
Declaration
Objective-C
- (CLLocationCoordinate2D *_Nonnull)coordinates;
Swift
func coordinates() -> UnsafeMutablePointer<CLLocationCoordinate2D>
Return Value
Pointer to the array
-
Coordinate at a given Index on the route
Declaration
Objective-C
- (CLLocationCoordinate2D)coordinateAtIndex:(NSUInteger)index;
Swift
func coordinate(at index: UInt) -> CLLocationCoordinate2D
Parameters
index
Index on the route
Return Value
Coordinate at the index in route shape array
-
Coordinate at a given position on the route
Declaration
Objective-C
- (CLLocationCoordinate2D)coordinateAtPosition: (MQNavigationRoutePosition)position;
Swift
func coordinate(atPosition position: MQNavigationRoutePosition) -> CLLocationCoordinate2D
Parameters
position
Position on the route
Return Value
location Coordinate of the position on the route
-
Calculates distance from an index to an other index
Declaration
Objective-C
- (CLLocationDistance) distanceFromPosition:(MQNavigationRoutePosition)fromPosition toPosition:(MQNavigationRoutePosition)toPosition;
Swift
func distance(fromPosition: MQNavigationRoutePosition, toPosition: MQNavigationRoutePosition) -> CLLocationDistance
Parameters
fromPosition
From position
toPosition
To position
Return Value
distance
-
Find the closest position on the route shape to a given coordinate
Declaration
Objective-C
- (void) closestPositionOnRouteToCoordinate:(CLLocationCoordinate2D)coordinate handler:(void (^_Nonnull)(CLLocationCoordinate2D, MQNavigationRoutePosition)) handler;
Swift
func closestPositionOnRoute(to coordinate: CLLocationCoordinate2D, handler: @escaping (CLLocationCoordinate2D, MQNavigationRoutePosition) -> Void)
Parameters
coordinate
Coordinate to start with
handler
Handler block that will be called synchronously with coordinate of closest point on the shape and position of the location on the shape array