public interface ILcdGXYLabelEditor extends Cloneable, ILcdPropertyChangeSource
Interface that models a label editor allowing the user to move the labels on the map, for example graphically by using his mouse.
To use this class, you must first set object whose label you wish to edit, set which label and
sublabel you are editing, then set the TLcdLabelLocation
containing the current
label location information and call the editLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
method. After you have called this
method, the TLcdLabelLocation you had previously set will be adjusted to point to the new
location, as determined from the parameters from the editLabel
method. You can then
store this changed information in the ALcdLabelLocations
instance.
This interface bears close resemblance to the ILcdGXYEditor
interface, which is
used to edit the objects themselves.
ALcdLabelLocations
,
About label- and sublabel indices.
Modifier and Type | Field and Description |
---|---|
static int |
CREATING
Mode defining that a label is being created.
|
static int |
END_CREATION
Mode defining that a label creation is ended.
|
static int |
RESHAPED
Mode defining that a label is reshaped.
|
static int |
START_CREATION
Mode defining that a label creation is started.
|
static int |
TRANSLATED
Mode defining that a label is translated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
acceptSnapTargetForLabel(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Returns whether the label specified by
setObject , setLabelIndex and
setSubLabelIndex accepts the snap target in the given
ILcdGXYContext . |
Object |
clone()
Redefines
Object.clone to make it public. |
boolean |
editLabel(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Adapts the set
TLcdLabelLocation according to the information present in
aGXYContext. |
String |
getDisplayName()
Returns the display name of this
ILcdGXYLabelEditor . |
int |
getLabelCount(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Returns the number of labels for the object set to this label editor.
|
int |
getLabelCreationClickCount()
Returns the number of points required to initialize the label of the set
Object . |
int |
getLabelIndex()
Returns the label of the index that is currently edited or scheduled to be edited .
|
TLcdLabelLocation |
getLabelLocation()
Returns the
TLcdLabelLocation that was previously set using setLabelLocation(com.luciad.view.TLcdLabelLocation) . |
Object |
getObject()
Gets the domain
Object of the label that is currently edited or scheduled to be
edited. |
int |
getSubLabelCount(int aLabelIndex)
Return the number of sublabels in a label.
|
int |
getSubLabelIndex()
Returns the index of the sublabel that is currently edited or scheduled to be edited.
|
void |
setLabelIndex(int aLabelIndex)
Sets the index of the label to edit.
|
void |
setLabelLocation(TLcdLabelLocation aLabelLocation)
Sets the
TLcdLabelLocation instance on this label editor. |
void |
setObject(Object aObject)
Sets the domain
Object of the label that should be edited by this
ILcdGXYLabelEditor . |
void |
setSubLabelIndex(int aSubLabelIndex)
Sets the index of the sublabel to edit within the current label.
|
addPropertyChangeListener, removePropertyChangeListener
static final int TRANSLATED
static final int RESHAPED
static final int CREATING
START_CREATION
and END_CREATION
.static final int START_CREATION
END_CREATION
is received, the creation goes on.static final int END_CREATION
START_CREATION
.void setLabelLocation(TLcdLabelLocation aLabelLocation)
Sets the TLcdLabelLocation
instance on this label editor. This instance should
contain the location information of the label specified by setObject
,
setLabelIndex
and setSubLabelIndex
, and will be modified in editLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
to reflect the new location information after the label has been edited.
This location information must be set after the object has been set, as setting
the object discards the previously set location information by setting it to
null
.
aLabelLocation
- The TLcdLabelLocation
instance which contains the current
information about a label, and which will be updated when the label is
edited.ILcdGXYLabelPainter2.setLabelLocation(com.luciad.view.TLcdLabelLocation)
TLcdLabelLocation getLabelLocation()
TLcdLabelLocation
that was previously set using setLabelLocation(com.luciad.view.TLcdLabelLocation)
.TLcdLabelLocation
setLabelLocation(com.luciad.view.TLcdLabelLocation)
void setObject(Object aObject)
Sets the domain Object
of the label that should be edited by this
ILcdGXYLabelEditor
. You should also call setLabelLocation(com.luciad.view.TLcdLabelLocation)
after calling
this method
Calling this method will set the label location to null
.
aObject
- The domain Object
of the label that this editor must edit.editLabel
Object getObject()
Object
of the label that is currently edited or scheduled to be
edited.Object
of the label that is currently edited or scheduled to be
edited.setObject
boolean editLabel(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
Adapts the set TLcdLabelLocation
according to the information present in
aGXYContext. If the method returns true
, the TLcdLabelLocation
was
modified, if false
is returned, it wasn't changed.
The implementation of this method shall define how to edit the label specified by the set
domain Object
, label index and
sublabel index, considering the given mode and
aGXYContext
. These should all be set before calling this method. Note that
if aMode
is one of the creating modes, the (sub) label indices are irrelevant.
aGraphics
- The Graphics
on which the label is painted.aMode
- the mode to consider when editing aObject: aMode shall be a combination of
ILcdGXYLabelEditor.TRANSLATED
,ILcdGXYLabelEditor.RESHAPED
, ILcdGXYLabelEditor.START_CREATION
,ILcdGXYLabelEditor.CREATING
, ILcdGXYLabelEditor.END_CREATION
.aGXYContext
- contains the information to consider when editing the set Object.ILcdGXYContext
int getLabelCreationClickCount()
Object
.Object
or
-1 if this is undefined like for a polyline or a polygon. 0 means graphical creation
of labels is not supported.boolean acceptSnapTargetForLabel(Graphics aGraphics, ILcdGXYContext aGXYContext)
Returns whether the label specified by setObject
, setLabelIndex
and
setSubLabelIndex
accepts the snap target in the given
ILcdGXYContext
.
The snap target is the Object
returned by aGXYContext.getSnapTarget()
,
and is on the ILcdGXYLayer
returned by aGXYContext.getSnapTargetLayer()
.
aGraphics
- The Graphics
on which the label is painted.aGXYContext
- The ILcdGXYContext
containing the snapping information.true
if the label accepts the snap target, false
otherwise.ILcdGXYContext.getSnapTarget()
,
ILcdGXYContext.getSnapTargetLayer()
String getDisplayName()
ILcdGXYLabelEditor
. This name can be used to
represent this label editor to the user. One should not rely on the String
returned by this method to remain always the same.ILcdGXYLabelEditor
.Object clone()
Object.clone
to make it public.void setLabelIndex(int aLabelIndex)
aLabelIndex
must be between 0 and
getLabelCount
- 1
inclusive.aLabelIndex
- the index of the label for the given object.int getLabelIndex()
setLabelIndex(int)
int getLabelCount(Graphics aGraphics, ILcdGXYContext aGXYContext)
aGraphics
- The Graphics currently painting onaGXYContext
- The ILcdGXYContext currently validint getSubLabelIndex()
setSubLabelIndex(int)
void setSubLabelIndex(int aSubLabelIndex)
aSubLabelIndex
must be between 0 and
getSubLabelCount
- 1
inclusive.aSubLabelIndex
- the index of the sublabel of the current label index.setLabelIndex(int)
int getSubLabelCount(int aLabelIndex)
aLabelIndex
- the index of the label.