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

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.

Since:
7.0
See Also:
  • Field Details

  • Method Details

    • setLabelLocation

      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.

      Parameters:
      aLabelLocation - The TLcdLabelLocation 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 the TLcdLabelLocation that was previously set using setLabelLocation(com.luciad.view.TLcdLabelLocation).
      Returns:
      The previously set TLcdLabelLocation
      See Also:
    • setObject

      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.

      Parameters:
      aObject - The domain Object of the label that this editor must edit.
      See Also:
    • getObject

      Object getObject()
      Gets the domain Object 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

      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.

      Parameters:
      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.
      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 set Object.
      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

      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().

      Parameters:
      aGraphics - The Graphics on which the label is painted.
      aGXYContext - The ILcdGXYContext 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 this 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.
      Returns:
      the display name of this ILcdGXYLabelEditor.
    • clone

      Object clone()
      Redefines Object.clone to make it public.
    • setLabelIndex

      void setLabelIndex(int aLabelIndex)
      Sets the index of the label to edit. The aLabelIndex must be between 0 and getLabelCount - 1 inclusive.

      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

      int getLabelCount(Graphics aGraphics, ILcdGXYContext aGXYContext)
      Returns the number of labels for the object set to this label editor.
      Parameters:
      aGraphics - The Graphics currently painting on
      aGXYContext - 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. The aSubLabelIndex must be between 0 and getSubLabelCount - 1 inclusive.

      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.