org.opensourcephysics.cabrillo.tracker
Class Protractor

java.lang.Object
  extended by org.opensourcephysics.cabrillo.tracker.TTrack
      extended by org.opensourcephysics.cabrillo.tracker.Protractor
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, Drawable, Interactive, Measurable, Trackable

public class Protractor
extends TTrack

A Protractor measures and displays an angular arc.

Author:
Douglas Brown

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
TTrack.StepArray
 
Field Summary
protected  javax.swing.JMenuItem attachmentItem
           
protected  boolean editing
           
protected  java.awt.event.MouseListener editListener
           
protected  javax.swing.JCheckBoxMenuItem fixedItem
           
protected  boolean fixedPosition
           
protected  java.text.NumberFormat format
           
protected  javax.swing.JPanel glassPanel
           
protected  DecimalField inputField
           
protected  javax.swing.JPanel inputPanel
           
 
Fields inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
alphabet, angleField, angleLabel, angleSeparator, attachments, autoAdvance, autoAdvanceItem, autoTrackerMarking, circleFootprintListener, clearStepsItem, closeButton, colorItem, constantsLoadedFromXML, data, dataBuilderItem, dataDescriptions, dataFrames, dataProp, dataValid, defaultColors, defaultFootprint, deleteStepItem, deleteTrackItem, description, descriptionItem, enabled, fieldBorder, footprint, footprintListener, footprintMenu, footprints, frc, hint, isMarking, keyFrames, labelFont, locked, lockedItem, magField, magLabel, magSeparator, markByDefault, markByDefaultItem, menu, name, nameAction, nameDialog, nameField, nameItem, panels, partName, point, preferredColumnOrder, properties, refreshDataLater, skippedStepWarningCheckbox, skippedStepWarningDialog, skippedStepWarningOn, skippedStepWarningTextpane, stepLabel, steps, stepSeparator, stepSizeWhenFirstMarked, stepValueLabel, support, targetIndex, textColumnEntries, textColumnNames, tField, tLabel, toolbarPointComponents, toolbarTrackComponents, trackerPanel, trailLength, trailVisible, trailVisibleItem, tSeparator, tValueLabel, viewable, visible, visibleItem, worldBounds, xField, xLabel, xSeparator, xSpinner, yField, yLabel, ySeparator, ySpinner
 
Constructor Summary
Protractor()
          Constructs a Protractor.
 
Method Summary
 TPoint autoMarkAt(int n, double x, double y)
          Used by autoTracker to mark a step at a match target position.
 Step createStep(int n, double x, double y)
          Implements createStep but only mimics step creation since steps are created automatically by the autofill StepArray.
 Step createStep(int n, double x1, double y1, double x2, double y2)
          Mimics step creation by setting end positions of an existing step.
 Step deleteStep(int n)
          Overrides TTrack deleteStep method to prevent deletion.
 Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
          Implements findInteractive method.
 int getFootprintLength()
          Gets the length of the footprints required by this track.
static XML.ObjectLoader getLoader()
          Returns an ObjectLoader to save and load data for this class.
 javax.swing.JMenu getMenu(TrackerPanel trackerPanel)
          Returns a menu with items that control this track.
 Step getStep(int n)
          Overrides TTrack getStep method to provide fixed behavior.
 int getStepLength()
          Gets the length of the steps created by this track.
protected  java.lang.String getTargetDescription(int pointIndex)
          Returns a description of a target point with a given index.
 java.util.ArrayList<java.awt.Component> getToolbarTrackComponents(TrackerPanel trackerPanel)
          Returns a list of point-related toolbar components.
protected  boolean isAutoTrackable()
          Determines if any point in this track is autotrackable.
protected  boolean isAutoTrackable(int pointIndex)
          Determines if the given point index is autotrackable.
 boolean isFixed()
          Gets the fixed property.
 void propertyChange(java.beans.PropertyChangeEvent e)
          Responds to property change events.
protected  void refreshData(DatasetManager data, TrackerPanel trackerPanel)
          Refreshes the data.
protected  void refreshStep(ProtractorStep step)
          Refreshes a step by setting it equal to a keyframe step.
protected  void setAnglesInRadians(boolean radians)
          Overrides TTrack method.
 void setFixed(boolean fixed)
          Sets the fixed property.
