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): seeTLcdEPSGModelReferenceDecoderfor more info. - WKT references (
<filename>.prj): seeTLcdWKTModelReferenceDecoderfor more info. - Luciad encoded model references (
<filename>.ref): seeTLcdModelReferenceDecoderfor more info.
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 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
colorModelprovides 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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newTLcdArcInfoASCIIGridModelDecoder, with a globally shared buffer for caching tiles.Creates a newTLcdArcInfoASCIIGridModelDecoder. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStatusListener(ILcdStatusListener aListener) Registers the given listener so it will receive status events from this source.booleancanDecodeSource(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.voidremoveStatusListener(ILcdStatusListener aListener) Removes the specified listener so it is no longer notified.voidsetColorModel(ColorModel aColorModel) Sets the default color model for decoded rasters.voidsetDefaultModelReference(ILcdModelReference aDefaultModelReference) Sets the default model reference for decoded models, in case the model reference decoder doesn't provide one.voidsetInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory to be used.voidsetModelReferenceDecoder(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, waitMethods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
-
Field Details
-
TYPE_NAME
Thetype namewhich 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
ILcdInputStreamFactoryandILcdModelReferenceDecoder. 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
ILcdInputStreamFactoryandILcdModelReferenceDecoder. 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:ILcdStatusSourceRegisters 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
ALcdWeakStatusListenerinstance as status listener.- Specified by:
addStatusListenerin interfaceILcdStatusSource- Parameters:
aListener- The listener to be notified when the status has changed.
-
removeStatusListener
Description copied from interface:ILcdStatusSourceRemoves the specified listener so it is no longer notified.- Specified by:
removeStatusListenerin interfaceILcdStatusSource- Parameters:
aListener- The listener to remove.
-
setInputStreamFactory
Sets the input stream factory to be used.- Specified by:
setInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Parameters:
aInputStreamFactory- the input stream factory to be used.- Throws:
NullPointerException- if the specified input stream factory isnull
-
getInputStreamFactory
Description copied from interface:ILcdInputStreamFactoryCapableReturns the input stream factory that is used.- Specified by:
getInputStreamFactoryin 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 referencewill 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
ColorModelisnull.- Returns:
- the default color model
- See Also:
-
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.
-
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:
canDecodeSourcein interfaceILcdModelDecoder- Parameters:
aSourceName- the data source to be verified; typically a file name or a URL.- Returns:
trueif this decoder can likely 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:
-