diff --git a/docs/Classes.html b/docs/Classes.html index b799fce..400c72a 100644 --- a/docs/Classes.html +++ b/docs/Classes.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + +
  • +
    + + + + CachedTileOverlayRenderer + +
    +
    +
    +
    +
    +
    +

    A Tile overlay that supports to zoom beyond the maximumZ

    + +

    Tile servers allow from 1 to a certain zoom level typically between 16 and 21 (set in MapCacheConfig.maximumZ). +Beyond that zoom levels tiles are not available in the server

    + +

    This renderer takes the maximumZ tile and extracts the portion that would correspond to the requested level.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    class CachedTileOverlayRenderer : MKTileOverlayRenderer
    + +
    +
    +
    +
    +
  • @@ -503,7 +545,7 @@

    Declaration

    diff --git a/docs/Classes/CachedTileOverlay.html b/docs/Classes/CachedTileOverlay.html index 7fd4864..6b2b08c 100644 --- a/docs/Classes/CachedTileOverlay.html +++ b/docs/Classes/CachedTileOverlay.html @@ -42,6 +42,9 @@
  • + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + +
  • +
    + + + + shouldZoom(at:) + +
    +
    +
    +
    +
    +
    +

    Tells whether or not to upsample and show a lesser detailed z level +takes into account useZoom configuration as well as current and maximumZ values

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func shouldZoom(at scale: MKZoomScale) -> Bool
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + tilesInMapRect(rect:scale:) + +
    +
    +
    +
    +
    +
    +

    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

    +
    +
    +
    +
    +
    +
  • diff --git a/docs/Classes/CachedTileOverlayRenderer.html b/docs/Classes/CachedTileOverlayRenderer.html new file mode 100644 index 0000000..ddf2d86 --- /dev/null +++ b/docs/Classes/CachedTileOverlayRenderer.html @@ -0,0 +1,323 @@ + + + + CachedTileOverlayRenderer Class Reference + + + + + + + + + + + + + +
    +
    +

    MapCache 0.7.0 Docs (100% documented)

    +

    View on GitHub

    +

    +

    + +
    +

    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    CachedTileOverlayRenderer

    +
    +
    + +
    class CachedTileOverlayRenderer : MKTileOverlayRenderer
    + +
    +
    +

    A Tile overlay that supports to zoom beyond the maximumZ

    + +

    Tile servers allow from 1 to a certain zoom level typically between 16 and 21 (set in MapCacheConfig.maximumZ). +Beyond that zoom levels tiles are not available in the server

    + +

    This renderer takes the maximumZ tile and extracts the portion that would correspond to the requested level.

    + +
    +
    +
    +
      +
    • +
      + + + + canDraw(_:zoomScale:) + +
      +
      +
      +
      +
      +
      +

      Indicates if the renderer is ready to draw. It´s always true

      +
      +

      See also

      + MKOverlayRenderer + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      override func canDraw(_ mapRect: MKMapRect, zoomScale: MKZoomScale) -> Bool
      + +
      +
      +
      +
      +
    • +
    • +
      + + + + draw(_:zoomScale:in:) + +
      +
      +
      +
      +
      +
      +

      Draws the tile in the map

      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      override func draw(_ mapRect: MKMapRect, zoomScale: MKZoomScale, in context: CGContext)
      + +
      +
      +
      +

      Parameters

      + + + + + + + + + + + +
      + + mapRect + + +
      +

      the map rect where the tiles need to be drawn

      +
      +
      + + zoomScale + + +
      +

      current zoom in the map

      +
      +
      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + + diff --git a/docs/Classes/CachedTileOverlayZoomRenderer.html b/docs/Classes/CachedTileOverlayZoomRenderer.html new file mode 100644 index 0000000..39c152e --- /dev/null +++ b/docs/Classes/CachedTileOverlayZoomRenderer.html @@ -0,0 +1,287 @@ + + + + CachedTileOverlayZoomRenderer Class Reference + + + + + + + + + + + + + +
    +
    +

    MapCache 0.7.0 Docs (100% documented)

    +

    View on GitHub

    +

    +

    + +
    +

    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    CachedTileOverlayZoomRenderer

    +
    +
    + +
    class CachedTileOverlayZoomRenderer : MKTileOverlayRenderer
    + +
    +
    +

    A Tile overlay that supports to zoom

    + +
    +
    +
    +
      +
    • +
      + + + + canDraw(_:zoomScale:) + +
      +
      +
      +
      +
      +
      +

      Indicates if the renderer is ready to draw. It´s always true

      +
      +

      See also

      + MKOverlayRenderer + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      override func canDraw(_ mapRect: MKMapRect, zoomScale: MKZoomScale) -> Bool
      + +
      +
      +
      +
      +
    • +
    • +
      + + + + draw(_:zoomScale:in:) + +
      +
      +
      +
      +
      +
      +

      Draws the tile in the map

      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      override func draw(_ mapRect: MKMapRect, zoomScale: MKZoomScale, in context: CGContext)
      + +
      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + + diff --git a/docs/Classes/DiskCache.html b/docs/Classes/DiskCache.html index a28ab03..e98fd0f 100644 --- a/docs/Classes/DiskCache.html +++ b/docs/Classes/DiskCache.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + @@ -448,7 +490,7 @@

    Declaration

    -

    Get the path for key

    +

    Get the path for key.

    @@ -475,8 +517,8 @@

    Declaration

    -

    Sets the data for the key asyncronously -Use this function for writing into the cache

    +

    Sets the data for the key asyncronously. +Use this function for writing into the cache.

    @@ -503,7 +545,7 @@

    Declaration

    -

    Sets the data for the key synchronously

    +

    Sets the data for the key synchronously.

    @@ -530,7 +572,7 @@

    Declaration

    -

    Fetches the image data from storage synchronously

    +

    Fetches the image data from storage synchronously.

    @@ -541,6 +583,49 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + forKey + + +
    +

    Key within the cache

    +
    +
    + + failure + + +
    +

    closure to be run in case of error

    +
    +
    + + success + + +
    +

    closure to be run once the data is ready

    +
    +
    +
    @@ -557,7 +642,7 @@

    Declaration

    -

    Removes asynchronously the data from the diskcache for the key passed as argument

    +

    Removes asynchronously the data from the diskcache for the key passed as argument.

    @@ -568,6 +653,25 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + +
    + + withKey + + +
    +

    key to be removed

    +
    +
    +
    @@ -584,8 +688,8 @@

    Declaration

    -

    Removes asynchronously all data from the cache -Calls completition closure once the task is done

    +

    Removes asynchronously all data from the cache. +Calls completition closure once the task is done.

    @@ -596,6 +700,25 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + +
    + + completition + + +
    +

    closure run once all the files are deleted from the cache

    +
    +
    +
    @@ -669,7 +792,7 @@

    Declaration

    -

    Calculates the size used by all the files in the cache

    +

    Calculates the size used by all the files in the cache.

    @@ -764,7 +887,7 @@

    Declaration

    -

    Removes a file syncrhonously

    +

    Removes a file syncrhonously.

    @@ -791,8 +914,8 @@

    Declaration

    -

    Substracts from the cachesize the disk size passed as parameter -Logs an error message if the amount to be substracted is larger than the current used disk space

    +

    Substracts from the cachesize the disk size passed as parameter. +Logs an error message if the amount to be substracted is larger than the current used disk space.

    @@ -803,6 +926,25 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + +
    + + diskSize + + +
    +

    disksize to be deducted

    +
    +
    +
    @@ -811,7 +953,7 @@

    Declaration

    diff --git a/docs/Classes/HashBase.html b/docs/Classes/HashBase.html index fb293ea..69335c9 100644 --- a/docs/Classes/HashBase.html +++ b/docs/Classes/HashBase.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + @@ -361,7 +389,14 @@

    Declaration

    -

    For the path passed as argument it creates a unique key to be used in diskCache.

    +

    For the path passed as argument it creates a unique key to be used in DiskCache.

    + +

    The output is a string that has the following format {config.urlTemplate}-{x}-{y}-{z} where:

    + +
    @@ -372,6 +407,25 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + +
    + + forPath + + +
    +

    is the path of the tile you want the cache

    +
    +
    +
    @@ -404,6 +458,49 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + at + + +
    +

    Path for the tile

    +
    +
    + + failure + + +
    +

    if the tile cannot be retrieved from the server this closure is called

    +
    +
    + + success + + +
    +

    if the image is downloaded

    +
    +
    +
    @@ -421,10 +518,10 @@

    Declaration

    Returns the tile to be displayed on the overlay. -The strategy used to retrieve the tile (i.e. from network or from the diskCache) depends on the config.loadTileMode.

    +The strategy used to retrieve the tile (i.e. from network or from the diskCache) depends on the config.loadTileMode.

    See also

    -

    LoadTileMode

    +

    LoadTileMode

    @@ -480,7 +577,12 @@

    Declaration

    -

    Calculate size of the cache

    +

    Calculates the disk space allocated in dis for the cache

    +
    +

    See also

    + DiskCache + +
    @@ -508,7 +610,7 @@

    Declaration

    Clears the cache. -Removes all files in the diskCache +Removes all files in the diskCache As it may take some time to remove all files it calls the completition closure upon finishing the removal.

    @@ -520,6 +622,25 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + +
    + + completition + + +
    +

    code to run upon the cache is cleared.

    +
    +
    +
    @@ -528,7 +649,7 @@

    Declaration

    diff --git a/docs/Classes/RegionDownloader.html b/docs/Classes/RegionDownloader.html index 8e2c0cb..e472b9c 100644 --- a/docs/Classes/RegionDownloader.html +++ b/docs/Classes/RegionDownloader.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + @@ -782,7 +822,7 @@

    Declaration

    -

    Resets downloader counters

    +

    Resets downloader counters.

    @@ -809,7 +849,7 @@

    Declaration

    -

    Starts download

    +

    Starts download.

    @@ -856,7 +896,7 @@

    Declaration

    diff --git a/docs/Classes/TileCoords.html b/docs/Classes/TileCoords.html index 0a2fed3..8ae23f6 100644 --- a/docs/Classes/TileCoords.html +++ b/docs/Classes/TileCoords.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + +
  • +
    + + + + MKZoomScale + +
    +
    +
    +
    +
    +
    +

    Extension for MapCache

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    extension MKZoomScale
    + +
    +
    +
    +
    +
  • diff --git a/docs/Extensions/FileManager.html b/docs/Extensions/FileManager.html index dd5330c..cd013a4 100644 --- a/docs/Extensions/FileManager.html +++ b/docs/Extensions/FileManager.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + @@ -303,7 +369,7 @@

    Declaration

    diff --git a/docs/Extensions/FileManager/allocatedDiskSizeForDirectory(at:).html b/docs/Extensions/FileManager/allocatedDiskSizeForDirectory(at:).html index e75cfcc..3da9967 100644 --- a/docs/Extensions/FileManager/allocatedDiskSizeForDirectory(at:).html +++ b/docs/Extensions/FileManager/allocatedDiskSizeForDirectory(at:).html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ +
  • - + - useCache(_:) + useCache(_:)
    @@ -222,7 +231,12 @@

    MKMapView

    -

    Will tell the map to use the cache passed as parameter.

    +

    Will tell the map to use the cache passed as parameter for getting the tiles.

    +
    +

    See also

    +

    Readme

    + +
    @@ -230,10 +244,29 @@

    Declaration

    Swift

    @discardableResult
    -public func useCache(_ cache: MapCache) -> CachedTileOverlay
    +public func useCache(_ cache: MapCacheProtocol) -> CachedTileOverlay
    +
    +

    Parameters

    + + + + + + + +
    + + cache + + +
    +

    A cache that implements the MapCacheProtocol. Typically an instance of MapCache

    +
    +
    +
  • @@ -283,7 +316,8 @@

    Declaration

    -

    Returns current zoom level

    +

    TODO: Implement this correctly. +Returns current zoom level

    @@ -302,7 +336,7 @@

    Declaration

    diff --git a/docs/Extensions/MKTileOverlayPath.html b/docs/Extensions/MKTileOverlayPath.html index a4a5990..b66c2a6 100644 --- a/docs/Extensions/MKTileOverlayPath.html +++ b/docs/Extensions/MKTileOverlayPath.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + @@ -244,7 +272,7 @@

    Declaration

    -

    Returns the tile overlay path as a TileCoords object.

    +

    Returns the tile overlay path as a TileCoords object.

    @@ -263,7 +291,7 @@

    Declaration

    diff --git a/docs/Extensions/MKZoomScale.html b/docs/Extensions/MKZoomScale.html new file mode 100644 index 0000000..9280358 --- /dev/null +++ b/docs/Extensions/MKZoomScale.html @@ -0,0 +1,278 @@ + + + + MKZoomScale Extension Reference + + + + + + + + + + + + + +
    +
    +

    MapCache 0.7.0 Docs (100% documented)

    +

    View on GitHub

    +

    +

    + +
    +

    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    MKZoomScale

    +
    +
    + +
    extension MKZoomScale
    + +
    +
    +

    Extension for MapCache

    + +
    +
    +
    +
      +
    • + +
      +
      +
      +
      +
      +

      Converts from standard MapKit MKZoomScale to tile zoom level

      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      func toZoomLevel(tileSize: CGSize) -> Int
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + tileSize + + +
      +

      current map tile size in pixels. Typically set in MapCacheConfig

      +
      +
      +
      +
      +

      Return Value

      +

      Corresponding zoom level for a tile

      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + + diff --git a/docs/Extensions/NSMutableData.html b/docs/Extensions/NSMutableData.html index 8420eb3..ecf44ab 100644 --- a/docs/Extensions/NSMutableData.html +++ b/docs/Extensions/NSMutableData.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + +
  • +
    + + + + ZoomableTile + +
    +
    +
    +
    +
    +
    +

    Specifies a single tile and area of the tile that should upscaled.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    struct ZoomableTile
    + +
    +
    +
    +
    +
  • diff --git a/docs/Structs/BytesSequence.html b/docs/Structs/BytesSequence.html index f2045b7..e19fd32 100644 --- a/docs/Structs/BytesSequence.html +++ b/docs/Structs/BytesSequence.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + @@ -312,7 +364,7 @@

    Declaration

    Log.debug("Hello world") // prints: [MapCache][DEBUG] Hello word
     
    -

    These messages are displayed only if DEBUG is defined

    +

    These messages are displayed only if DEBUG is defined.

    @@ -323,6 +375,37 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + + + + + +
    + + message + + +
    +

    message to display

    +
    +
    + + error + + +
    +

    error to display if any.

    +
    +
    +
    @@ -340,13 +423,11 @@

    Declaration

    These messages are displayed independently of the debug mode. - Used to provide useful information on exceptional situations to library users. - Example:

    -
     Log.error("Could not download tile", error) // prints: [MapCache][ERROR] Could not download tile with error No internet connection.
    +Used  to provide useful information on exceptional situations to library users.
    +Example:

    +
    Log.error("Could not download tile", error) // prints: [MapCache][ERROR] Could not download tile with error No internet connection.
     
    -

    

    -

    Declaration

    @@ -356,6 +437,37 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + + + + + +
    + + message + + +
    +

    message to display

    +
    +
    + + error + + +
    +

    error to display

    +
    +
    +
    @@ -364,7 +476,7 @@

    Declaration

    diff --git a/docs/Structs/Log/Level.html b/docs/Structs/Log/Level.html index 59d41bc..ec2b880 100644 --- a/docs/Structs/Log/Level.html +++ b/docs/Structs/Log/Level.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + +
  • +
    + + + + minimumZ + +
    +
    +
    +
    +
    +
    +

    It must be smaller or equal than maximumZ

    + +

    Default value is 0.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var minimumZ: Int
    + +
    +
    +
    +
    +
  • @@ -293,17 +331,16 @@

    Declaration

    Maximum supported zoom by the tile server

    -

    If the tile server supported zoom is smaller than maximumZ tiles won’t be rendered as a HTTP 404 error -will be returned by the server for not supported zoom levels.

    +

    Tiles with a z zoom beyond maximumZ supported by the tile server will return a HTTP 404 error.

    Values vary from server to server. For example OpenStreetMap supports 19, but OpenCycleMap supports 22

    -

    Default value: 19. If 0 or negative is set iOS default value (i.e. 21)

    +
    @@ -320,9 +357,9 @@

    Declaration

  • - - - minimumZ + + + overZoomMaximumZ
    @@ -330,16 +367,17 @@

    Declaration

    -

    It must be smaller or equal than maximumZ

    +

    If set to true when zooming in beyond maximumZ the tiles at maximumZ will be upsampled and shown. +This mitigates the issue of showing an empty map when zooming in beyond maximumZ.

    -

    Default value is 0.

    +

    maximumZ is vital to zoom working, make sure it is properly set.

    Declaration

    Swift

    -
    public var minimumZ: Int
    +
    public var overZoomMaximumZ: Bool
    @@ -448,7 +486,7 @@

    Declaration

    By default loads from the cache and if it fails loads from the server

    See also

    - LoadTileMode + LoadTileMode
    @@ -504,12 +542,7 @@

    Declaration

    -

    Constructor that overwrites the urlTemplate

    -
    -

    See also

    -

    MapCacheConfig.urlTemplate

    - -
    +

    Constructor that overwrites the urlTemplate`

    @@ -520,6 +553,25 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + +
    + + withUrlTemplate + + +
    +

    is the string of the urlTemplate

    +
    +
    +
  • @@ -612,7 +664,7 @@

    Declaration

    diff --git a/docs/Structs/TileRange.html b/docs/Structs/TileRange.html index e695c06..ddf1b09 100644 --- a/docs/Structs/TileRange.html +++ b/docs/Structs/TileRange.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + +
  • + +
    +
    +
    +
    +
    +

    A Tile overlay that supports to zoom beyond the maximumZ

    + +

    Tile servers allow from 1 to a certain zoom level typically between 16 and 21 (set in MapCacheConfig.maximumZ). +Beyond that zoom levels tiles are not available in the server

    + +

    This renderer takes the maximumZ tile and extracts the portion that would correspond to the requested level.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    class CachedTileOverlayRenderer : MKTileOverlayRenderer
    + +
    +
    +
    +
    +
  • @@ -503,7 +545,7 @@

    Declaration

    diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/CachedTileOverlay.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/CachedTileOverlay.html index 7fd4864..6b2b08c 100644 --- a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/CachedTileOverlay.html +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/CachedTileOverlay.html @@ -42,6 +42,9 @@
  • + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + +
  • +
    + + + + shouldZoom(at:) + +
    +
    +
    +
    +
    +
    +

    Tells whether or not to upsample and show a lesser detailed z level +takes into account useZoom configuration as well as current and maximumZ values

    + +
    +
    +

    Declaration

    +
    +

    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

    +
    +
    +
    +
    +
    +
  • diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/CachedTileOverlayRenderer.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/CachedTileOverlayRenderer.html new file mode 100644 index 0000000..ddf2d86 --- /dev/null +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/CachedTileOverlayRenderer.html @@ -0,0 +1,323 @@ + + + + CachedTileOverlayRenderer Class Reference + + + + + + + + + + + + + +
    +
    +

    MapCache 0.7.0 Docs (100% documented)

    +

    View on GitHub

    +

    +

    + +
    +

    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    CachedTileOverlayRenderer

    +
    +
    + +
    class CachedTileOverlayRenderer : MKTileOverlayRenderer
    + +
    +
    +

    A Tile overlay that supports to zoom beyond the maximumZ

    + +

    Tile servers allow from 1 to a certain zoom level typically between 16 and 21 (set in MapCacheConfig.maximumZ). +Beyond that zoom levels tiles are not available in the server

    + +

    This renderer takes the maximumZ tile and extracts the portion that would correspond to the requested level.

    + +
    +
    +
    +
      +
    • +
      + + + + canDraw(_:zoomScale:) + +
      +
      +
      +
      +
      +
      +

      Indicates if the renderer is ready to draw. It´s always true

      +
      +

      See also

      + MKOverlayRenderer + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      override func canDraw(_ mapRect: MKMapRect, zoomScale: MKZoomScale) -> Bool
      + +
      +
      +
      +
      +
    • +
    • +
      + + + + draw(_:zoomScale:in:) + +
      +
      +
      +
      +
      +
      +

      Draws the tile in the map

      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      override func draw(_ mapRect: MKMapRect, zoomScale: MKZoomScale, in context: CGContext)
      + +
      +
      +
      +

      Parameters

      + + + + + + + + + + + +
      + + mapRect + + +
      +

      the map rect where the tiles need to be drawn

      +
      +
      + + zoomScale + + +
      +

      current zoom in the map

      +
      +
      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + + diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/CachedTileOverlayZoomRenderer.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/CachedTileOverlayZoomRenderer.html new file mode 100644 index 0000000..39c152e --- /dev/null +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/CachedTileOverlayZoomRenderer.html @@ -0,0 +1,287 @@ + + + + CachedTileOverlayZoomRenderer Class Reference + + + + + + + + + + + + + +
    +
    +

    MapCache 0.7.0 Docs (100% documented)

    +

    View on GitHub

    +

    +

    + +
    +

    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    CachedTileOverlayZoomRenderer

    +
    +
    + +
    class CachedTileOverlayZoomRenderer : MKTileOverlayRenderer
    + +
    +
    +

    A Tile overlay that supports to zoom

    + +
    +
    +
    +
      +
    • +
      + + + + canDraw(_:zoomScale:) + +
      +
      +
      +
      +
      +
      +

      Indicates if the renderer is ready to draw. It´s always true

      +
      +

      See also

      + MKOverlayRenderer + +
      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      override func canDraw(_ mapRect: MKMapRect, zoomScale: MKZoomScale) -> Bool
      + +
      +
      +
      +
      +
    • +
    • +
      + + + + draw(_:zoomScale:in:) + +
      +
      +
      +
      +
      +
      +

      Draws the tile in the map

      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      override func draw(_ mapRect: MKMapRect, zoomScale: MKZoomScale, in context: CGContext)
      + +
      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + + diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/DiskCache.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/DiskCache.html index a28ab03..e98fd0f 100644 --- a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/DiskCache.html +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/DiskCache.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + @@ -448,7 +490,7 @@

    Declaration

    -

    Get the path for key

    +

    Get the path for key.

    @@ -475,8 +517,8 @@

    Declaration

    -

    Sets the data for the key asyncronously -Use this function for writing into the cache

    +

    Sets the data for the key asyncronously. +Use this function for writing into the cache.

    @@ -503,7 +545,7 @@

    Declaration

    -

    Sets the data for the key synchronously

    +

    Sets the data for the key synchronously.

    @@ -530,7 +572,7 @@

    Declaration

    -

    Fetches the image data from storage synchronously

    +

    Fetches the image data from storage synchronously.

    @@ -541,6 +583,49 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + forKey + + +
    +

    Key within the cache

    +
    +
    + + failure + + +
    +

    closure to be run in case of error

    +
    +
    + + success + + +
    +

    closure to be run once the data is ready

    +
    +
    +
    @@ -557,7 +642,7 @@

    Declaration

    -

    Removes asynchronously the data from the diskcache for the key passed as argument

    +

    Removes asynchronously the data from the diskcache for the key passed as argument.

    @@ -568,6 +653,25 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + +
    + + withKey + + +
    +

    key to be removed

    +
    +
    +
    @@ -584,8 +688,8 @@

    Declaration

    -

    Removes asynchronously all data from the cache -Calls completition closure once the task is done

    +

    Removes asynchronously all data from the cache. +Calls completition closure once the task is done.

    @@ -596,6 +700,25 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + +
    + + completition + + +
    +

    closure run once all the files are deleted from the cache

    +
    +
    +
    @@ -669,7 +792,7 @@

    Declaration

    -

    Calculates the size used by all the files in the cache

    +

    Calculates the size used by all the files in the cache.

    @@ -764,7 +887,7 @@

    Declaration

    -

    Removes a file syncrhonously

    +

    Removes a file syncrhonously.

    @@ -791,8 +914,8 @@

    Declaration

    -

    Substracts from the cachesize the disk size passed as parameter -Logs an error message if the amount to be substracted is larger than the current used disk space

    +

    Substracts from the cachesize the disk size passed as parameter. +Logs an error message if the amount to be substracted is larger than the current used disk space.

    @@ -803,6 +926,25 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + +
    + + diskSize + + +
    +

    disksize to be deducted

    +
    +
    +
    @@ -811,7 +953,7 @@

    Declaration

    diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/HashBase.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/HashBase.html index fb293ea..69335c9 100644 --- a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/HashBase.html +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/HashBase.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + @@ -361,7 +389,14 @@

    Declaration

    -

    For the path passed as argument it creates a unique key to be used in diskCache.

    +

    For the path passed as argument it creates a unique key to be used in DiskCache.

    + +

    The output is a string that has the following format {config.urlTemplate}-{x}-{y}-{z} where:

    + +
      +
    • config.urlTemplate is the template url template and
    • +
    • x, y and z are the coords of the path

    • +
    @@ -372,6 +407,25 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + +
    + + forPath + + +
    +

    is the path of the tile you want the cache

    +
    +
    +
    @@ -404,6 +458,49 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + at + + +
    +

    Path for the tile

    +
    +
    + + failure + + +
    +

    if the tile cannot be retrieved from the server this closure is called

    +
    +
    + + success + + +
    +

    if the image is downloaded

    +
    +
    +
    @@ -421,10 +518,10 @@

    Declaration

    Returns the tile to be displayed on the overlay. -The strategy used to retrieve the tile (i.e. from network or from the diskCache) depends on the config.loadTileMode.

    +The strategy used to retrieve the tile (i.e. from network or from the diskCache) depends on the config.loadTileMode.

    See also

    -

    LoadTileMode

    +

    LoadTileMode

    @@ -480,7 +577,12 @@

    Declaration

    -

    Calculate size of the cache

    +

    Calculates the disk space allocated in dis for the cache

    +
    +

    See also

    + DiskCache + +
    @@ -508,7 +610,7 @@

    Declaration

    Clears the cache. -Removes all files in the diskCache +Removes all files in the diskCache As it may take some time to remove all files it calls the completition closure upon finishing the removal.

    @@ -520,6 +622,25 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + +
    + + completition + + +
    +

    code to run upon the cache is cleared.

    +
    +
    +
    @@ -528,7 +649,7 @@

    Declaration

    diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/RegionDownloader.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/RegionDownloader.html index 8e2c0cb..e472b9c 100644 --- a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/RegionDownloader.html +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/RegionDownloader.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + @@ -782,7 +822,7 @@

    Declaration

    -

    Resets downloader counters

    +

    Resets downloader counters.

    @@ -809,7 +849,7 @@

    Declaration

    -

    Starts download

    +

    Starts download.

    @@ -856,7 +896,7 @@

    Declaration

    diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/TileCoords.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/TileCoords.html index 0a2fed3..8ae23f6 100644 --- a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/TileCoords.html +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Classes/TileCoords.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + +
  • +
    + + + + MKZoomScale + +
    +
    +
    +
    +
    +
    +

    Extension for MapCache

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    extension MKZoomScale
    + +
    +
    +
    +
    +
  • diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/FileManager.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/FileManager.html index dd5330c..cd013a4 100644 --- a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/FileManager.html +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/FileManager.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + @@ -303,7 +369,7 @@

    Declaration

    diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/FileManager/allocatedDiskSizeForDirectory(at:).html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/FileManager/allocatedDiskSizeForDirectory(at:).html index e75cfcc..3da9967 100644 --- a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/FileManager/allocatedDiskSizeForDirectory(at:).html +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/FileManager/allocatedDiskSizeForDirectory(at:).html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ +
  • @@ -222,7 +231,12 @@

    MKMapView

    -

    Will tell the map to use the cache passed as parameter.

    +

    Will tell the map to use the cache passed as parameter for getting the tiles.

    +
    +

    See also

    +

    Readme

    + +
    @@ -230,10 +244,29 @@

    Declaration

    Swift

    @discardableResult
    -public func useCache(_ cache: MapCache) -> CachedTileOverlay
    +public func useCache(_ cache: MapCacheProtocol) -> CachedTileOverlay
    +
    +

    Parameters

    + + + + + + + +
    + + cache + + +
    +

    A cache that implements the MapCacheProtocol. Typically an instance of MapCache

    +
    +
    +
  • @@ -283,7 +316,8 @@

    Declaration

    -

    Returns current zoom level

    +

    TODO: Implement this correctly. +Returns current zoom level

    @@ -302,7 +336,7 @@

    Declaration

    diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/MKTileOverlayPath.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/MKTileOverlayPath.html index a4a5990..b66c2a6 100644 --- a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/MKTileOverlayPath.html +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/MKTileOverlayPath.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + @@ -244,7 +272,7 @@

    Declaration

    -

    Returns the tile overlay path as a TileCoords object.

    +

    Returns the tile overlay path as a TileCoords object.

    @@ -263,7 +291,7 @@

    Declaration

    diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/MKZoomScale.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/MKZoomScale.html new file mode 100644 index 0000000..9280358 --- /dev/null +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/MKZoomScale.html @@ -0,0 +1,278 @@ + + + + MKZoomScale Extension Reference + + + + + + + + + + + + + +
    +
    +

    MapCache 0.7.0 Docs (100% documented)

    +

    View on GitHub

    +

    +

    + +
    +

    +
    +
    +
    + +
    +
    + +
    +
    +
    +

    MKZoomScale

    +
    +
    + +
    extension MKZoomScale
    + +
    +
    +

    Extension for MapCache

    + +
    +
    +
    +
      +
    • + +
      +
      +
      +
      +
      +

      Converts from standard MapKit MKZoomScale to tile zoom level

      + +
      +
      +

      Declaration

      +
      +

      Swift

      +
      func toZoomLevel(tileSize: CGSize) -> Int
      + +
      +
      +
      +

      Parameters

      + + + + + + + +
      + + tileSize + + +
      +

      current map tile size in pixels. Typically set in MapCacheConfig

      +
      +
      +
      +
      +

      Return Value

      +

      Corresponding zoom level for a tile

      +
      +
      +
      +
    • +
    +
    +
    +
    + +
    +
    + + + diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/NSMutableData.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/NSMutableData.html index 8420eb3..ecf44ab 100644 --- a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/NSMutableData.html +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Extensions/NSMutableData.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + +
  • +
    + + + + ZoomableTile + +
    +
    +
    +
    +
    +
    +

    Specifies a single tile and area of the tile that should upscaled.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    struct ZoomableTile
    + +
    +
    +
    +
    +
  • diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Structs/BytesSequence.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Structs/BytesSequence.html index f2045b7..e19fd32 100644 --- a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Structs/BytesSequence.html +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Structs/BytesSequence.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + @@ -312,7 +364,7 @@

    Declaration

    Log.debug("Hello world") // prints: [MapCache][DEBUG] Hello word
     
    -

    These messages are displayed only if DEBUG is defined

    +

    These messages are displayed only if DEBUG is defined.

    @@ -323,6 +375,37 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + + + + + +
    + + message + + +
    +

    message to display

    +
    +
    + + error + + +
    +

    error to display if any.

    +
    +
    +
    @@ -340,13 +423,11 @@

    Declaration

    These messages are displayed independently of the debug mode. - Used to provide useful information on exceptional situations to library users. - Example:

    -
     Log.error("Could not download tile", error) // prints: [MapCache][ERROR] Could not download tile with error No internet connection.
    +Used  to provide useful information on exceptional situations to library users.
    +Example:

    +
    Log.error("Could not download tile", error) // prints: [MapCache][ERROR] Could not download tile with error No internet connection.
     
    -

    

    -

    Declaration

    @@ -356,6 +437,37 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + + + + + +
    + + message + + +
    +

    message to display

    +
    +
    + + error + + +
    +

    error to display

    +
    +
    +
    @@ -364,7 +476,7 @@

    Declaration

    diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Structs/Log/Level.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Structs/Log/Level.html index 59d41bc..ec2b880 100644 --- a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Structs/Log/Level.html +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Structs/Log/Level.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + +
  • +
    + + + + minimumZ + +
    +
    +
    +
    +
    +
    +

    It must be smaller or equal than maximumZ

    + +

    Default value is 0.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var minimumZ: Int
    + +
    +
    +
    +
    +
  • @@ -293,17 +331,16 @@

    Declaration

    Maximum supported zoom by the tile server

    -

    If the tile server supported zoom is smaller than maximumZ tiles won’t be rendered as a HTTP 404 error -will be returned by the server for not supported zoom levels.

    +

    Tiles with a z zoom beyond maximumZ supported by the tile server will return a HTTP 404 error.

    Values vary from server to server. For example OpenStreetMap supports 19, but OpenCycleMap supports 22

    -

    Default value: 19. If 0 or negative is set iOS default value (i.e. 21)

    +
    @@ -320,9 +357,9 @@

    Declaration

  • @@ -330,16 +367,17 @@

    Declaration

    -

    It must be smaller or equal than maximumZ

    +

    If set to true when zooming in beyond maximumZ the tiles at maximumZ will be upsampled and shown. +This mitigates the issue of showing an empty map when zooming in beyond maximumZ.

    -

    Default value is 0.

    +

    maximumZ is vital to zoom working, make sure it is properly set.

    Declaration

    Swift

    -
    public var minimumZ: Int
    +
    public var overZoomMaximumZ: Bool
    @@ -448,7 +486,7 @@

    Declaration

    By default loads from the cache and if it fails loads from the server

    See also

    - LoadTileMode + LoadTileMode
    @@ -504,12 +542,7 @@

    Declaration

    -

    Constructor that overwrites the urlTemplate

    -
    -

    See also

    -

    MapCacheConfig.urlTemplate

    - -
    +

    Constructor that overwrites the urlTemplate`

    @@ -520,6 +553,25 @@

    Declaration

    +
    +

    Parameters

    + + + + + + + +
    + + withUrlTemplate + + +
    +

    is the string of the urlTemplate

    +
    +
    +
  • @@ -612,7 +664,7 @@

    Declaration

    diff --git a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Structs/TileRange.html b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Structs/TileRange.html index e695c06..ddf1b09 100644 --- a/docs/docsets/MapCache.docset/Contents/Resources/Documents/Structs/TileRange.html +++ b/docs/docsets/MapCache.docset/Contents/Resources/Documents/Structs/TileRange.html @@ -42,6 +42,9 @@ + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -103,6 +106,9 @@ + @@ -172,6 +178,9 @@ + + @@ -102,6 +105,9 @@ + @@ -171,6 +177,9 @@ + + @@ -102,6 +105,9 @@ + @@ -171,6 +177,9 @@ +