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.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 Footprintprotected Footprint[]protected booleanprotected Stringprotected ArrayList<ParticleDataTrack>protected Stringprotected Stringprotected Stringstatic final Stringno 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, yLimitFields 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, xVisibleOnAllFields 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.DataTrack
PROPERTY_DATATRACK_STARTFRAMEFields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendData(DatasetManager manager) Informs this track that values have been appended to the Data.protected PositionStepcreatePositionStep(PointMass track, int n, double x, double y) Creates a position step with image coordinates.protected voiddelete(boolean postEdit) Removes this track from all panels that draw it.voiddispose()Disposes of resources when this track is deleted or cleared.protected voiddoAllCircle(String footprintName) protected voidprotected voidprotected voiddoAutoPaste(boolean tf) getData()Gets the model data.double[][]Gets the data array.Gets the data clip.protected intgetDataIndexAtVideoStepNumber(int videoStepNumber) Converts video step number to data index.intGets the end frame for this model.intGets the end data index.doubleGets 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 StringReturns the lead track (index=0)static XML.ObjectLoaderReturns 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 Footprintprotected StringGets the name of this track.protected static StringgetNextName(String original, int increment) protected JMenugetPointMenu(TrackerPanel trackerPanel) Returns a menu with items associated with this track's point properties.protected StringGets the point name.Gets the data source.intGets the start frame for this model.intGets the step in the videoclip at which the first data point is displayed.doublegetStepTime(int step) Gets the (start) time for a given step.getToolbarTrackComponents(TrackerPanel trackerPanel) Overrides TTrack getToolbarTrackComponents method.protected static ParticleDataTrackgetTrackForData(DatasetManager data, TrackerPanel trackerPanel) protected static ParticleDataTrackgetTrackForDataString(String dataString, TrackerPanel trackerPanel) Gets the trackerPanel video clip.Gets the VideoPanel on which this DataTrack is drawn.doubleGets the data-based video start time in seconds if availableprotected voidInitializes the ModelFunctionPanel.voidinvalidateData(Object newValue) booleanDetermines if autopaste is enabled for this DataTrack.booleanDetermines if time is defined by the Data.booleanReports whether or not this is visible.voidResponds to property change events.protected voidRefreshes initial time parameter for this model.protected voidreset()Resets model parameters and sets position(s) for start frame.protected voidsetAllColors(Color[] colors) Sets the colors of all points and line in this track.protected voidsetAllFootprints(String[] footprints) Sets the footprints of all points in this track.protected voidsetAutoPasteEnabled(boolean enable) Sets the autoPasteEnabled flag for this track.voidOverrides TTrack setColor method.voidsetColorToDefault(int index) Sets the color to one of the default colors[].voidSets the Data for the track.voidsetData(DatasetManager manager) Sets the Data.voidsetEndFrame(int n) Sets the end frame for this model.voidsetFootprint(String name) Sets the footprint to the specified choice.voidsetLineColor(Color color) Sets the line color for the modelFootprint.protected voidsetModelFootprint(String name) protected voidsetMoreData(ArrayList<Object[]> pointData) voidSets the name.protected voidsetPointName(String newName) Sets the point name.voidSets the data source.voidsetStartFrame(int n) Sets the start frame for this model.voidsetStartStep(int start) Sets the step in the videoclip at which the first data point is displayed.voidsetTrackerPanel(TrackerPanel panel) Adds events for TrackerPanel.voidsetVisible(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, trimStepsMethods 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, updateDerivativesMethods 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, 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.media.core.DataTrack
addPropertyChangeListenerMethods 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:TTrackRemoves 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:
getMenuin 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:TTrackGets this track's current icon. -
getToolbarTrackComponents
Description copied from class:PointMassOverrides TTrack getToolbarTrackComponents method.- Overrides:
getToolbarTrackComponentsin 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:DataTrackDetermines if autopaste is enabled for this DataTrack.- Specified by:
isAutoPasteEnabledin 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:TTrackGets the name of this track. -
setName
Description copied from class:ParticleModelSets the name. Overrides TTrack method.- Overrides:
setNamein classParticleModel- Parameters:
newName- the name
-
setColor
Description copied from class:PointMassOverrides TTrack setColor method. -
setLineColor
Sets the line color for the modelFootprint.- Parameters:
color- the color
-
setFootprint
Description copied from class:TTrackSets the footprint to the specified choice.- Overrides:
setFootprintin 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:
getDataClipin interfaceDataTrack- Returns:
- the data clip
-
invalidateData
- Overrides:
invalidateDatain 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:TTrackReports whether or not this is visible. -
setVisible
public void setVisible(boolean vis) Description copied from class:PointMassShows and hides this track.- Overrides:
setVisiblein classPointMass- Parameters:
vis-trueto 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:
isTimeDataAvailablein 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:
getVideoStartTimein 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:
getFrameDurationin interfaceDataTrack- Returns:
- the frame duration (assumed in seconds), or Double.NaN if unavailable
-
setStartFrame
public void setStartFrame(int n) Description copied from class:ParticleModelSets the start frame for this model. Also sets the initial time to the video clip time at the start frame.- Specified by:
setStartFramein interfaceDataTrack- Overrides:
setStartFramein classParticleModel- Parameters:
n- the desired start frame
-
setStartStep
public void setStartStep(int start) Description copied from interface:DataTrackSets the step in the videoclip at which the first data point is displayed.- Specified by:
setStartStepin interfaceDataTrack- Parameters:
start- the start step number
-
getStartStep
public int getStartStep()Description copied from interface:DataTrackGets the step in the videoclip at which the first data point is displayed.- Specified by:
getStartStepin interfaceDataTrack- Returns:
- the start step number
-
setEndFrame
public void setEndFrame(int n) Description copied from class:ParticleModelSets the end frame for this model.- Overrides:
setEndFramein classParticleModel- Parameters:
n- the desired end frame
-
refreshInitialTime
protected void refreshInitialTime()Description copied from class:ParticleModelRefreshes initial time parameter for this model.- Overrides:
refreshInitialTimein classParticleModel
-
getStartFrame
public int getStartFrame()Description copied from class:ParticleModelGets the start frame for this model.- Specified by:
getStartFramein interfaceDataTrack- Overrides:
getStartFramein classParticleModel- Returns:
- the start frame
-
getEndFrame
public int getEndFrame()Description copied from class:ParticleModelGets the end frame for this model.- Overrides:
getEndFramein 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:TTrackSets the color to one of the default colors[].- Overrides:
setColorToDefaultin classTTrack- Parameters:
index- the color index
-
setTrackerPanel
Description copied from class:PointMassAdds events for TrackerPanel.- Overrides:
setTrackerPanelin classParticleModel- Parameters:
panel- the new TrackerPanel
-
propertyChange
Description copied from class:ParticleModelResponds to property change events.- Specified by:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classParticleModel- Parameters:
e- the property change event
-
initializeFunctionPanel
protected void initializeFunctionPanel()Description copied from class:ParticleModelInitializes the ModelFunctionPanel.- Specified by:
initializeFunctionPanelin classParticleModel
-
reset
protected void reset()Description copied from class:ParticleModelResets model parameters and sets position(s) for start frame. Most of the work in this method must be done by subclasses.- Specified by:
resetin classParticleModel
-
setData
Description copied from interface:DataTrackSets 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:DataTrackGets the VideoPanel on which this DataTrack is drawn.- Specified by:
getVideoPanelin interfaceDataTrack- Returns:
- the VideoPanel
-
createPositionStep
Description copied from class:ParticleModelCreates a position step with image coordinates. Overridden by ParticleDataTrack.- Overrides:
createPositionStepin 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:TTrackDisposes of resources when this track is deleted or cleared.- Overrides:
disposein classParticleModel
-