org.opensourcephysics.cabrillo.tracker
Class TTrack

java.lang.Object
  extended by org.opensourcephysics.cabrillo.tracker.TTrack
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, Drawable, Interactive, Measurable, Trackable
Direct Known Subclasses:
Calibration, CoordAxes, LineProfile, OffsetOrigin, PerspectiveTrack, PointMass, Protractor, RGBRegion, TapeMeasure, Vector

public abstract class TTrack
extends java.lang.Object
implements Interactive, Trackable, java.beans.PropertyChangeListener

A TTrack draws a series of visible Steps on a TrackerPanel. This is an abstract class that cannot be instantiated directly.

Author:
Douglas Brown

Nested Class Summary
protected  class TTrack.StepArray
           
 
Field Summary
protected static java.lang.String alphabet
           
protected  DecimalField angleField
           
protected  javax.swing.JLabel angleLabel
           
protected  java.awt.Component angleSeparator
           
protected  TTrack[] attachments
           
protected  boolean autoAdvance
           
protected  javax.swing.JCheckBoxMenuItem autoAdvanceItem
           
protected  boolean autoTrackerMarking
           
protected  java.awt.event.ActionListener circleFootprintListener
           
protected  javax.swing.JMenuItem clearStepsItem
           
protected static javax.swing.JButton closeButton
           
protected  javax.swing.JMenuItem colorItem
           
protected  java.lang.Object[][] constantsLoadedFromXML
           
protected  DatasetManager data
           
protected  javax.swing.JMenuItem dataBuilderItem
           
protected  java.lang.String[] dataDescriptions
           
protected  java.util.ArrayList<java.lang.Integer> dataFrames
           
protected  XMLProperty dataProp
           
protected  boolean dataValid
           
protected  java.awt.Color[] defaultColors
           
protected  Footprint defaultFootprint
           
protected  javax.swing.JMenuItem deleteStepItem
           
protected  javax.swing.JMenuItem deleteTrackItem
           
protected  java.lang.String description
           
protected  javax.swing.JMenuItem descriptionItem
           
protected  boolean enabled
           
protected  javax.swing.border.Border fieldBorder
           
protected  Footprint footprint
           
protected  java.awt.event.ActionListener footprintListener
           
protected  javax.swing.JMenu footprintMenu
           
protected  Footprint[] footprints
           
protected static java.awt.font.FontRenderContext frc
           
protected  java.lang.String hint
           
protected  boolean isMarking
           
protected  java.util.TreeSet<java.lang.Integer> keyFrames
           
protected  java.awt.Font labelFont
           
protected  boolean locked
           
protected  javax.swing.JCheckBoxMenuItem lockedItem
           
protected  NumberField magField
           
protected  javax.swing.JLabel magLabel
           
protected  java.awt.Component magSeparator
           
protected  boolean markByDefault
           
protected  javax.swing.JCheckBoxMenuItem markByDefaultItem
           
protected  javax.swing.JMenu menu
           
protected  java.lang.String name
           
protected  javax.swing.Action nameAction
           
protected  javax.swing.JDialog nameDialog
           
protected  javax.swing.JTextField nameField
           
protected  javax.swing.JMenuItem nameItem
           
protected  java.util.Collection<TrackerPanel> panels
           
protected  java.lang.String partName
           
protected  java.awt.geom.Point2D point
           
protected  int[] preferredColumnOrder
           
protected  java.util.HashMap<java.lang.String,java.lang.Object> properties
           
protected  boolean refreshDataLater
           
protected static javax.swing.JCheckBox skippedStepWarningCheckbox
           
protected static javax.swing.JDialog skippedStepWarningDialog
           
protected static boolean skippedStepWarningOn
           
protected static javax.swing.JTextPane skippedStepWarningTextpane
           
protected  javax.swing.JLabel stepLabel
           
protected  TTrack.StepArray steps
           
protected  java.awt.Component stepSeparator
           
protected  int stepSizeWhenFirstMarked
           
protected  javax.swing.JLabel stepValueLabel
           
protected  java.beans.PropertyChangeSupport support
           
protected  int targetIndex
           
protected  NumberField tField
           
protected  javax.swing.JLabel tLabel
           
protected  java.util.ArrayList<java.awt.Component> toolbarPointComponents
           
protected  java.util.ArrayList<java.awt.Component> toolbarTrackComponents
           
protected  TrackerPanel trackerPanel
           
protected  int trailLength
           
protected  boolean trailVisible
           
protected  javax.swing.JCheckBoxMenuItem trailVisibleItem
           
protected  java.awt.Component tSeparator
           
