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 forMultiLevelSourceimplementations. 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 protectedAbstractMultiLevelSource(MultiLevelModel multiLevelModel)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckLevel(int level)Utility method which checks if a given level is valid.protected abstract RenderedImagecreateImage(int level)Called bygetImage(int)if a level image is requested for the first time.RenderedImagegetImage(int level)Gets theRenderedImageat the given resolution level.ShapegetImageShape(int level)Gets the shape of the area where this image's raster data contains valid pixels at the given resolution level.MultiLevelModelgetModel()Gets the layout model for the multi-resolution image supported by thisLevelImageSource.voidreset()Removes all cached level images and also disposes anyPlanarImages among them.
-
-
-
Constructor Detail
-
AbstractMultiLevelSource
protected AbstractMultiLevelSource(MultiLevelModel multiLevelModel)
-
-
Method Detail
-
getModel
public MultiLevelModel getModel()
Description copied from interface:MultiLevelSourceGets the layout model for the multi-resolution image supported by thisLevelImageSource.- Specified by:
getModelin interfaceMultiLevelSource- Returns:
- the multi-resolution image model.
-
getImage
public RenderedImage getImage(int level)
Gets theRenderedImageat 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:
getImagein interfaceMultiLevelSource- Parameters:
level- The resolution level.- Returns:
- The
RenderedImageat the given resolution level.
-
getImageShape
public Shape getImageShape(int level)
Description copied from interface:MultiLevelSourceGets 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:
getImageShapein 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 bedisposedwhenreset()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
RenderedImagefor the given resolution level.
-
reset
public void reset()
Removes all cached level images and also disposes anyPlanarImages among them.Overrides should always call
super.reset().- Specified by:
resetin 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()
-
-