@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdSwissDHMMatrixModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
File | Required | Entry point | Description |
---|---|---|---|
*.mlt | x | x | MMBLT file containing the elevation raster |
*.mbl | x | MMBL file containing the elevation raster |
inputStreamFactory
of this decoder.ILcd2DBoundsIndexedModel
.TLcdSwissDHMMatrixModelDescriptor
.TLcdSwissGridReference
.ILcdRaster
.colorModel
allows to override the default
16-bits index color that is attached to the decoded rasters, since
DHM25 files don't contain any color information.
TLcdSwissDHMMatrixModelDecoder decoder = new TLcdSwissDHMMatrixModelDecoder();
ILcdColorModelFactory factory = new TLcdDTEDColorModelFactory();
ColorModel colorModel = factory.createColorModel();
decoder.setColorModel(colorModel);
ILcdModel model = decoder.decode("elevations.SwissDHMMatrix");
TLcdGeoTIFFModelEncoder
can
create multilevel GeoTIFF files that can replace the original DHM25
files.Modifier and Type | Field and Description |
---|---|
static int |
AVERAGE
The sampling strategy that returns the average value of the corners of
each DHM sample cell.
|
static int |
BILINEAR
The sampling strategy that returns a bilinear interpolation of the values
of the corners of each DHM sample cell.
|
static String |
DISPLAY_NAME |
static int |
MAXIMUM
The sampling strategy that returns the maximum value of the corners of
each DHM sample cell.
|
static int |
MINIMUM
The sampling strategy that returns the minimum value of the corners of
each DHM sample cell.
|
static int |
NORTH_EAST_CORNER
The sampling strategy that returns the North-East corner of each DHM
sample cell.
|
static int |
NORTH_WEST_CORNER
The sampling strategy that returns the North-West corner of each DHM
sample cell.
|
static int |
SOUTH_EAST_CORNER
The sampling strategy that returns the South-East corner of each DHM
sample cell.
|
static int |
SOUTH_WEST_CORNER
The sampling strategy that returns the South-West corner of each DHM
sample cell.
|
Constructor and Description |
---|
TLcdSwissDHMMatrixModelDecoder()
Creates a new TLcdSwissDHMMatrixModelDecoder, with a globally shared
buffer for caching tiles.
|
TLcdSwissDHMMatrixModelDecoder(ILcdBuffer aBuffer)
Creates a new TLcdSwissDHMMatrixModelDecoder with the given buffer.
|
TLcdSwissDHMMatrixModelDecoder(ILcdBuffer aBuffer,
ColorModel aColorModel)
Creates a new TLcdSwissDHMMatrixModelDecoder with the given buffer and
color model.
|
TLcdSwissDHMMatrixModelDecoder(ILcdBuffer aBuffer,
ColorModel aColorModel,
int aDefaultValue)
Creates a new TLcdSwissDHMMatrixModelDecoder.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canDecodeSource(String aSourceAsString)
Checks whether this model decoder can decode the specified data source.
|
ILcdTile |
createTile(String aSourceName,
int aTileWidth,
int aTileHeight)
Decodes the given DHM file as an
ILcdTile . |
ILcdModel |
decode(String aSourceName)
Creates a new model from the given data source.
|
ColorModel |
getColorModel()
Get the color model to be used for the decoded rasters.
|
int |
getDefaultValue()
Returns default raster value for pixels that cannot be resolved.
|
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.
|
ILcdModelReference |
getModelReference()
Returns the reference used for the decoded model.
|
int |
getSampleStrategy() |
static boolean |
isClassTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
boolean |
isSupportGeoidDatums()
Returns whether the geodetic datums of the decoded GeoTIFF model
references may be geoid datums.
|
static void |
setClassTraceOn(boolean aClassTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setColorModel(ColorModel aColorModel)
Set the color model to be used for the decoded rasters.
|
void |
setDefaultValue(int aDefaultValue)
Sets default raster value for pixels that cannot be resolved.
|
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 geodetic datums of the decoded model references may
be geoid datums, instead of the default ellipsoid datums.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
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 static final String DISPLAY_NAME
public TLcdSwissDHMMatrixModelDecoder()
TLcdSharedBuffer.getBufferInstance()
public TLcdSwissDHMMatrixModelDecoder(ILcdBuffer aBuffer)
aBuffer
- The buffer to use for caching tiles.public TLcdSwissDHMMatrixModelDecoder(ILcdBuffer aBuffer, ColorModel aColorModel)
aBuffer
- The buffer to use for caching tiles.aColorModel
- ColorModel to set on the created rasters.public TLcdSwissDHMMatrixModelDecoder(ILcdBuffer aBuffer, ColorModel aColorModel, int aDefaultValue)
aBuffer
- Buffer to use for caching tiles.aColorModel
- ColorModel to set on the created rasters.aDefaultValue
- Default pixel value.public ILcdModelReference getModelReference()
public void setColorModel(ColorModel aColorModel)
aColorModel
- color model to be used for the decoded rasters.public ColorModel getColorModel()
public void setDefaultValue(int aDefaultValue)
aDefaultValue
- Default raster value for pixels that cannot be resolved.public int getDefaultValue()
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 setSampleStrategy(int aSampleStrategy)
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)
public boolean isSupportGeoidDatums()
public String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
ILcdModelDecoder
.public boolean canDecodeSource(String aSourceAsString)
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
aSourceAsString
- the data source to be verified; typically a file name or a URL.true
if this decoder can likely decode the data specified by the source name, false
otherwise.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 ILcdTile createTile(String aSourceName, int aTileWidth, int aTileHeight)
ILcdTile
.public static boolean isClassTraceOn()
true
if tracing is enabled for this class.public static void setClassTraceOn(boolean aClassTraceOn)
true
then all log messages are recorded, otherwise only
the informative, warning and error messages are recorded.aClassTraceOn
- if true then all log messages are recorded,
otherwise only the informative, warning and error messages are recorded.