Package org.oscim.core
Class Tile
java.lang.Object
org.oscim.core.Tile
- Direct Known Subclasses:
MapTile
A tile represents a rectangular part of the world map. All tiles can be
identified by their X and Y number together with their zoom level. The actual
area that a tile covers on a map depends on the underlying map projection.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal longthe map size implied by zoom level and tileSize, to avoid multiple computations.static intWidth and height of a map tile in pixels.static intTile size multiple in pixels.final intThe X number of this tile.final intThe Y number of this tile.final byteThe Zoom level of this tile. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intCalculate tile size (256px) with a scale factor.booleanGets the geographic extend of this Tile as a BoundingBox.static BoundingBoxgetBoundingBox(Tile upperLeft, Tile lowerRight) Return the BoundingBox of a rectangle of tiles defined by upper left and lower right tile.static intgetMaxTileNumber(byte zoomLevel) Returns the top-left point of this tile in absolute coordinates.inthashCode()toString()
-
Field Details
-
SIZE
public static int SIZEWidth and height of a map tile in pixels. -
TILE_SIZE_MULTIPLE
public static int TILE_SIZE_MULTIPLETile size multiple in pixels. -
mapSize
public final long mapSizethe map size implied by zoom level and tileSize, to avoid multiple computations. -
tileX
public final int tileXThe X number of this tile. -
tileY
public final int tileYThe Y number of this tile. -
zoomLevel
public final byte zoomLevelThe Zoom level of this tile.
-
-
Constructor Details
-
Tile
public Tile(int tileX, int tileY, byte zoomLevel) - Parameters:
tileX- the X number of the tile.tileY- the Y number of the tile.zoomLevel- the zoom level of the tile.
-
-
Method Details
-
toString
-
equals
-
hashCode
public int hashCode() -
calculateTileSize
public static int calculateTileSize()Calculate tile size (256px) with a scale factor. Clamp tile size to a preset multiple, e.g. 64px. -
getBoundingBox
Gets the geographic extend of this Tile as a BoundingBox.- Returns:
- boundaries of this tile.
-
getBoundingBox
Return the BoundingBox of a rectangle of tiles defined by upper left and lower right tile.- Parameters:
upperLeft- tile in upper left corner.lowerRight- tile in lower right corner.- Returns:
- BoundingBox defined by the area around upperLeft and lowerRight Tile.
-
getMaxTileNumber
public static int getMaxTileNumber(byte zoomLevel) - Returns:
- the maximum valid tile number for the given zoom level, 2zoomLevel -1.
-
getOrigin
Returns the top-left point of this tile in absolute coordinates.- Returns:
- the top-left point
-