@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdUSRPModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
File | Required | Entry point | Description |
---|---|---|---|
TRANSH01.THF |
x | Transmittal Header File | |
*01.GEN |
x | x | General Information file, containing raster metadata |
*01.GER |
x | Georeference file, always specifying the geodetic datum WGS84 | |
*01.QAL |
x | x | Quality file, containing accuracy metadata |
*.SOU |
x | Source file, containing image metadata | |
*.IMG |
x | x | Image file, containing the actual raster data |
inputStreamFactory
of this decoder.ILcd2DBoundsIndexedModel
.TRANSH01.THF
file, the decoded model is an ILcdModelTreeNode
containing
the above models, or optionally a TLcd2DBoundsIndexedModelList
. See also setCreateModelTreeNodes(boolean)
.
TRANSH01.THF
file, the model descriptor
of the decoded model is a TLcdUSRPModelDescriptor
.TLcdUSRPDatasetModelDescriptor
.TLcdGeodeticReference
.TLcdUTMGrid
or TLcdUPSGrid
depending on the zone number.ALcdImage
and (ILcdraster
) elements. Each
raster contains a single TLcdUSRPTile
instance that corresponds
to a USRP/ASRP/ADRG zone. It contains additional information about the
zone.
ILcdModelDecoder decoder = new TLcdUSRPModelDecoder();
ILcdModel model = decoder.decode("TRANSH01.THF");
TLcdGeoTIFFModelEncoder
can create compressed multilevel GeoTIFF
files that can replace the original USRP files.Constructor and Description |
---|
TLcdUSRPModelDecoder()
Creates a new
TLcdUSRPModelDecoder , with a globally shared
buffer for caching tiles. |
TLcdUSRPModelDecoder(ILcdBuffer aBuffer)
Creates a new
TLcdUSRPModelDecoder , with the given shared
buffer for caching tiles. |
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.
|
TLcdModelMetadata |
decodeModelMetadata(String aSourceName)
Decodes metadata for the specified 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 for creating input streams
given source names.
|
boolean |
isCreateModelTreeNodes()
Returns whether an
ILcdModelTreeNode or a TLcdModelList is
created when decoding a .THF file. |
void |
setCreateModelTreeNodes(boolean aCreateModelTreeNodes)
Specifies whether an
ILcdModelTreeNode or a TLcdModelList
should be created when decoding a .THF file. |
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory that will be used for creating input streams
given source names.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeSource, discoverDataSources
public TLcdUSRPModelDecoder()
TLcdUSRPModelDecoder
, with a globally shared
buffer for caching tiles.TLcdSharedBuffer.getBufferInstance()
public TLcdUSRPModelDecoder(ILcdBuffer aBuffer)
TLcdUSRPModelDecoder
, with the given shared
buffer for caching tiles.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 setCreateModelTreeNodes(boolean aCreateModelTreeNodes)
ILcdModelTreeNode
or a TLcdModelList
should be created when decoding a .THF file.aCreateModelTreeNodes
- true
if an ILcdModelTreeNode
should be created,
false
if a TLcdModelList
should be created.public boolean isCreateModelTreeNodes()
ILcdModelTreeNode
or a TLcdModelList
is
created when decoding a .THF file. The default is true
, which means
that by default ILcdModelTreeNode
instances are used.true
if an ILcdModelTreeNode
is created when
decoding a source, false
if a TLcdModelList
is be created.public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface 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 the file extension of the given source name
is "01.THF", "01.GEN", "01.QAL", ".SOU", or ".IMG",
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 TLcdModelMetadata decodeModelMetadata(String aSourceName) throws IOException
ILcdModelDecoder
decodeModelMetadata
in interface ILcdModelDecoder
aSourceName
- the data source to be decoded; typically a file name or a URL.IOException
- if the metadata cannot be decoded for some reason.ILcdModelDecoder.canDecodeSource(String)