protected  javax.swing.JLabel tValueLabel
           
protected  boolean viewable
           
protected  boolean visible
           
protected  javax.swing.JCheckBoxMenuItem visibleItem
           
protected  java.util.HashMap<TrackerPanel,double[]> worldBounds
           
protected  NumberField xField
           
protected  javax.swing.JLabel xLabel
           
protected  java.awt.Component xSeparator
           
protected  javax.swing.JSpinner xSpinner
           
protected  NumberField yField
           
protected  javax.swing.JLabel yLabel
           
protected  java.awt.Component ySeparator
           
protected  javax.swing.JSpinner ySpinner
           
 
Constructor Summary
protected TTrack()
          Constructs a TTrack.
 
Method Summary
 void addFootprint(Footprint footprint)
          Adds a new footprint to the current choices.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener for a specified property.
 TPoint autoMarkAt(int n, double x, double y)
          Used by autoTracker to mark a step at a match target position.
protected  void cleanup()
          Cleans up associated resources when this track is deleted or cleared.
abstract  Step createStep(int n, double x, double y)
          Creates a new step.
protected  void createWarningDialog()
           
 void delete()
          Removes this track from all panels that draw it.
 Step deleteStep(int n)
          Deletes a step.
 void draw(DrawingPanel panel, java.awt.Graphics _g)
          Draws the steps on the tracker panel.
 void erase()
          Erases all steps on all panels.
 void erase(TrackerPanel trackerPanel)
          Erases all steps on the specified panel.
 Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
          Finds the interactive drawable object located at the specified pixel position.
 void firePropertyChange(java.lang.String name, java.lang.Object oldVal, java.lang.Object newVal)
          Fires a property change event.
 java.awt.Color getColor()
          Gets the color.
 DatasetManager getData(TrackerPanel trackerPanel)
          Returns the DatasetManager.
 java.lang.String getDataDescription(int index)
          Gets the description of a data variable.
 java.lang.String getDataName(int index)
          Gets the name of a data variable.
 java.lang.String getDescription()
          Gets the description of this track.
 Footprint getFootprint()
          Gets the current footprint.
 Footprint getFootprint(Step step)
          Gets the current footprint.
abstract  int getFootprintLength()
          Gets the length of the footprints required by this track.
 Footprint[] getFootprints()
          Gets the footprint choices.
 Footprint[] getFootprints(Step step)
          Gets the footprint choices.
 int getFrameForData(java.lang.String var, double value)
          Gets the frame number associated with a specified variable and value.
static XML.ObjectLoader getLoader()
          Returns an ObjectLoader to save and load data for this class.
 TPoint getMarkedPoint(int n, int index)
          Used by autoTracker to get the marked point for a given frame and index.
protected  java.awt.Cursor getMarkingCursor(java.awt.event.InputEvent e)
          Gets the cursor used for marking new steps.
 javax.swing.JMenu getMenu(TrackerPanel trackerPanel)
          Prepares menu items and returns a new menu.
 java.lang.String getMessage()
          Gets a message about this track to display in a message box.
 java.lang.String getName()
          Gets the name of this track.
 Step getNextVisibleStep(Step step, TrackerPanel trackerPanel)
          Gets next visible step after the specified step.
 java.util.ArrayList<java.lang.Integer> getPreferredDataOrder()
          Gets the preferred order of data table columns.
 Step getPreviousVisibleStep(Step step, TrackerPanel trackerPanel)
          Gets first visible step before the specified step.
 java.lang.Object getProperty(java.lang.String name)
          Gets a user property of the track.
 java.util.Collection<java.lang.String> getPropertyNames()
          Gets a collection of user property names for the track.
protected  javax.swing.JDialog getSkippedStepWarningDialog()
           
 Step getStep(int n)
          Gets a step specified by frame number.
 Step getStep(TPoint point, TrackerPanel trackerPanel)
          Gets a step containing a TPoint.
abstract  int getStepLength()
          Gets the length of the steps created by this track.
 Step[] getSteps()
          Gets the step array.
protected  javax.swing.JDialog getStepSizeWarningDialog()
           
protected  java.lang.String getTargetDescription(int pointIndex)
          Returns a description of a target point with a given index.
protected  int getTargetIndex()
          Returns the target index for the autotracker.
 java.util.ArrayList<java.awt.Component> getToolbarPointComponents(TrackerPanel trackerPanel, TPoint point)
          Returns an empty list of point-related toolbar components.
 java.util.ArrayList<java.awt.Component> getToolbarTrackComponents(TrackerPanel trackerPanel)
          Returns an empty list of track-related toolbar components.
 int getTrailLength()
          Gets the trail length.
