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 intprotected TTrack[]protected intprotected JMenuItemprotected booleanprotected JMenuItemprotected JLabelprotected static final String[]protected static final String[]protected booleanprotected static final String[]protected booleanprotected static final intprotected JMenuItemprotected JMenuItemprotected JMenuprotected JButtonstatic final Stringprotected intprotected JMenuItemprotected JMenuItemprotected JMenuprotected Stringprotected NumberFieldprotected JLabelprotected Componentprotected NumberFieldprotected JLabelprotected ComponentFields 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, ySpinnerFields 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.voiddispose()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.intgetAttachmentEndFrame(int frameNumber) Gets the end frame for single track attachments.intGets the attachment frame count.protected intTTrack[]Returns the array of attachments for this track.intgetAttachmentStartFrame(int frameNumber) Gets the start frame for single track attachments.intGets the length of the footprints required by this track.String[]protected CircleFitterStepgetKeyStep(CircleFitterStep step) Returns the key step for a given step.static XML.ObjectLoaderReturns 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.intGets the length of the steps created by this track.protected StringgetTargetDescription(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) booleanisFixed()Gets the fixed property.booleanisNoPoints(int frameNumber) Determines if this is attached to one or more tracks.booleanisValidCircle(int frame) Determines if a valid circle exists at a specified frame number.protected booleanloadAttachmentsFromNames(boolean refresh) Loads the attachments for this track.voidResponds to property change events fired in TrackerPanel or VideoPanel.protected voidRefreshes the attachments for this track.protected voidprotected voidrefreshData(DatasetManager data, TrackerPanel trackerPanel) Refreshes the data in the specified DatasetManager.protected voidrefreshFields(int frameNumber) Refreshes the toolbar fields.protected voidrefreshStep(CircleFitterStep step) Refreshes a step by setting it equal to a keyframe step.protected voidsetAnglesInRadians(boolean radians) Sets the display format for angles.voidsetAttachmentFrameCount(int n) Sets the attachment frame count for single track attachments.voidsetAttachmentStartFrame(int n) Sets the start frame for single track attachments.protected voidsetCoordsOriginToCenter(boolean all) Sets the coordinate system origin to the circle center.protected voidsetCoordsScaleFromRadius(boolean all) Brings up a dialog to sets the coordinate system scale by setting the circle radius.voidsetFixed(boolean fixed) Sets the fixed property.voidsetFontLevel(int level) Sets the font level.voidsetTrackerPanel(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.voidsetTrailVisible(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, updateListenerVisibleMethods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
getFormatVariablesin classTTrack
-
getFormatMap
- Specified by:
getFormatMapin classTTrack
-
getFormatDescMap
- Specified by:
getFormatDescMapin classTTrack
-
getBaseType
- Specified by:
getBaseTypein classTTrack
-
getVarDimsImpl
- Specified by:
getVarDimsImplin classTTrack
-
setFixed
public void setFixed(boolean fixed) Sets the fixed property. When fixed, it has the same data points at all times.- Parameters:
fixed-trueto fix
-
isFixed
public boolean isFixed()Gets the fixed property.- Returns:
trueif fixed
-
isValidCircle
public boolean isValidCircle(int frame) Determines if a valid circle exists at a specified frame number.- Returns:
trueif valid
-
propertyChange
Description copied from class:TTrackResponds to property change events fired in TrackerPanel or VideoPanel.- Specified by:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classTTrack- Parameters:
e- the property change event
-
setTrailVisible
public void setTrailVisible(boolean visible) Description copied from class:TTrackShows and hides the trail. If the trail is shown, all steps are visible. If not, only the current step is visible.- Overrides:
setTrailVisiblein classTTrack- Parameters:
visible-trueto show trail
-
createStep
Implements createStep but only mimics step creation since steps are created automatically by the autofill StepArray.- Specified by:
createStepin 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:
deleteStepin classTTrack- Parameters:
n- the frame number- Returns:
- null since the step itself is never deleted
-
getStep
Description copied from class:TTrackGets a step specified by frame number. May return null. -
getStep
Description copied from class:TTrackGets a step containing a TPoint. May return null. -
getStepLength
public int getStepLength()Description copied from class:TTrackGets the length of the steps created by this track.- Specified by:
getStepLengthin classTTrack- Returns:
- the footprint length
-
getFootprintLength
public int getFootprintLength()Description copied from class:TTrackGets the length of the footprints required by this track.- Specified by:
getFootprintLengthin classTTrack- Returns:
- the footprint length
-
setFontLevel
public void setFontLevel(int level) Description copied from class:TTrackSets the font level.- Overrides:
setFontLevelin classTTrack- Parameters:
level- the desired font level
-
dispose
public void dispose()Description copied from class:TTrackDisposes 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:
getAttachmentLengthin classTTrack
-
getAttachments
Description copied from class:TTrackReturns the array of attachments for this track. Returns null only if the specified number of attachments == 0.- Overrides:
getAttachmentsin classTTrack- Returns:
- the attachments array
-
getAttachmentDescription
Returns the description of a particular attachment point.- Overrides:
getAttachmentDescriptionin 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:
refreshAttachmentsin classTTrack
-
refreshAttachmentsAync
protected void refreshAttachmentsAync() -
getMenu
Description copied from class:TTrackPrepares menu items and adds them to a menu. Subclasses should override this method and add track-specific menu items. -
getToolbarTrackComponents
Description copied from class:TTrackReturns an empty list of track-related toolbar components. Subclasses should override this method and add track-specific components.- Overrides:
getToolbarTrackComponentsin classTTrack- Parameters:
trackerPanel- the tracker panel- Returns:
- a collection of components
-
getToolbarPointComponents
Description copied from class:TTrackReturns an empty list of point-related toolbar components. Subclasses should override this method and add point-specific components.- Overrides:
getToolbarPointComponentsin classTTrack- Parameters:
trackerPanel- the tracker panelpoint- the TPoint- Returns:
- a list of components
-
findInteractive
Description copied from class:TTrackFinds the interactive drawable object located at the specified pixel position.- Specified by:
findInteractivein interfaceInteractive- Overrides:
findInteractivein 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:TTrackOverrides Object toString method. -
getNumberFields
Description copied from class:TTrackGets a map of number fields by name.- Overrides:
getNumberFieldsin classTTrack- Returns:
- a map of name to NumberField.
-
setTrackerPanel
Description copied from class:TTrackInstall 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:
setTrackerPanelin classTTrack- Parameters:
panel- the TrackerPanel
-
setAnglesInRadians
protected void setAnglesInRadians(boolean radians) Description copied from class:TTrackSets the display format for angles.- Overrides:
setAnglesInRadiansin classTTrack- Parameters:
radians-truefor radians, false for degrees
-
getTargetDescription
Description copied from class:TTrackReturns a description of a target point with a given index.- Overrides:
getTargetDescriptionin classTTrack- Parameters:
pointIndex- the index- Returns:
- the description
-
refreshData
Description copied from class:TTrackRefreshes the data in the specified DatasetManager. Subclasses should use this method to refresh track-specific data sets.- Overrides:
refreshDatain 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:
loadAttachmentsFromNamesin 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
-