Class MultiResolutionCoverageLoader
java.lang.Object
org.apache.sis.internal.map.coverage.MultiResolutionCoverageLoader
A helper class for reading
GridCoverage instances at various resolutions.
The resolutions are inferred from GridCoverageResource.getResolutions(),
using default values if necessary. The objective CRS does not need to be the same
than the coverage CRS, in which case transformations are applied at the point in
the center of the display bounds.
Multi-threading
Instances of this class are immutable (except for the cache) and safe for use by multiple threads. However, it assumes that theGridCoverageResource given to the constructor is also thread-safe;
this class does not synchronize accesses to the resource (because it may be used outside this class anyway).- Since:
- 1.2
- Version:
- 1.2
- Author:
- Martin Desruisseaux (Geomatys)
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal GridCoverageResourceThe resource from which to read grid coverages. -
Constructor Summary
ConstructorsConstructorDescriptionMultiResolutionCoverageLoader(GridCoverageResource resource, org.opengis.geometry.Envelope domain, int[] range) Creates a new loader of grid coverages from the given resource. -
Method Summary
Modifier and TypeMethodDescriptionfinal GridCoveragegetOrLoad(int level) Returns the coverage at the given level if it is present in the cache, or loads and caches it otherwise.final GridCoveragegetOrLoad(GridGeometry domain, int[] range) If the a grid coverage for the given domain and range is in the cache, returns that coverage.toString()Returns a string representation of this loader for debugging purpose.
-
Field Details
-
resource
The resource from which to read grid coverages.
-
-
Constructor Details
-
MultiResolutionCoverageLoader
public MultiResolutionCoverageLoader(GridCoverageResource resource, org.opengis.geometry.Envelope domain, int[] range) throws DataStoreException Creates a new loader of grid coverages from the given resource. The loader assumes a pyramid with resolutions declared by the given resource if present, or computes default resolutions otherwise.- Parameters:
resource- the resource from which to read grid coverages. Should be thread-safe.domain- desired spatiotemporal region in any CRS, ornullfor no sub-area.range- 0-based indices of sample dimensions to read, ornullfor all.- Throws:
DataStoreException- if an error occurred while querying the resource for resolutions.
-
-
Method Details
-
getOrLoad
Returns the coverage at the given level if it is present in the cache, or loads and caches it otherwise.- Parameters:
level- pyramid level of the desired coverage.- Returns:
- the coverage at the specified level (never null).
- Throws:
DataStoreException- if an error occurred while loading the coverage.
-
getOrLoad
If the a grid coverage for the given domain and range is in the cache, returns that coverage. Otherwise loads the coverage and eventually caches it. The caching happens only if the given domain and range are managed by this loader.- Parameters:
domain- desired grid extent and resolution, ornullfor reading the whole domain.range- 0-based indices of sample dimensions to read, ornullor an empty sequence for reading them all.- Returns:
- the grid coverage for the specified domain and range.
- Throws:
DataStoreException- if an error occurred while reading the grid coverage data.
-
toString
Returns a string representation of this loader for debugging purpose. Default implementation formats the resolution thresholds in a table with "cached" word after the level having a cached coverage.
-