protected  double[] getWorldBounds(TrackerPanel panel)
          Gets the world bounds of this track on the specified TrackerPanel.
 double getX()
          Gets x.
 double getXMax()
          Gets the maximum x needed to draw this object.
 double getXMax(TrackerPanel panel)
          Gets the maximum world x needed to draw this object on the specified TrackerPanel.
 double getXMin()
          Gets the minimum x needed to draw this object.
 double getXMin(TrackerPanel panel)
          Gets the minimum world x needed to draw this object on the specified TrackerPanel.
 double getY()
          Gets y.
 double getYMax()
          Gets the maximum y needed to draw this object.
 double getYMax(TrackerPanel panel)
          Gets the maximum world y needed to draw this object on the specified TrackerPanel.
 double getYMin()
          Gets the minimum y needed to draw this object.
 double getYMin(TrackerPanel panel)
          Gets the minimum world y needed to draw this object on the specified TrackerPanel.
 boolean isAutoAdvance()
          Gets the autoAdvance property.
protected  boolean isAutoTrackable()
          Determines if at least one point in this track is autotrackable.
protected  boolean isAutoTrackable(int pointIndex)
          Determines if the given point index is autotrackable.
 boolean isDependent()
          Reports whether or not this is dependent.
 boolean isEmpty()
          Returns true if this track contains no steps.
 boolean isEnabled()
          Gets whether this responds to mouse hits.
 boolean isLocked()
          Gets the locked property.
 boolean isMarkByDefault()
          Gets the markByDefault property.
 boolean isMeasured()
          Reports whether information is available to set min/max values.
 boolean isStepComplete(int n)
          Returns true if the step at the specified frame number is complete.
 boolean isStepVisible(Step step, TrackerPanel trackerPanel)
          Reports whether or not the specified step is visible.
 boolean isTrailVisible()
          Gets the trail visibility.
 boolean isViewable()
          Reports whether or not this is viewable.
 boolean isVisible()
          Reports whether or not this is visible.
 void propertyChange(java.beans.PropertyChangeEvent e)
          Responds to property change events.
protected  void refreshData(DatasetManager data, TrackerPanel trackerPanel)
          Refreshes the data in the specified DatasetManager.
protected  void refreshData(DatasetManager data, TrackerPanel trackerPanel, int startFrame, int stepCount)
          Refreshes the data for a specified frame range.
 void remark()
          Remarks all steps on all panels.
 void remark(TrackerPanel trackerPanel)
          Remarks all steps on the specified panel.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener.
 void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener for a specified property.
 void repaint()
          Repaints all steps on all panels.
 void repaint(Step step)
          Repaints the specified step on all panels.
 void repaint(TrackerPanel trackerPanel)
          Repaints all steps on the specified panel.
protected  void setAnglesInRadians(boolean radians)
          Sets the display format for angles.
 void setAutoAdvance(boolean auto)
          Sets the autoAdvance property.
 void setColor(java.awt.Color color)
          Sets the color.
 void setColorToDefault(int index)
          Sets the color to one of the default colors[].
 void setDefaultNameAndColor(TrackerPanel trackerPanel, java.lang.String connector)
          Sets the default name and color for a specified tracker panel.
 void setDescription(java.lang.String desc)
          Sets the description of this track.
 void setEnabled(boolean enabled)
          Sets whether this responds to mouse hits.
 void setFootprint(java.lang.String name)
          Sets the footprint to the specified choice.
 void setFootprint(java.lang.String name, Step step)
          Sets the footprint to the specified choice.
 void setFootprints(Footprint[] choices)
          Sets the footprint choices.
 void setFootprints(Footprint[] choices, Step step)
          Sets the footprint choices.
 void setLocked(boolean locked)
          Locks and unlocks this track.
 void setMarkByDefault(boolean mark)
          Sets the markByDefault property.
protected  void setMarking(boolean marking)
          Sets the marking flag.
 void setName(java.lang.String newName)
          Sets the name of this track.
 void setProperty(java.lang.String name, java.lang.Object value)
          Sets a user property of the track.
protected  void setTargetIndex(int index)
          Sets the target index for the autotracker.
protected  void setTargetIndex(java.lang.String description)
          Sets the target index for the autotracker.
protected  void setTargetIndex(TPoint p)
          Sets the target index for the autotracker.