protected  void setTrackerPanel(TrackerPanel panel)
          Overrides TTrack setTrackerPanel method.
 void setTrailVisible(boolean visible)
          Overrides TTrack setTrailVisible method to keep trails hidden.
 java.lang.String toString()
          Overrides Object toString method.
 
Methods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFootprint, addPropertyChangeListener, addPropertyChangeListener, addTextColumn, chooseColor, cleanup, convertTextToDataColumn, createWarningDialog, delete, draw, erase, erase, firePropertyChange, getColor, getData, getDataDescription, getDataName, getDescription, getFootprint, getFootprint, getFootprints, getFootprints, getFrameForData, getMarkedPoint, getMarkingCursor, getMessage, getName, getNextVisibleStep, getPreferredDataOrder, getPreviousVisibleStep, getProperty, getPropertyNames, getSkippedStepWarningDialog, getStep, getSteps, getStepSizeWarningDialog, getTargetIndex, getTextColumnEntry, getTextColumnNames, getToolbarPointComponents, getTrailLength, getWorldBounds, getX, getXMax, getXMax, getXMin, getXMin, getY, getYMax, getYMax, getYMin, getYMin, isAutoAdvance, isDependent, isEmpty, isEnabled, isLocked, isMarkByDefault, isMeasured, isStepComplete, isStepVisible, isTrailVisible, isViewable, isVisible, refreshData, remark, remark, removePropertyChangeListener, removePropertyChangeListener, removeTextColumn, renameTextColumn, repaint, repaint, repaint, setAutoAdvance, setColor, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFontLevel, setFootprint, setFootprint, setFootprints, setFootprints, setLocked, setMarkByDefault, setMarking, setName, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, setTextColumnEntry, setTrailLength, setViewable, setVisible, setX, setXY, setY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fixedPosition

protected boolean fixedPosition

fixedItem

protected javax.swing.JCheckBoxMenuItem fixedItem

attachmentItem

protected javax.swing.JMenuItem attachmentItem

editing

protected boolean editing

inputField

protected final DecimalField inputField

inputPanel

protected javax.swing.JPanel inputPanel

glassPanel

protected javax.swing.JPanel glassPanel

format

protected java.text.NumberFormat format

editListener

protected java.awt.event.MouseListener editListener
Constructor Detail

Protractor

public Protractor()
Constructs a Protractor.

Method Detail

setFixed

public void setFixed(boolean fixed)
Sets the fixed property. When fixed, it has the same position at all times.

Parameters:
fixed - true to fix

isFixed

public boolean isFixed()
Gets the fixed property.

Returns:
true if fixed

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Responds to property change events. Overrides TTrack method.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class TTrack
Parameters:
e - the property change event

setTrailVisible

public void setTrailVisible(boolean visible)
Overrides TTrack setTrailVisible method to keep trails hidden.

Overrides:
setTrailVisible in class TTrack
Parameters:
visible - ignored

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

deleteStep

public Step deleteStep(int n)
Overrides TTrack deleteStep method to prevent deletion.

Overrides:
deleteStep in class TTrack
Parameters:
n - the frame number
Returns:
the deleted step

getStep

public Step getStep(int n)
Overrides TTrack getStep method to provide fixed behavior.

Overrides:
getStep in class TTrack
Parameters:
n - the frame number
Returns:
the step

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

isAutoTrackable

protected boolean isAutoTrackable(int pointIndex)
Determines if the given point index is autotrackable.

Overrides:
isAutoTrackable in class TTrack
Parameters:
pointIndex - the points[] index
Returns:
true if autotrackable

getTargetDescription

protected java.lang.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

getMenu

public javax.swing.JMenu getMenu(TrackerPanel trackerPanel)
Returns a menu with items that control this track.

Overrides:
getMenu in class TTrack
Parameters:
trackerPanel - the tracker panel
Returns:
a menu

getToolbarTrackComponents

public java.util.ArrayList<java.awt.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 java.lang.String toString()
Overrides Object toString method.

Overrides:
toString in class TTrack
Returns:
the name of this track

setTrackerPanel

protected void setTrackerPanel(TrackerPanel panel)
Overrides TTrack setTrackerPanel method.

Overrides:
setTrackerPanel in class TTrack
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

refreshStep

protected void refreshStep(ProtractorStep step)
Refreshes a step by setting it equal to a keyframe step.

Parameters:
step - the step to refresh

getLoader

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

Returns:
the object loader