public class TLcdGXYLayerLabelPainter extends Object implementsILcdGXYLayerLabelPainter, ILcdCloneable
label painter
.
It tries to place all labels one by one, and when a label cannot be placed without overlap, it
is omitted. If a sublabel of a label is dropped, all the sublabels of that label are dropped.
The user can control the quality versus the labeling speed through the
properties fineTuning, overLappingAllowed and allowedCluttering.
Note that this painter does not know of a layer's TLcdGXYLayer.setSelectionLabeled(boolean)
property.
See setSelectionLabeled(boolean)
instead.
For other labeling algorithms, see
ILcdGXYViewLabelPlacer
.Modifier and Type | Class and Description |
---|---|
static class |
TLcdGXYLayerLabelPainter.Quality |
Modifier and Type | Field and Description |
---|---|
static TLcdGXYLayerLabelPainter.Quality |
HIGH |
static TLcdGXYLayerLabelPainter.Quality |
LOW |
ALL, SELECTION
Constructor and Description |
---|
TLcdGXYLayerLabelPainter() |
TLcdGXYLayerLabelPainter(TLcdGXYLayerLabelPainter aGXYLayerLabelPainter) |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Redefines
Object.clone to make it public. |
double |
getAllowedCluttering()
allowedCluttering defines the fraction (a double located between 0 and 1 )
of the area (pixels) that the labels
may occupy. |
int |
getForcedPaintingThresholdPriority()
Returns the threshold priority for forced label painting.
|
ILcdGXYLabelPriorityProvider |
getLabelPriorityProvider()
Returns the
ILcdGXYLabelPriorityProvider that is used by this label painter. |
TLcdGXYLayerLabelPainter.Quality |
getQuality()
Returns the quality of the placement of the labels.
|
void |
invalidate()
Invalidate any stored information about label locations in order to
recalculate the label positions.
|
boolean |
isFineTuning()
fineTuning determines whether to apply fine grain (thus more time consuming)
label placement algorithms.
|
boolean |
isReusePreviousLocation()
Deprecated.
Use a layer implementing ILcdGXYEditableLabelsLayer instead. ALcdLabelLocations is more flexible
and its default implementation automatically removes locations for removed objects.
|
boolean |
isSelectionLabeled() |
boolean |
isSomewhatOverlapping()
somewhatOverlapping determines whether the labels may overlap a bit, thus allowing
for more labels to be placed.
|
void |
paintLabel(Graphics aGraphics,
ILcdGXYLayer aGXYLayer,
ILcdGXYView aGXYView,
int aLayerLabelPainterMode)
This method shall try to paint the labels of
all the objects of all layers in the given
ILcdGXYView ,
in the given mode aMode, considering the aGXYContext. |
void |
setAllowedCluttering(double aCluttering)
allowedCluttering defines the fraction (a double located between 0 and 1 )
of the area (pixels) that the labels
may occupy. |
void |
setFineTuning(boolean aFineTune)
fineTuning determines whether to apply fine grain (thus more time consuming)
label placement algorithms.
|
void |
setForcedPaintingThresholdPriority(int aPriority)
Sets the threshold priority for forced label painting.
|
void |
setLabelPriorityProvider(ILcdGXYLabelPriorityProvider aLabelPriorityProvider)
Sets the
ILcdGXYLabelPriorityProvider to be used by this label painter. |
void |
setQuality(TLcdGXYLayerLabelPainter.Quality aQuality)
Sets the quality of the algorithm to place the labels.
|
void |
setReusePreviousLocation(boolean aReusePreviousLocation)
Deprecated.
Use a layer implementing ILcdGXYEditableLabelsLayer instead. ALcdLabelLocations is more flexible
and its default implementation automatically removes locations for removed objects.
|
void |
setSelectionLabeled(boolean aSelectionLabeled)
selectionLabeled determines whether an object should be labeled anyhow.
|
void |
setSomewhatOverlapping(boolean aOverlap)
somewhatOverlapping determines whether the labels may overlap a bit, thus allowing
for more labels to be placed.
|
public static final TLcdGXYLayerLabelPainter.Quality LOW
public static final TLcdGXYLayerLabelPainter.Quality HIGH
public TLcdGXYLayerLabelPainter()
public TLcdGXYLayerLabelPainter(TLcdGXYLayerLabelPainter aGXYLayerLabelPainter)
public TLcdGXYLayerLabelPainter.Quality getQuality()
setQuality(com.luciad.view.gxy.TLcdGXYLayerLabelPainter.Quality)
public void setQuality(TLcdGXYLayerLabelPainter.Quality aQuality)
aQuality
- LOW or HIGHgetQuality()
public void paintLabel(Graphics aGraphics, ILcdGXYLayer aGXYLayer, ILcdGXYView aGXYView, int aLayerLabelPainterMode)
ILcdGXYView
,
in the given mode aMode, considering the aGXYContext.paintLabel
in interface ILcdGXYLayerLabelPainter
aGraphics
- The Graphics
instance on which to paint the labels.aGXYLayer
- The layer for which to paint the labels. If this layer is an
instance of ILcdGXYEditableLabelsLayer
, its
ALcdLabelLocations
should be informed of which
labels have been drawn and which haven't.aGXYView
- The view in which the layer is contained.aLayerLabelPainterMode
- Determines which labels should be painted. Should be one of
ILcdGXYLayerLabelPainter.ALL
or ILcdGXYLayerLabelPainter.SELECTION
ILcdGXYEditableLabelsLayer
,
ALcdLabelLocations.setPainted(java.lang.Object, int, int, com.luciad.view.ILcdView, boolean, int)
public boolean isFineTuning()
true
if fineTuning is true
, else false
is returned.public void setFineTuning(boolean aFineTune)
public boolean isSomewhatOverlapping()
true
if somewhatOverlapping is true
, else false
is returned.public void setSomewhatOverlapping(boolean aOverlap)
public double getAllowedCluttering()
allowedCluttering
defines the fraction (a double located between 0 and 1 )
of the area (pixels) that the labels
may occupy.
allowedCluttering
equal to zero means no labels may be drawn.
allowedCluttering
equal to one allows the view to be filled by labels.public void setAllowedCluttering(double aCluttering)
allowedCluttering
defines the fraction (a double located between 0 and 1 )
of the area (pixels) that the labels
may occupy.
allowedCluttering
equal to zero means no labels may be drawn.
allowedCluttering
equal to one allows the view to be filled by labels.
Sets allowedCluttering
to aCluttering.public void setReusePreviousLocation(boolean aReusePreviousLocation)
invalidate()
to clear the cached positions of all objects.aReusePreviousLocation
- true to cache relative label position.isReusePreviousLocation()
,
invalidate()
public boolean isReusePreviousLocation()
setReusePreviousLocation(boolean)
public void setSelectionLabeled(boolean aSelectionLabeled)
public boolean isSelectionLabeled()
setSelectionLabeled(boolean)
public void setLabelPriorityProvider(ILcdGXYLabelPriorityProvider aLabelPriorityProvider)
ILcdGXYLabelPriorityProvider
to be used by this label painter.
If null
, no priorities will be used (default behavior).aLabelPriorityProvider
- the ILcdGXYLabelPriorityProvider
to be used.getLabelPriorityProvider()
public ILcdGXYLabelPriorityProvider getLabelPriorityProvider()
ILcdGXYLabelPriorityProvider
that is used by this label painter.ILcdGXYLabelPriorityProvider
that is used.setLabelPriorityProvider(ILcdGXYLabelPriorityProvider)
public void setForcedPaintingThresholdPriority(int aPriority)
-1
, in which case no forced painting is done.aPriority
- the threshold priority for forced label painting.getForcedPaintingThresholdPriority()
public int getForcedPaintingThresholdPriority()
setForcedPaintingThresholdPriority(int)
public void invalidate()
reusePreviousLocation
if it is true.public Object clone()
ILcdGXYLayerLabelPainter
Object.clone
to make it public.clone
in interface ILcdCloneable
clone
in interface ILcdGXYLayerLabelPainter
clone
in class Object
Object.clone()