diff options
author | Jason Wray <jason@mapbox.com> | 2017-07-18 19:17:11 -0400 |
---|---|---|
committer | Jason Wray <jason@mapbox.com> | 2017-08-18 12:26:25 -0400 |
commit | cd36ec00bc44990df1bde02668e104307b30e7d2 (patch) | |
tree | e2ac0491e0cdedf3347a58602c3a965ecfc642ca /platform/darwin/src/MGLFeature.mm | |
parent | 1188707dc3ca6d88349d4bf323d03e3e93c0e548 (diff) | |
download | qtlocation-mapboxgl-cd36ec00bc44990df1bde02668e104307b30e7d2.tar.gz |
[ios] Add debug descriptions to shapes and features
Diffstat (limited to 'platform/darwin/src/MGLFeature.mm')
-rw-r--r-- | platform/darwin/src/MGLFeature.mm | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLFeature.mm b/platform/darwin/src/MGLFeature.mm index e169ee19bb..84f1a1ff25 100644 --- a/platform/darwin/src/MGLFeature.mm +++ b/platform/darwin/src/MGLFeature.mm @@ -42,6 +42,15 @@ MGL_DEFINE_FEATURE_IS_EQUAL(); return mbglFeature({[self geometryObject]}, identifier, self.attributes); } +- (NSString *)description +{ + return [NSString stringWithFormat:@"<%@: %p; identifier = %@, coordinate = %f, %f, attributes = %@>", + NSStringFromClass([self class]), (void *)self, + self.identifier ? [NSString stringWithFormat:@"\"%@\"", self.identifier] : self.identifier, + self.coordinate.latitude, self.coordinate.longitude, + self.attributes.count ? self.attributes : @"none"]; +} + @end @interface MGLPolylineFeature () @@ -68,6 +77,16 @@ MGL_DEFINE_FEATURE_IS_EQUAL(); return mbglFeature({[self geometryObject]}, identifier, self.attributes); } +- (NSString *)description +{ + return [NSString stringWithFormat:@"<%@: %p; identifier = %@, count = %lu, bounds = %@, attributes = %@>", + NSStringFromClass([self class]), (void *)self, + self.identifier ? [NSString stringWithFormat:@"\"%@\"", self.identifier] : self.identifier, + (unsigned long)[self pointCount], + MGLStringFromCoordinateBounds(self.overlayBounds), + self.attributes.count ? self.attributes : @"none"]; +} + @end @interface MGLPolygonFeature () @@ -94,6 +113,16 @@ MGL_DEFINE_FEATURE_IS_EQUAL(); return mbglFeature({[self geometryObject]}, identifier, self.attributes); } +- (NSString *)description +{ + return [NSString stringWithFormat:@"<%@: %p; identifier = %@, count = %lu, bounds = %@, attributes = %@>", + NSStringFromClass([self class]), (void *)self, + self.identifier ? [NSString stringWithFormat:@"\"%@\"", self.identifier] : self.identifier, + (unsigned long)[self pointCount], + MGLStringFromCoordinateBounds(self.overlayBounds), + self.attributes.count ? self.attributes : @"none"]; +} + @end @interface MGLPointCollectionFeature () @@ -146,6 +175,16 @@ MGL_DEFINE_FEATURE_IS_EQUAL(); return mbglFeature({[self geometryObject]}, identifier, self.attributes); } +- (NSString *)description +{ + return [NSString stringWithFormat:@"<%@: %p; identifier = %@, count = %lu, bounds = %@, attributes = %@>", + NSStringFromClass([self class]), (void *)self, + self.identifier ? [NSString stringWithFormat:@"\"%@\"", self.identifier] : self.identifier, + (unsigned long)self.polylines.count, + MGLStringFromCoordinateBounds(self.overlayBounds), + self.attributes.count ? self.attributes : @"none"]; +} + @end @interface MGLMultiPolygonFeature () @@ -172,6 +211,16 @@ MGL_DEFINE_FEATURE_IS_EQUAL(); return mbglFeature({[self geometryObject]}, identifier, self.attributes); } +- (NSString *)description +{ + return [NSString stringWithFormat:@"<%@: %p; identifier = %@, count = %lu, bounds = %@, attributes = %@>", + NSStringFromClass([self class]), (void *)self, + self.identifier ? [NSString stringWithFormat:@"\"%@\"", self.identifier] : self.identifier, + (unsigned long)self.polygons.count, + MGLStringFromCoordinateBounds(self.overlayBounds), + self.attributes.count ? self.attributes : @"none"]; +} + @end @interface MGLShapeCollectionFeature () |