com.orsoncharts.plot

## Class AbstractPlot3D

- java.lang.Object
- - com.orsoncharts.plot.AbstractPlot3D

- All Implemented Interfaces:
    ChartElement, Dataset3DChangeListener, Plot3D, java.io.Serializable, java.util.EventListener
  Direct Known Subclasses:
    CategoryPlot3D, PiePlot3D, XYZPlot

      public abstract class AbstractPlot3D
      extends java.lang.Object
      implements Plot3D, Dataset3DChangeListener, java.io.Serializable

  A base class that can be used to create classes that implement `Plot3D`.
  A mechanism is provided for registering change listeners on the plot. Whenever some attribute of the plot changes, all the registered listeners are notified. The `Chart3D` instance that owns the plot will be automatically registered as a listener so that it receives notification whenever the plot (or some other object managed by the plot) changes.
  Typically a plot registers itself as a change listener on its dataset and whenever a dataset change notification is received, the plot will pass on a `Plot3DChangeEvent` to all *its* listeners. If the plot has axes, then the same approach is used to listen for changes to the axes.
  NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `autoAdjustDimensions` A flag that controls whether or not the plot dimensions (in the 3D model) are adjusted automatically.
    `protected Dimension3D` | `dimensions` The plot dimensions in 3D space.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractPlot3D()` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addChangeListener(Plot3DChangeListener listener)` Registers an object for notification of changes to the plot.
    `void` | `datasetChanged(Dataset3DChangeEvent event)` Receives notification of a dataset change, and passes this event on wrapped in a `Plot3DChangeEvent`.
    `boolean` | `equals(java.lang.Object obj)` Tests this plot for equality with an arbitrary object.
    `protected void` | `fireChangeEvent(boolean requiresWorldUpdate)` Sends a `Plot3DChangeEvent` to all registered listeners.
    `abstract java.lang.String` | `generateToolTipText(ItemKey itemKey)` Returns the tool tip text for the specified data item, or `null` if no tool tip is required.
    `Chart3D` | `getChart()` Returns the chart that the plot is assigned to, if any.
    `Dimension3D` | `getDimensions()` Returns the dimensions of the box in 3D space into which the plot will be composed.
    `boolean` | `isAutoAdjustDimensions()` Returns the flag that controls whether or not the plot dimensions are auto-adjusted when the dataset changes.
    `boolean` | `isNotify()` Returns a flag that controls whether or not change events are sent to registered listeners.
    `void` | `notifyListeners(Plot3DChangeEvent event)` Notifies all registered listeners that the plot has been modified.
    `abstract void` | `receive(ChartElementVisitor visitor)` Accepts a `ChartElementVisitor`.
    `void` | `removeChangeListener(Plot3DChangeListener listener)` Unregisters an object for notification of changes to the plot.
    `void` | `setChart(Chart3D chart)` Sets the chart that the plot is assigned to.
    `void` | `setNotify(boolean notify)` Sets a flag that controls whether or not listeners receive `Plot3DChangeEvent` notifications.

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

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

    - ### Methods inherited from interface com.orsoncharts.plot.Plot3D

      `compose, getLegendInfo`

- - ### Field Detail

    - #### dimensions

          protected Dimension3D dimensions

      The plot dimensions in 3D space. By default, this is auto-adjusted according to the dataset, but the user can override this.

    - #### autoAdjustDimensions

          protected boolean autoAdjustDimensions

      A flag that controls whether or not the plot dimensions (in the 3D model) are adjusted automatically.

  - ### Constructor Detail

    - #### AbstractPlot3D

          protected AbstractPlot3D()

      Default constructor.

  - ### Method Detail

    - #### getChart

          public Chart3D getChart()

      Returns the chart that the plot is assigned to, if any.
      Specified by:
        `getChart` in interface `Plot3D`
      Returns:
        The chart (possibly `null`).
      Since:
        1.2

    - #### setChart

          public void setChart(Chart3D chart)

      Sets the chart that the plot is assigned to.
      Specified by:
        `setChart` in interface `Plot3D`
      Parameters:
        `chart` - the chart (`null` permitted).
      Since:
        1.2

    - #### getDimensions

          public Dimension3D getDimensions()

      Returns the dimensions of the box in 3D space into which the plot will be composed. The dimension can change according to the shape of the data.
      Specified by:
        `getDimensions` in interface `Plot3D`
      Returns:
        The dimensions of the plot (never `null`).
      See Also:
        `isAutoAdjustDimensions()`

    - #### isAutoAdjustDimensions

          public boolean isAutoAdjustDimensions()

      Returns the flag that controls whether or not the plot dimensions are auto-adjusted when the dataset changes. Certain subclasses will allow this flag to be changed (`CategoryPlot3D` and `XYZPlot`) while others will always auto-adjust the dimensions (`PiePlot3D`).
      Returns:
        A boolean.

    - #### generateToolTipText

          public abstract java.lang.String generateToolTipText(ItemKey itemKey)

      Returns the tool tip text for the specified data item, or `null` if no tool tip is required.
      Specified by:
        `generateToolTipText` in interface `Plot3D`
      Parameters:
        `itemKey` - the item key (`null` not permitted).
      Returns:
        The tool tip text (possibly `null`).
      Since:
        1.3

    - #### receive

          public abstract void receive(ChartElementVisitor visitor)

      Accepts a `ChartElementVisitor`. This is part of a general purpose mechanism for traversing the chart structure, you won't normally call this method directly.
      Specified by:
        `receive` in interface `ChartElement`
      Parameters:
        `visitor` - the visitor (never `null`).

    - #### equals

          public boolean equals(java.lang.Object obj)

      Tests this plot for equality with an arbitrary object.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the object (`null` permitted).
      Returns:
        A boolean.

    - #### isNotify

          public boolean isNotify()

      Returns a flag that controls whether or not change events are sent to registered listeners.
      Returns:
        A boolean.
      See Also:
        `setNotify(boolean)`

    - #### setNotify

          public void setNotify(boolean notify)

      Sets a flag that controls whether or not listeners receive `Plot3DChangeEvent` notifications.
      Parameters:
        `notify` - a boolean.
      See Also:
        `isNotify()`

    - #### addChangeListener

          public void addChangeListener(Plot3DChangeListener listener)

      Registers an object for notification of changes to the plot.
      Specified by:
        `addChangeListener` in interface `Plot3D`
      Parameters:
        `listener` - the object to be registered.
      See Also:
        `removeChangeListener(Plot3DChangeListener)`

    - #### removeChangeListener

          public void removeChangeListener(Plot3DChangeListener listener)

      Unregisters an object for notification of changes to the plot.
      Specified by:
        `removeChangeListener` in interface `Plot3D`
      Parameters:
        `listener` - the object to be unregistered.
      See Also:
        `addChangeListener(Plot3DChangeListener)`

    - #### notifyListeners

          public void notifyListeners(Plot3DChangeEvent event)

      Notifies all registered listeners that the plot has been modified.
      Parameters:
        `event` - information about the change event.

    - #### fireChangeEvent

          protected void fireChangeEvent(boolean requiresWorldUpdate)

      Sends a `Plot3DChangeEvent` to all registered listeners.
      Parameters:
        `requiresWorldUpdate` - requires the world to be updated?

    - #### datasetChanged

          public void datasetChanged(Dataset3DChangeEvent event)

      Receives notification of a dataset change, and passes this event on wrapped in a `Plot3DChangeEvent`.
      Specified by:
        `datasetChanged` in interface `Dataset3DChangeListener`
      Parameters:
        `event` - the dataset change event.