org.opensourcephysics.cabrillo.tracker
Class Calibration

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

public class Calibration
extends TTrack

A Calibration controls the image coordinate system of a specified tracker panel.

Author:
Douglas Brown

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
TTrack.StepArray
 
Field Summary
protected  int axes
           
protected  javax.swing.JLabel axisLabel
           
protected  java.util.ArrayList axisList
           
protected  javax.swing.event.ChangeListener axisListener
           
protected  javax.swing.JSpinner axisSpinner
           
protected  boolean[] isWorldDataValid
           
protected static java.lang.String names
           
protected static int namesIndex
           
protected  boolean[] pointsVisible
           
protected  double worldX0
           
protected  double worldX1
           
protected  NumberField worldXField
           
protected  double worldY0
           
protected  double worldY1
           
protected  NumberField worldYField
           
protected static int X_AXIS
           
protected static int XY_AXES
           
protected static int Y_AXIS
           
 
Fields inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
angleField, angleLabel, angleSeparator, autoAdvance, autoAdvanceItem, colorItem, data, dataColumnsItem, dataProp, dataValid, defaultColor, defaultFootprint, deleteItem, description, descriptionItem, enabled, footprint, footprintListener, footprintMenu, footprints, labelFont, locked, lockedItem, magField, magLabel, magSeparator, markByDefault, markByDefaultItem, menu, name, nameAction, nameDialog, nameField, nameItem, panels, point, properties, stepField, stepLabel, steps, stepSeparator, support, tField, tLabel, toolbarPointComponents, toolbarTrackComponents, trackerPanel, trailLength, trailVisible, trailVisibleItem, tSeparator, viewable, visible, visibleItem, worldBounds, xField, xLabel, xSeparator, xSpinner, yField, yLabel, ySeparator, ySpinner
 
Constructor Summary
Calibration()
          Constructs a Calibration.
 
Method Summary
 Step createStep(int n, double x, double y)
          Creates a new calibration step with a single calibration point.
 Step createStep(int n, double x1, double y1, double x2, double y2)
          Creates a new calibration step with two calibration points.
 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)
          Overrides TTrack getMenu method.
 Step getStep(int n)
          Overrides TTrack getStep method.
 java.util.ArrayList getToolbarPointComponents(TrackerPanel trackerPanel, TPoint point)
          Overrides TTrack getToolbarPointComponents method.
 java.util.ArrayList getToolbarTrackComponents(TrackerPanel trackerPanel)
          Overrides TTrack getToolbarTrackComponents method.
 boolean isLocked()
          Overrides TTrack isLocked method.
 boolean isPointVisible(int index)
          Gets the visibility of a point specified by index in the points array.
 boolean isStepComplete(int n)
          Returns true if the step at the specified frame number is complete.
 void setAxes(int axis)
           
 void setFootprint(java.lang.String name)
          Overrides TTrack setFootprint to handle PointAxesFootprints.
 void setPointVisible(int index, boolean visible)
          Sets the visibility of the calibration points by index.
 void setTrailVisible(boolean visible)
          Overrides TTrack setTrailVisible method.
 void setWorldXY(double wx0, double wy0, double wx1, double wy1)
          Sets the world coordinates of this calibration.
 java.lang.String toString()
          Overrides Object toString method.
 
Methods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFootprint, addPropertyChangeListener, addPropertyChangeListener, cleanup, delete, deleteStep, draw, erase, erase, firePropertyChange, getColor, getData, getDataDescription, getDataName, getDescription, getFootprint, getFootprint, getFootprints, getFootprints, getName, getNextVisibleStep, getPreviousVisibleStep, getProperty, getPropertyNames, getStep, getSteps, getTrailLength, getWorldBounds, getX, getXMax, getXMax, getXMin, getXMin, getY, getYMax, getYMax, getYMin, getYMin, isAutoAdvance, isDependent, isEmpty, isEnabled, isMarkByDefault, isMeasured, isStepVisible, isTrailVisible, isViewable, isVisible, propertyChange, refreshData, remark, remark, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, setAutoAdvance, setColor, setDescription, setEnabled, setFootprint, setFootprints, setFootprints, setLocked, setMarkByDefault, setName, setProperty, setTrackerPanel, setTrailLength, setViewable, setVisible, setX, setXY, setY, updateNumberFields
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

