Class TLcyLspCompositeLayerFactory
- All Implemented Interfaces:
ILspLayerFactory,Iterable<ILspLayerFactory>
Composite implementation (see composite design pattern) of ILspLayerFactory. It
keeps a list of associated ILspLayerFactorys: one can add and remove other
ILspLayerFactorys to this ILspLayerFactory. When it is asked to create
a layer, it loops over its associated ILspLayerFactorys to find the first one that
returns a valid layer (means canCreateLayers does return true). That layer will then be
returned.
- Since:
- 2012.0
-
Field Summary
Fields inherited from class com.luciad.lucy.util.TLcyGenericComposite
PRIORITY_DEFAULT, PRIORITY_FALLBACK -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.TLcyLspCompositeLayerFactory(ILcyLucyEnv aLucyEnv) Construct aTLcyLspCompositeLayerFactoryworking on the Lucy back-end -
Method Summary
Modifier and TypeMethodDescriptionbooleancanCreateLayers(ILcdModel aModel) Determines whether or not this layer factory is capable of creating layers for the given model.createLayers(ILcdModel aModel) Creates one or moreILspLayerobjects for the given model.Methods inherited from class com.luciad.lucy.util.TLcyGenericComposite
add, add, getList, getPriority, iterator, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TLcyLspCompositeLayerFactory
public TLcyLspCompositeLayerFactory()Default constructor. No
ILspLayerFactorys are associated.The created instance will only work on the
ILspLayerFactoryinstances registered to it. If you want to use all registeredILspLayerFactoryinstances of the Lucy back-end, useTLcyLspCompositeLayerFactory(com.luciad.lucy.ILcyLucyEnv)instead.- See Also:
-
TLcyLspCompositeLayerFactory
Construct a
TLcyLspCompositeLayerFactoryworking on the Lucy back-endIt will use all
ILspLayerFactoryinstances registered to the back-end, and adding and/or removingILspLayerFactorys to/from thisTLcyLspCompositeLayerFactorywill respectively add/remove it as service from the back-end.If you want to create a
TLcyLspCompositeLayerFactorywhich does not use the back-end, useTLcyLspCompositeLayerFactory()instead.- Parameters:
aLucyEnv- The Lucy back-end.- See Also:
-
-
Method Details
-
canCreateLayers
Description copied from interface:ILspLayerFactoryDetermines whether or not this layer factory is capable of creating layers for the given model. If this method returnsfalse, the result of callingILspLayerFactory.createLayers(com.luciad.model.ILcdModel)with the same parameters is undefined.- Specified by:
canCreateLayersin interfaceILspLayerFactory- Parameters:
aModel- the model for which layers should be created- Returns:
trueif this factory can create layers foraModel, orfalseotherwise
-
createLayers
Description copied from interface:ILspLayerFactoryCreates one or moreILspLayerobjects for the given model. Note that this method should not be called ifILspLayerFactory.canCreateLayers(com.luciad.model.ILcdModel)returnsfalse; the results are undefined in this case. In most typical scenarios, this method will only create a singleILspLayerinstances for a given model. In such cases, theALspSingleLayerFactoryprovides a convenient abstract base class for layer factory implementations. An example of when it might be useful to return multiple layers is a model that describes objects moving along a certain trajectory. The layer factory might return one layer which represents the trajectories as polylines, and another which represents the current positions of the objects as point icons.- Specified by:
createLayersin interfaceILspLayerFactory- Parameters:
aModel- the model for which layers should be created- Returns:
- a collection of layers representing the given model
-