protected  void setTrackerPanel(TrackerPanel panel)
          Identifies the controlling TrackerPanel for this track (by default, the first TrackerPanel that adds this track to its drawables).
 void setTrailLength(int steps)
          Sets the trail length.
 void setTrailVisible(boolean visible)
          Shows and hides the trail.
 void setViewable(boolean viewable)
          Determines whether views and track menu include this track.
 void setVisible(boolean visible)
          Shows and hides this track.
 void setX(double x)
          Empty setX method.
 void setXY(double x, double y)
          Empty setXY method.
 void setY(double y)
          Empty setY method.
 java.lang.String toString()
          Overrides Object toString method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

alphabet

protected static java.lang.String alphabet

skippedStepWarningDialog

protected static javax.swing.JDialog skippedStepWarningDialog

skippedStepWarningTextpane

protected static javax.swing.JTextPane skippedStepWarningTextpane

skippedStepWarningCheckbox

protected static javax.swing.JCheckBox skippedStepWarningCheckbox

closeButton

protected static javax.swing.JButton closeButton

skippedStepWarningOn

protected static boolean skippedStepWarningOn

frc

protected static java.awt.font.FontRenderContext frc

name

protected java.lang.String name

description

protected java.lang.String description

visible

protected boolean visible

trailVisible

protected boolean trailVisible

trailLength

protected int trailLength

locked

protected boolean locked

enabled

protected boolean enabled

viewable

protected boolean viewable

footprints

protected Footprint[] footprints

footprint

protected Footprint footprint

defaultFootprint

protected Footprint defaultFootprint

defaultColors

protected java.awt.Color[] defaultColors

steps

protected TTrack.StepArray steps

panels

protected java.util.Collection<TrackerPanel> panels

support

protected java.beans.PropertyChangeSupport support

properties

protected java.util.HashMap<java.lang.String,java.lang.Object> properties

data

protected DatasetManager data

worldBounds

protected java.util.HashMap<TrackerPanel,double[]> worldBounds

point

protected java.awt.geom.Point2D point

toolbarTrackComponents

protected java.util.ArrayList<java.awt.Component> toolbarTrackComponents

toolbarPointComponents

protected java.util.ArrayList<java.awt.Component> toolbarPointComponents

tLabel

protected javax.swing.JLabel tLabel

xLabel

protected javax.swing.JLabel xLabel

yLabel

protected javax.swing.JLabel yLabel

magLabel

protected javax.swing.JLabel magLabel

angleLabel

protected javax.swing.JLabel angleLabel

stepLabel

protected javax.swing.JLabel stepLabel

tValueLabel

protected javax.swing.JLabel tValueLabel

stepValueLabel

protected javax.swing.JLabel stepValueLabel

tField

protected NumberField tField

xField

protected NumberField xField

yField

protected NumberField yField

magField

protected NumberField magField

angleField

protected DecimalField angleField

fieldBorder

protected javax.swing.border.Border fieldBorder

tSeparator

protected java.awt.Component tSeparator

xSeparator

protected java.awt.Component xSeparator

ySeparator

protected java.awt.Component ySeparator

magSeparator

protected java.awt.Component magSeparator

angleSeparator

protected java.awt.Component angleSeparator

stepSeparator

protected java.awt.Component stepSeparator

menu

protected javax.swing.JMenu menu

autoAdvance

protected boolean autoAdvance

markByDefault

protected boolean markByDefault

isMarking

protected boolean isMarking

visibleItem

protected javax.swing.JCheckBoxMenuItem visibleItem

trailVisibleItem

protected javax.swing.JCheckBoxMenuItem trailVisibleItem

markByDefaultItem

protected javax.swing.JCheckBoxMenuItem markByDefaultItem

autoAdvanceItem

protected javax.swing.JCheckBoxMenuItem autoAdvanceItem

lockedItem

protected javax.swing.JCheckBoxMenuItem lockedItem

nameItem

protected javax.swing.JMenuItem nameItem

colorItem

protected javax.swing.JMenuItem colorItem

footprintMenu

protected javax.swing.JMenu footprintMenu

footprintListener

protected java.awt.event.ActionListener footprintListener

circleFootprintListener

protected java.awt.event.ActionListener circleFootprintListener

deleteTrackItem

protected javax.swing.JMenuItem deleteTrackItem

deleteStepItem

protected javax.swing.JMenuItem deleteStepItem

clearStepsItem

protected javax.swing.JMenuItem clearStepsItem

descriptionItem

protected javax.swing.JMenuItem descriptionItem

dataBuilderItem

protected javax.swing.JMenuItem dataBuilderItem

xSpinner

protected javax.swing.JSpinner xSpinner

ySpinner

protected javax.swing.JSpinner ySpinner

labelFont

protected java.awt.Font labelFont

nameDialog

protected javax.swing.JDialog nameDialog

nameField

protected javax.swing.JTextField nameField

