public abstract class AbstractMultiLevelSource extends Object implements MultiLevelSource
MultiLevelSource
implementations.
Level images are cached unless reset()
is called.
Subclasses are asked to implement createImage(int)
.NULL
Modifier | Constructor and Description |
---|---|
protected |
AbstractMultiLevelSource(MultiLevelModel multiLevelModel) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkLevel(int level)
Utility method which checks if a given level is valid.
|
protected abstract RenderedImage |
createImage(int level)
Called by
getImage(int) if a level image is requested for the first time. |
RenderedImage |
getImage(int level)
Gets the
RenderedImage at the given resolution level. |
static Dimension |
getImageDimension(int width,
int height,
double scale)
Deprecated.
since Ceres 0.14, lower-level resolutions of image pyramids are computed in the JPEG2000-style,
that is
newSize=(int)ceil(scale * size) (ceiling integer),
while JAI is newSize=(int)ceil(scale * size - 0.5) (rounding to nearest integer).
Please use getImageRectangle(int, int, int, int, double) instead. |
static Rectangle |
getImageRectangle(int minX,
int minY,
int width,
int height,
double scale)
Deprecated.
since Ceres 0.14, lower-level resolutions of image pyramids are computed in the JPEG2000-style,
that is
newSize=(int)ceil(scale * size) (ceiling integer),
while JAI is newSize=(int)ceil(scale * size - 0.5) (rounding to nearest integer).
Please use getImageRectangle(int, int, int, int, double) instead. |
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 this
LevelImageSource . |
void |
reset()
Removes all cached level images and also disposes
any
PlanarImage s among them. |
protected AbstractMultiLevelSource(MultiLevelModel multiLevelModel)
public MultiLevelModel getModel()
MultiLevelSource
LevelImageSource
.getModel
in interface MultiLevelSource
public RenderedImage getImage(int level)
RenderedImage
at the given resolution level. Unless reset()
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 calls
createImage(int)
in order to retrieve the actual image instance.getImage
in interface MultiLevelSource
level
- The resolution level.RenderedImage
at the given resolution level.public Shape getImageShape(int level)
MultiLevelSource
null
, if the entire image raster contains valid pixels.getImageShape
in interface MultiLevelSource
level
- The resolution level.null
.protected abstract RenderedImage createImage(int level)
getImage(int)
if a level image is requested for the first time.
Note that images created via this method will be disposed
when reset()
is called on this multi-level image source. See getImage(int)
.
The dimension of the level image created must be the same as that obtained from
getImageDimension(int, int, double)
for the scale associated with the
given resolution level.
level
- The resolution level.RenderedImage
for the given resolution level.public void reset()
PlanarImage
s among them.
Overrides should always call super.reset()
.
reset
in interface MultiLevelSource
protected void checkLevel(int level)
level
- The resolution level.IllegalArgumentException
- if level < 0 || level >= getModel().getLevelCount()
@Deprecated public static Dimension getImageDimension(int width, int height, double scale)
newSize=(int)ceil(scale * size)
(ceiling integer),
while JAI is newSize=(int)ceil(scale * size - 0.5)
(rounding to nearest integer).
Please use getImageRectangle(int, int, int, int, double)
instead.javax.media.jai.operator.ScaleDescriptor.create(...)
.width
- The width of the image in pixels at level zero.height
- The height of the image in pixels at level zero.scale
- The scale at the level of interest.@Deprecated public static Rectangle getImageRectangle(int minX, int minY, int width, int height, double scale)
newSize=(int)ceil(scale * size)
(ceiling integer),
while JAI is newSize=(int)ceil(scale * size - 0.5)
(rounding to nearest integer).
Please use getImageRectangle(int, int, int, int, double)
instead.javax.media.jai.operator.ScaleDescriptor.create(...)
.minX
- The image's minimum X coordinate in pixels at level zero.minY
- The image's minimum Y coordinate in pixels at level zero.width
- The width of the image in pixels at level zero.height
- The height of the image in pixels at level zero.scale
- The scale at the level of interest.Copyright © 2014–2022 European Space Agency (ESA). All rights reserved.