@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdDMEDModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
File | Required | Entry point | Description |
---|---|---|---|
dmed | x | x | DMED file referring to DTED files |
dted/[we]???/[sn]??.dt[012] | x | x | DTED files containing the actual elevations |
inputStreamFactory
of this decoder.ILcd2DBoundsIndexedModel
.TLcdDMEDModelDescriptor
.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 ILcdMultilevelRaster
) instance.
The object by default contains the DMED level and DTED levels 0, 1, and 2.ILcdRaster
instances that correspond
to DTED levels in turn contain TLcdDTEDTile
s that
correspond to DTED cells and that point to additional information about
the cells (only if checkTilesImmediately
is
true
and for cells that are present).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
DMED files and DTED files don't contain any color information.checkTilesImmediately
property allows to specify whether
the presence of the DTED cells should be checked right away when the
model is decoded. If so, only DTED levels that are present will be
created. Otherwise, all levels will be created, even though their
contents may be empty when the elevation data are accessed.fallBackOnHigherResolution
property is set to
true
). If that fails, the raster will try to find a
corresponding lower resolution DTED file (unless the
fallBackOnLowerResolution
property is set to
false
).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.level0Extension
allows to specify which
extension should be used for DTED level 0.
TLcdDMEDModelDecoder decoder = new TLcdDMEDModelDecoder();
decoder.setIncludeDMEDLevel(false);
decoder.setMinLevel(0);
decoder.setMaxLevel(1);
decoder.setFallBackOnHigherResolution(true);
decoder.setFallBackOnLowerResolution(true);
ILcdModel model = decoder.decode("dmed");
minLevel
and maxLevel
properly can help avoiding unnecessarily looking for DTED cells at
levels that are not available.checkTilesImmediately
to
true
may slow down the initial decoding, especially if many
cells have to be accessed across a slow network connection.fallBackOnHigherResolution
to
true
may introduce a significant overhead, since higher
resolution cells are considerably larger than the lower resolution
counterparts that they are replacing.checkTilesImmediately
is set to
true
.Modifier and Type | Field and Description |
---|---|
static String |
ALTERNATIVE_EXTENSION |
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_EXTENSION |
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 |
---|
TLcdDMEDModelDecoder()
Creates a model decoder to decode DMED files, with a globally shared
buffer for caching tiles.
|
TLcdDMEDModelDecoder(ILcdBuffer aBuffer)
Creates a model decoder to decode DMED files.
|
TLcdDMEDModelDecoder(ILcdBuffer aBuffer,
boolean aShading)
Creates a model decoder to decode DMED files, optionally producing
shaded rasters instead of elevation rasters.
|
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 DMED file.
|
ColorModel |
getColorModel()
Returns the color model that is attached to decoded rasters.
|
String |
getDefaultExtension() |
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.
|
String |
getLevel0Extension() |
int |
getMaxLevel() |
int |
getMinLevel() |
int |
getSampleStrategy() |
boolean |
isApplyGeoidDatums() |
boolean |
isCheckTilesImmediately() |
boolean |
isFallBackOnHigherResolution() |
boolean |
isFallBackOnLowerResolution() |
boolean |
isIncludeDMEDLevel() |
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 |
setBuffer(ILcdBuffer aBuffer)
Sets the buffer in which decoded raster tiles will be cached.
|
void |
setCheckTilesImmediately(boolean aCheckTilesImmediately)
Specifies whether the DMED and DTED tiles should be checked immediately or
lazily.
|
void |
setColorModel(ColorModel aColorModel)
Sets the color model that will be attached to decoded rasters.
|
void |
setFallBackOnHigherResolution(boolean aFallBackOnHigherResolution)
Specifies whether to fall back on higher resolution DTED files if a file
at some level cannot be found.
|
void |
setFallBackOnLowerResolution(boolean aFallBackOnLowerResolution)
Specifies whether to fall back on lower resolution DTED files if a file
at some level cannot be found.
|
void |
setIncludeDMEDLevel(boolean aIncludeDMEDLevel)
Specifies whether the DMED thumbnail level should be included in
decoded multilevel rasters.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory that will be used for creating input streams
given source names.
|
void |
setLevel0Extension(String aLevel0Extension)
Sets the extension for DTED level 0 files.
|
void |
setMaxLevel(int aMaxLevel)
Sets the maximum DTED level that is decoded.
|
void |
setMinLevel(int aMinLevel)
Sets the minimum DTED level that is decoded.
|
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_EXTENSION
public static final String ALTERNATIVE_EXTENSION
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 TLcdDMEDModelDecoder()
TLcdSharedBuffer.getBufferInstance()
public TLcdDMEDModelDecoder(ILcdBuffer aBuffer)
aBuffer
- the buffer in which decoded raster tiles will be cached.public TLcdDMEDModelDecoder(ILcdBuffer aBuffer, boolean aShading)
aBuffer
- the buffer in which decoded raster tiles are cached.aShading
- specifies whether rasters should be shaded.public void setBuffer(ILcdBuffer aBuffer)
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 setIncludeDMEDLevel(boolean aIncludeDMEDLevel)
true
.public boolean isIncludeDMEDLevel()
public void setMinLevel(int aMinLevel)
public int getMinLevel()
public void setMaxLevel(int aMaxLevel)
public int getMaxLevel()
public void setCheckTilesImmediately(boolean aCheckTilesImmediately)
If true
, the decoded multi-level rasters will only contain
the non-empty DMED levels and DTED levels that are actually present. In
addition, the DTED tiles will be instances of TLcdDTEDTile
,
which contain instances of TLcdDTEDModelDescriptor
. If any
DTED files cannot be found, the tiles may fall back on higher or lower
levels.
If false
, the decoded multi-level rasters will contain the
DMED level and all DTED levels (0, 1, and 2). If any DTED files cannot be
found later on, when elevation data are actually requested, the tiles may
still fall back on higher or lower levels.
The default is false
.
public boolean isCheckTilesImmediately()
public void setFallBackOnHigherResolution(boolean aFallBackOnHigherResolution)
false
.public boolean isFallBackOnHigherResolution()
public void setFallBackOnLowerResolution(boolean aFallBackOnLowerResolution)
true
.public boolean isFallBackOnLowerResolution()
public void setLevel0Extension(String aLevel0Extension)
setSampleStrategy(int)
public String getLevel0Extension()
public void setSampleStrategy(int aSampleStrategy)
ILcdRaster
API. The ALcdImage
API explicitly models
DTED data as being point-sampled and will ignore this setting. The
DMED level, if included, however, is always area-sampled, so the
first level in the resulting multilevel image mosaic may have a
different sampling mode than the others.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 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 getDefaultExtension()
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
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 given path name ends with "dmed" or
"dmed.".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
TLcdModelMetadata
will also offer an option to decode the model metadata of the source's
DTED directory, by calling TLcdModelMetadata.discoverDataSeries()
. A call to that method will trigger an
attempt to find the DTED directory next to the given source, and decode its metadata as described in
TLcdDTEDDirectoryModelDecoder.decodeModelMetadata(String)
. Note that the discovery of this DTED directory
directly accesses the file system, instead of using the decoder's inputstream factory. This also means that the
discovery will not succeed for sources that are not located on the file system, such as sources served over HTTP.decodeModelMetadata
in interface ILcdModelDecoder
aSourceName
- the DMED file for which the model metadata will be decoded.IOException
- if the metadata cannot be decoded for some reason.ILcdModelDecoder.canDecodeSource(String)