Class Tile

  • All Implemented Interfaces:
    Cacheable, java.lang.Comparable<Tile>
    Direct Known Subclasses:
    BasicElevationModel.ElevationTile, TextureTile

    public class Tile
    extends java.lang.Object
    implements java.lang.Comparable<Tile>, Cacheable
    Large images and most imagery and elevation-data sets are subdivided in order to display visible portions quickly and without excessive memory usage. Each subdivision is called a tile, and a collections of adjacent tiles corresponding to a common spatial resolution is typically maintained in a Level. A collection of levels of progressive resolutions are maintained in a LevelSet. The Tile class represents a single tile of a subdivided image or elevation raster.

    Individual tiles are identified by the level, row and column of the tile within its containing level set.

    • Constructor Detail

      • Tile

        public Tile​(Sector sector,
                    Level level,
                    int row,
                    int column)
        Constructs a tile for a given sector, level, row and column of the tile's containing tile set.
        Parameters:
        sector - the sector corresponding with the tile.
        level - the tile's level within a containing level set.
        row - the row index (0 origin) of the tile within the indicated level.
        column - the column index (0 origin) of the tile within the indicated level.
        Throws:
        java.lang.IllegalArgumentException - if sector or level is null.
      • Tile

        public Tile​(Sector sector,
                    Level level,
                    int row,
                    int column,
                    java.lang.String cacheName)
        Constructs a tile for a given sector, level, row and column of the tile's containing tile set. If the cache name is non-null, it overrides the level's cache name and is returned by getCacheName(). Otherwise, the level's cache name is used.
        Parameters:
        sector - the sector corresponding with the tile.
        level - the tile's level within a containing level set.
        row - the row index (0 origin) of the tile within the indicated level.
        column - the column index (0 origin) of the tile within the indicated level.
        cacheName - optional cache name to override the Level's cache name. May be null.
        Throws:
        java.lang.IllegalArgumentException - if sector or level is null.
      • Tile

        public Tile​(Sector sector,
                    Level level)
        Constructs a texture tile for a given sector and level, and with a default row and column.
        Parameters:
        sector - the sector to create the tile for.
        level - the level to associate the tile with
        Throws:
        java.lang.IllegalArgumentException - if sector or level are null.
      • Tile

        public Tile​(Sector sector)
        Constructs a texture tile for a given sector with a default level, row and column.
        Parameters:
        sector - the sector to create the tile for.
    • Method Detail

      • getSizeInBytes

        public long getSizeInBytes()
        Description copied from interface: Cacheable
        Retrieves the approximate size of this object in bytes. Implementors are encouraged to calculate the exact size for smaller objects, but use approximate values for objects that include such large components that the approximation would produce an error so small that the extra computation would be wasteful.
        Specified by:
        getSizeInBytes in interface Cacheable
        Returns:
        this Cacheable object's size in bytes
      • getPath

        public java.lang.String getPath()
      • getPathBase

        public java.lang.String getPathBase()
      • getSector

        public final Sector getSector()
      • getLevel

        public Level getLevel()
      • getLevelNumber

        public final int getLevelNumber()
      • getLevelName

        public final java.lang.String getLevelName()
      • getRow

        public final int getRow()
      • getColumn

        public final int getColumn()
      • getCacheName

        public final java.lang.String getCacheName()
        Returns the tile's cache name. If a non-null cache name was specified at construction, that name is returned. Otherwise this returns the level's cache name.
        Returns:
        the tile's cache name.
      • getFormatSuffix

        public final java.lang.String getFormatSuffix()
      • getTileKey

        public final TileKey getTileKey()
      • getResourceURL

        public java.net.URL getResourceURL()
                                    throws java.net.MalformedURLException
        Throws:
        java.net.MalformedURLException
      • getResourceURL

        public java.net.URL getResourceURL​(java.lang.String imageFormat)
                                    throws java.net.MalformedURLException
        Throws:
        java.net.MalformedURLException
      • getLabel

        public java.lang.String getLabel()
      • getWidth

        public int getWidth()
      • getHeight

        public int getHeight()
      • compareTo

        public int compareTo​(Tile tile)
        Specified by:
        compareTo in interface java.lang.Comparable<Tile>
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • computeRow

        public static int computeRow​(Angle delta,
                                     Angle latitude,
                                     Angle origin)
        Computes the row index of a latitude in the global tile grid corresponding to a specified grid interval.
        Parameters:
        delta - the grid interval
        latitude - the latitude for which to compute the row index
        origin - the origin of the grid
        Returns:
        the row index of the row containing the specified latitude
        Throws:
        java.lang.IllegalArgumentException - if delta is null or non-positive, or latitude is null, greater than positive 90 degrees, or less than negative 90 degrees
      • computeColumn

        public static int computeColumn​(Angle delta,
                                        Angle longitude,
                                        Angle origin)
        Computes the column index of a longitude in the global tile grid corresponding to a specified grid interval.
        Parameters:
        delta - the grid interval
        longitude - the longitude for which to compute the column index
        origin - the origin of the grid
        Returns:
        the column index of the column containing the specified latitude
        Throws:
        java.lang.IllegalArgumentException - if delta is null or non-positive, or longitude is null, greater than positive 180 degrees, or less than negative 180 degrees
      • computeRowLatitude

        public static Angle computeRowLatitude​(int row,
                                               Angle delta,
                                               Angle origin)
        Determines the minimum latitude of a row in the global tile grid corresponding to a specified grid interval.
        Parameters:
        row - the row index of the row in question
        delta - the grid interval
        origin - the origin of the grid
        Returns:
        the minimum latitude of the tile corresponding to the specified row
        Throws:
        java.lang.IllegalArgumentException - if the grid interval (delta) is null or zero or the row index is negative.
      • computeColumnLongitude

        public static Angle computeColumnLongitude​(int column,
                                                   Angle delta,
                                                   Angle origin)
        Determines the minimum longitude of a column in the global tile grid corresponding to a specified grid interval.
        Parameters:
        column - the row index of the row in question
        delta - the grid interval
        origin - the origin of the grid
        Returns:
        the minimum longitude of the tile corresponding to the specified column
        Throws:
        java.lang.IllegalArgumentException - if the grid interval (delta) is null or zero or the column index is negative.
      • getPriority

        public double getPriority()
      • setPriority

        public void setPriority​(double priority)