Class DataCube

All Implemented Interfaces:
ResourceOnFileSystem, StoreResource, DataSet, GridCoverageResource, Resource
Direct Known Subclasses:
ImageFileDirectory

abstract class DataCube extends TiledGridResource implements ResourceOnFileSystem, StoreResource
One or many GeoTIFF images packaged as a single resource. This is typically a single two-dimensional image represented as a ImageFileDirectory. But it can also be a stack of images organized in a n-dimensional data cube, or a pyramid of images with their overviews used when low resolution images is requested.

Warning: do not implement Localized, as it may cause an infinite loop in listeners.getLocale() call.

Since:
1.1
Version:
1.3
  • Field Details

    • reader

      final Reader reader
      The GeoTIFF reader which contain this DataCube. Used for fetching information like the input channel and where to report warnings.
  • Constructor Details

    • DataCube

      DataCube(Reader reader)
      Creates a new data cube.
      Parameters:
      reader - information about the input stream to read, the metadata and the character encoding.
  • Method Details

    • getOriginator

      public final DataStore getOriginator()
      Returns the data store that produced this resource.
      Specified by:
      getOriginator in interface StoreResource
      Returns:
      the data store that created this resource.
    • getSynchronizationLock

      protected final Object getSynchronizationLock()
      Returns the object on which to perform all synchronizations for thread-safety.
      Overrides:
      getSynchronizationLock in class AbstractResource
      Returns:
      the synchronization lock.
    • listeners

      final StoreListeners listeners()
      Access to the protected listeners() field.
    • filename

      final String filename()
      Shortcut for a frequently requested information.
    • getIdentifier

      public abstract Optional<org.opengis.util.GenericName> getIdentifier()
      Returns an human-readable identification of this coverage. The namespace should be the filename and the tip can be an image index, citation, or overview level.

      The returned value should never be empty. An empty value would be a failure to initialize overviews.

      Specified by:
      getIdentifier in interface Resource
      Overrides:
      getIdentifier in class AbstractResource
      Returns:
      a persistent identifier unique within the data store, or absent if this resource has no such identifier.
      See Also:
    • getComponentFiles

      public final Path[] getComponentFiles()
      Gets the paths to files used by this resource, or an empty array if unknown.
      Specified by:
      getComponentFiles in interface ResourceOnFileSystem
      Returns:
      files used by this resource. Should never be null.
    • getNumBands

      abstract int getNumBands()
      Returns the number of components per pixel in the image stored in GeoTIFF file. This the same value than the one returned by getSampleModel().getNumBands(), and is also the size of the collection returned by GridCoverageResource.getSampleDimensions().
      See Also:
    • getNumTiles

      abstract long getNumTiles()
      Returns the total number of tiles. This is used for computing the stride between a band and the next band in
      invalid reference
      #tileOffsets
      and
      invalid reference
      #tileByteCounts
      vectors.
    • getTileArrayInfo

      abstract Vector[] getTileArrayInfo()
      Gets the stream position and the length in bytes of compressed tile arrays in the GeoTIFF file. Values in the returned vector are long primitive type.
      Returns:
      stream position (relative to file beginning) and length of compressed tile arrays, in bytes.
    • isBitOrderReversed

      abstract boolean isBitOrderReversed()
      Returns true if Integer.reverseBytes(int) should be invoked on each byte read. This mode is very rare and should apply only to uncompressed image or CCITT 1D/2D compressions.
    • getCompression

      abstract Compression getCompression()
      Returns the compression method, or null if unspecified.
    • getPredictor

      abstract Predictor getPredictor()
      Returns the mathematical operator that is applied to the image data before an encoding scheme is applied. Should never be null; the default value is Predictor.NONE.
    • canReadDirect

      private boolean canReadDirect(TiledGridResource.Subset subset) throws DataStoreException
      Returns true if the image can be read with the DataSubset base class, or false if the more sophisticated CompressedSubset sub-class is needed. The readSlice(…) implementation in DataSubset base class is more efficient but can be used only if all following conditions hold:
      • The sample model stores each band in its own bank (this condition is relaxed if there is no band subset and no subsampling on the x axis). The reason for this restriction is because otherwise, the space skipped between values to read may be of irregular sizes, or the number of values to read between spaces may be greater than 1.
      • There is only one sample value per bank element (i.e. no multi-pixels packed in single elements).
      If above conditions do not hold, then the less direct CompressedSubset subclass must be used even if there is no compression.
      Throws:
      DataStoreException
    • read

      public final GridCoverage read(GridGeometry domain, int... ranges) throws DataStoreException
      Creates a GridCoverage which will load pixel data in the given domain.
      Specified by:
      read in interface GridCoverageResource
      Parameters:
      domain - desired grid extent and resolution, or null for reading the whole domain.
      ranges - 0-based index of sample dimensions to read, or an empty sequence for reading all ranges.
      Returns:
      the grid coverage for the specified domain and ranges.
      Throws:
      DataStoreException - if an error occurred while reading the grid coverage data.