nameAction

protected javax.swing.Action nameAction

trackerPanel

protected TrackerPanel trackerPanel

dataProp

protected XMLProperty dataProp

constantsLoadedFromXML

protected java.lang.Object[][] constantsLoadedFromXML

dataDescriptions

protected java.lang.String[] dataDescriptions

dataValid

protected boolean dataValid

refreshDataLater

protected boolean refreshDataLater

preferredColumnOrder

protected int[] preferredColumnOrder

dataFrames

protected java.util.ArrayList<java.lang.Integer> dataFrames

partName

protected java.lang.String partName

hint

protected java.lang.String hint

stepSizeWhenFirstMarked

protected int stepSizeWhenFirstMarked

keyFrames

protected java.util.TreeSet<java.lang.Integer> keyFrames

autoTrackerMarking

protected boolean autoTrackerMarking

targetIndex

protected int targetIndex

attachments

protected TTrack[] attachments
Constructor Detail

TTrack

protected TTrack()
Constructs a TTrack.

Method Detail

setVisible

public void setVisible(boolean visible)
Shows and hides this track.

Parameters:
visible - true to show this track

delete

public void delete()
Removes this track from all panels that draw it. If no other objects have a reference to it, this should then be garbage-collected.


isVisible

public boolean isVisible()
Reports whether or not this is visible.

Returns:
true if this track is visible

setTrailVisible

public void setTrailVisible(boolean visible)
Shows and hides the trail. If the trail is shown, all steps are visible. If not, only the current step is visible.

Parameters:
visible - true to show trail

isTrailVisible

public boolean isTrailVisible()
Gets the trail visibility.

Returns:
true if trail is visible

setTrailLength

public void setTrailLength(int steps)
Sets the trail length.

Parameters:
steps - the trail length

getTrailLength

public int getTrailLength()
Gets the trail length.

Returns:
trail length

setLocked

public void setLocked(boolean locked)
Locks and unlocks this track. When locked, no changes are allowed.

Parameters:
locked - true to lock this

isLocked

public boolean isLocked()
Gets the locked property.

Returns:
true if this is locked

setAutoAdvance

public void setAutoAdvance(boolean auto)
Sets the autoAdvance property.

Parameters:
auto - true to request that the video autoadvance while marking.

isAutoAdvance

public boolean isAutoAdvance()
Gets the autoAdvance property.

Returns:
true if this is autoadvance

setMarkByDefault

public void setMarkByDefault(boolean mark)
Sets the markByDefault property. When true, the mouse handler should mark a point whenever the active track reports itself incomplete.

Parameters:
mark - true to mark by default

isMarkByDefault

public boolean isMarkByDefault()
Gets the markByDefault property. When true, the mouse handler should mark a point whenever the active track reports itself incomplete.

Returns:
true if this marks by default

getColor

public java.awt.Color getColor()
Gets the color.

Returns:
the current color

setColor

public void setColor(java.awt.Color color)
Sets the color.

Parameters:
color - the desired color

setColorToDefault

public void setColorToDefault(int index)
Sets the color to one of the default colors[].

Parameters:
index - the color index

setDefaultNameAndColor

public void setDefaultNameAndColor(TrackerPanel trackerPanel,
                                   java.lang.String connector)
Sets the default name and color for a specified tracker panel.

Parameters:
trackerPanel - the TrackerPanel
connector - the string connector between the name and letter suffix

getName

public java.lang.String getName()
Gets the name of this track.

Returns:
the name

setName

public void setName(java.lang.String newName)
Sets the name of this track.

Parameters:
newName - the new name of this track

getDescription

public java.lang.String getDescription()
Gets the description of this track.

Returns:
the description

setDescription

public void setDescription(java.lang.String desc)
Sets the description of this track.

Parameters:
desc - a description

toString

public java.lang.String toString()
Overrides Object toString method.

Overrides:
toString in class java.lang.Object
Returns:
a description of this object

getMessage

public java.lang.String getMessage()
Gets a message about this track to display in a message box.

Returns:
the message

setViewable

public void setViewable(boolean viewable)
Determines whether views and track menu include this track.

Parameters:
viewable - true to include this track in views

isViewable

public boolean isViewable()
Reports whether or not this is viewable.

Returns:
true if this track is viewable

isDependent

public boolean isDependent()
Reports whether or not this is dependent. A dependent track gets some or all of its data from other tracks. Dependent tracks should override this method to return true.

Returns:
true if this track is dependent

setFootprints

public void setFootprints(Footprint[] choices)
Sets the footprint choices. The footprint is set to the first choice.

Parameters:
choices - the array of Footprints available to this track

