Class TTrack
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.cabrillo.tracker.TTrack
- All Implemented Interfaces:
PropertyChangeListener,EventListener,Drawable,Interactive,Measurable,Trackable
- Direct Known Subclasses:
Calibration,CircleFitter,CoordAxes,InputTrack,LineProfile,OffsetOrigin,PerspectiveTrack,PointMass,RGBRegion,Vector
public abstract class TTrack
extends OSPRuntime.Supported
implements Interactive, Trackable, PropertyChangeListener
A TTrack draws a series of visible Steps on a TrackerPanel. This is an
abstract class that cannot be instantiated directly.
- Author:
- Douglas Brown
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA dialog used to set the name of a track.protected classprotected static classA DrawingPanel that mimics the look of a JLabel but can display subscripts.protected classA DecimalField that resizes itself for display on a TTrackBar.protected classA NumberField that resizes itself for display on a TTrackBar. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DecimalFieldprotected TTrack.TextLineLabelprotected Componentprotected String[]protected TTrack[]protected booleanprotected JCheckBoxMenuItemprotected booleanprotected ActionListenerprotected JMenuItemprotected static JButtonprotected JMenuItemprotected Object[][]protected String[]protected JMenuItemprotected String[]protected XMLPropertyprotected DatasetManagerprotected booleanprotected Color[]protected Footprintprotected JMenuItemprotected JMenuItemprotected Stringprotected JMenuItemprotected booleanprotected Borderprotected JCheckBoxMenuItemprotected Footprintprotected ActionListenerprotected JMenuprotected Footprint[]protected MouseAdapterprotected MouseAdapterprotected Stringstatic final Integerstatic final Integerprotected booleanset false if data needs to be initialized, e.g.protected booleanprotected Fontprotected booleanprotected JCheckBoxMenuItemprotected NumberFieldprotected TTrack.TextLineLabelprotected Componentprotected booleanprotected JCheckBoxMenuItemprotected Stringprotected static TTrack.NameDialogprotected JMenuItemprotected static intprotected static final String[]protected Map<String,NumberField[]> protected Stringprotected final Point2D.Double[]protected NumberField[]protected int[]static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected booleanprotected static JCheckBoxprotected static JDialogprotected static booleanprotected static JTextPaneprotected JLabelprotected TTrack.StepArrayprotected Componentprotected intprotected JLabelprotected intprotected NumberFieldprotected TFrameprotected JLabelprotected TrackerPanelprotected intprotected booleanprotected JCheckBoxMenuItemprotected Componentfinal intprotected JLabelstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intprotected booleanprotected booleanprotected JCheckBoxMenuItemprotected NumberFieldprotected TTrack.TextLineLabelprotected Componentprotected JSpinnerprotected NumberFieldprotected TTrack.TextLineLabelprotected Componentprotected JSpinnerFields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddFixedItem(JMenu menu) voidaddFootprint(Footprint footprint) Adds a new footprint to the current choices.voidaddListener(TrackerPanel panel) Allow the TrackPanel to respond to specific track (outgoing) property changes.voidThe NAME, COLOR, and FOOTPRINT property changes are of interest to AutoTracker, DynamicSystemInspector, VectorSumInspector, AttachementDialog, TrackChooserTView, TrackControl, and TTrackBar.protected voidaddPanelEvents(String[] events) Add specific (incoming) trackPanel events that the track has to respond to.voidSTEP and STEPS listeners include TrackerPanel, CenterOfMass, CircleFitter, DynamicParticle, DynamicSystem, ReferenceFrame, PlotTrackView, and TrackChooserTView.booleanaddTextColumn(String name) Adds a new text column.protected JMenuassembleMenu(JMenu menu, JMenuItem topItem) Remove unwanted menu items and separators, then add the top item, a separator if needed, then clean out duplicate separators.autoMarkAt(int n, double x, double y) Used by autoTracker to mark a step at a match target position.protected voidclearColumns(DatasetManager data, int count, String[] dataVariables, String desc, double[][] validData, int len) Refreshes data by clearing previous data and appending new valid data.protected DatasetconvertTextToDataColumn(String textColumnName) createAllVariables(String[] datavars, String[] fieldvars) abstract StepcreateStep(int n, double x, double y) Creates a new step.protected voidvoiddelete()Removes this track from all panels that draw it.protected voiddelete(boolean postEdit) Removes this track from all panels that draw it.deleteStep(int n) Deletes a step.voiddispose()Disposes of resources when this track is deleted or cleared.voiddraw(DrawingPanel panel, Graphics _g) Draws the steps on the tracker panel.voiderase()Erases all steps on all panels.voidErases all steps on the specified panel.voidfinalize()findInteractive(DrawingPanel panel, int xpix, int ypix) Finds the interactive drawable object located at the specified pixel position.voidgetAllVariables(int ttype) Gets a list of all variable names for a given track type.getAttachmentDescription(int n) Returns the description of a particular attachment point.protected intTTrack[]Returns the array of attachments for this track.static StringgetBaseTrackName(int ttype) abstract Stringstatic intgetBaseTypeInt(String type) getColor()Gets the color.protected String[]Gets the custom format patterns for a specified track for TTrack.Loader.saveObjectgetData(TrackerPanel panel) Returns the DatasetManager.getData(TrackerPanel panel, int datasetIndex) Returns the DatasetManager for a specified Dataset index, if supported.getDataDescription(int index) Gets the description of a data variable.getDataName(int index) Gets the name of a data variable.getDefaultFormatPatterns(int ttype) Gets the description of this track.Gets the current footprint.getFootprint(Step step) Gets the current footprint.abstract intGets the length of the footprints required by this track.Gets the full name of the current footprint, including properties if availableGets the footprint choices.getFootprints(Step step) Gets the footprint choices.String[]Gets the format patterns for a specified track.abstract String[]intgetFrameForData(String xVar, String yVar, double[] xyValues) Gets the frame number associated with specified variables and values.Gets this track's current icon.intgetID()Gets the ID number of this track.static XML.ObjectLoaderReturns an ObjectLoader to save and load data for this class.getMarkedPoint(int n, int index) Used by autoTracker to get the marked point for a given frame and index.protected CursorGets the cursor used for marking new steps.getMenu(TrackerPanel trackerPanel, JMenu menu) Prepares menu items and adds them to a menu.protected voidGets a message about this track to display in a message box.getName()Gets the name of this track.Gets the name of this track.protected TTrack.NameDialoggetNextVisibleStep(Step step, TrackerPanel panel) Gets next visible step after the specified step.protected Map<String,NumberField[]> Gets a map of number fields by name.protected NumberField[]getNumberFieldsForStep(Step step) Returns an array of NumberFields {x, y, magnitude, angle} for a given step.protected ArrayList<PlotTrackView>Gets all plot views for a specified track.Gets the preferred order of data table columns.getPreviousVisibleStep(Step step, TrackerPanel trackerPanel) Gets first visible step before the specified step.getProperty(String name) Gets a user property of the track.Gets a collection of user property names for the track.protected JDialoggetStep(int n) Gets a step specified by frame number.getStep(TPoint point, TrackerPanel trackerPanel) Gets a step containing a TPoint.abstract intGets the length of the steps created by this track.Step[]getSteps()Gets the step array.protected JDialogprotected ArrayList<TableTrackView>Gets all table views for a specified track.protected StringgetTargetDescription(int pointIndex) Returns a description of a target point with a given index.protected intReturns the target index for the autotracker.getTextColumnEntry(String columnName, int frameNumber) Gets the entry in a text column for a specified frame.Gets the text column names.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.protected static TTrackgetTrack(int ID) intGets the trail length.static Collection<TTrack>abstract StringgetVarDimsImpl(String variable) protected StringgetVarFormatPattern(String name) Gets the format pattern for a specified track and variable.static StringgetVariableDimensions(TTrack track, String variable) Determines the unit dimensions associated with a given track variable.protected String[]Gets an array of variables to format for a given track type and formatter display name.doublegetX()Gets x.doublegetXMax()Gets the maximum x needed to draw this object.doublegetXMin()Gets the minimum x needed to draw this object.doublegetY()Gets y.doublegetYMax()Gets the maximum y needed to draw this object.doublegetYMin()Gets the minimum y needed to draw this object.voidinitialize(TrackerPanel panel) Finish up any unfinished loading business that for whatever reason was not finished upon loading a track.voidinvalidateData(Object newValue) booleanDetermines if this is attached to one or more tracks.booleanGets the autoAdvance property.protected booleanDetermines if at least one point in this track is autotrackable.protected booleanisAutoTrackable(int pointIndex) Determines if the given point index is autotrackable.booleanbooleanReports whether or not this is dependent.booleanisEmpty()Returns true if this track contains no steps.booleanGets whether this responds to mouse hits.protected booleanDetermines if all attachments are non-nullbooleanisLocked()Gets the locked property.booleanGets the markByDefault property.protected booleanDetermines if this track is marking.booleanReports whether information is available to set min/max values.booleanisStepComplete(int n) Returns true if the step at the specified frame number is complete.booleanisStepVisible(Step step, TrackerPanel trackerPanel) Reports whether or not the specified step is visible.booleanGets the trail visibility.booleanReports whether or not this is viewable.booleanReports whether or not this is visible.protected booleanloadAttachmentsFromNames(boolean refresh) Loads the attachments for this track based on attachmentNames array, if any.voidResponds to property change events fired in TrackerPanel or VideoPanel.protected voidRefreshes the attachments for this track.protected voidRefreshes the attachments for this track after a delay.protected voidrefreshData(DatasetManager data, TrackerPanel panel) Refreshes the data in the specified DatasetManager.protected voidrefreshData(DatasetManager data, TrackerPanel trackerPanel, int startFrame, int stepCount) Refreshes the data for a specified frame range.voidvoidremark()Remarks all steps on all panels.voidRemarks all steps on the specified panel.static voidremoveActiveTrack(int id) protected voidremoveDeleteTrackItem(JMenu menu) remove the last item and the separator before it, provided that item is deleteTrackItem.voidremoveListener(TrackerPanel panel) Remove the TrackPanel from specific (outgoing) property change lists.voidprotected voidremovePanelEvents(String[] events) Remove specific (incoming) trackPanel events that the track was respond to.voidbooleanremoveTextColumn(String name) Removes a named text column.booleanrenameTextColumn(String name, String newName) Renames a text column.voidrepaint()Repaints all steps on all panels.voidRepaints all steps on the specified panel.protected voidSchedule repainting of all panel and world views associated with this track.voidrepaintStep(Step step) Repaints the specified step on all panels.static voidrestorePatterns(TrackerPanel panel) static voidsavePatterns(TrackerPanel panel) voidprotected voidsetAnglesInRadians(boolean radians) Sets the display format for angles.voidsetAutoAdvance(boolean auto) Sets the autoAdvance property.voidSets the color.voidsetColorToDefault(int index) Sets the color to one of the default colors[].voidsetDefaultNameAndColor(TrackerPanel trackerPanel, String connector) Sets the default name and color for a specified tracker panel.voidsetDescription(String desc) Sets the description of this track.voidsetEnabled(boolean enabled) Sets whether this responds to mouse hits.protected voidsetFixedPosition(boolean b) voidsetFontLevel(int level) Sets the font level.voidsetFootprint(String name) Sets the footprint to the specified choice.voidsetFootprint(String name, Step step) Sets the footprint to the specified choice.voidsetFootprints(Footprint[] choices) Sets the footprint choices.voidsetFootprints(Footprint[] choices, Step step) Sets the footprint choices.protected booleansetFormatPattern(String name, String pattern) Sets the format pattern for a specified track and name.voidsetInitialFormatPatterns(TrackerPanel trackerPanel) voidsetLocked(boolean locked) Locks and unlocks this track.voidsetMarkByDefault(boolean mark) Sets the markByDefault property.protected voidsetMarking(boolean marking) Sets the marking flag.voidSets the name of this track.voidsetProperty(String name, Object value) Sets a user property of the track.protected voidsetTargetIndex(int index) Sets the target index for the autotracker.protected voidsetTargetIndex(String description) Sets the target index for the autotracker.protected voidSets the target index for the autotracker.booleansetTextColumnEntry(String columnName, int frameNumber, String text) Sets the text in a text column for a specified frame.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.voidsetTrailLength(int steps) Sets the trail length.voidsetTrailVisible(boolean visible) Shows and hides the trail.voidsetViewable(boolean viewable) Determines whether views and track menu include this track.voidsetVisible(boolean visible) Shows and hides this track.voidsetX(double x) Empty setX method.voidsetXY(double x, double y) Empty setXY method.voidsetY(double y) Empty setY method.protected voidshowAnglePopup(NumberField field) protected voidshowFormatPopup(NumberField field) toString()Overrides Object toString method.voidTTRACK_VISIBLE is of interest to TToolBar Calibration and Ruler buttons, as well as WorldTView.Methods 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
-
PROPERTY_TTRACK_FOOTPRINT
- See Also:
-
PROPERTY_TTRACK_MASS
- See Also:
-
PROPERTY_TTRACK_MODELEND
- See Also:
-
PROPERTY_TTRACK_MODELSTART
- See Also:
-
PROPERTY_TTRACK_NAME
- See Also:
-
PROPERTY_TTRACK_STEP
- See Also:
-
PROPERTY_TTRACK_STEPS
- See Also:
-
PROPERTY_TTRACK_FORMAT
- See Also:
-
PROPERTY_TTRACK_VISIBLE
- See Also:
-
PROPERTY_TTRACK_DATA
- See Also:
-
PROPERTY_TTRACK_COLOR
- See Also:
-
PROPERTY_TTRACK_LOCKED
- See Also:
-
PROPERTY_TTRACK_TEXTCOLUMN
- See Also:
-
HINT_STEP_ADDED_OR_REMOVED
-
HINT_STEPS_SELECTED
-
ttype
public final int ttype -
skippedStepWarningDialog
-
skippedStepWarningTextpane
-
skippedStepWarningCheckbox
-
closeButton
-
skippedStepWarningOn
protected static boolean skippedStepWarningOn -
nameDialog
-
nextID
protected static int nextID -
name
-
description
-
visible
protected boolean visible -
trailVisible
protected boolean trailVisible -
trailLength
protected int trailLength -
locked
protected boolean locked -
enabled
protected boolean enabled -
viewable
protected boolean viewable -
footprints
-
footprint
-
defaultFootprint
-
defaultColors
-
steps
-
properties
-
datasetManager
-
points
-
toolbarTrackComponents
-
toolbarPointComponents
-
numberFields
-
autoAdvance
protected boolean autoAdvance -
markByDefault
protected boolean markByDefault -
isMarking
protected boolean isMarking -
xLabel
-
yLabel
-
magLabel
-
angleLabel
-
footprintListener
-
circleFootprintListener
-
labelFont
-
tp
-
tframe
-
dataProp
-
constantsLoadedFromXML
-
dataDescriptions
-
initialized
protected boolean initializedset false if data needs to be initialized, e.g. CenterOfMass from TRZ -
dataValid
protected boolean dataValid -
refreshDataLater
protected boolean refreshDataLater -
preferredColumnOrder
protected int[] preferredColumnOrder -
dataFrames
-
partName
-
hint
-
stepSizeWhenFirstMarked
protected int stepSizeWhenFirstMarked -
keyFrames
-
autoTrackerMarking
protected boolean autoTrackerMarking -
targetIndex
protected int targetIndex -
attachments
-
attachmentNames
-
textColumnEntries
-
textColumnNames
-
formatMouseListener
-
formatAngleMouseListener
-
customNumberFormats
-
tLabel
-
stepLabel
-
tValueLabel
-
stepValueLabel
-
tField
-
xField
-
yField
-
magField
-
angleField
-
positionFields
-
fieldBorder
-
xSpinner
-
ySpinner
-
footprintMenu
-
tSeparator
-
xSeparator
-
ySeparator
-
magSeparator
-
angleSeparator
-
stepSeparator
-
visibleItem
-
trailVisibleItem
-
markByDefaultItem
-
autoAdvanceItem
-
lockedItem
-
fixedItem
-
nameItem
-
colorItem
-
deleteTrackItem
-
deleteStepItem
-
clearStepsItem
-
descriptionItem
-
dataBuilderItem
-
TYPE_UNKNOWN
public static final int TYPE_UNKNOWN- See Also:
-
TYPE_CALIBRATION
public static final int TYPE_CALIBRATION- See Also:
-
TYPE_CIRCLEFITTER
public static final int TYPE_CIRCLEFITTER- See Also:
-
TYPE_COORDAXES
public static final int TYPE_COORDAXES- See Also:
-
TYPE_LINEPROFILE
public static final int TYPE_LINEPROFILE- See Also:
-
TYPE_OFFSETORIGIN
public static final int TYPE_OFFSETORIGIN- See Also:
-
TYPE_POINTMASS
public static final int TYPE_POINTMASS- See Also:
-
TYPE_PROTRACTOR
public static final int TYPE_PROTRACTOR- See Also:
-
TYPE_RGBREGION
public static final int TYPE_RGBREGION- See Also:
-
TYPE_TAPEMEASURE
public static final int TYPE_TAPEMEASURE- See Also:
-
TYPE_VECTOR
public static final int TYPE_VECTOR- See Also:
-
TYPE_PERSPECTIVE
public static final int TYPE_PERSPECTIVE- See Also:
-
NOMAP
-
NOMAPS
-
NOVARS
-
NOVARA
-
-
Constructor Details
-
TTrack
protected TTrack(int ttype) Constructs a TTrack.- Parameters:
type-
-
-
Method Details
-
propertyChange
Responds to property change events fired in TrackerPanel or VideoPanel.- Specified by:
propertyChangein interfacePropertyChangeListener- Parameters:
e- the property change event
-
setTrackerPanel
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.- Parameters:
panel- the TrackerPanel
-
addPanelEvents
Add specific (incoming) trackPanel events that the track has to respond to.- Parameters:
events-
-
removePanelEvents
Remove specific (incoming) trackPanel events that the track was respond to.- Parameters:
events-
-
addListener
Allow the TrackPanel to respond to specific track (outgoing) property changes.- Parameters:
panel-
-
removeListener
Remove the TrackPanel from specific (outgoing) property change lists.- Parameters:
panel-
-
addListenerNCF
The NAME, COLOR, and FOOTPRINT property changes are of interest to AutoTracker, DynamicSystemInspector, VectorSumInspector, AttachementDialog, TrackChooserTView, TrackControl, and TTrackBar.- Parameters:
l-
-
removeListenerNCF
-
addStepListener
STEP and STEPS listeners include TrackerPanel, CenterOfMass, CircleFitter, DynamicParticle, DynamicSystem, ReferenceFrame, PlotTrackView, and TrackChooserTView.- Parameters:
c-
-
removeStepListener
-
updateListenerVisible
TTRACK_VISIBLE is of interest to TToolBar Calibration and Ruler buttons, as well as WorldTView. This method safely adds the listener, first removing an existing one by this name if present.- Parameters:
l-
-
getBaseTrackName
-
getDefaultFormatPatterns
-
savePatterns
-
restorePatterns
-
showAnglePopup
-
showFormatPopup
-
setVisible
public void setVisible(boolean visible) Shows and hides this track.- Parameters:
visible-trueto show this track
-
delete
public void delete()Removes this track from all panels that draw it. If no other objects have a reference to it, this should then be garbage-collected. -
delete
protected void delete(boolean postEdit) Removes this track from all panels that draw it. If no other objects have a reference to it, this should then be garbage-collected.- Parameters:
postEdit- true to post an undoable edit
-
isVisible
public boolean isVisible()Reports whether or not this is visible.- Returns:
trueif this track is visible
-
setTrailVisible
public void setTrailVisible(boolean visible) Shows and hides the trail. If the trail is shown, all steps are visible. If not, only the current step is visible.- Parameters:
visible-trueto show trail
-
isTrailVisible
public boolean isTrailVisible()Gets the trail visibility.- Returns:
trueif trail is visible
-
setTrailLength
public void setTrailLength(int steps) Sets the trail length.- Parameters:
steps- the trail length
-
getTrailLength
public int getTrailLength()Gets the trail length.- Returns:
- trail length
-
setLocked
public void setLocked(boolean locked) Locks and unlocks this track. When locked, no changes are allowed.- Parameters:
locked-trueto lock this
-
isLocked
public boolean isLocked()Gets the locked property.- Returns:
trueif this is locked
-
setAutoAdvance
public void setAutoAdvance(boolean auto) Sets the autoAdvance property.- Parameters:
auto-trueto request that the video autoadvance while marking.
-
isAutoAdvance
public boolean isAutoAdvance()Gets the autoAdvance property.- Returns:
trueif this is autoadvance
-
setMarkByDefault
public void setMarkByDefault(boolean mark) Sets the markByDefault property. When true, the mouse handler should mark a point whenever the active track reports itself incomplete.- Parameters:
mark-trueto mark by default
-
isMarkByDefault
public boolean isMarkByDefault()Gets the markByDefault property. When true, the mouse handler should mark a point whenever the active track reports itself incomplete.- Returns:
trueif this marks by default
-
getColor
Gets the color.- Returns:
- the current color
-
setColor
Sets the color.- Parameters:
color- the desired color
-
setColorToDefault
public void setColorToDefault(int index) Sets the color to one of the default colors[].- Parameters:
index- the color index
-
setDefaultNameAndColor
Sets the default name and color for a specified tracker panel.- Parameters:
trackerPanel- the TrackerPanelconnector- the string connector between the name and letter suffix
-
getID
public int getID()Gets the ID number of this track.- Returns:
- the ID number
-
getName
Gets the name of this track.- Returns:
- the name
-
getName
Gets the name of this track.- Parameters:
context- ignored by default- Returns:
- the name
-
setName
Sets the name of this track.- Parameters:
newName- the new name of this track
-
getDescription
Gets the description of this track.- Returns:
- the description
-
setDescription
Sets the description of this track.- Parameters:
desc- a description
-
toString
Overrides Object toString method. -
finalize
public void finalize() -
getMessage
Gets a message about this track to display in a message box.- Returns:
- the message
-
setViewable
public void setViewable(boolean viewable) Determines whether views and track menu include this track.- Parameters:
viewable-trueto include this track in views
-
isViewable
public boolean isViewable()Reports whether or not this is viewable.- Returns:
trueif this track is viewable
-
isDependent
public boolean isDependent()Reports whether or not this is dependent. A dependent track gets some or all of its data from other tracks. Dependent tracks should override this method to return true.- Returns:
trueif this track is dependent
-
setFootprints
Sets the footprint choices. The footprint is set to the first choice.- Parameters:
choices- the array of Footprints available to this track
-
setFootprints
Sets the footprint choices. The footprint is set to the first choice. The step parameter may be used to set the footprints of secondary step arrays (veloc, accel, etc).- Parameters:
choices- the array of Footprints available to this trackstep- the step that identifies the step array
-
getFootprints
Gets the footprint choices.- Returns:
- the array of Footprints available to this track
-
getFootprints
Gets the footprint choices. The step parameter may be used to get the footprints of secondary step arrays (veloc, accel, etc).- Parameters:
step- the step that identifies the step array- Returns:
- the array of Footprints available to this track
-
addFootprint
Adds a new footprint to the current choices.- Parameters:
footprint- the footprint
-
setFootprint
Sets the footprint to the specified choice.- Parameters:
name- the name of the desired footprint
-
getFootprintName
Gets the full name of the current footprint, including properties if available- Returns:
- the footprint name
-
getFootprint
Gets the current footprint.- Returns:
- the footprint
-
setFootprint
Sets the footprint to the specified choice. The step parameter may be used to set the footprints of secondary step arrays (veloc, accel, etc).- Parameters:
name- the name of the desired footprintstep- the step that identifies the step array
-
getFootprint
Gets the current footprint. The step parameter may be used to get the footprints of secondary step arrays (veloc, accel, etc).- Parameters:
step- the step that identifies the step array- Returns:
- the footprint
-
getIcon
Gets this track's current icon.- Parameters:
w- the icon widthh- the icon heightcontext-- Returns:
- the icon
-
getStepLength
public abstract int getStepLength()Gets the length of the steps created by this track.- Returns:
- the footprint length
-
getFootprintLength
public abstract int getFootprintLength()Gets the length of the footprints required by this track.- Returns:
- the footprint length
-
createStep
Creates a new step.- Parameters:
n- the frame numberx- the x coordinate in image spacey- the y coordinate in image space- Returns:
- the new step
-
deleteStep
Deletes a step.- Parameters:
n- the frame number- Returns:
- the deleted step
-
getStep
Gets a step specified by frame number. May return null.- Parameters:
n- the frame number- Returns:
- the step
-
getNextVisibleStep
Gets next visible step after the specified step. May return null.- Parameters:
step- the steptrackerPanel- the tracker panel- Returns:
- the next visiblestep
-
getPreviousVisibleStep
Gets first visible step before the specified step. May return null.- Parameters:
step- the steptrackerPanel- the tracker panel- Returns:
- the previous visible step
-
getStep
Gets a step containing a TPoint. May return null.- Parameters:
point- a TPointtrackerPanel- ignored- Returns:
- the step containing the TPoint
-
getSteps
Gets the step array. Some or all elements may be null.- Returns:
- the step array
-
isStepComplete
public boolean isStepComplete(int n) Returns true if the step at the specified frame number is complete. Points may be created or remarked if false.- Parameters:
n- the frame number- Returns:
trueif the step is complete, otherwise false
-
autoMarkAt
Used by autoTracker to mark a step at a match target position.- Parameters:
n- the frame numberx- the x target coordinate in image spacey- the y target coordinate in image space- Returns:
- the TPoint that was automarked
-
getMarkedPoint
Used by autoTracker to get the marked point for a given frame and index.- Parameters:
n- the frame numberindex- the index- Returns:
- the step TPoint at the index
-
getTargetIndex
protected int getTargetIndex()Returns the target index for the autotracker.- Returns:
- the point index
-
setTargetIndex
protected void setTargetIndex(int index) Sets the target index for the autotracker.- Parameters:
index- the point index
-
setTargetIndex
Sets the target index for the autotracker.- Parameters:
description- the description of the target
-
setTargetIndex
Sets the target index for the autotracker.- Parameters:
p- a TPoint associated with a step in this track
-
getTargetDescription
Returns a description of a target point with a given index.- Parameters:
pointIndex- the index- Returns:
- the description
-
isAutoTrackable
protected boolean isAutoTrackable(int pointIndex) Determines if the given point index is autotrackable.- Parameters:
pointIndex- the points[] index- Returns:
- true if autotrackable
-
isAutoTrackable
protected boolean isAutoTrackable()Determines if at least one point in this track is autotrackable.- Returns:
- true if autotrackable
-
isEmpty
public boolean isEmpty()Returns true if this track contains no steps.- Returns:
trueif this contains no steps
-
getNumberFieldsForStep
Returns an array of NumberFields {x, y, magnitude, angle} for a given step.- Parameters:
step- the step- Returns:
- the number fields
-
setFontLevel
public void setFontLevel(int level) Sets the font level.- Parameters:
level- the desired font level
-
getData
Returns the DatasetManager.- Parameters:
panel- the tracker panel- Returns:
- the DatasetManager
-
getData
Returns the DatasetManager for a specified Dataset index, if supported. This default implementation ignores the index.- Parameters:
panel- the tracker paneldatasetIndex-- Returns:
- the DatasetManager
-
refreshData
Refreshes the data in the specified DatasetManager. Subclasses should use this method to refresh track-specific data sets.- Parameters:
data- the DatasetManagertrackerPanel- the tracker panel
-
refreshData
protected void refreshData(DatasetManager data, TrackerPanel trackerPanel, int startFrame, int stepCount) Refreshes the data for a specified frame range. This default implementation ignores the range arguments.- Parameters:
data- the DatasetManagertrackerPanel- the tracker panelstartFrame- the start framestepCount- the step count
-
getDataName
Gets the name of a data variable. Index zero is the shared x-variable, indices 1-n+1 are the y-variables.- Parameters:
index- the dataset index- Returns:
- a String data name
-
getDataDescription
Gets the description of a data variable. Index zero is the shared x-variable, indices 1-n+1 are the y-variables. Subclasses should override to provide correct descriptions.- Parameters:
index- the dataset index- Returns:
- a String data description
-
getPreferredDataOrder
Gets the preferred order of data table columns.- Returns:
- a list of column indices in preferred order
-
getFrameForData
Gets the frame number associated with specified variables and values.- Parameters:
xVar- the x-variable name (required)yVar- the y-variable name (may be null)xyValues- values array (length 1 or 2)- Returns:
- the frame number, or -1 if not found
-
refreshDecimalSeparators
public void refreshDecimalSeparators() -
getNumberFields
Gets a map of number fields by name.- Returns:
- a map of name to NumberField.
-
getAllVariables
Gets a list of all variable names for a given track type.- Returns:
- an ArrayList of names. May be empty.
-
getBaseTypeInt
-
createAllVariables
-
getVariablesFromFormatterDisplayName
Gets an array of variables to format for a given track type and formatter display name.- Returns:
- an array of variables. May be null.
-
getTextColumnNames
Gets the text column names.- Returns:
- list of column names.
-
addTextColumn
Adds a new text column.- Parameters:
name- the name- Returns:
- true if a new column was added
-
removeTextColumn
Removes a named text column.- Parameters:
name- the name- Returns:
- true if the column was removed
-
renameTextColumn
Renames a text column.- Parameters:
name- the existing namenewName- the new name- Returns:
- true if renamed
-
getTextColumnEntry
Gets the entry in a text column for a specified frame.- Parameters:
columnName- the column nameframeNumber- the frame number- Returns:
- the text entry (may be null)
-
setTextColumnEntry
Sets the text in a text column for a specified frame.- Parameters:
columnName- the column nameframeNumber- the frame numbertext- the text (may be null)- Returns:
- true if the text was changed
-
getAttachmentLength
protected int getAttachmentLength() -
getAttachments
Returns the array of attachments for this track. Returns null only if the specified number of attachments == 0.- Returns:
- the attachments array
-
getAttachmentDescription
Returns the description of a particular attachment point.- Parameters:
n- the attachment point index- Returns:
- the description
-
loadAttachmentsFromNames
protected boolean loadAttachmentsFromNames(boolean refresh) Loads the attachments for this track based on attachmentNames array, if any.- Parameters:
refresh- true to refresh attachments after loading- Returns:
- true if attachments were loaded
-
refreshAttachmentsLater
protected void refreshAttachmentsLater()Refreshes the attachments for this track after a delay. This should be used only when loading attachments from Names during loading -
isFullyAttached
protected boolean isFullyAttached()Determines if all attachments are non-null- Returns:
- true if all attachments are non-null.
-
isAttached
public boolean isAttached()Determines if this is attached to one or more tracks.- Returns:
- true if attached
-
refreshAttachments
protected void refreshAttachments()Refreshes the attachments for this track. -
setFixedPosition
protected void setFixedPosition(boolean b) -
getMenu
Prepares menu items and adds them to a menu. Subclasses should override this method and add track-specific menu items.- Parameters:
trackerPanel- the tracker panelmenu- the menu. If null, a dynamic menu is returned that adds items only when selected- Returns:
- a menu
-
getMenuItems
protected void getMenuItems() -
getToolbarTrackComponents
Returns an empty list of track-related toolbar components. Subclasses should override this method and add track-specific components.- Parameters:
trackerPanel- the tracker panel- Returns:
- a collection of components
-
getToolbarPointComponents
Returns an empty list of point-related toolbar components. Subclasses should override this method and add point-specific components.- Parameters:
trackerPanel- the tracker panelpoint- the TPoint- Returns:
- a list of components
-
erase
public void erase()Erases all steps on all panels. -
remark
public void remark()Remarks all steps on all panels. -
repaint
public void repaint()Repaints all steps on all panels. -
repaintAll
protected void repaintAll()Schedule repainting of all panel and world views associated with this track. -
erase
Erases all steps on the specified panel.- Parameters:
trackerPanel- the tracker panel
-
remark
Remarks all steps on the specified panel.- Parameters:
trackerPanel- the tracker panel
-
repaint
Repaints all steps on the specified panel.- Parameters:
trackerPanel- the tracker panel
-
repaintStep
Repaints the specified step on all panels. This should be used instead of the Step.repaint() method to paint a new step on all panels for the first time, since a new step does not know what panels it is drawn on whereas the track does.- Parameters:
step- the step
-
draw
Draws the steps on the tracker panel. -
findInteractive
Finds the interactive drawable object located at the specified pixel position.- Specified by:
findInteractivein interfaceInteractive- 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
-
getX
public double getX()Gets x. Tracks have no meaningful position, so returns 0.- Specified by:
getXin interfaceInteractive- Returns:
- 0
-
getY
public double getY()Gets y. Tracks have no meaningful position, so returns 0.- Specified by:
getYin interfaceInteractive- Returns:
- 0
-
setX
public void setX(double x) Empty setX method.- Specified by:
setXin interfaceInteractive- Parameters:
x- the x position
-
setY
public void setY(double y) Empty setY method.- Specified by:
setYin interfaceInteractive- Parameters:
y- the y position
-
setXY
public void setXY(double x, double y) Empty setXY method.- Specified by:
setXYin interfaceInteractive- Parameters:
x- the x positiony- the y position
-
setEnabled
public void setEnabled(boolean enabled) Sets whether this responds to mouse hits.- Specified by:
setEnabledin interfaceInteractive- Parameters:
enabled-trueif this responds to mouse hits.
-
isEnabled
public boolean isEnabled()Gets whether this responds to mouse hits.- Specified by:
isEnabledin interfaceInteractive- Returns:
trueif this responds to mouse hits.
-
isMeasured
public boolean isMeasured()Reports whether information is available to set min/max values.- Specified by:
isMeasuredin interfaceMeasurable- Returns:
falsesince TTrack knows only its image coordinates
-
getXMin
public double getXMin()Gets the minimum x needed to draw this object.- Specified by:
getXMinin interfaceMeasurable- Returns:
- 0
-
getXMax
public double getXMax()Gets the maximum x needed to draw this object.- Specified by:
getXMaxin interfaceMeasurable- Returns:
- 0
-
getYMin
public double getYMin()Gets the minimum y needed to draw this object.- Specified by:
getYMinin interfaceMeasurable- Returns:
- 0
-
getYMax
public double getYMax()Gets the maximum y needed to draw this object.- Specified by:
getYMaxin interfaceMeasurable- Returns:
- 0
-
setProperty
Sets a user property of the track.- Parameters:
name- the name of the propertyvalue- the value of the property
-
getProperty
Gets a user property of the track. May return null.- Parameters:
name- the name of the property- Returns:
- the value of the property
-
getPropertyNames
Gets a collection of user property names for the track.- Returns:
- a collection of property names
-
isStepVisible
Reports whether or not the specified step is visible.- Parameters:
step- the steptrackerPanel- the tracker panel- Returns:
trueif the step is visible
-
setAnglesInRadians
protected void setAnglesInRadians(boolean radians) Sets the display format for angles.- Parameters:
radians-truefor radians, false for degrees
-
dispose
public void dispose()Disposes of resources when this track is deleted or cleared.- Overrides:
disposein classOSPRuntime.Supported
-
setMarking
protected void setMarking(boolean marking) Sets the marking flag. Flag should be true when ready to be marked by user.- Parameters:
marking- true when marking
-
isMarking
protected boolean isMarking()Determines if this track is marking.- Parameters:
marking- true when marking
-
getMarkingCursor
Gets the cursor used for marking new steps.- Parameters:
e- the input event triggering this call (may be null)- Returns:
- the marking cursor
-
createWarningDialog
protected void createWarningDialog() -
getStepSizeWarningDialog
-
getSkippedStepWarningDialog
-
convertTextToDataColumn
-
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-
getNameDialog
-
setActive
public void setActive() -
getTrack
-
removeActiveTrack
public static void removeActiveTrack(int id) -
getValues
-
invalidateData
-
isDataValid
public boolean isDataValid() -
initialize
Finish up any unfinished loading business that for whatever reason was not finished upon loading a track. For example, adding masses to a center-of-mass system, or adding particles to a DynamicSystem.- Parameters:
panel-
-
fireStepsChanged
public void fireStepsChanged() -
getFormatMap
-
getFormatDescMap
-
getFormatVariables
-
getVarDimsImpl
-
getBaseType
-
getCustomFormatPatterns
Gets the custom format patterns for a specified track for TTrack.Loader.saveObject- Parameters:
track- the track- Returns:
- array with variable names and custom patterns
-
getTableViews
Gets all table views for a specified track.- Parameters:
track- the track- Returns:
- ArrayList of table views
-
getPlotViews
Gets all plot views for a specified track.- Parameters:
track- the track- Returns:
- ArrayList of plot views
-
getFormatPatterns
Gets the format patterns for a specified track.- Parameters:
track- the track- Returns:
- array with variable names and patterns
-
setFormatPattern
Sets the format pattern for a specified track and name. Name may point to multiple variables.- Parameters:
track- the trackname- the namepattern- the pattern- Returns:
- true if the pattern was changed
-
getVarFormatPattern
Gets the format pattern for a specified track and variable.- Parameters:
track- the trackname- the variable name- Returns:
- the pattern
-
getDefaultFormatPatterns
-
getVariableDimensions
Determines the unit dimensions associated with a given track variable. Dimensions include L (length), T (time), M (mass), A (angle), I (integer), P (pixels), C (color 8 bit). Dimensions are often combinations of MLT. May return null.- Parameters:
track- the trackvariable- the variable name- Returns:
- the dimensions or null if unknown
-
setInitialFormatPatterns
-
clearColumns
protected void clearColumns(DatasetManager data, int count, String[] dataVariables, String desc, double[][] validData, int len) Refreshes data by clearing previous data and appending new valid data. Also refreshes data descriptions and initializes dataset names if needed.- Parameters:
data- the DatasetManager with datasets to refreshcount- the number of datasets (columns) to refreshdataVariables- array of variable names (length=count+1 since 1st dataset includes indep var)desc- prefix of String resources defined in tracker.propertiesvalidData- array of data arrays to be appended (length=count+1 since last array is indep var)len- length of the data arrays
-
addFixedItem
-
assembleMenu
Remove unwanted menu items and separators, then add the top item, a separator if needed, then clean out duplicate separators.- Parameters:
menu-topItem-- Returns:
-
removeDeleteTrackItem
remove the last item and the separator before it, provided that item is deleteTrackItem.- Parameters:
menu-
-