Package com.bc.ceres.multilevel.support
Class AbstractMultiLevelSource
java.lang.Object
com.bc.ceres.multilevel.support.AbstractMultiLevelSource
- All Implemented Interfaces:
MultiLevelSource
- Direct Known Subclasses:
AbstractMosaicSubsetMultiLevelSource
,ColoredBandImageMultiLevelSource
,ColoredMaskImageMultiLevelSource
,DefaultMultiLevelSource
,FileMultiLevelSource
,GenericMultiLevelSource
,TiledFileMultiLevelSource
An abstract base class for
MultiLevelSource
implementations.
Level images are cached unless reset()
is called.
Subclasses are asked to implement createImage(int)
.-
Field Summary
Fields inherited from interface com.bc.ceres.multilevel.MultiLevelSource
NULL
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractMultiLevelSource
(MultiLevelModel multiLevelModel) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkLevel
(int level) Utility method which checks if a given level is valid.protected abstract RenderedImage
createImage
(int level) Called bygetImage(int)
if a level image is requested for the first time.getImage
(int level) Gets theRenderedImage
at the given resolution level.getImageShape
(int level) Gets the shape of the area where this image's raster data contains valid pixels at the given resolution level.getModel()
Gets the layout model for the multi-resolution image supported by thisLevelImageSource
.void
reset()
Removes all cached level images and also disposes anyPlanarImage
s among them.
-
Constructor Details
-
AbstractMultiLevelSource
-
-
Method Details
-
getModel
Description copied from interface:MultiLevelSource
Gets the layout model for the multi-resolution image supported by thisLevelImageSource
.- Specified by:
getModel
in interfaceMultiLevelSource
- Returns:
- the multi-resolution image model.
-
getImage
Gets theRenderedImage
at the given resolution level. Unlessreset()
is called, the method will always return the same image instance at the same resolution level. If a level image is requested for the first time, the method callscreateImage(int)
in order to retrieve the actual image instance.- Specified by:
getImage
in interfaceMultiLevelSource
- Parameters:
level
- The resolution level.- Returns:
- The
RenderedImage
at the given resolution level.
-
getImageShape
Description copied from interface:MultiLevelSource
Gets the shape of the area where this image's raster data contains valid pixels at the given resolution level. The method returnsnull
, if the entire image raster contains valid pixels.- Specified by:
getImageShape
in interfaceMultiLevelSource
- Parameters:
level
- The resolution level.- Returns:
- The shape of the area where the image has data, can be
null
.
-
createImage
Called bygetImage(int)
if a level image is requested for the first time. Note that images created via this method will bedisposed
whenreset()
is called on this multi-level image source. SeegetImage(int)
.The dimension of the level image created must be the same as that obtained from {DefaultMultiLevelSource.getLevelImageBounds(Rectangle sourceBounds, double scale)} for the scale associated with the given resolution level.
- Parameters:
level
- The resolution level.- Returns:
- An instance of a
RenderedImage
for the given resolution level.
-
reset
public void reset()Removes all cached level images and also disposes anyPlanarImage
s among them.Overrides should always call
super.reset()
.- Specified by:
reset
in interfaceMultiLevelSource
-
checkLevel
protected void checkLevel(int level) Utility method which checks if a given level is valid.- Parameters:
level
- The resolution level.- Throws:
IllegalArgumentException
- iflevel < 0 || level >= getModel().getLevelCount()
-