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 class
A dialog used to set the name of a track.protected class
protected static class
A DrawingPanel that mimics the look of a JLabel but can display subscripts.protected class
A DecimalField that resizes itself for display on a TTrackBar.protected class
A NumberField that resizes itself for display on a TTrackBar. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DecimalField
protected TTrack.TextLineLabel
protected Component
protected String[]
protected TTrack[]
protected boolean
protected JCheckBoxMenuItem
protected boolean
protected ActionListener
protected JMenuItem
protected static JButton
protected JMenuItem
protected Object[][]
protected String[]
protected JMenuItem
protected String[]
protected XMLProperty
protected DatasetManager
protected boolean
protected Color[]
protected Footprint
protected JMenuItem
protected JMenuItem
protected String
protected JMenuItem
protected boolean
protected Border
protected JCheckBoxMenuItem
protected Footprint
protected ActionListener
protected JMenu
protected Footprint[]
protected MouseAdapter
protected MouseAdapter
protected String
static final Integer
static final Integer
protected boolean
set false if data needs to be initialized, e.g.protected boolean
protected Font
protected boolean
protected JCheckBoxMenuItem
protected NumberField
protected TTrack.TextLineLabel
protected Component
protected boolean
protected JCheckBoxMenuItem
protected String
protected static TTrack.NameDialog
protected JMenuItem
protected static int
protected static final String[]
protected Map<String,
NumberField[]> protected String
protected final Point2D.Double[]
protected NumberField[]
protected int[]
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected boolean
protected static JCheckBox
protected static JDialog
protected static boolean
protected static JTextPane
protected JLabel
protected TTrack.StepArray
protected Component
protected int
protected JLabel
protected int
protected NumberField
protected TFrame
protected JLabel
protected TrackerPanel
protected int
protected boolean
protected JCheckBoxMenuItem
protected Component
final int
protected JLabel
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
protected boolean
protected boolean
protected JCheckBoxMenuItem
protected NumberField
protected TTrack.TextLineLabel
protected Component
protected JSpinner
protected NumberField
protected TTrack.TextLineLabel
protected Component
protected JSpinner
Fields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addFixedItem
(JMenu menu) void
addFootprint
(Footprint footprint) Adds a new footprint to the current choices.void
addListener
(TrackerPanel panel) Allow the TrackPanel to respond to specific track (outgoing) property changes.void
The NAME, COLOR, and FOOTPRINT property changes are of interest to AutoTracker, DynamicSystemInspector, VectorSumInspector, AttachementDialog, TrackChooserTView, TrackControl, and TTrackBar.protected void
addPanelEvents
(String[] events) Add specific (incoming) trackPanel events that the track has to respond to.void
STEP and STEPS listeners include TrackerPanel, CenterOfMass, CircleFitter, DynamicParticle, DynamicSystem, ReferenceFrame, PlotTrackView, and TrackChooserTView.boolean
addTextColumn
(String name) Adds a new text column.protected JMenu
assembleMenu
(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 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.protected Dataset
convertTextToDataColumn
(String textColumnName) createAllVariables
(String[] datavars, String[] fieldvars) abstract Step
createStep
(int n, double x, double y) Creates a new step.protected void
void
delete()
Removes this track from all panels that draw it.protected void
delete
(boolean postEdit) Removes this track from all panels that draw it.deleteStep
(int n) Deletes a step.void
dispose()
Disposes of resources when this track is deleted or cleared.void
draw
(DrawingPanel panel, Graphics _g) Draws the steps on the tracker panel.void
erase()
Erases all steps on all panels.void
Erases all steps on the specified panel.void
finalize()
findInteractive
(DrawingPanel panel, int xpix, int ypix) Finds the interactive drawable object located at the specified pixel position.void
getAllVariables
(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 int
TTrack[]
Returns the array of attachments for this track.static String
getBaseTrackName
(int ttype) abstract String
static int
getBaseTypeInt
(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 int
Gets 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[]
int
getFrameForData
(String xVar, String yVar, double[] xyValues) Gets the frame number associated with specified variables and values.Gets this track's current icon.int
getID()
Gets the ID number of this track.static XML.ObjectLoader
Returns 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 Cursor
Gets the cursor used for marking new steps.getMenu
(TrackerPanel trackerPanel, JMenu menu) Prepares menu items and adds them to a menu.protected void
Gets 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.NameDialog
getNextVisibleStep
(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 JDialog
getStep
(int n) Gets a step specified by frame number.getStep
(TPoint point, TrackerPanel trackerPanel) Gets a step containing a TPoint.abstract int
Gets the length of the steps created by this track.Step[]
getSteps()
Gets the step array.protected JDialog
protected ArrayList<TableTrackView>
Gets all table views for a specified track.protected String
getTargetDescription
(int pointIndex) Returns a description of a target point with a given index.protected int
Returns 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 TTrack
getTrack
(int ID) int
Gets the trail length.static Collection<TTrack>
abstract String
getVarDimsImpl
(String variable) protected String
getVarFormatPattern
(String name) Gets the format pattern for a specified track and variable.static String
getVariableDimensions
(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.double
getX()
Gets x.double
getXMax()
Gets the maximum x needed to draw this object.double
getXMin()
Gets the minimum x needed to draw this object.double
getY()
Gets y.double
getYMax()
Gets the maximum y needed to draw this object.double
getYMin()
Gets the minimum y needed to draw this object.void
initialize
(TrackerPanel panel) Finish up any unfinished loading business that for whatever reason was not finished upon loading a track.void
invalidateData
(Object newValue) boolean
Determines if this is attached to one or more tracks.boolean
Gets the autoAdvance property.protected boolean
Determines if at least one point in this track is autotrackable.protected boolean
isAutoTrackable
(int pointIndex) Determines if the given point index is autotrackable.boolean
boolean
Reports whether or not this is dependent.boolean
isEmpty()
Returns true if this track contains no steps.boolean
Gets whether this responds to mouse hits.protected boolean
Determines if all attachments are non-nullboolean
isLocked()
Gets the locked property.boolean
Gets the markByDefault property.protected boolean
Determines if this track is marking.boolean
Reports whether information is available to set min/max values.boolean
isStepComplete
(int n) Returns true if the step at the specified frame number is complete.boolean
isStepVisible
(Step step, TrackerPanel trackerPanel) Reports whether or not the specified step is visible.boolean
Gets the trail visibility.boolean
Reports whether or not this is viewable.boolean
Reports whether or not this is visible.protected boolean
loadAttachmentsFromNames
(boolean refresh) Loads the attachments for this track based on attachmentNames array, if any.void
Responds to property change events fired in TrackerPanel or VideoPanel.protected void
Refreshes the attachments for this track.protected void
Refreshes the attachments for this track after a delay.protected void
refreshData
(DatasetManager data, TrackerPanel panel) Refreshes the data in the specified DatasetManager.protected void
refreshData
(DatasetManager data, TrackerPanel trackerPanel, int startFrame, int stepCount) Refreshes the data for a specified frame range.void
void
remark()
Remarks all steps on all panels.void
Remarks all steps on the specified panel.static void
removeActiveTrack
(int id) protected void
removeDeleteTrackItem
(JMenu menu) remove the last item and the separator before it, provided that item is deleteTrackItem.void
removeListener
(TrackerPanel panel) Remove the TrackPanel from specific (outgoing) property change lists.void
protected void
removePanelEvents
(String[] events) Remove specific (incoming) trackPanel events that the track was respond to.void
boolean
removeTextColumn
(String name) Removes a named text column.boolean
renameTextColumn
(String name, String newName) Renames a text column.void
repaint()
Repaints all steps on all panels.void
Repaints all steps on the specified panel.protected void
Schedule repainting of all panel and world views associated with this track.void
repaintStep
(Step step) Repaints the specified step on all panels.static void
restorePatterns
(TrackerPanel panel) static void
savePatterns
(TrackerPanel panel) void
protected void
setAnglesInRadians
(boolean radians) Sets the display format for angles.void
setAutoAdvance
(boolean auto) Sets the autoAdvance property.void
Sets the color.void
setColorToDefault
(int index) Sets the color to one of the default colors[].void
setDefaultNameAndColor
(TrackerPanel trackerPanel, String connector) Sets the default name and color for a specified tracker panel.void
setDescription
(String desc) Sets the description of this track.void
setEnabled
(boolean enabled) Sets whether this responds to mouse hits.protected void
setFixedPosition
(boolean b) void
setFontLevel
(int level) Sets the font level.void
setFootprint
(String name) Sets the footprint to the specified choice.void
setFootprint
(String name, Step step) Sets the footprint to the specified choice.void
setFootprints
(Footprint[] choices) Sets the footprint choices.void
setFootprints
(Footprint[] choices, Step step) Sets the footprint choices.protected boolean
setFormatPattern
(String name, String pattern) Sets the format pattern for a specified track and name.void
setInitialFormatPatterns
(TrackerPanel trackerPanel) void
setLocked
(boolean locked) Locks and unlocks this track.void
setMarkByDefault
(boolean mark) Sets the markByDefault property.protected void
setMarking
(boolean marking) Sets the marking flag.void
Sets the name of this track.void
setProperty
(String name, Object value) Sets a user property of the track.protected void
setTargetIndex
(int index) Sets the target index for the autotracker.protected void
setTargetIndex
(String description) Sets the target index for the autotracker.protected void
Sets the target index for the autotracker.boolean
setTextColumnEntry
(String columnName, int frameNumber, String text) Sets the text in a text column for a specified frame.void
setTrackerPanel
(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.void
setTrailLength
(int steps) Sets the trail length.void
setTrailVisible
(boolean visible) Shows and hides the trail.void
setViewable
(boolean viewable) Determines whether views and track menu include this track.void
setVisible
(boolean visible) Shows and hides this track.void
setX
(double x) Empty setX method.void
setXY
(double x, double y) Empty setXY method.void
setY
(double y) Empty setY method.protected void
showAnglePopup
(NumberField field) protected void
showFormatPopup
(NumberField field) toString()
Overrides Object toString method.void
TTRACK_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, removePropertyChangeListener
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:
propertyChange
in 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
-true
to 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:
true
if 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
-true
to show trail
-
isTrailVisible
public boolean isTrailVisible()Gets the trail visibility.- Returns:
true
if 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
-true
to lock this
-
isLocked
public boolean isLocked()Gets the locked property.- Returns:
true
if this is locked
-
setAutoAdvance
public void setAutoAdvance(boolean auto) Sets the autoAdvance property.- Parameters:
auto
-true
to request that the video autoadvance while marking.
-
isAutoAdvance
public boolean isAutoAdvance()Gets the autoAdvance property.- Returns:
true
if 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
-true
to 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:
true
if 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
-true
to include this track in views
-
isViewable
public boolean isViewable()Reports whether or not this is viewable.- Returns:
true
if 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:
true
if 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:
true
if 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:
true
if 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:
findInteractive
in 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:
getX
in interfaceInteractive
- Returns:
- 0
-
getY
public double getY()Gets y. Tracks have no meaningful position, so returns 0.- Specified by:
getY
in interfaceInteractive
- Returns:
- 0
-
setX
public void setX(double x) Empty setX method.- Specified by:
setX
in interfaceInteractive
- Parameters:
x
- the x position
-
setY
public void setY(double y) Empty setY method.- Specified by:
setY
in interfaceInteractive
- Parameters:
y
- the y position
-
setXY
public void setXY(double x, double y) Empty setXY method.- Specified by:
setXY
in interfaceInteractive
- Parameters:
x
- the x positiony
- the y position
-
setEnabled
public void setEnabled(boolean enabled) Sets whether this responds to mouse hits.- Specified by:
setEnabled
in interfaceInteractive
- Parameters:
enabled
-true
if this responds to mouse hits.
-
isEnabled
public boolean isEnabled()Gets whether this responds to mouse hits.- Specified by:
isEnabled
in interfaceInteractive
- Returns:
true
if this responds to mouse hits.
-
isMeasured
public boolean isMeasured()Reports whether information is available to set min/max values.- Specified by:
isMeasured
in interfaceMeasurable
- Returns:
false
since TTrack knows only its image coordinates
-
getXMin
public double getXMin()Gets the minimum x needed to draw this object.- Specified by:
getXMin
in interfaceMeasurable
- Returns:
- 0
-
getXMax
public double getXMax()Gets the maximum x needed to draw this object.- Specified by:
getXMax
in interfaceMeasurable
- Returns:
- 0
-
getYMin
public double getYMin()Gets the minimum y needed to draw this object.- Specified by:
getYMin
in interfaceMeasurable
- Returns:
- 0
-
getYMax
public double getYMax()Gets the maximum y needed to draw this object.- Specified by:
getYMax
in 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:
true
if the step is visible
-
setAnglesInRadians
protected void setAnglesInRadians(boolean radians) Sets the display format for angles.- Parameters:
radians
-true
for radians, false for degrees
-
dispose
public void dispose()Disposes of resources when this track is deleted or cleared.- Overrides:
dispose
in 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
-
-