public class TLcdCompositeGXYLayerFactory extends Object implements ILcdGXYLayerFactory
ILcdGXYLayerFactory
. Any number of layer
factories can be added to this composite; the
createGXYLayer(com.luciad.model.ILcdModel)
method will delegate to the
first factory in the list whose
createGXYLayer(com.luciad.model.ILcdModel)
does not return null
for the given input model.
You can create a factory with good default behavior like so:
ILcdGXYLayerFactory layerFactory =
new TLcdCompositeGXYLayerFactory(TLcdServiceLoader.getInstance(ILcdGXYLayerFactory.class));
Using TLcdServiceLoader
, it combines all layer factories of all available optional components. It can
therefore provide sensible default behavior for almost all data formats. For example, the optional Ecdis maritime
charts are styled correctly if this option is available. Do keep in mind that the exact behavior may change in future
versions. So if you need full control, or if customization is desired, you're recommended to implement your own layer
factories. Many examples are available as sample code. If you annotate them with
LcdService
and generate the services files using the annotation processor, your
factories take precedence when using the default priority (or more important). Please refer to the developer's guide
for more information on the annotation processor.
When adding layers to a GXY view for client side use (e.g. TLcdMapJPanel
), you will
likely want to wrap the layers with an asynchronous layer. That is not taken care of by the layer factories
discovered using TLcdServiceLoader
as it is undesired for server-side views. Refer to
samples.common.formatsupport.GXYOpenSupport
for examples on decorating layers with asynchronous behavior.
Constructor and Description |
---|
TLcdCompositeGXYLayerFactory()
Creates a new, empty composite layer factory.
|
TLcdCompositeGXYLayerFactory(ILcdGXYLayerFactory... aLayerFactories)
Creates a new composite layer factory containing the supplied delegate factories.
|
TLcdCompositeGXYLayerFactory(Iterable<? extends ILcdGXYLayerFactory> aLayerFactories)
Creates a new composite layer factory that lazily uses the given Iterable to delegate to.
|
Modifier and Type | Method and Description |
---|---|
ILcdGXYLayer |
createGXYLayer(ILcdModel aModel)
Delegates to the first layer factory whose
createGXYLayer() method
does not return null for the given model. |
List<ILcdGXYLayerFactory> |
getGXYLayerFactories()
Returns the list of delegate layer factories contained in this composite.
|
public TLcdCompositeGXYLayerFactory()
layer factory list
.public TLcdCompositeGXYLayerFactory(Iterable<? extends ILcdGXYLayerFactory> aLayerFactories)
aLayerFactories
- a list of layer factoriespublic TLcdCompositeGXYLayerFactory(ILcdGXYLayerFactory... aLayerFactories)
aLayerFactories
- delegate factories to be added to the compositepublic List<ILcdGXYLayerFactory> getGXYLayerFactories()
public ILcdGXYLayer createGXYLayer(ILcdModel aModel)
createGXYLayer()
method
does not return null for the given model.createGXYLayer
in interface ILcdGXYLayerFactory
aModel
- the model for which a layer should be createdTLcdGXYViewJPanel.setGXYLayerFactory(com.luciad.view.gxy.ILcdGXYLayerFactory)