@LcdService(service=ILcdModelEncoder.class, priority=20000) public class TLcdJPEG2000ModelEncoder extends Object implements ILcdModelEncoder
ILcdModelEncoder
encodes raster models into georeferenced
JPEG2000 files. The encoder will encode the first ILcdRaster
or ILcdMultilevelRaster
element in
the model. Any other elements are ignored. The georeference is encoded by
means of an embedded GeoTIFF box.
imageOutputStreamFactory
provides some control over
the destination of the encoded images. By default, they are written to
files.
levelCount
.
Each level effectively reduces the image dimensions by a factor of two. If
not specified, the number of levels is computed such that the smallest image
tile (or the entire image if tiling is not used) will have a size of at least
64x64 pixels.
quality
of the output image as a
number between 0 (lowest) and 8.0 (highest quality). The size of the output
image will be higher if the quality is higher. The default value is 0.8 .
layerCount
.
The quality layers are used for progressive image transmission - each new
layer adds new details to the already existing layers. The
quality
parameter of the encoder only affects the last layer
(the most detailed one); the qualities of the other layers are computed
automatically. Up to 60 layers can be specified. The default value is 1.
tileWidth
and tileHeight
. Tiled
images can improve access times when they are used, since only the required
parts of the images need be decoded and cached, but may introduce compression
artifacts at the tile boundaries. By default, tiling is not used.
When encoding any indexed color map raster, you should use lossless compression and 1 level and quality layer. Other settings (ex. multiple levels or layers, lossy encoding) are only supported for gray-level color models.
The native JPEG2000 library has to be installed in order to be able to use this decoder.
Constructor and Description |
---|
TLcdJPEG2000ModelEncoder() |
Modifier and Type | Method and Description |
---|---|
boolean |
canExport(ILcdModel aModel,
String string)
Returns whether this encoder can export the specified model to the specified destination.
|
boolean |
canSave(ILcdModel aModel)
Returns whether this model encoder can save the specified model to the location it originally came from.
|
void |
export(ILcdModel aModel,
String aFileName)
Exports the specified model to the specified destination.
|
String |
getDisplayName()
Returns a short, displayable name for the format this
ILcdModelEncoder encodes to. |
ILcdOutputStreamFactory |
getImageOutputStreamFactory()
Returns the output stream factory.
|
int |
getLevelCount()
Returns the number of wavelet decomposition levels or stages.
|
float |
getQuality()
Returns the encoding quality.
|
int |
getQualityLayerCount()
Returns the number of JPEG2000 quality layers.
|
int |
getTileHeight()
Returns the height of a tile in pixels.
|
int |
getTileWidth()
Returns the width of a tile in pixels.
|
boolean |
isLossless()
Returns whether lossless compression is enabled.
|
void |
save(ILcdModel aModel)
Saves the model to the location where it originally came from.
|
void |
setImageOutputStreamFactory(ILcdOutputStreamFactory aImageOutputStreamFactory)
Sets the factory that will create the output streams to which images can
be encoded.
|
void |
setLevelCount(int aLevelCount)
Sets the number of wavelet decomposition levels or stages.
|
void |
setLossless(boolean aLossless)
Enables/disables lossless (reversible) JPEG2000 encoding.
|
void |
setQuality(float aQuality)
Sets the encoding quality as an floating value between 0 (lowest) and
8.0 (highest quality).
|
void |
setQualityLayerCount(int aQualityLayerCount)
Sets the number of quality layers.
|
void |
setTileHeight(int aTileHeight)
Sets the height of a tile in pixels.
|
void |
setTileWidth(int aTileWidth)
Sets the width of a tile in pixels.
|
public void setImageOutputStreamFactory(ILcdOutputStreamFactory aImageOutputStreamFactory)
null
, meaning that images are
encoded in files.public ILcdOutputStreamFactory getImageOutputStreamFactory()
public void setLevelCount(int aLevelCount)
If not set by the user, the default number of levels is 0, which is interpreted differently depending on the color model of the image:
0
means that the number of
levels will be computed such that the smallest image tile (or the entire image if tiling
is not used) will have a size of at least 64x64 pixels. 0
means that the encoded
image will have a single level.aLevelCount
- the number of JPEG2000 DWT levelspublic int getLevelCount()
public void setQualityLayerCount(int aQualityLayerCount)
aQualityLayerCount
- the number of JPEG2000 quality layers.public int getQualityLayerCount()
public void setTileWidth(int aTileWidth)
aTileWidth
- the tile width.public int getTileWidth()
public void setTileHeight(int aTileHeight)
aTileHeight
- the tile height.public int getTileHeight()
public void setQuality(float aQuality)
aQuality
- a value between 0 and 8.setLossless(boolean)
public float getQuality()
isLossless()
public void setLossless(boolean aLossless)
aLossless
- true if reversible encoding is required.setQuality(float)
public boolean isLossless()
getQuality()
public String getDisplayName()
ILcdModelEncoder
ILcdModelEncoder
encodes to.getDisplayName
in interface ILcdModelEncoder
ILcdModelEncoder
.public boolean canSave(ILcdModel aModel)
ILcdModelEncoder
canSave
in interface ILcdModelEncoder
aModel
- the model to be verified.true
if this encoder can save the model in the location where it originally came from,
false
otherwise.ILcdModelEncoder.save(com.luciad.model.ILcdModel)
public void save(ILcdModel aModel) throws IllegalArgumentException, IOException
ILcdModelEncoder
save
in interface ILcdModelEncoder
aModel
- the model to be saved.IllegalArgumentException
- if the model cannot be saved by this encoder (!canSave(aModel)
).IOException
- if an I/O error occurs during encoding.public boolean canExport(ILcdModel aModel, String string)
ILcdModelEncoder
canExport
in interface ILcdModelEncoder
aModel
- the model to be verified.string
- the location where the model should be exported to.true
if this encoder can export the specified model to the
specified location, false
otherwise.ILcdModelEncoder.export(com.luciad.model.ILcdModel, java.lang.String)
public void export(ILcdModel aModel, String aFileName) throws IllegalArgumentException, IOException
ILcdModelEncoder
export
in interface ILcdModelEncoder
aModel
- the model to be exported.aFileName
- the location where the model should be saved. Typically, this is a name for the output
file, but it can also point to a file containing the required properties to create a set
of data files.IllegalArgumentException
- if the model cannot be saved by this encoder (!canExport(aModel, aDestinationName)
).IOException
- if an I/O error occurs during encoding.