Class TrackPlottingPanel

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, InteractiveMouseHandler, OSPRuntime.Disposable, Renderable, Tool

public class TrackPlottingPanel extends PlottingPanel implements Tool
This is a plotting panel for a track
Author:
Douglas Brown
See Also:
  • Field Details

    • frame

      protected TFrame frame
    • panelID

      protected Integer panelID
    • trackID

      protected int trackID
    • datasetManager

      protected DatasetManager datasetManager
    • dataset

      protected HighlightableDataset dataset
    • guests

      protected ArrayList<TTrack> guests
    • guestDatasets

      protected HashMap<TTrack,HighlightableDataset> guestDatasets
    • xPopup

      protected JPopupMenu xPopup
    • yPopup

      protected JPopupMenu yPopup
    • linesItem

      protected JCheckBoxMenuItem linesItem
    • pointsItem

      protected JCheckBoxMenuItem pointsItem
    • dataToolItem

      protected JMenuItem dataToolItem
    • dataFunctionListener

      protected Action dataFunctionListener
    • guestListener

      protected Action guestListener
    • xLabel

      protected String xLabel
    • yLabel

      protected String yLabel
    • title

      protected String title
    • xListener

      protected ItemListener xListener
    • yListener

      protected ItemListener yListener
    • plotTrackView

      protected PlotTrackView plotTrackView
    • isCustom

      protected boolean isCustom
    • font

      protected Font font
    • hitRect

      protected Rectangle hitRect
    • plotAxes

      protected org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel.ClickableAxes plotAxes
    • isZoomMode

      protected boolean isZoomMode
    • mouseListener

      protected org.opensourcephysics.cabrillo.tracker.TrackPlottingPanel.PlotMouseListener mouseListener
    • playerListener

      protected PropertyChangeListener playerListener
    • clickedStep

      protected Step clickedStep
    • coordStringBuilder

      protected TCoordinateStringBuilder coordStringBuilder
    • linesItemSelected

      protected boolean linesItemSelected
    • pointsItemSelected

      protected boolean pointsItemSelected
    • bsFrameHighlights

      public final BitSet bsFrameHighlights
  • Constructor Details

    • TrackPlottingPanel

      public TrackPlottingPanel(TTrack track, DatasetManager data)
      Constructs a TrackPlottingPanel for a track.
      Parameters:
      track - the track
      data - the track's data
  • Method Details

    • initAxes

      protected void initAxes()
      Description copied from class: PlottingPanel
      Override to specify a different kind of axes.
      Overrides:
      initAxes in class PlottingPanel
    • send

      public void send(Job job, Tool noReply)
      Description copied from interface: Tool
      Sends a job to this tool and specifies a tool to reply to.
      Specified by:
      send in interface Tool
      Parameters:
      job - the Job
      noReply - the tool to notify when the job is complete (may be null)
    • getDataset

      public HighlightableDataset getDataset()
      Gets the dataset
      Returns:
      the dataset plotted on this panel
    • setXLabel

      public void setXLabel(String label)
      Sets the label for the X (horizontal) axis. Overrides PlottingPanel.
      Overrides:
      setXLabel in class PlottingPanel
      Parameters:
      label - the x label.
    • getXLabel

      public String getXLabel()
      Gets the label for the X (horizontal) axis.
      Returns:
      the x label
    • setYLabel

      public void setYLabel(String label)
      Sets the label for the Y (vertical) axis. Overrides PlottingPanel.
      Overrides:
      setYLabel in class PlottingPanel
      Parameters:
      label - the y label
    • getYLabel

      public String getYLabel()
      Gets the label for the Y (vertical) axis.
      Returns:
      the y label
    • setTitle

      public void setTitle(String title)
      Sets the title.
      Overrides:
      setTitle in class PlottingPanel
      Parameters:
      title - the title.
    • getTitle

      public String getTitle()
      Gets the title.
      Returns:
      the title
    • addGuest

      public void addGuest(TTrack guest)
      Adds a guest track. Guest tracks are plotted along with the main track.
      Parameters:
      guest - the track
    • removeGuest

      public void removeGuest(TTrack guest)
      Removes a guest track.
      Parameters:
      guest - the track
    • scale

      public void scale(ArrayList<Drawable> list)
      Overrides DrawingPanel scale method
      Overrides:
      scale in class DrawingPanel
    • getPopupMenu

      public JPopupMenu getPopupMenu()
      Gets the popup menu.
      Overrides:
      getPopupMenu in class DrawingPanel
    • snapshot

      public void snapshot()
      Creates a snapshot of this plot or, if possible, of the parent TViewChooser.
      Overrides:
      snapshot in class DrawingPanel
    • buildPopupMenu

      protected void buildPopupMenu()
      Builds the default popup menu for this panel.
      Overrides:
      buildPopupMenu in class DrawingPanel
    • selectAction

      protected void selectAction(Object source)
    • findViewRect

      public Rectangle findViewRect()
      Overrides DrawingPanel method to prevent changes to glassPanel and deal with multiple plots.
      Overrides:
      findViewRect in class DrawingPanel
    • showZeroOnAxis

      protected void showZeroOnAxis(String axis)
      Rescales this plot so the zero value is included in the range ymin-ymax.
    • scaleXMin

      protected void scaleXMin()
      Sets the min on the horizontal axis scale.
    • scaleXMax

      protected void scaleXMax()
      Sets the max on the horizontal axis scale.
    • scaleYMin

      protected void scaleYMin()
      Sets the min on the vertical axis scale.
    • scaleYMax

      protected void scaleYMax()
      Sets the max on the vertical axis scale.
    • getOwner

      protected TViewChooser getOwner()
      Gets the TViewChooser that owns (displays) this panel.
      Returns:
      the TViewChooser. May return null.
    • plotData

      protected void plotData()
      Plots the data.
    • refreshDataset

      protected void refreshDataset(HighlightableDataset hds, DatasetManager manager, boolean xIsAngle, boolean yIsAngle, boolean degrees)
      Refreshes the data in a dataset based on current x and y index.
      Parameters:
      hds - the dataset to refresh
      manager - the DatasetManager with the data columns
      xIsAngle - true if the x index is an angle
      yIsAngle - true if the y index is an angle
      degrees - true if angle units are degrees
    • showPlotCoordinates

      protected void showPlotCoordinates(int index)
      Shows plot coordinates at the specified dataset index.
      Parameters:
      index - the index
    • refreshDecimalSeparators

      protected void refreshDecimalSeparators()
      Description copied from class: DrawingPanel
      Refreshes the decimal separators.
      Overrides:
      refreshDecimalSeparators in class DrawingPanel
    • setPreferredMinMax

      public void setPreferredMinMax(double xmin, double xmax, double ymin, double ymax, boolean invalidateImage)
      Sets preferred min/max values. Overrides DrawingPanel method.
      Overrides:
      setPreferredMinMax in class DrawingPanel
      Parameters:
      xmin -
      xmax -
      ymin -
      ymax -
      invalidateImage - invalidates image if min/max have changed
    • setPreferredMinMaxX

      public void setPreferredMinMaxX(double xmin, double xmax)
      Sets preferred min/max x values. Overrides DrawingPanel method.
      Overrides:
      setPreferredMinMaxX in class DrawingPanel
      Parameters:
      xmin -
      xmax -
    • setPreferredMinMaxY

      public void setPreferredMinMaxY(double ymin, double ymax)
      Sets preferred min/max y values. Overrides DrawingPanel method.
      Overrides:
      setPreferredMinMaxY in class DrawingPanel
      Parameters:
      ymin -
      ymax -
    • requestFocusInWindow

      public boolean requestFocusInWindow()
      Overrides requestFocusInWindow. This declines the focus if scale setter is visible.
      Overrides:
      requestFocusInWindow in class JComponent
    • setXVariable

      protected void setXVariable(String name)
      Sets the x variable by name.
      Parameters:
      name - the name of the dataset to plot on the x axis
    • getXVariable

      protected String getXVariable()
      Gets the x variable name.
      Returns:
      the name of the x variable
    • setYVariable

      protected void setYVariable(String name)
      Sets the y variable by name.
      Parameters:
      name - the name of the dataset to plot on the y axis
    • getYVariable

      protected String getYVariable()
      Gets the y variable name.
      Returns:
      the name of the y variable, without the defined information
    • setPlotTrackView

      protected void setPlotTrackView(PlotTrackView view)
      Sets the PlotTrackView that owns this.
      Parameters:
      view - the PlotTrackView
    • createXYPopups

      protected void createXYPopups()
    • createVarItems

      protected void createVarItems()
    • updateVarSelection

      public void updateVarSelection()
    • setVariables

      protected void setVariables()
    • isShowCoordinates

      public boolean isShowCoordinates()
      Description copied from class: DrawingPanel
      Returns true if mouse coordinates are displayed
      Overrides:
      isShowCoordinates in class DrawingPanel
      Returns:
      true if mouse coordinates are displayed
    • getLoader

      public static XML.ObjectLoader getLoader()
      Returns an XML.ObjectLoader to save and load object data.
      Returns:
      the XML.ObjectLoader
    • fireRepaint

      public void fireRepaint(TTrack track)
    • showDataTool

      public void showDataTool()
    • clearPopup

      public void clearPopup()
    • setHighlights

      public void setHighlights(BitSet highlightFrames)
    • repaint

      public void repaint()
      Overrides:
      repaint in class DrawingPanel
    • dispose

      public void dispose()
      Specified by:
      dispose in interface OSPRuntime.Disposable
      Overrides:
      dispose in class InteractivePanel
    • finalize

      public void finalize()
      Overrides:
      finalize in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Component