Class TapeMeasure

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

public class TapeMeasure extends InputTrack implements MarkingRequired
A TapeMeasure measures and displays its world length and its angle relative to the positive x-axis. It is used to set the scale and angle of an ImageCoordSystem.
Author:
Douglas Brown
  • Field Details

    • MIN_LENGTH

      protected static final double MIN_LENGTH
      See Also:
    • BROKEN_LINE

      public static final float[] BROKEN_LINE
    • dataVariables

      protected static final String[] dataVariables
    • 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
    • fixedLength

      protected boolean fixedLength
    • readOnly

      protected boolean readOnly
    • stickMode

      protected boolean stickMode
    • isStepChangingScale

      protected boolean isStepChangingScale
    • notYetShown

      protected boolean notYetShown
    • isIncomplete

      protected boolean isIncomplete
    • isCalibrator

      protected boolean isCalibrator
    • end1Label

      protected JLabel end1Label
    • end2Label

      protected JLabel end2Label
    • lengthLabel

      protected JLabel lengthLabel
    • tapeFootprints

      protected Footprint[] tapeFootprints
    • stickFootprints

      protected Footprint[] stickFootprints
    • lengthKeyFrames

      protected TreeSet<Integer> lengthKeyFrames
    • attachmentItem

      protected JMenuItem attachmentItem
    • calibrationLength

      protected Double calibrationLength
  • Constructor Details

    • TapeMeasure

      public TapeMeasure()
      Constructs a TapeMeasure.
  • 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
    • setFixedLength

      public void setFixedLength(boolean fixed)
      Sets the fixed length property. When it is fixed, it has the same world length at all times. Applies to sticks only.
      Parameters:
      fixed - true to fix the length
    • isFixedLength

      public boolean isFixedLength()
      Gets the fixed length property.
      Returns:
      true if length is fixed
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Sets the readOnly property. When true, the scale and angle are not settable.
      Parameters:
      readOnly - true to prevent editing
    • isReadOnly

      public boolean isReadOnly()
      Gets the ReadOnly property.
      Returns:
      true if read-only
    • setStickMode

      public void setStickMode(boolean stick)
      Sets the stickMode property. When true, the 'stick" has constant world length and the scale changes when you drag the mouse. When false, the "tape" stretches without changing the scale when you drag the mouse.
      Parameters:
      stick - true for stick mode, false for tape mode
    • isStickMode

      public boolean isStickMode()
      Gets the stickMode property.
      Returns:
      true if in stick mode
    • setCalibrator

      public void setCalibrator(Double worldLength)
      Sets this to be a calibration tape or stick.
      Parameters:
      worldLength - the initial length of a calibration stick (ignored by tape)
    • isMarkByDefault

      public boolean isMarkByDefault()
      Description copied from class: TTrack
      Gets the markByDefault property. When true, the mouse handler should mark a point whenever the active track reports itself incomplete.
      Overrides:
      isMarkByDefault in class TTrack
      Returns:
      true if this marks by default
    • requiresMarking

      public boolean requiresMarking()
      Implements MarkingRequired interface.
      Specified by:
      requiresMarking in interface MarkingRequired
    • setLocked

      public void setLocked(boolean locked)
      Overrides TTrack method.
      Overrides:
      setLocked in class TTrack
      Parameters:
      locked - true to lock this
    • 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
    • setVisible

      public void setVisible(boolean visible)
      Overrides TTrack setVisible method to change notYetShown flag.
      Overrides:
      setVisible in class TTrack
      Parameters:
      visible - true to show this track
    • isLocked

      public boolean isLocked()
      Overrides TTrack isLocked method.
      Overrides:
      isLocked in class TTrack
      Returns:
      true if this is locked
    • 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. If no existing step, creates one and autofills array
      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
    • getFootprintLength

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

      public String getFormattedLength(double length)
      Formats the specified length value.
      Parameters:
      length - the length value to format
      Returns:
      the formatted length string
    • isViewable

      public boolean isViewable()
      Reports whether or not this is viewable.
      Overrides:
      isViewable in class TTrack
      Returns:
      true if this track is viewable
    • isAutoTrackable

      protected boolean isAutoTrackable()
      Determines if at least one 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
    • 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
    • getMenuItems

      protected void getMenuItems()
      Overrides:
      getMenuItems in class TTrack
    • 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
    • refreshData

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

      public void remark(Integer panelID)
      Remarks all steps on the specified panel. Overrides TTrack method.
      Overrides:
      remark in class TTrack
      Parameters:
      trackerPanel - the tracker panel
    • 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
    • setFontLevel

      public void setFontLevel(int level)
      Description copied from class: TTrack
      Sets the font level.
      Overrides:
      setFontLevel in class InputTrack
      Parameters:
      level - the desired font level
    • setTrackerPanel

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

      protected void refreshWorldLengths()
      Refreshes world lengths at all steps based on current ends and scale.
    • isFieldsEnabled

      protected boolean isFieldsEnabled()
      Determines if the input fields are enabled.
      Returns:
      true if enabled
    • 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 the previous 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