[ios] Add description strings to constituent classes

This commit is contained in:
Jason Wray
2016-03-10 03:56:47 -05:00
parent d03e87fa4d
commit 64b163ee5d
5 changed files with 29 additions and 2 deletions

View File

@@ -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];
}

View File

@@ -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];
}

View File

@@ -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

View File

@@ -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

View File

@@ -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