Class TilePlaceholder
java.lang.Object
org.apache.sis.internal.coverage.j2d.TilePlaceholder
- Direct Known Subclasses:
TilePlaceholder.Filled
,TilePlaceholder.WithCross
Source of read-only empty tiles to use as placeholder for tiles that were not computed.
This class reduces memory usage by sharing the same data buffer for all tiles.
Subclasses can optionally draw some symbols in the tile, for example to signal an error.
- Since:
- 1.2
- Version:
- 1.2
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Weak reference to a data buffer.private static final class
A provider of tile placeholder with a fill value.private static final class
A provider of tile placeholder with a white border and white cross in the tile. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final WeakHashSet
<TilePlaceholder> Cache of empty tiles for different sample models.protected final SampleModel
The sample model of the empty tiles to create.static final boolean
Identifies workaround for two JDK bugs.private TilePlaceholder.BufferRef
The data buffers for empty tiles. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TilePlaceholder
(SampleModel model) Creates a initially empty set of empty tiles. -
Method Summary
Modifier and TypeMethodDescriptionfinal Raster
Creates a tile to use as a placeholder when a tile cannot be computed.protected void
draw
(WritableRaster tile) Invoked when a new empty tile is created.static TilePlaceholder
empty
(SampleModel model) Returns a provider of empty tiles for the given sample model.boolean
Compares this object with given object for equality.static TilePlaceholder
filled
(SampleModel model, Number fillValue) Returns a provider of empty tiles filled with the given value in all bands.static TilePlaceholder
filled
(SampleModel model, FillValues fill) Returns a provider of empty tiles filled with the given values.int
hashCode()
Returns a hash code value for this provider of tile placeholders.final boolean
isCreatorOf
(Raster tile) Returnstrue
if this factory is the creator of given raster.static TilePlaceholder
withCross
(RenderedImage image) Returns a source of "empty" tiles with a white border and a white cross.
-
Field Details
-
PENDING_JDK_FIX
Identifies workaround for two JDK bugs.JDK-8166038: If
invalid reference
BufferedImage
invalid reference
ReshapedImage
JDK-8275345: call to
Graphics2D.drawRenderedImage(…)
fails if the image contains more than one tile (or a single tile not located at 0,0) and the tiles are not instances ofWritableRaster
(i.e. are instances of the read-onlyRaster
parent class). The exception thrown is:- See Also:
-
CACHE
Cache of empty tiles for different sample models. -
model
The sample model of the empty tiles to create. -
reference
The data buffers for empty tiles. The same data buffer is shared by allRaster
instances using the same sample model. Data may contain some drawing such as a cross (X).
-
-
Constructor Details
-
TilePlaceholder
Creates a initially empty set of empty tiles.- Parameters:
model
- sample model of the empty tiles.
-
-
Method Details
-
empty
Returns a provider of empty tiles for the given sample model. All pixel values will be zero in all bands.- Parameters:
model
- sample model of the empty tiles.- Returns:
- provider of fully empty tiles.
-
filled
Returns a provider of empty tiles filled with the given value in all bands. A value ofnull
is interpreted as 0 for integer types or NaN for floating point types.- Parameters:
model
- sample model of the empty tiles.fillValue
- the value to use for filling empty spaces in rasters, ornull
for zero.- Returns:
- provider of filled tiles.
-
filled
Returns a provider of empty tiles filled with the given values.- Parameters:
model
- sample model of the empty tiles.fill
- the fill values.- Returns:
- provider of filled tiles.
-
withCross
Returns a source of "empty" tiles with a white border and a white cross.- Parameters:
image
- sample model and color model of the tiles to create.- Returns:
- a source of "empty" tiles with white borders and crosses.
-
create
Creates a tile to use as a placeholder when a tile cannot be computed.- Parameters:
location
- minimum x and y coordinates of the tile raster.- Returns:
- placeholder for a tile at the given location.
-
isCreatorOf
Returnstrue
if this factory is the creator of given raster.- Parameters:
tile
- the tile to test, ornull
.- Returns:
- whether this tile is the creator of given raster.
-
draw
Invoked when a new empty tile is created. Subclasses can override this method for drawing some visual indication that the tile is missing. The default implementation does nothing.- Parameters:
tile
- the tile where to draw.
-
equals
Compares this object with given object for equality. -
hashCode
public int hashCode()Returns a hash code value for this provider of tile placeholders.
-