Class TLcdBufferedTile
- All Implemented Interfaces:
ILcdSubtiledTile
,ILcdTile
,ILcdDisposable
,AutoCloseable
- Direct Known Subclasses:
TLcdCADRGTile
,TLcdDTEDTile
,TLcdUSRPTile
ILcdTile
provides lazy decoding of
image data that can be retrieved from a file or from a URL. The actual
decoding is left to an ILcdTileDecoder
.
The decoded data are stored in an ILcdBuffer
. Such a buffer
generally serves as a cache that is shared across the application. Decoded
data may therefore be flushed as the buffer is filled by other classes or
instances. The data then get decoded again when needed, transparently to
the user.
If the provided tile decoder supports it, the tile can be subtiled. Only subtiles are then decoded at a time, which provides improved performance and memory usage for large tiles.
This class is thread-safe for concurrent read-only access of its contents, on the condition that a thread-safe buffer implementation is used.
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected ILcdBuffer
protected ColorModel
protected ILcdTileDecoder
protected int
protected String
protected int
protected int
protected int
protected boolean
protected int
protected boolean
protected int
protected int
protected int
protected URL
protected int
-
Constructor Summary
ConstructorDescriptionTLcdBufferedTile
(String aFileName, int aImageIndex, int aWidth, int aHeight, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, int aType, int aBitOffset, int aPixelSize, ILcdBuffer aBuffer, int aDefaultValue, ColorModel aColorModel) Deprecated.Type and offset don't need to be specified; they are now decoded by the given ILcdTileDecoder.TLcdBufferedTile
(String aFileName, int aImageIndex, int aWidth, int aHeight, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue, ColorModel aColorModel) Creates aTLcdBufferedTile
of an image accessible through a given file name.TLcdBufferedTile
(String aFileName, int aImageIndex, int aWidth, int aHeight, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue, ColorModel aColorModel, boolean aSigned) Creates aTLcdBufferedTile
of an image accessible through a given file name.TLcdBufferedTile
(String aFileName, int aImageIndex, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, int aType, int aBitOffset, int aPixelSize, ILcdBuffer aBuffer, int aDefaultValue) Deprecated.Type and offset don't need to be specified; they are now decoded by the given ILcdTileDecoder.TLcdBufferedTile
(String aFileName, int aImageIndex, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue) Creates aTLcdBufferedTile
of an image accessible through a given file name.TLcdBufferedTile
(String aFileName, int aImageIndex, ILcdTileDecoder aDecoder, int aType, int aBitOffset, int aPixelSize, ILcdBuffer aBuffer, int aDefaultValue) Deprecated.Type and offset don't need to be specified; they are now decoded by the given ILcdTileDecoder.TLcdBufferedTile
(String aFileName, int aImageIndex, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer) Creates aTLcdBufferedTile
of an image accessible through a given file name.TLcdBufferedTile
(String aFileName, int aImageIndex, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue) Creates aTLcdBufferedTile
of an image accessible through a given file name.TLcdBufferedTile
(URL aURL, int aImageIndex, int aWidth, int aHeight, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, int aType, int aBitOffset, int aPixelSize, ILcdBuffer aBuffer, int aDefaultValue, ColorModel aColorModel) Deprecated.Type and offset don't need to be specified; they are now decoded by the given ILcdTileDecoder.TLcdBufferedTile
(URL aURL, int aImageIndex, int aWidth, int aHeight, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue, ColorModel aColorModel) Creates aTLcdBufferedTile
as a sub-tile of an image accessible through a given URL.TLcdBufferedTile
(URL aURL, int aImageIndex, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, int aType, int aBitOffset, int aPixelSize, ILcdBuffer aBuffer, int aDefaultValue) Deprecated.Type and offset don't need to be specified; they are now decoded by the given ILcdTileDecoder.TLcdBufferedTile
(URL aURL, int aImageIndex, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue) Creates aTLcdBufferedTile
of an image accessible through a given URL.TLcdBufferedTile
(URL aURL, int aImageIndex, ILcdTileDecoder aDecoder, int aType, int aBitOffset, int aPixelSize, ILcdBuffer aBuffer, int aDefaultValue) Deprecated.Type and offset don't need to be specified; they are now decoded by the given ILcdTileDecoder.TLcdBufferedTile
(URL aURL, int aImageIndex, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer) Creates aTLcdBufferedTile
of an image accessible through a given URL.TLcdBufferedTile
(URL aURL, int aImageIndex, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue) Creates aTLcdBufferedTile
of an image accessible through a given URL. -
Method Summary
Modifier and TypeMethodDescriptionCreates an image of the entire tile, using the tile's own color model.createImage
(int aX, int aY, int aWidth, int aHeight) Creates an image of the specified rectangular area of the tile, using the tile's own color model.createImage
(int aX, int aY, int aWidth, int aHeight, ColorModel aColorModel) Creates an image of the specified rectangular area of the tile, using the given color model.createImage
(ColorModel aColorModel) Creates an image of the entire tile, using the given color model.void
dispose()
Disposes of this object and allows it to release any system resources that it is holding.int
Returns the optional color model of the tile.Returns the name of the file from which the tile is read, if it has been set.int
int
Returns the height of the tile, expressed in pixels.int
Returns the index of the image to be read.int
Returns the pixel size of the tile values, expressed in bits.int
Returns the height of a subtile in pixels.int
Returns the width of a subtile in pixels.int
getType()
Returns the internal storage type of the tile values.getURL()
Returns the URL from which the tile is read, if it has been set.int
getWidth()
Returns the width of the tile, expressed in pixels.boolean
Returns whether all values in the tile are equal to a default value.boolean
isSigned()
Returns whether the pixel values are signed.boolean
Deprecated.This method has been deprecated.protected ILcdBufferSegment
retrieveTile
(int aSubTileRow, int aSubTileColumn) Decodes the specified subtile.int
retrieveValue
(int aX, int aY) Retrieves the tile value at the specified location.static void
setClassTraceOn
(boolean aClassTraceOn) Deprecated.This method has been deprecated.void
setColorModel
(ColorModel aColorModel) void
setFileName
(String aFileName) Sets the name of the file from which the tile is to be read.void
setForcedTransparentColorIndex
(int aForcedTransparentColorIndex) Sets the index of a color that should be made transparent.void
setHeight
(int aHeight) void
setImageIndex
(int aImageIndex) Sets the index of the image to decode from a multi-image file.void
setSigned
(boolean aIsSigned) Specifies whether the pixel values are signed.void
setTraceOn
(boolean aTraceOn) Deprecated.This method has been deprecated.void
Sets the URL of the file from which the tile is to be read.void
setWidth
(int aWidth) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.util.ILcdDisposable
close
-
Field Details
-
fURL
-
fFileName
-
fImageIndex
protected int fImageIndex -
fWidth
protected volatile int fWidth -
fHeight
protected volatile int fHeight -
fSubTileWidth
protected volatile int fSubTileWidth -
fSubTileHeight
protected volatile int fSubTileHeight -
fDecoder
-
fBuffer
-
fDefaultValue
protected int fDefaultValue -
fColorModel
-
fForcedTransparentColorIndex
protected int fForcedTransparentColorIndex -
fType
protected volatile int fType -
fBitOffset
protected volatile int fBitOffset -
fPixelSize
protected volatile int fPixelSize -
fSigned
protected volatile boolean fSigned -
fIsAllDefault
protected volatile boolean fIsAllDefault
-
-
Constructor Details
-
TLcdBufferedTile
public TLcdBufferedTile(String aFileName, int aImageIndex, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer) Creates aTLcdBufferedTile
of an image accessible through a given file name. The tile parameters will be determined by theILcdTileDecoder
. -
TLcdBufferedTile
public TLcdBufferedTile(String aFileName, int aImageIndex, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue) Creates aTLcdBufferedTile
of an image accessible through a given file name. The ColorModel of the tile will be determined by theILcdTileDecoder
. -
TLcdBufferedTile
public TLcdBufferedTile(String aFileName, int aImageIndex, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue) Creates aTLcdBufferedTile
of an image accessible through a given file name. The size and ColorModel of the tile will be determined by theILcdTileDecoder
. The tile is sub-tiled with sub-tiles of a given size. -
TLcdBufferedTile
public TLcdBufferedTile(String aFileName, int aImageIndex, int aWidth, int aHeight, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue, ColorModel aColorModel) Creates aTLcdBufferedTile
of an image accessible through a given file name. The tile is sub-tiled with sub-tiles of a given size. By default, only short pixel values are considered signed.A typical example of a constructor could be:
new TLcdBufferedTile(aFileName, 0, 512, 512, 256, 256, aDecoder, aBuffer, 32, 0, ColorModel.getRGBdefault())
This constructor creates a buffered tile of 512 by 512 pixels, with sub-tiles of 256 by 256 pixels. Each pixel is specified using a 32-bit integer with a default value of 0, in the default DirectColorModel.- Parameters:
aFileName
- the name of the file that contains the image.aImageIndex
- the index of the image to decode from a multi-image file.aWidth
- the number of columns of pixels in the tile.aHeight
- the number of rows of pixels in the tile.aSubTileWidth
- the total number of rows of sub-tiles in which the image (URL) is divided horizontally.aSubTileHeight
- the total number of columns of sub-tiles in which the image (URL) is divided vertically.aDecoder
- an image decoder knowing how to read and decode pixels of a sub-tile from an image.aBuffer
- the buffer that will be used for caching the pixel values of the tile.aPixelSize
- the number of bits used to specify a pixel value.aDefaultValue
- a default value for pixels that can't be resolved.aColorModel
- an optional ColorModel for the pixels.
-
TLcdBufferedTile
public TLcdBufferedTile(String aFileName, int aImageIndex, int aWidth, int aHeight, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue, ColorModel aColorModel, boolean aSigned) Creates aTLcdBufferedTile
of an image accessible through a given file name. The tile is sub-tiled with sub-tiles of a given size.A typical example of a constructor could be:
new TLcdBufferedTile(aFileName, 0, 512, 512, 256, 256, aDecoder, aBuffer, 16, 0xffff, aIndexColorModel, false)
This constructor creates a buffered tile of 512 by 512 pixels, with sub-tiles of 256 by 256 pixels. Each pixel is specified using an unsigned 16-bits integer with a default value of 0xffff, and an IndexColorModel (which must be 16-bits also).- Parameters:
aFileName
- the name of the file that contains the image.aImageIndex
- the index of the image to decode from a multi-image file.aWidth
- the number of columns of pixels in the tile.aHeight
- the number of rows of pixels in the tile.aSubTileWidth
- the total number of rows of sub-tiles in which the image (URL) is divided horizontally.aSubTileHeight
- the total number of columns of sub-tiles in which the image (URL) is divided vertically.aDecoder
- an image decoder knowing how to read and decode pixels of a sub-tile from an image.aBuffer
- the buffer that will be used for caching the pixel values of the tile.aPixelSize
- the number of bits used to specify a pixel value.aDefaultValue
- a default value for pixels that can't be resolved.aColorModel
- an optional ColorModel for the pixels.aSigned
- specifies whether the pixel values are signed.
-
TLcdBufferedTile
Creates aTLcdBufferedTile
of an image accessible through a given URL. The tile parameters will be determined by theILcdTileDecoder
. -
TLcdBufferedTile
public TLcdBufferedTile(URL aURL, int aImageIndex, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue) Creates aTLcdBufferedTile
of an image accessible through a given URL. The size and ColorModel of the tile will be determined by theILcdTileDecoder
. -
TLcdBufferedTile
public TLcdBufferedTile(URL aURL, int aImageIndex, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue) Creates aTLcdBufferedTile
of an image accessible through a given URL. The size and ColorModel of the tile will be determined by theILcdTileDecoder
. The tile is sub-tiled with sub-tiles of a given size. -
TLcdBufferedTile
public TLcdBufferedTile(URL aURL, int aImageIndex, int aWidth, int aHeight, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, ILcdBuffer aBuffer, int aPixelSize, int aDefaultValue, ColorModel aColorModel) Creates aTLcdBufferedTile
as a sub-tile of an image accessible through a given URL. The size and ColorModel of the tile will be determined by theILcdTileDecoder
. The tile is sub-tiled with sub-tiles of a given size.new TLcdBufferedTile(aURL, 0, 512, 512, 256, 256, aDecoder, aBuffer, 32, 0, ColorModel.getRGBdefault())
This constructor creates a buffered tile of 512 by 512 pixels, with sub-tiles of 256 by 256 pixels. Each pixel is specified using a 32-bit integer with a default value of 0, in e default DirectColorModel.- Parameters:
aURL
- URL defining the underlying image for the tile.aImageIndex
- the index of the image to decode from a multi-image file.aWidth
- the number of columns of pixels in the tile.aHeight
- the number of rows of pixels in the tile.aSubTileWidth
- the total number of rows of sub-tiles in which the image (URL) is divided horizontally.aSubTileHeight
- the total number of columns of sub-tiles in which the image (URL) is divided vertically.aDecoder
- an image decoder knowing how to read and decode pixels of a sub-tile from an image.aBuffer
- the buffer that will be used for caching the pixel values of the tile.aPixelSize
- the number of bits used to specify a pixel value.aDefaultValue
- a default value for pixels that can't be resolved.aColorModel
- an optional ColorModel for the pixels.
-
TLcdBufferedTile
public TLcdBufferedTile(String aFileName, int aImageIndex, ILcdTileDecoder aDecoder, int aType, int aBitOffset, int aPixelSize, ILcdBuffer aBuffer, int aDefaultValue) Deprecated.Type and offset don't need to be specified; they are now decoded by the given ILcdTileDecoder.- See Also:
-
TLcdBufferedTile
public TLcdBufferedTile(String aFileName, int aImageIndex, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, int aType, int aBitOffset, int aPixelSize, ILcdBuffer aBuffer, int aDefaultValue) Deprecated.Type and offset don't need to be specified; they are now decoded by the given ILcdTileDecoder.- See Also:
-
TLcdBufferedTile
public TLcdBufferedTile(String aFileName, int aImageIndex, int aWidth, int aHeight, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, int aType, int aBitOffset, int aPixelSize, ILcdBuffer aBuffer, int aDefaultValue, ColorModel aColorModel) Deprecated.Type and offset don't need to be specified; they are now decoded by the given ILcdTileDecoder.- See Also:
-
TLcdBufferedTile
public TLcdBufferedTile(URL aURL, int aImageIndex, ILcdTileDecoder aDecoder, int aType, int aBitOffset, int aPixelSize, ILcdBuffer aBuffer, int aDefaultValue) Deprecated.Type and offset don't need to be specified; they are now decoded by the given ILcdTileDecoder.- See Also:
-
TLcdBufferedTile
public TLcdBufferedTile(URL aURL, int aImageIndex, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, int aType, int aBitOffset, int aPixelSize, ILcdBuffer aBuffer, int aDefaultValue) Deprecated.Type and offset don't need to be specified; they are now decoded by the given ILcdTileDecoder.- See Also:
-
TLcdBufferedTile
public TLcdBufferedTile(URL aURL, int aImageIndex, int aWidth, int aHeight, int aSubTileWidth, int aSubTileHeight, ILcdTileDecoder aDecoder, int aType, int aBitOffset, int aPixelSize, ILcdBuffer aBuffer, int aDefaultValue, ColorModel aColorModel) Deprecated.Type and offset don't need to be specified; they are now decoded by the given ILcdTileDecoder.- See Also:
-
-
Method Details
-
setClassTraceOn
public static void setClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istrue
then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn
- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrue
orfalse
as argument automatically turns off tracing for all other class instances for whichsetTraceOn
has not been called. If the argument isfalse
then only the informative, warning and error log messages are recorded.- Parameters:
aTraceOn
- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrue
if tracing is enabled for this class.- Returns:
- true if tracing is enabled for this class, false otherwise.
-
setURL
Sets the URL of the file from which the tile is to be read. -
getURL
Returns the URL from which the tile is read, if it has been set. -
setFileName
Sets the name of the file from which the tile is to be read. -
getFileName
Returns the name of the file from which the tile is read, if it has been set. -
setImageIndex
public void setImageIndex(int aImageIndex) Sets the index of the image to decode from a multi-image file. -
getImageIndex
public int getImageIndex()Returns the index of the image to be read. The meaning of the index can depend on the file format that the tile decoder decodes. -
setSigned
public void setSigned(boolean aIsSigned) Specifies whether the pixel values are signed. -
isSigned
public boolean isSigned()Returns whether the pixel values are signed. -
setWidth
public void setWidth(int aWidth) -
getWidth
public int getWidth()Description copied from interface:ILcdTile
Returns the width of the tile, expressed in pixels. -
setHeight
public void setHeight(int aHeight) -
getHeight
public int getHeight()Description copied from interface:ILcdTile
Returns the height of the tile, expressed in pixels. -
getType
public int getType()Description copied from interface:ILcdTile
Returns the internal storage type of the tile values. -
getPixelSize
public int getPixelSize()Description copied from interface:ILcdTile
Returns the pixel size of the tile values, expressed in bits.- Specified by:
getPixelSize
in interfaceILcdTile
-
getBitOffset
public int getBitOffset() -
setColorModel
-
getColorModel
Description copied from interface:ILcdTile
Returns the optional color model of the tile.- Specified by:
getColorModel
in interfaceILcdTile
- Returns:
- the color model, or
null
if the raster doesn't have an explicit color model.
-
isAllDefault
public boolean isAllDefault()Description copied from interface:ILcdTile
Returns whether all values in the tile are equal to a default value.- Specified by:
isAllDefault
in interfaceILcdTile
-
setForcedTransparentColorIndex
public void setForcedTransparentColorIndex(int aForcedTransparentColorIndex) Sets the index of a color that should be made transparent. This can be useful if the RenderedImage has an IndexColorModel that doesn't have a transparent color of its own. -
getForcedTransparentColorIndex
public int getForcedTransparentColorIndex() -
getTileDecoder
-
getSubTileWidth
public int getSubTileWidth()Description copied from interface:ILcdSubtiledTile
Returns the width of a subtile in pixels. May be equal to the width of the parent tile (as returned by the getWidth() method), in which case the tile is not subdivided.- Specified by:
getSubTileWidth
in interfaceILcdSubtiledTile
-
getSubTileHeight
public int getSubTileHeight()Description copied from interface:ILcdSubtiledTile
Returns the height of a subtile in pixels. May be equal to the height of the parent tile (as returned by the getHeight() method), in which case the tile is not subdivided.- Specified by:
getSubTileHeight
in interfaceILcdSubtiledTile
-
retrieveValue
public int retrieveValue(int aX, int aY) Description copied from interface:ILcdTile
Retrieves the tile value at the specified location.- Specified by:
retrieveValue
in interfaceILcdTile
- Parameters:
aX
- the x ordinate of the value, expressed in tile coordinates.aY
- the y ordinate of the value, expressed in tile coordinates.- Returns:
- the integer tile value at the specified location.
-
retrieveTile
Decodes the specified subtile.- Parameters:
aSubTileRow
- the subtile row.aSubTileColumn
- the subtile column.- Returns:
- the decoded tile contents.
-
createImage
Description copied from interface:ILcdTile
Creates an image of the entire tile, using the tile's own color model.- Specified by:
createImage
in interfaceILcdTile
-
createImage
Description copied from interface:ILcdTile
Creates an image of the entire tile, using the given color model.- Specified by:
createImage
in interfaceILcdTile
- Parameters:
aColorModel
- the color model to be used for the image. The color model should be compatible with the pixel values of the tile.
-
createImage
Description copied from interface:ILcdTile
Creates an image of the specified rectangular area of the tile, using the tile's own color model.- Specified by:
createImage
in interfaceILcdTile
- Parameters:
aX
- the x ordinate of the area, expressed in tile coordinates.aY
- the y ordinate of the area, expressed in tile coordinates.aWidth
- the width of the area, expressed in tile coordinates.aHeight
- the height of the area, expressed in tile coordinates.
-
createImage
Description copied from interface:ILcdTile
Creates an image of the specified rectangular area of the tile, using the given color model.- Specified by:
createImage
in interfaceILcdTile
- Parameters:
aX
- the x ordinate of the area, expressed in tile coordinates.aY
- the y ordinate of the area, expressed in tile coordinates.aWidth
- the width of the area, expressed in tile coordinates.aHeight
- the height of the area, expressed in tile coordinates.aColorModel
- the color model to be used for the image. The color model should be compatible with the pixel values of the tile.
-
dispose
public void dispose()Description copied from interface: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.- Specified by:
dispose
in interfaceILcdDisposable
-