Package org.apache.sis.storage.aggregate
Class ConcatenatedGridResource
java.lang.Object
org.apache.sis.storage.AbstractResource
org.apache.sis.storage.AbstractGridCoverageResource
org.apache.sis.storage.aggregate.ConcatenatedGridResource
- All Implemented Interfaces:
AggregatedResource
,DataSet
,GridCoverageResource
,Resource
final class ConcatenatedGridResource
extends AbstractGridCoverageResource
implements AggregatedResource
A grid coverage resource where a single dimension is the concatenation of many grid coverage resources.
All components must have the same "grid to CRS" transform.
Instances of
ConcatenatedGridResource
are created by CoverageAggregator
.- Since:
- 1.3
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int[]
Whether loading of grid coverages should be deferred to rendering time.private ImmutableEnvelope
The envelope of this aggregate, ornull
if not yet computed.private boolean
Whetherenvelope
has been initialized.private final GridGeometry
The grid geometry of this aggregated resource.(package private) final boolean
Whether allSampleDimension
represent "real world" values.(package private) final GridSliceLocator
The object for identifying indices in theslices
array.private String
Name of this resource.private double[][]
The resolutions, ornull
if not yet computed.private final List<SampleDimension>
The ranges of sample values of this aggregated resource.private final GridCoverageResource[]
The slices of this resource, in the same order thanGridSliceLocator.sliceLows
.(package private) final MergeStrategy
Algorithm to apply when more than one grid coverage can be found at the same grid index.Fields inherited from class org.apache.sis.storage.AbstractResource
listeners
-
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
ConcatenatedGridResource
(String name, StoreListeners listeners, GridGeometry domain, List<SampleDimension> ranges, GridCoverageResource[] slices, GridSliceLocator locator, MergeStrategy strategy) Creates a new aggregated resource.private
ConcatenatedGridResource
(ConcatenatedGridResource source, MergeStrategy strategy) Creates a new resource with the same data than given resource but a different merge strategy. -
Method Summary
Modifier and TypeMethodDescriptionfinal Resource
Returns a coverage with the same data than this coverage but a different merge strategy.protected org.opengis.metadata.Metadata
Creates when first requested the metadata about this resource.Optional<org.opengis.geometry.Envelope>
Returns the spatiotemporal envelope of this resource.final GridGeometry
Returns the grid geometry of this aggregated resource.Returns an indication about when the "physical" loading of raster data will happen.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 of this aggregated resource.private boolean
isDeferred
(int i) Returnstrue
if the loading of the coverage at the given index is deferred.read
(GridGeometry domain, int... ranges) Loads a subset of the grid coverage represented by this resource.boolean
setLoadingStrategy
(RasterLoadingStrategy strategy) Sets the preferred strategy about when to do the "physical" loading of raster data.void
Modifies the name of the resource.Methods inherited from class org.apache.sis.storage.AbstractGridCoverageResource
canNotRead, logReadOperation
Methods inherited from class org.apache.sis.storage.AbstractResource
addListener, clearCache, getIdentifier, getMetadata, getSynchronizationLock, removeListener
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
-
name
Name of this resource. -
gridGeometry
The grid geometry of this aggregated resource.- See Also:
-
sampleDimensions
The ranges of sample values of this aggregated resource. Shall be an unmodifiable list.- See Also:
-
isConverted
final boolean isConvertedWhether allSampleDimension
represent "real world" values. -
slices
The slices of this resource, in the same order thanGridSliceLocator.sliceLows
. Each slice is not necessarily 1 cell tick; larger slices are accepted. This array shall be read-only. -
deferredLoading
private int[] deferredLoadingWhether loading of grid coverages should be deferred to rendering time. This is a bit set packed asint
values. A bit value of 1 means that the coverages at the corresponding index should be loaded from the slices at same index only when first needed.Whether a bit is set or not depends on two factor:
- Whether deferred loading has been requested by a call to
setLoadingStrategy(RasterLoadingStrategy)
. - Whether the slice at the corresponding index can handle deferred loading itself. In such case, we let the resource manages its own lazy loading.
- Whether deferred loading has been requested by a call to
-
locator
The object for identifying indices in theslices
array. -
strategy
Algorithm to apply when more than one grid coverage can be found at the same grid index. This isnull
if no merge should be attempted. -
envelope
The envelope of this aggregate, ornull
if not yet computed. May also benull
if no slice declare an envelope, or if the union cannot be computed.- See Also:
-
envelopeIsEvaluated
private boolean envelopeIsEvaluatedWhetherenvelope
has been initialized. The envelope may still be null if the initialization failed. -
resolutions
private double[][] resolutionsThe resolutions, ornull
if not yet computed. Can be an empty array after computation. Shall be read-only after computation.- See Also:
-
-
Constructor Details
-
ConcatenatedGridResource
ConcatenatedGridResource(String name, StoreListeners listeners, GridGeometry domain, List<SampleDimension> ranges, GridCoverageResource[] slices, GridSliceLocator locator, MergeStrategy strategy) Creates a new aggregated resource.- Parameters:
name
- name of the grid coverage to create.listeners
- listeners of the parent resource, ornull
if none.domain
- value to be returned bygetGridGeometry()
.ranges
- value to be returned bygetSampleDimensions()
.slices
- the slices of this resource, in the same order thanGridSliceLocator.sliceLows
.
-
ConcatenatedGridResource
Creates a new resource with the same data than given resource but a different merge strategy. The two resources will share the same cache of loaded coverages.- Parameters:
source
- the resource to copy.strategy
- the new merge strategy.
-
-
Method Details
-
apply
Returns a coverage with the same data than this coverage but a different merge strategy.- Specified by:
apply
in interfaceAggregatedResource
- Parameters:
s
- the new merge strategy to apply.- Returns:
- resource using the specified strategy (may be
this
).
-
setName
Modifies the name of the resource. This information is used for metadata.- Specified by:
setName
in interfaceAggregatedResource
- Parameters:
name
- new name of the resource.
-
createMetadata
Creates when first requested the metadata about this resource.- Overrides:
createMetadata
in classAbstractGridCoverageResource
- Returns:
- the newly created metadata, or
null
if unknown. - Throws:
DataStoreException
- if an error occurred while reading metadata from this resource.
-
getGridGeometry
Returns the grid geometry of this aggregated resource.- Specified by:
getGridGeometry
in interfaceGridCoverageResource
- Returns:
- extent of grid coordinates together with their mapping to "real world" coordinates.
- See Also:
-
getSampleDimensions
Returns the ranges of sample values of this aggregated resource.- Specified by:
getSampleDimensions
in interfaceGridCoverageResource
- Returns:
- ranges of sample values together with their mapping to "real values".
- See Also:
-
getEnvelope
Returns the spatiotemporal envelope of this resource.- Specified by:
getEnvelope
in interfaceDataSet
- Overrides:
getEnvelope
in classAbstractGridCoverageResource
- Returns:
- the spatiotemporal resource extent.
- Throws:
DataStoreException
- if an error occurred while reading or computing the envelope.- See Also:
-
getResolutions
Returns the preferred resolutions (in units of CRS axes) for read operations in this data store. This method returns only the resolution that are declared by all coverages.- 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:
-
getLoadingStrategy
Returns an indication about when the "physical" loading of raster data will happen. This method returns the most conservative value of all slices.- 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. Slices are free to replace the given strategy by another one.- Specified by:
setLoadingStrategy
in interfaceGridCoverageResource
- Parameters:
strategy
- the desired strategy for loading raster data.- Returns:
true
if the given strategy has been accepted by at least one slice.- Throws:
DataStoreException
- if an error occurred while setting data store configuration.
-
isDeferred
private boolean isDeferred(int i) Returnstrue
if the loading of the coverage at the given index is deferred. -
read
Loads a subset of the grid coverage represented 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.
-