@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdECRGModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
File | Required | Entry point | Description |
---|---|---|---|
TOC.xml |
x | x | Table of contents, referring to individual frame files |
<ds><z> |
x | Individual frame file.<ds> refers the the data series code as listed in the data series
table below.<z> refers to the ARC zone number. This is a character in the range
[1-9] for the northern hemisphere or [A-HJ] for the southern hemisphere. Please refer to section
3.4
of the ADRG specification (MIL-A-89007) for more details on the ARC system. |
inputStreamFactory
of this decoder.ILcd2DBoundsIndexedModel
.TLcdECRGModelDescriptor
or a
TLcdECRGMultilevelRasterModelDescriptor
, depending on the
contents of TOC.xml
.ILcdGeodeticReference
as model references.ALcdImage
elements. These also implement either
ILcdRaster
or ILcdMultilevelRaster
, depending on the presence of multiple scales in TOC.xml
.
TLcdRaster
instances correspond to
the ECRG/CIB boundary rectangles. They contain additional information
about the rectangles.TLcdRaster
instances in turn contain
TLcdECRGTile
instances that correspond to the
individual ECRG/CIB frames. They contain additional information about
the frames.
ILcdModelDecoder decoder = new TLcdECRGModelDecoder();
ILcdModel model = decoder.decode( "TOC.xml" );
Modifier and Type | Field and Description |
---|---|
static String |
DISPLAY_NAME |
Constructor and Description |
---|
TLcdECRGModelDecoder()
Creates a new
TLcdECRGModelDecoder , with a globally shared
buffer for caching tiles. |
TLcdECRGModelDecoder(ILcdBuffer aBuffer)
Creates a new
TLcdECRGModelDecoder . |
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeSource(String aSourceName)
Checks whether this model decoder can decode the specified data source.
|
ILcdModel |
decode(String aSourceName)
Creates a new model from the given data source.
|
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.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory to be used.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public static final String DISPLAY_NAME
public TLcdECRGModelDecoder()
TLcdECRGModelDecoder
, with a globally shared
buffer for caching tiles.TLcdSharedBuffer.getBufferInstance()
public TLcdECRGModelDecoder(ILcdBuffer aBuffer)
TLcdECRGModelDecoder
.aBuffer
- the buffer in which pixel data can be decoded and cached.public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
ILcdInputStreamFactoryCapable
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the input stream factory to be used.public ILcdInputStreamFactory getInputStreamFactory()
ILcdInputStreamFactoryCapable
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public boolean canDecodeSource(String aSourceName)
ILcdModelDecoder
true
for a source name while decode
throws an exception for that same source name.
For performance reasons, we strongly recommend that this will only be a simple test. For example: check the file extension of a file, but not that the file exists or contains expected content.
canDecodeSource
in interface ILcdModelDecoder
aSourceName
- the data source to be verified; typically a file name or a URL.true
if this decoder can likely 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)