diff options
Diffstat (limited to 'platform/darwin/src/MGLPointAnnotation.mm')
-rw-r--r-- | platform/darwin/src/MGLPointAnnotation.mm | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLPointAnnotation.mm b/platform/darwin/src/MGLPointAnnotation.mm new file mode 100644 index 0000000000..ce8e4a2355 --- /dev/null +++ b/platform/darwin/src/MGLPointAnnotation.mm @@ -0,0 +1,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 + |