Class SurfacePlot

All Implemented Interfaces:
ImageObserver, MenuContainer, Printable, Serializable
Direct Known Subclasses:
DensityPlot, Histogram, ScatterPlot

public abstract class SurfacePlot extends TablePlot implements Printable
Abstract superclass for plot components which display on a PlotSurface. Note that the PlotSurface is not specified in the constructor but must be set before any plotting is done. This class mainly handles keeping track of the current state (PlotState and PlotSurface members). The actual work is done by the paintComponent method of concrete subclasses.

The details of the plot are determined by a PlotState object which indicates what the plot will look like. Setting these values does not itself trigger a change in the component, they only take effect when paintComponent(java.awt.Graphics) is called (e.g. following a JComponent.repaint(long, int, int, int, int) call). The drawing of axes and other decorations is done by a decoupled PlotSurface object (bridge pattern).

Since:
11 Nov 2005
Author:
Mark Taylor
See Also:
  • Constructor Details

    • SurfacePlot

      protected SurfacePlot()
      Constructor.
  • Method Details

    • setSurface

      public void setSurface(PlotSurface surface)
      Sets the plotting surface which draws axes and other decorations that form the background to the actual plotted points. This must be called before the component is drawn.
      Parameters:
      surface - plotting surface implementation
    • getSurface

      public PlotSurface getSurface()
      Returns the plotting surface on which this component displays.
      Returns:
      plotting surface
    • getPlotBounds

      public Rectangle getPlotBounds()
      Description copied from class: TablePlot
      Returns the bounds of the actual plot. This may be used for visual alignment of some items in the window. It is permissible to return just the bounds of the plot component itself, but alignment of other components (legends) may look better if the bounds of the actual plotting region (for instance, excluding external axis labels) is returned.
      Specified by:
      getPlotBounds in class TablePlot
      Returns:
      plot region bounds
    • setState

      public void setState(PlotState state)
      Description copied from class: TablePlot
      Sets the plot state for this plot. This characterises how the plot will be done next time this component is painted.
      Overrides:
      setState in class TablePlot
      Parameters:
      state - plot state
    • setFont

      public void setFont(Font font)
      Overrides:
      setFont in class JComponent
    • print

      public int print(Graphics g, PageFormat pf, int pageIndex)
      Implements the Printable interface. At time of writing, this method is not used by TOPCAT, though it could be; in particular it is not used to implement the export to EPS functionality. The code is mostly pinched from SPLAT.
      Specified by:
      print in interface Printable
    • paintComponent

      protected void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent