Package noaa.coastwatch.io.tile
Class TilingScheme.Tile
java.lang.Object
noaa.coastwatch.io.tile.TilingScheme.Tile
- Enclosing class:
- TilingScheme
A tile is a rectangular section of data with associated
attributes. The tile position indicates its position in the
tiling scheme starting from [0,0]. The tile dimensions are the
tile rows and columns, which usually correspond to the tiling
scheme tile dimensions except when the global dimensions are not
a multiple of the tile dimensions. The tile data is an array of
data values as an object reference. A tile has a dirty flag to
indicate that data values in the tile have been set, but the tile
has not been written to a destination. The dirty flag is for the
convenience of classes that use the tile for data reading and
writing.
-
Constructor Summary
ConstructorDescriptionTile
(TilingScheme.TilePosition pos, Object data) Creates a new tile with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(int row, int col) Determines if a global coordinate is contained in this tile.getData()
Gets the tile data.int[]
Gets the tile dimensions.boolean
getDirty()
Gets the tile dirty flag.int
getIndex
(int row, int col) Gets an index into the tile data based on a global data coordinate.Gets the tile position.Gets the tile rectangle.Gets the tiling scheme for this tile.boolean
Compares the tile position to this tile for equality.void
Sets the tile data.void
setDirty
(boolean flag) Sets the tile dirty flag.toString()
-
Constructor Details
-
Tile
Creates a new tile with the specified parameters. The dirty flag is initialized to false.- Parameters:
pos
- the tile position in the grid.data
- the tile data.
-
-
Method Details
-
setData
Sets the tile data. Only the reference is copied, not the contents. -
getData
Gets the tile data. Only the reference is returned. -
getDimensions
public int[] getDimensions()Gets the tile dimensions. -
getPosition
Gets the tile position. -
getDirty
public boolean getDirty()Gets the tile dirty flag. -
setDirty
public void setDirty(boolean flag) Sets the tile dirty flag. -
toString
-
contains
public boolean contains(int row, int col) Determines if a global coordinate is contained in this tile.- Parameters:
row
- the global row coordinate.col
- the global column coordinate.- Returns:
- true if the location is in this tile, or false if not.
-
getIndex
public int getIndex(int row, int col) Gets an index into the tile data based on a global data coordinate.- Parameters:
row
- the global row coordinate.col
- the global column coordinate.- Returns:
- the index into this tile's data.
-
getRectangle
Gets the tile rectangle.- Returns:
- the rectangle bounding this tile.
-
hasPosition
Compares the tile position to this tile for equality.- Parameters:
pos
- the tile position for comparison.- Returns:
- true if the tile position is the same as this tile, or false otherwise.
-
getScheme
Gets the tiling scheme for this tile.- Returns:
- the tiling scheme associated with this tile.
-