Class TLspCompositeLayerFactory

java.lang.Object
com.luciad.view.lightspeed.layer.TLspCompositeLayerFactory
All Implemented Interfaces:
ILspLayerFactory

public class TLspCompositeLayerFactory extends Object implements ILspLayerFactory
Composite implementation of ILspLayerFactory. Any number of layer factories can be added to this composite; the createLayers(com.luciad.model.ILcdModel) method will delegate to the first factory in the list whose ILspLayerFactory.canCreateLayers(com.luciad.model.ILcdModel) returns true for the given input model.

Example usage:

To create a composite instance which uses all default available ILspLayerFactory instances, you can use:
    ILspLayerFactory layerFactory =
        new TLspCompositeLayerFactory(TLcdServiceLoader.getInstance(ILspLayerFactory.class));
This will use all layer factories annotated with the @LcdService annotation.
Since:
2012.0
  • Constructor Details

    • TLspCompositeLayerFactory

      public TLspCompositeLayerFactory()
      Creates a new, empty composite layer factory. This factory will not be able to create layers until delegate layer factories are added to the layer factory list.
    • TLspCompositeLayerFactory

      public TLspCompositeLayerFactory(Iterable<? extends ILspLayerFactory> aLayerFactories)
      Creates a new composite layer factory that lazily uses the given Iterable to delegate to.
      Parameters:
      aLayerFactories - delegate factories to be added to the composite
    • TLspCompositeLayerFactory

      public TLspCompositeLayerFactory(ILspLayerFactory... aLayerFactories)
      Creates a new composite layer factory containing the supplied delegate factories.
      Parameters:
      aLayerFactories - delegate factories to be added to the composite
  • Method Details

    • getLayerFactories

      public List<ILspLayerFactory> getLayerFactories()
      Returns the list of delegate layer factories contained in this composite. If the composite does not use an Iterable, delegates can be added or removed by modifying this list.
      Returns:
      the list of delegate layer factories in this composite
    • createLayers

      public Collection<ILspLayer> createLayers(ILcdModel aModel)
      Delegates to the first layer factory whose canCreateLayer() method returns true for the given model.
      Specified by:
      createLayers in interface ILspLayerFactory
      Parameters:
      aModel - the model for which a layer should be created
      Returns:
      a layer created by the selected delegate factory
    • canCreateLayers

      public boolean canCreateLayers(ILcdModel aModel)
      Returns true if there is at least one delegate factory whose canCreateLayer() method also returns true for the given model.
      Specified by:
      canCreateLayers in interface ILspLayerFactory
      Parameters:
      aModel - the model for which a layer should be created
      Returns:
      true if at least one of the delegate factories supports the given model