Package org.apache.sis.image
Class BandedSampleConverter.Writable
java.lang.Object
org.apache.sis.image.PlanarImage
org.apache.sis.image.ComputedImage
org.apache.sis.image.BandedSampleConverter
org.apache.sis.image.BandedSampleConverter.Writable
- All Implemented Interfaces:
RenderedImage,WritableRenderedImage,Disposable
- Enclosing class:
- BandedSampleConverter
private static final class BandedSampleConverter.Writable
extends BandedSampleConverter
implements WritableRenderedImage
A
BandedSampleConverter capable to retro-propagate the changes to the source coverage.
This class contains the inverse of all MathTransform1D given to the parent class.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.opengis.referencing.operation.MathTransform1D[]The converters for computing the source values from a converted value.private TileObserver[]The observers, ornullif none.Fields inherited from class org.apache.sis.image.ComputedImage
sampleModel, SOURCE_PADDING_KEYFields inherited from class org.apache.sis.image.PlanarImage
GRID_GEOMETRY_KEY, MASK_KEY, POSITIONAL_ACCURACY_KEY, SAMPLE_RESOLUTIONS_KEY, STATISTICS_KEY -
Constructor Summary
ConstructorsConstructorDescriptionWritable(WritableRenderedImage source, BandedSampleModel sampleModel, ColorModel colorModel, NumberRange<?>[] ranges, org.opengis.referencing.operation.MathTransform1D[] converters, org.opengis.referencing.operation.MathTransform1D[] inverses) Creates a new writable image which will compute values using the given converters. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTileObserver(TileObserver observer) Adds an observer to be notified when a tile is checked out for writing.booleanRestores the identity behavior for writable image, because it may have listeners attached to this specific instance.getWritableTile(int tileX, int tileY) Checks out a tile for writing.inthashCode()Restores the identity behavior for writable image, because it may have listeners attached to this specific instance.protected booleanmarkTileWritable(int tileX, int tileY, boolean writing) Sets or clears whether a tile is checked out for writing and notifies the listener if needed.voidreleaseWritableTile(int tileX, int tileY) Relinquishes the right to write to a tile.voidremoveTileObserver(TileObserver observer) Removes an observer from the list of observers notified when a tile is checked out for writing.voidSets a region of the image to the contents of the given raster.Methods inherited from class org.apache.sis.image.BandedSampleConverter
computeTile, create, getColorModel, getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getProperty, getPropertyNames, getWidth, prefetchMethods inherited from class org.apache.sis.image.ComputedImage
clearErrorFlags, createTile, dispose, equalsBase, getDestination, getSampleModel, getSource, getSource, getSources, getTile, getTileHeight, getTileWidth, getWritableTileIndices, hashCodeBase, hasTileWriters, isTileWritable, markDirtyTiles, reference, setDestination, sourceTileChangedMethods inherited from class org.apache.sis.image.PlanarImage
copyData, getBounds, getData, getData, getNumXTiles, getNumYTiles, getTileGridXOffset, getTileGridYOffset, toString, verifyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.image.RenderedImage
copyData, getColorModel, getData, getData, getHeight, getMinTileX, getMinTileY, getMinX, getMinY, getNumXTiles, getNumYTiles, getProperty, getPropertyNames, getSampleModel, getSources, getTile, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, getWidthMethods inherited from interface java.awt.image.WritableRenderedImage
getWritableTileIndices, hasTileWriters, isTileWritable
-
Field Details
-
inverses
private final org.opengis.referencing.operation.MathTransform1D[] inversesThe converters for computing the source values from a converted value. -
observers
The observers, ornullif none. This is a copy-on-write array: values are never modified after construction (new arrays are created). This field is declared volatile because it is read without synchronization bymarkTileWritable(int, int, boolean). Since this is a copy-on-write array, it is okay to omit synchronization for that method but we still need the memory effect.
-
-
Constructor Details
-
Writable
Writable(WritableRenderedImage source, BandedSampleModel sampleModel, ColorModel colorModel, NumberRange<?>[] ranges, org.opengis.referencing.operation.MathTransform1D[] converters, org.opengis.referencing.operation.MathTransform1D[] inverses) Creates a new writable image which will compute values using the given converters.
-
-
Method Details
-
addTileObserver
Adds an observer to be notified when a tile is checked out for writing. If the observer is already present, it will receive multiple notifications.- Specified by:
addTileObserverin interfaceWritableRenderedImage- Parameters:
observer- the observer to notify.
-
removeTileObserver
Removes an observer from the list of observers notified when a tile is checked out for writing. If the observer was not registered, nothing happens. If the observer was registered for multiple notifications, it will now be registered for one fewer.- Specified by:
removeTileObserverin interfaceWritableRenderedImage- Parameters:
observer- the observer to stop notifying.
-
markTileWritable
protected boolean markTileWritable(int tileX, int tileY, boolean writing) Sets or clears whether a tile is checked out for writing and notifies the listener if needed.- Overrides:
markTileWritablein classComputedImage- Parameters:
tileX- the x index of the tile to acquire or release.tileY- the y index of the tile to acquire or release.writing-truefor acquiring the tile, orfalsefor releasing it.- Returns:
trueif the tile goes from having no writers to having one writer (may happen ifwritingistrue), or goes from having one writer to no writers (may happen ifwritingisfalse).- See Also:
-
getWritableTile
Checks out a tile for writing.- Specified by:
getWritableTilein interfaceWritableRenderedImage- Parameters:
tileX- the x index of the tile.tileY- the y index of the tile.- Returns:
- the specified tile as a writable tile.
-
releaseWritableTile
public void releaseWritableTile(int tileX, int tileY) Relinquishes the right to write to a tile. If the tile goes from having one writer to having no writers, the values are inverse converted and written in the original image. If the caller continues to write to the tile, the results are undefined.- Specified by:
releaseWritableTilein interfaceWritableRenderedImage- Parameters:
tileX- the x index of the tile.tileY- the y index of the tile.
-
setData
Sets a region of the image to the contents of the given raster. The raster is assumed to be in the same coordinate space as this image. The operation is clipped to the bounds of this image.- Specified by:
setDatain interfaceWritableRenderedImage- Parameters:
data- the values to write in this image.
-
hashCode
public int hashCode()Restores the identity behavior for writable image, because it may have listeners attached to this specific instance.- Overrides:
hashCodein classBandedSampleConverter
-
equals
Restores the identity behavior for writable image, because it may have listeners attached to this specific instance.- Overrides:
equalsin classBandedSampleConverter
-