Class TapeMeasure
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.cabrillo.tracker.TTrack
org.opensourcephysics.cabrillo.tracker.InputTrack
org.opensourcephysics.cabrillo.tracker.TapeMeasure
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,MarkingRequired
,Drawable
,Interactive
,Measurable
,Trackable
A TapeMeasure measures and displays its world length and its angle relative
to the positive x-axis. It is used to set the scale and angle of an
ImageCoordSystem.
- Author:
- Douglas Brown
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Inner class containing the tape data for a single frame number.Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
TTrack.NameDialog, TTrack.StepArray, TTrack.TextLineLabel, TTrack.TrackDecimalField, TTrack.TrackNumberField
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JMenuItem
static final float[]
protected Double
protected static final String[]
protected JLabel
protected JLabel
protected boolean
protected static final String[]
protected boolean
protected boolean
protected boolean
protected JLabel
protected static final double
protected boolean
protected boolean
protected Footprint[]
protected boolean
protected Footprint[]
Fields inherited from class org.opensourcephysics.cabrillo.tracker.InputTrack
editing, editListener, fixedPosition, inputField, ruler, rulerCheckbox
Fields inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
angleField, angleLabel, angleSeparator, attachmentNames, attachments, autoAdvance, autoAdvanceItem, autoTrackerMarking, circleFootprintListener, clearStepsItem, closeButton, colorItem, constantsLoadedFromXML, customNumberFormats, dataBuilderItem, dataDescriptions, dataFrames, dataProp, datasetManager, dataValid, defaultColors, defaultFootprint, deleteStepItem, deleteTrackItem, description, descriptionItem, enabled, fieldBorder, fixedItem, footprint, footprintListener, footprintMenu, footprints, formatAngleMouseListener, formatMouseListener, hint, HINT_STEP_ADDED_OR_REMOVED, HINT_STEPS_SELECTED, initialized, isMarking, keyFrames, labelFont, locked, lockedItem, magField, magLabel, magSeparator, markByDefault, markByDefaultItem, name, nameDialog, nameItem, nextID, NOMAP, NOMAPS, NOVARA, NOVARS, numberFields, partName, points, positionFields, preferredColumnOrder, properties, PROPERTY_TTRACK_COLOR, PROPERTY_TTRACK_DATA, PROPERTY_TTRACK_FOOTPRINT, PROPERTY_TTRACK_FORMAT, PROPERTY_TTRACK_LOCKED, PROPERTY_TTRACK_MASS, PROPERTY_TTRACK_MODELEND, PROPERTY_TTRACK_MODELSTART, PROPERTY_TTRACK_NAME, PROPERTY_TTRACK_STEP, PROPERTY_TTRACK_STEPS, PROPERTY_TTRACK_TEXTCOLUMN, PROPERTY_TTRACK_VISIBLE, refreshDataLater, skippedStepWarningCheckbox, skippedStepWarningDialog, skippedStepWarningOn, skippedStepWarningTextpane, stepLabel, steps, stepSeparator, stepSizeWhenFirstMarked, stepValueLabel, targetIndex, textColumnEntries, textColumnNames, tField, tframe, tLabel, toolbarPointComponents, toolbarTrackComponents, tp, trailLength, trailVisible, trailVisibleItem, tSeparator, ttype, tValueLabel, TYPE_CALIBRATION, TYPE_CIRCLEFITTER, TYPE_COORDAXES, TYPE_LINEPROFILE, TYPE_OFFSETORIGIN, TYPE_PERSPECTIVE, TYPE_POINTMASS, TYPE_PROTRACTOR, TYPE_RGBREGION, TYPE_TAPEMEASURE, TYPE_UNKNOWN, TYPE_VECTOR, viewable, visible, visibleItem, xField, xLabel, xSeparator, xSpinner, yField, yLabel, ySeparator, ySpinner
Fields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionautoMarkAt
(int n, double x, double y) Used by autoTracker to mark a step at a match target position.protected boolean
protected NumberField
createStep
(int n, double x, double y) Implements createStep but only mimics step creation since steps are created automatically by the autofill StepArray.createStep
(int n, double x1, double y1, double x2, double y2) Mimics step creation by setting end positions of an existing step.protected void
endEditing
(Step step, String rawText) findInteractive
(DrawingPanel panel, int xpix, int ypix) Implements findInteractive method.int
Gets the length of the footprints required by this track.getFormattedLength
(double length) Formats the specified length value.String[]
protected JPopupMenu
Returns a popup menu for the input field (readout).protected Rectangle
getLayoutBounds
(Step step) static XML.ObjectLoader
Returns an ObjectLoader to save and load data for this class.getMenu
(TrackerPanel trackerPanel, JMenu menu0) Returns a menu with items that control this track.protected void
Map<String,
NumberField[]> Gets a map of number fields by name.protected Ruler
getRuler()
Gets the Ruler.int
Gets the length of the steps created by this track.protected String
getTargetDescription
(int pointIndex) Returns a description of a target point with a given index.getToolbarTrackComponents
(TrackerPanel trackerPanel) Returns a list of point-related toolbar components.getVarDimsImpl
(String variable) protected boolean
Determines if at least one point in this track is autotrackable.protected boolean
Determines if the input fields are enabled.boolean
Gets the fixed length property.boolean
isLocked()
Overrides TTrack isLocked method.boolean
Gets the markByDefault property.boolean
Gets the ReadOnly property.boolean
Gets the stickMode property.boolean
Reports whether or not this is viewable.void
Responds to property change events.protected void
refreshData
(DatasetManager data, TrackerPanel trackerPanel) Refreshes the data.protected void
refreshStep
(Step step) Refreshes a step by setting it equal to the previous keyframe step.protected void
Refreshes world lengths at all steps based on current ends and scale.void
Remarks all steps on the specified panel.boolean
Implements MarkingRequired interface.void
setCalibrator
(Double worldLength) Sets this to be a calibration tape or stick.void
setFixedLength
(boolean fixed) Sets the fixed length property.void
setFontLevel
(int level) Sets the font level.protected void
setInputValue
(Step step) void
setLocked
(boolean locked) Overrides TTrack method.void
setReadOnly
(boolean readOnly) Sets the readOnly property.void
setStickMode
(boolean stick) Sets the stickMode property.void
setTrackerPanel
(TrackerPanel panel) Overrides TTrack setTrackerPanel method.void
setVisible
(boolean visible) Overrides TTrack setVisible method to change notYetShown flag.toString()
Overrides Object toString method.Methods inherited from class org.opensourcephysics.cabrillo.tracker.InputTrack
deleteStep, getAttachmentLength, getKeyStep, getStep, getStep, isAutoTrackable, isFixedPosition, mouseClickedAction, setColor, setEditAction, setEditing, setFixedPosition, setFootprint, setMagValue, setTrailVisible, stopEditing
Methods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFixedItem, addFootprint, addListener, addListenerNCF, addPanelEvents, addStepListener, addTextColumn, assembleMenu, clearColumns, convertTextToDataColumn, createAllVariables, createWarningDialog, delete, delete, dispose, draw, erase, erase, finalize, fireStepsChanged, getAllVariables, getAttachmentDescription, getAttachments, getBaseTrackName, getBaseTypeInt, getColor, getCustomFormatPatterns, getData, getData, getDataDescription, getDataName, getDefaultFormatPatterns, getDefaultFormatPatterns, getDescription, getFootprint, getFootprint, getFootprintName, getFootprints, getFootprints, getFormatPatterns, getFrameForData, getIcon, getID, getMarkedPoint, getMarkingCursor, getMessage, getName, getName, getNameDialog, getNextVisibleStep, getNumberFieldsForStep, getPlotViews, getPreferredDataOrder, getPreviousVisibleStep, getProperty, getPropertyNames, getSkippedStepWarningDialog, getSteps, getStepSizeWarningDialog, getTableViews, getTargetIndex, getTextColumnEntry, getTextColumnNames, getToolbarPointComponents, getTrack, getTrailLength, getValues, getVarFormatPattern, getVariableDimensions, getVariablesFromFormatterDisplayName, getX, getXMax, getXMin, getY, getYMax, getYMin, initialize, invalidateData, isAttached, isAutoAdvance, isDataValid, isDependent, isEmpty, isEnabled, isFullyAttached, isMarking, isMeasured, isStepComplete, isStepVisible, isTrailVisible, isVisible, loadAttachmentsFromNames, refreshAttachments, refreshAttachmentsLater, refreshData, refreshDecimalSeparators, remark, removeActiveTrack, removeDeleteTrackItem, removeListener, removeListenerNCF, removePanelEvents, removeStepListener, removeTextColumn, renameTextColumn, repaint, repaint, repaintAll, repaintStep, restorePatterns, savePatterns, setActive, setAnglesInRadians, setAutoAdvance, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFootprint, setFootprints, setFootprints, setFormatPattern, setInitialFormatPatterns, setMarkByDefault, setMarking, setName, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, setTextColumnEntry, setTrailLength, setViewable, setX, setXY, setY, showAnglePopup, showFormatPopup, updateListenerVisible
Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
-
Field Details
-
MIN_LENGTH
protected static final double MIN_LENGTH- See Also:
-
BROKEN_LINE
public static final float[] BROKEN_LINE -
dataVariables
-
formatVariables
-
formatMap
-
formatDescriptionMap
-
allVariables
-
fixedLength
protected boolean fixedLength -
readOnly
protected boolean readOnly -
stickMode
protected boolean stickMode -
isStepChangingScale
protected boolean isStepChangingScale -
notYetShown
protected boolean notYetShown -
isIncomplete
protected boolean isIncomplete -
isCalibrator
protected boolean isCalibrator -
end1Label
-
end2Label
-
lengthLabel
-
tapeFootprints
-
stickFootprints
-
lengthKeyFrames
-
attachmentItem
-
calibrationLength
-
-
Constructor Details
-
TapeMeasure
public TapeMeasure()Constructs a TapeMeasure.
-
-
Method Details
-
getFormatVariables
- Specified by:
getFormatVariables
in classTTrack
-
getFormatMap
- Specified by:
getFormatMap
in classTTrack
-
getFormatDescMap
- Specified by:
getFormatDescMap
in classTTrack
-
getBaseType
- Specified by:
getBaseType
in classTTrack
-
getVarDimsImpl
- Specified by:
getVarDimsImpl
in classTTrack
-
setFixedLength
public void setFixedLength(boolean fixed) Sets the fixed length property. When it is fixed, it has the same world length at all times. Applies to sticks only.- Parameters:
fixed
-true
to fix the length
-
isFixedLength
public boolean isFixedLength()Gets the fixed length property.- Returns:
true
if length is fixed
-
setReadOnly
public void setReadOnly(boolean readOnly) Sets the readOnly property. When true, the scale and angle are not settable.- Parameters:
readOnly
-true
to prevent editing
-
isReadOnly
public boolean isReadOnly()Gets the ReadOnly property.- Returns:
true
if read-only
-
setStickMode
public void setStickMode(boolean stick) Sets the stickMode property. When true, the 'stick" has constant world length and the scale changes when you drag the mouse. When false, the "tape" stretches without changing the scale when you drag the mouse.- Parameters:
stick
-true
for stick mode,false
for tape mode
-
isStickMode
public boolean isStickMode()Gets the stickMode property.- Returns:
true
if in stick mode
-
setCalibrator
Sets this to be a calibration tape or stick.- Parameters:
worldLength
- the initial length of a calibration stick (ignored by tape)
-
isMarkByDefault
public boolean isMarkByDefault()Description copied from class:TTrack
Gets the markByDefault property. When true, the mouse handler should mark a point whenever the active track reports itself incomplete.- Overrides:
isMarkByDefault
in classTTrack
- Returns:
true
if this marks by default
-
requiresMarking
public boolean requiresMarking()Implements MarkingRequired interface.- Specified by:
requiresMarking
in interfaceMarkingRequired
-
setLocked
public void setLocked(boolean locked) Overrides TTrack method. -
propertyChange
Responds to property change events. Overrides TTrack method.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Overrides:
propertyChange
in classTTrack
- Parameters:
e
- the property change event
-
setVisible
public void setVisible(boolean visible) Overrides TTrack setVisible method to change notYetShown flag.- Overrides:
setVisible
in classTTrack
- Parameters:
visible
-true
to show this track
-
isLocked
public boolean isLocked()Overrides TTrack isLocked method. -
createStep
Implements createStep but only mimics step creation since steps are created automatically by the autofill StepArray.- Specified by:
createStep
in classTTrack
- Parameters:
n
- the frame numberx
- the x coordinate in image spacey
- the y coordinate in image space- Returns:
- the step
-
createStep
Mimics step creation by setting end positions of an existing step. If no existing step, creates one and autofills array- Parameters:
n
- the frame numberx1
- the x coordinate of end1 in image spacey1
- the y coordinate of end1 in image spacex2
- the x coordinate of end2 in image spacey2
- the y coordinate of end2 in image space- Returns:
- the step
-
autoMarkAt
Used by autoTracker to mark a step at a match target position.- Overrides:
autoMarkAt
in classTTrack
- 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
-
getStepLength
public int getStepLength()Gets the length of the steps created by this track.- Specified by:
getStepLength
in classTTrack
- Returns:
- the footprint length
-
getFootprintLength
public int getFootprintLength()Gets the length of the footprints required by this track.- Specified by:
getFootprintLength
in classTTrack
- Returns:
- the footprint length
-
getFormattedLength
Formats the specified length value.- Parameters:
length
- the length value to format- Returns:
- the formatted length string
-
isViewable
public boolean isViewable()Reports whether or not this is viewable.- Overrides:
isViewable
in classTTrack
- Returns:
true
if this track is viewable
-
isAutoTrackable
protected boolean isAutoTrackable()Determines if at least one point in this track is autotrackable.- Overrides:
isAutoTrackable
in classTTrack
- Returns:
- true if autotrackable
-
getTargetDescription
Returns a description of a target point with a given index.- Overrides:
getTargetDescription
in classTTrack
- Parameters:
pointIndex
- the index- Returns:
- the description
-
getMenu
Returns a menu with items that control this track. -
getMenuItems
protected void getMenuItems()- Overrides:
getMenuItems
in classTTrack
-
getToolbarTrackComponents
Returns a list of point-related toolbar components.- Overrides:
getToolbarTrackComponents
in classTTrack
- Parameters:
trackerPanel
- the tracker panel- Returns:
- a list of components
-
findInteractive
Implements findInteractive method.- Specified by:
findInteractive
in interfaceInteractive
- Overrides:
findInteractive
in classTTrack
- Parameters:
panel
- the drawing panelxpix
- the x pixel position on the panelypix
- the y pixel position on the panel- Returns:
- the first step or motion vector that is hit
-
refreshData
Refreshes the data.- Overrides:
refreshData
in classTTrack
- Parameters:
data
- the DatasetManagertrackerPanel
- the tracker panel
-
remark
Remarks all steps on the specified panel. Overrides TTrack method. -
toString
Overrides Object toString method. -
getNumberFields
Description copied from class:TTrack
Gets a map of number fields by name.- Overrides:
getNumberFields
in classTTrack
- Returns:
- a map of name to NumberField.
-
getInputFieldPopup
Returns a popup menu for the input field (readout).- Returns:
- the popup menu
-
setFontLevel
public void setFontLevel(int level) Description copied from class:TTrack
Sets the font level.- Overrides:
setFontLevel
in classInputTrack
- Parameters:
level
- the desired font level
-
setTrackerPanel
Overrides TTrack setTrackerPanel method.- Overrides:
setTrackerPanel
in classInputTrack
- Parameters:
panel
- the TrackerPanel
-
refreshWorldLengths
protected void refreshWorldLengths()Refreshes world lengths at all steps based on current ends and scale. -
isFieldsEnabled
protected boolean isFieldsEnabled()Determines if the input fields are enabled.- Returns:
- true if enabled
-
getRuler
Description copied from class:InputTrack
Gets the Ruler. Subclasses override to return the appropriate Ruler type.- Overrides:
getRuler
in classInputTrack
- Returns:
- the Ruler
-
refreshStep
Refreshes a step by setting it equal to the previous keyframe step.- Specified by:
refreshStep
in classInputTrack
- Parameters:
step
- the step to refresh
-
createInputField
- Specified by:
createInputField
in classInputTrack
-
getLayoutBounds
- Specified by:
getLayoutBounds
in classInputTrack
-
checkKeyFrame
protected boolean checkKeyFrame()- Specified by:
checkKeyFrame
in classInputTrack
-
endEditing
- Specified by:
endEditing
in classInputTrack
-
setInputValue
- Specified by:
setInputValue
in classInputTrack
-
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-