public class TLcyCompositeLayerStyleProvider extends TLcyGenericComposite<ILcyLayerStyleProvider> implements ILcyLayerStyleProvider
A composite implementation of ILcyModelContentTypeProvider
according to the
composite design pattern.
When creating a new TLcyCompositeLayerStyleProvider
using the default
constructor (see TLcyCompositeLayerStyleProvider()
), the created instance will
only work on/with the ILcyLayerStyleProviders registered
on this composite instance (see addLayerStyleProvider(ILcyLayerStyleProvider)
and removeLayerStyleProvider(ILcyLayerStyleProvider)
).
When creating a new TLcyCompositeLayerStyleProvider
using the constructor
specifying an ILcyLucyEnv
instance (see TLcyCompositeLayerStyleProvider(com.luciad.lucy.ILcyLucyEnv)
, the created instance will
work on the Lucy back-end services. It will use
all registered ILcyLayerStyleProvider instances of the
Lucy back-end, adding and/or removing an ILcyLayerStyleProvider
will
add/remove the ILcyLayerStyleProvider
as service from Lucy, ... .
Retrieving the style for an ILcdLayer
using the back-end based implementation
can be done by creating a new instance of this class:
//Create a new instance whenever you need it.
TLcyCompositeLayerStyleProvider provider = new TLcyCompositeLayerStyleProvider( aLucyEnv );
if( provider.canGetStyle( aLayer ) ){
ILcyLayerStyle layerStyle = provider.getStyle( aLayer );
}
//There is no need to keep a reference to the composite instance, you can create a new one
//the next time you would need it
provider = null;
PRIORITY_DEFAULT, PRIORITY_FALLBACK
Constructor and Description |
---|
TLcyCompositeLayerStyleProvider()
Default constructor.
|
TLcyCompositeLayerStyleProvider(ILcyLucyEnv aLucyEnv)
Construct a
TLcyCompositeLayerStyleProvider working on the Lucy back-end |
Modifier and Type | Method and Description |
---|---|
void |
addLayerStyleProvider(ILcyLayerStyleProvider aLayerStyleProvider)
Adds the given
ILcyLayerStyleProvider to the list of registered layer style
providers. |
void |
applyStyle(ILcyLayerStyle aLayerStyle,
ILcdLayer aLayerSFCT)
Applies the given style to the given layer.
|
boolean |
canApplyStyle(ILcyLayerStyle aLayerStyle,
ILcdLayer aLayerSFCT)
Returns true if the provider can apply the given style to the given layer.
|
boolean |
canGetStyle(ILcdLayer aLayer)
Returns true if the provider can return the given layer's style.
|
ILcyLayerStyleProvider |
getLayerStyleProvider(int aIndex)
Returns the
ILcyLayerStyleProvider at index aIndex . |
int |
getLayerStyleProviderCount()
Returns the number of registered
ILcyLayerStyleProvider instances. |
ILcyLayerStyle |
getStyle(ILcdLayer aLayer)
Returns the layer style of the given layer.
|
void |
removeLayerStyleProvider(ILcyLayerStyleProvider aLayerStyleProvider)
Removes the given
ILcyLayerStyleProvider from the list of registered layer
style providers. |
add, add, getList, getPriority, iterator, remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public TLcyCompositeLayerStyleProvider()
Default constructor.
The created instance will only work on the ILcyLayerStyleProvider
instances
registered to it. If you want to use all registered ILcyLayerStyleProvider
instances of the Lucy back-end, use TLcyCompositeLayerStyleProvider(com.luciad.lucy.ILcyLucyEnv)
instead.
public TLcyCompositeLayerStyleProvider(ILcyLucyEnv aLucyEnv)
Construct a TLcyCompositeLayerStyleProvider
working on the Lucy back-end
It will use all ILcyLayerStyleProvider
instances registered to the back-end,
and adding and/or removing ILcyLayerStyleProvider
s to/from this
TLcyCompositeLayerStyleProvider
will respectively add/remove it as service from
the back-end.
If you want to create a TLcyCompositeLayerStyleProvider
which does not use the
back-end, use TLcyCompositeLayerStyleProvider()
instead.
aLucyEnv
- The Lucy back-end.TLcyCompositeLayerStyleProvider()
,
ILcyLucyEnv.addService(Object, int)
,
ILcyLucyEnv.removeService(Object)
public void addLayerStyleProvider(ILcyLayerStyleProvider aLayerStyleProvider)
Adds the given ILcyLayerStyleProvider
to the list of registered layer style
providers.
If the constructor specifying an ILcyLucyEnv
is used, the
ILcyLayerStyleProvider
will be registered as a service on the Lucy back-end (see
ILcyLucyEnv.addService(Object, int)
). When calling ILcyLucyEnv.getServices(Class)
afterwards, aLayerStyleProvider
will only be included in the returned list when the requested class was
ILcyLayerStyleProvider.class
.
Note: if you want to remove the registered ILcyLayerStyleProvider
afterwards, use removeLayerStyleProvider(ILcyLayerStyleProvider)
and not ILcyLucyEnv.removeService(Object)
.
aLayerStyleProvider
- The layer style provider to add. Must not be null
.removeLayerStyleProvider(ILcyLayerStyleProvider)
public void removeLayerStyleProvider(ILcyLayerStyleProvider aLayerStyleProvider)
Removes the given ILcyLayerStyleProvider
from the list of registered layer
style providers. Nothing will happen if the given provider was never added before.
If the constructor specifying an ILcyLucyEnv
is used, the
ILcyLayerStyleProvider
will be removed as service from the Lucy back-end (see
ILcyLucyEnv.removeService(Object)
).
Note: it is only possible to remove ILcyLayerStyleProvider
instances which
were registered using the addLayerStyleProvider(ILcyLayerStyleProvider)
method.
aLayerStyleProvider
- The layer style provider to remove. Must not be null
addLayerStyleProvider(ILcyLayerStyleProvider)
public ILcyLayerStyle getStyle(ILcdLayer aLayer)
ILcyLayerStyleProvider
Returns the layer style of the given layer. As a result, modifying this style after it has been retrieved updates the layer style.
When this ILcyLayerStyleProvider
is unable to retrieve the layer's style,
null
should be returned.
getStyle
in interface ILcyLayerStyleProvider
aLayer
- The layer to get the style from.public boolean canGetStyle(ILcdLayer aLayer)
ILcyLayerStyleProvider
canGetStyle
in interface ILcyLayerStyleProvider
aLayer
- the layer to get the style fromILcyLayerStyleProvider.getStyle(com.luciad.view.ILcdLayer)
public void applyStyle(ILcyLayerStyle aLayerStyle, ILcdLayer aLayerSFCT)
ILcyLayerStyleProvider
applyStyle
in interface ILcyLayerStyleProvider
aLayerStyle
- The style to apply.aLayerSFCT
- The layer to update.public boolean canApplyStyle(ILcyLayerStyle aLayerStyle, ILcdLayer aLayerSFCT)
ILcyLayerStyleProvider
canApplyStyle
in interface ILcyLayerStyleProvider
aLayerStyle
- The style to apply.aLayerSFCT
- The layer to update.ILcyLayerStyleProvider.applyStyle(ILcyLayerStyle, com.luciad.view.ILcdLayer)
public int getLayerStyleProviderCount()
ILcyLayerStyleProvider
instances.ILcyLayerStyleProvider
instances.public ILcyLayerStyleProvider getLayerStyleProvider(int aIndex)
ILcyLayerStyleProvider
at index aIndex
.aIndex
- The index: 0 <= aIndex < getLayerStyleProviderCount()
ILcyLayerStyleProvider
at index aIndex
.