@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdNITFModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
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.setAllowOrthographicReferencing(boolean)
setMaximumResidualTiePointError(double)
setRasterReferencer(com.luciad.format.raster.reference.ILcdRasterReferencer)
null
).
The decoder supports the following optional Tagged Record Extensions:*.ntf
), NSF (*.nsf
) and NSIF (*.nsif
)
files, as well as any supported CADRG frame file. Extensions for these files are a concatenation
of a data series code and a zone code. See TLcdCADRGModelDecoder
for more info.
inputStreamFactory
of this decoder.ILcd2DBoundsIndexedModel
.separateGraphics
property
is set to true
, models that contain vector graphic segments
also implement ILcdModelTreeNode
. The vector
data are then returned in model tree nodes, one per graphic segment.
The model tree nodes also implement
ILcd2DBoundsIndexedModel
.TLcdNITFModelDescriptor
.ILcdGridReference
constructed from the RPC parameters
(see the RPC00B specifications).
The
datum of the reference is WGS84.ILcdGridReference
constructed from the SENSRB parameters. The datum of the reference is
WGS84.
ICORDS
element is set, the returned model reference can be an
ILcdGeodeticReference
or a TLcdUTMGrid
. constructed from the
ICORDS
element.ALcdImage
and (ILcdRaster
)
elements.ILcdShape
elements, as specified by TLcdCGMModelDecoder
.
By default, the vector data are decoded as elements of the main model.
If the separateGraphics
property
is set to true
, they are decoded as elements of model tree
nodes of the main model, with one model tree node per graphic
segment.ignoreGraphics
property.
ILcdModelDecoder decoder = new TLcdNITFModelDecoder();
ILcdModel model = decoder.decode("raster.ntf");
TLcdGeoTIFFModelEncoder
can create
compressed and tiled multilevel GeoTIFF files that can replace the
original NITF files.ELcdNITFBandRepresentation
).Constructor and Description |
---|
TLcdNITFModelDecoder()
Creates a new
TLcdNITFModelDecoder , with a globally shared
buffer for caching tiles. |
TLcdNITFModelDecoder(ILcdBuffer aBuffer)
Creates a new
TLcdNITFModelDecoder . |
TLcdNITFModelDecoder(ILcdBuffer aBuffer,
ILcdModelReferenceDecoder aModelReferenceDecoder)
Creates a new
TLcdNITFModelDecoder . |
TLcdNITFModelDecoder(ILcdBuffer aBuffer,
ILcdModelReferenceDecoder aModelReferenceDecoder,
ILcdModelReference aDefaultModelReference,
ILcdBounds aDefaultBounds)
Creates a new
TLcdNITFModelDecoder . |
TLcdNITFModelDecoder(ILcdBuffer aBuffer,
ILcdModelReference aDefaultModelReference,
ILcdBounds aDefaultBounds)
Creates a new
TLcdNITFModelDecoder . |
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.
|
protected ILcdBounds |
decodeImageBounds(String aCoordinateSystem,
String aGeographicLocation,
int aDisplayLevel,
int aAttachmentLevel,
int aImageWidth,
int aImageHeight,
ILcdModelReference aModelReference)
Decodes image bounds based on the given information.
|
protected ILcdModelReference |
decodeModelReference(String aCoordinateSystem,
String aGeographicLocation,
ILcdModelReference aDefaultModelReference)
Decodes a model reference based on the given information.
|
ILcdBounds |
getDefaultBounds()
Returns the default bounds for decoded rasters, in case an input NITF file
doesn't provide any.
|
String |
getDefaultExtension() |
ILcdModelReference |
getDefaultModelReference()
Returns the default model reference for decoded models, in case an input
NITF file and the model reference decoder don't provide one.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the input stream factory that is used for creating input streams
given source names.
|
double |
getMaximumResidualTiePointError()
Returns the maximum acceptable residual error for the four corner points.
|
ILcdModelReferenceDecoder |
getModelReferenceDecoder()
Returns the model reference decoder that is used for creating model
references for decoded models, in case an input NITF file doesn't provide
one.
|
ILcdRasterReferencer |
getRasterReferencer()
Returns the raster referencer that is used when positioning image files
based on tie points.
|
boolean |
isAllowOrthographicReferencing()
Returns whether images that are rotated in a geodetic reference may
be put in an orthographic grid reference that is centered around the image.
|
boolean |
isDecodeMultilevelRasters()
Returns whether the decoder may return multilevel rasters (when possible)
instead of single-level rasters.
|
boolean |
isIgnoreGraphics()
Returns whether CGM vector graphics segments are ignored.
|
boolean |
isSeparateGraphics()
Returns whether CGM vector graphics segments are separated into individual
submodels.
|
void |
setAllowOrthographicReferencing(boolean aAllowOrthographicReferencing)
Specifies whether images that are rotated in a geodetic reference may
be put in an approximating orthographic grid reference that is centered
around the image.
|
void |
setDecodeMultilevelRasters(boolean aDecodeMultilevelRasters)
Specifies whether the decoder is allowed to create multilevel rasters if
the input data permits (for instance, for rasters with JPEG-2000
compression).
|
void |
setDefaultBounds(ILcdBounds aDefaultBounds)
Sets the default bounds for decoded rasters, in case an input NITF file
doesn't provide any.
|
void |
setDefaultModelReference(ILcdModelReference aDefaultModelReference)
Sets the default model reference for decoded models, in case an input NITF
file and the model reference decoder don't provide one.
|
void |
setIgnoreGraphics(boolean aIgnoreGraphics)
Specifies whether to ignore CGM vector graphics segments.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory that will be used for creating input streams
given source names.
|
void |
setMaximumResidualTiePointError(double aMaximumResidualTiePointError)
Sets the maximum acceptable residual error for the four corner points,
when positioning image files in an approximating orthographic grid
reference.
|
void |
setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
Sets the model reference decoder that will be used for creating model
references for decoded models, in case an input NITF file doesn't provide
one.
|
void |
setRasterReferencer(ILcdRasterReferencer aRasterReferencer)
Sets the raster referencer that will be used when positioning image files
based on tie points.
|
void |
setSeparateGraphics(boolean aSeparateGraphics)
Specifies whether to separate CGM vector graphics segments into individual
submodels.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public TLcdNITFModelDecoder()
TLcdNITFModelDecoder
, with a globally shared
buffer for caching tiles.TLcdSharedBuffer.getBufferInstance()
public TLcdNITFModelDecoder(ILcdBuffer aBuffer)
TLcdNITFModelDecoder
.aBuffer
- the shared buffer that decoded models will use.public TLcdNITFModelDecoder(ILcdBuffer aBuffer, ILcdModelReferenceDecoder aModelReferenceDecoder)
TLcdNITFModelDecoder
.aBuffer
- the shared buffer that decoded models will use.aModelReferenceDecoder
- the model reference decoder for NITF files
that don't specify model references.public TLcdNITFModelDecoder(ILcdBuffer aBuffer, ILcdModelReference aDefaultModelReference, ILcdBounds aDefaultBounds)
TLcdNITFModelDecoder
.aBuffer
- the shared buffer that decoded models will use.aDefaultModelReference
- the default model reference for NITF files
that don't specify model references.aDefaultBounds
- the default raster bounds for NITF images
that don't have bounds.public TLcdNITFModelDecoder(ILcdBuffer aBuffer, ILcdModelReferenceDecoder aModelReferenceDecoder, ILcdModelReference aDefaultModelReference, ILcdBounds aDefaultBounds)
TLcdNITFModelDecoder
.aBuffer
- the shared buffer that decoded models will use.aModelReferenceDecoder
- the model reference decoder for NITF files
that don't specify model references.aDefaultModelReference
- the default model reference for NITF files
that don't specify model references.aDefaultBounds
- the default raster bounds for NITF images
that don't have bounds.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 setDefaultBounds(ILcdBounds aDefaultBounds)
public ILcdBounds getDefaultBounds()
public void setAllowOrthographicReferencing(boolean aAllowOrthographicReferencing)
public boolean isAllowOrthographicReferencing()
public void setMaximumResidualTiePointError(double aMaximumResidualTiePointError)
aMaximumResidualTiePointError
- the maximum residual error, expressed
in pixels.setAllowOrthographicReferencing(boolean)
public double getMaximumResidualTiePointError()
public void setRasterReferencer(ILcdRasterReferencer aRasterReferencer)
allowOrthographicReferencing
and
maximumResidualTiePointError
, which are used by default.aRasterReferencer
- the raster referencer, which will create model
references and raster bounds based on tie points.public ILcdRasterReferencer getRasterReferencer()
public void setIgnoreGraphics(boolean aIgnoreGraphics)
public boolean isIgnoreGraphics()
public void setSeparateGraphics(boolean aSeparateGraphics)
public boolean isSeparateGraphics()
public String getDefaultExtension()
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
public boolean isDecodeMultilevelRasters()
false
.public void setDecodeMultilevelRasters(boolean aDecodeMultilevelRasters)
aDecodeMultilevelRasters
- specifies whether the decoder should create
multilevel rasters when possible.public boolean canDecodeSource(String aSourceName)
TLcdCADRGModelDecoder
for more information on which CADRG frame types are supported.canDecodeSource
in interface ILcdModelDecoder
aSourceName
- the name of the file or URL that is to be decoded.true
if this decoder 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)
protected ILcdModelReference decodeModelReference(String aCoordinateSystem, String aGeographicLocation, ILcdModelReference aDefaultModelReference) throws IOException
aCoordinateSystem
- the NITF Image Coordinate Representation
(ICORDS).aGeographicLocation
- the NITF Image Geographic Location (IGEOLO).aDefaultModelReference
- the default model reference, if set, which
can be returned in case the NITF parameters
don't specify a valid model reference.IOException
protected ILcdBounds decodeImageBounds(String aCoordinateSystem, String aGeographicLocation, int aDisplayLevel, int aAttachmentLevel, int aImageWidth, int aImageHeight, ILcdModelReference aModelReference) throws IOException
aCoordinateSystem
- the NITF Image Coordinate Representation
(ICORDS).aGeographicLocation
- the NITF Image Geographic Location (IGEOLO).aDisplayLevel
- the NITF display level of the image segment.aAttachmentLevel
- the NITF attachment level of the image segment.aImageWidth
- the image width, expressed in pixels.aImageHeight
- the image height, expressed in pixels.aModelReference
- the previously decoded model reference.IOException