Class Protractor

All Implemented Interfaces:
PropertyChangeListener, EventListener, Drawable, Interactive, Measurable, Trackable

public class Protractor extends InputTrack
A Protractor measures and displays angular arcs and arm lengths.
Author:
Douglas Brown
  • Field Details

    • dataVariables

      protected static final String[] dataVariables
    • fieldVariables

      protected static final String[] fieldVariables
    • formatVariables

      protected static final String[] formatVariables
    • formatMap

      protected static final Map<String,String[]> formatMap
    • formatDescriptionMap

      protected static final Map<String,String> formatDescriptionMap
    • allVariables

      protected static final ArrayList<String> allVariables
    • attachmentItem

      protected JMenuItem attachmentItem
    • firstDerivSpill

      protected int firstDerivSpill
    • secondDerivSpill

      protected int secondDerivSpill
    • params

      protected int[] params
    • rotationAngle

      protected double[] rotationAngle
    • validData

      protected boolean[] validData
    • derivData

      protected Object[] derivData
  • Constructor Details

    • Protractor

      public Protractor()
      Constructs a Protractor.
  • Method Details

    • getFormatVariables

      public String[] getFormatVariables()
      Specified by:
      getFormatVariables in class TTrack
    • getFormatMap

      public Map<String,String[]> getFormatMap()
      Specified by:
      getFormatMap in class TTrack
    • getFormatDescMap

      public Map<String,String> getFormatDescMap()
      Specified by:
      getFormatDescMap in class TTrack
    • getBaseType

      public String getBaseType()
      Specified by:
      getBaseType in class TTrack
    • getVarDimsImpl

      public String getVarDimsImpl(String variable)
      Specified by:
      getVarDimsImpl in class TTrack
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Responds to property change events. Overrides TTrack method.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Overrides:
      propertyChange in class TTrack
      Parameters:
      e - the property change event
    • createStep

      public Step createStep(int n, double x, double y)
      Implements createStep but only mimics step creation since steps are created automatically by the autofill StepArray.
      Specified by:
      createStep in class TTrack
      Parameters:
      n - the frame number
      x - the x coordinate in image space
      y - the y coordinate in image space
      Returns:
      the step
    • createStep

      public Step createStep(int n, double x1, double y1, double x2, double y2)
      Mimics step creation by setting end positions of an existing step.
      Parameters:
      n - the frame number
      x1 - the x coordinate of end1 in image space
      y1 - the y coordinate of end1 in image space
      x2 - the x coordinate of end2 in image space
      y2 - the y coordinate of end2 in image space
      Returns:
      the step
    • autoMarkAt

      public TPoint autoMarkAt(int n, double x, double y)
      Used by autoTracker to mark a step at a match target position.
      Overrides:
      autoMarkAt in class TTrack
      Parameters:
      n - the frame number
      x - the x target coordinate in image space
      y - the y target coordinate in image space
      Returns:
      the TPoint that was automarked
    • getStepLength

      public int getStepLength()
      Gets the length of the steps created by this track.
      Specified by:
      getStepLength in class TTrack
      Returns:
      the footprint length
    • isAutoTrackable

      protected boolean isAutoTrackable()
      Determines if any point in this track is autotrackable.
      Overrides:
      isAutoTrackable in class TTrack
      Returns:
      true if autotrackable
    • getTargetDescription

      protected String getTargetDescription(int pointIndex)
      Returns a description of a target point with a given index.
      Overrides:
      getTargetDescription in class TTrack
      Parameters:
      pointIndex - the index
      Returns:
      the description
    • getFootprintLength

      public int getFootprintLength()
      Gets the length of the footprints required by this track.
      Specified by:
      getFootprintLength in class TTrack
      Returns:
      the footprint length
    • refreshData

      protected void refreshData(DatasetManager data, TrackerPanel trackerPanel)
      Refreshes the data.
      Overrides:
      refreshData in class TTrack
      Parameters:
      data - the DatasetManager
      trackerPanel - the tracker panel
    • getRotationData

      protected Object[] getRotationData()
      Gets the rotational data.
      Returns:
      Object[] {theta, omega, alpha}
    • getAttachmentDescription

      public String getAttachmentDescription(int n)
      Returns the description of a particular attachment point.
      Overrides:
      getAttachmentDescription in class TTrack
      Parameters:
      n - the attachment point index
      Returns:
      the description
    • getMenu

      public JMenu getMenu(TrackerPanel trackerPanel, JMenu menu0)
      Returns a menu with items that control this track.
      Overrides:
      getMenu in class TTrack
      Parameters:
      trackerPanel - the tracker panel
      menu0 - the menu. If null, a dynamic menu is returned that adds items only when selected
      Returns:
      a menu
    • getToolbarTrackComponents

      public ArrayList<Component> getToolbarTrackComponents(TrackerPanel trackerPanel)
      Returns a list of point-related toolbar components.
      Overrides:
      getToolbarTrackComponents in class TTrack
      Parameters:
      trackerPanel - the tracker panel
      Returns:
      a list of components
    • findInteractive

      public Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
      Implements findInteractive method.
      Specified by:
      findInteractive in interface Interactive
      Overrides:
      findInteractive in class TTrack
      Parameters:
      panel - the drawing panel
      xpix - the x pixel position on the panel
      ypix - the y pixel position on the panel
      Returns:
      the first step or motion vector that is hit
    • toString

      public String toString()
      Overrides Object toString method.
      Overrides:
      toString in class TTrack
      Returns:
      the name of this track
    • getNumberFields

      public Map<String,NumberField[]> getNumberFields()
      Description copied from class: TTrack
      Gets a map of number fields by name.
      Overrides:
      getNumberFields in class TTrack
      Returns:
      a map of name to NumberField.
    • getInputFieldPopup

      protected JPopupMenu getInputFieldPopup()
      Returns a popup menu for the input field (readout).
      Returns:
      the popup menu
    • setTrackerPanel

      public void setTrackerPanel(TrackerPanel panel)
      Overrides TTrack setTrackerPanel method.
      Overrides:
      setTrackerPanel in class InputTrack
      Parameters:
      panel - the TrackerPanel
    • setAnglesInRadians

      protected void setAnglesInRadians(boolean radians)
      Overrides TTrack method.
      Overrides:
      setAnglesInRadians in class TTrack
      Parameters:
      radians - true for radians, false for degrees
    • getRuler

      protected Ruler getRuler()
      Description copied from class: InputTrack
      Gets the Ruler. Subclasses override to return the appropriate Ruler type.
      Overrides:
      getRuler in class InputTrack
      Returns:
      the Ruler
    • refreshStep

      protected void refreshStep(Step step)
      Refreshes a step by setting it equal to a keyframe step.
      Specified by:
      refreshStep in class InputTrack
      Parameters:
      step - the step to refresh
    • createInputField

      protected NumberField createInputField()
      Specified by:
      createInputField in class InputTrack
    • getLayoutBounds

      protected Rectangle getLayoutBounds(Step step)
      Specified by:
      getLayoutBounds in class InputTrack
    • checkKeyFrame

      protected boolean checkKeyFrame()
      Specified by:
      checkKeyFrame in class InputTrack
    • endEditing

      protected void endEditing(Step step, String rawText)
      Specified by:
      endEditing in class InputTrack
    • setInputValue

      protected void setInputValue(Step step)
      Specified by:
      setInputValue in class InputTrack
    • getLoader

      public static XML.ObjectLoader getLoader()
      Returns an ObjectLoader to save and load data for this class.
      Returns:
      the object loader