Class TLcdGXYLabelPlacer
- All Implemented Interfaces:
ILcdCloneable
,ILcdGXYViewLabelPlacer
,Cloneable
ILcdGXYViewLabelPlacer
places the labels using a
given algorithm. This label placer executes the label placing and the labeling algorithm
on the EventDispatch thread.
Note: When using this label placer in combination with asynchronous painting, it passes the wrapped layer to the labeling algorithm, and not the asynchronous layer wrapper.
- Since:
- 10.1
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.luciad.view.gxy.labeling.ILcdGXYViewLabelPlacer
ILcdGXYViewLabelPlacer.ViewLabelPlacerCallback
-
Constructor Summary
ConstructorDescriptionCreate a new label placer with a labeling algorithm that delegates to the appropriate layer'slabeling algorithm
.TLcdGXYLabelPlacer
(ILcdGXYLabelingAlgorithm aLabelingAlgorithm) Create a new label placer based on the given algorithm. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addStatusListener
(ILcdStatusListener aListener) Adds the given status listener to this view label placer.clone()
MakesObject.clone()
public.Returns the label conflict checker used when placing labels.Returns the used labeling algorithm.Returns the usedILcdGXYLabelObstacleProvider
.void
placeLabels
(Graphics aGraphics, ILcdGXYView aGXYView, ILcdGXYViewLabelPlacer.ViewLabelPlacerCallback aCallback) The implementation of this method shall define how to place the labels of all objects in the variousILcdGXYLayer
s of the givenILcdGXYView
.void
placeLabels
(Graphics aGraphics, List<ILcdGXYLayer> aGXYLayers, ILcdGXYView aGXYView, ILcdGXYViewLabelPlacer.ViewLabelPlacerCallback aCallback) The implementation of this method shall define how to place the labels of all objects in the variousILcdGXYLayer
s from the givenList
.void
removeStatusListener
(ILcdStatusListener aListener) Removes the given status listener from this view label placer.void
setAlgorithm
(ILcdGXYLabelingAlgorithm aLabelingAlgorithm) Sets the given labeling algorithm.void
setLabelConflictChecker
(ILcdLabelConflictChecker aLabelConflictChecker) Sets the label conflict checker to be used when placing labels.void
setLabelObstacleProvider
(ILcdGXYLabelObstacleProvider aLabelObstacleProvider) Sets the used label obstacle provider.
-
Constructor Details
-
TLcdGXYLabelPlacer
public TLcdGXYLabelPlacer()Create a new label placer with a labeling algorithm that delegates to the appropriate layer'slabeling algorithm
. -
TLcdGXYLabelPlacer
Create a new label placer based on the given algorithm.Warning: when calling this constructor you are overriding the the layer's own label algorithms.
- Parameters:
aLabelingAlgorithm
- a labeling algorithm.
-
-
Method Details
-
getLabelingAlgorithm
Returns the used labeling algorithm.- Returns:
- the used labeling algorithm.
-
setAlgorithm
Sets the given labeling algorithm.Warning: using this constructor you are overriding the the layer's own label algorithms.
- Parameters:
aLabelingAlgorithm
- a labeling algorithm.
-
getLabelConflictChecker
Returns the label conflict checker used when placing labels.- Returns:
- aLabelConflictChecker the label conflict checker used when placing labels.
- See Also:
-
setLabelConflictChecker
Sets the label conflict checker to be used when placing labels.- Parameters:
aLabelConflictChecker
- the label conflict checker to be used when placing labels.- See Also:
-
getLabelObstacleProvider
Returns the usedILcdGXYLabelObstacleProvider
.- Returns:
- the used
ILcdGXYLabelObstacleProvider
, ornull
if no label obstacle provider is used. - See Also:
-
setLabelObstacleProvider
Sets the used label obstacle provider. This obstacle provider is used to provide the labeling algorithm with obstacles: places where preferably no labels are placed.The default value is
null
.- Parameters:
aLabelObstacleProvider
- a label obstacle provider.- See Also:
-
clone
Description copied from interface:ILcdCloneable
Makes
When for example extending fromObject.clone()
public.java.lang.Object
, it can be implemented like this:public Object clone() { try { return super.clone(); } catch ( CloneNotSupportedException e ) { // Cannot happen: extends from Object and implements Cloneable (see also Object.clone) throw new RuntimeException( e ); } }
- Specified by:
clone
in interfaceILcdCloneable
- Overrides:
clone
in classObject
- See Also:
-
placeLabels
public void placeLabels(Graphics aGraphics, ILcdGXYView aGXYView, ILcdGXYViewLabelPlacer.ViewLabelPlacerCallback aCallback) Description copied from interface:ILcdGXYViewLabelPlacer
The implementation of this method shall define how to place the labels of all objects in the variousILcdGXYLayer
s of the givenILcdGXYView
. Here one can implement or use various smart algorithms to check whether or not to place a label at a certain location.Layers for which labels are placed should be
ILcdGXYEditableLabelsLayer
s. This method should then inform theALcdLabelLocations
associated with that layer which labels were placed, and where they were placed.This method should only be called once every time the view is invalidated.
- Specified by:
placeLabels
in interfaceILcdGXYViewLabelPlacer
- Parameters:
aGraphics
- The currentGraphics
instance.aGXYView
- The view for which to place the labels.aCallback
- Will be invoked when labels are updated, and when the label placing has ended.- See Also:
-
placeLabels
public void placeLabels(Graphics aGraphics, List<ILcdGXYLayer> aGXYLayers, ILcdGXYView aGXYView, ILcdGXYViewLabelPlacer.ViewLabelPlacerCallback aCallback) Description copied from interface:ILcdGXYViewLabelPlacer
The implementation of this method shall define how to place the labels of all objects in the variousILcdGXYLayer
s from the givenList
. Here one can implement or use various smart algorithms to check whether or not to place a label at a certain location.Layers for which labels are placed should be
ILcdGXYEditableLabelsLayer
s. This method should then inform theALcdLabelLocations
associated with that layer which labels were placed, and where they were placed.This method should only be called once every time the view is invalidated.
- Specified by:
placeLabels
in interfaceILcdGXYViewLabelPlacer
- Parameters:
aGraphics
- The currentGraphics
instance.aGXYLayers
- Only the labels for the layers in thisList
will be placed.aGXYView
- The view for which to place the labels.aCallback
- Will be invoked when labels are updated, and when the label placing has ended.- See Also:
-
addStatusListener
Description copied from interface:ILcdGXYViewLabelPlacer
Adds the given status listener to this view label placer. Whenever an event occurs concerning the labeling process, this listener is notified.- Specified by:
addStatusListener
in interfaceILcdGXYViewLabelPlacer
- Parameters:
aListener
- a labeling listener.
-
removeStatusListener
Description copied from interface:ILcdGXYViewLabelPlacer
Removes the given status listener from this view label placer. After calling this method, the given listener will not be notified anymore.- Specified by:
removeStatusListener
in interfaceILcdGXYViewLabelPlacer
- Parameters:
aListener
- a labeling listener.
-