Package com.luciad.format.usrp
Class TLcdUSRPModelDecoder
java.lang.Object
com.luciad.format.usrp.TLcdUSRPModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdModelDecoder
@LcdService(service=ILcdModelDecoder.class,
priority=20000)
public class TLcdUSRPModelDecoder
extends Object
implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
This model decoder decodes rasters in the USRP, ASRP, and ADRG formats.
More specifically, these formats are:
- the UTM/UPS Standard Raster Product format (USRP, versions 1.2 and 1.3), as used by the French Defense Mapping Agency,
- the Arc Standard Raster Product format (ASRP, versions 1.0 and 1.2), as used by the British Military Survey Agency,
- the Arc Digitized Raster Graphics format (ADRG).
Input files
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 |
Supported file transfer protocols
- This model decoder supports all transfer protocols that are supported by
the
inputStreamFactory
of this decoder.
Model structure
- This model decoder creates a model per raster data set.
- All models returned by this model decoder implement
ILcd2DBoundsIndexedModel
. - When decoding a
TRANSH01.THF
file, the decoded model is anILcdModelTreeNode
containing the above models, or optionally aTLcd2DBoundsIndexedModelList
. See alsosetCreateModelTreeNodes(boolean)
.
Model descriptor
- When decoding a
TRANSH01.THF
file, the model descriptor of the decoded model is aTLcdUSRPModelDescriptor
. - Otherwise, the model descriptor of the decoded model is a
TLcdUSRPDatasetModelDescriptor
. - The type name of the model descriptor is the display name of this decoder.
Model reference
- For ADRG and ASRP data, models have a
TLcdGeodeticReference
. - For USRP data, models have a
TLcdUTMGrid
orTLcdUPSGrid
depending on the zone number.
Model elements
- Raster data are decoded as an implementation of
ALcdImage
and (ILcdraster
) elements. Each raster contains a singleTLcdUSRPTile
instance that corresponds to a USRP/ASRP/ADRG zone. It contains additional information about the zone.
Sample code
ILcdModelDecoder decoder = new TLcdUSRPModelDecoder();
ILcdModel model = decoder.decode("TRANSH01.THF");
Performance tips
- USRP rasters can be large. Precomputing and storing multiple levels
of detail may speed up visualization and some computations. The
TLcdGeoTIFFModelEncoder
can create compressed multilevel GeoTIFF files that can replace the original USRP files.
Thread safety
- The decoding of models is thread-safe, as long as no properties are changed during the decoding.
- The decoded models and elements are thread-safe for read access, on the condition that a thread-safe buffer is used.
Supported versions and specifications
- The UTM/UPS Standard Raster Product Specification (USRP, Editions 1.2 and 1.3, August 1997)
- The ARC Standard Raster Product Specification (ASRP, Editions 1.0 and 1.2, March 1995)
- ARC Digitized Graphics (ADRG, MIL-A-89007, February 1990)
Known limitations
- The current implementation does not support 12-bits grayscale JPEG images.
Requirements
- This decoder is part of the Defense Standards component.
- Since:
- 2.3
-
Constructor Summary
ConstructorDescriptionCreates a newTLcdUSRPModelDecoder
, with a globally shared buffer for caching tiles.TLcdUSRPModelDecoder
(ILcdBuffer aBuffer) Creates a newTLcdUSRPModelDecoder
, with the given shared buffer for caching tiles. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeSource
(String aSourceName) Checks whether this model decoder can decode the specified data source.Creates a new model from the given data source.decodeModelMetadata
(String aSourceName) Decodes metadata for the specified data source.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.Returns the input stream factory that is used for creating input streams given source names.boolean
Returns whether anILcdModelTreeNode
or aTLcdModelList
is created when decoding a .THF file.void
setCreateModelTreeNodes
(boolean aCreateModelTreeNodes) Specifies whether anILcdModelTreeNode
or aTLcdModelList
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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeSource, discoverDataSources
-
Constructor Details
-
TLcdUSRPModelDecoder
public TLcdUSRPModelDecoder()Creates a newTLcdUSRPModelDecoder
, with a globally shared buffer for caching tiles.- See Also:
-
TLcdUSRPModelDecoder
Creates a newTLcdUSRPModelDecoder
, with the given shared buffer for caching tiles.
-
-
Method Details
-
setInputStreamFactory
Sets the input stream factory that will be used for creating input streams given source names.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- the input stream factory to be used.
-
getInputStreamFactory
Returns the input stream factory that is used for creating input streams given source names.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the input stream factory that is used.
-
setCreateModelTreeNodes
public void setCreateModelTreeNodes(boolean aCreateModelTreeNodes) Specifies whether anILcdModelTreeNode
or aTLcdModelList
should be created when decoding a .THF file.- Parameters:
aCreateModelTreeNodes
-true
if anILcdModelTreeNode
should be created,false
if aTLcdModelList
should be created.
-
isCreateModelTreeNodes
public boolean isCreateModelTreeNodes()Returns whether anILcdModelTreeNode
or aTLcdModelList
is created when decoding a .THF file. The default istrue
, which means that by defaultILcdModelTreeNode
instances are used.- Returns:
true
if anILcdModelTreeNode
is created when decoding a source,false
if aTLcdModelList
is be created.
-
getDisplayName
Description copied from interface:ILcdModelDecoder
Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.- Specified by:
getDisplayName
in interfaceILcdModelDecoder
- Returns:
- "USRP".
-
canDecodeSource
Description copied from interface:ILcdModelDecoder
Checks whether this model decoder can decode the specified data source. It is acceptable for this method to returntrue
for a source name whiledecode
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.
- Specified by:
canDecodeSource
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the data source to be verified; typically a file name or a URL.- Returns:
true
if the file extension of the given source name is "01.THF", "01.GEN", "01.QAL", ".SOU", or ".IMG",false
otherwise.- See Also:
-
decode
Description copied from interface:ILcdModelDecoder
Creates a new model from the given data source.- Specified by:
decode
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the data source to be decoded; typically a file name or a URL.- Returns:
- A model containing the decoded data. While
null
is allowed, implementors are advised to throw an error instead. - Throws:
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); } }
- See Also:
-
decodeModelMetadata
Description copied from interface:ILcdModelDecoder
Decodes metadata for the specified data source. By default, this decodes the model and returns the model metadata found on that model. Implementations can override this method to speed up the retrieval.- Specified by:
decodeModelMetadata
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the data source to be decoded; typically a file name or a URL.- Returns:
- the model metadata for the data source, never null.
- Throws:
IOException
- if the metadata cannot be decoded for some reason.- See Also:
-