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 class
The writable variant ofMultiImageStore
.Nested classes/interfaces inherited from class org.apache.sis.internal.storage.image.WorldFileStore
WorldFileStore.Components
Nested classes/interfaces inherited from class org.apache.sis.internal.storage.PRJDataStore
PRJDataStore.AuxiliaryContent, PRJDataStore.Provider
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate WorldFileResource
The singleton resource in this aggregate.Fields inherited from class org.apache.sis.internal.storage.image.WorldFileStore
CELL_ANCHOR, identifiers, MAIN_IMAGE, suffix
Fields inherited from class org.apache.sis.internal.storage.PRJDataStore
crs, encoding, PRJ
Fields 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 WorldFileResource
delegate()
Returns the singleton resource in this aggregate.final Optional<org.opengis.geometry.Envelope>
Returns the envelope of the grid geometry if known.final GridGeometry
Returns the valid extent of grid coordinates together with the conversion from those grid coordinates to real world coordinates.final RasterLoadingStrategy
Returns 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 boolean
Returnstrue
for meaning that the singleton component will be used only for internal purposes.final GridCoverage
read
(GridGeometry domain, int... ranges) Loads a subset of the image wrapped by this resource.final boolean
setLoadingStrategy
(RasterLoadingStrategy strategy) Sets the preferred strategy about when to do the "physical" loading of raster data.final GridCoverageResource
Requests 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, setGridGeometry
Methods inherited from class org.apache.sis.internal.storage.PRJDataStore
deleteAuxiliaryFile, getOpenParameters, listComponentFiles, readAuxiliaryFile, readPRJ, writeAuxiliaryFile, writePRJ
Methods inherited from class org.apache.sis.internal.storage.URIDataStore
addTitleOrIdentifier, getIdentifier, getOriginator, getSpecifiedPath, location, parameters
Methods inherited from class org.apache.sis.storage.DataStore
addListener, findResource, getDisplayName, getLocale, getNativeMetadata, getProvider, removeListener, setLocale, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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()Returnstrue
for meaning that the singleton component will be used only for internal purposes.- Overrides:
isComponentHidden
in classWorldFileStore
-
delegate
Returns the singleton resource in this aggregate. The delegate is used for allGridCoverageResource
operations 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*.prj
and/or world auxiliary file has not been found.- Specified by:
getGridGeometry
in 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:
getEnvelope
in 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:
getResolutions
in 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:
getSampleDimensions
in 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:
subset
in 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:
read
in interfaceGridCoverageResource
- Parameters:
domain
- desired grid extent and resolution, ornull
for reading the whole domain.ranges
- 0-based indices of sample dimensions to read, ornull
or 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:
getLoadingStrategy
in 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:
setLoadingStrategy
in interfaceGridCoverageResource
- Parameters:
strategy
- the desired strategy for loading raster data.- Returns:
true
if the given strategy has been accepted, orfalse
if this implementation replaced the given strategy by an alternative.- Throws:
DataStoreException
- if an error occurred while setting data store configuration.
-