[ios] Add debug descriptions to shapes and features
This commit is contained in:
@@ -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 ()
|
||||
|
||||
@@ -200,4 +200,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.polygons.count,
|
||||
MGLStringFromCoordinateBounds(self.overlayBounds)];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -201,4 +201,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
|
||||
|
||||
Reference in New Issue
Block a user