X_AXIS

protected static final int X_AXIS
See Also:
Constant Field Values

XY_AXES

protected static final int XY_AXES
See Also:
Constant Field Values

Y_AXIS

protected static final int Y_AXIS
See Also:
Constant Field Values

names

protected static java.lang.String names

namesIndex

protected static int namesIndex

pointsVisible

protected boolean[] pointsVisible

worldXField

protected NumberField worldXField

worldYField

protected NumberField worldYField

worldX0

protected double worldX0

worldY0

protected double worldY0

worldX1

protected double worldX1

worldY1

protected double worldY1

isWorldDataValid

protected boolean[] isWorldDataValid

axisList

protected java.util.ArrayList axisList

axisSpinner

protected javax.swing.JSpinner axisSpinner

axisListener

protected javax.swing.event.ChangeListener axisListener

axisLabel

protected javax.swing.JLabel axisLabel

axes

protected int axes
Constructor Detail

Calibration

public Calibration()
Constructs a Calibration.

Method Detail

setAxes

public void setAxes(int axis)

setWorldXY

public void setWorldXY(double wx0,
                       double wy0,
                       double wx1,
                       double wy1)
Sets the world coordinates of this calibration.

Parameters:
wx0 - the x coordinate of point 0 in world space
wy0 - the y coordinate of point 0 in world space
wx1 - the x coordinate of point 1 in world space
wy1 - the y coordinate of point 1 in world space

setPointVisible

public void setPointVisible(int index,
                            boolean visible)
Sets the visibility of the calibration points by index.

Parameters:
index - the index of the point in the points array
visible - true to make the point visible

isPointVisible

public boolean isPointVisible(int index)
Gets the visibility of a point specified by index in the points array.

Parameters:
index - the index of the point in the points array
Returns:
true if the point is visible

createStep

public Step createStep(int n,
                       double x,
                       double y)
Creates a new calibration step with a single calibration point.

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 new step

createStep

public Step createStep(int n,
                       double x1,
                       double y1,
                       double x2,
                       double y2)
Creates a new calibration step with two calibration points.

Parameters:
n - the frame number
x1 - the x coordinate of point 1 in image space
y1 - the y coordinate of point 1 in image space
x2 - the x coordinate of point 2 in image space
y2 - the y coordinate of point 2 in image space
Returns:
the step

getStep

public Step getStep(int n)
Overrides TTrack getStep method.

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

isLocked

public boolean isLocked()
Overrides TTrack isLocked method.

Overrides:
isLocked in class TTrack
Returns:
true if this is locked

setTrailVisible

public void setTrailVisible(boolean visible)
Overrides TTrack setTrailVisible method. Calibration trails are never visible.

Overrides:
setTrailVisible in class TTrack
Parameters:
visible - ignored

isStepComplete

public boolean isStepComplete(int n)
Returns true if the step at the specified frame number is complete. Overrides TTrack isStepComplete method.

Overrides:
isStepComplete in class TTrack
Parameters:
n - the frame number
Returns:
true only if the step is complete

getFootprintLength

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

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

setFootprint

public void setFootprint(java.lang.String name)
Overrides TTrack setFootprint to handle PointAxesFootprints.

Overrides:
setFootprint in class TTrack
Parameters:
name - the name of the desired footprint

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 calibration point that is hit

getMenu

public javax.swing.JMenu getMenu(TrackerPanel trackerPanel)
Overrides TTrack getMenu method.

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

getToolbarTrackComponents

public java.util.ArrayList getToolbarTrackComponents(TrackerPanel trackerPanel)
Overrides TTrack getToolbarTrackComponents method.

Overrides:
getToolbarTrackComponents in class TTrack
Parameters:
trackerPanel - the tracker panel
Returns:
a list of components

getToolbarPointComponents

public java.util.ArrayList getToolbarPointComponents(TrackerPanel trackerPanel,
                                                     TPoint point)
Overrides TTrack getToolbarPointComponents method.

Overrides:
getToolbarPointComponents in class TTrack
Parameters:
trackerPanel - the tracker panel
point - the TPoint
Returns:
a list of components

toString

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

Overrides:
toString in class java.lang.Object
Returns:
the name of this track

getLoader

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

Returns:
the object loader