[ios] Add description strings to constituent classes
This commit is contained in:
@@ -80,7 +80,7 @@ NS_INLINE BOOL MGLCoordinateBoundsIsEmpty(MGLCoordinateBounds bounds) {
|
||||
|
||||
/** Returns a formatted string for the given coordinate bounds. */
|
||||
NS_INLINE NSString *MGLStringFromCoordinateBounds(MGLCoordinateBounds bounds) {
|
||||
return [NSString stringWithFormat:@"{{%.1f, %.1f}, {%.1f, %.1f}}",
|
||||
return [NSString stringWithFormat:@"{ sw = {%.1f, %.1f}, ne = {%.1f, %.1f}}",
|
||||
bounds.sw.latitude, bounds.sw.longitude,
|
||||
bounds.ne.latitude, bounds.ne.longitude];
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@ %p centerCoordinate:%f, %f altitude:%.0fm heading:%.0f° pitch:%.0f°>",
|
||||
return [NSString stringWithFormat:@"<%@: %p; centerCoordinate = %f, %f; altitude = %.0fm; heading = %.0f°; pitch = %.0f°>",
|
||||
NSStringFromClass([self class]), (void *)self, _centerCoordinate.latitude, _centerCoordinate.longitude, _altitude, _heading, _pitch];
|
||||
}
|
||||
|
||||
|
||||
@@ -128,4 +128,10 @@ mbgl::Color MGLColorObjectFromCGColorRef(CGColorRef cgColor) {
|
||||
return mbgl::ShapeAnnotation::Properties();
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@: %p; count = %lu; bounds = %@>",
|
||||
NSStringFromClass([self class]), (void *)self, (unsigned long)_count, MGLStringFromCoordinateBounds(_bounds)];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -4,4 +4,13 @@
|
||||
|
||||
@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];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -71,4 +71,16 @@ NS_ASSUME_NONNULL_END
|
||||
return (_title ? _title : @"You Are Here");
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@: %p; location = %f, %f; updating = %@; altitude = %.0fm; heading = %.0f°; title = %@; subtitle = %@>",
|
||||
NSStringFromClass([self class]), (void *)self,
|
||||
self.location.coordinate.latitude, self.location.coordinate.longitude,
|
||||
self.updating ? @"yes" : @"no",
|
||||
self.location.altitude,
|
||||
self.heading.trueHeading,
|
||||
self.title ? [NSString stringWithFormat:@"\"%@\"", self.title] : self.title,
|
||||
self.subtitle ? [NSString stringWithFormat:@"\"%@\"", self.subtitle] : self.subtitle];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user