Package com.bc.ceres.glevel.support
Class AbstractMultiLevelSource
- java.lang.Object
-
- com.bc.ceres.glevel.support.AbstractMultiLevelSource
-
- All Implemented Interfaces:
MultiLevelSource
- Direct Known Subclasses:
AbstractMosaicSubsetMultiLevelSource
,ColoredBandImageMultiLevelSource
,ColoredMaskImageMultiLevelSource
,DefaultMultiLevelSource
,FileMultiLevelSource
,GenericMultiLevelSource
,TiledFileMultiLevelSource
public abstract class AbstractMultiLevelSource extends Object implements MultiLevelSource
An abstract base class forMultiLevelSource
implementations. Level images are cached unlessreset()
is called. Subclasses are asked to implementcreateImage(int)
.
-
-
Field Summary
-
Fields inherited from interface com.bc.ceres.glevel.MultiLevelSource
NULL
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractMultiLevelSource(MultiLevelModel multiLevelModel)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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.RenderedImage
getImage(int level)
Gets theRenderedImage
at the given resolution level.Shape
getImageShape(int level)
Gets the shape of the area where this image's raster data contains valid pixels at the given resolution level.MultiLevelModel
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 Detail
-
AbstractMultiLevelSource
protected AbstractMultiLevelSource(MultiLevelModel multiLevelModel)
-
-
Method Detail
-
getModel
public MultiLevelModel 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
public RenderedImage getImage(int level)
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
public Shape getImageShape(int level)
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
protected abstract RenderedImage createImage(int level)
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()
-
-