Class ParticleDataTrack
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.cabrillo.tracker.TTrack
org.opensourcephysics.cabrillo.tracker.PointMass
org.opensourcephysics.cabrillo.tracker.ParticleModel
org.opensourcephysics.cabrillo.tracker.ParticleDataTrack
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,Drawable
,Interactive
,Measurable
,DataTrack
,Trackable
This is a particle model with steps based on world positions defined in a
Data object. The Data object is an "external model" associated with a source
(eg path, URL, Tool, null) The Data must define one or more data arrays in
matched x-y pairs and may include a time array "t"
- Author:
- Douglas Brown
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.PointMass
PointMass.FrameData
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 Footprint
protected Footprint[]
protected boolean
protected String
protected ArrayList<ParticleDataTrack>
protected String
protected String
protected String
static final String
no listeners?Fields inherited from class org.opensourcephysics.cabrillo.tracker.ParticleModel
dt, endFrame, functionEditor, functionPanel, inspectorH, inspectorX, inspectorY, invalidWarningShown, loading, massParamListener, modelBuilder, modelBuilderItem, myPoint, nan, nCalc, points, prevX, prevY, refreshDerivsLater, refreshing, refreshStepsLater, showModelBuilder, stampItem, startFrame, startFrameUndefined, t0, time, timeFormat, timeParamListener, tracePt, tracePtsPerStep, traceX, traceY, useDefaultReferenceFrame, useDefaultRefFrameItem, xLimit, yLimit
Fields 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, xVisibleOnAll
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, 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.DataTrack
PROPERTY_DATATRACK_STARTFRAME
Fields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendData
(DatasetManager manager) Informs this track that values have been appended to the Data.protected PositionStep
createPositionStep
(PointMass track, int n, double x, double y) Creates a position step with image coordinates.protected void
delete
(boolean postEdit) Removes this track from all panels that draw it.void
dispose()
Disposes of resources when this track is deleted or cleared.protected void
doAllCircle
(String footprintName) protected void
protected void
protected void
doAutoPaste
(boolean tf) getData()
Gets the model data.double[][]
Gets the data array.Gets the data clip.protected int
getDataIndexAtVideoStepNumber
(int videoStepNumber) Converts video step number to data index.int
Gets the end frame for this model.int
Gets the end data index.double
Gets the data-based frame duration in seconds if availableGets the full name (model & point) for this track.Gets this track's current icon.protected static String
Returns the lead track (index=0)static XML.ObjectLoader
Returns an ObjectLoader to save and load data for this class.getMenu
(TrackerPanel trackerPanel, JMenu menu0) Returns a menu with items that control this track.protected Footprint
protected String
Gets the name of this track.protected static String
getNextName
(String original, int increment) protected JMenu
getPointMenu
(TrackerPanel trackerPanel) Returns a menu with items associated with this track's point properties.protected String
Gets the point name.Gets the data source.int
Gets the start frame for this model.int
Gets the step in the videoclip at which the first data point is displayed.double
getStepTime
(int step) Gets the (start) time for a given step.getToolbarTrackComponents
(TrackerPanel trackerPanel) Overrides TTrack getToolbarTrackComponents method.protected static ParticleDataTrack
getTrackForData
(DatasetManager data, TrackerPanel trackerPanel) protected static ParticleDataTrack
getTrackForDataString
(String dataString, TrackerPanel trackerPanel) Gets the trackerPanel video clip.Gets the VideoPanel on which this DataTrack is drawn.double
Gets the data-based video start time in seconds if availableprotected void
Initializes the ModelFunctionPanel.void
invalidateData
(Object newValue) boolean
Determines if autopaste is enabled for this DataTrack.boolean
Determines if time is defined by the Data.boolean
Reports whether or not this is visible.void
Responds to property change events.protected void
Refreshes initial time parameter for this model.protected void
reset()
Resets model parameters and sets position(s) for start frame.protected void
setAllColors
(Color[] colors) Sets the colors of all points and line in this track.protected void
setAllFootprints
(String[] footprints) Sets the footprints of all points in this track.protected void
setAutoPasteEnabled
(boolean enable) Sets the autoPasteEnabled flag for this track.void
Overrides TTrack setColor method.void
setColorToDefault
(int index) Sets the color to one of the default colors[].void
Sets the Data for the track.void
setData
(DatasetManager manager) Sets the Data.void
setEndFrame
(int n) Sets the end frame for this model.void
setFootprint
(String name) Sets the footprint to the specified choice.void
setLineColor
(Color color) Sets the line color for the modelFootprint.protected void
setModelFootprint
(String name) protected void
setMoreData
(ArrayList<Object[]> pointData) void
Sets the name.protected void
setPointName
(String newName) Sets the point name.void
Sets the data source.void
setStartFrame
(int n) Sets the start frame for this model.void
setStartStep
(int start) Sets the step in the videoclip at which the first data point is displayed.void
setTrackerPanel
(TrackerPanel panel) Adds events for TrackerPanel.void
setVisible
(boolean vis) Shows and hides this track.Methods inherited from class org.opensourcephysics.cabrillo.tracker.ParticleModel
createMassAndTimeParameters, delete, doStamp, draw, drawMe, findInteractive, fireStepsChanged, getDisplayName, getFunctionEditor, getInitEditor, getInitialValues, getLastValidFrame, getMass, getModelBuilder, getModels, getParamEditor, getToolbarPointComponents, holdPainting, isAutoTrackable, isDependent, isModelsVisible, isStepComplete, isUseDefaultReferenceFrame, newTimeParam, refreshDerivsIfNeeded, refreshSteps, restoreState, saveState, setAnglesInRadians, setLastValidFrame, setLocked, setMass, setUseDefaultReferenceFrame, trimSteps
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, 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, setFontLevel, setFootprint, setLabelsVisible, setMarking, setPositionVisible, setPositionVisibleOnAll, setTraceVisible, setVelocityColor, setVelocityFootprint, setVelocityFootprints, setVVisible, setVVisibleOnAll, updateDerivatives, updateDerivatives, updateDerivatives, updateDerivatives, updateDerivatives
Methods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFixedItem, addFootprint, addListener, addListenerNCF, addPanelEvents, addStepListener, addTextColumn, assembleMenu, clearColumns, convertTextToDataColumn, createAllVariables, createWarningDialog, finalize, getAllVariables, getAttachmentDescription, getAttachmentLength, getAttachments, getBaseTrackName, getBaseTypeInt, getColor, getCustomFormatPatterns, getData, getData, getDataDescription, getDataName, getDefaultFormatPatterns, getDefaultFormatPatterns, getDescription, getFootprint, getFootprintName, getFootprints, getFormatPatterns, getFrameForData, getID, getMarkedPoint, getMarkingCursor, getMenuItems, getMessage, 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, isAttached, isAutoAdvance, isAutoTrackable, isDataValid, isEmpty, isEnabled, isFullyAttached, isLocked, isMarkByDefault, isMarking, isMeasured, isTrailVisible, isViewable, loadAttachmentsFromNames, refreshAttachments, refreshAttachmentsLater, refreshData, refreshDecimalSeparators, removeActiveTrack, removeDeleteTrackItem, removeListener, removeListenerNCF, removePanelEvents, removeStepListener, removeTextColumn, renameTextColumn, repaint, repaint, repaintAll, repaintStep, restorePatterns, savePatterns, setActive, setAutoAdvance, setDefaultNameAndColor, setDescription, setEnabled, setFixedPosition, setFootprints, setFootprints, setFormatPattern, setInitialFormatPatterns, setMarkByDefault, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, setTextColumnEntry, setTrailLength, setTrailVisible, setViewable, setX, setXY, setY, showAnglePopup, showFormatPopup, toString, 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.media.core.DataTrack
addPropertyChangeListener
Methods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
-
Field Details
-
PROPERTY_PARTICLEDATATRACK_DATACLIP
no listeners?- See Also:
-
pointName
-
modelName
-
morePoints
-
pendingDataString
-
prevDataString
-
modelFootprint
-
modelFootprints
-
modelFootprintVisible
protected boolean modelFootprintVisible
-
-
Constructor Details
-
ParticleDataTrack
Public constructor.- Parameters:
data
- the Data objectsource
- the data source object (null if data is pasted)- Throws:
Exception
- if the data does not define x and y-datasets
-
-
Method Details
-
setMoreData
-
doAllColor
protected void doAllColor() -
doAllCircle
-
doAllFoot
-
delete
protected void delete(boolean postEdit) Description copied from class:TTrack
Removes this track from all panels that draw it. If no other objects have a reference to it, this should then be garbage-collected. -
setModelFootprint
-
getModelFootprint
-
getModelFootprintName
-
getMenu
Returns a menu with items that control this track.- Overrides:
getMenu
in classParticleModel
- Parameters:
trackerPanel
- the tracker panelmenu0
- the menu. If null, a dynamic menu is returned that adds items only when selected- Returns:
- a menu
-
getPointMenu
Returns a menu with items associated with this track's point properties.- Parameters:
trackerPanel
- the tracker panel- Returns:
- a menu
-
getIcon
Description copied from class:TTrack
Gets this track's current icon. -
getToolbarTrackComponents
Description copied from class:PointMass
Overrides TTrack getToolbarTrackComponents method.- Overrides:
getToolbarTrackComponents
in classPointMass
- Parameters:
trackerPanel
- the tracker panel- Returns:
- a list of components
-
doAutoPaste
protected void doAutoPaste(boolean tf) -
isAutoPasteEnabled
public boolean isAutoPasteEnabled()Description copied from interface:DataTrack
Determines if autopaste is enabled for this DataTrack.- Specified by:
isAutoPasteEnabled
in interfaceDataTrack
- Returns:
- true if autopaste is enabled
-
setAutoPasteEnabled
protected void setAutoPasteEnabled(boolean enable) Sets the autoPasteEnabled flag for this track.- Parameters:
enable
- true to enable autopasting
-
getPointName
Gets the point name. The point name is appended to the lead track name for most buttons and dropdowns.- Returns:
- the point name
-
setPointName
Sets the point name. The point name is appended to the leader's track name to name the point.- Parameters:
newName
- the point name
-
setAllColors
Sets the colors of all points and line in this track. Used for undo/redo.- Parameters:
colors
- array of colors
-
setAllFootprints
Sets the footprints of all points in this track. Used for undo/redo.- Parameters:
footprints
- array of footprints
-
getFullName
Gets the full name (model & point) for this track.- Returns:
- the full name
-
getName
Description copied from class:TTrack
Gets the name of this track. -
setName
Description copied from class:ParticleModel
Sets the name. Overrides TTrack method.- Overrides:
setName
in classParticleModel
- Parameters:
newName
- the name
-
setColor
Description copied from class:PointMass
Overrides TTrack setColor method. -
setLineColor
Sets the line color for the modelFootprint.- Parameters:
color
- the color
-
setFootprint
Description copied from class:TTrack
Sets the footprint to the specified choice.- Overrides:
setFootprint
in classTTrack
- Parameters:
name
- the name of the desired footprint
-
getLeader
Returns the lead track (index=0)- Returns:
- the leader (may be this track)
-
setData
Sets the Data. Data must define columns "x" and "y". If time data is included, it is assumed to be in seconds.- Parameters:
manager
- the Data object- Throws:
Exception
- if the data does not define x and y-columns
-
getData
Gets the model data. This can return null if loaded from XMLControl. -
getSource
Gets the data source. -
setSource
Sets the data source. -
getDataClip
Gets the data clip.- Specified by:
getDataClip
in interfaceDataTrack
- Returns:
- the data clip
-
invalidateData
- Overrides:
invalidateData
in classTTrack
-
getVideoClip
Gets the trackerPanel video clip.- Returns:
- the video clip (null if not yet added to TrackerPanel)
-
isVisible
public boolean isVisible()Description copied from class:TTrack
Reports whether or not this is visible. -
setVisible
public void setVisible(boolean vis) Description copied from class:PointMass
Shows and hides this track.- Overrides:
setVisible
in classPointMass
- Parameters:
vis
-true
to show this track
-
getEndIndex
public int getEndIndex()Gets the end data index.- Returns:
- the end index
-
getStepTime
public double getStepTime(int step) Gets the (start) time for a given step.- Returns:
- the time
-
isTimeDataAvailable
public boolean isTimeDataAvailable()Determines if time is defined by the Data.- Specified by:
isTimeDataAvailable
in interfaceDataTrack
- Returns:
- true if time data is available
-
getVideoStartTime
public double getVideoStartTime()Gets the data-based video start time in seconds if available- Specified by:
getVideoStartTime
in interfaceDataTrack
- Returns:
- the start time (assumed in seconds), or Double.NaN if unavailable
-
getFrameDuration
public double getFrameDuration()Gets the data-based frame duration in seconds if available- Specified by:
getFrameDuration
in interfaceDataTrack
- Returns:
- the frame duration (assumed in seconds), or Double.NaN if unavailable
-
setStartFrame
public void setStartFrame(int n) Description copied from class:ParticleModel
Sets the start frame for this model. Also sets the initial time to the video clip time at the start frame.- Specified by:
setStartFrame
in interfaceDataTrack
- Overrides:
setStartFrame
in classParticleModel
- Parameters:
n
- the desired start frame
-
setStartStep
public void setStartStep(int start) Description copied from interface:DataTrack
Sets the step in the videoclip at which the first data point is displayed.- Specified by:
setStartStep
in interfaceDataTrack
- Parameters:
start
- the start step number
-
getStartStep
public int getStartStep()Description copied from interface:DataTrack
Gets the step in the videoclip at which the first data point is displayed.- Specified by:
getStartStep
in interfaceDataTrack
- Returns:
- the start step number
-
setEndFrame
public void setEndFrame(int n) Description copied from class:ParticleModel
Sets the end frame for this model.- Overrides:
setEndFrame
in classParticleModel
- Parameters:
n
- the desired end frame
-
refreshInitialTime
protected void refreshInitialTime()Description copied from class:ParticleModel
Refreshes initial time parameter for this model.- Overrides:
refreshInitialTime
in classParticleModel
-
getStartFrame
public int getStartFrame()Description copied from class:ParticleModel
Gets the start frame for this model.- Specified by:
getStartFrame
in interfaceDataTrack
- Overrides:
getStartFrame
in classParticleModel
- Returns:
- the start frame
-
getEndFrame
public int getEndFrame()Description copied from class:ParticleModel
Gets the end frame for this model.- Overrides:
getEndFrame
in classParticleModel
- Returns:
- the end frame
-
getDataIndexAtVideoStepNumber
protected int getDataIndexAtVideoStepNumber(int videoStepNumber) Converts video step number to data index.- Parameters:
videoStepNumber
-- Returns:
- the data index, or -1 if none
-
setColorToDefault
public void setColorToDefault(int index) Description copied from class:TTrack
Sets the color to one of the default colors[].- Overrides:
setColorToDefault
in classTTrack
- Parameters:
index
- the color index
-
setTrackerPanel
Description copied from class:PointMass
Adds events for TrackerPanel.- Overrides:
setTrackerPanel
in classParticleModel
- Parameters:
panel
- the new TrackerPanel
-
propertyChange
Description copied from class:ParticleModel
Responds to property change events.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Overrides:
propertyChange
in classParticleModel
- Parameters:
e
- the property change event
-
initializeFunctionPanel
protected void initializeFunctionPanel()Description copied from class:ParticleModel
Initializes the ModelFunctionPanel.- Specified by:
initializeFunctionPanel
in classParticleModel
-
reset
protected void reset()Description copied from class:ParticleModel
Resets model parameters and sets position(s) for start frame. Most of the work in this method must be done by subclasses.- Specified by:
reset
in classParticleModel
-
setData
Description copied from interface:DataTrack
Sets the Data for the track. Data must define "x" and "y" positions, and may define "t". Optional source may be a JPanel control panel. -
getVideoPanel
Description copied from interface:DataTrack
Gets the VideoPanel on which this DataTrack is drawn.- Specified by:
getVideoPanel
in interfaceDataTrack
- Returns:
- the VideoPanel
-
createPositionStep
Description copied from class:ParticleModel
Creates a position step with image coordinates. Overridden by ParticleDataTrack.- Overrides:
createPositionStep
in classParticleModel
- Parameters:
track
- the PointMass trackn
- the frame numberx
- the x coordinatey
- the y coordinate- Returns:
- the PositionStep
-
getDataArray
public double[][] getDataArray()Gets the data array.- Returns:
- double[][] {x, y, t}
-
appendData
Informs this track that values have been appended to the Data. not referenced- Parameters:
manager
- Data containing newly appended values- Throws:
Exception
- if (x, y) data not found
-
getImportableDataName
-
getTrackForDataString
protected static ParticleDataTrack getTrackForDataString(String dataString, TrackerPanel trackerPanel) -
getTrackForData
-
getNextName
-
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-
dispose
public void dispose()Description copied from class:TTrack
Disposes of resources when this track is deleted or cleared.- Overrides:
dispose
in classParticleModel
-