Class TLcdCADRGModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable,ILcdModelDecoder
Input files
| File | Required | Entry point | Description |
|---|---|---|---|
A.TOC |
x | Table of contents, referring to individual frame files | |
*.<ds><z> |
x | 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. |
Supported Data Series
The decoder supports all data series codes from MIL-STD-2411-1 Change 3 (2010), table 5.1.4 with a fixed scale >= 1m. In summary, the following codes are supported:A1, A2, A3, A4, AT, C1, C2, C3, C4, C5, C6, C7, C8, C9, CA, CB, CC, CD, CE, CF, CH, CJ, CK, CL, CN, CP, CQ, CR, CS, CT, D1, D2, EG, ES, ET, F1, F2, F3, F4, F5, GN, I1, I2, I3, I4, JA, JG, JN, JO, JR, K1, K2, K3, K7, K8, KB, KE, KM, KR, KS, KU, L1, L2, L3, L4, L5, LF, LN, MH, MI, MJ, OH, ON, OW, P1, P2, P3, P4, P5, P6, P7, P8, P9, PA, PB, PC, PD, PE, PF, PG, PH, PI, PJ, PK, PL, PM, PN, PO, PP, PQ, PR, PS, PT, PU, PV, R1, R2, R3, R4, R5, RC, RL, RR, RV, TC, TF, TL, TN, TP, TQ, TR, TT, UL, V1, V2, V3, V4, VH, VN, VT, WA, WB, WC, WD, WE, WF, WG, WH, WI, WK, XD, XE, XF, XG, XH, XI, XJ, XK, Y9, YA, YB, YC, YD, YE, YF, YI, YJ, YZ, Z8, ZA, ZB, ZC, ZD, ZE, ZF, ZG, ZH, ZI, ZJ, ZK, ZT, ZV, ZZ
The following codes are recognized, but can't be decoded:CG, CM, CO, HA, I5, IV, M1, M2, MM, OA
We refer to the specification for a more detailed overview of these codes.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.
Model descriptor
- All models returned by this model decoder have a
TLcdCADRGModelDescriptoror aTLcdCADRGMultilevelRasterModelDescriptor, depending on the propertycreateMultilevelRasters. - The type name of the model descriptor is the display name of this decoder.
Model reference
- All models returned by this model decoder have instances of
ILcdGeodeticReferenceas model references. - The geodetic datum of this reference is an ellipsoidal datum WGS84.
Model elements
- Each decoded model contains either
TLcdCADRGRasterelements, orILcdMultilevelRasterelements containingTLcdCADRGRasterinstances, depending on the propertycreateMultilevelRasters. - In both cases, the
TLcdCADRGRasterinstances correspond to the CADRG/CIB boundary rectangles. They contain additional information about the rectangles. - The
TLcdCADRGRasterinstances in turn containinstances that correspond to the individual CADRG/CIB frames. They contain additional information about the frames.TLcdCADRGTile
Useful settings
-
By default, the decoder will produce tiles with full ARGB
DirectColorModelinstances instead ofIndexColorModelinstances. This avoids problems with clashing color maps from different CADRG tiles (cfr. MIL-C-89038, Section 3.10.3 "Color reduction"). This behavior can be disabled by setting the propertyexpandColorMaptofalse. - The property
createMultilevelRastersallows to decodeILcdMultilevelRasterelements instead of simpleILcdRasterelements.
Sample code
ILcdModelDecoder decoder =
new TLcdCADRGModelDecoder(TLcdSharedBuffer.getBufferInstance(), true, true);
ILcdModel model = decoder.decode("A.TOC");
Performance tips
Creating multilevel rasterscan help avoiding picking the right level of detail when painting them. Rasters that are defined at different levels of detail will not be painted at the same time, which is generally unnecessary for overlapping rasters. Usually this should be combined withexpanding color mapssince all levels must use the same kind of pixel.
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
- Compressed ARC Digitized Raster Graphics (CADRG, MIL-C-89038, 6 October 1994)
- Compressed ARC Digitized Raster Graphics (CADRG, MIL-PRF-89038, 6 October 1994)
- Controlled Image Base (CIB, MIL-C-89041, 15 May 1995)
- Controlled Image Base (CIB, MIL-PRF-89041, 15 May 1995)
- Raster Product Format (MIL-STD-2411, 6 October 1994)
- Integration of Raster Product Format Files into the National Imagery Transmission Format (MIL-STD-2411-2, 26 August 1994)
- Registered Data Values for Raster Product Format (MIL-STD-2411-1, 30 August 1994)
Known limitations
- Any legend frames, overview frames, elevation frames, and polar frames in the table of contents are currently ignored.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newTLcdCADRGModelDecoder, with a globally shared buffer for caching tiles.TLcdCADRGModelDecoder(ILcdBuffer aBuffer) Creates a newTLcdCADRGModelDecoder.TLcdCADRGModelDecoder(ILcdBuffer aBuffer, boolean aExpandColorMap) Creates a newTLcdCADRGModelDecoder.TLcdCADRGModelDecoder(ILcdBuffer aBuffer, boolean aExpandColorMap, boolean aCreateMultilevelRasters) Creates a newTLcdCADRGModelDecoder. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecodeSource(String aSourceName) Checks whetherTLcdCADRGModelDecodercan decode the given data.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 decoded models contain multilevel rasters, one for each CADRG zone, or just regular rasters.booleanReturns whether the color maps of decoded tiles are expanded.booleanDeprecated.This method has been deprecated.static voidsetClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated.voidsetCreateMultilevelRasters(boolean aCreateMultilevelRasters) Specifies whether decoded models should contain multilevel rasters, one for each CADRG zone, or just regular rasters.voidsetExpandColorMap(boolean aExpandColorMap) Sets whether the color maps of decoded tiles should be expanded.voidsetInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory that will be used for creating input streams given source names.voidsetTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated.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
-
Field Details
-
DISPLAY_NAME
- See Also:
-
TOC_NAME
- See Also:
-
DEFAULT_EXTENSION
- See Also:
-
OVERVIEW_EXTENSION
- See Also:
-
LEGEND_EXTENSION
- See Also:
-
-
Constructor Details
-
TLcdCADRGModelDecoder
public TLcdCADRGModelDecoder()Creates a newTLcdCADRGModelDecoder, with a globally shared buffer for caching tiles.- See Also:
-
TLcdCADRGModelDecoder
Creates a newTLcdCADRGModelDecoder.- Parameters:
aBuffer- the buffer in which pixel data can be decoded and cached.
-
TLcdCADRGModelDecoder
Creates a newTLcdCADRGModelDecoder.- Parameters:
aBuffer- the buffer in which pixel data can be decoded and cached.aExpandColorMap- specifies whether the color maps of decoded tiles should be expanded.
-
TLcdCADRGModelDecoder
public TLcdCADRGModelDecoder(ILcdBuffer aBuffer, boolean aExpandColorMap, boolean aCreateMultilevelRasters) Creates a newTLcdCADRGModelDecoder.- Parameters:
aBuffer- the buffer in which pixel data can be decoded and cached.aExpandColorMap- specifies whether the color maps of decoded tiles should be expanded.aCreateMultilevelRasters- specifies whether the decoder should create multilevel rasters instead of ordinary rasters
-
-
Method Details
-
setClassTraceOn
public static void setClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istruethen all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrueorfalseas argument automatically turns off tracing for all other class instances for whichsetTraceOnhas not been called. If the argument isfalsethen only the informative, warning and error log messages are recorded.- Parameters:
aTraceOn- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrueif tracing is enabled for this class.- Returns:
- true if tracing is enabled for this class, false otherwise.
-
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.
-
setExpandColorMap
public void setExpandColorMap(boolean aExpandColorMap) Sets whether the color maps of decoded tiles should be expanded. -
isExpandColorMap
public boolean isExpandColorMap()Returns whether the color maps of decoded tiles are expanded. The default is false. -
setCreateMultilevelRasters
public void setCreateMultilevelRasters(boolean aCreateMultilevelRasters) Specifies whether decoded models should contain multilevel rasters, one for each CADRG zone, or just regular rasters. The default is false. When you enable multi-level data then you should typically also enableexpanding of color mapssince all levels must have the same pixel type.- See Also:
-
isCreateMultilevelRasters
public boolean isCreateMultilevelRasters()Returns whether decoded models contain multilevel rasters, one for each CADRG zone, or just regular rasters. The default is false.- Returns:
- true if multilevel rasters are created, false if regular rasters are created.
-
getDisplayName
Description copied from interface:ILcdModelDecoderReturns a short, displayable name for the format that is decoded by thisILcdModelDecoder.- Specified by:
getDisplayNamein interfaceILcdModelDecoder- Returns:
- the displayable name of this
ILcdModelDecoder.
-
decodeModelMetadata
Decodes metadata for the specified data source.If the given data source is a
.TOCfile, the resultingTLcdModelMetadatawill also contain a metadata instance for each of the referenced frame files. These frame files' metadata are stored as data series children and can be retrieved withTLcdModelMetadata.discoverDataSeries(). All information in the metadata is obtained from the.TOCfile itself, which means that none of the frame files will be decoded (or even accessed) and a call toTLcdModelMetadata.discoverDataSeries()will not trigger any additional I/O.If the given data source is a single frame file, the file is simply decoded and the resulting metadata is extracted from that decoded model with
ILcdModel.getModelMetadata().- Specified by:
decodeModelMetadatain interfaceILcdModelDecoder- Parameters:
aSourceName- the data source for which the model metadata will be decoded.- Returns:
- the model metadata for the data source, never null.
- Throws:
IOException- if the metadata cannot be decoded for some reason.- See Also:
-
canDecodeSource
Checks whetherTLcdCADRGModelDecodercan decode the given data. The result istrueif the source name has one of the supported extensions.- Specified by:
canDecodeSourcein interfaceILcdModelDecoder- Parameters:
aSourceName- the name of the file or URL that is to be decoded.- Returns:
trueifTLcdCADRGModelDecodercan decode the data specified by the source name,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:
-