Package noaa.coastwatch.io.tile
Class TilingScheme
java.lang.Object
noaa.coastwatch.io.tile.TilingScheme
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 dimensionIn 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
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
A tile is a rectangular section of data with associated attributes.class
A tile position stores the row and column location coordinates of a tile in a tiling scheme. -
Field Summary
-
Constructor Summary
ConstructorDescriptionTilingScheme
(int[] dims, int[] tileDims) Creates a new tiling scheme from the specified dimensions. -
Method Summary
Modifier and TypeMethodDescriptioncreateTilePosition
(int row, int col) Creates a new tile position from global coordinates.int[]
Gets the global dimensions as [rows, columns].int[]
Gets the tile counts as [rows, columns].int[]
Gets the tile dimensions as [rows, columns].int[]
Deprecated.static void
Tests this class.
-
Field Details
-
ROWS
public static final int ROWSIndex of rows dimension.- See Also:
-
COLS
public static final int COLSIndex of columns dimension.- See Also:
-
-
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.As of 3.3.1, useTilingScheme.TilePosition.getDimensions()
.Gets the tile dimensions as [rows, columns] for the specified tile position. This method may return smaller dimensions thangetTileDimensions()
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
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
Tests this class.- Parameters:
argv
- the array of command line parameters.- Throws:
Exception
-
TilingScheme.TilePosition.getDimensions()
.