Interface ILcdModelDecoder
- All Known Subinterfaces:
ILcdARINCDecoder
,ILcdDAFIFDecoder
,ILcdDAFIFMultiModelDecoder
,ILcdDataSourceModelDecoder
,ILcdDGNModelDecoder
,ILcdDWGModelDecoder
- All Known Implementing Classes:
ALcdDAFIFAerodromeDecoder
,ALcdDAFIFAirspaceDecoder
,ALcdDAFIFDecoder
,ALcdDAFIFMultiModelDecoder
,ALcdDAFIFSingleModelDecoder
,ALcdDAFIFTModelDecoder
,ALcdXMLModelDecoder
,TLcdAIXM51ModelDecoder
,TLcdAIXMModelDecoder
,TLcdArcInfoASCIIGridModelDecoder
,TLcdARINCDecoder
,TLcdARINCModelDecoder
,TLcdASDIModelDecoder
,TLcdASTERIXLiveModelDecoder
,TLcdASTERIXModelDecoder
,TLcdBCIRasterModelDecoder
,TLcdBILModelDecoder
,TLcdBingMapsModelDecoder
,TLcdBinzModelDecoder
,TLcdBUFRModelDecoder
,TLcdCADRGDirectoryModelDecoder
,TLcdCADRGModelDecoder
,TLcdCGMModelDecoder
,TLcdCompositeModelDecoder
,TLcdCoverageModelDecoder
,TLcdCSVModelDecoder
,TLcdDAFIFAerodromeDecoder
,TLcdDAFIFAerodromeNavaidDecoder
,TLcdDAFIFAirspaceDecoder
,TLcdDAFIFATSRouteDecoder
,TLcdDAFIFHelipadDecoder
,TLcdDAFIFHeliportDecoder
,TLcdDAFIFHoldingDecoder
,TLcdDAFIFILSDecoder
,TLcdDAFIFIndependentAerodromeNavaidDecoder
,TLcdDAFIFIndependentATSRouteDecoder
,TLcdDAFIFIndependentHelipadDecoder
,TLcdDAFIFIndependentHoldingDecoder
,TLcdDAFIFIndependentILSDecoder
,TLcdDAFIFIndependentProcedureDecoder
,TLcdDAFIFIndependentRunwayDecoder
,TLcdDAFIFMilitaryTrainingRouteDecoder
,TLcdDAFIFModelDecoder
,TLcdDAFIFNavaidDecoder
,TLcdDAFIFOrtcaDecoder
,TLcdDAFIFParachuteJumpAreaDecoder
,TLcdDAFIFProcedureDecoder
,TLcdDAFIFRefuelingTrackDecoder
,TLcdDAFIFRunwayDecoder
,TLcdDAFIFSpecialUseAirspaceDecoder
,TLcdDAFIFTAerodromeDecoder
,TLcdDAFIFTAerodromeNavaidDecoder
,TLcdDAFIFTAirspaceDecoder
,TLcdDAFIFTATSRouteDecoder
,TLcdDAFIFTHelipadDecoder
,TLcdDAFIFTHeliportDecoder
,TLcdDAFIFTHoldingDecoder
,TLcdDAFIFTILSDecoder
,TLcdDAFIFTIndependentAerodromeNavaidDecoder
,TLcdDAFIFTIndependentATSRouteDecoder
,TLcdDAFIFTIndependentHelipadDecoder
,TLcdDAFIFTIndependentHoldingDecoder
,TLcdDAFIFTIndependentILSDecoder
,TLcdDAFIFTIndependentProcedureDecoder
,TLcdDAFIFTIndependentRunwayDecoder
,TLcdDAFIFTMilitaryTrainingRouteDecoder
,TLcdDAFIFTMinimumSectorAltitudeDecoder
,TLcdDAFIFTNavaidDecoder
,TLcdDAFIFTOrtcaDecoder
,TLcdDAFIFTParachuteJumpAreaDecoder
,TLcdDAFIFTPrecisionApproachPathDecoder
,TLcdDAFIFTProcedureDecoder
,TLcdDAFIFTRefuelingTrackDecoder
,TLcdDAFIFTRunwayDecoder
,TLcdDAFIFTSpecialUseAirspaceDecoder
,TLcdDAFIFTVFRRouteDecoder
,TLcdDAFIFTWayPointDecoder
,TLcdDAFIFVFRRouteDecoder
,TLcdDAFIFWayPointDecoder
,TLcdDatabaseModelDecoder
,TLcdDB2SpatialModelDecoder
,TLcdDEMModelDecoder
,TLcdDGNModelDecoder
,TLcdDGNModelListDecoder
,TLcdDIMAPModelDecoder
,TLcdDMEDModelDecoder
,TLcdDTEDDirectoryModelDecoder
,TLcdDTEDModelDecoder
,TLcdDWGModelDecoder
,TLcdDWGModelListDecoder
,TLcdE57ModelDecoder
,TLcdEarthAssetModelCodec
,TLcdEarthRepositoryModelDecoder
,TLcdEarthTerrainRepositoryModelDecoder
,TLcdECRGModelDecoder
,TLcdECWModelDecoder
,TLcdETOPOModelDecoder
,TLcdGDALModelDecoder
,TLcdGDFModelDecoder
,TLcdGDFMultiLevelTiledModelDecoder
,TLcdGEEModelDecoder
,TLcdGeoJsonModelDecoder
,TLcdGeoPackageModelDecoder
,TLcdGeospatialPDFModelDecoder
,TLcdGeoSPOTModelDecoder
,TLcdGeoTIFFModelDecoder
,TLcdGML2ModelDecoder
,TLcdGML31ModelDecoder
,TLcdGML32ModelDecoder
,TLcdGML3ModelDecoder
,TLcdGMLApplicationModelDecoder
,TLcdGMLModelDecoder
,TLcdGRIB1ModelDecoder
,TLcdGRIB2ModelDecoder
,TLcdGRIBBulletinModelDecoder
,TLcdGRIBModelDecoder
,TLcdIFCModelDecoder
,TLcdIGRFModelDecoder
,TLcdInformixGeodeticModelDecoder
,TLcdInformixSpatialModelDecoder
,TLcdJAIRasterModelDecoder
,TLcdJPEG2000ModelDecoder
,TLcdJPIPModelDecoder
,TLcdKML22ModelDecoder
,TLcdLASModelDecoder
,TLcdLRDBModelDecoder
,TLcdLVDBModelDecoder
,TLcdMAPModelDecoder
,TLcdMBTilesModelDecoder
,TLcdMGCPModelDecoder
,TLcdMIFModelDecoder
,TLcdMrSIDModelDecoder
,TLcdMSSQLModelDecoder
,TLcdMultilevelRegularTiledModelDecoder
,TLcdMultilevelTiledModelDecoder
,TLcdNetCDFModelDecoder
,TLcdNITFModelDecoder
,TLcdNVGModelDecoder
,TLcdOBJModelDecoder
,TLcdOGC3DTilesModelDecoder
,TLcdOGCWMSProxyModelDecoder
,TLcdOpenFlightModelDecoder
,TLcdOracleGeoRasterModelDecoder
,TLcdOracleSpatialModelDecoder
,TLcdOSGBModelDecoder
,TLcdPegasusModelDecoder
,TLcdPointCloudModelDecoder
,TLcdPOLModelDecoder
,TLcdPostGISModelDecoder
,TLcdRasterModelDecoder
,TLcdRevitModelDecoder
,TLcdS57CatalogueModelDecoder
,TLcdS57DirectoryModelDecoder
,TLcdS57ModelDecoder
,TLcdS57UnifiedModelDecoder
,TLcdS63CatalogueModelDecoder
,TLcdS63ModelDecoder
,TLcdS63UnifiedModelDecoder
,TLcdSHPModelDecoder
,TLcdSHPModelDecoder2
,TLcdSpatiaLiteModelDecoder
,TLcdSVGModelDecoder
,TLcdSwissDHMMatrixModelDecoder
,TLcdTABRasterModelDecoder
,TLcdTarModelListDecoder
,TLcdTFWRasterModelDecoder
,TLcdUSRPModelDecoder
,TLcdVPFModelDecoder
,TLcdWCSCoverageModelDecoder
,TLcdWFSModelDecoderDecorator
,TLcdWMMModelDecoder
,TLcdWMTSModelDecoder
,TLcdZipModelListDecoder
,TLfnTileStoreModelDecoder
ILcdModel
instances from files
or from other data sources
. It also allows
retrieving model metadata
without decoding the model itself.
The supported data sources and the type of models (implemented interfaces, structure, contents, ...) that are
created are defined by the actual implementations of this interface.
Each model decoder has a displayable name that identifies the data format, decoded by this decoder.
See the Supporting Custom Formats documentation for some examples on how to implement this interface.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canDecodeSource
(ILcdDataSource aDataSource) Checks whether this model decoder can decode the data source(s), identified by the passedILcdDataSource
.boolean
canDecodeSource
(String aSourceName) Checks whether this model decoder can decode the specified data source.Creates a new model from the given data source.default TLcdModelMetadata
decodeModelMetadata
(ILcdDataSource aDataSource) Decodes metadata for the specified data source.default TLcdModelMetadata
decodeModelMetadata
(String aSourceName) Decodes metadata for the specified data source.default ILcdModel
decodeSource
(ILcdDataSource aDataSource) Creates a new model from the given data source.default List
<? extends ILcdDataSource> discoverDataSources
(String aPath) Retrieves a set of model-specificILcdDataSource
instances.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.
-
Method Details
-
getDisplayName
String getDisplayName()Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder
.- Returns:
- the displayable name of this
ILcdModelDecoder
.
-
canDecodeSource
Checks whether this model decoder can decode the specified data source. It is acceptable for this method to returntrue
for a source name whiledecode
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.
- 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:
-
decodeModelMetadata
Decodes metadata for the specified data source. By default, this decodes the model and returns the model metadata found on that model. Implementations can override this method to speed up the retrieval.- Parameters:
aSourceName
- the data source to be decoded; typically a file name or a URL.- Returns:
- the model metadata for the data source, never null.
- Throws:
IOException
- if the metadata cannot be decoded for some reason.- Since:
- 2018.0
- See Also:
-
decodeModelMetadata
Decodes metadata for the specified data source. By default, this decodes the model and returns the model metadata found on that model. Implementations can override this method to speed up the retrieval.- Parameters:
aDataSource
- the data source to be decoded.- Returns:
- the model metadata for the data source, never null.
- Throws:
IOException
- if the metadata cannot be decoded for some reason.- Since:
- 2018.0
- See Also:
-
decode
Creates a new model from the given data source.- 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:
NullPointerException
- ifnull
is not accepted as value foraSourceName
by this model decoder.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 anInterruptedIOException
. This same exception can also be used if the decoder shows UI to the user, and the user cancels the decoding through the UI.- See Also:
-
canDecodeSource
Checks whether this model decoder can decode the data source(s), identified by the passed
ILcdDataSource
.For performance reasons, we strongly recommend that this will only be a simple test. For example: check the instance class of
aDataSource
, or check the file extension if it is aTLcdDataSource
.The default implementation of this method will check if the given
ILcdDataSource
is aTLcdDataSource
. If not, this method returns false. Otherwise, it delegates the source to thecanDecodeSource(String)
method.- Parameters:
aDataSource
- theILcdModelSource
to be verified.- Returns:
true
if this decoder can likely decode the data specified byaDataSource
,false
otherwise.- Since:
- 2017.0
- See Also:
-
decodeSource
Creates a new model from the given data source.
By default, this method:
- Throws a
NullPointerException
when anull
data source is passed. - Delegates to the
decode(String)
method when aTLcdDataSource
is passed. - Throws an IOException in other case.
- Parameters:
aDataSource
- theILcdDataSource
to be decoded.- Returns:
- a model containing the decoded data. While
null
is allowed, implementors are advised to throw an error instead. - Throws:
NullPointerException
- ifnull
is not accepted as value foraDataSource
by this model decoder.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 decodeSource(ILcdDataSource aDataSource) throws IOException { try { // Perform decoding ... } catch (RuntimeException e) { throw new IOException(e); } }
- Since:
- 2017.0
- See Also:
- Throws a
-
discoverDataSources
Retrieves a set of model-specific
ILcdDataSource
instances.By default, this method:
- returns a list containing at least a single
TLcdDataSource
that contains a reference to the supplied path, whencanDecodeSource(String)
returnstrue
for the supplied path. - throws an
IOException
whencanDecodeSource(String)
returnsfalse
for the supplied path.
ILcdDataSource
, for instance, if the path references a collection of data sources.An example where this is useful is for container formats, such as NetCDF. A NetCDF file can contain multiple measurement layers. This
discoverDataSources(String)
method allows you to distinguish between them usingILcdDataSource
s, where each measurement layer can be referenced to and decoded separately usingdecodeSource(ILcdDataSource)
- Parameters:
aPath
- A path to the data source to be decoded; typically a file path or a URL.- Returns:
- If this model decoder returns
true
forcanDecodeSource(String)
, it will return a list containing at least a singleILcdDataSource
. - Throws:
IOException
- If this model decoder returnsfalse
forcanDecodeSource(String)
or if any exceptions caused by IO problems or invalid data occur.- Since:
- 2017.0
- returns a list containing at least a single
-