public abstract class ALcdRaster extends Object implements ILcdRaster, ILcdDisposable
Constructor and Description |
---|
ALcdRaster(ILcdBounds aBounds,
double aTileWidth,
double aTileHeight,
double aPixelDensity,
int aDefaultValue,
ColorModel aColorModel)
Creates a new ALcdRaster.
|
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clears the cache.
|
void |
dispose()
Disposes of this object and allows it to release any system resources that it is holding.
|
ILcdBounds |
getBounds()
Returns the
ILcdBounds by which the geometry of this ILcdBounded object
is bounded. |
Object |
getCachedObject(Object aKey)
Looks up and returns the cached Object corresponding to the given key.
|
ColorModel |
getColorModel()
Returns the optional color model of the raster.
|
int |
getDefaultValue()
Returns the pixel value that is returned for points outside the bounds of
the raster.
|
double |
getPixelDensity()
Returns the average number of pixels per unit of area in raster
coordinates.
|
int |
getPixelSize()
Returns the pixel size of the tiles in this raster, expressed in bits.
|
double |
getTileHeight()
Returns the height of a single tile, expressed in raster coordinates.
|
double |
getTileWidth()
Returns the width of a single tile, expressed in raster coordinates.
|
int |
getType()
Returns the internal storage type of the raster values.
|
void |
insertIntoCache(Object aKey,
Object aObject)
Inserts a cache Object corresponding to the given key Object.
|
Object |
removeCachedObject(Object aKey)
Looks up and removes the cached Object corresponding to the given key.
|
int |
retrieveValue(double aX,
double aY)
Retrieves the raster value at the specified location.
|
void |
setColorModel(ColorModel aColorModel)
Sets the
ColorModel of the raster. |
void |
setDefaultValue(int aDefaultValue)
Sets the pixel value that is returned for points outside the bounds of
the raster.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTileColumnCount, getTileRowCount, retrieveTile
close
public ALcdRaster(ILcdBounds aBounds, double aTileWidth, double aTileHeight, double aPixelDensity, int aDefaultValue, ColorModel aColorModel)
For a raster with a uniform pixel density, the tile width (and similarly the tile height) in model coordinates can be computed as follows:
<tile width> = <tile width in pixels> / <raster width in pixels> * <raster width>
aBounds
- the bounds of the raster in model coordinates.aTileWidth
- the width of the tiles in model coordinates.aTileHeight
- the height of the tiles in model coordinates.aPixelDensity
- an estimate of the number of pixels per unit area in
model coordinates.aDefaultValue
- a default value in case the raster cannot resolve
a point.aColorModel
- an optional ColorModel that overrides the ColorModel
of the raster's tiles.public void setColorModel(ColorModel aColorModel)
ILcdRaster
ColorModel
of the raster.setColorModel
in interface ILcdRaster
aColorModel
- the color model.public ColorModel getColorModel()
ILcdRaster
getColorModel
in interface ILcdRaster
null
if the raster doesn't have
an explicit color model.public double getTileWidth()
ILcdRaster
getBounds().getWidth() - getTileWidth() * (getTileColumnCount() - 1)
getTileWidth
in interface ILcdRaster
public double getTileHeight()
ILcdRaster
getBounds().getHeight() - getTileHeight() * (getTileRowCount() - 1)
getTileHeight
in interface ILcdRaster
public double getPixelDensity()
ILcdRaster
getPixelDensity
in interface ILcdRaster
public int getDefaultValue()
ILcdRaster
getDefaultValue
in interface ILcdRaster
ILcdRaster.retrieveValue(double, double)
public void setDefaultValue(int aDefaultValue)
ILcdRaster
setDefaultValue
in interface ILcdRaster
aDefaultValue
- the default pixel value.public int retrieveValue(double aX, double aY)
ILcdRaster
retrieveValue
in interface ILcdRaster
aX
- the x ordinate of the value, expressed in raster coordinates.aY
- the y ordinate of the value, expressed in raster coordinates.public ILcdBounds getBounds()
ILcdBounded
ILcdBounds
by which the geometry of this ILcdBounded
object
is bounded.
If the geometry does not allow retrieving valid bounds (for example a polyline with 0 points)
the return value is unspecified.
It is highly recommended to return an undefined
bounds.
You can create undefined bounds using the default constructors
of TLcdLonLatBounds
or TLcdXYBounds
.
getBounds
in interface ILcdBounded
ILcdBounds
by which the geometry of this ILcdBounded
object
is bounded.public void insertIntoCache(Object aKey, Object aObject)
ILcdCache
insertIntoCache
in interface ILcdCache
aKey
- the key Object that will be used to identify the Object.
The key must therefore be a unique identifier, typically the caller
itself: insertIntoCache(this, ...)
.aObject
- the Object to be cached.public Object getCachedObject(Object aKey)
ILcdCache
getCachedObject
in interface ILcdCache
aKey
- the key Object that was used for storing the cache Object.public Object removeCachedObject(Object aKey)
ILcdCache
removeCachedObject
in interface ILcdCache
aKey
- the key Object that was used for storing the cache Object.public void clearCache()
ILcdCache
clearCache
in interface ILcdCache
public void dispose()
ILcdDisposable
Disposes of this object and allows it to release any system resources that it is holding.
The result of calling any other method (other than finalize
) on this object subsequent to a call to
this method is undefined.
dispose
in interface ILcdDisposable
public int getType()
ILcdRaster
getType
in interface ILcdRaster
ILcdTile.BYTE
,
ILcdTile.SHORT
, or
ILcdTile.INT
.public int getPixelSize()
ILcdRaster
getPixelSize
in interface ILcdRaster