Package org.apache.sis.storage.aggregate
Class ConcatenatedGridCoverage.Loader
java.lang.Object
org.apache.sis.storage.aggregate.ConcatenatedGridCoverage.Loader
- Enclosing class:
ConcatenatedGridCoverage
The class in charge of loading and caching grid coverages.
The same loader may be shared by many
ConcatenatedGridCoverage
instances.
Loaders are immutable (except for the cache) and thread-safe.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Cache
<Integer, GridCoverage> Cache ofGridCoverage
instances.(package private) final int[]
Whether loading of grid coverages should be deferred to rendering time.private final GridGeometry
The domain to request when reading a coverage from the resource.private final int[]
The sample dimensions to request when loading slices from theinvalid reference
#resources
-
Constructor Summary
ConstructorsConstructorDescriptionLoader
(int[] deferred, GridGeometry domain, int[] ranges) Creates a new loader. -
Method Summary
Modifier and TypeMethodDescription(package private) final GridCoverage
getOrLoad
(Integer key, GridCoverageResource source) Returns the coverage if available in the cache, or load it immediately otherwise.
-
Field Details
-
deferred
final int[] deferredWhether loading of grid coverages should be deferred to rendering time. This is a bit set packed aslong
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.- See Also:
-
domain
The domain to request when reading a coverage from the resource. -
ranges
private final int[] rangesThe sample dimensions to request when loading slices from theinvalid reference
#resources
-
coverages
Cache ofGridCoverage
instances. Keys are index in theConcatenatedGridCoverage.slices
array.
-
-
Constructor Details
-
Loader
Loader(int[] deferred, GridGeometry domain, int[] ranges) Creates a new loader.- Parameters:
deferred
- whether loading of grid coverages should be deferred to rendering time.domain
- grid geometry to request when loading data.ranges
- bands to request when loading coverages.
-
-
Method Details
-
getOrLoad
Returns the coverage if available in the cache, or load it immediately otherwise. This method shall be invoked only whenisDeferred(key) == true
. This method can be invoked from any thread.- Parameters:
key
- index of theGridCoverageResource
in theConcatenatedGridCoverage.slices
array.source
- value ofslices[key]
, used only if data need to be loaded.- Returns:
- the coverage at the given index.
- Throws:
NullPointerException
- if noGridCoverageResource
are expected to exist.DataStoreException
- if an error occurred while loading data from the resource.
-