Class TLfnCompositeFormat

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

public class TLfnCompositeFormat extends ALfnFormat
A composite format.

This class is thread-safe.

Since:
10.0
  • Constructor Details

    • TLfnCompositeFormat

      public TLfnCompositeFormat()
      Creates an empty composite factory.
  • Method Details

    • getSLDGXYLayerFactory

      public ILcdSLDGXYLayerFactory getSLDGXYLayerFactory()
      Description copied from class: ALfnFormat

      Gets the SLD GXY layer factory of this format, if any.

      A layer factory is needed when you want to fuse the data as ELfnDataType#IMAGE. The images will be created based on the layer created by the layer factory. When this method returns null, it will not be possible to fuse as IMAGE.

      To remain backwards compatible, the default implementation of this method will fall back to the ALfnFormat.getGXYLayerFactory() when no SLD layer factory is available but a regular ILcdGXYLayerFactory is.

      Typically you do not need to call this method yourself. It is mainly here for LuciadFusion itself. A possible use-case to call this method as API user is if you want to create preview layers of how the fused data will look.

      Overrides:
      getSLDGXYLayerFactory in class ALfnFormat
      Returns:
      a layer factory, possibly null
    • getGXYLayerFactory

      public ILcdGXYLayerFactory getGXYLayerFactory()
      Description copied from class: ALfnFormat

      Gets the GXY layer factory of this format, if any.

      A layer factory is needed when you want to fuse the data as ELfnDataType.IMAGE. The images will be created based on the layer created by the layer factory. When this method returns null, it will not be possible to fuse as IMAGE (see class javadoc).

      This method is no longer used by LuciadFusion. LuciadFusion uses the SLD GXY layer factory method. The recommended way to replace the layer factory of a format is to override the ALfnFormat.getSLDGXYLayerFactory() method.

      Overrides:
      getGXYLayerFactory in class ALfnFormat
      Returns:
      a GXY layer factory, possibly null
    • getHeightProviderFactory

      public ILcdModelHeightProviderFactory getHeightProviderFactory()
      Description copied from class: ALfnFormat

      Gets the height provider factory of this format, if any.

      A height provider factory is needed when you want to fuse the data as ELfnDataType.ELEVATION. The elevation values will be extracted from the model using the created height provider. When this method returns null, it will not be possible to fuse as ELEVATION (see class javadoc).

      Typically you do not need to call this method yourself. It is mainly here for LuciadFusion itself.

      Overrides:
      getHeightProviderFactory in class ALfnFormat
      Returns:
      a height provider factory, possibly null
    • getIdentityProviderFactory

      public ILfnIdentityProviderFactory getIdentityProviderFactory()
      Description copied from class: ALfnFormat

      Gets the (vector) feature ID provider factory of this format, if any. The default implementation returns null.

      An identity provider factory is needed when you want to fuse the data as ELfnDataType.VECTOR. The id's for the features of the model will be retrieved from the identity provider. When this method returns null, it will not be possible to fuse as VECTOR (see class javadoc).

      Overrides:
      getIdentityProviderFactory in class ALfnFormat
      Returns:
      a feature ID provider factory, possibly null
    • getDataSourceModelDecoderFactory

      public ILfnDataSourceModelDecoderFactory getDataSourceModelDecoderFactory()
      Description copied from class: ALfnFormat

      Gets the data source model decoder factory of this format.

      If you override this method, you also need to adjust the ALfnFormat.createDataSource(java.util.List) method (and perhaps also the ALfnFormat.groupAssetPartsForDataSources(java.util.List) method). The default implementations of these 3 methods depend on each other. If you adjust one of those methods, you need to adjust all of them. Consult the class javadoc for more information on how these methods work together.

      Typically you do not need to call this method yourself. It is mainly here for LuciadFusion itself.

      Overrides:
      getDataSourceModelDecoderFactory in class ALfnFormat
      Returns:
      a data source model decoder factory, never null
    • groupAssetPartsForDataSources

      public List<List<ALfnAssetMetadata.AssetPart>> groupAssetPartsForDataSources(List<ALfnAssetMetadata> aAssetMetadatas)
      Description copied from class: ALfnFormat

      This method is responsible for grouping all AssetPart instances into groups. For each of those groups, an ILcdDataSource will be created by calling the ALfnFormat.createDataSource(java.util.List) method.

      The default implementation of this method creates groups containing a single AssetPart.

      An example format which might group several AssetParts together is a format which supports base files and updates for those base files. Typically an update file in itself contains not enough information to allow the model decoder to decode it into an ILcdModel (e.g. an update file which only indicates element X must be removed). Instead, you need to group both the base file and update file into an ILcdDataSource and pass it to the model decoder.This method indicates to the fusion process which AssetParts needs to be grouped together when an ILcdDataSource is created. When this method groups the AssetParts representing the update file(s) together with the ones corresponding to the base files, they will be passed as one group to the ALfnFormat.createDataSource(java.util.List) method which allows to create an ILcdDataSource representing both the base and update.

      If you override this method, you also need to adjust the ALfnFormat.createDataSource(java.util.List) method and provide a custom ALfnFormat.getDataSourceModelDecoderFactory(). The default implementations of these 3 methods depend on each other. If you adjust one of those methods, you need to adjust all of them. Consult the class javadoc for more information on how these methods work together.

      Typically you do not need to call this method yourself. It is mainly here for LuciadFusion itself.

      Overrides:
      groupAssetPartsForDataSources in class ALfnFormat
      Parameters:
      aAssetMetadatas - All the ALfnAssetMetadata instances available in the coverage.
      Returns:
      A List containing groups of AssetPart instances (where a group is represented by a List as well). Each AssetPart group will be passed to the ALfnFormat.createDataSource(java.util.List) method to create an ILcdDataSource.
    • createDataSource

      public ILcdDataSource createDataSource(List<ALfnAssetMetadata.AssetPart> aGroupedAssetParts)
      Description copied from class: ALfnFormat

      This method is responsible for creating an ILcdDataSource which represents all AssetPart instances in aAssetPartsGroup. Which AssetPart instances are contained in aAssetPartsGroup is determined by the result of the ALfnFormat.groupAssetPartsForDataSources(java.util.List) method.

      The default implementation of this method creates ILcdDataSource instances which are accepted by the default ILfnDataSourceModelDecoderFactory. If you used a constructor which accepts a custom ILfnDataSourceModelDecoderFactory, or you have overridden the ALfnFormat.getDataSourceModelDecoderFactory() method, you will have to override this method as well.

      If you override this method, you also need to provide a custom ALfnFormat.getDataSourceModelDecoderFactory() (and possibly also adjust the ALfnFormat.groupAssetPartsForDataSources(java.util.List) method). The default implementations of these 3 methods depend on each other. If you adjust one of those methods, you need to adjust all of them. Consult the class javadoc for more information on how these methods work together.

      Typically you do not need to call this method yourself. It is mainly here for LuciadFusion itself.

      Overrides:
      createDataSource in class ALfnFormat
      Parameters:
      aGroupedAssetParts - A group of AssetPart instances for which an ILcdDataSource must be created. All AssetPart instances should have been created by this format.
      Returns:
      An ILcdDataSource representing all AssetParts contained in aAssetPartsGroup
    • canDecode

      public boolean canDecode(String aSource)
      Deprecated.
      If you want to know whether the model decoder factory can decode the specified source, you can use getDataSourceModelDecoderFactory().canDecodeSource(aSource). If you want to know whether an asset can be created for aSource, you can use the canCreateAsset(String, java.util.List) method.
      Returns whether the model decoder factory of this format can decode the specified source.
      Parameters:
      aSource - the source
      Returns:
      true if the model decoder factory can decoder aSource
    • canCreateAsset

      public boolean canCreateAsset(String aSourceName, List<ALfnAssetMetadata> aOtherAssetMetadatas)
      Description copied from class: ALfnFormat

      Returns false when the format is certain it cannot create an asset for the given source, true otherwise. This method is a quick check which might be called often and should return quickly.

      The list of other asset metadatas that is provided may be used by the format to compute asset information which is not available in aSource itself, but can only be deduced using information from other, already existing assets. A typical example is an update asset for an existing base asset, which is not self-describing but can only be interpreted in combination with the base asset.

      Note that true does not always imply that a model can be created for the source. As an example, assets can be created for S-57 update files, but these update files cannot be decoded to models.

      The default implementation delegates to getDataSourceModelDecoderFactory().canDecodeSource(aSource) and ignores aOtherAssetMetadatas.

      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. Before you call the createAsset methods, you need to call this method.

      Overrides:
      canCreateAsset in class ALfnFormat
      Parameters:
      aSourceName - the source to be tested
      aOtherAssetMetadatas - a list of already existing asset metadatas which may be used by the format to deduce information for the new asset. May be null or empty.
      Returns:
      true if the given source can be decoded to an asset and/or model, false otherwise.
      See Also:
    • 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
    • getName

      public final String getName()

      Warning: this method throws an exception and should not be called. You should find the actual format instead and use that name, and not the name of the composite format.

      Overrides:
      getName in class ALfnFormat
      Returns:
      the name of this format, for example "GeoTIFF"
    • toString

      public String toString()
      Overrides:
      toString in class ALfnFormat
    • getFormats

      public List<ALfnFormat> getFormats()
      Returns a read-only list of the registered engine formats.
      Returns:
      the engine formats
    • addFormat

      public void addFormat(ALfnFormat aFormat)
      Adds an engine format.

      The engine format is added before all other formats, so it will be considered more important than any existing formats.

      If the specified format has a gxy layer factory, it should be able to create a layer for all models that are of its format according to ALfnFormat.isModelOfFormat(com.luciad.model.ILcdModel). Similarly, if the specified format has a height provider factory, it should be able to a create height provider for all models that are of its format.

      Parameters:
      aFormat - the format
    • addFormats

      public void addFormats(List<ALfnFormat> aFormats)
      Adds a list of engine formats.

      The engine formats are added before all other formats, so they will be considered more important than any existing formats.

      Parameters:
      aFormats - a list of formats
      See Also:
    • removeFormat

      public void removeFormat(ALfnFormat aFormat)
      Removes an engine format
      Parameters:
      aFormat - the format
    • removeFormats

      public void removeFormats(Collection<ALfnFormat> aFormats)
      Removes multiple engine formats.
      Parameters:
      aFormats - multiple formats to unregister
    • 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:
    • createAsset

      public ALfnAssetMetadata createAsset(String aSourceName, List<ALfnAssetMetadata> aOtherAssetMetadatas) throws IOException
      Description copied from class: ALfnFormat

      Creates an asset for a given source name.

      The list of other asset metadatas that is provided may be used by the format to compute asset information which is not available in aSourceName itself, but can only be deduced using information from other, already existing assets. A typical example is an update asset for an existing base asset, which is not self-describing but can only be interpreted in combination with the base asset. The source name would point to the update asset, while the base asset must be in the list of other assets. You may for example use ALfnTileStore.query(com.luciad.fusion.tilestore.ELfnResourceType) to get the existing asset metadatas of a Tile Store. It is not possible to decode a stand-alone model from the update asset, it can only exist in combination with its base asset.

      The default implementation will use the model decoder factory to create an ILcdModel for the source, and pass that model to the ALfnFormat.createAsset(com.luciad.model.ILcdModel) method. The default implementation makes no use of the aOtherAssetMetadatas parameter.

      The format 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.

      Overrides:
      createAsset in class ALfnFormat
      Parameters:
      aSourceName - The source name
      aOtherAssetMetadatas - a list of already existing asset metadatas which may be used by the format to deduce information for the new asset. May be null or empty.
      Returns:
      the asset, or null if the source file is not supported
      Throws:
      IOException - any IO exception which occurs in the model decoder during the decoding of the model
      See Also:
    • isAssetSourcesInTileStoreSupported

      public boolean isAssetSourcesInTileStoreSupported(String aFormatName)
      Indicates if a format matching the given name exists and supports asset sources in Tile Store.
      Parameters:
      aFormatName - a format name
      Returns:
      if a format matching the given name exists and supports asset sources in Tile Store
      Since:
      2013.1
    • isAssetOfFormat

      public boolean isAssetOfFormat(ALfnAssetMetadata aAssetMetadata)
      Description copied from class: ALfnFormat

      Returns true when aAssetMetadata was created by this ALfnFormat, false otherwise. This method might be called often, hence need to return quickly.

      The default implementation relies on the result of the ALfnAssetMetadata.getFormat() method. When the format name is not specified in the asset, a (slower) fallback mechanism is used. Therefore it is recommended to make sure the format name is specified in the assets, although it is optional.

      Typically you do not need to call this method yourself. It is mainly here for LuciadFusion itself. In most use-cases where you need access to an ALfnFormat, you can use the TLfnCompositeFormat and work against the composite instance, without having to bother which ALfnFormat corresponded to which asset (part).

      Overrides:
      isAssetOfFormat in class ALfnFormat
      Parameters:
      aAssetMetadata - The asset
      Returns:
      true when aAssetMetadata was created by this AlfnFormat, false otherwise
    • isAssetPartOfFormat

      public boolean isAssetPartOfFormat(ALfnAssetMetadata.AssetPart aAssetPart)
      Description copied from class: ALfnFormat

      Returns true when aAssetPart was created by this ALfnFormat, false otherwise. This method might be called often, hence need to return quickly.

      The default implementation relies on the result of the ALfnAssetMetadata.getFormat() method. When the format name is not specified in the asset part, a (slower) fallback mechanism is used. Therefore it is recommended to make sure the format name is specified in the asset parts, although it is optional.

      Typically you do not need to call this method yourself. It is mainly here for LuciadFusion itself. In most use-cases where you need access to an ALfnFormat, you can use the TLfnCompositeFormat and work against the composite instance, without having to bother which ALfnFormat corresponded to which asset (part).

      Overrides:
      isAssetPartOfFormat in class ALfnFormat
      Parameters:
      aAssetPart - The asset part
      Returns:
      true when aAssetPart was created by this ALfnFormat, false otherwise
    • retrieveFormatOf

      public final ALfnFormat retrieveFormatOf(ALfnAssetMetadata aAssetMetadata)
      Utility method which loops over all registered ALfnFormat instances and returns the first format which returns true for ALfnFormat.isAssetOfFormat(com.luciad.fusion.tilestore.metadata.ALfnAssetMetadata)
      Parameters:
      aAssetMetadata - The asset
      Returns:
      The first of the registered formats which returns true for ALfnFormat.isAssetOfFormat(com.luciad.fusion.tilestore.metadata.ALfnAssetMetadata) for aAssetMetadata, or null when no such format can be found.
      Since:
      2014.0