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

public interface ILcdModelDecoder
Decodes 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 Details

    • getDisplayName

      String getDisplayName()
      Returns a short, displayable name for the format that is decoded by this ILcdModelDecoder.
      Returns:
      the displayable name of this ILcdModelDecoder.
    • canDecodeSource

      boolean canDecodeSource(String aSourceName)
      Checks whether this model decoder can decode the specified data source. It is acceptable for this method to return 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.

      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

      default TLcdModelMetadata decodeModelMetadata(String aSourceName) throws IOException
      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

      default TLcdModelMetadata decodeModelMetadata(ILcdDataSource aDataSource) throws IOException
      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

      ILcdModel decode(String aSourceName) throws IOException
      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 - if null is not accepted as value for aSourceName 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 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.
      See Also:
    • canDecodeSource

      default boolean canDecodeSource(ILcdDataSource aDataSource)

      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 a TLcdDataSource.

      The default implementation of this method will check if the given ILcdDataSource is a TLcdDataSource. If not, this method returns false. Otherwise, it delegates the source to the canDecodeSource(String) method.

      Parameters:
      aDataSource - the ILcdModelSource to be verified.
      Returns:
      true if this decoder can likely decode the data specified by aDataSource, false otherwise.
      Since:
      2017.0
      See Also:
    • decodeSource

      default ILcdModel decodeSource(ILcdDataSource aDataSource) throws IOException

      Creates a new model from the given data source.

      By default, this method:

      • Throws a NullPointerException when a null data source is passed.
      • Delegates to the decode(String) method when a TLcdDataSource is passed.
      • Throws an IOException in other case.
      Parameters:
      aDataSource - the ILcdDataSource to be decoded.
      Returns:
      a model containing the decoded data. While null is allowed, implementors are advised to throw an error instead.
      Throws:
      NullPointerException - if null is not accepted as value for aDataSource 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:
    • discoverDataSources

      default List<? extends ILcdDataSource> discoverDataSources(String aPath) throws IOException

      Retrieves a set of model-specific ILcdDataSource instances.

      By default, this method:

      Concrete model decoders might choose to return a set of 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 using ILcdDataSources, where each measurement layer can be referenced to and decoded separately using decodeSource(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 for canDecodeSource(String), it will return a list containing at least a single ILcdDataSource.
      Throws:
      IOException - If this model decoder returns false for canDecodeSource(String) or if any exceptions caused by IO problems or invalid data occur.
      Since:
      2017.0