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  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, autoAdvance, autoAdvanceItem, autoTrackerMarking, circleFootprintListener, clearStepsItem, closeButton, colorItem, constantsLoadedFromXML, data, dataBuilderItem, dataFrames, dataProp, dataValid, defaultColors, defaultFootprint, deleteItem, 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, 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
 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 getDefaultAutoTrackerIndex()
          Gets the default step point index.
 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.
 java.util.ArrayList<java.awt.Component> getToolbarTrackComponents(TrackerPanel trackerPanel)
          Returns a list of point-related toolbar components.
 boolean isFixed()
          Gets the fixed property.
 void propertyChange(java.beans.PropertyChangeEvent e)
          Responds to property change events.
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, autoMarkAt, cleanup, 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, getTargetDescription, getTargetIndex, getToolbarPointComponents, getTrailLength, getWorldBounds, getX, getXMax, getXMax, getXMin, getXMin, getY, getYMax, getYMax, getYMin, getYMin, isAutoAdvance, isAutoTrackable, isAutoTrackable, isDependent, isEmpty, isEnabled, isLocked, isMarkByDefault, isMeasured, isStepComplete, isStepVisible, isTrailVisible, isViewable, isVisible, refreshData, refreshData, remark, remark, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, setAutoAdvance, setColor, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFootprint, setFootprint, setFootprints, setFootprints, setLocked, setMarkByDefault, setMarking, setName, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, 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

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

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

getDefaultAutoTrackerIndex

public int getDefaultAutoTrackerIndex()
Gets the default step point index.

Specified by:
getDefaultAutoTrackerIndex in class TTrack
Returns:
the step pint index

getFootprintLength

public int getFootprintLength()
Gets the length of the footprints required by this track.

Specified by:
getFootprintLength in class TTrack
Returns:
the footprint length

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