public class TLcdGXYLabelPlacer extends Object implements ILcdGXYViewLabelPlacer
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.
ILcdGXYViewLabelPlacer.ViewLabelPlacerCallback
Constructor and Description |
---|
TLcdGXYLabelPlacer()
Create a new label placer with a labeling algorithm that delegates to the appropriate layer's
labeling algorithm . |
TLcdGXYLabelPlacer(ILcdGXYLabelingAlgorithm aLabelingAlgorithm)
Create a new label placer based on the given algorithm.
|
Modifier and Type | Method and Description |
---|---|
void |
addStatusListener(ILcdStatusListener aListener)
Adds the given status listener to this view label placer.
|
TLcdGXYLabelPlacer |
clone()
Makes
Object.clone() public. |
ILcdLabelConflictChecker |
getLabelConflictChecker()
Returns the label conflict checker used when placing labels.
|
ILcdGXYLabelingAlgorithm |
getLabelingAlgorithm()
Returns the used labeling algorithm.
|
ILcdGXYLabelObstacleProvider |
getLabelObstacleProvider()
Returns the used
ILcdGXYLabelObstacleProvider . |
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 various
ILcdGXYLayer s of the given ILcdGXYView . |
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 various
ILcdGXYLayer s from the given List . |
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.
|
public TLcdGXYLabelPlacer()
labeling algorithm
.public TLcdGXYLabelPlacer(ILcdGXYLabelingAlgorithm aLabelingAlgorithm)
Warning: when calling this constructor you are overriding the the layer's own label algorithms.
aLabelingAlgorithm
- a labeling algorithm.public ILcdGXYLabelingAlgorithm getLabelingAlgorithm()
public void setAlgorithm(ILcdGXYLabelingAlgorithm aLabelingAlgorithm)
Warning: using this constructor you are overriding the the layer's own label algorithms.
aLabelingAlgorithm
- a labeling algorithm.public ILcdLabelConflictChecker getLabelConflictChecker()
setLabelConflictChecker(com.luciad.view.labeling.algorithm.ILcdLabelConflictChecker)
public void setLabelConflictChecker(ILcdLabelConflictChecker aLabelConflictChecker)
aLabelConflictChecker
- the label conflict checker to be used when placing labels.getLabelConflictChecker()
public ILcdGXYLabelObstacleProvider getLabelObstacleProvider()
ILcdGXYLabelObstacleProvider
.ILcdGXYLabelObstacleProvider
, or null
if no label
obstacle provider is used.setLabelObstacleProvider(com.luciad.view.gxy.ILcdGXYLabelObstacleProvider)
public void setLabelObstacleProvider(ILcdGXYLabelObstacleProvider aLabelObstacleProvider)
The default value is null
.
aLabelObstacleProvider
- a label obstacle provider.getLabelObstacleProvider()
public TLcdGXYLabelPlacer clone()
ILcdCloneable
Makes Object.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 );
}
}
clone
in interface ILcdCloneable
clone
in class Object
Object.clone()
public void placeLabels(Graphics aGraphics, ILcdGXYView aGXYView, ILcdGXYViewLabelPlacer.ViewLabelPlacerCallback aCallback)
ILcdGXYViewLabelPlacer
ILcdGXYLayer
s of the given ILcdGXYView
. 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 the ALcdLabelLocations
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.
placeLabels
in interface ILcdGXYViewLabelPlacer
aGraphics
- The current Graphics
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.ILcdGXYEditableLabelsLayer
,
ALcdLabelLocations.putLabelLocation(java.lang.Object, int, int, com.luciad.view.ILcdView, com.luciad.view.TLcdLabelLocation, int)
,
ALcdLabelLocations.setPainted(java.lang.Object, int, int, com.luciad.view.ILcdView, boolean, int)
public void placeLabels(Graphics aGraphics, List<ILcdGXYLayer> aGXYLayers, ILcdGXYView aGXYView, ILcdGXYViewLabelPlacer.ViewLabelPlacerCallback aCallback)
ILcdGXYViewLabelPlacer
ILcdGXYLayer
s from the given List
. 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 the ALcdLabelLocations
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.
placeLabels
in interface ILcdGXYViewLabelPlacer
aGraphics
- The current Graphics
instance.aGXYLayers
- Only the labels for the layers in this List
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.ILcdGXYEditableLabelsLayer
,
ALcdLabelLocations.putLabelLocation(java.lang.Object, int, int, com.luciad.view.ILcdView, com.luciad.view.TLcdLabelLocation, int)
,
ALcdLabelLocations.setPainted(java.lang.Object, int, int, com.luciad.view.ILcdView, boolean, int)
public void addStatusListener(ILcdStatusListener aListener)
ILcdGXYViewLabelPlacer
addStatusListener
in interface ILcdGXYViewLabelPlacer
aListener
- a labeling listener.public void removeStatusListener(ILcdStatusListener aListener)
ILcdGXYViewLabelPlacer
removeStatusListener
in interface ILcdGXYViewLabelPlacer
aListener
- a labeling listener.