public class TLcyCompositeAsynchronousPaintHintProvider extends TLcyGenericComposite<ILcyAsynchronousPaintHintProvider> implements ILcyAsynchronousPaintHintProvider, ILcdGXYAsynchronousPaintHintProvider
Composite (see composite design pattern) implementation of ILcyAsynchronousPaintHintProvider
.
It keeps a list of associated ILcyAsynchronousPaintHintProvider
s. When it needs to
provide an asynchronous paint hint, it will delegate to the first suitable paint hint provider.
When creating a new TLcyCompositeAsynchronousPaintHintProvider
using the default
constructor (see TLcyCompositeAsynchronousPaintHintProvider()
), the created instance will
only work on/with the ILcyAsynchronousPaintHintProviders registered
on this composite instance (see addAsynchronousPaintHintProvider(ILcyAsynchronousPaintHintProvider)
and removeAsynchronousPaintHintProvider(ILcyAsynchronousPaintHintProvider)
).
When creating a new TLcyCompositeAsynchronousPaintHintProvider
using the constructor
specifying an ILcyLucyEnv
instance (see TLcyCompositeAsynchronousPaintHintProvider(com.luciad.lucy.ILcyLucyEnv)
, the created instance will
work on the Lucy back-end services. It will use
all registered ILcyAsynchronousPaintHintProvider instances of the
Lucy back-end, adding and/or removing an ILcyAsynchronousPaintHintProvider
will
add/remove the ILcyAsynchronousPaintHintProvider
as service from Lucy, ... .
Retrieving the paint hint 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.
TLcyCompositeAsynchronousPaintHintProvider provider = new TLcyCompositeAsynchronousPaintHintProvider( aLucyEnv );
TLcyAsynchronousPaintHint paintHint = provider.getAsynchronousPaintHint( 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 |
---|
TLcyCompositeAsynchronousPaintHintProvider()
Default constructor.
|
TLcyCompositeAsynchronousPaintHintProvider(ILcyLucyEnv aLucyEnv)
Construct a
TLcyCompositeAsynchronousPaintHintProvider working on the Lucy
back-end |
Modifier and Type | Method and Description |
---|---|
void |
addAsynchronousPaintHintProvider(ILcyAsynchronousPaintHintProvider aPaintHintProvider)
Adds the given
ILcyAsynchronousPaintHintProvider to the list of associated
providers. |
TLcyAsynchronousPaintHint |
getAsynchronousPaintHint(ILcdLayer aLayer)
Loops over all its associated
ILcyAsynchronousPaintHintProvider s to find the first
suitable provider. |
ILcyAsynchronousPaintHintProvider |
getAsynchronousPaintHintProvider(int aIndex)
Returns the layer type provider at the given index.
|
int |
getAsynchronousPaintHintProviderCount()
Returns the number of associated paint hint providers.
|
TLcdGXYAsynchronousPaintHint |
getPaintHint(ILcdGXYAsynchronousLayerWrapper aLayer)
Returns the
TLcdGXYAsynchronousPaintHint corresponding to the layer
aLayer . |
void |
removeAsynchronousPaintHintProvider(ILcyAsynchronousPaintHintProvider aGXYLayerTypeProvider)
Removes the given
ILcyAsynchronousPaintHintProvider from the list of associated
providers. |
add, add, getList, getPriority, iterator, remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public TLcyCompositeAsynchronousPaintHintProvider()
Default constructor. No ILcyAsynchronousPaintHintProvider
s are associated.
The created instance will only work on the ILcyAsynchronousPaintHintProvider
instances registered to it. If you want to use all registered ILcyAsynchronousPaintHintProvider
instances of the Lucy back-end, use TLcyCompositeAsynchronousPaintHintProvider(com.luciad.lucy.ILcyLucyEnv)
instead.
public TLcyCompositeAsynchronousPaintHintProvider(ILcyLucyEnv aLucyEnv)
Construct a TLcyCompositeAsynchronousPaintHintProvider
working on the Lucy
back-end
It will use all ILcyAsynchronousPaintHintProvider
instances registered to the
back-end, and adding and/or removing ILcyAsynchronousPaintHintProvider
s to/from
this TLcyCompositeAsynchronousPaintHintProvider
will respectively add/remove it as
service from the back-end.
If you want to create a TLcyCompositeAsynchronousPaintHintProvider
which does
not use the back-end, use TLcyCompositeAsynchronousPaintHintProvider()
instead.
aLucyEnv
- The Lucy back-end.TLcyCompositeAsynchronousPaintHintProvider()
,
ILcyLucyEnv.addService(Object, int)
,
ILcyLucyEnv.removeService(Object)
public void addAsynchronousPaintHintProvider(ILcyAsynchronousPaintHintProvider aPaintHintProvider)
Adds the given ILcyAsynchronousPaintHintProvider
to the list of associated
providers.
If the constructor specifying an ILcyLucyEnv
is used, the
ILcyAsynchronousPaintHintProvider
will be registered as a service on the Lucy
back-end (see ILcyLucyEnv.addService(Object, int)
). When calling ILcyLucyEnv.getServices(Class)
afterwards, aPaintHintProvider
will only be included in the returned list when the requested class was
ILcyAsynchronousPaintHintProvider.class
.
Note: if you want to remove the registered ILcyAsynchronousPaintHintProvider
afterwards, use removeAsynchronousPaintHintProvider(ILcyAsynchronousPaintHintProvider)
and not ILcyLucyEnv.removeService(Object)
.
aPaintHintProvider
- The provider to add.removeAsynchronousPaintHintProvider(ILcyAsynchronousPaintHintProvider)
,
TLcyGenericComposite.add(Object)
public void removeAsynchronousPaintHintProvider(ILcyAsynchronousPaintHintProvider aGXYLayerTypeProvider)
Removes the given ILcyAsynchronousPaintHintProvider
from the list of associated
providers. If the given provider was never added, nothing will happen.
If the constructor specifying an ILcyLucyEnv
is used, the
ILcyAsynchronousPaintHintProvider
will be removed as service from the Lucy
back-end (see ILcyLucyEnv.removeService(Object)
).
Note: it is only possible to remove ILcyAsynchronousPaintHintProvider
instances which were registered using the addAsynchronousPaintHintProvider(ILcyAsynchronousPaintHintProvider)
method.
aGXYLayerTypeProvider
- The provider to remove.addAsynchronousPaintHintProvider(ILcyAsynchronousPaintHintProvider)
,
TLcyGenericComposite.remove(Object)
public int getAsynchronousPaintHintProviderCount()
getAsynchronousPaintHintProvider(int)
public ILcyAsynchronousPaintHintProvider getAsynchronousPaintHintProvider(int aIndex)
aIndex
- The index of the provider to retrieve. 0 <= aIndex < getAsynchronousPaintHintProviderCount()
getAsynchronousPaintHintProviderCount()
public TLcyAsynchronousPaintHint getAsynchronousPaintHint(ILcdLayer aLayer)
ILcyAsynchronousPaintHintProvider
s to find the first
suitable provider. Suitable means it does not return null.getAsynchronousPaintHint
in interface ILcyAsynchronousPaintHintProvider
aLayer
- The layer to provide the layer type of.TLcyAsynchronousPaintHint
public TLcdGXYAsynchronousPaintHint getPaintHint(ILcdGXYAsynchronousLayerWrapper aLayer)
ILcdGXYAsynchronousPaintHintProvider
Returns the TLcdGXYAsynchronousPaintHint
corresponding to the layer
aLayer
.
Depending on the returned TLcdGXYAsynchronousPaintHint
instances, it might be
useful for implementations of this class to use a caching mechanism. This is however left to
the implementation.
getPaintHint
in interface ILcdGXYAsynchronousPaintHintProvider
aLayer
- The layer to retrieve the paint hint for.