Class TilingScheme

java.lang.Object
noaa.coastwatch.io.tile.TilingScheme

public class TilingScheme extends Object
The tiling scheme class helps support the tiling of 2D data. A tiling scheme consists of a set of global row and column dimensions along with a set of tile row and column dimensions. The tiling scheme contains the TilePosition and Tile classes to aid in the manipulation of tile coordinates and data. A general tiling in 2D looks as follows:
              
              tile column
               dimension            tile position coordinates
              <--------->         /
                                 /
            ^ +---------*-------/-*---+    ^
            | |         *      /  *   |    | 
   tile row | |         *     v   *   |    |
  dimension | |  [0,0]  *  [0,1]  * [0,2]  |
            | |         *         *   |    |
            | |         *         *   |    |
            v *************************    |
              |         *         *   |    | global row dimension
              |         *         *   |    |
              |  [1,0]  *  [1,1]  * [1,2]  |
              |         *         *   |    | 
              |         *         *   |    |
              *************************    |
              |         *         *   |    |
 truncated -->|  [2,0]  *  [2,1]  * [2,2]  |
   tile       +---------*---------*---+    v

              <----------------------->
                    global column
                      dimension  
 
In the example above, the tile count in both dimensions is 3, even though some tiles are truncated due to the tile dimensions.
Since:
3.1.2
Author:
Peter Hollemans
  • Field Details

  • Constructor Details

    • TilingScheme

      public TilingScheme(int[] dims, int[] tileDims)
      Creates a new tiling scheme from the specified dimensions.
      Parameters:
      dims - the global dimensions as [rows, columns].
      tileDims - the tile dimensions as [rows, columns].
  • Method Details

    • getDimensions

      public int[] getDimensions()
      Gets the global dimensions as [rows, columns].
    • getTileDimensions

      public int[] getTileDimensions()
      Gets the tile dimensions as [rows, columns].
    • getTileDimensions

      @Deprecated public int[] getTileDimensions(TilingScheme.TilePosition pos)
      Deprecated.
      Gets the tile dimensions as [rows, columns] for the specified tile position. This method may return smaller dimensions than getTileDimensions() for tiles at the truncated positions.
      Parameters:
      pos - the tile position.
      Returns:
      the tile dimensions at the specified position.
    • getTileCounts

      public int[] getTileCounts()
      Gets the tile counts as [rows, columns].
    • createTilePosition

      public TilingScheme.TilePosition createTilePosition(int row, int col)
      Creates a new tile position from global coordinates.
      Parameters:
      row - the data row coordinate.
      col - the data column coordinate.
      Throws:
      IndexOutOfBoundsException - if the coordinates do not reference a valid tile in the tiling scheme.
    • main

      public static void main(String[] argv) throws Exception
      Tests this class.
      Parameters:
      argv - the array of command line parameters.
      Throws:
      Exception