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
FieldsModifier and TypeFieldDescriptionstatic final intMode defining that a label is being created.static final intMode defining that a label creation is ended.static final intMode defining that a label is reshaped.static final intMode defining that a label creation is started.static final intMode defining that a label is translated. -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptSnapTargetForLabel(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns whether the label specified bysetObject,setLabelIndexandsetSubLabelIndexaccepts the snap target in the givenILcdGXYContext.clone()RedefinesObject.cloneto make it public.booleaneditLabel(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext) Adapts the setTLcdLabelLocationaccording to the information present in aGXYContext.Returns the display name of thisILcdGXYLabelEditor.intgetLabelCount(Graphics aGraphics, ILcdGXYContext aGXYContext) Returns the number of labels for the object set to this label editor.intReturns the number of points required to initialize the label of the setObject.intReturns the label of the index that is currently edited or scheduled to be edited .Returns theTLcdLabelLocationthat was previously set usingsetLabelLocation(com.luciad.view.TLcdLabelLocation).Gets the domainObjectof the label that is currently edited or scheduled to be edited.intgetSubLabelCount(int aLabelIndex) Return the number of sublabels in a label.intReturns the index of the sublabel that is currently edited or scheduled to be edited.voidsetLabelIndex(int aLabelIndex) Sets the index of the label to edit.voidsetLabelLocation(TLcdLabelLocation aLabelLocation) Sets theTLcdLabelLocationinstance on this label editor.voidSets the domainObjectof the label that should be edited by thisILcdGXYLabelEditor.voidsetSubLabelIndex(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_CREATIONandEND_CREATION.- See Also:
-
START_CREATION
static final int START_CREATIONMode defining that a label creation is started. UntilEND_CREATIONis 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
TLcdLabelLocationinstance on this label editor. This instance should contain the location information of the label specified bysetObject,setLabelIndexandsetSubLabelIndex, 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- TheTLcdLabelLocationinstance which contains the current information about a label, and which will be updated when the label is edited.- See Also:
-
getLabelLocation
TLcdLabelLocation getLabelLocation()Returns theTLcdLabelLocationthat was previously set usingsetLabelLocation(com.luciad.view.TLcdLabelLocation).- Returns:
- The previously set
TLcdLabelLocation - See Also:
-
setObject
Sets the domain
Objectof 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 domainObjectof the label that this editor must edit.- See Also:
-
getObject
Object getObject()Gets the domainObjectof the label that is currently edited or scheduled to be edited.- Returns:
- The domain
Objectof the label that is currently edited or scheduled to be edited. - See Also:
-
editLabel
Adapts the set
TLcdLabelLocationaccording to the information present in aGXYContext. If the method returnstrue, theTLcdLabelLocationwas modified, iffalseis 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 ifaModeis one of the creating modes, the (sub) label indices are irrelevant.- Parameters:
aGraphics- TheGraphicson 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
Objector -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,setLabelIndexandsetSubLabelIndexaccepts the snap target in the givenILcdGXYContext.The snap target is the
Objectreturned byaGXYContext.getSnapTarget(), and is on theILcdGXYLayerreturned byaGXYContext.getSnapTargetLayer().- Parameters:
aGraphics- TheGraphicson which the label is painted.aGXYContext- TheILcdGXYContextcontaining the snapping information.- Returns:
trueif the label accepts the snap target,falseotherwise.- 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 theStringreturned by this method to remain always the same.- Returns:
- the display name of this
ILcdGXYLabelEditor.
-
clone
Object clone()RedefinesObject.cloneto make it public. -
setLabelIndex
void setLabelIndex(int aLabelIndex) Sets the index of the label to edit. TheaLabelIndexmust be between 0 andinclusive.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. TheaSubLabelIndexmust be between 0 andinclusive.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.
-