- All Implemented Interfaces:
Serializable
,Comparable<RasterLoadingStrategy>
,Constable
Time when the "physical" loading of raster data should happen. Some resource implementations may
not load data immediately when the read method is invoked,
but instead defer the actual loading until the image is rendered.
This enumeration gives some control over the time when data loading happens.
The different strategies are compromises between memory consumption,
redundant loading of same data and early error detection.
Enumeration values are ordered from the most eager strategy to the laziest strategy. The eager strategy is fastest when all pixels are used, at the cost of largest memory consumption. The lazy strategy is more efficient when only a few tiles will be used and those tiles are not known in advance. The lazy strategy is also the only applicable one if the image is too large for holding in memory.
- Since:
- 1.1
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionRaster data are loaded atRenderedImage.getTile(int, int)
invocation time.Raster data are loaded atGridCoverageResource.read(GridGeometry, int...)
invocation time.Raster data are loaded atGridCoverage.render(GridExtent)
invocation time. -
Method Summary
Modifier and TypeMethodDescriptionstatic RasterLoadingStrategy
Returns the enum constant of this class with the specified name.static RasterLoadingStrategy[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
AT_READ_TIME
Raster data are loaded atGridCoverageResource.read(GridGeometry, int...)
invocation time. This is the most eager loading strategy.Advantages:
- Fastest loading strategy if all pixels in the returned
GridCoverage
will be used. - No redundant data loading: all data stay in memory until the resource is garbage-collected.
- Immediate error notification with a checked
DataStoreException
.
Disadvantages:
- Slower than other strategies if only a subset of the returned
GridCoverage
will be used. - Consume memory for the full
GridCoverage
as long as the resource is referenced.
- Fastest loading strategy if all pixels in the returned
-
AT_RENDER_TIME
Raster data are loaded atGridCoverage.render(GridExtent)
invocation time. Speed and memory usage are at an intermediate level betweenAT_READ_TIME
andAT_GET_TILE_TIME
.Advantages:
- Faster than
AT_GET_TILE_TIME
if all pixels in the returnedRenderedImage
will be used. - Load less data than
AT_READ_TIME
if theGridExtent
is a sub-region of the coverage. - Memory is released sooner (when the
RenderedImage
is garbage-collected) than above mode.
Disadvantages:
- Slower than
AT_GET_TILE_TIME
if only a few tiles will be used. - Consume memory for the full
RenderedImage
as long as the image is referenced. - May reload the same data many times if images are discarded and recreated.
- Unchecked
CannotEvaluateException
can happen relatively late (atrender(…)
invocation time) in a chain of coverage operations.
- Faster than
-
AT_GET_TILE_TIME
Raster data are loaded atRenderedImage.getTile(int, int)
invocation time. This is the laziest loading strategy. This is also the only strategy that can handle very largeRenderedImage
s.Advantages:
- Only the tiles that are actually used are loaded.
- Memory can be released at any time (tiles are kept by soft references).
Disadvantages:
- Slower read operations (numerous seeks when tiles are read in random order).
- May reload the same data many times if tiles are discarded and recreated.
- Unchecked
ImagingOpException
can happen late (atgetTile(…)
invocation time) in a chain of image operations.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-