Class 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 Details

    • name

      private String name
      Name of this resource.
    • gridGeometry

      private final GridGeometry gridGeometry
      The grid geometry of this aggregated resource.
      See Also:
    • sampleDimensions

      private final List<SampleDimension> sampleDimensions
      The ranges of sample values of this aggregated resource. Shall be an unmodifiable list.
      See Also:
    • isConverted

      final boolean isConverted
      Whether all SampleDimension represent "real world" values.
    • slices

      private final GridCoverageResource[] slices
      The slices of this resource, in the same order than GridSliceLocator.sliceLows. Each slice is not necessarily 1 cell tick; larger slices are accepted. This array shall be read-only.
    • deferredLoading

      private int[] deferredLoading
      Whether loading of grid coverages should be deferred to rendering time. This is a bit set packed as int 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.
      This array shall be read-only. If changes are desired, a new array shall be created (copy-on-write).
      See Also:
    • locator

      final GridSliceLocator locator
      The object for identifying indices in the slices array.
    • strategy

      final MergeStrategy strategy
      Algorithm to apply when more than one grid coverage can be found at the same grid index. This is null if no merge should be attempted.
    • envelope

      private ImmutableEnvelope envelope
      The envelope of this aggregate, or null if not yet computed. May also be null if no slice declare an envelope, or if the union cannot be computed.
      See Also:
    • envelopeIsEvaluated

      private boolean envelopeIsEvaluated
      Whether envelope has been initialized. The envelope may still be null if the initialization failed.
    • resolutions

      private double[][] resolutions
      The resolutions, or null if not yet computed. Can be an empty array after computation. Shall be read-only after computation.
      See Also:
  • Constructor Details

  • Method Details

    • apply

      public final Resource apply(MergeStrategy s)
      Returns a coverage with the same data than this coverage but a different merge strategy.
      Specified by:
      apply in interface AggregatedResource
      Parameters:
      s - the new merge strategy to apply.
      Returns:
      resource using the specified strategy (may be this).
    • setName

      public void setName(String name)
      Modifies the name of the resource. This information is used for metadata.
      Specified by:
      setName in interface AggregatedResource
      Parameters:
      name - new name of the resource.
    • createMetadata

      protected org.opengis.metadata.Metadata createMetadata() throws DataStoreException
      Creates when first requested the metadata about this resource.
      Overrides:
      createMetadata in class AbstractGridCoverageResource
      Returns:
      the newly created metadata, or null if unknown.
      Throws:
      DataStoreException - if an error occurred while reading metadata from this resource.
    • getGridGeometry

      public final GridGeometry getGridGeometry()
      Returns the grid geometry of this aggregated resource.
      Specified by:
      getGridGeometry in interface GridCoverageResource
      Returns:
      extent of grid coordinates together with their mapping to "real world" coordinates.
      See Also:
    • getSampleDimensions

      public final List<SampleDimension> getSampleDimensions()
      Returns the ranges of sample values of this aggregated resource.
      Specified by:
      getSampleDimensions in interface GridCoverageResource
      Returns:
      ranges of sample values together with their mapping to "real values".
      See Also:
    • getEnvelope

      public Optional<org.opengis.geometry.Envelope> getEnvelope() throws DataStoreException
      Returns the spatiotemporal envelope of this resource.
      Specified by:
      getEnvelope in interface DataSet
      Overrides:
      getEnvelope in class AbstractGridCoverageResource
      Returns:
      the spatiotemporal resource extent.
      Throws:
      DataStoreException - if an error occurred while reading or computing the envelope.
      See Also:
    • getResolutions

      public List<double[]> getResolutions() throws DataStoreException
      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 interface GridCoverageResource
      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

      public RasterLoadingStrategy getLoadingStrategy() throws DataStoreException
      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 interface GridCoverageResource
      Returns:
      current raster data loading strategy for this resource.
      Throws:
      DataStoreException - if an error occurred while fetching data store configuration.
    • setLoadingStrategy

      public boolean setLoadingStrategy(RasterLoadingStrategy strategy) throws DataStoreException
      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 interface GridCoverageResource
      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)
      Returns true if the loading of the coverage at the given index is deferred.
    • read

      public GridCoverage read(GridGeometry domain, int... ranges) throws DataStoreException
      Loads a subset of the grid coverage represented by this resource.
      Specified by:
      read in interface GridCoverageResource
      Parameters:
      domain - desired grid extent and resolution, or null for reading the whole domain.
      ranges - 0-based indices of sample dimensions to read, or null 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.