Class TiledImage
java.lang.Object
org.apache.sis.image.PlanarImage
org.apache.sis.internal.coverage.j2d.TiledImage
- All Implemented Interfaces:
RenderedImage
- Direct Known Subclasses:
WritableTiledImage
A rendered image which can contain an arbitrary number of tiles. Tiles are stored in memory.
This class may become public in a future version, but not yet because managing large tiled
images would require a more sophisticated class than current implementation.
This class should not perform any computation; all tiles are given at construction time. This requirement makes this class thread-safe and concurrent without the need for synchronization.
- Since:
- 1.1
- Version:
- 1.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ColorModelThe color model, ornullif none.private final intNumber of pixels along X or Y axis in the whole rendered image.private final intIndex of the first tile in the image.private final intIndex of the first tile in the image.Image properties, or an empty map if none.private final Raster[]The tiles.private final intNumber of pixels along X or Y axis in the whole rendered image.Fields inherited from class org.apache.sis.image.PlanarImage
GRID_GEOMETRY_KEY, MASK_KEY, POSITIONAL_ACCURACY_KEY, SAMPLE_RESOLUTIONS_KEY, STATISTICS_KEY -
Constructor Summary
ConstructorsConstructorDescriptionTiledImage(Map<String, Object> properties, ColorModel colorModel, int width, int height, int minTileX, int minTileY, Raster... tiles) Creates a new tiled image. -
Method Summary
Modifier and TypeMethodDescriptionReturns the color model, ornullif none.intReturns the number of pixels along Y axis in the whole rendered image.intReturns the minimum tile index in the X direction.intReturns the minimum tile index in the Y direction.intgetMinX()Returns the minimum x coordinate (inclusive) of this image.intgetMinY()Returns the minimum y coordinate (inclusive) of this image.getProperty(String key) Gets a property from this image.String[]Returns the names of all recognized properties, ornullif this image has no properties.Returns the sample model.getTile(int tileX, int tileY) Returns the tile at the given location in tile coordinates.intReturns the tile height in pixels.intReturns the tile width in pixels.intgetWidth()Returns the number of pixels along X axis in the whole rendered image.private static StringLabel returned byverify()for identifying an error in a specified tile.verify()Verifies whether image layout information and tile coordinates are consistent.private static intverifyTileIndex(String name, int value, int min, int count) Verifies that the given tile index is inside expected bounds, then returns is zero-based value.Methods inherited from class org.apache.sis.image.PlanarImage
copyData, getBounds, getData, getData, getNumXTiles, getNumYTiles, getSources, getTileGridXOffset, getTileGridYOffset, toString
-
Field Details
-
colorModel
The color model, ornullif none. -
width
private final int widthNumber of pixels along X or Y axis in the whole rendered image. -
height
private final int heightNumber of pixels along X or Y axis in the whole rendered image. -
minTileX
private final int minTileXIndex of the first tile in the image. -
minTileY
private final int minTileYIndex of the first tile in the image. -
tiles
The tiles. They must all use the same sample model. -
properties
Image properties, or an empty map if none.
-
-
Constructor Details
-
TiledImage
public TiledImage(Map<String, Object> properties, ColorModel colorModel, int width, int height, int minTileX, int minTileY, Raster... tiles) Creates a new tiled image. The first tile in the given array must be the one located at the minimal tile indices. All tiles must have the same size and the same sample model and must be sorted in row-major fashion (this is not verified in current version, but may be in the future).- Parameters:
properties- image properties, ornullif none.colorModel- the color model, ornullif none.width- number of pixels along X axis in the whole rendered image.height- number of pixels along Y axis in the whole rendered image.minTileX- minimum tile index in the X direction.minTileY- minimum tile index in the Y direction.tiles- the tiles. Must contains at least one element. This array is not cloned.
-
-
Method Details
-
verify
Verifies whether image layout information and tile coordinates are consistent. This method verifies the size and minimum pixel coordinates of all tiles. If okay, then this method completes the check with all verifications documented in parent class- Overrides:
verifyin classPlanarImage- Returns:
nullif image layout information are consistent, or the name of inconsistent attribute if a problem is found.
-
property
Label returned byverify()for identifying an error in a specified tile. -
getColorModel
Returns the color model, ornullif none. -
getSampleModel
Returns the sample model. -
getProperty
Gets a property from this image.- Specified by:
getPropertyin interfaceRenderedImage- Overrides:
getPropertyin classPlanarImage- Parameters:
key- the name of the property to get.- Returns:
- the property value, or
Image.UndefinedPropertyif none.
-
getPropertyNames
Returns the names of all recognized properties, ornullif this image has no properties.- Specified by:
getPropertyNamesin interfaceRenderedImage- Overrides:
getPropertyNamesin classPlanarImage- Returns:
- names of all recognized properties, or
nullif none.
-
getMinX
public int getMinX()Returns the minimum x coordinate (inclusive) of this image.- Specified by:
getMinXin interfaceRenderedImage- Overrides:
getMinXin classPlanarImage- Returns:
- the minimum x coordinate (column) of this image.
-
getMinY
public int getMinY()Returns the minimum y coordinate (inclusive) of this image.- Specified by:
getMinYin interfaceRenderedImage- Overrides:
getMinYin classPlanarImage- Returns:
- the minimum y coordinate (row) of this image.
-
getWidth
public int getWidth()Returns the number of pixels along X axis in the whole rendered image. -
getHeight
public int getHeight()Returns the number of pixels along Y axis in the whole rendered image. -
getTileWidth
public int getTileWidth()Returns the tile width in pixels. All tiles must have the same width. -
getTileHeight
public int getTileHeight()Returns the tile height in pixels. All tiles must have the same height. -
getMinTileX
public int getMinTileX()Returns the minimum tile index in the X direction.- Specified by:
getMinTileXin interfaceRenderedImage- Overrides:
getMinTileXin classPlanarImage- Returns:
- the minimum tile index in the x direction.
-
getMinTileY
public int getMinTileY()Returns the minimum tile index in the Y direction.- Specified by:
getMinTileYin interfaceRenderedImage- Overrides:
getMinTileYin classPlanarImage- Returns:
- the minimum tile index in the y direction.
-
getTile
Returns the tile at the given location in tile coordinates. -
verifyTileIndex
Verifies that the given tile index is inside expected bounds, then returns is zero-based value.
-