Class TLcdAIXM51AirspaceLabelPainter

java.lang.Object
com.luciad.view.gxy.ALcdGXYLabelPainter
com.luciad.view.gxy.TLcdGXYStampLabelPainter
com.luciad.format.aixm51.view.gxy.TLcdAIXM51AirspaceLabelPainter
All Implemented Interfaces:
ILcdPropertyChangeSource, ILcdGXYLabelEditor, ILcdGXYLabelEditorProvider, ILcdGXYLabelPainter, ILcdGXYLabelPainter2, ILcdGXYLabelPainterProvider, ILcdGXYMultiLabelPainter, Serializable, Cloneable

public class TLcdAIXM51AirspaceLabelPainter extends TLcdGXYStampLabelPainter
A TLcdGXYStampLabelPainter which draws an 'ICAO Annex 4'-compliant label for AIXM 5.1 Airspace features.

By default, this painter will accept TLcdAIXM51Feature objects that are of the type TLcdAIXM51DataTypes.AirspaceType (see TLcdDataType.isInstance(java.lang.Object)).

The default time slice of the feature is used for the contents of the label. As such, the information that is displayed in the label also depends on the available information in this airspace timeslice, represented by TLcdAIXM51AirspaceTimeSlice.

This label painter extends the standard TLcdGXYStampLabelPainter with the following properties:

  • the horizontal spacing between two strings
  • the distance between the altitude and the seperation line
