Class TLcyGXYCompositeLabelPlacementHintProvider
- All Implemented Interfaces:
ILcyGXYLabelPlacementHintProvider
,Iterable<ILcyGXYLabelPlacementHintProvider>
ILcyGXYLabelPlacementHintProvider
according to the composite
design pattern.
When creating a new TLcyCompositeLabelPlacementHintProvider
using the default
constructor (see TLcyGXYCompositeLabelPlacementHintProvider()
), the created instance will
only work on/with the ILcyGXYLabelPlacementHintProviders registered on this composite
instance (see addLabelPlacementHintProvider(com.luciad.lucy.map.labeling.ILcyGXYLabelPlacementHintProvider)
and removeLabelPlacementHintProvider(com.luciad.lucy.map.labeling.ILcyGXYLabelPlacementHintProvider)
.
When creating a new TLcyCompositeLabelPlacementHintProvider
using the constructor
specifying an ILcyLucyEnv
instance (see TLcyGXYCompositeLabelPlacementHintProvider(ILcyLucyEnv)
,
the created instance will work on the Lucy back-end
services. It will use all registered ILcyGXYLabelPlacementHintProvider instances of the
Lucy back-end, adding and/or removing an ILcyLabelPlacementHintProvider
will
add/remove the ILcyLabelPlacementHintProvider
as service from Lucy, ... .
Creating a TLcyGXYLabelPlacementHint
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.
TLcyGXYCompositeLabelPlacementHintProvider provider = new TLcyGXYCompositeLabelPlacementHintProvider(aLucyEnv);
TLcyGXYLabelPlacementHint hint = provider.getLabelPlacementHint(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;
- Since:
- 10.1
-
Field Summary
Fields inherited from class com.luciad.lucy.util.TLcyGenericComposite
PRIORITY_DEFAULT, PRIORITY_FALLBACK
-
Constructor Summary
ConstructorDescriptionDefault constructor.Construct aTLcyCompositeLabelPlacementHintProvider
working on the Lucy back-end. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLabelPlacementHintProvider
(ILcyGXYLabelPlacementHintProvider aLabelPlacementHintProvider) Adds the givenILcyLabelPlacementHintProvider
to the list of registered label placement hint providers.getLabelPlacementHint
(ILcdGXYLayer aGXYLayer) Returns a label placement hint for the specified layer.getLabelPlacementHintProvider
(int aIndex) Returns theILcyLabelPlacementHintProvider
at indexaIndex
.int
Returns the number of registeredILcyLabelPlacementHintProvider
instances.void
removeLabelPlacementHintProvider
(ILcyGXYLabelPlacementHintProvider aLabelPlacementHintProvider) Removes the givenILcyLabelPlacementHintProvider
from the list of registered label placement hint providers.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
-
TLcyGXYCompositeLabelPlacementHintProvider
public TLcyGXYCompositeLabelPlacementHintProvider()Default constructor.The created instance will only work on the
ILcyLabelPlacementHintProvider
instances registered to it. If you want to use all registeredILcyLabelPlacementHintProvider
instances of the Lucy back-end, useTLcyGXYCompositeLabelPlacementHintProvider(ILcyLucyEnv)
instead.- See Also:
-
TLcyGXYCompositeLabelPlacementHintProvider
Construct aTLcyCompositeLabelPlacementHintProvider
working on the Lucy back-end.It will use all
ILcyLabelPlacementHintProvider
instances registered to the back-end, and adding and/or removingILcyLabelPlacementHintProvider
s to/from thisTLcyCompositeLabelPlacementHintProvider
will respectively add/remove it as service from the back-end.If you want to create a
TLcyCompositeLabelPlacementHintProvider
which does not use the back-end, useTLcyGXYCompositeLabelPlacementHintProvider()
instead.- Parameters:
aLucyEnv
- The Lucy back-end.- See Also:
-
-
Method Details
-
addLabelPlacementHintProvider
public void addLabelPlacementHintProvider(ILcyGXYLabelPlacementHintProvider aLabelPlacementHintProvider) Adds the givenILcyLabelPlacementHintProvider
to the list of registered label placement hint providers.If the constructor specifying an
ILcyLucyEnv
is used, theILcyLabelPlacementHintProvider
will be registered as a service on the Lucy back-end (seeILcyLucyEnv.addService(Object, int)
). When callingILcyLucyEnv.getServices(Class)
afterwards,aLabelPlacementHintProvider
will only be included in the returned list when the requested class wasILcyLabelPlacementHintProvider.class
.Note: if you want to remove the registered
ILcyLabelPlacementHintProvider
afterwards, useremoveLabelPlacementHintProvider(ILcyGXYLabelPlacementHintProvider)
and notILcyLucyEnv.removeService(Object)
.- Parameters:
aLabelPlacementHintProvider
- The label placement hint provider to add. Must not benull
.- See Also:
-
removeLabelPlacementHintProvider
public void removeLabelPlacementHintProvider(ILcyGXYLabelPlacementHintProvider aLabelPlacementHintProvider) Removes the givenILcyLabelPlacementHintProvider
from the list of registered label placement hint providers. Nothing will happen if the given factory was never added before.If the constructor specifying an
ILcyLucyEnv
is used, theILcyLabelPlacementHintProvider
will be removed as service from the Lucy back-end (seeILcyLucyEnv.removeService(Object)
).Note: it is only possible to remove
ILcyLabelPlacementHintProvider
instances which were registered using theaddLabelPlacementHintProvider(ILcyGXYLabelPlacementHintProvider)
method.- Parameters:
aLabelPlacementHintProvider
- The label placement hint provider to remove. Must not benull
.- See Also:
-
getLabelPlacementHint
Description copied from interface:ILcyGXYLabelPlacementHintProvider
Returns a label placement hint for the specified layer. If a label placement hint provider cannot determine a label placement hint for the specified layer,null
should be returned.- Specified by:
getLabelPlacementHint
in interfaceILcyGXYLabelPlacementHintProvider
- Parameters:
aGXYLayer
- the layer for which we wish to retrieve a label placement hint.- Returns:
- an label placement hint if the provider knows it,
null
otherwise. - See Also:
-
getLabelPlacementHintProviderCount
public int getLabelPlacementHintProviderCount()Returns the number of registeredILcyLabelPlacementHintProvider
instances.- Returns:
- the number of registered
ILcyLabelPlacementHintProvider
instances.
-
getLabelPlacementHintProvider
Returns the
ILcyLabelPlacementHintProvider
at indexaIndex
.- Parameters:
aIndex
- The index: 0 <= aIndex <getLabelPlacementHintProviderCount()
- Returns:
- the
ILcyLabelPlacementHintProvider
at indexaIndex
.
-