public class TLcyCompositeGXYLayerTypeProvider extends TLcyGenericComposite<ILcyGXYLayerTypeProvider> implements ILcyGXYLayerTypeProvider
Composite (see composite design pattern) implementation of ILcyGXYLayerTypeProvider
.
It keeps a list of associated ILcyGXYLayerTypeProvider
s. When it needs to provide a
layer type, it will delegate to the first suitable layer type provider.
When creating a new TLcyCompositeGXYLayerTypeProvider
using the default
constructor (see TLcyCompositeGXYLayerTypeProvider()
), the created instance will
only work on/with the ILcyGXYLayerTypeProviders registered
on this composite instance (see addGXYLayerTypeProvider(ILcyGXYLayerTypeProvider)
and removeGXYLayerTypeProvider(ILcyGXYLayerTypeProvider)
).
When creating a new TLcyCompositeGXYLayerTypeProvider
using the constructor
specifying an ILcyLucyEnv
instance (see TLcyCompositeGXYLayerTypeProvider(com.luciad.lucy.ILcyLucyEnv)
, the created instance will
work on the Lucy back-end services. It will use
all registered ILcyGXYLayerTypeProvider instances of the
Lucy back-end, adding and/or removing an ILcyGXYLayerTypeProvider
will
add/remove the ILcyGXYLayerTypeProvider
as service from Lucy, ... .
Retrieving the layer type for an ILcdGXYLayer
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.
TLcyCompositeGXYLayerTypeProvider provider = new TLcyCompositeGXYLayerTypeProvider( aLucyEnv );
int layerType = provider.getGXYLayerType( aGXYLayer );
//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
BACKGROUND, EDITABLE, REALTIME, UNKNOWN
Constructor and Description |
---|
TLcyCompositeGXYLayerTypeProvider()
Default constructor.
|
TLcyCompositeGXYLayerTypeProvider(ILcyLucyEnv aLucyEnv)
Construct a
TLcyCompositeGXYLayerTypeProvider working on the Lucy back-end |
Modifier and Type | Method and Description |
---|---|
void |
addGXYLayerTypeProvider(ILcyGXYLayerTypeProvider aGXYLayerTypeProvider)
Adds the given
ILcyGXYLayerTypeProvider to the list of associated providers. |
int |
getGXYLayerType(ILcdGXYLayer aGXYLayer)
Loops over all its associated
ILcyGXYLayerTypeProvider s to find the first suitable
provider. |
ILcyGXYLayerTypeProvider |
getGXYLayerTypeProvider(int aIndex)
Returns the layer type provider at the given index.
|
int |
getGXYLayerTypeProviderCount()
Returns the number of associated layer type providers.
|
void |
removeGXYLayerTypeProvider(ILcyGXYLayerTypeProvider aGXYLayerTypeProvider)
Removes the given
ILcyGXYLayerTypeProvider 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 TLcyCompositeGXYLayerTypeProvider()
Default constructor. No ILcyGXYLayerTypeProvider
s are associated.
The created instance will only work on the ILcyGXYLayerTypeProvider
instances
registered to it. If you want to use all registered ILcyGXYLayerTypeProvider
instances of the Lucy back-end, use TLcyCompositeGXYLayerTypeProvider(com.luciad.lucy.ILcyLucyEnv)
instead.
public TLcyCompositeGXYLayerTypeProvider(ILcyLucyEnv aLucyEnv)
Construct a TLcyCompositeGXYLayerTypeProvider
working on the Lucy back-end
It will use all ILcyGXYLayerTypeProvider
instances registered to the back-end,
and adding and/or removing ILcyGXYLayerTypeProvider
s to/from this
TLcyCompositeGXYLayerTypeProvider
will respectively add/remove it as service from
the back-end.
If you want to create a TLcyCompositeGXYLayerTypeProvider
which does not
use the back-end, use TLcyCompositeGXYLayerTypeProvider()
instead.
aLucyEnv
- The Lucy back-end.TLcyCompositeGXYLayerTypeProvider()
,
ILcyLucyEnv.addService(Object, int)
,
ILcyLucyEnv.removeService(Object)
public void addGXYLayerTypeProvider(ILcyGXYLayerTypeProvider aGXYLayerTypeProvider)
Adds the given ILcyGXYLayerTypeProvider
to the list of associated providers.
If the constructor specifying an ILcyLucyEnv
is used, the
ILcyGXYLayerTypeProvider
will be registered as a service on the Lucy back-end
(see ILcyLucyEnv.addService(Object, int)
). When calling ILcyLucyEnv.getServices(Class)
afterwards, aGXYLayerTypeProvider
will only be included in the returned list when the requested class was
ILcyGXYLayerTypeProvider.class
.
Note: if you want to remove the registered ILcyGXYLayerTypeProvider
afterwards, use removeGXYLayerTypeProvider(ILcyGXYLayerTypeProvider)
and not
ILcyLucyEnv.removeService(Object)
.
aGXYLayerTypeProvider
- The provider to add.removeGXYLayerTypeProvider(ILcyGXYLayerTypeProvider)
public void removeGXYLayerTypeProvider(ILcyGXYLayerTypeProvider aGXYLayerTypeProvider)
Removes the given ILcyGXYLayerTypeProvider
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
ILcyGXYLayerTypeProvider
will be removed as service from the Lucy back-end (see
ILcyLucyEnv.removeService(Object)
).
Note: it is only possible to remove ILcyGXYLayerTypeProvider
instances
which were registered using the addGXYLayerTypeProvider(ILcyGXYLayerTypeProvider)
method.
aGXYLayerTypeProvider
- The provider to remove.addGXYLayerTypeProvider(ILcyGXYLayerTypeProvider)
public int getGXYLayerTypeProviderCount()
getGXYLayerTypeProvider(int)
public ILcyGXYLayerTypeProvider getGXYLayerTypeProvider(int aIndex)
aIndex
- The index of the provider to retrieve. 0 <= aIndex < getGXYLayerTypeProviderCount()
getGXYLayerTypeProviderCount()
public int getGXYLayerType(ILcdGXYLayer aGXYLayer)
ILcyGXYLayerTypeProvider
s to find the first suitable
provider. Suitable means it does not return ILcyGXYLayerType.UNKNOWN. Providing the layer type
is delegated to the first suitable provider.getGXYLayerType
in interface ILcyGXYLayerTypeProvider
aGXYLayer
- The layer to provide the layer type of.ILcyGXYLayerType