Class MemoryGridCoverageResource
Object
AbstractResource
AbstractGridCoverageResource
MemoryGridCoverageResource
- All Implemented Interfaces:
DataSet, GridCoverageResource, Resource
A Grid Coverage Resource stored in memory.
This resource wraps an arbitrary
GridCoverage specified at construction time.
Metadata can be specified by overriding the AbstractGridCoverageResource.createMetadata() method.
When to use
This class is useful for small grid coverages, or for testing purposes, or when the coverage is in memory anyway (for example, a computation result). It should generally not be used for large coverages read from files or databases.- Since:
- 1.6
-
Nested Class Summary
Nested classes/interfaces inherited from interface Resource
Resource.FileSet -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final GridCoverageThe grid coverage specified at construction time.protected final GridCoverageProcessorThe grid coverage processor to use for selecting bands.Fields inherited from class AbstractResource
listeners -
Constructor Summary
ConstructorsConstructorDescriptionMemoryGridCoverageResource(Resource parent, GenericName identifier, GridCoverage coverage, GridCoverageProcessor processor) Creates a new coverage stored in memory. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests whether this memory grid coverage resource is wrapping the same coverage as the given object.Returns the grid coverage wrapped by this resource.Returns information about the domain of wrapped grid coverage.Returns the resource identifier specified at construction time, if any.Returns an indication about whetherread(…)tries to force the loading of data.Returns information about the ranges of wrapped grid coverage.intReturns a hash code value for consistency withequals(Object).read(GridGeometry domain, int... ranges) Returns a subset of the wrapped grid coverage.booleansetLoadingStrategy(RasterLoadingStrategy strategy) Sets the preference about whetherread(…)should try to force the loading of data.Returns a string representation of this resource.Methods inherited from class AbstractGridCoverageResource
canNotRead, createMetadata, getEnvelope, logReadOperationMethods inherited from class AbstractResource
addListener, clearCache, getMetadata, getSynchronizationLock, removeListenerMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface GridCoverageResource
getResolutions, subsetMethods inherited from interface Resource
addListener, getFileSet, getMetadata, removeListener
-
Field Details
-
coverage
-
processor
The grid coverage processor to use for selecting bands. It may be configured with a colorizer for determining the color models.
-
-
Constructor Details
-
MemoryGridCoverageResource
public MemoryGridCoverageResource(Resource parent, GenericName identifier, GridCoverage coverage, GridCoverageProcessor processor) Creates a new coverage stored in memory.- Parameters:
parent- the parent resource, ornullif none.identifier- resource identifier, ornullif none.coverage- stored coverage retained as-is (not copied). Cannot be null.processor- the grid coverage processor for selecting bands, ornullfor default.
-
-
Method Details
-
getIdentifier
Returns the resource identifier specified at construction time, if any.- Returns:
- a persistent identifier unique within the data store, or absent if this resource has no such identifier.
- See Also:
-
getGridCoverage
Returns the grid coverage wrapped by this resource. The grid coverage returned by this method shall be the same or equivalent to the coverage that would be returned by a call toread(null), and should not be expansive to get.- Returns:
- the grid coverage wrapped by this resource.
- See Also:
-
getGridGeometry
Returns information about the domain of wrapped grid coverage.- Returns:
- extent of grid coordinates together with their mapping to "real world" coordinates.
- See Also:
-
getSampleDimensions
Returns information about the ranges of wrapped grid coverage.- Returns:
- ranges of sample values together with their mapping to "real values".
- See Also:
-
getLoadingStrategy
Returns an indication about whetherread(…)tries to force the loading of data.- Returns:
- current raster data loading strategy for this resource.
-
setLoadingStrategy
Sets the preference about whetherread(…)should try to force the loading of data.- Parameters:
strategy- the desired strategy for loading raster data.- Returns:
trueif the given strategy has been accepted, orfalseif this implementation replaced the given strategy by an alternative.
-
read
Returns a subset of the wrapped grid coverage. If a null grid geometry and a null or empty range is specified, then this method shall return the same grid coverage asgetGridCoverage()or an equivalent coverage. If a non-null grid geometry is specified, then this method tries to return a grid coverage matching the given grid geometry on a best-effort basis. It may be the whole coverage.- Parameters:
domain- desired grid extent and resolution, ornullfor the whole domain.ranges- 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 ranges.
-
equals
Tests whether this memory grid coverage resource is wrapping the same coverage as the given object. This method checks also that the listeners and the grid coverage processor are equal. -
hashCode
-
toString
-