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 ofGridCoverageinstances.(package private) final int[]Whether loading of grid coverages should be deferred to rendering time.private final GridGeometryThe domain to request when reading a coverage from the resource.private final int[]The sample dimensions to request when loading slices from the #resources. -
Constructor Summary
ConstructorsConstructorDescriptionLoader(int[] deferred, GridGeometry domain, int[] ranges) Creates a new loader. -
Method Summary
Modifier and TypeMethodDescription(package private) final GridCoveragegetOrLoad(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 aslongvalues. 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. -
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 the #resources. -
coverages
Cache ofGridCoverageinstances. Keys are index in theConcatenatedGridCoverage.slicesarray.
-
-
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 theGridCoverageResourcein theConcatenatedGridCoverage.slicesarray.source- value ofslices[key], used only if data need to be loaded.- Returns:
- the coverage at the given index.
- Throws:
NullPointerException- if noGridCoverageResourceare expected to exist.DataStoreException- if an error occurred while loading data from the resource.
-