Class CircleFitter
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.cabrillo.tracker.TTrack
org.opensourcephysics.cabrillo.tracker.CircleFitter
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,Drawable
,Interactive
,Measurable
,Trackable
A CircleFitter track fits and measures circles and their centers.
- Author:
- Douglas Brown
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
TTrack.NameDialog, TTrack.StepArray, TTrack.TextLineLabel, TTrack.TrackDecimalField, TTrack.TrackNumberField
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected TTrack[]
protected int
protected JMenuItem
protected boolean
protected JMenuItem
protected JLabel
protected static final String[]
protected static final String[]
protected boolean
protected static final String[]
protected boolean
protected static final int
protected JMenuItem
protected JMenuItem
protected JMenu
protected JButton
static final String
protected int
protected JMenuItem
protected JMenuItem
protected JMenu
protected String
protected NumberField
protected JLabel
protected Component
protected NumberField
protected JLabel
protected Component
Fields inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
angleField, angleLabel, angleSeparator, attachmentNames, attachments, autoAdvance, autoAdvanceItem, autoTrackerMarking, circleFootprintListener, clearStepsItem, closeButton, colorItem, constantsLoadedFromXML, customNumberFormats, dataBuilderItem, dataDescriptions, dataFrames, dataProp, datasetManager, dataValid, defaultColors, defaultFootprint, deleteStepItem, deleteTrackItem, description, descriptionItem, enabled, fieldBorder, fixedItem, footprint, footprintListener, footprintMenu, footprints, formatAngleMouseListener, formatMouseListener, hint, HINT_STEP_ADDED_OR_REMOVED, HINT_STEPS_SELECTED, initialized, isMarking, keyFrames, labelFont, locked, lockedItem, magField, magLabel, magSeparator, markByDefault, markByDefaultItem, name, nameDialog, nameItem, nextID, NOMAP, NOMAPS, NOVARA, NOVARS, numberFields, partName, points, positionFields, preferredColumnOrder, properties, PROPERTY_TTRACK_COLOR, PROPERTY_TTRACK_DATA, PROPERTY_TTRACK_FOOTPRINT, PROPERTY_TTRACK_FORMAT, PROPERTY_TTRACK_LOCKED, PROPERTY_TTRACK_MASS, PROPERTY_TTRACK_MODELEND, PROPERTY_TTRACK_MODELSTART, PROPERTY_TTRACK_NAME, PROPERTY_TTRACK_STEP, PROPERTY_TTRACK_STEPS, PROPERTY_TTRACK_TEXTCOLUMN, PROPERTY_TTRACK_VISIBLE, refreshDataLater, skippedStepWarningCheckbox, skippedStepWarningDialog, skippedStepWarningOn, skippedStepWarningTextpane, stepLabel, steps, stepSeparator, stepSizeWhenFirstMarked, stepValueLabel, targetIndex, textColumnEntries, textColumnNames, tField, tframe, tLabel, toolbarPointComponents, toolbarTrackComponents, tp, trailLength, trailVisible, trailVisibleItem, tSeparator, ttype, tValueLabel, TYPE_CALIBRATION, TYPE_CIRCLEFITTER, TYPE_COORDAXES, TYPE_LINEPROFILE, TYPE_OFFSETORIGIN, TYPE_PERSPECTIVE, TYPE_POINTMASS, TYPE_PROTRACTOR, TYPE_RGBREGION, TYPE_TAPEMEASURE, TYPE_UNKNOWN, TYPE_VECTOR, viewable, visible, visibleItem, xField, xLabel, xSeparator, xSpinner, yField, yLabel, ySeparator, ySpinner
Fields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateStep
(int n, double x, double y) Implements createStep but only mimics step creation since steps are created automatically by the autofill StepArray.deleteStep
(int n) Overrides TTrack deleteStep method to delete selected data points.void
dispose()
Disposes of resources when this track is deleted or cleared.findInteractive
(DrawingPanel panel, int xpix, int ypix) Finds the interactive drawable object located at the specified pixel position.getAttachmentDescription
(int n) Returns the description of a particular attachment point.int
getAttachmentEndFrame
(int frameNumber) Gets the end frame for single track attachments.int
Gets the attachment frame count.protected int
TTrack[]
Returns the array of attachments for this track.int
getAttachmentStartFrame
(int frameNumber) Gets the start frame for single track attachments.int
Gets the length of the footprints required by this track.String[]
protected CircleFitterStep
getKeyStep
(CircleFitterStep step) Returns the key step for a given step.static XML.ObjectLoader
Returns an ObjectLoader to save and load data for this class.getMenu
(TrackerPanel trackerPanel, JMenu menu0) Prepares menu items and adds them to a menu.Map<String,
NumberField[]> Gets a map of number fields by name.getStep
(int n) Gets a step specified by frame number.getStep
(TPoint point, TrackerPanel trackerPanel) Gets a step containing a TPoint.int
Gets the length of the steps created by this track.protected String
getTargetDescription
(int pointIndex) Returns a description of a target point with a given index.getToolbarPointComponents
(TrackerPanel trackerPanel, TPoint point) Returns an empty list of point-related toolbar components.getToolbarTrackComponents
(TrackerPanel trackerPanel) Returns an empty list of track-related toolbar components.getVarDimsImpl
(String variable) boolean
isFixed()
Gets the fixed property.boolean
isNoPoints
(int frameNumber) Determines if this is attached to one or more tracks.boolean
isValidCircle
(int frame) Determines if a valid circle exists at a specified frame number.protected boolean
loadAttachmentsFromNames
(boolean refresh) Loads the attachments for this track.void
Responds to property change events fired in TrackerPanel or VideoPanel.protected void
Refreshes the attachments for this track.protected void
protected void
refreshData
(DatasetManager data, TrackerPanel trackerPanel) Refreshes the data in the specified DatasetManager.protected void
refreshFields
(int frameNumber) Refreshes the toolbar fields.protected void
refreshStep
(CircleFitterStep step) Refreshes a step by setting it equal to a keyframe step.protected void
setAnglesInRadians
(boolean radians) Sets the display format for angles.void
setAttachmentFrameCount
(int n) Sets the attachment frame count for single track attachments.void
setAttachmentStartFrame
(int n) Sets the start frame for single track attachments.protected void
setCoordsOriginToCenter
(boolean all) Sets the coordinate system origin to the circle center.protected void
setCoordsScaleFromRadius
(boolean all) Brings up a dialog to sets the coordinate system scale by setting the circle radius.void
setFixed
(boolean fixed) Sets the fixed property.void
setFontLevel
(int level) Sets the font level.void
setTrackerPanel
(TrackerPanel panel) Install the controlling TrackerPanel for this track (by default, the first TrackerPanel that adds this track to its drawables) and add this track to the panel's specific (outgoing) listener lists so that the track can respond to external changes.void
setTrailVisible
(boolean visible) Shows and hides the trail.toString()
Overrides Object toString method.Methods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFixedItem, addFootprint, addListener, addListenerNCF, addPanelEvents, addStepListener, addTextColumn, assembleMenu, autoMarkAt, clearColumns, convertTextToDataColumn, createAllVariables, createWarningDialog, delete, delete, draw, erase, erase, finalize, fireStepsChanged, getAllVariables, getBaseTrackName, getBaseTypeInt, getColor, getCustomFormatPatterns, getData, getData, getDataDescription, getDataName, getDefaultFormatPatterns, getDefaultFormatPatterns, getDescription, getFootprint, getFootprint, getFootprintName, getFootprints, getFootprints, getFormatPatterns, getFrameForData, getIcon, getID, getMarkedPoint, getMarkingCursor, getMenuItems, getMessage, getName, getName, getNameDialog, getNextVisibleStep, getNumberFieldsForStep, getPlotViews, getPreferredDataOrder, getPreviousVisibleStep, getProperty, getPropertyNames, getSkippedStepWarningDialog, getSteps, getStepSizeWarningDialog, getTableViews, getTargetIndex, getTextColumnEntry, getTextColumnNames, getTrack, getTrailLength, getValues, getVarFormatPattern, getVariableDimensions, getVariablesFromFormatterDisplayName, getX, getXMax, getXMin, getY, getYMax, getYMin, initialize, invalidateData, isAttached, isAutoAdvance, isAutoTrackable, isAutoTrackable, isDataValid, isDependent, isEmpty, isEnabled, isFullyAttached, isLocked, isMarkByDefault, isMarking, isMeasured, isStepComplete, isStepVisible, isTrailVisible, isViewable, isVisible, refreshAttachmentsLater, refreshData, refreshDecimalSeparators, remark, remark, removeActiveTrack, removeDeleteTrackItem, removeListener, removeListenerNCF, removePanelEvents, removeStepListener, removeTextColumn, renameTextColumn, repaint, repaint, repaintAll, repaintStep, restorePatterns, savePatterns, setActive, setAutoAdvance, setColor, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFixedPosition, setFootprint, setFootprint, setFootprints, setFootprints, setFormatPattern, setInitialFormatPatterns, setLocked, setMarkByDefault, setMarking, setName, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, setTextColumnEntry, setTrailLength, setViewable, setVisible, setX, setXY, setY, showAnglePopup, showFormatPopup, updateListenerVisible
Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
-
Field Details
-
maxDataPointCount
protected static final int maxDataPointCount- See Also:
-
dataVariables
-
fieldVariables
-
formatVariables
-
formatMap
-
formatDescriptionMap
-
allVariables
-
fixedPosition
protected boolean fixedPosition -
clickToMarkLabel
-
xDataPointLabel
-
yDataPointLabel
-
xDataField
-
yDataField
-
xDataPointSeparator
-
yDataPointSeparator
-
clearPointsItem
-
setRadiusItem
-
setRadiusAllItem
-
originToCenterItem
-
originToCenterAllItem
-
originToCenterMenu
-
setRadiusMenu
-
attachmentItem
-
pointCountButton
-
attachToSteps
protected boolean attachToSteps -
isRelativeFrameNumbers
protected boolean isRelativeFrameNumbers -
absoluteStart
protected int absoluteStart -
relativeStart
protected int relativeStart -
attachmentFrameCount
protected int attachmentFrameCount -
attachmentForSteps
-
stepAttachmentName
-
PROPERTY_CIRCLEFITTER_DATAPOINT
- See Also:
-
-
Constructor Details
-
CircleFitter
public CircleFitter()Constructs a CircleFitter.
-
-
Method Details
-
getFormatVariables
- Specified by:
getFormatVariables
in classTTrack
-
getFormatMap
- Specified by:
getFormatMap
in classTTrack
-
getFormatDescMap
- Specified by:
getFormatDescMap
in classTTrack
-
getBaseType
- Specified by:
getBaseType
in classTTrack
-
getVarDimsImpl
- Specified by:
getVarDimsImpl
in classTTrack
-
setFixed
public void setFixed(boolean fixed) Sets the fixed property. When fixed, it has the same data points at all times.- Parameters:
fixed
-true
to fix
-
isFixed
public boolean isFixed()Gets the fixed property.- Returns:
true
if fixed
-
isValidCircle
public boolean isValidCircle(int frame) Determines if a valid circle exists at a specified frame number.- Returns:
true
if valid
-
propertyChange
Description copied from class:TTrack
Responds to property change events fired in TrackerPanel or VideoPanel.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Overrides:
propertyChange
in classTTrack
- Parameters:
e
- the property change event
-
setTrailVisible
public void setTrailVisible(boolean visible) Description copied from class:TTrack
Shows and hides the trail. If the trail is shown, all steps are visible. If not, only the current step is visible.- Overrides:
setTrailVisible
in classTTrack
- Parameters:
visible
-true
to show trail
-
createStep
Implements createStep but only mimics step creation since steps are created automatically by the autofill StepArray.- Specified by:
createStep
in classTTrack
- Parameters:
n
- the frame numberx
- the x coordinate in image spacey
- the y coordinate in image space- Returns:
- the step
-
deleteStep
Overrides TTrack deleteStep method to delete selected data points.- Overrides:
deleteStep
in classTTrack
- Parameters:
n
- the frame number- Returns:
- null since the step itself is never deleted
-
getStep
Description copied from class:TTrack
Gets a step specified by frame number. May return null. -
getStep
Description copied from class:TTrack
Gets a step containing a TPoint. May return null. -
getStepLength
public int getStepLength()Description copied from class:TTrack
Gets the length of the steps created by this track.- Specified by:
getStepLength
in classTTrack
- Returns:
- the footprint length
-
getFootprintLength
public int getFootprintLength()Description copied from class:TTrack
Gets the length of the footprints required by this track.- Specified by:
getFootprintLength
in classTTrack
- Returns:
- the footprint length
-
setFontLevel
public void setFontLevel(int level) Description copied from class:TTrack
Sets the font level.- Overrides:
setFontLevel
in classTTrack
- Parameters:
level
- the desired font level
-
dispose
public void dispose()Description copied from class:TTrack
Disposes of resources when this track is deleted or cleared. -
isNoPoints
public boolean isNoPoints(int frameNumber) Determines if this is attached to one or more tracks.- Returns:
- true if attached
-
setAttachmentStartFrame
public void setAttachmentStartFrame(int n) Sets the start frame for single track attachments.- Parameters:
n
- the desired start frame
-
getAttachmentStartFrame
public int getAttachmentStartFrame(int frameNumber) Gets the start frame for single track attachments.- Parameters:
frameNumber
- the frame number- Returns:
- the start frame
-
setAttachmentFrameCount
public void setAttachmentFrameCount(int n) Sets the attachment frame count for single track attachments.- Parameters:
n
- the desired frame count
-
getAttachmentFrameCount
public int getAttachmentFrameCount()Gets the attachment frame count.- Returns:
- the frame count
-
getAttachmentEndFrame
public int getAttachmentEndFrame(int frameNumber) Gets the end frame for single track attachments.- Parameters:
frameNumber
- the current frame number- Returns:
- the end frame
-
getAttachmentLength
protected int getAttachmentLength()- Overrides:
getAttachmentLength
in classTTrack
-
getAttachments
Description copied from class:TTrack
Returns the array of attachments for this track. Returns null only if the specified number of attachments == 0.- Overrides:
getAttachments
in classTTrack
- Returns:
- the attachments array
-
getAttachmentDescription
Returns the description of a particular attachment point.- Overrides:
getAttachmentDescription
in classTTrack
- Parameters:
n
- the attachment point index- Returns:
- the description
-
refreshAttachments
protected void refreshAttachments()Refreshes the attachments for this track. This manages attached data points (dataPoints[1]) and ignores marked data points (dataPoints[0])- Overrides:
refreshAttachments
in classTTrack
-
refreshAttachmentsAync
protected void refreshAttachmentsAync() -
getMenu
Description copied from class:TTrack
Prepares menu items and adds them to a menu. Subclasses should override this method and add track-specific menu items. -
getToolbarTrackComponents
Description copied from class:TTrack
Returns an empty list of track-related toolbar components. Subclasses should override this method and add track-specific components.- Overrides:
getToolbarTrackComponents
in classTTrack
- Parameters:
trackerPanel
- the tracker panel- Returns:
- a collection of components
-
getToolbarPointComponents
Description copied from class:TTrack
Returns an empty list of point-related toolbar components. Subclasses should override this method and add point-specific components.- Overrides:
getToolbarPointComponents
in classTTrack
- Parameters:
trackerPanel
- the tracker panelpoint
- the TPoint- Returns:
- a list of components
-
findInteractive
Description copied from class:TTrack
Finds the interactive drawable object located at the specified pixel position.- Specified by:
findInteractive
in interfaceInteractive
- Overrides:
findInteractive
in classTTrack
- Parameters:
panel
- the drawing panelxpix
- the x pixel position on the panelypix
- the y pixel position on the panel- Returns:
- the first step TPoint that is hit
-
toString
Description copied from class:TTrack
Overrides Object toString method. -
getNumberFields
Description copied from class:TTrack
Gets a map of number fields by name.- Overrides:
getNumberFields
in classTTrack
- Returns:
- a map of name to NumberField.
-
setTrackerPanel
Description copied from class:TTrack
Install the controlling TrackerPanel for this track (by default, the first TrackerPanel that adds this track to its drawables) and add this track to the panel's specific (outgoing) listener lists so that the track can respond to external changes. This method is overridden to add specific TrackerPanel events for subclasses.- Overrides:
setTrackerPanel
in classTTrack
- Parameters:
panel
- the TrackerPanel
-
setAnglesInRadians
protected void setAnglesInRadians(boolean radians) Description copied from class:TTrack
Sets the display format for angles.- Overrides:
setAnglesInRadians
in classTTrack
- Parameters:
radians
-true
for radians, false for degrees
-
getTargetDescription
Description copied from class:TTrack
Returns a description of a target point with a given index.- Overrides:
getTargetDescription
in classTTrack
- Parameters:
pointIndex
- the index- Returns:
- the description
-
refreshData
Description copied from class:TTrack
Refreshes the data in the specified DatasetManager. Subclasses should use this method to refresh track-specific data sets.- Overrides:
refreshData
in classTTrack
- Parameters:
data
- the DatasetManager
-
refreshStep
Refreshes a step by setting it equal to a keyframe step.- Parameters:
step
- the step to refresh
-
refreshFields
protected void refreshFields(int frameNumber) Refreshes the toolbar fields. -
getKeyStep
Returns the key step for a given step.- Parameters:
step
- the step- Returns:
- the key step
-
loadAttachmentsFromNames
protected boolean loadAttachmentsFromNames(boolean refresh) Loads the attachments for this track.- Overrides:
loadAttachmentsFromNames
in classTTrack
- Parameters:
refresh
- true to refresh attachments after loading- Returns:
- true if attachments were loaded
-
setCoordsOriginToCenter
protected void setCoordsOriginToCenter(boolean all) Sets the coordinate system origin to the circle center.- Parameters:
all
- true to set origin in all frames, else only in the current frame
-
setCoordsScaleFromRadius
protected void setCoordsScaleFromRadius(boolean all) Brings up a dialog to sets the coordinate system scale by setting the circle radius.- Parameters:
all
- true to set the scale in all frames, else only in the current frame.
-
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-