public class DefaultMultiLevelModel extends Object implements MultiLevelModel
MultiLevelModel
interface.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_LEVEL_PIXEL_COUNT |
Constructor and Description |
---|
DefaultMultiLevelModel(AffineTransform imageToModelTransform,
int width,
int height)
Constructs a a new model for a multi level source.
|
DefaultMultiLevelModel(int levelCount,
AffineTransform imageToModelTransform,
int width,
int height)
Constructs a a new model for a multi level source.
|
DefaultMultiLevelModel(int levelCount,
AffineTransform imageToModelTransform,
Rectangle2D modelBounds)
Constructs a a new model for a multi level source.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkLevel(int level) |
AffineTransform |
getImageToModelTransform(int level)
Gets a copy (non-life object) of the affine transformation from image to model coordinates for the given level.
|
int |
getLevel(double scale)
Gets the resolution level for a given scaling factor, e.g.
|
int |
getLevelCount()
Gets the number of resolution levels, which is always greater than zero.
|
static int |
getLevelCount(int width,
int height)
Computes the number of levels using the
DEFAULT_MAX_LEVEL_PIXEL_COUNT constant. |
Rectangle2D |
getModelBounds()
Gets the bounding box in model coordinates.
|
static Rectangle2D |
getModelBounds(AffineTransform i2mTransform,
int width,
int height)
Computes the image bounding box in model coordinates.
|
static Rectangle2D |
getModelBounds(AffineTransform i2mTransform,
RenderedImage levelZeroImage)
Computes the image bounding box in model coordinates.
|
AffineTransform |
getModelToImageTransform(int level)
Gets a copy (non-life object) of the affine transformation from model to image coordinates for the given level.
|
double |
getScale(int level)
Gets the scale for a given resolution level, e.g.
|
protected static double |
log2(double v) |
protected static double |
pow2(double v) |
void |
setModelBounds(Rectangle2D modelBounds) |
public static final int DEFAULT_MAX_LEVEL_PIXEL_COUNT
public DefaultMultiLevelModel(AffineTransform imageToModelTransform, int width, int height)
getLevelCount(int, int)
.
The image bounds are computed by getModelBounds(java.awt.geom.AffineTransform, int, int)
.imageToModelTransform
- The affine transformation from image to model coordinates.width
- The width of the image in pixels at level zero.height
- The height of the image in pixels at level zero.public DefaultMultiLevelModel(int levelCount, AffineTransform imageToModelTransform, int width, int height)
getModelBounds(java.awt.geom.AffineTransform, int, int)
.levelCount
- The number of levels.imageToModelTransform
- The affine transformation from image to model coordinates.width
- The width of the image in pixels at level zero.height
- The height of the image in pixels at level zero.public DefaultMultiLevelModel(int levelCount, AffineTransform imageToModelTransform, Rectangle2D modelBounds)
levelCount
- The number of levels.imageToModelTransform
- The affine transformation from image to model coordinates.modelBounds
- The image bounds in model coordinates.public int getLevelCount()
MultiLevelModel
getLevelCount
in interface MultiLevelModel
public int getLevel(double scale)
MultiLevelModel
level=log(scale)/log(2)
.getLevel
in interface MultiLevelModel
scale
- The scaling factor, will always be a greater than or equal to 1.levelCount
-1.MultiLevelSource.getImage(int)
public double getScale(int level)
MultiLevelModel
scale=pow(2,level)
.getScale
in interface MultiLevelModel
level
- The resolution level, must be in the range 0 to levelCount
-1.getLevel(scale)
shall return level
.MultiLevelSource.getImage(int)
public final AffineTransform getImageToModelTransform(int level)
MultiLevelModel
getImageToModelTransform
in interface MultiLevelModel
level
- The resolution level, must be in the range 0 to levelCount
-1.public final AffineTransform getModelToImageTransform(int level)
MultiLevelModel
getModelToImageTransform
in interface MultiLevelModel
level
- The resolution level, must be in the range 0 to levelCount
-1.protected static double pow2(double v)
protected static double log2(double v)
protected void checkLevel(int level)
public Rectangle2D getModelBounds()
MultiLevelModel
getModelBounds
in interface MultiLevelModel
null
if unspecified.public void setModelBounds(Rectangle2D modelBounds)
public static Rectangle2D getModelBounds(AffineTransform i2mTransform, RenderedImage levelZeroImage)
i2mTransform
- The affine transformation from image to model coordinates.levelZeroImage
- The image at level zero.public static Rectangle2D getModelBounds(AffineTransform i2mTransform, int width, int height)
i2mTransform
- The affine transformation from image to model coordinates.width
- The width of the image in pixels at level zero.height
- The height of the image in pixels at level zero.public static int getLevelCount(int width, int height)
DEFAULT_MAX_LEVEL_PIXEL_COUNT
constant.width
- The width of the image in pixels at level zero.height
- The height of the image in pixels at level zero.Copyright © 2014–2017 European Space Agency (ESA). All rights reserved.