com.orsoncharts.marker

## Class AbstractMarker

- java.lang.Object
- - com.orsoncharts.marker.AbstractMarker

- All Implemented Interfaces:
    ChartElement, Marker
  Direct Known Subclasses:
    CategoryMarker, NumberMarker, RangeMarker

      public abstract class AbstractMarker
      extends java.lang.Object
      implements Marker

  A base class for implementing markers (includes the event notification mechanism).
  Since:
    1.2

- - ### Field Summary

    - ### Fields inherited from interface com.orsoncharts.marker.Marker

      `DEFAULT_FILL_COLOR, DEFAULT_LABEL_COLOR, DEFAULT_LINE_COLOR, DEFAULT_LINE_STROKE, DEFAULT_MARKER_FONT`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addChangeListener(MarkerChangeListener listener)` Registers a listener to receive notification of changes to the marker.
    `protected static TextAnchor` | `deriveTextAnchor(RefPt2D refPt, boolean vflip)` A utility method that returns a suitable text anchor for a given reference point.
    `protected static TextAnchor` | `deriveTextAnchorForLine(RefPt2D refPt, boolean vflip)` A utility method that returns a suitable text anchor for a given reference point relative to a line (rather than a rectangle which is the normal case).
    `protected void` | `drawMarkerLabel(java.awt.Graphics2D g2, java.lang.String label, double x, double y, Anchor2D anchor, java.awt.geom.Line2D refLine, boolean reverse)` Draws a marker label.
    `protected void` | `drawMarkerLabel(java.awt.Graphics2D g2, java.lang.String label, double x, double y, Anchor2D anchor, java.awt.geom.Line2D refLine1, java.awt.geom.Line2D refLine2, boolean reverse)` Draws a marker label.
    `protected void` | `fireChangeEvent()` Sends a `MarkerChangeEvent` to all registered listeners.
    `void` | `receive(ChartElementVisitor visitor)` Receives a visitor.
    `void` | `removeChangeListener(MarkerChangeListener listener)` Deregisters a listener so that it no longer receives notification of changes to the marker.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.orsoncharts.marker.Marker

      `draw`

- - ### Method Detail

    - #### drawMarkerLabel

          protected void drawMarkerLabel(java.awt.Graphics2D g2,
                                         java.lang.String label,
                                         double x,
                                         double y,
                                         Anchor2D anchor,
                                         java.awt.geom.Line2D refLine,
                                         boolean reverse)

      Draws a marker label.
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `label` - the label.
        `x` - the x-coordinate for the anchor point.
        `y` - the y-cpordinate for the anchor point.
        `anchor` - the label anchor (`null` not permitted).
        `refLine` - a reference line that is used to determine the rotation angle for the label (`null` not permitted).
        `reverse` - a flag to indicate reverse orientation.

    - #### drawMarkerLabel

          protected void drawMarkerLabel(java.awt.Graphics2D g2,
                                         java.lang.String label,
                                         double x,
                                         double y,
                                         Anchor2D anchor,
                                         java.awt.geom.Line2D refLine1,
                                         java.awt.geom.Line2D refLine2,
                                         boolean reverse)

      Draws a marker label.
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `label` - the label.
        `x` - the x-coordinate for the anchor point.
        `y` - the y-cpordinate for the anchor point.
        `anchor` - the label anchor (`null` not permitted).
        `refLine1` - a reference line that is used to determine the rotation angle for the label (`null` not permitted).
        `refLine2` - a reference line that is used to determine the rotation angle for the label (`null` not permitted).
        `reverse` - a flag to indicate reverse orientation.

    - #### receive

          public void receive(ChartElementVisitor visitor)

      Receives a visitor.
      Specified by:
        `receive` in interface `ChartElement`
      Parameters:
        `visitor` - the visitor.
      Since:
        1.2

    - #### addChangeListener

          public void addChangeListener(MarkerChangeListener listener)

      Registers a listener to receive notification of changes to the marker.
      Specified by:
        `addChangeListener` in interface `Marker`
      Parameters:
        `listener` - the listener (`null` not permitted).

    - #### removeChangeListener

          public void removeChangeListener(MarkerChangeListener listener)

      Deregisters a listener so that it no longer receives notification of changes to the marker.
      Specified by:
        `removeChangeListener` in interface `Marker`
      Parameters:
        `listener` - the listener (`null` not permitted).

    - #### fireChangeEvent

          protected void fireChangeEvent()

      Sends a `MarkerChangeEvent` to all registered listeners.

    - #### deriveTextAnchor

          protected static TextAnchor deriveTextAnchor(RefPt2D refPt,
                                                       boolean vflip)

      A utility method that returns a suitable text anchor for a given reference point. This is used for range marker label positioning.
      Parameters:
        `refPt` - the reference point (`null` not permitted).
        `vflip` - is the text flipped vertically?
      Returns:
        A text anchor (never `null`).

    - #### deriveTextAnchorForLine

          protected static TextAnchor deriveTextAnchorForLine(RefPt2D refPt,
                                                              boolean vflip)

      A utility method that returns a suitable text anchor for a given reference point relative to a line (rather than a rectangle which is the normal case). This is used for value marker label positioning.
      Parameters:
        `refPt` - the reference point (`null` not permitted).
        `vflip` - is the text flipped vertically?
      Returns:
        A text anchor (never `null`).