Class TilingScheme.Tile

java.lang.Object
noaa.coastwatch.io.tile.TilingScheme.Tile
Enclosing class:
TilingScheme

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

    • Tile

      public Tile(TilingScheme.TilePosition pos, Object data)
      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

      public void setData(Object data)
      Sets the tile data. Only the reference is copied, not the contents.
    • getData

      public Object getData()
      Gets the tile data. Only the reference is returned.
    • getDimensions

      public int[] getDimensions()
      Gets the tile dimensions.
    • getPosition

      public TilingScheme.TilePosition 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

      public String toString()
      Overrides:
      toString in class Object
    • 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

      public Rectangle getRectangle()
      Gets the tile rectangle.
      Returns:
      the rectangle bounding this tile.
    • hasPosition

      public boolean hasPosition(TilingScheme.TilePosition pos)
      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

      public TilingScheme getScheme()
      Gets the tiling scheme for this tile.
      Returns:
      the tiling scheme associated with this tile.