Authored by Justin R. Miller

fixes #494: bring back v4 tiles including 512px for retina

... ... @@ -2498,7 +2498,7 @@
{
tileSourcesMinZoom = ceilf(tileSourcesMinZoom) - 0.99;
if ( ! self.adjustTilesForRetinaDisplay && _screenScale > 1.0)
if ( ! self.adjustTilesForRetinaDisplay && _screenScale > 1.0 && ! [RMMapboxSource isUsingLargeTiles])
tileSourcesMinZoom -= 1.0;
[self setMinZoom:tileSourcesMinZoom];
... ... @@ -2525,7 +2525,7 @@
{
tileSourcesMaxZoom = floorf(tileSourcesMaxZoom);
if ( ! self.adjustTilesForRetinaDisplay && _screenScale > 1.0)
if ( ! self.adjustTilesForRetinaDisplay && _screenScale > 1.0 && ! [RMMapboxSource isUsingLargeTiles])
tileSourcesMaxZoom -= 1.0;
[self setMaxZoom:tileSourcesMaxZoom];
... ... @@ -2558,7 +2558,7 @@
{
float zoom = ceilf(_zoom);
if ( ! self.adjustTilesForRetinaDisplay && _screenScale > 1.0)
if ( ! self.adjustTilesForRetinaDisplay && _screenScale > 1.0 && ! [RMMapboxSource isUsingLargeTiles])
zoom += 1.0;
return zoom;
... ... @@ -2568,7 +2568,7 @@
{
tileSourcesZoom = floorf(tileSourcesZoom);
if ( ! self.adjustTilesForRetinaDisplay && _screenScale > 1.0)
if ( ! self.adjustTilesForRetinaDisplay && _screenScale > 1.0 && ! [RMMapboxSource isUsingLargeTiles])
tileSourcesZoom -= 1.0;
[self setZoom:tileSourcesZoom];
... ... @@ -2634,7 +2634,7 @@
- (float)adjustedZoomForRetinaDisplay
{
if (!self.adjustTilesForRetinaDisplay && _screenScale > 1.0)
if (!self.adjustTilesForRetinaDisplay && _screenScale > 1.0 && ! [RMMapboxSource isUsingLargeTiles])
return [self zoom] + 1.0;
return [self zoom];
... ...
... ... @@ -139,6 +139,8 @@ typedef enum : NSUInteger {
* Note that you may want to clear the tile cache after changing this value in order to provide a consistent experience. */
@property (nonatomic, assign) RMMapboxSourceQuality imageQuality;
+ (BOOL)isUsingLargeTiles;
#if OS_OBJECT_USE_OBJC
@property (nonatomic, readonly, strong) dispatch_queue_t dataQueue;
#else
... ...
... ... @@ -83,7 +83,8 @@
if ([_infoDictionary[@"id"] hasPrefix:@"examples."])
RMLog(@"Using watermarked example map ID %@. Please go to https://mapbox.com and create your own map style.", _infoDictionary[@"id"]);
_uniqueTilecacheKey = [NSString stringWithFormat:@"Mapbox-%@%@", _infoDictionary[@"id"], (_infoDictionary[@"version"] ? [@"-" stringByAppendingString:_infoDictionary[@"version"]] : @"")];
_uniqueTilecacheKey = [NSString stringWithFormat:@"Mapbox-%@%@%@", _infoDictionary[@"id"], (_infoDictionary[@"version"] ? [@"-" stringByAppendingString:_infoDictionary[@"version"]] : @""),
([RMMapboxSource isUsingLargeTiles] ? @"-512" : @"")];
id dataObject = nil;
... ... @@ -355,11 +356,21 @@
return roundf(([self maxZoom] + [self minZoom]) / 2);
}
+ (BOOL)isUsingLargeTiles
{
return ([[RMConfiguration configuration] accessToken] && [[UIScreen mainScreen] scale] > 1.0);
}
- (NSString *)uniqueTilecacheKey
{
return _uniqueTilecacheKey;
}
- (NSUInteger)tileSideLength
{
return ([RMMapboxSource isUsingLargeTiles] ? 512 : kMapboxDefaultTileSize);
}
- (NSString *)shortName
{
return self.infoDictionary[@"name"];
... ...