setFootprints

public void setFootprints(Footprint[] choices,
                          Step step)
Sets the footprint choices. The footprint is set to the first choice. The step parameter may be used to set the footprints of secondary step arrays (veloc, accel, etc).

Parameters:
choices - the array of Footprints available to this track
step - the step that identifies the step array

getFootprints

public Footprint[] getFootprints()
Gets the footprint choices.

Returns:
the array of Footprints available to this track

getFootprints

public Footprint[] getFootprints(Step step)
Gets the footprint choices. The step parameter may be used to get the footprints of secondary step arrays (veloc, accel, etc).

Parameters:
step - the step that identifies the step array
Returns:
the array of Footprints available to this track

addFootprint

public void addFootprint(Footprint footprint)
Adds a new footprint to the current choices.

Parameters:
footprint - the footprint

setFootprint

public void setFootprint(java.lang.String name)
Sets the footprint to the specified choice.

Parameters:
name - the name of the desired footprint

getFootprint

public Footprint getFootprint()
Gets the current footprint.

Returns:
the footprint

setFootprint

public void setFootprint(java.lang.String name,
                         Step step)
Sets the footprint to the specified choice. The step parameter may be used to set the footprints of secondary step arrays (veloc, accel, etc).

Parameters:
name - the name of the desired footprint
step - the step that identifies the step array

getFootprint

public Footprint getFootprint(Step step)
Gets the current footprint. The step parameter may be used to get the footprints of secondary step arrays (veloc, accel, etc).

Parameters:
step - the step that identifies the step array
Returns:
the footprint

getStepLength

public abstract int getStepLength()
Gets the length of the steps created by this track.

Returns:
the footprint length

getFootprintLength

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

Returns:
the footprint length

createStep

public abstract Step createStep(int n,
                                double x,
                                double y)
Creates a new step.

Parameters:
n - the frame number
x - the x coordinate in image space
y - the y coordinate in image space
Returns:
the new step

deleteStep

public Step deleteStep(int n)
Deletes a step.

Parameters:
n - the frame number
Returns:
the deleted step

getStep

public Step getStep(int n)
Gets a step specified by frame number. May return null.

Parameters:
n - the frame number
Returns:
the step

getNextVisibleStep

public Step getNextVisibleStep(Step step,
                               TrackerPanel trackerPanel)
Gets next visible step after the specified step. May return null.

Parameters:
step - the step
trackerPanel - the tracker panel
Returns:
the next visiblestep

getPreviousVisibleStep

public Step getPreviousVisibleStep(Step step,
                                   TrackerPanel trackerPanel)
Gets first visible step before the specified step. May return null.

Parameters:
step - the step
trackerPanel - the tracker panel
Returns:
the previous visible step

getStep

public Step getStep(TPoint point,
                    TrackerPanel trackerPanel)
Gets a step containing a TPoint. May return null.

Parameters:
point - a TPoint
trackerPanel - the tracker panel holding the TPoint
Returns:
the step containing the TPoint

getSteps

public Step[] getSteps()
Gets the step array. Some or all elements may be null.

Returns:
the step array

isStepComplete

public boolean isStepComplete(int n)
Returns true if the step at the specified frame number is complete. Points may be created or remarked if false.

Parameters:
n - the frame number
Returns:
true if the step is complete, otherwise false

autoMarkAt

public TPoint autoMarkAt(int n,
                         double x,
                         double y)
Used by autoTracker to mark a step at a match target position.

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

getMarkedPoint

public TPoint getMarkedPoint(int n,
                             int index)
Used by autoTracker to get the marked point for a given frame and index.

Parameters:
n - the frame number
index - the index
Returns:
the step TPoint at the index

getTargetIndex

protected int getTargetIndex()
Returns the target index for the autotracker.

Returns:
the point index

setTargetIndex

protected void setTargetIndex(int index)
Sets the target index for the autotracker.

Parameters:
index - the point index

setTargetIndex

protected void setTargetIndex(java.lang.String description)
Sets the target index for the autotracker.

Parameters:
description - the description of the target

setTargetIndex

protected void setTargetIndex(TPoint p)
Sets the target index for the autotracker.

Parameters:
p - a TPoint associated with a step in this track

getTargetDescription

protected java.lang.String getTargetDescription(int pointIndex)
Returns a description of a target point with a given index.

Parameters:
pointIndex - the index
Returns:
the description

isAutoTrackable

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

Parameters:
pointIndex - the points[] index
Returns:
true if autotrackable

isAutoTrackable

protected boolean isAutoTrackable()
Determines if at least one point in this track is autotrackable.

