Package gov.nasa.worldwind.util
Class Tile
- java.lang.Object
-
- gov.nasa.worldwind.util.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 aLevel
. A collection of levels of progressive resolutions are maintained in aLevelSet
. TheTile
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 Summary
Constructors Constructor Description Tile(Sector sector)
Constructs a texture tile for a given sector with a default level, row and column.Tile(Sector sector, Level level)
Constructs a texture tile for a given sector and level, and with a default row and column.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.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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Tile tile)
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.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.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.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.boolean
equals(java.lang.Object o)
java.lang.String
getCacheName()
Returns the tile's cache name.int
getColumn()
java.lang.String
getFormatSuffix()
int
getHeight()
java.lang.String
getLabel()
Level
getLevel()
java.lang.String
getLevelName()
int
getLevelNumber()
java.lang.String
getPath()
java.lang.String
getPathBase()
double
getPriority()
java.net.URL
getResourceURL()
java.net.URL
getResourceURL(java.lang.String imageFormat)
int
getRow()
Sector
getSector()
long
getSizeInBytes()
Retrieves the approximate size of this object in bytes.TileKey
getTileKey()
int
getWidth()
int
hashCode()
void
setPriority(double priority)
java.lang.String
toString()
-
-
-
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
- ifsector
orlevel
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 bygetCacheName()
. 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
- ifsector
orlevel
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 interfaceCacheable
- 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 interfacejava.lang.Comparable<Tile>
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.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 intervallatitude
- the latitude for which to compute the row indexorigin
- the origin of the grid- Returns:
- the row index of the row containing the specified latitude
- Throws:
java.lang.IllegalArgumentException
- ifdelta
is null or non-positive, orlatitude
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 intervallongitude
- the longitude for which to compute the column indexorigin
- the origin of the grid- Returns:
- the column index of the column containing the specified latitude
- Throws:
java.lang.IllegalArgumentException
- ifdelta
is null or non-positive, orlongitude
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 questiondelta
- the grid intervalorigin
- 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 questiondelta
- the grid intervalorigin
- 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)
-
-