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
  • Field Details

    • PROPERTY_TTRACK_FOOTPRINT

      public static final String PROPERTY_TTRACK_FOOTPRINT
      See Also:
    • PROPERTY_TTRACK_MASS

      public static final String PROPERTY_TTRACK_MASS
      See Also:
    • PROPERTY_TTRACK_MODELEND

      public static final String PROPERTY_TTRACK_MODELEND
      See Also:
    • PROPERTY_TTRACK_MODELSTART

      public static final String PROPERTY_TTRACK_MODELSTART
      See Also:
    • PROPERTY_TTRACK_NAME

      public static final String PROPERTY_TTRACK_NAME
      See Also:
    • PROPERTY_TTRACK_STEP

      public static final String PROPERTY_TTRACK_STEP
      See Also:
    • PROPERTY_TTRACK_STEPS

      public static final String PROPERTY_TTRACK_STEPS
      See Also:
    • PROPERTY_TTRACK_FORMAT

      public static final String PROPERTY_TTRACK_FORMAT
      See Also:
    • PROPERTY_TTRACK_VISIBLE

      public static final String PROPERTY_TTRACK_VISIBLE
      See Also:
    • PROPERTY_TTRACK_DATA

      public static final String PROPERTY_TTRACK_DATA
      See Also:
    • PROPERTY_TTRACK_COLOR

      public static final String PROPERTY_TTRACK_COLOR
      See Also:
    • PROPERTY_TTRACK_LOCKED

      public static final String PROPERTY_TTRACK_LOCKED
      See Also:
    • PROPERTY_TTRACK_TEXTCOLUMN

      public static final String PROPERTY_TTRACK_TEXTCOLUMN
      See Also:
    • HINT_STEP_ADDED_OR_REMOVED

      public static final Integer HINT_STEP_ADDED_OR_REMOVED
    • HINT_STEPS_SELECTED

      public static final Integer HINT_STEPS_SELECTED
    • ttype

      public final int ttype
    • skippedStepWarningDialog

      protected static JDialog skippedStepWarningDialog
    • skippedStepWarningTextpane

      protected static JTextPane skippedStepWarningTextpane
    • skippedStepWarningCheckbox

      protected static JCheckBox skippedStepWarningCheckbox
    • closeButton

      protected static JButton closeButton
    • skippedStepWarningOn

      protected static boolean skippedStepWarningOn
    • nameDialog

      protected static TTrack.NameDialog nameDialog
    • nextID

      protected static int nextID
    • name

      protected String name
    • description

      protected String 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

      protected Footprint[] footprints
    • footprint

      protected Footprint footprint
    • defaultFootprint

      protected Footprint defaultFootprint
    • defaultColors

      protected Color[] defaultColors
    • steps

      protected TTrack.StepArray steps
    • properties

      protected HashMap<String,Object> properties
    • datasetManager

      protected DatasetManager datasetManager
    • points

      protected final Point2D.Double[] points
    • toolbarTrackComponents

      protected ArrayList<Component> toolbarTrackComponents
    • toolbarPointComponents

      protected ArrayList<Component> toolbarPointComponents
    • numberFields

      protected Map<String,NumberField[]> numberFields
    • autoAdvance

      protected boolean autoAdvance
    • markByDefault

      protected boolean markByDefault
    • isMarking

      protected boolean isMarking
    • xLabel

      protected TTrack.TextLineLabel xLabel
    • yLabel

      protected TTrack.TextLineLabel yLabel
    • magLabel

      protected TTrack.TextLineLabel magLabel
    • angleLabel

      protected TTrack.TextLineLabel angleLabel
    • footprintListener

      protected ActionListener footprintListener
    • circleFootprintListener

      protected ActionListener circleFootprintListener
    • labelFont

      protected Font labelFont
    • tp

      protected TrackerPanel tp
    • tframe

      protected TFrame tframe
    • dataProp

      protected XMLProperty dataProp
    • constantsLoadedFromXML

      protected Object[][] constantsLoadedFromXML
    • dataDescriptions

      protected String[] dataDescriptions
    • initialized

      protected boolean initialized
      set 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

      protected ArrayList<Integer> dataFrames
    • partName

      protected String partName
    • hint

      protected String hint
    • stepSizeWhenFirstMarked

      protected int stepSizeWhenFirstMarked
    • keyFrames

      protected TreeSet<Integer> keyFrames
    • autoTrackerMarking

      protected boolean autoTrackerMarking
    • targetIndex

      protected int targetIndex
    • attachments

      protected TTrack[] attachments
    • attachmentNames

      protected String[] attachmentNames
    • textColumnEntries

      protected Map<String,String[]> textColumnEntries
    • textColumnNames

      protected ArrayList<String> textColumnNames
    • formatMouseListener

      protected MouseAdapter formatMouseListener
    • formatAngleMouseListener

      protected MouseAdapter formatAngleMouseListener
    • customNumberFormats

      protected String[] customNumberFormats
    • tLabel

      protected JLabel tLabel
    • stepLabel

      protected JLabel stepLabel
    • tValueLabel

      protected JLabel tValueLabel
    • stepValueLabel

      protected JLabel stepValueLabel
    • tField

      protected NumberField tField
    • xField

      protected NumberField xField
    • yField

      protected NumberField yField
    • magField

      protected NumberField magField
    • angleField

      protected DecimalField angleField
    • positionFields

      protected NumberField[] positionFields
    • fieldBorder

      protected Border fieldBorder
    • xSpinner

      protected JSpinner xSpinner
    • ySpinner

      protected JSpinner ySpinner
    • footprintMenu

      protected JMenu footprintMenu
    • tSeparator

      protected Component tSeparator
    • xSeparator

      protected Component xSeparator
    • ySeparator

      protected Component ySeparator
    • magSeparator

      protected Component magSeparator
    • angleSeparator

      protected Component angleSeparator
    • stepSeparator

      protected Component stepSeparator
    • visibleItem

      protected JCheckBoxMenuItem visibleItem
    • trailVisibleItem

      protected JCheckBoxMenuItem trailVisibleItem
    • markByDefaultItem

      protected JCheckBoxMenuItem markByDefaultItem
    • autoAdvanceItem

      protected JCheckBoxMenuItem autoAdvanceItem
    • lockedItem

      protected JCheckBoxMenuItem lockedItem
    • fixedItem

      protected JCheckBoxMenuItem fixedItem
    • nameItem

      protected JMenuItem nameItem
    • colorItem

      protected JMenuItem colorItem
    • deleteTrackItem

      protected JMenuItem deleteTrackItem
    • deleteStepItem

      protected JMenuItem deleteStepItem
    • clearStepsItem

      protected JMenuItem clearStepsItem
    • descriptionItem

      protected JMenuItem descriptionItem
    • dataBuilderItem

      protected JMenuItem 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

      protected static final Map<String,String[]> NOMAP
    • NOMAPS

      protected static final Map<String,String> NOMAPS
    • NOVARS

      protected static final String[] NOVARS
    • NOVARA

      protected static final ArrayList<String> NOVARA
  • Constructor Details

    • TTrack

      protected TTrack(int ttype)
      Constructs a TTrack.
      Parameters:
      type -
  • Method Details

    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Responds to property change events fired in TrackerPanel or VideoPanel.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      e - the property change event
    • setTrackerPanel

      public 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. This method is overridden to add specific TrackerPanel events for subclasses.
      Parameters:
      panel - the TrackerPanel
    • addPanelEvents

      protected void addPanelEvents(String[] events)
      Add specific (incoming) trackPanel events that the track has to respond to.
      Parameters:
      events -
    • removePanelEvents

      protected void removePanelEvents(String[] events)
      Remove specific (incoming) trackPanel events that the track was respond to.
      Parameters:
      events -
    • addListener

      public void addListener(TrackerPanel panel)
      Allow the TrackPanel to respond to specific track (outgoing) property changes.
      Parameters:
      panel -
    • removeListener

      public void removeListener(TrackerPanel panel)
      Remove the TrackPanel from specific (outgoing) property change lists.
      Parameters:
      panel -
    • addListenerNCF

      public void addListenerNCF(PropertyChangeListener l)
      The NAME, COLOR, and FOOTPRINT property changes are of interest to AutoTracker, DynamicSystemInspector, VectorSumInspector, AttachementDialog, TrackChooserTView, TrackControl, and TTrackBar.
      Parameters:
      l -
    • removeListenerNCF

      public void removeListenerNCF(PropertyChangeListener l)
    • addStepListener

      public void addStepListener(PropertyChangeListener c)
      STEP and STEPS listeners include TrackerPanel, CenterOfMass, CircleFitter, DynamicParticle, DynamicSystem, ReferenceFrame, PlotTrackView, and TrackChooserTView.
      Parameters:
      c -
    • removeStepListener

      public void removeStepListener(PropertyChangeListener c)
    • updateListenerVisible

      public void updateListenerVisible(PropertyChangeListener l)
      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

      public static String getBaseTrackName(int ttype)
    • getDefaultFormatPatterns

      public static TreeMap<String,String>[] getDefaultFormatPatterns()
    • savePatterns

      public static void savePatterns(TrackerPanel panel)
    • restorePatterns

      public static void restorePatterns(TrackerPanel panel)
    • showAnglePopup

      protected void showAnglePopup(NumberField field)
    • showFormatPopup

      protected void showFormatPopup(NumberField field)
    • 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

      public Color getColor()
      Gets the color.
      Returns:
      the current color
    • setColor

      public void setColor(Color color)
      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

      public void setDefaultNameAndColor(TrackerPanel trackerPanel, String connector)
      Sets the default name and color for a specified tracker panel.
      Parameters:
      trackerPanel - the TrackerPanel
      connector - 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

      public String getName()
      Gets the name of this track.
      Returns:
      the name
    • getName

      public String getName(String context)
      Gets the name of this track.
      Parameters:
      context - ignored by default
      Returns:
      the name
    • setName

      public void setName(String newName)
      Sets the name of this track.
      Parameters:
      newName - the new name of this track
    • getDescription

      public String getDescription()
      Gets the description of this track.
      Returns:
      the description
    • setDescription

      public void setDescription(String desc)
      Sets the description of this track.
      Parameters:
      desc - a description
    • toString

      public String toString()
      Overrides Object toString method.
      Overrides:
      toString in class Object
      Returns:
      a description of this object
    • finalize

      public void finalize()
      Overrides:
      finalize in class Object
    • getMessage

      public String 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

      public void setFootprints(Footprint[] choices)
      Sets the footprint choices. The footprint is set to the first choice.
      Parameters:
      choices - the array of Footprints available to this track
    • setFootprints

      public void setFootprints(Footprint[] choices, Step step)
      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 track
      step - the step that identifies the step array
    • getFootprints

      public Footprint[] getFootprints()
      Gets the footprint choices.
      Returns:
      the array of Footprints available to this track
    • getFootprints

      public Footprint[] getFootprints(Step step)
      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

      public void addFootprint(Footprint footprint)
      Adds a new footprint to the current choices.
      Parameters:
      footprint - the footprint
    • setFootprint

      public void setFootprint(String name)
      Sets the footprint to the specified choice.
      Parameters:
      name - the name of the desired footprint
    • getFootprintName

      public String getFootprintName()
      Gets the full name of the current footprint, including properties if available
      Returns:
      the footprint name
    • getFootprint

      public Footprint getFootprint()
      Gets the current footprint.
      Returns:
      the footprint
    • setFootprint

      public void setFootprint(String name, Step step)
      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 footprint
      step - the step that identifies the step array
    • getFootprint

      public Footprint getFootprint(Step step)
      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

      public Icon getIcon(int w, int h, String context)
      Gets this track's current icon.
      Parameters:
      w - the icon width
      h - the icon height
      context -
      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

      public abstract Step createStep(int n, double x, double y)
      Creates a new step.
      Parameters:
      n - the frame number
      x - the x coordinate in image space
      y - the y coordinate in image space
      Returns:
      the new step
    • deleteStep

      public Step deleteStep(int n)
      Deletes a step.
      Parameters:
      n - the frame number
      Returns:
      the deleted step
    • getStep

      public Step getStep(int n)
      Gets a step specified by frame number. May return null.
      Parameters:
      n - the frame number
      Returns:
      the step
    • getNextVisibleStep

      public Step getNextVisibleStep(Step step, TrackerPanel panel)
      Gets next visible step after the specified step. May return null.
      Parameters:
      step - the step
      trackerPanel - the tracker panel
      Returns:
      the next visiblestep
    • getPreviousVisibleStep

      public Step getPreviousVisibleStep(Step step, TrackerPanel trackerPanel)
      Gets first visible step before the specified step. May return null.
      Parameters:
      step - the step
      trackerPanel - the tracker panel
      Returns:
      the previous visible step
    • getStep

      public Step getStep(TPoint point, TrackerPanel trackerPanel)
      Gets a step containing a TPoint. May return null.
      Parameters:
      point - a TPoint
      trackerPanel - ignored
      Returns:
      the step containing the TPoint
    • getSteps

      public Step[] 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

      public TPoint autoMarkAt(int n, double x, double y)
      Used by autoTracker to mark a step at a match target position.
      Parameters:
      n - the frame number
      x - the x target coordinate in image space
      y - the y target coordinate in image space
      Returns:
      the TPoint that was automarked
    • getMarkedPoint

      public TPoint getMarkedPoint(int n, int index)
      Used by autoTracker to get the marked point for a given frame and index.
      Parameters:
      n - the frame number
      index - 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

      protected void setTargetIndex(String description)
      Sets the target index for the autotracker.
      Parameters:
      description - the description of the target
    • setTargetIndex

      protected void setTargetIndex(TPoint p)
      Sets the target index for the autotracker.
      Parameters:
      p - a TPoint associated with a step in this track
    • getTargetDescription

      protected String getTargetDescription(int pointIndex)
      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

      protected NumberField[] getNumberFieldsForStep(Step step)
      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

      public DatasetManager getData(TrackerPanel panel)
      Returns the DatasetManager.
      Parameters:
      panel - the tracker panel
      Returns:
      the DatasetManager
    • getData

      public DatasetManager getData(TrackerPanel panel, int datasetIndex)
      Returns the DatasetManager for a specified Dataset index, if supported. This default implementation ignores the index.
      Parameters:
      panel - the tracker panel
      datasetIndex -
      Returns:
      the DatasetManager
    • refreshData

      protected void refreshData(DatasetManager data, TrackerPanel panel)
      Refreshes the data in the specified DatasetManager. Subclasses should use this method to refresh track-specific data sets.
      Parameters:
      data - the DatasetManager
      trackerPanel - 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 DatasetManager
      trackerPanel - the tracker panel
      startFrame - the start frame
      stepCount - the step count
    • getDataName

      public String getDataName(int index)
      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

      public String getDataDescription(int index)
      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

      public ArrayList<Integer> getPreferredDataOrder()
      Gets the preferred order of data table columns.
      Returns:
      a list of column indices in preferred order
    • getFrameForData

      public int getFrameForData(String xVar, String yVar, double[] xyValues)
      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

      protected Map<String,NumberField[]> getNumberFields()
      Gets a map of number fields by name.
      Returns:
      a map of name to NumberField.
    • getAllVariables

      protected static ArrayList<String> getAllVariables(int ttype)
      Gets a list of all variable names for a given track type.
      Returns:
      an ArrayList of names. May be empty.
    • getBaseTypeInt

      public static int getBaseTypeInt(String type)
    • createAllVariables

      protected static ArrayList<String> createAllVariables(String[] datavars, String[] fieldvars)
    • getVariablesFromFormatterDisplayName

      protected String[] getVariablesFromFormatterDisplayName(String name)
      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

      public ArrayList<String> getTextColumnNames()
      Gets the text column names.
      Returns:
      list of column names.
    • addTextColumn

      public boolean addTextColumn(String name)
      Adds a new text column.
      Parameters:
      name - the name
      Returns:
      true if a new column was added
    • removeTextColumn

      public boolean removeTextColumn(String name)
      Removes a named text column.
      Parameters:
      name - the name
      Returns:
      true if the column was removed
    • renameTextColumn

      public boolean renameTextColumn(String name, String newName)
      Renames a text column.
      Parameters:
      name - the existing name
      newName - the new name
      Returns:
      true if renamed
    • getTextColumnEntry

      public String getTextColumnEntry(String columnName, int frameNumber)
      Gets the entry in a text column for a specified frame.
      Parameters:
      columnName - the column name
      frameNumber - the frame number
      Returns:
      the text entry (may be null)
    • setTextColumnEntry

      public boolean setTextColumnEntry(String columnName, int frameNumber, String text)
      Sets the text in a text column for a specified frame.
      Parameters:
      columnName - the column name
      frameNumber - the frame number
      text - the text (may be null)
      Returns:
      true if the text was changed
    • getAttachmentLength

      protected int getAttachmentLength()
    • getAttachments

      public TTrack[] getAttachments()
      Returns the array of attachments for this track. Returns null only if the specified number of attachments == 0.
      Returns:
      the attachments array
    • getAttachmentDescription

      public String getAttachmentDescription(int n)
      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

      public JMenu getMenu(TrackerPanel trackerPanel, JMenu menu)
      Prepares menu items and adds them to a menu. Subclasses should override this method and add track-specific menu items.
      Parameters:
      trackerPanel - the tracker panel
      menu - the menu. If null, a dynamic menu is returned that adds items only when selected
      Returns:
      a menu
    • getMenuItems

      protected void getMenuItems()
    • getToolbarTrackComponents

      public ArrayList<Component> getToolbarTrackComponents(TrackerPanel trackerPanel)
      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

      public ArrayList<Component> getToolbarPointComponents(TrackerPanel trackerPanel, TPoint point)
      Returns an empty list of point-related toolbar components. Subclasses should override this method and add point-specific components.
      Parameters:
      trackerPanel - the tracker panel
      point - 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

      public void erase(Integer panelID)
      Erases all steps on the specified panel.
      Parameters:
      trackerPanel - the tracker panel
    • remark

      public void remark(Integer panelID)
      Remarks all steps on the specified panel.
      Parameters:
      trackerPanel - the tracker panel
    • repaint

      public void repaint(Integer panelID)
      Repaints all steps on the specified panel.
      Parameters:
      trackerPanel - the tracker panel
    • repaintStep

      public void repaintStep(Step step)
      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

      public void draw(DrawingPanel panel, Graphics _g)
      Draws the steps on the tracker panel.
      Specified by:
      draw in interface Drawable
      Parameters:
      panel - the drawing panel requesting the drawing
      _g - the graphics context on which to draw
    • findInteractive

      public Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
      Finds the interactive drawable object located at the specified pixel position.
      Specified by:
      findInteractive in interface Interactive
      Parameters:
      panel - the drawing panel
      xpix - the x pixel position on the panel
      ypix - 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 interface Interactive
      Returns:
      0
    • getY

      public double getY()
      Gets y. Tracks have no meaningful position, so returns 0.
      Specified by:
      getY in interface Interactive
      Returns:
      0
    • setX

      public void setX(double x)
      Empty setX method.
      Specified by:
      setX in interface Interactive
      Parameters:
      x - the x position
    • setY

      public void setY(double y)
      Empty setY method.
      Specified by:
      setY in interface Interactive
      Parameters:
      y - the y position
    • setXY

      public void setXY(double x, double y)
      Empty setXY method.
      Specified by:
      setXY in interface Interactive
      Parameters:
      x - the x position
      y - the y position
    • setEnabled

      public void setEnabled(boolean enabled)
      Sets whether this responds to mouse hits.
      Specified by:
      setEnabled in interface Interactive
      Parameters:
      enabled - true if this responds to mouse hits.
    • isEnabled

      public boolean isEnabled()
      Gets whether this responds to mouse hits.
      Specified by:
      isEnabled in interface Interactive
      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 interface Measurable
      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 interface Measurable
      Returns:
      0
    • getXMax

      public double getXMax()
      Gets the maximum x needed to draw this object.
      Specified by:
      getXMax in interface Measurable
      Returns:
      0
    • getYMin

      public double getYMin()
      Gets the minimum y needed to draw this object.
      Specified by:
      getYMin in interface Measurable
      Returns:
      0
    • getYMax

      public double getYMax()
      Gets the maximum y needed to draw this object.
      Specified by:
      getYMax in interface Measurable
      Returns:
      0
    • setProperty

      public void setProperty(String name, Object value)
      Sets a user property of the track.
      Parameters:
      name - the name of the property
      value - the value of the property
    • getProperty

      public Object getProperty(String name)
      Gets a user property of the track. May return null.
      Parameters:
      name - the name of the property
      Returns:
      the value of the property
    • getPropertyNames

      public Collection<String> getPropertyNames()
      Gets a collection of user property names for the track.
      Returns:
      a collection of property names
    • isStepVisible

      public boolean isStepVisible(Step step, TrackerPanel trackerPanel)
      Reports whether or not the specified step is visible.
      Parameters:
      step - the step
      trackerPanel - 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 class OSPRuntime.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

      protected Cursor getMarkingCursor(InputEvent e)
      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

      protected JDialog getStepSizeWarningDialog()
    • getSkippedStepWarningDialog

      protected JDialog getSkippedStepWarningDialog()
    • convertTextToDataColumn

      protected Dataset convertTextToDataColumn(String textColumnName)
    • getLoader

      public static XML.ObjectLoader getLoader()
      Returns an ObjectLoader to save and load data for this class.
      Returns:
      the object loader
    • getNameDialog

      protected TTrack.NameDialog getNameDialog()
    • setActive

      public void setActive()
    • getTrack

      protected static TTrack getTrack(int ID)
    • removeActiveTrack

      public static void removeActiveTrack(int id)
    • getValues

      public static Collection<TTrack> getValues()
    • invalidateData

      public void invalidateData(Object newValue)
    • isDataValid

      public boolean isDataValid()
    • initialize

      public void initialize(TrackerPanel panel)
      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

      public abstract Map<String,String[]> getFormatMap()
    • getFormatDescMap

      public abstract Map<String,String> getFormatDescMap()
    • getFormatVariables

      public abstract String[] getFormatVariables()
    • getVarDimsImpl

      public abstract String getVarDimsImpl(String variable)
    • getBaseType

      public abstract String getBaseType()
    • getCustomFormatPatterns

      protected String[] 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

      protected ArrayList<TableTrackView> getTableViews()
      Gets all table views for a specified track.
      Parameters:
      track - the track
      Returns:
      ArrayList of table views
    • getPlotViews

      protected ArrayList<PlotTrackView> getPlotViews()
      Gets all plot views for a specified track.
      Parameters:
      track - the track
      Returns:
      ArrayList of plot views
    • getFormatPatterns

      public String[] getFormatPatterns()
      Gets the format patterns for a specified track.
      Parameters:
      track - the track
      Returns:
      array with variable names and patterns
    • setFormatPattern

      protected boolean setFormatPattern(String name, String pattern)
      Sets the format pattern for a specified track and name. Name may point to multiple variables.
      Parameters:
      track - the track
      name - the name
      pattern - the pattern
      Returns:
      true if the pattern was changed
    • getVarFormatPattern

      protected String getVarFormatPattern(String name)
      Gets the format pattern for a specified track and variable.
      Parameters:
      track - the track
      name - the variable name
      Returns:
      the pattern
    • getDefaultFormatPatterns

      protected static TreeMap<String,String> getDefaultFormatPatterns(int ttype)
    • getVariableDimensions

      public static String getVariableDimensions(TTrack track, String variable)
      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 track
      variable - the variable name
      Returns:
      the dimensions or null if unknown
    • setInitialFormatPatterns

      public void setInitialFormatPatterns(TrackerPanel trackerPanel)
    • 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 refresh
      count - the number of datasets (columns) to refresh
      dataVariables - array of variable names (length=count+1 since 1st dataset includes indep var)
      desc - prefix of String resources defined in tracker.properties
      validData - array of data arrays to be appended (length=count+1 since last array is indep var)
      len - length of the data arrays
    • addFixedItem

      protected void addFixedItem(JMenu menu)
    • assembleMenu

      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.
      Parameters:
      menu -
      topItem -
      Returns:
    • removeDeleteTrackItem

      protected void removeDeleteTrackItem(JMenu menu)
      remove the last item and the separator before it, provided that item is deleteTrackItem.
      Parameters:
      menu -