...
|
...
|
@@ -20,6 +20,7 @@ |
|
|
@implementation RMMapTiledLayerView
|
|
|
|
|
|
@synthesize delegate;
|
|
|
@synthesize useSnapshotRenderer;
|
|
|
|
|
|
+ (Class)layerClass
|
|
|
{
|
...
|
...
|
@@ -42,6 +43,8 @@ |
|
|
self.multipleTouchEnabled = YES;
|
|
|
self.opaque = NO;
|
|
|
|
|
|
self.useSnapshotRenderer = NO;
|
|
|
|
|
|
CATiledLayer *tiledLayer = [self tiledLayer];
|
|
|
tiledLayer.levelsOfDetail = [[mapView tileSource] maxZoom];
|
|
|
tiledLayer.levelsOfDetailBias = [[mapView tileSource] maxZoom];
|
...
|
...
|
@@ -87,21 +90,7 @@ |
|
|
|
|
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
|
|
|
|
if (zoom == (short)ceilf(mapView.adjustedZoomForRetinaDisplay))
|
|
|
{
|
|
|
int x = floor(rect.origin.x / rect.size.width),
|
|
|
y = floor(fabs(rect.origin.y / rect.size.height));
|
|
|
|
|
|
// NSLog(@"Tile @ x:%d, y:%d, zoom:%d", x, y, zoom);
|
|
|
|
|
|
UIGraphicsPushContext(context);
|
|
|
|
|
|
UIImage *tileImage = [[mapView tileSource] imageForTile:RMTileMake(x, y, zoom) inCache:[mapView tileCache]];
|
|
|
[tileImage drawInRect:rect];
|
|
|
|
|
|
UIGraphicsPopContext();
|
|
|
}
|
|
|
else // Probably due to renderInContext:
|
|
|
if (self.useSnapshotRenderer)
|
|
|
{
|
|
|
zoom = (short)ceilf(mapView.adjustedZoomForRetinaDisplay);
|
|
|
CGFloat rectSize = bounds.size.width / powf(2.0, (float)zoom);
|
...
|
...
|
@@ -126,6 +115,20 @@ |
|
|
|
|
|
UIGraphicsPopContext();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
int x = floor(rect.origin.x / rect.size.width),
|
|
|
y = floor(fabs(rect.origin.y / rect.size.height));
|
|
|
|
|
|
// NSLog(@"Tile @ x:%d, y:%d, zoom:%d", x, y, zoom);
|
|
|
|
|
|
UIGraphicsPushContext(context);
|
|
|
|
|
|
UIImage *tileImage = [[mapView tileSource] imageForTile:RMTileMake(x, y, zoom) inCache:[mapView tileCache]];
|
|
|
[tileImage drawInRect:rect];
|
|
|
|
|
|
UIGraphicsPopContext();
|
|
|
}
|
|
|
|
|
|
[pool release]; pool = nil;
|
|
|
}
|
...
|
...
|
|