@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdDTEDModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
File | Required | Entry point | Description |
---|---|---|---|
*.dt[012] | x | x | DTED file corresponding to a single cell of 1 degree by 1 degree |
inputStreamFactory
of this decoder.ILcd2DBoundsIndexedModel
.TLcdDTEDModelDescriptor
.ILcdGeodeticReference
as model references.supportGeoidDatums
is set to
true
, the more accurate geoid datum EGM96. Alternatively,
if applyGeoidDatums
is set to true
, the geoid
height is already added to the elevations of the rasters, and the
geodetic datum is WGS84.ALcdImage
(and ILcdRaster
) instance.ILcdRaster
instance in turn contains
a single TLcdDTEDTile
instance that
corresponds to the DTED cell and that points to additional information
about the cell.ALcdImage
interface. Legacy rasters are assumed to
be area-sampled.colorModel
allows to override the default
16-bits index color that is attached to the decoded rasters, since
DTED files don't contain any color information.sampleStrategy
property. For instance, a
tile value can be a corner value, or the minimum, maximum, or average
of the four corner values. Furthermore, the raster values can be derived
by means of bilinear interpolation. This yields better-looking results,
at a higher computational cost.
TLcdDTEDModelDecoder decoder = new TLcdDTEDModelDecoder();
ILcdModel model = decoder.decode("dted/e011/n45.dt0");
TLcdDMEDModelDecoder
or
TLcdDTEDDirectoryModelDecoder
than to use several individual
DTED rasters decoded with this decoder.Modifier and Type | Field and Description |
---|---|
static int |
AVERAGE
The sampling strategy that returns the average value of the corners of
each DTED sample cell.
|
static int |
BILINEAR
The sampling strategy that returns a bilinear interpolation of the values
of the corners of each DTED sample cell.
|
static String |
DEFAULT_DISPLAY_NAME |
static String[] |
DEFAULT_EXTENSIONS |
static int |
MAXIMUM
The sampling strategy that returns the maximum value of the corners of
each DTED sample cell.
|
static int |
MINIMUM
The sampling strategy that returns the minimum value of the corners of
each DTED sample cell.
|
static int |
NORTH_EAST_CORNER
The sampling strategy that returns the North-East corner of each DTED
sample cell.
|
static int |
NORTH_WEST_CORNER
The sampling strategy that returns the North-West corner of each DTED
sample cell.
|
static String |
SHADING_DISPLAY_NAME |
static int |
SOUTH_EAST_CORNER
The sampling strategy that returns the South-East corner of each DTED
sample cell.
|
static int |
SOUTH_WEST_CORNER
The sampling strategy that returns the South-West corner of each DTED
sample cell.
|
Constructor and Description |
---|
TLcdDTEDModelDecoder()
Creates a model decoder to decode DTED files, with a globally shared
buffer for caching tiles.
|
TLcdDTEDModelDecoder(ILcdBuffer aBuffer)
Creates a model decoder to decode DTED files.
|
TLcdDTEDModelDecoder(ILcdBuffer aBuffer,
boolean aShading)
Creates a model decoder to decode DTED files, optionally producing
shaded rasters instead of elevation rasters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeSource(String aString)
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 DTED file.
|
ColorModel |
getColorModel()
Returns the color model that is attached to decoded rasters.
|
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.
|
int |
getSampleStrategy() |
boolean |
isApplyGeoidDatums() |
boolean |
isSupportGeoidDatums() |
void |
setApplyGeoidDatums(boolean aApplyGeoidDatums)
Specifies whether the geoid heights of the geodetic datum (EGM96) should
be added to the elevation data right away while decoding.
|
void |
setColorModel(ColorModel aColorModel)
Sets the color model that will be attached to decoded rasters.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory that will be used for creating input streams
given source names.
|
void |
setSampleStrategy(int aSampleStrategy)
Sets the sampling strategy for retrieving elevation values.
|
void |
setSupportGeoidDatums(boolean aSupportGeoidDatums)
Specifies whether the decoded geodetic datum of the geodetic reference
should be a geoid datum (EGM96), instead of the default ellipsoid datum
(WGS84 or WGS72).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeSource, discoverDataSources
public static final String DEFAULT_DISPLAY_NAME
public static final String SHADING_DISPLAY_NAME
public static final String[] DEFAULT_EXTENSIONS
public static final int NORTH_WEST_CORNER
public static final int SOUTH_WEST_CORNER
public static final int NORTH_EAST_CORNER
public static final int SOUTH_EAST_CORNER
public static final int MINIMUM
public static final int MAXIMUM
public static final int AVERAGE
public static final int BILINEAR
public TLcdDTEDModelDecoder()
TLcdSharedBuffer.getBufferInstance()
public TLcdDTEDModelDecoder(ILcdBuffer aBuffer)
aBuffer
- the buffer in which decoded raster tiles are cached.public TLcdDTEDModelDecoder(ILcdBuffer aBuffer, boolean aShading)
aBuffer
- the buffer in which decoded raster tiles are cached.aShading
- specifies whether rasters should be shaded.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 setColorModel(ColorModel aColorModel)
aColorModel
- a 16-bit IndexColorModel.public ColorModel getColorModel()
public void setSampleStrategy(int aSampleStrategy)
ILcdRaster
API. The ALcdImage
API explicitly models
DTED data as being point-sampled and will ignore this setting.aSampleStrategy
- one of
NORTH_WEST_CORNER
,
SOUTH_WEST_CORNER
,
NORTH_EAST_CORNER
,
SOUTH_EAST_CORNER
,
MINIMUM
,
MAXIMUM
,
AVERAGE
, or
BILINEAR
.public int getSampleStrategy()
public void setSupportGeoidDatums(boolean aSupportGeoidDatums)
The default value is false
.
public boolean isSupportGeoidDatums()
public void setApplyGeoidDatums(boolean aApplyGeoidDatums)
This is an alternative to setSupportGeoidDatums(boolean)
. It
has precedence if both options are set.
Note that the 0m elevation (sea level) becomes the geoid height, which may be confusing when a raster is displayed with an elevation color model that assigns blue colors to negative elevations.
The default is false
.
public boolean isApplyGeoidDatums()
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public boolean canDecodeSource(String aString)
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
aString
- the data source to be verified; typically a file name or a URL.true
if file name aString has extension "dt0", "dt1",
"dt2", "dted", "avg", "min", or "max".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
decodeModelMetadata
in interface ILcdModelDecoder
aSourceName
- the DTED file for which metadata will be decoded.IOException
- if the metadata cannot be decoded for some reason.ILcdModelDecoder.canDecodeSource(String)