TileCoordsRegion

public class TileCoordsRegion

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               ||                     |
|                     ||                     ||                     |
+---------------------++---------------------++---------------------+
  • Undocumented

    Declaration

    Swift

    public var topLeft: TileCoords
  • Undocumented

    Declaration

    Swift

    public var bottomRight: TileCoords
  • Undocumented

    Declaration

    Swift

    public var zoomRange: ZoomRange { get }
  • Undocumented

    Declaration

    Swift

    public var count: TileNumber { get }
  • The region will be the area that holds the line from any top left point (P1) to any bottom rightpoint 2 (P2)

    Declaration

    Swift

    public init?(topLeftLatitude: Double, topLeftLongitude: Double, bottomRightLatitude: Double, bottomRightLongitude: Double, minZoom: UInt8, maxZoom: UInt8)
  • The region will be the area that holds the line from any top left point (P1) to any bottom rightpoint 2 (P2) For example, in this map:

    +---------------------++---------------------++---------------------+
    |               P1    ||                     ||                     |
    |                * . .||. +                  ||                     |
    |                . \  ||  ·                  ||                     |
    |       Map 1    .  \ ||  ·     Map 2        ||       Map 3         |
    |                .   \||  ·                  ||                     |
    |                .    \|  ·                  ||                     |
    |                .    |\  ·                  ||                     |
    |                .    ||\ ·                  ||                     |
    |                .    || \·                  ||                     |
    |                + . .||. * P2               ||                     |
    +---------------------++---------------------++---------------------+
    

    -180 180 -180 180

    The area will be the one denoted with the dots.

    Declaration

    Swift

    public init?(topLeft: TileCoords, bottomRight: TileCoords)
  • Undocumented

    Declaration

    Swift

    public func count(forZoom zoom: Zoom) -> TileNumber
  • For example, in this map there are two ranges. One that covers the area A1 and other that covers the area A2

    +----------------------++---------------------++---------------------+
    |               P1     ||                     ||                     |
    |                *.....||...+                  ||                     |
    |                . \  .||.  ·                  ||                     |
    |       Map 1    .  \ .||.  ·     Map 2        ||       Map 3         |
    |                .   \.||.  ·                  ||                     |
    |                .    \||.A2·                  ||                     |
    |                .  A1.|\.  ·                  ||                     |
    |                .    .||\  ·                  ||                     |
    |                .    .||.\ ·                  ||                     |
    |                +.....||...* P2               ||                     |
    +----------------------++---------------------++---------------------+
    

    -180 180 -180 180

    Declaration

    Swift

    public func tileRanges(forZoom zoom: Zoom) -> [TileRange]?
  • Gets the tile ranges for all zooms.

    Declaration

    Swift

    public func tileRanges() -> [TileRange]?