summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLPolyline+MGLAdditions.m
blob: e91e4fc192058e966308d6ffcbffadee818562dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//
//  MGLPolyline+MGLPolyline_MGLAdditions.m
//  ios
//
//  Created by Mapbox on 9/30/16.
//  Copyright © 2016 Mapbox. All rights reserved.
//

#import "MGLPolyline+MGLAdditions.h"

@implementation MGLPolyline (MGLAdditions)

- (NS_ARRAY_OF(id) *)mgl_coordinates {
    
    NS_MUTABLE_ARRAY_OF(NS_ARRAY_OF(NSNumber *) *) *coordinates = [NSMutableArray array];
    
    for (NSUInteger index = 0; index < self.pointCount; index++) {
        CLLocationCoordinate2D coordinate = self.coordinates[index];
        [coordinates addObject:@[@(coordinate.longitude), @(coordinate.latitude)]];
    }
    
    return coordinates;
}

@end