Package org.apache.sis.storage.geotiff
Class MultiResolutionImage
java.lang.Object
org.apache.sis.internal.storage.GridResourceWrapper
org.apache.sis.storage.geotiff.MultiResolutionImage
- All Implemented Interfaces:
ResourceOnFileSystem
,StoreResource
,DataSet
,GridCoverageResource
,Resource
final class MultiResolutionImage
extends GridResourceWrapper
implements ResourceOnFileSystem, StoreResource
A list of Image File Directory (FID) where the first entry is the image at finest resolution
and following entries are images at finer resolutions.
- Since:
- 1.2
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.opengis.referencing.operation.CoordinateOperation
The last coordinate operation returned by#getTransformFrom(CoordinateReferenceSystem)
.private final ImageFileDirectory[]
Descriptions of each Image File Directory (IFD) in the GeoTIFF file.private org.opengis.util.NameSpace
Name of the image at finest resolution.private final double[][]
Resolutions (in units of CRS axes) of each level from finest to coarsest resolution. -
Constructor Summary
ConstructorsConstructorDescriptionMultiResolutionImage
(List<ImageFileDirectory> overviews) Creates a multi-resolution images with all the given reduced-resolution (overview) images, from finest resolution to coarsest resolution. -
Method Summary
Modifier and TypeMethodDescriptionprotected GridCoverageResource
Creates the resource on which to delegate operations.Path[]
Gets the paths to files used by this resource, or an empty array if unknown.private ImageFileDirectory
getImageFileDirectory
(int index) Completes and returns the image at the given pyramid level.final DataStore
Returns the data store that produced this resource.private double[]
getResolution
(GridGeometry domain) Converts a resolution from units in the given CRS to units of this coverage CRS.List<double[]>
Returns the preferred resolutions (in units of CRS axes) for read operations in this data store.protected final Object
Returns the object on which to perform all synchronizations for thread-safety.read
(GridGeometry domain, int... ranges) Loads a subset of the grid coverage represented by this resource.private double[]
resolution
(int level) Returns the resolution (in units of CRS axes) for the given level.Methods inherited from class org.apache.sis.internal.storage.GridResourceWrapper
addListener, closeDataStore, getEnvelope, getGridGeometry, getIdentifier, getLoadingStrategy, getMetadata, getSampleDimensions, removeListener, setLoadingStrategy, source
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.sis.storage.GridCoverageResource
subset
Methods inherited from interface org.apache.sis.storage.Resource
addListener, getIdentifier, getMetadata, removeListener
-
Field Details
-
namespace
private org.opengis.util.NameSpace namespaceName of the image at finest resolution. This is used as the namespace for overviews. -
levels
Descriptions of each Image File Directory (IFD) in the GeoTIFF file. Should have at least 2 elements. The full-resolution image shall be at index 0. -
resolutions
private final double[][] resolutionsResolutions (in units of CRS axes) of each level from finest to coarsest resolution. Array elements may benull
if not yet computed.- See Also:
-
lastOperation
private volatile org.opengis.referencing.operation.CoordinateOperation lastOperationThe last coordinate operation returned by#getTransformFrom(CoordinateReferenceSystem)
. Used as an optimization in the common case where the same CRS is used for many requests.
-
-
Constructor Details
-
MultiResolutionImage
MultiResolutionImage(List<ImageFileDirectory> overviews) Creates a multi-resolution images with all the given reduced-resolution (overview) images, from finest resolution to coarsest resolution. The full-resolution image shall be at index 0.
-
-
Method Details
-
getOriginator
Returns the data store that produced this resource.- Specified by:
getOriginator
in interfaceStoreResource
- Returns:
- the data store that created this resource.
-
getComponentFiles
Gets the paths to files used by this resource, or an empty array if unknown.- Specified by:
getComponentFiles
in interfaceResourceOnFileSystem
- Returns:
- files used by this resource. Should never be
null
.
-
getSynchronizationLock
Returns the object on which to perform all synchronizations for thread-safety.- Specified by:
getSynchronizationLock
in classGridResourceWrapper
- Returns:
- the object on which to perform synchronizations.
-
createSource
Creates the resource on which to delegate operations. The source is the first image, the one having finest resolution. By Cloud Optimized GeoTIFF (COG) convention, this is the image containing metadata (CRS). This method is invoked in a synchronized block when first needed and the result is cached.- Specified by:
createSource
in classGridResourceWrapper
- Returns:
- the resource on which to delegate operations.
- Throws:
DataStoreException
- if the resource cannot be created.
-
getImageFileDirectory
Completes and returns the image at the given pyramid level. Indices are in the same order as the images appear in the TIFF file, with 0 for the full resolution image.- Parameters:
index
- image index (level) in the pyramid, with 0 for finest resolution.- Returns:
- image at the given pyramid level.
- Throws:
IOException
DataStoreException
-
resolution
Returns the resolution (in units of CRS axes) for the given level.- Parameters:
level
- the desired resolution level, numbered from finest to coarsest resolution.- Returns:
- resolution at the specified level, not cloned (caller shall not modify).
- Throws:
DataStoreException
-
getResolutions
Returns the preferred resolutions (in units of CRS axes) for read operations in this data store. Elements are ordered from finest (smallest numbers) to coarsest (largest numbers) resolution.- Specified by:
getResolutions
in interfaceGridCoverageResource
- Overrides:
getResolutions
in classGridResourceWrapper
- 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:
-
getResolution
Converts a resolution from units in the given CRS to units of this coverage CRS.- Parameters:
domain
- the geometry from which to get the resolution.- Returns:
- resolution from the given grid geometry in units of this coverage CRS, or
null
. - Throws:
DataStoreException
-
read
Loads a subset of the grid coverage represented by this resource.- Specified by:
read
in interfaceGridCoverageResource
- Overrides:
read
in classGridResourceWrapper
- 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.
-