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
inputStreamFactoryof 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.THFfile, the decoded model is anILcdModelTreeNodecontaining the above models, or optionally aTLcd2DBoundsIndexedModelList. See alsosetCreateModelTreeNodes(boolean).
Model descriptor
- When decoding a
TRANSH01.THFfile, 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
TLcdUTMGridorTLcdUPSGriddepending on the zone number.
Model elements
- Raster data are decoded as an implementation of
ALcdImageand (ILcdraster) elements. Each raster contains a singleTLcdUSRPTileinstance 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
TLcdGeoTIFFModelEncodercan 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
ConstructorsConstructorDescriptionCreates 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 TypeMethodDescriptionbooleancanDecodeSource(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.booleanReturns whether anILcdModelTreeNodeor aTLcdModelListis created when decoding a .THF file.voidsetCreateModelTreeNodes(boolean aCreateModelTreeNodes) Specifies whether anILcdModelTreeNodeor aTLcdModelListshould be created when decoding a .THF file.voidsetInputStreamFactory(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, waitMethods 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:
setInputStreamFactoryin 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:
getInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Returns:
- the input stream factory that is used.
-
setCreateModelTreeNodes
public void setCreateModelTreeNodes(boolean aCreateModelTreeNodes) Specifies whether anILcdModelTreeNodeor aTLcdModelListshould be created when decoding a .THF file.- Parameters:
aCreateModelTreeNodes-trueif anILcdModelTreeNodeshould be created,falseif aTLcdModelListshould be created.
-
isCreateModelTreeNodes
public boolean isCreateModelTreeNodes()Returns whether anILcdModelTreeNodeor aTLcdModelListis created when decoding a .THF file. The default istrue, which means that by defaultILcdModelTreeNodeinstances are used.- Returns:
trueif anILcdModelTreeNodeis created when decoding a source,falseif aTLcdModelListis be created.
-
getDisplayName
Description copied from interface:ILcdModelDecoderReturns a short, displayable name for the format that is decoded by thisILcdModelDecoder.- Specified by:
getDisplayNamein interfaceILcdModelDecoder- Returns:
- "USRP".
-
canDecodeSource
Description copied from interface:ILcdModelDecoderChecks whether this model decoder can decode the specified data source. It is acceptable for this method to returntruefor a source name whiledecodethrows 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:
canDecodeSourcein interfaceILcdModelDecoder- Parameters:
aSourceName- the data source to be verified; typically a file name or a URL.- Returns:
trueif the file extension of the given source name is "01.THF", "01.GEN", "01.QAL", ".SOU", or ".IMG",falseotherwise.- See Also:
-
decode
Description copied from interface:ILcdModelDecoderCreates a new model from the given data source.- Specified by:
decodein interfaceILcdModelDecoder- Parameters:
aSourceName- the data source to be decoded; typically a file name or a URL.- Returns:
- A model containing the decoded data. While
nullis 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:ILcdModelDecoderDecodes 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:
decodeModelMetadatain 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:
-