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 ColorModel
The color model, ornull
if none.private final int
Number of pixels along X or Y axis in the whole rendered image.private final int
Index of the first tile in the image.private final int
Index of the first tile in the image.Image properties, or an empty map if none.private final Raster[]
The tiles.private final int
Number 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, ornull
if none.int
Returns the number of pixels along Y axis in the whole rendered image.int
Returns the minimum tile index in the X direction.int
Returns the minimum tile index in the Y direction.int
getMinX()
Returns the minimum x coordinate (inclusive) of this image.int
getMinY()
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, ornull
if this image has no properties.Returns the sample model.getTile
(int tileX, int tileY) Returns the tile at the given location in tile coordinates.int
Returns the tile height in pixels.int
Returns the tile width in pixels.int
getWidth()
Returns the number of pixels along X axis in the whole rendered image.private static String
Label returned byverify()
for identifying an error in a specified tile.verify()
Verifies whether image layout information and tile coordinates are consistent.private static int
verifyTileIndex
(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, ornull
if 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, ornull
if none.colorModel
- the color model, ornull
if 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:
verify
in classPlanarImage
- Returns:
null
if 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, ornull
if none. -
getSampleModel
Returns the sample model. -
getProperty
Gets a property from this image.- Specified by:
getProperty
in interfaceRenderedImage
- Overrides:
getProperty
in classPlanarImage
- Parameters:
key
- the name of the property to get.- Returns:
- the property value, or
Image.UndefinedProperty
if none.
-
getPropertyNames
Returns the names of all recognized properties, ornull
if this image has no properties.- Specified by:
getPropertyNames
in interfaceRenderedImage
- Overrides:
getPropertyNames
in classPlanarImage
- Returns:
- names of all recognized properties, or
null
if none.
-
getMinX
public int getMinX()Returns the minimum x coordinate (inclusive) of this image.- Specified by:
getMinX
in interfaceRenderedImage
- Overrides:
getMinX
in 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:
getMinY
in interfaceRenderedImage
- Overrides:
getMinY
in 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:
getMinTileX
in interfaceRenderedImage
- Overrides:
getMinTileX
in 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:
getMinTileY
in interfaceRenderedImage
- Overrides:
getMinTileY
in 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.
-