Returns:
true if autotrackable

isEmpty

public boolean isEmpty()
Returns true if this track contains no steps.

Returns:
true if this contains no steps

getData

public DatasetManager getData(TrackerPanel trackerPanel)
Returns the DatasetManager.

Parameters:
trackerPanel - the tracker panel
Returns:
the DatasetManager

refreshData

protected void refreshData(DatasetManager data,
                           TrackerPanel trackerPanel)
Refreshes the data in the specified DatasetManager. Subclasses should use this method to refresh track-specific data sets.

Parameters:
data - the DatasetManager
trackerPanel - the tracker panel

refreshData

protected void refreshData(DatasetManager data,
                           TrackerPanel trackerPanel,
                           int startFrame,
                           int stepCount)
Refreshes the data for a specified frame range. This default implementation ignores the range arguments.

Parameters:
data - the DatasetManager
trackerPanel - the tracker panel
startFrame - the start frame
stepCount - the step count

getDataName

public java.lang.String getDataName(int index)
Gets the name of a data variable. Index zero is the shared x-variable, indices 1-n+1 are the y-variables.

Parameters:
index - the dataset index
Returns:
a String data name

getDataDescription

public java.lang.String getDataDescription(int index)
Gets the description of a data variable. Index zero is the shared x-variable, indices 1-n+1 are the y-variables. Subclasses should override to provide correct descriptions.

Parameters:
index - the dataset index
Returns:
a String data description

getPreferredDataOrder

public java.util.ArrayList<java.lang.Integer> getPreferredDataOrder()
Gets the preferred order of data table columns.

Returns:
a list of column indices in preferred order

getFrameForData

public int getFrameForData(java.lang.String var,
                           double value)
Gets the frame number associated with a specified variable and value.

Parameters:
var - the variable name
value - the value
Returns:
the frame number, or -1 if not found

getMenu

public javax.swing.JMenu getMenu(TrackerPanel trackerPanel)
Prepares menu items and returns a new menu. Subclasses should override this method and add track-specific menu items.

Parameters:
trackerPanel - the tracker panel
Returns:
a menu

getToolbarTrackComponents

public java.util.ArrayList<java.awt.Component> getToolbarTrackComponents(TrackerPanel trackerPanel)
Returns an empty list of track-related toolbar components. Subclasses should override this method and add track-specific components.

Parameters:
trackerPanel - the tracker panel
Returns:
a collection of components

getToolbarPointComponents

public java.util.ArrayList<java.awt.Component> getToolbarPointComponents(TrackerPanel trackerPanel,
                                                                         TPoint point)
Returns an empty list of point-related toolbar components. Subclasses should override this method and add point-specific components.

Parameters:
trackerPanel - the tracker panel
point - the TPoint
Returns:
a list of components

erase

public void erase()
Erases all steps on all panels.


remark

public void remark()
Remarks all steps on all panels.


repaint

public void repaint()
Repaints all steps on all panels.


erase

public void erase(TrackerPanel trackerPanel)
Erases all steps on the specified panel.

Parameters:
trackerPanel - the tracker panel

remark

public void remark(TrackerPanel trackerPanel)
Remarks all steps on the specified panel.

Parameters:
trackerPanel - the tracker panel

repaint

public void repaint(TrackerPanel trackerPanel)
Repaints all steps on the specified panel.

Parameters:
trackerPanel - the tracker panel

repaint

public void repaint(Step step)
Repaints the specified step on all panels. This should be used instead of the Step.repaint() method to paint a new step on all panels for the first time, since a new step does not know what panels it is drawn on whereas the track does.

Parameters:
step - the step

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics _g)
Draws the steps on the tracker panel.

Specified by:
draw in interface Drawable
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 drawable object located at the specified pixel position.

Specified by:
findInteractive in interface Interactive
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 TPoint that is hit

getX

public double getX()
Gets x. Tracks have no meaningful position, so returns 0.

Specified by:
getX in interface Interactive
Returns:
0

getY

public double getY()
Gets y. Tracks have no meaningful position, so returns 0.

Specified by:
getY in interface Interactive
Returns:
0

setX

public void setX(double x)
Empty setX method.

Specified by:
setX in interface Interactive
Parameters:
x - the x position

setY

public void setY(double y)
Empty setY method.

Specified by:
setY in interface Interactive
Parameters:
y - the y position

setXY

public void setXY(double x,
                  double y)
Empty setXY method.

Specified by:
setXY in interface Interactive
Parameters:
x - the x position
y - the y position

setEnabled

public void setEnabled(boolean enabled)
Sets whether this responds to mouse hits.

