public interface ILcdGXYMultiLabelPainter extends ILcdGXYLabelPainter
A ILcdGXYMultiLabelPainter
can paint multiple labels per object.
More specifically, it supports multiple labels, each of which consists of one or more sublabels.
In contrast to an ILcdGXYLabelPainter
which could also be implemented to paint multiple
labels per object, the labels of a ILcdGXYMultiLabelPainter
are painted one after the other in
the current view implementations. As a consequence the label bounds are computed sequentially per label
(setLabelIndex(int)
) and are smaller than the the combined bounds of the labels. This is mainly used
in label decluttering.
One label consists of one or more sublabels. It is up to the user of this interface
(e.g. a ILcdLabelingAlgorithm
) to
decide how to interpret labels and sublabels.
One possible interpretation is to decide that if a label is painted, all of its sublabels are painted, if not, none of its sublabels are painted. A scenario for this interpretation could be street labeling, where the full street name is displayed every few segments. Here, the labels of the ILcdGXYMultiLabelPainter would be the street name, and the sublabels would be the individual words of the street name.
One other possible interpretation could be to fix the location of sublabels of a single label so that they move together. A scenario for this is when the object's representation is painted as one or more offset labels, with some extra text labels attached to each of them. Here, the labels of the ILcdGXYMultiLabelPainter would be the offset labels, and the sublabels would be the extra text labels surrounding each offset label.
This interface requires to set an object
, a location index
and the label-
and sublabel-
index before the other methods can be used.
ILcdGXYLabelingAlgorithm
DEFAULT, SELECTED
Modifier and Type | Method and Description |
---|---|
int |
getLabelCount(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Returns the number of labels for the object set to this label painter.
|
int |
getLabelIndex()
Returns the index of the label that is currently painted or scheduled to paint.
|
int |
getSubLabelCount(int aLabelIndex)
Return the number of sublabels in a label.
|
int |
getSubLabelIndex()
Returns the index of the sublabel to paint.
|
void |
setLabelIndex(int aLabelIndex)
Sets the label.
|
void |
setSubLabelIndex(int aSubLabelIndex)
Sets the sublabel index.
|
clone, getLocationIndex, getObject, getPossibleLocationCount, labelBoundsSFCT, paintLabel, setLocationIndex, setObject
void setLabelIndex(int aLabelIndex)
Sets the label. The results of any subsequent method calls to ILcdGXYLabelPainter.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
and ILcdGXYLabelPainter.labelBoundsSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Rectangle)
etc. will apply to the label and sublabel indicated by this label index.
aLabelIndex
- The label index. This should be larger than or equal to 0
and
less than the result getLabelCount(java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
.setSubLabelIndex(int)
int getLabelIndex()
setLabelIndex(int)
int getLabelCount(Graphics aGraphics, ILcdGXYContext aGXYContext)
Returns the number of labels for the object set to this label painter.
Note: when returning multiple (moveable) labels for the same object, it might be useful to useTLcdGXYEditControllerModel2.EDIT_WHAT_FIRST_TOUCHED_LABEL
to avoid that a mouse drag moves them all together.aGraphics
- The Graphics currently painting onaGXYContext
- The ILcdGXYContext currently validint getSubLabelIndex()
setSubLabelIndex(int)
void setSubLabelIndex(int aSubLabelIndex)
ILcdGXYLabelPainter.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
and
ILcdGXYLabelPainter.labelBoundsSFCT(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext, java.awt.Rectangle)
etc. will apply to the label and sublabel indicated by this sublabel
index.aSubLabelIndex
- The sub label index. This should be larger than or equal to
0
and less than the result getSubLabelCount(int)
.setLabelIndex(int)
int getSubLabelCount(int aLabelIndex)
aLabelIndex
- the index of the label.