CachedTileOverlay
open class CachedTileOverlay : MKTileOverlay
Whenever a tile is requested by the MapView
, it calls the MKTileOverlay.loadTile
.
This class overrides the default MKTileOverlay
to provide support to MapCache
.
See also
MkMapView+MapCache
-
A class that implements the
MapCacheProtocol
Declaration
Swift
let mapCache: MapCacheProtocol
-
If true
loadTile
uses the implementation of themapCache
var. Iffalse
, uses the defaultMKTileOverlay
implementation from Apple.Declaration
Swift
public var useCache: Bool
-
Constructor.
Declaration
Swift
public init(withCache cache: MapCacheProtocol)
Parameters
withCache
the cache to be used on
loadTile
-
Generates the URL for the tile to be requested. It replaces the values of {z},{x} and {y} in the
urlTemplate
defined inmapCache.config
Declaration
Swift
override public func url(forTilePath path: MKTileOverlayPath) -> URL
-
Tells whether or not to upsample and show a lesser detailed z level takes into account
useZoom
configuration as well as current andmaximumZ
valuesDeclaration
Swift
func shouldZoom(at scale: MKZoomScale) -> Bool
-
Given the maximum zoom level for the tileset
(mapCache.config.maximumZ
) it will return the tile, map rects, and additional scaling factor for upscaling tiles.Declaration
Swift
func tilesInMapRect(rect: MKMapRect, scale: MKZoomScale) -> [ZoomableTile]
Parameters
rect
map rectangle for which we want to get the tile set
scale
current zoom scale