Specified by:
setEnabled in interface Interactive
Parameters:
enabled - true if this responds to mouse hits.

isEnabled

public boolean isEnabled()
Gets whether this responds to mouse hits.

Specified by:
isEnabled in interface Interactive
Returns:
true if this responds to mouse hits.

isMeasured

public boolean isMeasured()
Reports whether information is available to set min/max values.

Specified by:
isMeasured in interface Measurable
Returns:
false since TTrack knows only its image coordinates

getXMin

public double getXMin()
Gets the minimum x needed to draw this object.

Specified by:
getXMin in interface Measurable
Returns:
0

getXMax

public double getXMax()
Gets the maximum x needed to draw this object.

Specified by:
getXMax in interface Measurable
Returns:
0

getYMin

public double getYMin()
Gets the minimum y needed to draw this object.

Specified by:
getYMin in interface Measurable
Returns:
0

getYMax

public double getYMax()
Gets the maximum y needed to draw this object.

Specified by:
getYMax in interface Measurable
Returns:
0

getXMin

public double getXMin(TrackerPanel panel)
Gets the minimum world x needed to draw this object on the specified TrackerPanel.

Parameters:
panel - the TrackerPanel drawing this track
Returns:
the minimum world x

getXMax

public double getXMax(TrackerPanel panel)
Gets the maximum world x needed to draw this object on the specified TrackerPanel.

Parameters:
panel - the TrackerPanel drawing this track
Returns:
the maximum x of any step's footprint

getYMin

public double getYMin(TrackerPanel panel)
Gets the minimum world y needed to draw this object on the specified TrackerPanel.

Parameters:
panel - the TrackerPanel drawing this track
Returns:
the minimum y of any step's footprint

getYMax

public double getYMax(TrackerPanel panel)
Gets the maximum world y needed to draw this object on the specified TrackerPanel.

Parameters:
panel - the TrackerPanel drawing this track
Returns:
the maximum y of any step's footprint

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Sets a user property of the track.

Parameters:
name - the name of the property
value - the value of the property

getProperty

public java.lang.Object getProperty(java.lang.String name)
Gets a user property of the track. May return null.

Parameters:
name - the name of the property
Returns:
the value of the property

getPropertyNames

public java.util.Collection<java.lang.String> getPropertyNames()
Gets a collection of user property names for the track.

Returns:
a collection of property names

propertyChange

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

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

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener.

Parameters:
listener - the object requesting property change notification

firePropertyChange

public void firePropertyChange(java.lang.String name,
                               java.lang.Object oldVal,
                               java.lang.Object newVal)
Fires a property change event.

Parameters:
name - the name of the property
oldVal - the old value of the property
newVal - the new value of the property

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String property,
                                      java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener for a specified property.

Parameters:
property - the name of the property of interest to the listener
listener - the object requesting property change notification

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener.

Parameters:
listener - the listener requesting removal

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String property,
                                         java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener for a specified property.

Parameters:
property - the name of the property
listener - the listener to remove

setTrackerPanel

protected void setTrackerPanel(TrackerPanel panel)
Identifies the controlling TrackerPanel for this track (by default, the first TrackerPanel that adds this track to its drawables).

Parameters:
panel - the TrackerPanel

getWorldBounds

protected double[] getWorldBounds(TrackerPanel panel)
Gets the world bounds of this track on the specified TrackerPanel.

Parameters:
panel - the TrackerPanel
Returns:
a double[] containing xMax, yMax, xMin, yMin

setAnglesInRadians

protected void setAnglesInRadians(boolean radians)
Sets the display format for angles.

Parameters:
radians - true for radians, false for degrees

cleanup

protected void cleanup()
Cleans up associated resources when this track is deleted or cleared.


setMarking

protected void setMarking(boolean marking)
Sets the marking flag. Flag should be true when ready to be marked by user.

Parameters:
marking - true when marking

getMarkingCursor

protected java.awt.Cursor getMarkingCursor(java.awt.event.InputEvent e)
Gets the cursor used for marking new steps.

Parameters:
e - the input event triggering this call
Returns:
the marking cursor

createWarningDialog

protected void createWarningDialog()

getStepSizeWarningDialog

protected javax.swing.JDialog getStepSizeWarningDialog()

getSkippedStepWarningDialog

protected javax.swing.JDialog getSkippedStepWarningDialog()

getLoader

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

Returns:
the object loader

isStepVisible

public boolean isStepVisible(Step step,
                             TrackerPanel trackerPanel)
Reports whether or not the specified step is visible.

Parameters:
step - the step
trackerPanel - the tracker panel
Returns:
true if the step is visible