org.opensourcephysics.cabrillo.tracker
Class LineProfile

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

public class LineProfile
extends TTrack

A LineProfile measures pixel brightness along a line on a video image.

Author:
Douglas Brown

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
TTrack.StepArray
 
Field Summary
protected  boolean fixedLine
           
protected  javax.swing.JCheckBoxMenuItem fixedLineItem
           
protected  javax.swing.JMenuItem horizOrientationItem
           
protected  boolean isHorizontal
           
protected  boolean loading
           
static int MAX_SPREAD
          The maximum allowed spread
protected  javax.swing.JMenu orientationMenu
           
protected  int spread
           
protected  IntegerField spreadField
           
protected  javax.swing.JLabel spreadLabel
           
protected  javax.swing.JMenuItem xaxisOrientationItem
           
 
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
LineProfile()
          Constructs a LineProfile.
 
Method Summary
 Step createStep(int n, double x, double y)
          Creates a new step.
 Step createStep(int n, double x1, double y1, double x2, double y2)
          Creates a new step or sets end positions of an existing step.
 Step deleteStep(int n)
          Overrides TTrack deleteStep method to prevent deletion.
 void draw(DrawingPanel panel, java.awt.Graphics _g)
          Overrides TTrack draw method.
 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.
 int getSpread()
          Gets the spread.
 Step getStep(int n)
          Overrides TTrack getStep method to provide fixedLine behavior.
 int getStepLength()
          Gets the length of the steps created by this track.
 java.util.ArrayList<java.awt.Component> getToolbarTrackComponents(TrackerPanel trackerPanel)
          Overrides TTrack getToolbarTrackComponents method.
 boolean isFixed()
          Gets the fixed property.
 boolean isStepComplete(int n)
          Returns true if the step at the specified frame number is complete.
 void propertyChange(java.beans.PropertyChangeEvent e)
          Responds to property change events.
protected  void refreshData(DatasetManager data, TrackerPanel trackerPanel)
          Refreshes the data.
protected  void refreshStep(LineProfileStep step)
          Refreshes a step by setting it equal to a keyframe step.
 void setFixed(boolean fixed)
          Sets the fixed property.
 void setFontLevel(int level)
          Sets the font level.
 void setSpread(int spread)
          Sets the spread.
 void setTrailVisible(boolean visible)
          Overrides TTrack setTrailVisible method to keep trails hidden.
 java.lang.String toString()
          Overrides Object toString method.
 
Methods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFootprint, addPropertyChangeListener, addPropertyChangeListener, addTextColumn, autoMarkAt, chooseColor, cleanup, convertTextToDataColumn, createWarningDialog, delete, 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, getTargetDescription, getTargetIndex, getTextColumnEntry, getTextColumnNames, getToolbarPointComponents, getTrailLength, getWorldBounds, getX, getXMax, getXMax, getXMin, getXMin, getY, getYMax, getYMax, getYMin, getYMin, isAutoAdvance, isAutoTrackable, isAutoTrackable, isDependent, isEmpty, isEnabled, isLocked, isMarkByDefault, isMeasured, isStepVisible, isTrailVisible, isViewable, isVisible, refreshData, remark, remark, removePropertyChangeListener, removePropertyChangeListener, removeTextColumn, renameTextColumn, repaint, repaint, repaint, setAnglesInRadians, setAutoAdvance, setColor, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFootprint, setFootprint, setFootprints, setFootprints, setLocked, 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

MAX_SPREAD

public static final int MAX_SPREAD
The maximum allowed spread

See Also:
Constant Field Values

fixedLine

protected boolean fixedLine

fixedLineItem

protected javax.swing.JCheckBoxMenuItem fixedLineItem

orientationMenu

protected javax.swing.JMenu orientationMenu

horizOrientationItem

protected javax.swing.JMenuItem horizOrientationItem

xaxisOrientationItem

protected javax.swing.JMenuItem xaxisOrientationItem

spread

protected int spread

spreadLabel

protected javax.swing.JLabel spreadLabel

spreadField

protected IntegerField spreadField

isHorizontal

protected boolean isHorizontal

loading

protected boolean loading
Constructor Detail

LineProfile

public LineProfile()
Constructs a LineProfile.

Method Detail

setFixed

public void setFixed(boolean fixed)
Sets the fixed property. When it is fixed, it is in the same position at all times.

Parameters:
fixed - true to fix the line

isFixed

public boolean isFixed()
Gets the fixed property.

Returns:
true if line is fixed

setSpread

public void setSpread(int spread)
Sets the spread. Spread determines how many pixels on each side of the line are given full weight in the average.

Parameters:
spread - the desired spread

getSpread

public int getSpread()
Gets the spread. Spread determines how many pixels on each side of the line are given full weight in the average.

Returns:
the spread

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics _g)
Overrides TTrack draw method.

Specified by:
draw in interface Drawable
Overrides:
draw in class TTrack
Parameters:
panel - the drawing panel requesting the drawing
_g - the graphics context on which to draw

setTrailVisible

public void setTrailVisible(boolean visible)
Overrides TTrack setTrailVisible method to keep trails hidden.

Overrides:
setTrailVisible in class TTrack
Parameters:
visible - ignored

createStep

public Step createStep(int n,
                       double x,
                       double y)
Creates a new 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 step

createStep

public Step createStep(int n,
                       double x1,
                       double y1,
                       double x2,
                       double y2)
Creates a new step or sets end positions of an existing step.

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

deleteStep

public Step deleteStep(int n)
Overrides TTrack deleteStep method to prevent deletion.

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

getStep

public Step getStep(int n)
Overrides TTrack getStep method to provide fixedLine behavior.

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

isStepComplete

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

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

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)
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 step or motion vector that is hit

refreshData

protected void refreshData(DatasetManager data,
                           TrackerPanel trackerPanel)
Refreshes the data.

Overrides:
refreshData in class TTrack
Parameters:
data - the DatasetManager
trackerPanel - the tracker panel

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 collection of components

setFontLevel

public void setFontLevel(int level)
Description copied from class: TTrack
Sets the font level.

Overrides:
setFontLevel in class TTrack
Parameters:
level - the desired font level

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Responds to property change events. LineProfile listens for the following events: "stepnumber", "image" and "transform" from TrackerPanel.

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

toString

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

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

refreshStep

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