@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdBILModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
File | Required | Entry point | Description | *.BIL | x | x | BIL file containing the band-interleaved image data |
---|---|---|---|
*.HDR | x | x | header file containing image metadata |
*.BLW | x | BIL World file specifying raster bounds |
ILcdModelReferenceDecoder
. The default reference decoder set on this
model decoder is based on all model reference decoders annotated with the LcdService
annotation, and can handle
<filename>.epsg
): see TLcdEPSGModelReferenceDecoder
for more info.<filename>.prj
): see TLcdWKTModelReferenceDecoder
for more info.<filename>.ref
): see TLcdModelReferenceDecoder
for more info.
If the HDR or BLW files don't specify raster bounds, they are retrieved from
the bounds
property of this decoder.
The decoder parses the following keywords for determining the BIL file structure:
ncols
int
nrows
int
nbands
int
nbits
int
byteorder [IM]
skipbytes
int
bandrowbytes
int
layout bil
xulcorner
double (or ulxmap
double)
yulcorner
double (or ulymap
double)
xllcorner
double (or llxmap
double)
yllcorner
double (or llymap
double)
cellsize
double
xdim
double
ydim
double
inputStreamFactory
of this decoder.ILcd2DBoundsIndexedModel
.TLcdBILModelDescriptor
.ILcdRaster
instance.colorModel
, defaultValue
, and
forcedTransparentColorIndex
provide some control over the color models that are attached to the
decoded rasters.
ILcdModelDecoder decoder = new TLcdBILModelDecoder();
ILcdModel model = decoder.decode("image.bil");
TLcdGeoTIFFModelEncoder
can create compressed multilevel GeoTIFF
files that can replace the original BIL files.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DISPLAY_NAME |
Constructor and Description |
---|
TLcdBILModelDecoder()
Creates a new
TLcdBILModelDecoder , with a globally shared
buffer for caching tiles. |
TLcdBILModelDecoder(ILcdBuffer aBuffer)
Creates a new
TLcdBILModelDecoder . |
TLcdBILModelDecoder(ILcdBuffer aBuffer,
ILcdModelReference aDefaultModelReference)
Creates a new
TLcdBILModelDecoder . |
TLcdBILModelDecoder(ILcdBuffer aBuffer,
ILcdModelReference aDefaultModelReference,
ColorModel aColorModel,
int aDefaultValue)
Creates a new
TLcdBILModelDecoder . |
TLcdBILModelDecoder(ILcdBuffer aBuffer,
ILcdModelReferenceDecoder aModelReferenceDecoder)
Creates a new
TLcdBILModelDecoder . |
TLcdBILModelDecoder(ILcdBuffer aBuffer,
ILcdModelReference aDefaultModelReference,
ILcdBounds aDefaultBounds)
Creates a new
TLcdBILModelDecoder . |
TLcdBILModelDecoder(ILcdBuffer aBuffer,
ILcdModelReference aDefaultModelReference,
ILcdBounds aDefaultBounds,
ColorModel aColorModel,
int aDefaultValue)
Creates a new
TLcdBILModelDecoder . |
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeSource(String aSourceName)
Checks whether this decoder can decode the given data.
|
ILcdModel |
decode(String aSourceName)
Creates a new model from the given data source.
|
ILcdBounds |
getBounds()
Returns the default bounds for decoded rasters.
|
ColorModel |
getColorModel()
Returns the default color model for decoded rasters.
|
ILcdModelReference |
getDefaultModelReference()
Returns the default model reference for decoded models.
|
int |
getDefaultValue()
Returns the default color or color index that is assigned to decoded
rasters.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
int |
getForcedTransparentColorIndex()
Returns the index of a color that is made transparent in the gray scale
rasters that are decoded.
|
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the input stream factory that is used for creating input streams
given source names.
|
ILcdModelReference |
getModelReference()
Deprecated.
|
ILcdModelReferenceDecoder |
getModelReferenceDecoder()
Returns the model reference decoder that is used for creating model
references for decoded models.
|
void |
setBounds(ILcdBounds aBounds)
Sets the default bounds for decoded rasters, in case an input data set
doesn't provide any.
|
void |
setColorModel(ColorModel aColorModel)
Sets the default color model for decoded rasters.
|
void |
setDefaultModelReference(ILcdModelReference aDefaultModelReference)
Sets the default model reference for decoded models, in case the model
reference decoder doesn't provide one.
|
void |
setDefaultValue(int aDefaultValue)
Sets the default color or color index to be assigned to decoded rasters.
|
void |
setForcedTransparentColorIndex(int aForcedTransparentColorIndex)
Sets the index of a color that should be made transparent in the gray scale
rasters that will be decoded next.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory that will be used for creating input streams
given source names.
|
void |
setModelReference(ILcdModelReference aDefaultModelReference)
Deprecated.
|
void |
setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
Sets the model reference decoder that will be used for creating model
references for decoded models.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public static final String DEFAULT_DISPLAY_NAME
public TLcdBILModelDecoder()
TLcdBILModelDecoder
, with a globally shared
buffer for caching tiles.TLcdSharedBuffer.getBufferInstance()
public TLcdBILModelDecoder(ILcdBuffer aBuffer)
TLcdBILModelDecoder
.aBuffer
- the buffer in which decoded raster tiles will be cached.public TLcdBILModelDecoder(ILcdBuffer aBuffer, ILcdModelReferenceDecoder aModelReferenceDecoder)
TLcdBILModelDecoder
.aBuffer
- the shared buffer that decoded models will use.aModelReferenceDecoder
- the model reference decoder.public TLcdBILModelDecoder(ILcdBuffer aBuffer, ILcdModelReference aDefaultModelReference)
TLcdBILModelDecoder
.aBuffer
- the shared buffer that decoded models will use.aDefaultModelReference
- the default model reference.public TLcdBILModelDecoder(ILcdBuffer aBuffer, ILcdModelReference aDefaultModelReference, ILcdBounds aDefaultBounds)
TLcdBILModelDecoder
.aBuffer
- the shared buffer that decoded models will use.aDefaultModelReference
- the default model reference.aDefaultBounds
- the default raster bounds.public TLcdBILModelDecoder(ILcdBuffer aBuffer, ILcdModelReference aDefaultModelReference, ColorModel aColorModel, int aDefaultValue)
TLcdBILModelDecoder
.aBuffer
- the shared buffer that decoded models will use.aDefaultModelReference
- the default model reference.aColorModel
- the color model for decoded rasters.aDefaultValue
- the default pixel value for decoded rasters.public TLcdBILModelDecoder(ILcdBuffer aBuffer, ILcdModelReference aDefaultModelReference, ILcdBounds aDefaultBounds, ColorModel aColorModel, int aDefaultValue)
TLcdBILModelDecoder
.aBuffer
- the shared buffer that decoded models will use.aDefaultModelReference
- the default model reference.aDefaultBounds
- the default raster bounds.aColorModel
- the color model for decoded rasters.aDefaultValue
- the default pixel value for decoded rasters.public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the input stream factory to be used.public ILcdInputStreamFactory getInputStreamFactory()
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
public void setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
public ILcdModelReferenceDecoder getModelReferenceDecoder()
setModelReferenceDecoder(com.luciad.model.ILcdModelReferenceDecoder)
public void setDefaultModelReference(ILcdModelReference aDefaultModelReference)
public ILcdModelReference getDefaultModelReference()
public void setModelReference(ILcdModelReference aDefaultModelReference)
setDefaultModelReference(ILcdModelReference)
.public ILcdModelReference getModelReference()
getDefaultModelReference()
.public void setBounds(ILcdBounds aBounds)
public ILcdBounds getBounds()
public void setColorModel(ColorModel aColorModel)
public ColorModel getColorModel()
public void setDefaultValue(int aDefaultValue)
public int getDefaultValue()
public void setForcedTransparentColorIndex(int aForcedTransparentColorIndex)
public int getForcedTransparentColorIndex()
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public boolean canDecodeSource(String aSourceName)
canDecodeSource
in interface ILcdModelDecoder
aSourceName
- the name of the file that is to be decoded.true
if TLcdBILModelDecoder
can decode the data specified by
the source name, false
otherwise.ILcdModelDecoder.decode(String)
,
ILcdModelDecoder.decodeModelMetadata(String)
public ILcdModel decode(String aSourceName) throws IOException
ILcdModelDecoder
decode
in interface ILcdModelDecoder
aSourceName
- the data source to be decoded; typically a file name or a URL.null
is allowed, implementors are advised to throw an error instead.IOException
- for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost
always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException,
IllegalArgumentException, ...) on unexpected places, implementations are advised to catch
RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated
in the code snippet below.
public ILcdModel decode( String aSourceName ) throws IOException {
try (InputStream input = fInputStreamFactory.createInputStream(aSourceName)) {
// Perform decoding ...
} catch (RuntimeException e) {
throw new IOException(e);
}
}
InterruptedIOException
- When the thread on which this method is called is interrupted: it is recommended to stop the decoding
and throw an InterruptedIOException
.
This same exception can also be used if the decoder shows UI to the user, and the user cancels the decoding
through the UI.ILcdModelDecoder.canDecodeSource(String)