diff options
Diffstat (limited to 'platform/darwin/src/MGLPolyline.mm')
-rw-r--r-- | platform/darwin/src/MGLPolyline.mm | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLPolyline.mm b/platform/darwin/src/MGLPolyline.mm index fd75dc2795..e011d09215 100644 --- a/platform/darwin/src/MGLPolyline.mm +++ b/platform/darwin/src/MGLPolyline.mm @@ -1,9 +1,9 @@ -#import "MGLPolyline.h" +#import "MGLPolyline_Private.h" #import "MGLMultiPoint_Private.h" #import "MGLGeometry_Private.h" -#import "MGLPolyline+MGLAdditions.h" +#import "MGLFeature.h" #import <mbgl/util/geojson.hpp> #import <mapbox/polylabel.hpp> @@ -49,6 +49,15 @@ @"coordinates": self.mgl_coordinates}; } +- (NS_ARRAY_OF(id) *)mgl_coordinates { + NSMutableArray *coordinates = [[NSMutableArray alloc] initWithCapacity:self.pointCount]; + for (NSUInteger index = 0; index < self.pointCount; index++) { + CLLocationCoordinate2D coordinate = self.coordinates[index]; + [coordinates addObject:@[@(coordinate.longitude), @(coordinate.latitude)]]; + } + return [coordinates copy]; +} + - (BOOL)isEqual:(id)other { return self == other || ([other isKindOfClass:[MGLPolyline class]] && [super isEqual:other]); } @@ -201,4 +210,14 @@ @"coordinates": coordinates}; } +- (NSString *)description +{ + return [NSString stringWithFormat:@"<%@: %p; title = %@, subtitle: = %@, count = %lu; bounds = %@>", + NSStringFromClass([self class]), (void *)self, + self.title ? [NSString stringWithFormat:@"\"%@\"", self.title] : self.title, + self.subtitle ? [NSString stringWithFormat:@"\"%@\"", self.subtitle] : self.subtitle, + (unsigned long)self.polylines.count, + MGLStringFromCoordinateBounds(self.overlayBounds)]; +} + @end |