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 ImageCoordSystem of a TrackerPanel.

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<java.lang.String> axisList
           
protected  javax.swing.event.ChangeListener axisListener
           
protected  javax.swing.JSpinner axisSpinner
           
protected  boolean fixedCoordinates
           
protected  javax.swing.JCheckBoxMenuItem fixedCoordinatesItem
           
protected  boolean[] isWorldDataValid
           
protected  javax.swing.JLabel point1Label
           
protected  javax.swing.JLabel point2Label
           
protected  int spinnerTextWidth
           
protected static int X_AXIS
           
protected  NumberField x1Field
           
protected  javax.swing.JLabel x1Label
           
protected static int XY_AXES
           
protected static int Y_AXIS
           
protected  NumberField y1Field
           
protected  javax.swing.JLabel y1Label
           
 
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, tField, tLabel, toolbarPointComponents, toolbarTrackComponents, trackerPanel, trailLength, trailVisible, trailVisibleItem, tSeparator, tValueLabel, viewable, visible, visibleItem, worldBounds, xField, xLabel, xSeparator, xSpinner, yField, yLabel, ySeparator, ySpinner
 
Constructor Summary
Calibration()
          Constructs a Calibration.
 
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)
          Creates, adds a point to, or repositions a calibration step.
 Step createStep(int n, double x1, double y1, double x2, double y2)
          Creates a new calibration step with two calibration points.
protected  void displayWorldCoordinates()
          Displays the world coordinates of the currently selected step.
 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.
 int getStepLength()
          Gets the length of the steps created by this track.
protected  java.lang.String getTargetDescription(int pointIndex)
          Returns a description of the point at a given index.
protected  int getTargetIndex()
          Overrides TTrack method
 java.util.ArrayList<java.awt.Component> getToolbarTrackComponents(TrackerPanel trackerPanel)
          Overrides TTrack getToolbarTrackComponents method.
protected  boolean isAutoTrackable()
          Determines if at least one point in this track is autotrackable.
 boolean isFixedCoordinates()
          Determines if the world coordinates are fixed.
 boolean isLocked()
          Overrides TTrack isLocked method.
 void propertyChange(java.beans.PropertyChangeEvent e)
          Responds to property change events.
protected  void refreshStep(CalibrationStep step)
          Refreshes a step by setting it equal to the previous keyframe step.
 void setAxisType(int axis)
          Sets the axis type.
 void setFixedCoordinates(boolean fixed)
          Sets the fixed coordinates property.
 void setFootprint(java.lang.String name)
          Overrides TTrack setFootprint to handle PointAxesFootprints.
 void setLocked(boolean locked)
          Overrides TTrack method.
 void setTrailVisible(boolean visible)
          Overrides TTrack setTrailVisible method.
 java.lang.String toString()
          Overrides Object toString method.
 
Methods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFootprint, addPropertyChangeListener, addPropertyChangeListener, cleanup, createWarningDialog, delete, deleteStep, 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, getToolbarPointComponents, getTrailLength, getWorldBounds, getX, getXMax, getXMax, getXMin, getXMin, getY, getYMax, getYMax, getYMin, getYMin, isAutoAdvance, isAutoTrackable, isDependent, isEmpty, isEnabled, isMarkByDefault, isMeasured, isStepComplete, isStepVisible, isTrailVisible, isViewable, isVisible, refreshData, refreshData, remark, remark, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, setAnglesInRadians, setAutoAdvance, setColor, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFootprint, setFootprints, setFootprints, setMarkByDefault, setMarking, setName, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, setTrackerPanel, 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

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

x1Field

protected NumberField x1Field

y1Field

protected NumberField y1Field

point1Label

protected javax.swing.JLabel point1Label

point2Label

protected javax.swing.JLabel point2Label

x1Label

protected javax.swing.JLabel x1Label

y1Label

protected javax.swing.JLabel y1Label

isWorldDataValid

protected boolean[] isWorldDataValid

axisList

protected java.util.ArrayList<java.lang.String> axisList

axisSpinner

protected javax.swing.JSpinner axisSpinner

axisListener

protected javax.swing.event.ChangeListener axisListener

axisLabel

protected javax.swing.JLabel axisLabel

axes

protected int axes

spinnerTextWidth

protected int spinnerTextWidth

fixedCoordinates

protected boolean fixedCoordinates

fixedCoordinatesItem

protected javax.swing.JCheckBoxMenuItem fixedCoordinatesItem
Constructor Detail

Calibration

public Calibration()
Constructs a Calibration.

Method Detail

setAxisType

public void setAxisType(int axis)
Sets the axis type.

Parameters:
axis - one of the type constants X_AXIS, Y_AXIS or XY_AXES

createStep

public Step createStep(int n,
                       double x,
                       double y)
Creates, adds a point to, or repositions a calibration step.

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

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

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

isAutoTrackable

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

Overrides:
isAutoTrackable in class TTrack
Returns:
true if autotrackable

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

isFixedCoordinates

public boolean isFixedCoordinates()
Determines if the world coordinates are fixed.

Returns:
true if fixed

setFixedCoordinates

public void setFixedCoordinates(boolean fixed)
Sets the fixed coordinates property. When fixed, the world coordinates are the same at all times.

Parameters:
fixed - true to fix the coordinates

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

setLocked

public void setLocked(boolean locked)
Overrides TTrack method.

Overrides:
setLocked in class TTrack
Parameters:
locked - true to lock this

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<java.awt.Component> getToolbarTrackComponents(TrackerPanel trackerPanel)
Overrides TTrack getToolbarTrackComponents method.

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

refreshStep

protected void refreshStep(CalibrationStep step)
Refreshes a step by setting it equal to the previous keyframe step.

Parameters:
step - the step to refresh

toString

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

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

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

getTargetIndex

protected int getTargetIndex()
Overrides TTrack method

Overrides:
getTargetIndex in class TTrack
Returns:
the point index

getTargetDescription

protected java.lang.String getTargetDescription(int pointIndex)
Returns a description of the point at a given index. Used by AutoTracker.

Overrides:
getTargetDescription in class TTrack
Parameters:
pointIndex - the points[] index
Returns:
the description

displayWorldCoordinates

protected void displayWorldCoordinates()
Displays the world coordinates of the currently selected step.


getLoader

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

Returns:
the object loader