TileCoordsRegion
open 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 || |
| || || |
+---------------------++---------------------++---------------------+
-
Top left tile/coordinate.
Declaration
Swift
public var topLeft: TileCoords
-
Bottom right tile/coordinate.
Declaration
Swift
public var bottomRight: TileCoords
-
Zoom range for the region.
Declaration
Swift
public var zoomRange: ZoomRange { get }
-
Total number of tiles in this region for all zoom levels.
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)
-
Counts for the zoom
Declaration
Swift
public func count(forZoom zoom: Zoom) -> TileNumber
-
All the tile ranges for this particular zoom. There may be 1 or 2.
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
-
Gets the tile ranges for all zooms.
Declaration
Swift
public func tileRanges() -> [TileRange]?