Class TLcdArcInfoASCIIGridModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable
,ILcdModelDecoder
,ILcdStatusSource
This model decoder decodes ESRI ArcInfo ASCII Grid format (*.asc, *.grd) raster files.
Input files
File | Required | Entry point | Description |
---|---|---|---|
*.asc or *.grd | x | x | ESRI ASCII grid format file containing the raster data and meta data |
Model reference
The model reference is obtained from anILcdModelReferenceDecoder
. The default reference decoder set on this
model decoder is based on all model reference decoders annotated with the LcdService
annotation, and can handle
- EPSG references (
<filename>.epsg
): seeTLcdEPSGModelReferenceDecoder
for more info. - WKT references (
<filename>.prj
): seeTLcdWKTModelReferenceDecoder
for more info. - Luciad encoded model references (
<filename>.ref
): seeTLcdModelReferenceDecoder
for more info.
Supported file transfer protocols
- This model decoder supports all transfer protocols that are supported by the
inputStreamFactory
of this decoder.
Model structure
- This model decoder creates a model per ASCII grid format file.
- All models returned by this model decoder implement
ILcd2DBoundsIndexedModel
.
Model descriptor
- All models returned by this model decoder have a
TLcdRasterModelDescriptor
. - The type name of the model descriptor is
TYPE_NAME
.
Model elements
- Each decoded model contains one object: an
ALcdImage
(andILcdRaster
) instance.
Useful settings
- The property
colorModel
provides some control over the color models that are attached to the decoded rasters.
Sample code
ILcdModelDecoder decoder = new TLcdArcInfoASCIIGridModelDecoder();
ILcdModel model = decoder.decode("my_raster.asc");
Thread safety
- The decoding of models is not thread-safe.
- The decoded models are thread-safe for read access.
- Since:
- 2013.1
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreates a newTLcdArcInfoASCIIGridModelDecoder
, with a globally shared buffer for caching tiles.Creates a newTLcdArcInfoASCIIGridModelDecoder
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addStatusListener
(ILcdStatusListener aListener) Registers the given listener so it will receive status events from this source.boolean
canDecodeSource
(String aSourceName) Checks whether this decoder can decode the given data, based on the extension of the file.Creates a new model from the given data source.Returns the default color model for decoded rasters.Returns the default model reference for decoded models.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.Returns the input stream factory that is used.Returns the model reference decoder that is used for creating model references for decoded models.void
removeStatusListener
(ILcdStatusListener aListener) Removes the specified listener so it is no longer notified.void
setColorModel
(ColorModel aColorModel) Sets the default color model for decoded rasters.void
setDefaultModelReference
(ILcdModelReference aDefaultModelReference) Sets the default model reference for decoded models, in case the model reference decoder doesn't provide one.void
setInputStreamFactory
(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory to be used.void
setModelReferenceDecoder
(ILcdModelReferenceDecoder aModelReferenceDecoder) Sets the model reference decoder that will be used for creating model references for decoded models.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
-
Field Details
-
TYPE_NAME
Thetype name
which will be used for the decoded models.- See Also:
-
-
Constructor Details
-
TLcdArcInfoASCIIGridModelDecoder
public TLcdArcInfoASCIIGridModelDecoder()Creates a new
TLcdArcInfoASCIIGridModelDecoder
, with a globally shared buffer for caching tiles.By default, the model decoder will use a default
ILcdInputStreamFactory
andILcdModelReferenceDecoder
. Use the corresponding setters if you want to change this.- See Also:
-
TLcdArcInfoASCIIGridModelDecoder
Creates a new
TLcdArcInfoASCIIGridModelDecoder
.By default, the model decoder will use a default
ILcdInputStreamFactory
andILcdModelReferenceDecoder
. Use the corresponding setters if you want to change this.- Parameters:
aBuffer
- the buffer in which decoded raster tiles will be cached.
-
-
Method Details
-
addStatusListener
Description copied from interface:ILcdStatusSource
Registers the given listener so it will receive status events from this source.
In case you need to register a listener which keeps a reference to an object with a shorter life-time than this status source, you can use a
ALcdWeakStatusListener
instance as status listener.- Specified by:
addStatusListener
in interfaceILcdStatusSource
- Parameters:
aListener
- The listener to be notified when the status has changed.
-
removeStatusListener
Description copied from interface:ILcdStatusSource
Removes the specified listener so it is no longer notified.- Specified by:
removeStatusListener
in interfaceILcdStatusSource
- Parameters:
aListener
- The listener to remove.
-
setInputStreamFactory
Sets the input stream factory to be used.- Specified by:
setInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Parameters:
aInputStreamFactory
- the input stream factory to be used.- Throws:
NullPointerException
- if the specified input stream factory isnull
-
getInputStreamFactory
Description copied from interface:ILcdInputStreamFactoryCapable
Returns the input stream factory that is used.- Specified by:
getInputStreamFactory
in interfaceILcdInputStreamFactoryCapable
- Returns:
- the input stream factory that is used.
-
setModelReferenceDecoder
Sets the model reference decoder that will be used for creating model references for decoded models. When the model reference decoder is not set, or when it cannot create a model reference for a certain source, the
default model reference
will be used.- Parameters:
aModelReferenceDecoder
- the new model reference decoder- See Also:
-
getModelReferenceDecoder
Returns the model reference decoder that is used for creating model references for decoded models.- Returns:
- the model reference decoder
- See Also:
-
setDefaultModelReference
Sets the default model reference for decoded models, in case the model reference decoder doesn't provide one.- Parameters:
aDefaultModelReference
- the new default model reference- See Also:
-
getDefaultModelReference
Returns the default model reference for decoded models.- Returns:
- the default model reference
- See Also:
-
setColorModel
Sets the default color model for decoded rasters.- Parameters:
aColorModel
- the new default color model- See Also:
-
getColorModel
Returns the default color model for decoded rasters.
By default, the
ColorModel
isnull
.- Returns:
- the default color model
- See Also:
-
getDisplayName
Description copied from interface:ILcdModelDecoder
Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.- Specified by:
getDisplayName
in interfaceILcdModelDecoder
- Returns:
- the displayable name of this
ILcdModelDecoder
.
-
canDecodeSource
Checks whether this decoder can decode the given data, based on the extension of the file. The extension of the file name should be "asc" or "grd".
- Specified by:
canDecodeSource
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the data source to be verified; typically a file name or a URL.- Returns:
true
if this decoder can likely decode the data specified by the source name,false
otherwise.- See Also:
-
decode
Description copied from interface:ILcdModelDecoder
Creates a new model from the given data source.- Specified by:
decode
in interfaceILcdModelDecoder
- Parameters:
aSourceName
- the data source to be decoded; typically a file name or a URL.- Returns:
- A model containing the decoded data. While
null
is 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:
-