Class TLfnFormat

java.lang.Object
com.luciad.fusion.engine.format.ALfnFormat
com.luciad.fusion.engine.format.TLfnFormat

public class TLfnFormat extends ALfnFormat
Default implementation of ALfnFormat.

This class provides an implementation of the createAsset() method which provides good defaults for most formats. It supports all format types (image, elevation, vector). It creates assets with the following information:

  • asset id: a random UUID
  • name: the model descriptor's display name
  • type: the provided data type
  • georeference: the georeference of the model. Model tree nodes with different model references are not supported.
  • asset parts: for vector data, a single asset part is created with the bounds of the model. For other data, an asset part is created per raster, each with the bounds of their raster.
For vector data, the scale denominator of the asset parts can be customized by overriding the getScaleDenominator(com.luciad.model.ILcdModel) method (the default returns the unknown scale denominator). For other data, the pixel density of the raster is used.
Since:
2012.0
  • Constructor Details

    • TLfnFormat

      public TLfnFormat(ILcdEarthModelDecoderFactory aModelDecoderFactory, ILcdGXYLayerFactory aGXYLayerFactory, ILcdModelHeightProviderFactory aHeightProviderFactory, ILfnIdentityProviderFactory aFeatureIdProviderFactory, ELfnDataType aType, String aModelDescriptorTypeName, Class<? extends ILcdModelDescriptor>... aModelDescriptorClasses)
      Creates a new engine format.
      Parameters:
      aModelDecoderFactory - the model decoder factory, the name of which will be taken as the format ID
      aGXYLayerFactory - the GXY layer factory
      aHeightProviderFactory - the height provider factory, may be null if not supported
      aFeatureIdProviderFactory - the feature ID provider factory for vector data , may be null if not supported
      aType - the data type, which is ignored since the format auto-detects the type from the model. It is safe to use null here.
      aModelDescriptorTypeName - the type name of the model descriptor or null for any
      aModelDescriptorClasses - the possible classes of the model descriptor or none for any
    • TLfnFormat

      public TLfnFormat(String aFormatId, ILcdEarthModelDecoderFactory aModelDecoderFactory, ILcdGXYLayerFactory aGXYLayerFactory, ILcdModelHeightProviderFactory aHeightProviderFactory, ILfnIdentityProviderFactory aFeatureIdProviderFactory, ELfnDataType aType, String aModelDescriptorTypeName, Class<? extends ILcdModelDescriptor>... aModelDescriptorClasses)
      Creates a new engine format with given parameters.

      If the GXY layer factory is not null, an SLD GXY layer factory adapter will be created which ignores the styling. If you desire a specific styling for your format, you should instead use the other constructor which takes an ILcdSLDGXYLayerFactory.

      Parameters:
      aFormatId - the unique identifier for this format, this should never change
      aModelDecoderFactory - the model decoder factory
      aGXYLayerFactory - the GXY layer factory, which may be null to indicate that assets of this format cannot be fused to IMAGE coverages
      aHeightProviderFactory - the height provider factory, may be null if not supported
      aFeatureIdProviderFactory - the feature ID provider factory for vector data , may be null if not supported
      aType - the data type, which is ignored since the format auto-detects the type from the model. It is safe to use null here.
      aModelDescriptorTypeName - the type name of the model descriptor or null for any
      aModelDescriptorClasses - the possible classes of the model descriptor or none for any
      See Also:
    • TLfnFormat

      public TLfnFormat(String aFormatId, ILfnDataSourceModelDecoderFactory aModelDecoderFactory, ILcdGXYLayerFactory aGXYLayerFactory, ILcdModelHeightProviderFactory aHeightProviderFactory, ILfnIdentityProviderFactory aFeatureIdProviderFactory, ELfnDataType aType, String aModelDescriptorTypeName, Class<? extends ILcdModelDescriptor>... aModelDescriptorClasses)
      Creates a new engine format with given parameters.

      If the GXY layer factory is not null, an SLD GXY layer factory adapter will be created which ignores the styling. If you desire a specific styling for your format, you should instead use the other constructor which takes an ILcdSLDGXYLayerFactory.

      Note that you need to override the ALfnFormat.createDataSource(java.util.List) as well. The default implementation of that method creates ILcdDataSource instances which will not be accepted by the model decoder factory.

      Parameters:
      aFormatId - the unique identifier for this format, this should never change
      aModelDecoderFactory - the model decoder factory
      aGXYLayerFactory - the GXY layer factory, which may be null to indicate that assets of this format cannot be fused to IMAGE coverages
      aHeightProviderFactory - the height provider factory, may be null if not supported
      aFeatureIdProviderFactory - the feature ID provider factory for vector data , may be null if not supported
      aType - the data type, which is ignored since the format auto-detects the type from the model. It is safe to use null here.
      aModelDescriptorTypeName - the type name of the model descriptor or null for any
      aModelDescriptorClasses - the possible classes of the model descriptor or none for any
      Since:
      2014.0
      See Also:
    • TLfnFormat

      public TLfnFormat(String aFormatId, ILcdEarthModelDecoderFactory aModelDecoderFactory, ILcdSLDGXYLayerFactory aSLDGXYLayerFactory, ILcdModelHeightProviderFactory aHeightProviderFactory, ILfnIdentityProviderFactory aFeatureIdProviderFactory, ELfnDataType aType, String aModelDescriptorTypeName, Class<? extends ILcdModelDescriptor>... aModelDescriptorClasses)
      Creates a new engine format.
      Parameters:
      aFormatId - the unique identifier for this format, this should never change
      aModelDecoderFactory - the model decoder factory
      aSLDGXYLayerFactory - the SLD GXY layer factory
      aHeightProviderFactory - the height provider factory, may be null if not supported
      aFeatureIdProviderFactory - the feature ID provider factory for vector data , may be null if not supported
      aType - the data type, which may be null to indicate that the format should figure out the data type from the model on a per model basis. If unsure, use null.
      aModelDescriptorTypeName - the type name of the model descriptor or null for any
      aModelDescriptorClasses - the possible classes of the model descriptor or none for any
    • TLfnFormat

      public TLfnFormat(String aFormatId, ILfnDataSourceModelDecoderFactory aModelDecoderFactory, ILcdSLDGXYLayerFactory aSLDGXYLayerFactory, ILcdModelHeightProviderFactory aHeightProviderFactory, ILfnIdentityProviderFactory aFeatureIdProviderFactory, ELfnDataType aType, String aModelDescriptorTypeName, Class<? extends ILcdModelDescriptor>... aModelDescriptorClasses)
      Creates a new engine format.

      Note that you need to override the ALfnFormat.createDataSource(java.util.List) as well. The default implementation of that method creates ILcdDataSource instances which will not be accepted by the model decoder factory.

      Parameters:
      aFormatId - the unique identifier for this format, this should never change
      aModelDecoderFactory - the model decoder factory
      aSLDGXYLayerFactory - the SLD GXY layer factory
      aHeightProviderFactory - the height provider factory, may be null if not supported
      aFeatureIdProviderFactory - the feature ID provider factory for vector data , may be null if not supported
      aType - the data type, which may be null to indicate that the format should figure out the data type from the model on a per model basis. If unsure, use null.
      aModelDescriptorTypeName - the type name of the model descriptor or null for any
      aModelDescriptorClasses - the possible classes of the model descriptor or none for any
      Since:
      2014.0
    • TLfnFormat

      public TLfnFormat(String aFormatId, ILfnDataSourceModelDecoderFactory aModelDecoderFactory, ILcdGXYLayerFactory aGXYLayerFactory, ILcdSLDGXYLayerFactory aSLDGXYLayerFactory, ILcdModelHeightProviderFactory aHeightProviderFactory, ILfnIdentityProviderFactory aFeatureIdProviderFactory, ELfnDataType aType, String aModelDescriptorTypeName, Class<? extends ILcdModelDescriptor>... aModelDescriptorClasses)
      Creates a new engine format.

      Note that you need to override the ALfnFormat.createDataSource(java.util.List) as well. The default implementation of that method creates ILcdDataSource instances which will not be accepted by the model decoder factory.

      Parameters:
      aFormatId - the unique identifier for this format, this should never change
      aModelDecoderFactory - the model decoder factory
      aGXYLayerFactory - the GXY layer factory. If also an ILcdGXYLayerFactory is supplied, this layer factory is used as fallback. Can be null if aSLDGXYLayerFactory is not null.
      aSLDGXYLayerFactory - the SLD GXY layer factory. Can be null if aGXYLayerFactory is not null.
      aHeightProviderFactory - the height provider factory, may be null if not supported
      aFeatureIdProviderFactory - the feature ID provider factory for vector data , may be null if not supported
      aType - the data type, which may be null to indicate that the format should figure out the data type from the model on a per model basis. If unsure, use null.
      aModelDescriptorTypeName - the type name of the model descriptor or null for any
      aModelDescriptorClasses - the possible classes of the model descriptor or none for any
      Since:
      2017.0
  • Method Details

    • createAsset

      public ALfnAssetMetadata createAsset(ILcdModel aModel)
      Description copied from class: ALfnFormat

      Creates an asset for a given model. This method is typically only called when you already have an ILcdModel available. If the model does not yet exists, the recommended way is to use the ALfnFormat.createAsset(String, java.util.List) method instead.

      The implementation of this method has to set all the properties of the asset, notably:

      This method is typically called by the LuciadFusion API user. In order to fuse data, you need to create and pass ALfnAssetMetadata instances to LuciadFusion. The creation of those assets is done by calling this method.

      Specified by:
      createAsset in class ALfnFormat
      Parameters:
      aModel - a model to create an asset for
      Returns:
      the asset, or null if the model is not supported
      See Also:
    • getScaleDenominator

      protected int getScaleDenominator(ILcdModel aModel)
      Returns the scale denominator for the compilation (native) scale for the given model. The default implementation estimates the scale based on the model's bounds. It uses a world scale of 1:50000000 for model bounds that span the whole world. Other model bounds are estimated relative to this world scale.

      A model with bounds covering the whole world will for example have an estimated scale of 1:50000000. A model with bounds covering only a quarter of the world will have an estimated scale of 1:25000000.

      The default implementation can only provide an estimate, because there is generally no information available in the model to do better. Specific formats, such as S-57 and DGN, may rely on specific information available in the model, resulting in an accurate scale denominator.

      Parameters:
      aModel - the model for which to determine the compilation scale denominator
      Returns:
      the compilation scale denominator of the given model
    • isModelOfFormat

      public boolean isModelOfFormat(ILcdModel aModel)
      Description copied from class: ALfnFormat
      Checks whether a model is of this format.
      Specified by:
      isModelOfFormat in class ALfnFormat
      Parameters:
      aModel - the model
      Returns:
      true if the given model is of this format, false otherwise