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
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassA tile is a rectangular section of data with associated attributes.classA tile position stores the row and column location coordinates of a tile in a tiling scheme. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTilingScheme(int[] dims, int[] tileDims) Creates a new tiling scheme from the specified dimensions. -
Method Summary
Modifier and TypeMethodDescriptioncreateTilePosition(int row, int col) Deprecated.Gets a list of all tile positions for this tiling scheme.getCoveringPositions(int[] start, int[] count) Gets a minimal list of tile positions that cover a subset of the global coordinates.int[]Gets the global dimensions as [rows, columns].intGets the total tile count in this scheme.int[]Gets the tile counts along each dimension.int[]Gets the tile dimensions as [rows, columns].int[]Deprecated.As of 3.3.1, useTilingScheme.TilePosition.getDimensions().getTilePositionForCoords(int row, int col) Gets a shared instance of a tile position whose tile contains the specified global coordinates.getTilePositionForIndex(int tileRow, int tileCol) Gets a tile position object using the tile position coordinates.static voidTests 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.
-
getTileCount
public int getTileCount()Gets the total tile count in this scheme.- Returns:
- the total tile count.
- Since:
- 3.8.1
-
getTileCounts
public int[] getTileCounts()Gets the tile counts along each dimension.- Returns:
- the tile counts as [rows, columns].
-
createTilePosition
Deprecated.As of 3.8.1, usegetTilePositionForCoords(int, int).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.
-
getTilePositionForCoords
Gets a shared instance of a tile position whose tile contains the specified global coordinates.- Parameters:
row- the data row coordinate.col- the data column coordinate.- Returns:
- the instance of the tile position containing the coordinates.
- Throws:
IndexOutOfBoundsException- if the coordinates do not reference a valid tile in the tiling scheme.- Since:
- 3.8.1
-
getTilePositionForIndex
Gets a tile position object using the tile position coordinates.- Parameters:
tileRow- the tile row index.tileCol- the tile column index.- Returns:
- the instance of the tile position of the specified tile indices.
- Throws:
IndexOutOfBoundsException- if the indices do not reference a valid tile in the tiling scheme.- Since:
- 3.8.1
- See Also:
-
getCoveringPositions
Gets a minimal list of tile positions that cover a subset of the global coordinates.- Parameters:
start- the data subset starting [row, column].count- the data subset dimension [rows, columns].- Returns:
- the list of tile positions.
- Throws:
IndexOutOfBoundsException- if the subset falls outside the grid dimensions.- Since:
- 3.8.1
-
getAllPositions
Gets a list of all tile positions for this tiling scheme.- Returns:
- the list of all tile positions. Changes to the returned list have no effect on the tiling scheme.
- Since:
- 3.8.1
-
main
Tests this class.- Parameters:
argv- the array of command line parameters.- Throws:
Exception
-
getTilePositionForCoords(int, int).