Classes

The following classes are available globally.

  • Whenever a tile is requested by the MapView, it calls the MKTileOverlay.loadTile. This class overrides the default MKTileOverlayto provide support to MapCache.

    See also

    MkMapView+MapCache
    See more

    Declaration

    Swift

    open class CachedTileOverlay : MKTileOverlay
  • 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

    open class CachedTileOverlayRenderer : MKTileOverlayRenderer
  • A specialized cache for storing data in disk. Based on Haneke Disk Cache and customized for the MapCache project.

    See more

    Declaration

    Swift

    open class DiskCache
  • HashBase The following is an altered source version that only includes MD5. The original software can be found at: https://github.com/krzyzanowskim/CryptoSwift

    See more

    Declaration

    Swift

    class HashBase
  • MD5

    An actual implementation of the MD5 The following is an altered source version that only includes MD5. The original software can be found at: https://github.com/krzyzanowskim/CryptoSwift

    See more

    Declaration

    Swift

    class MD5 : HashBase
  • This is the main implementation of the MapCacheProtocol, the actual cache

    See more

    Declaration

    Swift

    open class MapCache : MapCacheProtocol
  • Hey! I need to download this area of the map. No problemo.

    This class allows you to download all the tiles of a region of the map.

    Internally what it does is to iterate over every tile coordinate within the region and request to a mapCache to download it by calling its loadTile method.

    In order to keep track of the downloaded data you can implement ReguionDownloaderDelegate.

    Based on the value of incrementInPercentageNotification the delegate will be called.

    Experimental

    See more

    Declaration

    Swift

    @objc
    public class RegionDownloader : NSObject
  • Class to convert from Map Tiles to coordinates and from coordinates to tiles

    Coordinates (latitude and longitude) are ALWAYS expressed in degrees. The max latitude that can be converted to tiles is +85.0511 and the minimum is -85.0511 (see https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames).

    Zoom level (z) range is from 0 to 19.

    The earth is represented by a square that is divided in small pieces (tiles). The number of tiles depends on the zoom value and is equal to: 2^z x 2^z

    The values of tiles can be from 0 to 2^z - 1. For instance, for z=10 the max tile would be 1023 (2^10 - 1 = 1024 - 1)

    This diagram represents the equivalent lat/long vs tileX/tileY

    (-180,85.0511)           (180,85.0511)  <----- coords (lat, long)
    0,0                      2^z -1, 0 <---------- Tile number (x,y)
    +-------------------------+
    |                         |
    |            + (0.0,0.0)  |
    |                         |
    +-------------------------+
    0,2^z - 1                 2^z - 1, 2^z - 1
    (-180,-85.0511)           (180,-85.0511)
    

    All the wisdom of this class comes from: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames

    See more

    Declaration

    Swift

    open class TileCoords
  • 3 dimensional square region in a tile map. The three dimensions are:

    • latitude (y)
    • longitude (x)
    • zoom (z)

    A region is represented by two TileCoords one holds the topLeft corner and the other the bottomRight corner.

    Notice that, in general, map UIs represent an infinite scroll in the longitude (x) axis, when the map ends, it is displayed the beginning.

    In this scenario, if we allow user to pick two points to select a region, we may end up with two sub-regions.

    +---------------------++---------------------++---------------------+
    |                     ||                     ||                     |
    |             * P1    ||                     ||                     |
    |                     ||                     ||                     |
    |       Map 1         ||        Map 1bis     ||       Map 1 bis bis |
    |                     ||                     ||                     |
    |                     ||  * P2               ||                     |
    |                     ||                     ||                     |
    +---------------------++---------------------++---------------------+
    
    See more

    Declaration

    Swift

    open class TileCoordsRegion