Class SingleImageStore
java.lang.Object
org.apache.sis.storage.DataStore
org.apache.sis.internal.storage.URIDataStore
org.apache.sis.internal.storage.PRJDataStore
org.apache.sis.internal.storage.image.WorldFileStore
org.apache.sis.internal.storage.image.SingleImageStore
- All Implemented Interfaces:
AutoCloseable,ResourceOnFileSystem,StoreResource,DataSet,GridCoverageResource,Resource,Localized
- Direct Known Subclasses:
SingleImageStore.Writable
A world file store which is expected to contain exactly one image.
This class is used for image formats that are restricted to one image per file.
Examples: PNG and BMP image formats.
- Since:
- 1.2
- Version:
- 1.2
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classThe writable variant ofMultiImageStore.Nested classes/interfaces inherited from class org.apache.sis.internal.storage.image.WorldFileStore
WorldFileStore.ComponentsNested classes/interfaces inherited from class org.apache.sis.internal.storage.PRJDataStore
PRJDataStore.AuxiliaryContent, PRJDataStore.Provider -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate WorldFileResourceThe singleton resource in this aggregate.Fields inherited from class org.apache.sis.internal.storage.image.WorldFileStore
CELL_ANCHOR, identifiers, MAIN_IMAGE, suffixFields inherited from class org.apache.sis.internal.storage.PRJDataStore
crs, encoding, PRJFields inherited from class org.apache.sis.internal.storage.URIDataStore
location -
Constructor Summary
ConstructorsConstructorDescriptionSingleImageStore(FormatFinder format) Creates a new store from the given file, URL or stream. -
Method Summary
Modifier and TypeMethodDescription(package private) final WorldFileResourcedelegate()Returns the singleton resource in this aggregate.final Optional<org.opengis.geometry.Envelope>Returns the envelope of the grid geometry if known.final GridGeometryReturns the valid extent of grid coordinates together with the conversion from those grid coordinates to real world coordinates.final RasterLoadingStrategyReturns an indication about when the "physical" loading of raster data will happen.final List<double[]>Returns the preferred resolutions (in units of CRS axes) for read operations in this data store.final List<SampleDimension>Returns the ranges of sample values in each band.(package private) final booleanReturnstruefor meaning that the singleton component will be used only for internal purposes.final GridCoverageread(GridGeometry domain, int... ranges) Loads a subset of the image wrapped by this resource.final booleansetLoadingStrategy(RasterLoadingStrategy strategy) Sets the preferred strategy about when to do the "physical" loading of raster data.final GridCoverageResourceRequests a subset of the coverage.Methods inherited from class org.apache.sis.internal.storage.image.WorldFileStore
close, components, components, createImageResource, getComponentFiles, getCurrentReader, getGridGeometry, getImageFormat, getMetadata, prepareReader, reader, remove, resources, setGridGeometryMethods inherited from class org.apache.sis.internal.storage.PRJDataStore
deleteAuxiliaryFile, getOpenParameters, listComponentFiles, readAuxiliaryFile, readPRJ, writeAuxiliaryFile, writePRJMethods inherited from class org.apache.sis.internal.storage.URIDataStore
addTitleOrIdentifier, getIdentifier, getOriginator, getSpecifiedPath, location, parametersMethods inherited from class org.apache.sis.storage.DataStore
addListener, findResource, getDisplayName, getLocale, getNativeMetadata, getProvider, removeListener, setLocale, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sis.storage.Resource
addListener, getIdentifier, getMetadata, removeListener
-
Field Details
-
delegate
The singleton resource in this aggregate. Fetched when first needed.
-
-
Constructor Details
-
SingleImageStore
SingleImageStore(FormatFinder format) throws DataStoreException, IOException Creates a new store from the given file, URL or stream.- Parameters:
format- information about the storage (URL, stream, etc) and the reader/writer to use.- Throws:
DataStoreException- if an error occurred while opening the stream.IOException- if an error occurred while creating the image reader instance.
-
-
Method Details
-
isComponentHidden
final boolean isComponentHidden()Returnstruefor meaning that the singleton component will be used only for internal purposes.- Overrides:
isComponentHiddenin classWorldFileStore
-
delegate
Returns the singleton resource in this aggregate. The delegate is used for allGridCoverageResourceoperations but not for the following operations:URIDataStore.getIdentifier()because we want the filename without ":1" suffix (the image index).WorldFileStore.getMetadata()because it is richer thanAbstractResource.getMetadata().
- Throws:
DataStoreException
-
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 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:
-
getEnvelope
Returns the envelope of the grid geometry if known. The envelope is absent if the grid geometry does not provide this information.- Specified by:
getEnvelopein interfaceDataSet- Returns:
- the spatiotemporal resource extent. May be absent if none or too costly to compute.
- Throws:
DataStoreException- if an error occurred while reading or computing the envelope.
-
getResolutions
Returns the preferred resolutions (in units of CRS axes) for read operations in this data store.- Specified by:
getResolutionsin interfaceGridCoverageResource- Returns:
- preferred resolutions for read operations in this data store, or an empty array if none.
- 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:
-
subset
public final GridCoverageResource subset(Query query) throws UnsupportedQueryException, DataStoreException Requests a subset of the coverage.- Specified by:
subsetin interfaceGridCoverageResource- Parameters:
query- definition of domain (grid extent) and range (sample dimensions) filtering applied at reading time.- Returns:
- resulting coverage resource (never
null). - Throws:
UnsupportedQueryException- if the given query is not valid for thisGridCoverageResource. This includes query validation errors.DataStoreException- if another error occurred while processing the query.- 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.
-
getLoadingStrategy
Returns an indication about when the "physical" loading of raster data will happen.- Specified by:
getLoadingStrategyin interfaceGridCoverageResource- Returns:
- current raster data loading strategy for this resource.
- Throws:
DataStoreException- if an error occurred while fetching data store configuration.
-
setLoadingStrategy
Sets the preferred strategy about when to do the "physical" loading of raster data. Implementations are free to ignore this parameter or to replace the given strategy by the closest alternative that this resource can support.- Specified by:
setLoadingStrategyin interfaceGridCoverageResource- Parameters:
strategy- the desired strategy for loading raster data.- Returns:
trueif the given strategy has been accepted, orfalseif this implementation replaced the given strategy by an alternative.- Throws:
DataStoreException- if an error occurred while setting data store configuration.
-