public class TLcdS57DirectoryModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
ILcdModel
.
This model decoder can be used to decode sets of S-57 cells in case no catalogue (.031) file is
available. Note however that, since there is no information available about the cell bounds
(these
are normally provided by the catalogue file), this decoder does not support on-the-fly loading.
TLcdModelList (catalogue) --> TLcdS57CatalogueModelDescriptor
|
+-- TLcdModelList (one for each level) --> TLcdS57LevelModelDescriptor
|
+-- ILcdModel (one for each ENC cell) --> TLcdS57ModelDescriptor
TLcdS57ModelDecoder
. See the
documentation of the
TLcdS57ModelDecoder
for more information on the structure of the individual cell
models.
TLcdS57CatalogueModelDescriptor
.ILcd2DBoundsIndexedModel
,
the catalogue
and level model lists as well as the individual cell models.TLcdS57ModelDecoder
for more information on domain
objects.
TLcdS57ModelDecoder
.
A catalogue (.031) file is not needed.ILcdInputStreamFactory
that
is set on this decoder.TLcdS57ModelDecoder
for more information on this
topic.
TLcdS57ModelDecoder
TLcdS63ModelDecoder
instance should be provided to the
constructor of this model decoder.TLcdS57ModelDecoder
apply to this decoder
as well.TLcdS57ModelDecoder
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DISPLAY_NAME |
Constructor and Description |
---|
TLcdS57DirectoryModelDecoder() |
TLcdS57DirectoryModelDecoder(TLcdS57ModelDecoder aS57ModelDecoder) |
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.
|
TLcdS57AttributeClassMap |
getAttributeClassMap()
Returns the attribute class map that is used by this model decoder.
|
String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the factory that will create input streams from which models can be
decoded.
|
ILcdS57InvalidCellExceptionHandler |
getInvalidCellExceptionHandler()
Return the cell exception handler to be used when decoding individual cells.
|
TLcdS57ObjectClassMap |
getObjectClassMap()
Returns the object class map that is used by this model decoder.
|
boolean |
isIgnoreInvalidCells()
Returns whether to ignore invalid cells or not.
|
void |
resetExcludedObjectClasses()
Resets the list of object classes that is excluded from decoded models.
|
void |
resetObjectClassSelection()
Resets the list of object classes that is included into decoded models.
|
void |
setAttributeClassMap(TLcdS57AttributeClassMap aAttributeClassMap)
Sets the attribute class map to be used by this model decoder.
|
void |
setExcludedObjectClasses(int[] aExcludedObjectClasses)
Sets the list of object classes that is excluded from decoded models.
|
void |
setIgnoreInvalidCells(boolean aIgnoreInvalidCells)
Specifies whether to ignore invalid cells or not.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the factory that will create input streams from which models can be
decoded.
|
void |
setInvalidCellExceptionHandler(ILcdS57InvalidCellExceptionHandler aHandler)
Sets the cell exception handler to be used when decoding individual cells.
|
void |
setObjectClassMap(TLcdS57ObjectClassMap aObjectClassMap)
Sets the object class map to be used by this model decoder.
|
void |
setObjectClassSelection(int[] aObjectClasses)
Sets the list of object classes that is included into decoded models.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public static final String DEFAULT_DISPLAY_NAME
public TLcdS57DirectoryModelDecoder()
public TLcdS57DirectoryModelDecoder(TLcdS57ModelDecoder aS57ModelDecoder)
public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
setInputStreamFactory
in interface ILcdInputStreamFactoryCapable
aInputStreamFactory
- the factory that creates an input stream
based on a source name.getInputStreamFactory()
public ILcdInputStreamFactory getInputStreamFactory()
getInputStreamFactory
in interface ILcdInputStreamFactoryCapable
setInputStreamFactory(com.luciad.io.ILcdInputStreamFactory)
public void setIgnoreInvalidCells(boolean aIgnoreInvalidCells)
class javadoc
section "Error handling" for details.aIgnoreInvalidCells
- whether to ignore invalid cells or notisIgnoreInvalidCells()
,
setInvalidCellExceptionHandler(ILcdS57InvalidCellExceptionHandler)
public boolean isIgnoreInvalidCells()
true
if invalid cells have to be ignored, false
otherwise.setIgnoreInvalidCells(boolean)
public void setInvalidCellExceptionHandler(ILcdS57InvalidCellExceptionHandler aHandler)
class javadoc
section "Error handling" for details.aHandler
- the exception handler to be used when decoding individual cells.getInvalidCellExceptionHandler()
,
ILcdS57InvalidCellExceptionHandler
,
setIgnoreInvalidCells(boolean)
public ILcdS57InvalidCellExceptionHandler getInvalidCellExceptionHandler()
public void resetObjectClassSelection()
setObjectClassSelection(int[])
public void setObjectClassSelection(int[] aObjectClasses)
aObjectClasses
- the object classes to be included in the decoded
models. They can be listed in any order, and duplicate
entries are allowed.resetObjectClassSelection()
,
setExcludedObjectClasses(int[])
public void resetExcludedObjectClasses()
setExcludedObjectClasses(int[])
public void setExcludedObjectClasses(int[] aExcludedObjectClasses)
aExcludedObjectClasses
- the object classes to be excluded from the
decoded models. They can be listed in any
order, and duplicate entries are allowed.resetExcludedObjectClasses()
,
setObjectClassSelection(int[])
public void setObjectClassMap(TLcdS57ObjectClassMap aObjectClassMap)
aObjectClassMap
- the object class map to be used by this model decoder.public TLcdS57ObjectClassMap getObjectClassMap()
public void setAttributeClassMap(TLcdS57AttributeClassMap aAttributeClassMap)
aAttributeClassMap
- the attribute class map to be used by this model decoder.public TLcdS57AttributeClassMap getAttributeClassMap()
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 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)