Interface ILcdGXYLabelEditor
- All Superinterfaces:
Cloneable
,ILcdPropertyChangeSource
- All Known Implementing Classes:
TLcdAIXM51AirspaceLabelPainter
,TLcdAIXM51NavaidLabelPainter
,TLcdAIXM51XPathLabelPainter
,TLcdGXYCompositeLabelPainter
,TLcdGXYDataObjectLabelPainter
,TLcdGXYDataObjectPolygonLabelPainter
,TLcdGXYDataObjectPolylineLabelPainter
,TLcdGXYFeaturedLabelPainter
,TLcdGXYFeaturedPolygonLabelPainter
,TLcdGXYFeaturedPolylineLabelPainter
,TLcdGXYLabelPainter
,TLcdGXYLabelPainterAdapter
,TLcdGXYMultiFontLabelPainter
,TLcdGXYOffsetIconPainter
,TLcdGXYOutlinePolylineLabelPainter
,TLcdGXYPolygonLabelPainter
,TLcdGXYPolygonStampLabelPainter
,TLcdGXYPolylineLabelPainter
,TLcdGXYPolylineStampLabelPainter
,TLcdGXYStampLabelPainter
,TLcdICAOAirspaceDetailedLabelPainter
,TLcdICAOAirspaceLabelPainter
,TLcdICAOAreaMinimumAltitudeLabelPainter
,TLcdICAODMELabelPainter
,TLcdICAONavaidLabelPainter
,TLcdICAONDBLabelPainter
,TLcdICAOTACANLabelPainter
,TLcdICAOVORLabelPainter
,TLcdMagneticNorthGXYLabelPainter
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.
- Since:
- 7.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Mode defining that a label is being created.static final int
Mode defining that a label creation is ended.static final int
Mode defining that a label is reshaped.static final int
Mode defining that a label creation is started.static final int
Mode defining that a label is translated. -
Method Summary
Modifier and TypeMethodDescriptionboolean
acceptSnapTargetForLabel
(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns whether the label specified bysetObject
,setLabelIndex
andsetSubLabelIndex
accepts the snap target in the givenILcdGXYContext
.clone()
RedefinesObject.clone
to make it public.boolean
editLabel
(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Adapts the setTLcdLabelLocation
according to the information present in aGXYContext.Returns the display name of thisILcdGXYLabelEditor
.int
getLabelCount
(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns the number of labels for the object set to this label editor.int
Returns the number of points required to initialize the label of the setObject
.int
Returns the label of the index that is currently edited or scheduled to be edited .Returns theTLcdLabelLocation
that was previously set usingsetLabelLocation(com.luciad.view.TLcdLabelLocation)
.Gets the domainObject
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
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 theTLcdLabelLocation
instance on this label editor.void
Sets the domainObject
of the label that should be edited by thisILcdGXYLabelEditor
.void
setSubLabelIndex
(int aSubLabelIndex) Sets the index of the sublabel to edit within the current label.Methods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
-
Field Details
-
TRANSLATED
static final int TRANSLATEDMode defining that a label is translated.- See Also:
-
RESHAPED
static final int RESHAPEDMode defining that a label is reshaped.- See Also:
-
CREATING
static final int CREATINGMode defining that a label is being created. This mode must be used betweenSTART_CREATION
andEND_CREATION
.- See Also:
-
START_CREATION
static final int START_CREATIONMode defining that a label creation is started. UntilEND_CREATION
is received, the creation goes on.- See Also:
-
END_CREATION
static final int END_CREATIONMode defining that a label creation is ended. This mode must be used afterSTART_CREATION
.- See Also:
-
-
Method Details
-
setLabelLocation
Sets the
TLcdLabelLocation
instance on this label editor. This instance should contain the location information of the label specified bysetObject
,setLabelIndex
andsetSubLabelIndex
, and will be modified ineditLabel(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
.- Parameters:
aLabelLocation
- TheTLcdLabelLocation
instance which contains the current information about a label, and which will be updated when the label is edited.- See Also:
-
getLabelLocation
TLcdLabelLocation getLabelLocation()Returns theTLcdLabelLocation
that was previously set usingsetLabelLocation(com.luciad.view.TLcdLabelLocation)
.- Returns:
- The previously set
TLcdLabelLocation
- See Also:
-
setObject
Sets the domain
Object
of the label that should be edited by thisILcdGXYLabelEditor
. You should also callsetLabelLocation(com.luciad.view.TLcdLabelLocation)
after calling this methodCalling this method will set the label location to
null
.- Parameters:
aObject
- The domainObject
of the label that this editor must edit.- See Also:
-
getObject
Object getObject()Gets the domainObject
of the label that is currently edited or scheduled to be edited.- Returns:
- The domain
Object
of the label that is currently edited or scheduled to be edited. - See Also:
-
editLabel
Adapts the set
TLcdLabelLocation
according to the information present in aGXYContext. If the method returnstrue
, theTLcdLabelLocation
was modified, iffalse
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 andaGXYContext
. These should all be set before calling this method. Note that ifaMode
is one of the creating modes, the (sub) label indices are irrelevant.- Parameters:
aGraphics
- TheGraphics
on which the label is painted.aMode
- the mode to consider when editing aObject: aMode shall be a combination ofILcdGXYLabelEditor.TRANSLATED
,ILcdGXYLabelEditor.RESHAPED
,ILcdGXYLabelEditor.START_CREATION
,ILcdGXYLabelEditor.CREATING
,ILcdGXYLabelEditor.END_CREATION
.
aGXYContext
- contains the information to consider when editing the set Object.- Returns:
- true if the label of the set Object has changed, false otherwise.
- See Also:
-
getLabelCreationClickCount
int getLabelCreationClickCount()Returns the number of points required to initialize the label of the setObject
.- Returns:
- the number of points required to initialize the label of the set
Object
or -1 if this is undefined like for a polyline or a polygon. 0 means graphical creation of labels is not supported.
-
acceptSnapTargetForLabel
Returns whether the label specified by
setObject
,setLabelIndex
andsetSubLabelIndex
accepts the snap target in the givenILcdGXYContext
.The snap target is the
Object
returned byaGXYContext.getSnapTarget()
, and is on theILcdGXYLayer
returned byaGXYContext.getSnapTargetLayer()
.- Parameters:
aGraphics
- TheGraphics
on which the label is painted.aGXYContext
- TheILcdGXYContext
containing the snapping information.- Returns:
true
if the label accepts the snap target,false
otherwise.- See Also:
-
getDisplayName
String getDisplayName()Returns the display name of thisILcdGXYLabelEditor
. This name can be used to represent this label editor to the user. One should not rely on theString
returned by this method to remain always the same.- Returns:
- the display name of this
ILcdGXYLabelEditor
.
-
clone
Object clone()RedefinesObject.clone
to make it public. -
setLabelIndex
void setLabelIndex(int aLabelIndex) Sets the index of the label to edit. TheaLabelIndex
must be between 0 and
inclusive.getLabelCount
- 1- Parameters:
aLabelIndex
- the index of the label for the given object.
-
getLabelIndex
int getLabelIndex()Returns the label of the index that is currently edited or scheduled to be edited .- See Also:
-
getLabelCount
Returns the number of labels for the object set to this label editor.- Parameters:
aGraphics
- The Graphics currently painting onaGXYContext
- The ILcdGXYContext currently valid- Returns:
- The number of label for the given object.
-
getSubLabelIndex
int getSubLabelIndex()Returns the index of the sublabel that is currently edited or scheduled to be edited.- See Also:
-
setSubLabelIndex
void setSubLabelIndex(int aSubLabelIndex) Sets the index of the sublabel to edit within the current label. TheaSubLabelIndex
must be between 0 and
inclusive.getSubLabelCount
- 1- Parameters:
aSubLabelIndex
- the index of the sublabel of the current label index.- See Also:
-
getSubLabelCount
int getSubLabelCount(int aLabelIndex) Return the number of sublabels in a label. The value should be 1 or higher.- Parameters:
aLabelIndex
- the index of the label.- Returns:
- The number of sublabels of the label with the given index.
-