Class PlotDisplay<P,A>

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
uk.ac.starlink.ttools.plot2.task.PlotDisplay<P,A>
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

public class PlotDisplay<P,A> extends JComponent
Graphical component which displays a gang of one or more plots. The plots are in general 'live', and may repaint themselves differently over the lifetime of the component according to user navigation actions, window size, and underlying data, depending on configuration.

Note: The paintComponent method of this class performs time-consuming operations, so it will tie up the Event Dispatch Thread. It is therefore not suitable as it stands for use as part of a general-purpose GUI application.

This class can be used as-is, or as a template.

Since:
1 Mar 2013
Author:
Mark Taylor
See Also:
  • Field Details

    • ASPECTS_PROPERTY

      public static final String ASPECTS_PROPERTY
      Name of property that changes when plot Aspects are reset. Can be monitored by use of a PropertyChangeListener. The property object type is an array of aspects, that is of this class's parameterised type A[].
      See Also:
  • Constructor Details

    • PlotDisplay

      public PlotDisplay(PlotScene<P,A> scene, Navigator<A> navigator, DataStore dataStore)
      Constructor.
      Parameters:
      scene - plot scene
      navigator - user gesture navigation controller, or null for a non-interactive plot
      dataStore - data storage object
  • Method Details

    • getScene

      public PlotScene<P,A> getScene()
      Returns the PlotScene on which this component is based.
      Returns:
      scene
    • addPointSelectionListener

      public void addPointSelectionListener(PointSelectionListener psl)
      Adds a listener which will be notified when the user clicks on the plot region to select a point.
      Parameters:
      psl - listener to add
    • removePointSelectionListener

      public void removePointSelectionListener(PointSelectionListener psl)
      Removes a previously added point selection listener.
      Parameters:
      psl - listener to remove
    • invalidate

      public void invalidate()
      Overrides:
      invalidate in class Container
    • paintComponent

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

      @Slow public static <P, A> PlotDisplay<P,A> createPlotDisplay(PlotLayer[] layers, SurfaceFactory<P,A> surfFact, ConfigMap config, Trimming trimming, ShadeAxisKit shadeKit, PaperTypeSelector ptSel, Compositor compositor, Padding padding, DataStore dataStore, boolean navigable, PlotCaching caching)
      Utility method to construct a single-zoned PlotDisplay, with profile, aspect and navigator obtained from a supplied config map. This will perform ranging from data if it is required; in that case, it may take time to execute.
      Parameters:
      layers - layers constituting plot content
      surfFact - surface factory
      config - map containing surface profile, initial aspect and navigator configuration
      trimming - additional decoration specification, or null
      shadeKit - makes shader axis, or null if not required
      ptSel - paper type selector
      compositor - compositor for pixel composition
      padding - user requirements for external space
      dataStore - data storage object
      navigable - true for an interactive plot
      caching - plot caching policy
      Returns:
      new plot component