summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLPointAnnotation.mm
blob: ce8e4a2355a72239fc8ae007aa70304fc8f909d7 (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
26
27
28
29
30
31
32
33
34
#import "MGLPointAnnotation.h"

#import "MGLShape_Private.h"

#import <mbgl/util/geometry.hpp>


@implementation MGLPointAnnotation

@synthesize coordinate;

- (NSString *)description
{
    return [NSString stringWithFormat:@"<%@: %p; title = %@; subtitle = %@; coordinate = %f, %f>",
            NSStringFromClass([self class]), (void *)self,
            self.title ? [NSString stringWithFormat:@"\"%@\"", self.title] : self.title,
            self.subtitle ? [NSString stringWithFormat:@"\"%@\"", self.subtitle] : self.subtitle,
            coordinate.latitude, coordinate.longitude];
}

- (NSDictionary *)geoJSONDictionary
{
    return @{@"type": @"Point",
             @"coordinates": @[@(self.coordinate.longitude), @(self.coordinate.latitude)]};
}

- (mbgl::Feature)featureObject
{
    mbgl::Point<double> point = { self.coordinate.longitude, self.coordinate.latitude };
    return mbgl::Feature {point};
}

@end