java.lang.Object
org.opensourcephysics.cabrillo.tracker.Step
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
CalibrationStep, CircleFitterStep, CoordAxesStep, LineProfileStep, OffsetOriginStep, PerspectiveStep, PositionStep, ProtractorStep, RGBStep, TapeStep, VectorStep

public abstract class Step extends Object implements Cloneable
A Step is associated with a single frame of a TTrack. It contains an array of TPoints that define its image data and a Footprint that determines its screen appearance. This is an abstract class and cannot be instantiated directly.
Author:
Douglas Brown
  • Field Details

    • hitRect

      protected static final Rectangle hitRect
    • selectionShape

      protected static Shape selectionShape
    • selectionStroke

      protected static Stroke selectionStroke
    • transform

      protected static final AffineTransform transform
    • format

      protected static final NumberFormat format
    • trackID

      protected int trackID
    • n

      protected int n
    • footprint

      protected Footprint footprint
    • points

      protected TPoint[] points
    • screenPoints

      protected Point[] screenPoints
    • valid

      protected boolean valid
    • panelMarks

      protected Map<Integer,Mark> panelMarks
    • defaultIndex

      protected int defaultIndex
    • dataVisible

      protected boolean dataVisible
    • type

      public int type
    • TYPE_ACCELERATION

      public static final int TYPE_ACCELERATION
      See Also:
    • TYPE_VELOCITY

      public static final int TYPE_VELOCITY
      See Also:
    • TYPE_UNKNOWN

      public static final int TYPE_UNKNOWN
      See Also:
  • Constructor Details

    • Step

      protected Step(TTrack track, int n)
      Constructs a Step with the specified frame number.
      Parameters:
      track - the track
      n - the frame number
  • Method Details

    • getFrameNumber

      public int getFrameNumber()
      Gets the frame number.
      Returns:
      the frame number
    • setFootprint

      public void setFootprint(Footprint footprint)
      Sets the footprint.
      Parameters:
      footprint - the footprint
    • getTrack

      public TTrack getTrack()
      Gets the track.
      Returns:
      the track
    • getPoints

      public TPoint[] getPoints()
      Gets the array of TPoints contained in this step.
      Returns:
      the TPoints array
    • getPointIndex

      public int getPointIndex(TPoint p)
      Gets the index of a point in the points[] array.
      Parameters:
      p - the point
      Returns:
      the index, or -1 if not found
    • getDefaultPoint

      public TPoint getDefaultPoint()
      Gets the default point. The default point is the point initially selected when the step is created.
      Returns:
      the default TPoint
    • setDefaultPointIndex

      public void setDefaultPointIndex(int index)
      Sets the default point index. This defines the index of the points array used to get the point initially selected when the step is created.
      Parameters:
      index - the index
    • erase

      public void erase(Integer panelID)
      Erases this on the specified tracker panel. Erasing adds the current bounds to the dirty region and nulls the step's mark to trigger creation of a new one.
      Parameters:
      trackerPanel - the tracker panel
    • remark

      public void remark(Integer panelID)
      Erases and remarks this on the specified tracker panel. Remarking creates a new mark for the step and adds both the old and new bounds to the tracker panel's dirty region.
      Parameters:
      trackerPanel - the tracker panel
    • repaint

      public void repaint(Integer panelID)
      Repaints this on the specified tracker panel. Repainting a step first remarks it and then requests a repaint of the panel's dirty region.
      Parameters:
      trackerPanel - the tracker panel
    • erase

      public void erase()
      Erases this on all tracker panels.
    • remark

      public void remark()
      Remarks this on all tracker panels.
    • repaint

      public void repaint()
      Repaints this on all tracker panels.
    • dispose

      protected void dispose()
      Disposes of this step.
    • draw

      public void draw(DrawingPanel panel, Graphics g)
      Draws this step.
      Parameters:
      panel - the drawing panel requesting the drawing
      g - the graphics context on which to draw
    • findInteractive

      public Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
      Finds the Interactive located at the specified pixel position.
      Parameters:
      panel - the drawing panel
      xpix - the x pixel position
      ypix - the y pixel position
      Returns:
      the TPoint that is hit, or null
    • getMark

      protected Mark getMark(TrackerPanel trackerPanel)
      Gets the mark for the specified panel.
      Parameters:
      trackerPanel - the tracker panel
      Returns:
      the mark
    • toString

      public String toString()
      Returns a String describing this step.
      Overrides:
      toString in class Object
      Returns:
      a descriptive string
    • clone

      public Object clone()
      Clones this Step.
      Overrides:
      clone in class Object
      Returns:
      a clone of this step
    • setHitRectCenter

      protected void setHitRectCenter(int xpix, int ypix)
      Centers the hit testing rectangle on the specified screen point.
      Parameters:
      xpix - the x pixel position
      ypix - the y pixel position
    • getLength

      public static int getLength()
      Gets the step length. Default length is 1.
      Returns:
      the length of the points array