org.opensourcephysics.cabrillo.tracker
Class CalibrationStep

java.lang.Object
  extended by org.opensourcephysics.cabrillo.tracker.Step
      extended by org.opensourcephysics.cabrillo.tracker.CalibrationStep
All Implemented Interfaces:
java.lang.Cloneable

public class CalibrationStep
extends Step

This is a Step for a Calibration. It is used for setting the origin, angle and scale of an ImageCoordSystem.

Author:
Douglas Brown

Nested Class Summary
 class CalibrationStep.Position
          A class that represents the position of a calibration point.
 
Field Summary
protected  double worldX0
           
protected  double worldX1
           
protected  double worldY0
           
protected  double worldY1
           
 
Fields inherited from class org.opensourcephysics.cabrillo.tracker.Step
dataVisible, defaultIndex, footprint, format, frc, hitRect, marks, n, points, screenPoints, selectionShape, textLayoutFont, track, transform, valid
 
Constructor Summary
CalibrationStep(Calibration track, int n, double x, double y)
          Constructs a CalibrationStep with specified image coordinates.
 
Method Summary
 void addSecondPoint(double x, double y)
          Adds a second position point to this step at the specified image coordinates.
 java.lang.Object clone()
          Clones this Step.
 TPoint getDefaultPoint()
          Gets the default point.
static int getLength()
          Gets the step length.
static XML.ObjectLoader getLoader()
          Returns an ObjectLoader to save and load data for this class.
protected  Mark getMark(TrackerPanel trackerPanel)
          Overrides Step getMark method.
 CalibrationStep.Position getPosition(int n)
          Gets the specified position point.
 boolean setWorldCoordinates(double x1, double y1, double x2, double y2)
          Sets the world coordinates.
 java.lang.String toString()
          Returns a String describing this step.
 
Methods inherited from class org.opensourcephysics.cabrillo.tracker.Step
draw, erase, erase, findInteractive, getBounds, getFrameNumber, getPointIndex, getPoints, getTrack, remark, remark, repaint, repaint, setDefaultPointIndex, setFootprint, setHitRectCenter
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

worldX0

protected double worldX0

worldY0

protected double worldY0

worldX1

protected double worldX1

worldY1

protected double worldY1
Constructor Detail

CalibrationStep

public CalibrationStep(Calibration track,
                       int n,
                       double x,
                       double y)
Constructs a CalibrationStep with specified image coordinates.

Parameters:
track - the calibration
n - the frame number
x - the image x coordinate of point 0
y - the image y coordinate of point 0
Method Detail

addSecondPoint

public void addSecondPoint(double x,
                           double y)
Adds a second position point to this step at the specified image coordinates.

Parameters:
x - the image x coordinate of the position point
y - the image y coordinate of the position point

getPosition

public CalibrationStep.Position getPosition(int n)
Gets the specified position point.

Parameters:
n - the point number (0 or 1)
Returns:
the position

getDefaultPoint

public TPoint getDefaultPoint()
Gets the default point. The default point is the point initially selected when the step is created. Overrides step getDefaultPoint method.

Overrides:
getDefaultPoint in class Step
Returns:
the default TPoint

getMark

protected Mark getMark(TrackerPanel trackerPanel)
Overrides Step getMark method.

Overrides:
getMark in class Step
Parameters:
trackerPanel - the tracker panel
Returns:
the mark

clone

public java.lang.Object clone()
Clones this Step.

Overrides:
clone in class Step
Returns:
a clone of this step

setWorldCoordinates

public boolean setWorldCoordinates(double x1,
                                   double y1,
                                   double x2,
                                   double y2)
Sets the world coordinates. When a single point is visible, this sets the coords origin so its image position does not change. When both points are visible, this sets the origin, angle and scale so neither image position changes.

Parameters:
x1 - the world x coordinate of pt 1
y1 - the world y coordinate of pt 1
x2 - the world x coordinate of pt 2
y2 - the world x coordinate of pt 2
Returns:
true if successfully set

toString

public java.lang.String toString()
Returns a String describing this step.

Overrides:
toString in class Step
Returns:
a descriptive string

getLength

public static int getLength()
Gets the step length.

Returns:
the length of the points array

getLoader

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

Returns:
the object loader