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
ConstructorsConstructorDescriptionCreate 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 TypeMethodDescriptionvoidaddStatusListener(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.voidplaceLabels(Graphics aGraphics, ILcdGXYView aGXYView, ILcdGXYViewLabelPlacer.ViewLabelPlacerCallback aCallback) The implementation of this method shall define how to place the labels of all objects in the variousILcdGXYLayers of the givenILcdGXYView.voidplaceLabels(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 variousILcdGXYLayers from the givenList.voidremoveStatusListener(ILcdStatusListener aListener) Removes the given status listener from this view label placer.voidsetAlgorithm(ILcdGXYLabelingAlgorithm aLabelingAlgorithm) Sets the given labeling algorithm.voidsetLabelConflictChecker(ILcdLabelConflictChecker aLabelConflictChecker) Sets the label conflict checker to be used when placing labels.voidsetLabelObstacleProvider(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, ornullif 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:ILcdCloneableMakes
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:
clonein interfaceILcdCloneable- Overrides:
clonein classObject- See Also:
-
placeLabels
public void placeLabels(Graphics aGraphics, ILcdGXYView aGXYView, ILcdGXYViewLabelPlacer.ViewLabelPlacerCallback aCallback) Description copied from interface:ILcdGXYViewLabelPlacerThe implementation of this method shall define how to place the labels of all objects in the variousILcdGXYLayers 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
ILcdGXYEditableLabelsLayers. This method should then inform theALcdLabelLocationsassociated 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:
placeLabelsin interfaceILcdGXYViewLabelPlacer- Parameters:
aGraphics- The currentGraphicsinstance.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:ILcdGXYViewLabelPlacerThe implementation of this method shall define how to place the labels of all objects in the variousILcdGXYLayers 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
ILcdGXYEditableLabelsLayers. This method should then inform theALcdLabelLocationsassociated 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:
placeLabelsin interfaceILcdGXYViewLabelPlacer- Parameters:
aGraphics- The currentGraphicsinstance.aGXYLayers- Only the labels for the layers in thisListwill 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:ILcdGXYViewLabelPlacerAdds the given status listener to this view label placer. Whenever an event occurs concerning the labeling process, this listener is notified.- Specified by:
addStatusListenerin interfaceILcdGXYViewLabelPlacer- Parameters:
aListener- a labeling listener.
-
removeStatusListener
Description copied from interface:ILcdGXYViewLabelPlacerRemoves the given status listener from this view label placer. After calling this method, the given listener will not be notified anymore.- Specified by:
removeStatusListenerin interfaceILcdGXYViewLabelPlacer- Parameters:
aListener- a labeling listener.
-