public class TLcyLspCompositeLayerFactory extends TLcyGenericComposite<ILspLayerFactory> implements 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.
PRIORITY_DEFAULT, PRIORITY_FALLBACK
Constructor and Description |
---|
TLcyLspCompositeLayerFactory()
Default constructor.
|
TLcyLspCompositeLayerFactory(ILcyLucyEnv aLucyEnv)
Construct a
TLcyLspCompositeLayerFactory working on the Lucy back-end |
Modifier and Type | Method and Description |
---|---|
boolean |
canCreateLayers(ILcdModel aModel)
Determines whether or not this layer factory is capable of creating layers
for the given model.
|
Collection<ILspLayer> |
createLayers(ILcdModel aModel)
Creates one or more
ILspLayer objects for the given model. |
add, add, getList, getPriority, iterator, remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
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 registered ILspLayerFactory
instances of
the Lucy back-end, use TLcyLspCompositeLayerFactory(com.luciad.lucy.ILcyLucyEnv)
instead.
public TLcyLspCompositeLayerFactory(ILcyLucyEnv aLucyEnv)
Construct a TLcyLspCompositeLayerFactory
working on the Lucy back-end
It will use all ILspLayerFactory
instances registered to the back-end, and
adding and/or removing ILspLayerFactory
s to/from this
TLcyLspCompositeLayerFactory
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, use TLcyLspCompositeLayerFactory()
instead.
aLucyEnv
- The Lucy back-end.TLcyLspCompositeLayerFactory()
,
ILcyLucyEnv.addService(Object, int)
,
ILcyLucyEnv.removeService(Object)
public boolean canCreateLayers(ILcdModel aModel)
ILspLayerFactory
false
, the result of calling
ILspLayerFactory.createLayers(com.luciad.model.ILcdModel)
with the same parameters
is undefined.canCreateLayers
in interface ILspLayerFactory
aModel
- the model for which layers should be createdtrue
if this factory can create layers for aModel
, or false
otherwisepublic Collection<ILspLayer> createLayers(ILcdModel aModel)
ILspLayerFactory
ILspLayer
objects for the given model.
Note that this method should not be called if ILspLayerFactory.canCreateLayers(com.luciad.model.ILcdModel)
returns false
; the results are undefined in this case.
In most typical scenarios, this method will only create a single ILspLayer
instances
for a given model. In such cases, the ALspSingleLayerFactory
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.createLayers
in interface ILspLayerFactory
aModel
- the model for which layers should be created