@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdECWModelDecoder extends Object implements ILcdModelDecoder, ILcdMetadataDecoder
File | Required | Entry point | Description |
---|---|---|---|
*.ecw | x | x | ECW file containing the raster data and possibly specifying a model reference and raster bounds using embedded GeoTIFF tags |
*.ers | ERS file specifying a model reference and raster bounds | ||
*.tab | TAB file specifying a model reference and raster bounds |
If none of the files specify a model reference, the model reference is obtained from an 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 none of the files specify raster bounds, it is retrieved from the
bounds
property of this decoder.
InputStream
, from a http connection or from an image file inside
a jar file.
ILcd2DBoundsIndexedModel
.TLcdECWModelDescriptor
.default reference
for files from which the reference information is mssing.custom reference decoder
can also be installed.ALcdImage
(and ILcdMultilevelRaster
) instance.defaultValue
allows the specify the
default value that is assigned to decoded rasters.
ILcdModelDecoder decoder =
new TLcdECWModelDecoder();
ILcdModel model = decoder.decode("raster.ecw");
ILcdMetadataDecoder.MetadataWithSource
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DISPLAY_NAME |
static double |
EPSILON |
Constructor and Description |
---|
TLcdECWModelDecoder()
Creates a new TLcdECWModelDecoder, with a globally shared buffer for
caching tiles.
|
TLcdECWModelDecoder(ILcdBuffer aBuffer)
Creates a new TLcdECWModelDecoder with the given buffer.
|
TLcdECWModelDecoder(ILcdBuffer aBuffer,
ILcdModelReference aDefaultModelReference)
Creates a new TLcdECWModelDecoder with the given buffer and default
model reference.
|
TLcdECWModelDecoder(ILcdBuffer aBuffer,
ILcdModelReferenceDecoder aModelReferenceDecoder)
Creates a new TLcdECWModelDecoder with the given buffer and model
reference decoder.
|
TLcdECWModelDecoder(ILcdBuffer aBuffer,
ILcdModelReferenceDecoder aModelReferenceDecoder,
ILcdModelReference aDefaultModelReference,
int aDefaultValue)
Creates a new TLcdECWModelDecoder with the given properties.
|
TLcdECWModelDecoder(ILcdBuffer aBuffer,
ILcdModelReferenceDecoder aModelReferenceDecoder,
int aDefaultValue)
Creates a new TLcdECWModelDecoder with the given buffer, model
reference decoder, and default value.
|
TLcdECWModelDecoder(ILcdBuffer aBuffer,
ILcdModelReference aDefaultModelReference,
int aDefaultValue)
Creates a new TLcdECWModelDecoder with the given buffer, default
model reference, and default value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeMetadata(String aSourceName)
Tells whether this metadata decoder can likely decode metadata for a given source name.
|
boolean |
canDecodeSource(String aSourceName)
Checks whether
TLcdECWModelDecoder can decode the given data. |
ILcdModel |
decode(String aSourceName)
Creates a new model from the given data source.
|
TLcdISO19115Metadata |
decodeMetadata(String aSourceName)
The ECW metadata has the following structure:
|
ILcdBounds |
getBounds()
Sets the default model bounds that is assigned to rasters of the
decoded models whose image files don't specify bounds.
|
ILcdModelReference |
getDefaultModelReference()
Returns the default model reference that is assigned to decoded models
whose image files don't specify model references.
|
int |
getDefaultValue()
Returns the default pixel value that is assigned to the rasters of the
decoded models.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
long |
getMaxCacheSize()
Returns the maximum size of the ECW image cache.
|
double |
getMaximumResidualTiePointError()
Returns the maximum acceptable average residual error for tie points.
|
ILcdModelReference |
getModelReference()
Deprecated.
|
ILcdModelReferenceDecoder |
getModelReferenceDecoder()
Returns the model reference decoder that is used for decoded models
whose image files don't specify model references.
|
void |
setBounds(ILcdBounds aBounds)
Sets the default model bounds that will be assigned to rasters of the
decoded models whose image files don't specify bounds.
|
void |
setDefaultModelReference(ILcdModelReference aDefaultModelReference)
Sets the default model reference that will be assigned to decoded models
whose image files don't specify model references.
|
void |
setDefaultValue(int aDefaultValue)
Sets the default pixel value that will be assigned to the rasters of the
decoded models.
|
void |
setMaxCacheSize(long aMaxCacheSize)
Sets the maximum size of the ECW image cache.
|
void |
setMaximumResidualTiePointError(double aMaximumResidualTiePointError)
Sets the maximum acceptable average residual error for tie points, when
positioning rasters based TAB files instead of on scaling information.
|
void |
setModelReference(ILcdModelReference aDefaultModelReference)
Deprecated.
|
void |
setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
Sets the model reference decoder that will be used for decoded models
whose image files don't specify model references.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
findAndDecodeMetadata
public static final String DEFAULT_DISPLAY_NAME
public static final double EPSILON
public TLcdECWModelDecoder()
TLcdSharedBuffer.getBufferInstance()
public TLcdECWModelDecoder(ILcdBuffer aBuffer)
aBuffer
- the buffer in which pixel data can be decoded and cached.public TLcdECWModelDecoder(ILcdBuffer aBuffer, ILcdModelReferenceDecoder aModelReferenceDecoder)
aBuffer
- the buffer in which pixel data can be decoded and cached.aModelReferenceDecoder
- the model reference decoder.public TLcdECWModelDecoder(ILcdBuffer aBuffer, ILcdModelReferenceDecoder aModelReferenceDecoder, int aDefaultValue)
aBuffer
- the buffer in which pixel data can be decoded and cached.aModelReferenceDecoder
- the model reference decoder.aDefaultValue
- the default pixel value.public TLcdECWModelDecoder(ILcdBuffer aBuffer, ILcdModelReference aDefaultModelReference)
aBuffer
- the buffer in which pixel data can be decoded and cached.aDefaultModelReference
- the default model reference.public TLcdECWModelDecoder(ILcdBuffer aBuffer, ILcdModelReference aDefaultModelReference, int aDefaultValue)
aBuffer
- the buffer in which pixel data can be decoded and cached.aDefaultModelReference
- the default model reference.aDefaultValue
- the default pixel value.public TLcdECWModelDecoder(ILcdBuffer aBuffer, ILcdModelReferenceDecoder aModelReferenceDecoder, ILcdModelReference aDefaultModelReference, int aDefaultValue)
aBuffer
- the buffer in which pixel data can be decoded and cached.aModelReferenceDecoder
- the model reference decoder.aDefaultModelReference
- the default model reference.aDefaultValue
- the default pixel value.public void setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
aModelReferenceDecoder
- the model reference decoder.public ILcdModelReferenceDecoder getModelReferenceDecoder()
setModelReferenceDecoder(com.luciad.model.ILcdModelReferenceDecoder)
public void setDefaultModelReference(ILcdModelReference aDefaultModelReference)
aDefaultModelReference
- the default model reference.public ILcdModelReference getDefaultModelReference()
public void setModelReference(ILcdModelReference aDefaultModelReference)
setDefaultModelReference(ILcdModelReference)
.public ILcdModelReference getModelReference()
getDefaultModelReference()
.public void setBounds(ILcdBounds aBounds)
aBounds
- the default model bounds.public ILcdBounds getBounds()
public void setMaximumResidualTiePointError(double aMaximumResidualTiePointError)
A raster is always positioned by means of an affine transformation in its coordinate system. For tie points that define an affine transformation, the residual error should therefore be 0. For tie points that define more complex, non-linear warping of the image, it will be larger than 0.
The residual error is computed in image coordinates and expressed in
pixels. The default is EPSILON
.
aMaximumResidualTiePointError
- the maximum residual error, expressed
in pixels.public double getMaximumResidualTiePointError()
public void setDefaultValue(int aDefaultValue)
aDefaultValue
- the default pixel value.ILcdRaster.setDefaultValue(int)
public int getDefaultValue()
public long getMaxCacheSize()
64MB
which should give good performance and reasonable memory
usage in almost all cases.public void setMaxCacheSize(long aMaxCacheSize)
aMaxCacheSize
- the maximum size in bytesgetMaxCacheSize()
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public boolean canDecodeSource(String aSourceName)
TLcdECWModelDecoder
can decode the given data.
The extension of the file name should be "ecw" or "ers".canDecodeSource
in interface ILcdModelDecoder
aSourceName
- the name of the file that is to be decoded.true
if TLcdECWModelDecoder
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)
public boolean canDecodeMetadata(String aSourceName)
ILcdMetadataDecoder
true
, it is likely that ILcdMetadataDecoder.decodeMetadata(String)
will return a non-null TLcdISO19115Metadata
object,
but it is not a guarantee. The result is optimistic.
false
, it is guaranteed that ILcdMetadataDecoder.decodeMetadata(String)
will throw an exception or return null
.
canDecodeMetadata
in interface ILcdMetadataDecoder
aSourceName
- the source name to decode metadata fortrue
if this metadata decoder can decode metadata for the given source name, false
otherwisepublic TLcdISO19115Metadata decodeMetadata(String aSourceName) throws IOException
Elements with a '*' are optional. All file names are without parent path, which is needed for portability.Metadata DataIdentification Citation Title=[ECW data file name, same as identifier code] Identifier Code=[ECW data file name] Describes MX_DataSet DataFile FileName=[ECW data file name] SupportFiles FileName Src=[TAB support file name]* Src=[ERS support file name]* Src=[REF support file name]* Src=[PRJ support file name]*
Both the identifier and title contain the data file name. The identifier is authoritative, the title is for display purposes.
decodeMetadata
in interface ILcdMetadataDecoder
aSourceName
- the source name to decode metadata fromnull
IOException
- if the metadata cannot be decoded for some reason