Class TLcyLspCompositeLayerFactory
- All Implemented Interfaces:
ILspLayerFactory
,Iterable<ILspLayerFactory>
Composite implementation (see composite design pattern) of ILspLayerFactory
. It
keeps a list of associated ILspLayerFactory
s: one can add and remove other
ILspLayerFactory
s to this ILspLayerFactory
. When it is asked to create
a layer, it loops over its associated ILspLayerFactory
s 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
ConstructorDescriptionDefault constructor.TLcyLspCompositeLayerFactory
(ILcyLucyEnv aLucyEnv) Construct aTLcyLspCompositeLayerFactory
working on the Lucy back-end -
Method Summary
Modifier and TypeMethodDescriptionboolean
canCreateLayers
(ILcdModel aModel) Determines whether or not this layer factory is capable of creating layers for the given model.createLayers
(ILcdModel aModel) Creates one or moreILspLayer
objects for the given model.Methods inherited from class com.luciad.lucy.util.TLcyGenericComposite
add, add, getList, getPriority, iterator, remove
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TLcyLspCompositeLayerFactory
public TLcyLspCompositeLayerFactory()Default constructor. No
ILspLayerFactory
s are associated.The created instance will only work on the
ILspLayerFactory
instances registered to it. If you want to use all registeredILspLayerFactory
instances of the Lucy back-end, useTLcyLspCompositeLayerFactory(com.luciad.lucy.ILcyLucyEnv)
instead.- See Also:
-
TLcyLspCompositeLayerFactory
Construct a
TLcyLspCompositeLayerFactory
working on the Lucy back-endIt will use all
ILspLayerFactory
instances registered to the back-end, and adding and/or removingILspLayerFactory
s to/from thisTLcyLspCompositeLayerFactory
will respectively add/remove it as service from the back-end.If you want to create a
TLcyLspCompositeLayerFactory
which does not use the back-end, useTLcyLspCompositeLayerFactory()
instead.- Parameters:
aLucyEnv
- The Lucy back-end.- See Also:
-
-
Method Details
-
canCreateLayers
Description copied from interface:ILspLayerFactory
Determines 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:
canCreateLayers
in interfaceILspLayerFactory
- Parameters:
aModel
- the model for which layers should be created- Returns:
true
if this factory can create layers foraModel
, orfalse
otherwise
-
createLayers
Description copied from interface:ILspLayerFactory
Creates one or moreILspLayer
objects 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 singleILspLayer
instances for a given model. In such cases, theALspSingleLayerFactory
provides 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:
createLayers
in interfaceILspLayerFactory
- Parameters:
aModel
- the model for which layers should be created- Returns:
- a collection of layers representing the given model
-