Authored by Justin R. Miller

added tile debug labeling switch

... ... @@ -179,6 +179,38 @@
}
}
if (mapView.debugTiles)
{
UIGraphicsBeginImageContext(tileImage.size);
CGContextRef debugContext = UIGraphicsGetCurrentContext();
CGRect debugRect = CGRectMake(0, 0, tileImage.size.width, tileImage.size.height);
[tileImage drawInRect:debugRect];
CGColorRef color = CGColorCreateCopyWithAlpha([[UIColor redColor] CGColor], 0.25);
UIFont *font = [UIFont systemFontOfSize:36];
CGContextSetStrokeColorWithColor(debugContext, color);
CGContextSetLineWidth(debugContext, 5);
CGContextStrokeRect(debugContext, debugRect);
CGContextSetFillColorWithColor(debugContext, color);
NSString *debugString = [NSString stringWithFormat:@"%i,%i,%i", zoom, x, y];
CGSize debugSize = [debugString sizeWithFont:font];
[debugString drawInRect:CGRectMake(5, 5, debugSize.width, debugSize.height) withFont:font];
tileImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
[tileImage drawInRect:rect];
UIGraphicsPopContext();
... ...
... ... @@ -144,6 +144,8 @@ typedef enum {
/// subview for the background image displayed while tiles are loading.
@property (nonatomic, retain) UIView *backgroundView;
@property (nonatomic, assign) BOOL debugTiles;
#pragma mark -
#pragma mark Initializers
... ...
... ... @@ -118,6 +118,7 @@
@synthesize enableClustering, positionClusterMarkersAtTheGravityCenter, clusterMarkerSize, clusterAreaSize;
@synthesize adjustTilesForRetinaDisplay;
@synthesize missingTilesDepth;
@synthesize debugTiles;
#pragma mark -
#pragma mark Initialization
... ... @@ -1561,6 +1562,15 @@
return [[mercatorToTileProjection retain] autorelease];
}
- (void)setDebugTiles:(BOOL)shouldDebug;
{
debugTiles = shouldDebug;
tiledLayerView.layer.contents = nil;
[tiledLayerView.layer setNeedsDisplay];
}
#pragma mark -
#pragma mark LatLng/Pixel translation functions
... ...