Class Tile

java.lang.Object
org.oscim.core.Tile
Direct Known Subclasses:
MapTile

public class Tile extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    final long
    the map size implied by zoom level and tileSize, to avoid multiple computations.
    static int
    Width and height of a map tile in pixels.
    static int
    Tile size multiple in pixels.
    final int
    The X number of this tile.
    final int
    The Y number of this tile.
    final byte
    The Zoom level of this tile.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Tile(int tileX, int tileY, byte zoomLevel)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    Calculate tile size (256px) with a scale factor.
    boolean
     
    Gets the geographic extend of this Tile as a BoundingBox.
    getBoundingBox(Tile upperLeft, Tile lowerRight)
    Return the BoundingBox of a rectangle of tiles defined by upper left and lower right tile.
    static int
    getMaxTileNumber(byte zoomLevel)
     
    Returns the top-left point of this tile in absolute coordinates.
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • SIZE

      public static int SIZE
      Width and height of a map tile in pixels.
    • TILE_SIZE_MULTIPLE

      public static int TILE_SIZE_MULTIPLE
      Tile size multiple in pixels.
    • mapSize

      public final long mapSize
      the map size implied by zoom level and tileSize, to avoid multiple computations.
    • tileX

      public final int tileX
      The X number of this tile.
    • tileY

      public final int tileY
      The Y number of this tile.
    • zoomLevel

      public final byte zoomLevel
      The 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

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • calculateTileSize

      public static int calculateTileSize()
      Calculate tile size (256px) with a scale factor. Clamp tile size to a preset multiple, e.g. 64px.
    • getBoundingBox

      public BoundingBox getBoundingBox()
      Gets the geographic extend of this Tile as a BoundingBox.
      Returns:
      boundaries of this tile.
    • getBoundingBox

      public static BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight)
      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

      public Point getOrigin()
      Returns the top-left point of this tile in absolute coordinates.
      Returns:
      the top-left point