Class WorldFileResource
java.lang.Object
org.apache.sis.storage.AbstractResource
org.apache.sis.storage.AbstractGridCoverageResource
org.apache.sis.internal.storage.image.WorldFileResource
- All Implemented Interfaces:
StoreResource,DataSet,GridCoverageResource,Resource
- Direct Known Subclasses:
WritableResource
A single image in a
WorldFileStore.- Since:
- 1.2
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SoftReference<GridCoverage>Cached coverage for the full image, ornullif none.private GridGeometryThe grid geometry of this resource.private org.opengis.util.GenericNameThe identifier as a sequence number in the namespace of theWorldFileStore.private intIndex of the image to read or write in the image file.private List<SampleDimension>The ranges of sample values, computed when first needed.private WorldFileStoreThe parent data store, ornullif this resource is not valid anymore.(package private) static final intThe dimensions of x and y axes.(package private) static final intThe dimensions of x and y axes.Fields inherited from class org.apache.sis.storage.AbstractResource
listeners -
Constructor Summary
ConstructorsConstructorDescriptionWorldFileResource(WorldFileStore store, StoreListeners parent, int imageIndex, GridGeometry gridGeometry) Creates a new resource. -
Method Summary
Modifier and TypeMethodDescription(package private) final voidDecrements the image index.(package private) final voiddispose()Notifies this resource that it should not be used anymore.final GridGeometryReturns the valid extent of grid coordinates together with the conversion from those grid coordinates to real world coordinates.final Optional<org.opengis.util.GenericName>Returns the resource identifier.(package private) final intReturns the index of the image to read or write in the image file.final DataStoreReturns the data store that produced this resource.final List<SampleDimension>Returns the ranges of sample values in each band.final GridCoverageread(GridGeometry domain, int... ranges) Loads a subset of the image wrapped by this resource.(package private) final voidsetGridCoverage(GridCoverage coverage) Sets the grid coverage to the given value.(package private) final WorldFileStorestore()Returns the data store.Methods inherited from class org.apache.sis.storage.AbstractGridCoverageResource
canNotRead, createMetadata, getEnvelope, logReadOperationMethods inherited from class org.apache.sis.storage.AbstractResource
addListener, clearCache, getMetadata, getSynchronizationLock, removeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sis.storage.GridCoverageResource
getLoadingStrategy, getResolutions, setLoadingStrategy, subsetMethods inherited from interface org.apache.sis.storage.Resource
addListener, getMetadata, removeListener
-
Field Details
-
X_DIMENSION
static final int X_DIMENSIONThe dimensions of x and y axes. Static constants for now, may become configurable fields in the future.- See Also:
-
Y_DIMENSION
static final int Y_DIMENSIONThe dimensions of x and y axes. Static constants for now, may become configurable fields in the future.- See Also:
-
store
The parent data store, ornullif this resource is not valid anymore. -
imageIndex
private int imageIndexIndex of the image to read or write in the image file. This is usually 0. May be decremented when other resources are removed.- See Also:
-
identifier
private org.opengis.util.GenericName identifierThe identifier as a sequence number in the namespace of theWorldFileStore. The first image has the sequence number "1". This is computed when first needed.WritableResourcehave no identifier because the numbers may change.- See Also:
-
gridGeometry
The grid geometry of this resource. The grid extent is the image size.- See Also:
-
sampleDimensions
The ranges of sample values, computed when first needed. Shall be an unmodifiable list.- See Also:
-
fullCoverage
Cached coverage for the full image, ornullif none.
-
-
Constructor Details
-
WorldFileResource
WorldFileResource(WorldFileStore store, StoreListeners parent, int imageIndex, GridGeometry gridGeometry) Creates a new resource. This resource will have its own set of listeners, but the listeners of the data store that created this resource will be notified as well.
-
-
Method Details
-
getOriginator
Returns the data store that produced this resource.- Specified by:
getOriginatorin interfaceStoreResource- Returns:
- the data store that created this resource.
-
store
Returns the data store.- Throws:
DataStoreException- if this resource is not valid anymore.
-
getImageIndex
final int getImageIndex()Returns the index of the image to read or write in the image file. This is usually 0. Note that contrarily togetIdentifier(), this index is not guaranteed to be constant. -
decrementImageIndex
Decrements the image index. This is needed if images before this image have been removed.- Throws:
DataStoreException
-
getIdentifier
Returns the resource identifier. The name space is the file name and the local part of the name is the image index number, starting at 1. This identifier should be constant.- Specified by:
getIdentifierin interfaceResource- Overrides:
getIdentifierin classAbstractResource- Returns:
- a persistent identifier unique within the data store, or absent if this resource has no such identifier.
- Throws:
DataStoreException- if an error occurred while fetching the identifier.- See Also:
-
getGridGeometry
Returns the valid extent of grid coordinates together with the conversion from those grid coordinates to real world coordinates. The CRS and "pixels to CRS" conversion may be unknown if this image is not themain image, or if the*.prjand/or world auxiliary file has not been found.- Specified by:
getGridGeometryin interfaceGridCoverageResource- Returns:
- extent of grid coordinates together with their mapping to "real world" coordinates.
- Throws:
DataStoreException- if an error occurred while reading definitions from the underlying data store.- See Also:
-
getSampleDimensions
Returns the ranges of sample values in each band. Those sample dimensions describe colors because the World File format does not provide more information.- Specified by:
getSampleDimensionsin interfaceGridCoverageResource- Returns:
- ranges of sample values together with their mapping to "real values".
- Throws:
DataStoreException- if an error occurred while reading definitions from the underlying data store.- See Also:
-
read
Loads a subset of the image wrapped by this resource.- Specified by:
readin interfaceGridCoverageResource- Parameters:
domain- desired grid extent and resolution, ornullfor reading the whole domain.ranges- 0-based indices of sample dimensions to read, ornullor an empty sequence for reading them all.- Returns:
- the grid coverage for the specified domain and ranges.
- Throws:
DataStoreException- if an error occurred while reading the grid coverage data.
-
setGridCoverage
Sets the grid coverage to the given value. This is used during write operations only. -
dispose
final void dispose()Notifies this resource that it should not be used anymore.
-