org.opensourcephysics.cabrillo.tracker
Class OffsetOrigin

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

public class OffsetOrigin
extends TTrack

An OffsetOrigin controls the origin of an image coordinate system.

Author:
Douglas Brown

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
TTrack.StepArray
 
Field Summary
protected  boolean fixedCoordinates
           
protected  javax.swing.JCheckBoxMenuItem fixedCoordinatesItem
           
protected  javax.swing.JLabel unmarkedLabel
           
 
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, textColumnEntries, textColumnNames, tField, tLabel, toolbarPointComponents, toolbarTrackComponents, trackerPanel, trailLength, trailVisible, trailVisibleItem, tSeparator, tValueLabel, viewable, visible, visibleItem, worldBounds, xField, xLabel, xSeparator, xSpinner, yField, yLabel, ySeparator, ySpinner
 
Constructor Summary
OffsetOrigin()
          Constructs an OffsetOrigin.
 
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 a new offset origin step with specified image coordinates.
 Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
          Overrides TTrack 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.
 java.util.ArrayList<java.awt.Component> getToolbarTrackComponents(TrackerPanel trackerPanel)
          Overrides TTrack 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(OffsetOriginStep step)
          Refreshes a step by setting it equal to the previous keyframe step.
 void setFixedCoordinates(boolean fixed)
          Sets the fixed coordinates property.
 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, addTextColumn, chooseColor, cleanup, convertTextToDataColumn, 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, getTargetIndex, getTextColumnEntry, getTextColumnNames, 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, removeTextColumn, renameTextColumn, repaint, repaint, repaint, setAnglesInRadians, setAutoAdvance, setColor, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFontLevel, setFootprint, setFootprint, setFootprints, setFootprints, setMarkByDefault, setMarking, setName, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, setTextColumnEntry, 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

fixedCoordinates

protected boolean fixedCoordinates

fixedCoordinatesItem

protected javax.swing.JCheckBoxMenuItem fixedCoordinatesItem

unmarkedLabel

protected javax.swing.JLabel unmarkedLabel
Constructor Detail

OffsetOrigin

public OffsetOrigin()
Constructs an OffsetOrigin.

Method Detail

createStep

public Step createStep(int n,
                       double x,
                       double y)
Creates a new offset origin step with specified image coordinates.

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

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

isAutoTrackable

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

Overrides:
isAutoTrackable in class TTrack
Returns:
true if autotrackable

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

getStep

public Step getStep(int n)
Overrides TTrack getStep method. This refreshes the step before returning it since its position and/or world coordinates may change due to external factors.

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

isLocked

public boolean isLocked()
Overrides TTrack isLocked method. Returns true if this is locked or if the coordinate system is locked.

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

setTrailVisible

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

Overrides:
setTrailVisible in class TTrack
Parameters:
visible - ignored

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

findInteractive

public Interactive findInteractive(DrawingPanel panel,
                                   int xpix,
                                   int ypix)
Overrides TTrack 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 current step or null

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 method.

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

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

setLocked

public void setLocked(boolean locked)
Overrides TTrack method.

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

toString

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

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

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

refreshStep

protected void refreshStep(OffsetOriginStep step)
Refreshes a step by setting it equal to the previous 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