See Also:
  • Constructor Details

    • TLcdAIXM51AirspaceLabelPainter

      public TLcdAIXM51AirspaceLabelPainter()
      Constructs a new TLcdAIXM51AirspaceLabelPainter.
  • Method Details

    • setObject

      public void setObject(Object aObject)
      Sets the object to be labeled by this ILcdGXYLabelPainter.
      Specified by:
      setObject in interface ILcdGXYLabelEditor
      Specified by:
      setObject in interface ILcdGXYLabelPainter
      Specified by:
      setObject in interface ILcdGXYLabelPainter2
      Overrides:
      setObject in class ALcdGXYLabelPainter
      Parameters:
      aObject - the object to be labeled by this ILcdGXYLabelPainter.
      Throws:
      IllegalArgumentException - if the object is not of type AIXM 5.1 AirspaceType.
      See Also:
    • getLabelCount

      public int getLabelCount(Graphics aGraphics, ILcdGXYContext aILcdGXYContext)
      Description copied from class: ALcdGXYLabelPainter

      Return the number of labels for the currently set object. The default implementation returns 1. Override this method if you need to support multiple labels.

      Specified by:
      getLabelCount in interface ILcdGXYLabelEditor
      Specified by:
      getLabelCount in interface ILcdGXYMultiLabelPainter
      Overrides:
      getLabelCount in class ALcdGXYLabelPainter
      Parameters:
      aGraphics - The Graphics instance on which the labels would be painted.
      aILcdGXYContext - The context containing information about the layer and the view for which the label would be drawn.
      Returns:
      The number of labels for the set object. This should be greater than 0.
    • getHorizontalSpacing

      public int getHorizontalSpacing()
      Returns the horizontal spacing between two strings in the label, expressed in pixels.
      Returns:
      the horizontal spacing between two strings in the label, expressed in pixels.
      See Also:
    • setHorizontalSpacing

      public void setHorizontalSpacing(int aHorizontalSpacing)
      Specifies the horizontal spacing between two strings in the label, expressed in pixels.
      Parameters:
      aHorizontalSpacing - the horizontal spacing between two strings in the label, expressed in pixels.
      See Also:
    • getDistanceToAltitudeLine

      public int getDistanceToAltitudeLine()
      Returns the vertical spacing between the upper altitude and the separation line between upper and lower altitude, expressed in pixels. This is also the vertical spacing between the altitude separation line and the lower altitude.
      Returns:
      the vertical spacing between the upper altitude and the separation line between upper and lower altitude, expressed in pixels.
      See Also:
    • setDistanceToAltitudeLine

      public void setDistanceToAltitudeLine(int aDistanceToAltitudeLine)
      Specifies the vertical spacing between the upper altitude and the horizontal separation line between upper and lower altitude, expressed in pixels. This is also the vertical spacing between the altitude separation line and the lower altitude.
      Parameters:
      aDistanceToAltitudeLine - the vertical spacing between the upper altitude and the horizontal separation line between upper and lower altitude, expressed in pixels.
      See Also:
    • setFont

      public void setFont(Font aFont)
      Sets the font for drawing the labels.
      Parameters:
      aFont - the font for drawing the labels.
    • getFont

      public Font getFont()
      Returns the font for drawing the labels.
      Returns:
      the font for drawing the labels.
    • setForeground

      public void setForeground(Color aForeground)
      Sets the color of the labels.
      Parameters:
      aForeground - the color of the labels.
    • getForeground

      public Color getForeground()
      Returns the color of the labels.
      Returns:
      the color of the labels.
    • setBackground

      public void setBackground(Color aBackground)
      Sets the color of the label frames filling.
      Parameters:
      aBackground - the color of the label frames filling.
    • getBackground

      public Color getBackground()
      Returns the color of the label frames filling.
      Returns:
      the color of the label frames filling.
    • setSelectionColor

      public void setSelectionColor(Color aSelectionColor)
      Sets the color of the label of a selected object
      Parameters:
      aSelectionColor - the color of the label of a selected object.
    • getSelectionColor

      public Color getSelectionColor()
      Returns the color of the label of a selected object.
      Returns:
      the color of the label of a selected object.
    • setFilled

      public void setFilled(boolean aFilled)
      Sets whether the label's rectangle must be painted filled.
      Parameters:
      aFilled - whether the label's rectangle must be painted filled.
    • isFilled

      public boolean isFilled()
      Returns whether the label's rectangle is painted filled.
      Returns:
      true if the label's rectangle is painted filled.
    • setVerticalSpacing

      public void setVerticalSpacing(int aVerticalSpacing)
      Sets the vertical distance in pixels between successive features.
      Parameters:
      aVerticalSpacing - the vertical distance in pixels between successive features.
    • getVerticalSpacing

      public int getVerticalSpacing()
      Returns the vertical distance in pixels between successive features.
      Returns:
      the vertical distance in pixels between successive features.
    • setTimeSliceProvider

      public void setTimeSliceProvider(ILcdAIXM51TimeSliceProvider aTimeSliceProvider)
      Sets the time slice provider that will be used by this painter. By settings this time slice provider you override the default time slice provider of the AIXM 5 feature. Set this time slice provider to null to use the default time slice provider in this painter.
      Parameters:
      aTimeSliceProvider - A valid time slice provider or null.
      See Also:
    • getTimeSliceProvider

      public ILcdAIXM51TimeSliceProvider getTimeSliceProvider()
      Returns the time slice provider that is used by this painter. Returns null in case the default time slice provider of the AIXM 5.1 features is used.
      Returns:
      A valid time slice provider or null.
      See Also:
    • getPossibleLocationCount

      public int getPossibleLocationCount(Graphics aGraphics)
      Returns the number of possible locations to use (starting from the default position).
      Parameters:
      aGraphics - the Graphics the label will be painted on. Not used in this implementation.
      Returns:
      the number of possible locations to use (starting from the default position).
      See Also:
    • setPositionList

      public void setPositionList(int[] aPositionList)

      Sets a new position list. This list is only used when the labels are not placed freely. By default, all supported positions are offered: SOUTH_EAST, NORTH_WEST, NORTH_EAST, SOUTH_WEST, EAST, WEST, NORTH, SOUTH, and CENTER. See setShiftLabelPosition(int) for how these positions affect the label.

      Parameters:
      aPositionList - the list of possible positions to place the labels.
      See Also:
    • getPositionList

      public int[] getPositionList()
      Returns the list of possible positions to place the labels.
      Returns:
      the list of possible positions to place the labels.
      See Also:
    • setPositionListAsString

      public void setPositionListAsString(String[] aPositionList)
      The labels can occupy various positions relative to the anchor point (see description above). The following entries for the String objects are valid (independent of the font case):
      • "C" or "center".
      • "N" or "north".
      • "S" or "south".
      • "E" or "east".
      • "W" or "west".
      • "SE" or "southeast"
      • "NE" or "northeast"
      • "SW" or "southwest"
      • "NW" or "northwest"
      Any other entry will cause the labels to be positioned east.
      Parameters:
      aPositionList - the list of possible positions to place labels givens as Strings objects.
      See Also:
    • getPositionListAsString

      public String[] getPositionListAsString()
      Gets the String representations of the current position list.
      Returns:
      the String representations of the current position list.
      See Also:
    • getPositionAsString

      public String getPositionAsString(int aPosition)
      Returns the string representation of the given position of the labels relative to the anchor point.
      Parameters:
      aPosition - the integer code for a position. Can be any of SOUTH_EAST, SOUTH, SOUTH_WEST, WEST, NORTH_WEST, NORTH, NORTH_EAST, EAST or CENTER.
      Returns:
      the string representation of the given position of the labels relative to the anchor point.
      See Also:
    • labelPositionForLocationIndexSFCT

      protected double labelPositionForLocationIndexSFCT(int aLocationIndex, int aWidth, int aHeight, Point aAnchorPoint, int aMode, ILcdGXYContext aGXYContext, Graphics aGraphics, Point aPointSFCT)
      For discrete placement, the upper left corner is chosen as follows: - east-oriented positions: left label side touches aPointSFCT + shift - west-oriented positions: right label side touches aPointSFCT + shift - middle-oriented positions: vertical center axis of label touches aPointSFCT - north-oriented positions: lower side touches aPointSFCT + shift - south-oriented positions: upper side touches aPointSFCT + shift - center-oriented positions: horizontal center axis touches aPointSFCT The labels are unrotated.
      Parameters:
      aLocationIndex - the location index. This index is non-negative, thus representing a fixed label location.
      aWidth - the width of the label.
      aHeight - the height of the label.
      aAnchorPoint - The anchor point, retrieved using #anchorPointSFCT.
      aMode - the mode to consider.
      aGXYContext - the context.
      aGraphics - the Graphics.
      aPointSFCT - This point should be moved to the upper left label corner.
      Returns:
      the rotation of the label in radians. This rotation is applied in counter-clockwise direction and a rotation of 0 indicates regular horizontally painted text. The origin of the rotation is the upper left corner of the label, which is returned by this method through the aPointSFCT parameter as a side effect.
    • setShiftLabelPosition

      public void setShiftLabelPosition(int aShift)

      Sets how many pixels the label must be removed from the anchor point of the domain object. If the position of the label is east or west, this shift is applied in horizontal direction; if the position is north or south, this shift is applied in vertical direction. In case of north east, south east, south west or north west, this shift is applied in both directions. If the location of the label is center, the shift is ignored.

      The default for this value is 8 pixels.

      Parameters:
      aShift - the distance, expressed in pixels, that the label must be removed from the domain object.
      See Also:
    • getShiftLabelPosition

      public int getShiftLabelPosition()
      Returns how many pixels the label must be removed from the anchor point of the domain object.
      Returns:
      the distance, expressed in pixels, that the label must be removed from the domain object.
      See Also:
    • clone

      public Object clone()
      Description copied from class: ALcdGXYLabelPainter
      Returns a new instance of this ALcdGXYLabelPainter. The label location of the clone is a clone of the label location of the original. No other objects are cloned.
      Specified by:
      clone in interface ILcdGXYLabelEditor
      Specified by:
      clone in interface ILcdGXYLabelEditorProvider
      Specified by:
      clone in interface ILcdGXYLabelPainter
      Specified by:
      clone in interface ILcdGXYLabelPainter2
      Specified by:
      clone in interface ILcdGXYLabelPainterProvider
      Returns:
      A new instance of this ALcdGXYLabelPainter of which the label location is a deep clone.
    • setGXYInteractiveLabelProvider

      @Deprecated public void setGXYInteractiveLabelProvider(ALcdGXYInteractiveLabelProvider aGXYInteractiveLabelProvider)
      Deprecated.
      this is controller logic. Use TLcdGXYInteractiveLabelsController instead.

      Sets the interactive label provider. This method can be called at most once. If the interactive label provider was previously set (with this method or in the constructor), calling this method will throw and IllegalStateException.

      Note that to fully enable the functionality, setProvideInteractiveLabelOnMouseOver must be set to true.
      Parameters:
      aGXYInteractiveLabelProvider - The interactive label provider that will be used to configure and show a component that can, for instance, be used to edit the properties of the labeled domain object. This cannot be null.
      Throws:
      IllegalStateException - When the interactive label provider was already set.
      IllegalArgumentException - When the interactive label provider was null.
      See Also:
    • getGXYInteractiveLabelProvider

      public ALcdGXYInteractiveLabelProvider getGXYInteractiveLabelProvider()
      Returns the interactive label provider.
      Returns:
      The interactive label provider.
      See Also:
    • getComponentForGXYView

      protected Component getComponentForGXYView(ILcdGXYView aGXYView)

      Gets the component that represents the given ILcdGXYView. By default this is the view itself casted to java.awt.Component. This information is used for handling mouse events.

      Override this method if your ILcdGXYView implementation does not extend from java.awt.Component.

      Parameters:
      aGXYView - The view for which a Component must be retrieved.
      Returns:
      The java.awt.Component which corresponds to the given ILcdGXYView
      Throws:
      IllegalArgumentException - By default when aGXYView is not a java.awt.Component
      See Also:
    • canAddComponentToGXYView

      protected boolean canAddComponentToGXYView(ILcdGXYView aGXYView)

      Returns whether or not an interactive label can be added to the given view. If this method returns false, addComponentToGXYView must not be called. By default this method checks if the given ILcdGXYView is an instance of java.awt.Container without a layout set on it.

      Override this method if your ILcdGXYView implementation is not a java.awt.Container or if you add components to another container than the specified ILcdGXYView.

      Parameters:
      aGXYView - The ILcdGXYView for which to check if a component can be added.
      Returns:
      true if a component can be added, false otherwise.
      See Also:
    • addComponentToGXYView

      protected void addComponentToGXYView(ILcdGXYView aGXYView, Component aComponent)

      Adds the specified interactive label to the user interface. By default this method casts the given ILcdGXYView to java.awt.Container and adds the component to the view.

      Override this method if your implementation of ILcdGXYView does not extend from java.awt.Container or if you want to add the interactive label to another java.awt.Container because, for instance, you already need to add other components to the specified ILcdGXYView.

      If you override this method, you also need to override canAddComponentToGXYView and removeComponentFromGXYView as these methods are closely related to each other.

      This method will not be called if canAddComponentToGXYView returns false.

      Parameters:
      aGXYView - The view to which the interactive label should be added.
      aComponent - The interactive label that should be added to the user interface.
      Throws:
      IllegalArgumentException - By default if aGXYView is not an instance of java.awt.Container or if the layout of aGXYView is not null.
      See Also:
    • removeComponentFromGXYView

      protected void removeComponentFromGXYView(ILcdGXYView aGXYView, Component aComponent)

      Removes the specified java.awt.Component from the user interface. By default this method casts the specified ILcdGXYView to java.awt.Container and removes the component from that container.

      Override this method if you have overridden addComponentToGXYView.

      Parameters:
      aGXYView - The view from which the interactive label should be removed.
      aComponent - The interactive label that should be removed from the user interface
      Throws:
      IllegalArgumentException - By default if the view does not extend from java.awt.Container
    • startLabelInteraction

      public void startLabelInteraction(Object aDomainObject, int aLabelIndex, int aSubLabelIndex, ILcdGXYContext aGXYContext)
      Configure an interactive label for the specified label and show it in the GUI.
      Parameters:
      aDomainObject - The domain object for which to display an interactive label.
      aLabelIndex - The index of the label for which an interactive label should be displayed.
      aSubLabelIndex - The index of the sublabel for which an interactive label should be displayed.
      aGXYContext - An instance of ILcdGXYContext containing the layer and the view for which the label should be made interactive
    • canStopLabelInteraction

      public boolean canStopLabelInteraction()

      Returns whether or not the label interaction can be stopped. For instance, when the interactive label contains invalid text, this method should return false.

      Returns:
      true if the label interaction can be stopped, false otherwise.
    • stopLabelInteraction

      public boolean stopLabelInteraction()

      Stops the interactive label, if there is one. The interactive label will commit any outstanding changes.

      Returns:
      true if the interactive label could be stopped or if there was no interactive label, false otherwise.
      See Also:
    • cancelLabelInteraction

      public void cancelLabelInteraction()
      Cancels the interactive label, if there is one. This prevents the interactive label from committing any changes.
    • getDomainObjectForInteractiveLabel

      public Object getDomainObjectForInteractiveLabel()
      Returns the domain object for the interactive label, or null if there is no interactive label.
      Returns:
      The domain object for the interactive label, or null if there is no interactive label.
    • setProvideInteractiveLabelOnMouseOver

      @Deprecated public void setProvideInteractiveLabelOnMouseOver(boolean aProvideInteractiveLabelOnMouseOver)
      Deprecated.
      this is controller logic. Use TLcdGXYInteractiveLabelsController instead.

      Enables the ALcdGXYInteractiveLabelProvider functionality, so that the interactive label is present when the mouse hoovers over a label. This flag is typically enabled/disabled whenever the interactive label functionality is desired/not wanted. For example, the interactive labels could only be desired when a certain ILcdGXYController is active.

      Parameters:
      aProvideInteractiveLabelOnMouseOver - true to activate the ALcdGXYInteractiveLabelProvider, false otherwise.
      See Also:
    • isLabelTouched

      public boolean isLabelTouched(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
      Description copied from interface: ILcdGXYLabelPainter2
      Tests if the label specified by setObject, setLabelIndex and setSubLabelIndex is touched at view location (specified by aGXYContext.getX() and aGXYContext.getY()), considering the mode and the ILcdGXYContext instance.

      Before calling this method, the domain object, the label index, the sublabel index and the location of the label should be set using the respective methods.

      Specified by:
      isLabelTouched in interface ILcdGXYLabelPainter2
      Parameters:
      aGraphics - The Graphics instance on which the label is painted.
      aMode - the mode to consider. This is a bitwise combinations of several constants. See ILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext) for more information.
      aGXYContext - the ILcdGXYContext to consider.
      Returns:
      true if the representation of the Object returned by getObject() is touched, false otherwise
      See Also:
    • labelAnchorPointSFCT

      public void labelAnchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aPointSFCT) throws TLcdNoBoundsException
      Description copied from interface: ILcdGXYLabelPainter2

      Sets aPointSFCT to the anchor point of the label specified by setObject, setLabelIndex and setSubLabelIndex.

      If the location index is less than 0, the label anchor point is unambiguously determined by the label location. The actual label is to be painted somewhere around this anchor point. This method is typically called to compare the result with the label bounds, thus determining the exact relation between the label and its location.

      Before calling this method, the domain object, the label index, the sublabel index and the location of the label should be set using the respective methods.

      Specified by:
      labelAnchorPointSFCT in interface ILcdGXYLabelPainter2
      Parameters:
      aGraphics - The Graphics instance on which the label is painted.
      aMode - The mode to consider. This can be a bitwise combination of several constants. See ILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext) for more information.
      aGXYContext - The ILcdGXYContext that can be used to retrieve extra information.
      aPointSFCT - The point which will be updated to reflect the location of the anchor point.
      Throws:
      TLcdNoBoundsException - if the Object doesn't have any valid anchor point, e.g. if it is always invisible in the current projection.
      See Also:
    • paintLabel

      public void paintLabel(Graphics aGraphics, int aMode, ILcdGXYContext aContext)
      Description copied from interface: ILcdGXYLabelPainter2

      Paints the label specified by setObject, setLabelIndex and setSubLabelIndex on aGraphics. aGXYContext should contain the ILcdGXYView for which the label is painted and ILcdGXYLayer to which the object belongs

      The implementation of this method shall define how to paint the specified label in the given mode, considering aGXYContext and the set TLcdLabelLocation.

      The domain object, label index, sublabel index and the label location should be set before calling this method using the respective methods.

      This interface extends the original contract of the paintLabel method to allow for more modes. Where in the super interface the mode could only be one of ILcdGXYLabelPainter.DEFAULT or ILcdGXYLabelPainter.SELECTED, the mode now can be a bitwise combination of several constants

      Specified by:
      paintLabel in interface ILcdGXYLabelPainter
      Specified by:
      paintLabel in interface ILcdGXYLabelPainter2
      Parameters:
      aGraphics - The graphics object to paint the label on
      aMode - A bitwise combination of
      aContext - the drawing context for the label
      See Also:
    • editLabel

      public boolean editLabel(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
      Description copied from interface: ILcdGXYLabelEditor

      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.

      Specified by:
      editLabel in interface ILcdGXYLabelEditor
      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:
    • labelSnapTarget

      public Object labelSnapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext)
      Description copied from class: ALcdGXYLabelPainter
      Returns an Object that can be used as snapping target when graphically editing another Object or label than the one this ILcdGXYLabelPainter2 represents. The returned Object can be the Object this ILcdGXYLabelPainter2 represents or any other (e.g. an ILcdPoint if getObject() is an ILcdPointList).

      This default implementation always returns null. Override this method if you want to support snapping.

      Specified by:
      labelSnapTarget in interface ILcdGXYLabelPainter2
      Overrides:
      labelSnapTarget in class ALcdGXYLabelPainter
      Parameters:
      aGraphics - the Graphics on which is worked.
      aGXYContext - the ILcdGXYContext of the snapping.
      Returns:
      an Object that can be used as snapping target when graphically editing another Object or label than the one this ILcdGXYLabelPainter2 represents (returned by getObject()). This object can be null.
    • getGXYLabelPainter

      public ILcdGXYLabelPainter getGXYLabelPainter(Object aObject)
      Description copied from interface: ILcdGXYLabelPainterProvider
      Finds an ILcdGXYLabelPainter that can be used to label the object passed.

      The label painter provider is responsible for setting the object to the label painter before returning the label painter. An implementation should therefore have the following structure:

      
       public ILcdGXYLabelPainter getGXYLabelPainter(Object aObject) {
         ILcdGXYLabelPainter labelPainter = ... // find the label painter for the object
         if (labelPainter != null) {
          labelPainter.setObject(aObject);
         }
         return labelPainter;
       }
       

      Specified by:
      getGXYLabelPainter in interface ILcdGXYLabelPainterProvider
      Parameters:
      aObject - the object to find a label painter for
      Returns:
      a label painter that can be used to label the object; or null if no label painter could be found for the given object, or the object could not be set on the retrieved label painter.
    • getGXYLabelEditor

      public ILcdGXYLabelEditor getGXYLabelEditor(Object aObject)
      Description copied from interface: ILcdGXYLabelEditorProvider

      Returns a valid ILcdGXYLabelEditor for editing the labels of aObject. The returned ILcdGXYLabelEditor must have aObject set on it. The TLcdLabelLocation must not yet be set on it.

      Specified by:
      getGXYLabelEditor in interface ILcdGXYLabelEditorProvider
      Parameters:
      aObject - the Object for which to obtain a ILcdGXYLabelEditor.
      Returns:
      a valid ILcdGXYLabelEditor for editing the labels of aObject with aObject set on it.
      See Also:
    • setGXYLabelStamp

      public void setGXYLabelStamp(ALcdGXYLabelStamp aGXYLabelStamp)

      Sets the ALcdGXYLabelStamp that this painter should use to paint the labels. This stamp must be set to a non-null value before this label painter can be used on a layer.

      Parameters:
      aGXYLabelStamp - The ALcdGXYLabelStamp that this painter should use to paint the labels.
    • getGXYLabelStamp

      public ALcdGXYLabelStamp getGXYLabelStamp()
      Returns the ALcdGXYLabelStamp that is used by this painter to paint the labels.
      Returns:
      The ALcdGXYLabelStamp that is used by this painter to paint the labels.
      See Also:
    • firePropertyChangeEvent

      protected void firePropertyChangeEvent(PropertyChangeEvent aPropertyChangeEvent)
      Description copied from class: ALcdGXYLabelPainter
      Notifies the registered PropertyChangeListeners of the specified event.
      Overrides:
      firePropertyChangeEvent in class ALcdGXYLabelPainter
      Parameters:
      aPropertyChangeEvent - The event describing the property change of which the registered listeners should be notified.
      See Also:
    • getDisplayName

      public String getDisplayName()
      Description copied from class: ALcdGXYLabelPainter
      This default implementation returns the display name set with setDisplayName, or toString() if this was set to null.
      Specified by:
      getDisplayName in interface ILcdGXYLabelEditor
      Specified by:
      getDisplayName in interface ILcdGXYLabelPainter2
      Overrides:
      getDisplayName in class ALcdGXYLabelPainter
      Returns:
      the display name of this ILcdGXYLabelPainter2
    • getLabelCursor

      public Cursor getLabelCursor(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
      Description copied from class: ALcdGXYLabelPainter
      Returns a Cursor to indicate the type of editing aMode and aGXYContext.

      This default implementation always returns null. Override this method if you want to display custom cursors.

      Specified by:
      getLabelCursor in interface ILcdGXYLabelPainter2
      Overrides:
      getLabelCursor in class ALcdGXYLabelPainter
      Parameters:
      aGraphics - The Graphics instance on which the label is painted.
      aMode - The mode to consider. See ILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, ILcdGXYContext) for more information.
      aGXYContext - The ILcdGXYContext containing extra information, such as the layer, the view and the mouse position.
      Returns:
      a Cursor to indicate the type of editing aMode and aGXYContext. Returns null if no particular Cursor is required.
    • acceptSnapTargetForLabel

      public boolean acceptSnapTargetForLabel(Graphics aGraphics, ILcdGXYContext aGXYContext)
      Description copied from interface: ILcdGXYLabelEditor

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

      Specified by:
      acceptSnapTargetForLabel in interface ILcdGXYLabelEditor
      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:
    • labelBoundsSFCT

      public double labelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aContext, Rectangle aRectangle) throws TLcdNoBoundsException
      Description copied from interface: ILcdGXYLabelPainter2

      Calculates the bounds of the label that can be painted. The bounds are set as a side effect in aRectangleSFCT, the orientation of aRectangleSFCT is returned as an angle.

      The bounds represent the upper left point of the label, and a width and a height. The rotation value represents the rotation of the label bounds around the upper left point.

      The domain object, the label index, the sublabel index and the location of the label for which the bounds are retrieved should be set before calling this method using the respective methods.

      Note that if this label painter is used in conjunction with a labeling algorithm, the bounds should preferably be independent of the location, as this will yield the best results.

      Specified by:
      labelBoundsSFCT in interface ILcdGXYLabelPainter
      Specified by:
      labelBoundsSFCT in interface ILcdGXYLabelPainter2
      Parameters:
      aGraphics - the aGraphics to consider.
      aMode - the representation mode of the label.
      aContext - the ILcdGXYContext the drawing depends on.
      aRectangle - the Rectangle containing the bounds of the label in view / graphics coordinates as side effect.
      Returns:
      the angle orientation of the rectangle around the labels in RADIANs, clockwise, 0 at 3 o'clock.
      Throws:
      TLcdNoBoundsException - if the Object doesn't have any valid bounds, e.g. if it is always invisible in the current projection.
      See Also:
    • anchorPointSFCT

      protected void anchorPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aContext, Point aPointSFCT) throws TLcdNoBoundsException
      Retrieves an anchor point that is used to determine where the pin of the label (specified by setObject, setLabelIndex and setSubLabelIndex) attaches to the object representation. Implementations of this class can also use it to determine, for example, discrete positions for a label.

      By default, this anchor point is the result of the anchorPointSFCT method of the corresponding ILcdGXYPainter for the Object to be painted (see aGXYContext.getGXYLayer().getGXYPainter( aObject )). When the set TLcdLabelLocation can retrieve an anchor point, this anchor point should be returned.

      Before calling this method, the domain object, the label index, the sublabel index and the location of the label should be set using the respective methods.

      Parameters:
      aGraphics - the Graphics for which the labels anchor point should be calculated.
      aMode - the mode for the which the label anchor point should be calculated. Can be ILcdGXYLabelPainter.SELECTED or ILcdGXYLabelPainter.DEFAULT.
      aContext - the context in which this label will be painted.
      aPointSFCT - the point that will be moved to the computed anchor point.
      Throws:
      TLcdNoBoundsException - if the Object doesn't have any valid anchor point, e.g. if it is always invisible in the current projection.
    • setMakeLabelsStickyOnEdit

      public void setMakeLabelsStickyOnEdit(boolean aMakeLabelsStickyOnEdit)
      Sets whether or not this editor should set the label edit mode of the edited labels to include the sticky flag. This means the labels will no longer be automatically moved by the decluttering algorithm.
      Parameters:
      aMakeLabelsStickyOnEdit - true if you want the labels to be sticky after they are edited, false otherwise.
      See Also:
    • isMakeLabelsStickyOnEdit

      public boolean isMakeLabelsStickyOnEdit()
      Returns whether the labels this editor edits are made sticky.
      Returns:
      true if this editor sets the labels it edits to be sticky, false otherwise. The default value is false.
      See Also:
    • getLabelCreationClickCount

      public int getLabelCreationClickCount()
      Description copied from interface: ILcdGXYLabelEditor
      Returns the number of points required to initialize the label of the set Object.
      Specified by:
      getLabelCreationClickCount in interface ILcdGXYLabelEditor
      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.
    • getPinColor

      public Color getPinColor()
      Returns the color in which the pin is drawn.
      Returns:
      The color in which the pin is drawn.
      See Also:
    • setPinColor

      public void setPinColor(Color aPinColor)
      Sets the color in which the pin should be drawn.
      Parameters:
      aPinColor - The color in which the pin should be drawn.
      See Also:
    • getSelectedPinColor

      public Color getSelectedPinColor()
      Returns the color in which the pin should be drawn of the label of a selected object.
      Returns:
      The color in which the pin should be drawn of the label of a selected object.
    • setSelectedPinColor

      public void setSelectedPinColor(Color aSelectedPinColor)
      Sets the color in which the pin of the label of a selected label should be drawn.
      Parameters:
      aSelectedPinColor - The color in which the pin of the label of a selected label should be drawn.
      See Also:
    • isHaloEnabled

      public boolean isHaloEnabled()
      Returns true if the halo effect is on for the labels, false otherwise.
      Returns:
      true if the halo effect is on, false otherwise
      See Also:
    • setHaloEnabled

      public void setHaloEnabled(boolean aHaloEnabled)
      Switches the halo effect for the labels on or off.
      Parameters:
      aHaloEnabled - true if halos should be added, false otherwise
      See Also:
    • isHaloPinEnabled

      public boolean isHaloPinEnabled()
      Returns true if the halo effect also includes the pin.
      Returns:
      true if the halo effect includes the pin, false otherwise
      See Also:
    • setHaloPinEnabled

      public void setHaloPinEnabled(boolean aHaloPinEnabled)
      Sets if the halo effect should be applied to the pin. This only has effect when the pin is enabled.
      Parameters:
      aHaloPinEnabled - true if the halo effect includes the pin, false otherwise
      See Also:
    • getHaloThickness

      public int getHaloThickness()
      Returns the current halo thickness.
      Returns:
      the current halo thickness
      See Also:
    • setHaloThickness

      public void setHaloThickness(int aThickness)
      Sets the thickness (in pixels) of the halo to be added around labels.
      Parameters:
      aThickness - the new halo thickness
      See Also:
    • getHaloColor

      public Color getHaloColor()
      Returns the current halo color.
      Returns:
      the current halo color
      See Also:
    • setHaloColor

      public void setHaloColor(Color aColor)
      Sets the color of the halo to be added around labels.
      Parameters:
      aColor - the new halo color
      See Also:
    • setHaloAlgorithm

      public void setHaloAlgorithm(TLcdHaloAlgorithm aHaloAlgorithm)
      Sets the algorithm to be used for rendering halo's. The choice of the halo algorithm may have a major impact on the overall performance of this painter. See TLcdHaloAlgorithm for more information on the available algorithms.
      Parameters:
      aHaloAlgorithm - the algorithm to be used for rendering halo's.
      See Also:
    • getHaloAlgorithm

      public TLcdHaloAlgorithm getHaloAlgorithm()
      Returns the algorithm that is used for rendering halo's.
      Returns:
      the algorithm that is used for rendering halo's.
      See Also:
    • getHaloPinColor

      public Color getHaloPinColor()
      Returns the current halo pin color.
      Returns:
      the current halo pin color
      See Also:
    • setHaloPinColor

      public void setHaloPinColor(Color aColor)
      Sets the color of the halo to be added around pins.
      Parameters:
      aColor - the new halo color
      See Also:
    • isUseImageCache

      public boolean isUseImageCache()
      Returns true when image caching for labels with a halo is enabled, false otherwise.
      Returns:
      true when label image caching is enabled, false otherwise
      See Also:
    • setUseImageCache

      public void setUseImageCache(boolean aUseCache)
      Sets whether or not labels with halos should be cached as images. Creating a halo for a label is an expensive operation, so enabling image caching can considerably improve performance.
      Parameters:
      aUseCache - specifies whether image caching should be enabled
      See Also:
    • clearImageCache

      public void clearImageCache()
      Clears the entire label image cache. To remove a single label from the cache, use clearImageCache(Object).
      See Also:
    • clearImageCache

      public void clearImageCache(Object aObject)
      Clears the label image cache for the given object. The next time this object is painted, a new image will be created and cached for it. To remove all cached images in one go, use clearImageCache().
      Parameters:
      aObject - the object for which the cache to be cleared.
      See Also:
    • pinPointSFCT

      protected boolean pinPointSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Point aAnchorPoint, Rectangle aLabelBounds, double aRotation, Point aPinPointSFCT)
      Determines where the pin attaches to the label. This implementation attaches the pin on the label bounds, with the pin going towards the center of the label bounds.
      Parameters:
      aGraphics - The Graphics instance on which the pin will be painted.
      aMode - The mode in which the pin will be painted. See ILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, ILcdGXYContext) for more information.
      aGXYContext - The instance containing the context in which the pin will be painted.
      aAnchorPoint - The point in AWT coordinates where the pin attaches to the object representation (see #anchorPointSFCT)
      aLabelBounds - The bounds of the label in AWT coordinates.
      aRotation - The rotation of the label in radians, positive going from the x to the y axis
      aPinPointSFCT - The point in AWT coordinates where the pin attaches to the label
      Returns:
      Whether or not the pin needs to be drawn.
      See Also:
    • paintPin

      protected void paintPin(Graphics aGraphics, int aMode, int aStartPointX, int aStartPointY, int aEndPointX, int aEndPointY)
      Draws a label pin on the given graphics between the given lines. Overwrite this method if you want to change the look of the pin, for example by manipulating the graphics passed.
      Parameters:
      aGraphics - the graphics to paint the pin on.
      aMode - the mode this objects label is painted in (e.g. ILcdGXYLabelPainter.SELECTED).
      aStartPointX - the x coordinate of the start point of the pin.
      aStartPointY - the y coordinate of the start point of the pin.
      aEndPointX - the x coordinate of the end point of the pin.
      aEndPointY - the y coordinate of the end point of the pin.
      See Also:
    • setWithPin

      public void setWithPin(boolean aWithPin)
      The property withPin determines whether a pin should be drawn from the object to the label. The pin is attached to the object at the anchor point and to the label stamp at the pin point.
      Parameters:
      aWithPin - true to paint a pin connecting the label and the object.
      See Also:
    • isWithPin

      public boolean isWithPin()
      Returns whether a pin is drawn from the object to the label.
      Returns:
      true if a pin is drawn from the object to the label
      See Also:
    • setWithAnchorPoint

      public void setWithAnchorPoint(boolean aWithAnchorPoint)
      Determines whether to draw an anchor point at anchorPointSFCT.
      Parameters:
      aWithAnchorPoint - true to paint an anchor point
      See Also:
    • isWithAnchorPoint

      public boolean isWithAnchorPoint()
      Returns whether to draw an anchor point at anchorPointSFCT.
      Returns:
      true if an anchor point is painted, false otherwise
      See Also:
    • setClassTraceOn

      public static void setClassTraceOn(boolean aClassTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Enables tracing for all instances of this class. If the argument is true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
      Parameters:
      aClassTraceOn - if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.