Class ParticleModel
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.cabrillo.tracker.TTrack
org.opensourcephysics.cabrillo.tracker.PointMass
org.opensourcephysics.cabrillo.tracker.ParticleModel
- All Implemented Interfaces:
PropertyChangeListener,EventListener,Drawable,Interactive,Measurable,Trackable
- Direct Known Subclasses:
AnalyticParticle,DynamicParticle,ParticleDataTrack
An abstract class representing a point mass for which positions are
determined by a model. Subclassed as AnalyticParticle,
DynamicParticle, and ParticleDataTrack.
- Author:
- Douglas Brown
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
PointMass.FrameDataNested 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 doubleprotected intprotected UserFunctionEditorprotected ModelFunctionPanelprotected intprotected intprotected intprotected booleanprotected static booleanprotected PropertyChangeListenerprotected ModelBuilderprotected JMenuItemprotected intprotected static Point2D.Doubleprotected static intprotected Point2D.Double[]protected double[]protected double[]protected booleanprotected booleanprotected booleanprotected booleanprotected JMenuItemprotected intprotected booleanprotected doubleprotected doubleprotected static NumberFormatprotected PropertyChangeListenerprotected TPointprotected static intprotected double[]protected double[]protected booleanprotected JMenuItemprotected static doubleprotected static doubleFields inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
aAtOrigin, accelerationMenu, aColorItem, aDeriv, aDerivSpill, aFootprint, aFootprintMenu, aFootprints, algorithm, allVariables, aTailsToOriginItem, aTailsToPositionItem, autotrackItem, aVisibleItem, aVisibleOnAll, BOUNCE_DETECT, bounceDerivs, bounceDerivsSpill, dataVariables, derivData, drawsTrace, fieldVariables, FINITE_DIFF, FINITE_DIFF_VSPILL2, footprintNames, formatDescriptionMap, formatMap, formatVariables, isAutofill, isAutoKeyDown, labelsVisible, mass, massField, massLabel, MINIMUM_MASS, mSeparator, params, showfilledSteps, skippedSteps, trace, traceStroke, traceVisible, validData, vAtOrigin, vColorItem, vDeriv, vDerivSpill, vectorFields, velocityMenu, vFootprint, vFootprintMenu, vFootprints, vTailsToOriginItem, vTailsToPositionItem, vVisibleItem, vVisibleOnAll, xData, xVisibleOnAll, yDataFields 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, 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 TypeMethodDescriptionprotected voidThis adds the mass and initial time parameters to the function panel.protected PositionStepcreatePositionStep(PointMass track, int n, double x, double y) Creates a position step with image coordinates.voiddelete()Removes this particle from all panels that draw it.voiddispose()Disposes of resources when this track is deleted or cleared.protected voiddoStamp()voiddraw(DrawingPanel panel, Graphics _g) Overrides PointMass draw method.voiddrawMe(DrawingPanel panel, Graphics _g) Draws this without refreshing steps.findInteractive(DrawingPanel panel, int xpix, int ypix) Overrides PointMass findInteractive method.voidGets a display name for this model.intGets the end frame for this model.Gets the function editor.Gets the initial value editor.double[]Gets the initial values.protected intstatic XML.ObjectLoaderReturns an ObjectLoader to save and load data for this class.doublegetMass()Gets the mass.getMenu(TrackerPanel trackerPanel, JMenu menu0) Returns a menu with items that control this track.Gets the model builder.protected ParticleModel[]Gets the particle models associated with this model.Gets the parameter editor.intGets the start frame for this model.getToolbarPointComponents(TrackerPanel trackerPanel, TPoint point) Overrides TTrack getToolbarPointComponents method.protected voidholdPainting(boolean b) protected abstract voidInitializes the ModelFunctionPanel.protected booleanDetermines if any point in this track is autotrackable.booleanOverrides TTrack method to report that this is a dependent track.protected booleanbooleanisStepComplete(int n) Overrides TTrack isStepComplete method.protected booleanDetermines if the default reference frame is used to determine step positions.static FunctionEditor.FObjectvoidResponds to property change events.protected voidRefreshes the derivatives if they have not been refreshed in the refreshSteps() method (ie if the variable "refreshDerivsLater" is false).protected voidRefreshes initial time parameter for this model.protected voidrefreshSteps(String why) Refreshes step positions.protected abstract voidreset()Resets model parameters and sets position(s) for start frame.protected booleanrestoreState(int frameNumber) Restores the state to a previously saved state, if any.protected voidsaveState(int frameNumber) Saves the current state.protected voidsetAnglesInRadians(boolean radians) Sets the display format for angles.voidsetEndFrame(int n) Sets the end frame for this model.protected voidsetLastValidFrame(int i) voidsetLocked(boolean locked) Overrides TTrack setLocked method.voidsetMass(double mass) Sets the mass.voidSets the name.voidsetStartFrame(int n) Sets the start frame for this model.voidsetTrackerPanel(TrackerPanel panel) Adds events for TrackerPanel.voidsetUseDefaultReferenceFrame(boolean useDefault) Sets the useDefaultReferenceFrame flag.protected voidTrims all steps after endFrame.Methods inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
autoMarkAt, createGUI, createMenuIfNecessary, createStep, deleteAutoTrackerStep, deleteStep, erase, erase, getAArray, getAcceleration, getAccelerationFootprint, getAccelerationFootprints, getAccelerations, getBaseType, getFootprint, getFootprintLength, getFootprints, getFormatDescMap, getFormatMap, getFormatVariables, getNextVisibleStep, getNumberFields, getNumberFieldsForStep, getPreviousVisibleStep, getRotationData, getRotationData, getStep, getStepLength, getTargetDescription, getToolbarTrackComponents, getUnfilledGapCount, getVarDimsImpl, getVArray, getVelocities, getVelocity, getVelocityFootprint, getVelocityFootprints, getWorldAcceleration, getWorldPosition, getWorldVelocity, hasGaps, isAcceleration, isAutofill, isAVisible, isLabelsVisible, isPosition, isPositionVisible, isStepVisible, isTraceVisible, isVelocity, isVVisible, markAllInterpolatedSteps, markInterpolatedSteps, markInterpolatedSteps, refreshData, remark, remark, setAccelerationColor, setAccelerationFootprint, setAccelerationFootprints, setAlgorithm, setAutoFill, setAVisible, setAVisibleOnAll, setColor, setFontLevel, setFootprint, setLabelsVisible, setMarking, setPositionVisible, setPositionVisibleOnAll, setTraceVisible, setVelocityColor, setVelocityFootprint, setVelocityFootprints, setVisible, setVVisible, setVVisibleOnAll, updateDerivatives, updateDerivatives, updateDerivatives, updateDerivatives, updateDerivativesMethods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFixedItem, addFootprint, addListener, addListenerNCF, addPanelEvents, addStepListener, addTextColumn, assembleMenu, clearColumns, convertTextToDataColumn, createAllVariables, createWarningDialog, delete, finalize, getAllVariables, getAttachmentDescription, getAttachmentLength, getAttachments, getBaseTrackName, getBaseTypeInt, getColor, getCustomFormatPatterns, getData, getData, getDataDescription, getDataName, getDefaultFormatPatterns, getDefaultFormatPatterns, getDescription, getFootprint, getFootprintName, getFootprints, getFormatPatterns, getFrameForData, getIcon, getID, getMarkedPoint, getMarkingCursor, getMenuItems, getMessage, getName, getName, getNameDialog, getPlotViews, getPreferredDataOrder, getProperty, getPropertyNames, getSkippedStepWarningDialog, getStep, getSteps, getStepSizeWarningDialog, getTableViews, getTargetIndex, getTextColumnEntry, getTextColumnNames, getTrack, getTrailLength, getValues, getVarFormatPattern, getVariableDimensions, getVariablesFromFormatterDisplayName, getX, getXMax, getXMin, getY, getYMax, getYMin, initialize, invalidateData, isAttached, isAutoAdvance, isAutoTrackable, isDataValid, isEmpty, isEnabled, isFullyAttached, isLocked, isMarkByDefault, isMarking, isMeasured, isTrailVisible, isViewable, isVisible, loadAttachmentsFromNames, refreshAttachments, refreshAttachmentsLater, refreshData, refreshDecimalSeparators, removeActiveTrack, removeDeleteTrackItem, removeListener, removeListenerNCF, removePanelEvents, removeStepListener, removeTextColumn, renameTextColumn, repaint, repaint, repaintAll, repaintStep, restorePatterns, savePatterns, setActive, setAutoAdvance, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFixedPosition, setFootprint, setFootprints, setFootprints, setFormatPattern, setInitialFormatPatterns, setMarkByDefault, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, setTextColumnEntry, setTrailLength, setTrailVisible, setViewable, setX, setXY, setY, showAnglePopup, showFormatPopup, toString, 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
-
tracePtsPerStep
protected static int tracePtsPerStep -
loading
protected static boolean loading -
nan
-
xLimit
protected static double xLimit -
yLimit
protected static double yLimit -
timeFormat
-
modelBuilder
-
functionPanel
-
functionEditor
-
inspectorX
protected int inspectorX -
inspectorY
protected int inspectorY -
inspectorH
protected int inspectorH -
showModelBuilder
protected boolean showModelBuilder -
refreshing
protected boolean refreshing -
traceX
protected double[] traceX -
traceY
protected double[] traceY -
prevX
protected double[] prevX -
prevY
protected double[] prevY -
tracePt
-
t0
protected double t0 -
dt
protected double dt -
time
protected double time -
refreshDerivsLater
protected boolean refreshDerivsLater -
refreshStepsLater
protected boolean refreshStepsLater -
invalidWarningShown
protected boolean invalidWarningShown -
startFrameUndefined
protected boolean startFrameUndefined -
startFrame
protected int startFrame -
endFrame
protected int endFrame -
useDefaultReferenceFrame
protected boolean useDefaultReferenceFrame -
modelBuilderItem
-
useDefaultRefFrameItem
-
stampItem
-
massParamListener
-
timeParamListener
-
points
-
myPoint
protected int myPoint -
nCalc
protected static int nCalc
-
-
Constructor Details
-
ParticleModel
public ParticleModel()Constructs a ParticleModel.
-
-
Method Details
-
initializeFunctionPanel
protected abstract void initializeFunctionPanel()Initializes the ModelFunctionPanel. -
setLastValidFrame
protected void setLastValidFrame(int i) -
getLastValidFrame
protected int getLastValidFrame() -
draw
Overrides PointMass draw method. -
drawMe
Draws this without refreshing steps.- Parameters:
panel- the drawing panel requesting the drawing_g- the graphics context on which to draw
-
delete
public void delete()Removes this particle from all panels that draw it. Overrides TTrack method. -
setTrackerPanel
Description copied from class:PointMassAdds events for TrackerPanel.- Overrides:
setTrackerPanelin classPointMass- Parameters:
panel- the new TrackerPanel
-
propertyChange
Responds to property change events.- Specified by:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classPointMass- Parameters:
e- the property change event
-
getMass
public double getMass()Gets the mass. Overrides PointMass method. -
setMass
public void setMass(double mass) Sets the mass. Overrides PointMass method. -
setName
Sets the name. Overrides TTrack method. -
getDisplayName
Gets a display name for this model. The default is the model name.- Returns:
- the display name
-
isAutoTrackable
protected boolean isAutoTrackable()Determines if any point in this track is autotrackable.- Overrides:
isAutoTrackablein classPointMass- Returns:
- true if autotrackable
-
findInteractive
Overrides PointMass findInteractive method.- Specified by:
findInteractivein interfaceInteractive- Overrides:
findInteractivein classPointMass- Parameters:
panel- the drawing panelxpix- the x pixel position on the panelypix- the y pixel position on the panel- Returns:
- the first step or motion vector that is hit
-
setLocked
public void setLocked(boolean locked) Overrides TTrack setLocked method. ParticleModel is always locked. -
isDependent
public boolean isDependent()Overrides TTrack method to report that this is a dependent track.- Overrides:
isDependentin classTTrack- Returns:
trueif this track is dependent
-
isStepComplete
public boolean isStepComplete(int n) Overrides TTrack isStepComplete method. Always returns true.- Overrides:
isStepCompletein classTTrack- Parameters:
n- the frame number- Returns:
truealways since gets data from model
-
getMenu
Returns a menu with items that control this track. -
doStamp
protected void doStamp() -
getToolbarPointComponents
Overrides TTrack getToolbarPointComponents method.- Overrides:
getToolbarPointComponentsin classPointMass- Parameters:
trackerPanel- the tracker panelpoint- the TPoint- Returns:
- a list of components
-
setStartFrame
public void setStartFrame(int n) Sets the start frame for this model. Also sets the initial time to the video clip time at the start frame.- Parameters:
n- the desired start frame
-
getStartFrame
public int getStartFrame()Gets the start frame for this model.- Returns:
- the start frame
-
setEndFrame
public void setEndFrame(int n) Sets the end frame for this model.- Parameters:
n- the desired end frame
-
getEndFrame
public int getEndFrame()Gets the end frame for this model.- Returns:
- the end frame
-
setAnglesInRadians
protected void setAnglesInRadians(boolean radians) Sets the display format for angles.- Overrides:
setAnglesInRadiansin classPointMass- Parameters:
radians-truefor radians, false for degrees
-
reset
protected abstract void reset()Resets model parameters and sets position(s) for start frame. Most of the work in this method must be done by subclasses. -
getModels
Gets the particle models associated with this model. By default this model is returned.- Returns:
- array of particle models associated with this model
-
isModelsVisible
protected boolean isModelsVisible() -
refreshInitialTime
protected void refreshInitialTime()Refreshes initial time parameter for this model. -
refreshSteps
Refreshes step positions. -
holdPainting
protected void holdPainting(boolean b) -
fireStepsChanged
public void fireStepsChanged()- Overrides:
fireStepsChangedin classTTrack
-
createPositionStep
Creates a position step with image coordinates. Overridden by ParticleDataTrack.- Parameters:
track- the PointMass trackn- the frame numberx- the x coordinatey- the y coordinate- Returns:
- the PositionStep
-
refreshDerivsIfNeeded
protected void refreshDerivsIfNeeded()Refreshes the derivatives if they have not been refreshed in the refreshSteps() method (ie if the variable "refreshDerivsLater" is false). -
trimSteps
protected void trimSteps()Trims all steps after endFrame. -
saveState
protected void saveState(int frameNumber) Saves the current state. Does nothing by default, but DynamicParticle overrides.- Parameters:
frameNumber- the frame number
-
restoreState
protected boolean restoreState(int frameNumber) Restores the state to a previously saved state, if any. Does nothing by default, but DynamicParticle overrides.- Parameters:
frameNumber- the frame number- Returns:
- true if state successfully restored
-
isUseDefaultReferenceFrame
protected boolean isUseDefaultReferenceFrame()Determines if the default reference frame is used to determine step positions.- Returns:
- true if the default reference frame is used
-
setUseDefaultReferenceFrame
public void setUseDefaultReferenceFrame(boolean useDefault) Sets the useDefaultReferenceFrame flag.- Parameters:
useDefault- true to use the default reference frame
-
getModelBuilder
Gets the model builder.- Returns:
- the model builder
-
createMassAndTimeParameters
protected void createMassAndTimeParameters()This adds the mass and initial time parameters to the function panel. -
getInitialValues
public double[] getInitialValues()Gets the initial values.- Returns:
- initial values
-
getParamEditor
Gets the parameter editor.- Returns:
- ParamEditor
-
getInitEditor
Gets the initial value editor.- Returns:
- the editor
-
getFunctionEditor
Gets the function editor.- Returns:
- UserFunctionEditor
-
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-
dispose
public void dispose()Description copied from class:TTrackDisposes of resources when this track is deleted or cleared. -
newTimeParam
-