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 classInner 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 JMenuItemstatic final float[]protected Doubleprotected static final String[]protected JLabelprotected JLabelprotected booleanprotected static final String[]protected booleanprotected booleanprotected booleanprotected JLabelprotected static final doubleprotected booleanprotected booleanprotected Footprint[]protected booleanprotected Footprint[]Fields inherited from class org.opensourcephysics.cabrillo.tracker.InputTrack
editing, editListener, fixedPosition, inputField, ruler, rulerCheckboxFields 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, ySpinnerFields 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 booleanprotected NumberFieldcreateStep(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 voidendEditing(Step step, String rawText) findInteractive(DrawingPanel panel, int xpix, int ypix) Implements findInteractive method.intGets the length of the footprints required by this track.getFormattedLength(double length) Formats the specified length value.String[]protected JPopupMenuReturns a popup menu for the input field (readout).protected RectanglegetLayoutBounds(Step step) static XML.ObjectLoaderReturns an ObjectLoader to save and load data for this class.getMenu(TrackerPanel trackerPanel, JMenu menu0) Returns a menu with items that control this track.protected voidMap<String,NumberField[]> Gets a map of number fields by name.protected RulergetRuler()Gets the Ruler.intGets the length of the steps created by this track.protected StringgetTargetDescription(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 booleanDetermines if at least one point in this track is autotrackable.protected booleanDetermines if the input fields are enabled.booleanGets the fixed length property.booleanisLocked()Overrides TTrack isLocked method.booleanGets the markByDefault property.booleanGets the ReadOnly property.booleanGets the stickMode property.booleanReports whether or not this is viewable.voidResponds to property change events.protected voidrefreshData(DatasetManager data, TrackerPanel trackerPanel) Refreshes the data.protected voidrefreshStep(Step step) Refreshes a step by setting it equal to the previous keyframe step.protected voidRefreshes world lengths at all steps based on current ends and scale.voidRemarks all steps on the specified panel.booleanImplements MarkingRequired interface.voidsetCalibrator(Double worldLength) Sets this to be a calibration tape or stick.voidsetFixedLength(boolean fixed) Sets the fixed length property.voidsetFontLevel(int level) Sets the font level.protected voidsetInputValue(Step step) voidsetLocked(boolean locked) Overrides TTrack method.voidsetReadOnly(boolean readOnly) Sets the readOnly property.voidsetStickMode(boolean stick) Sets the stickMode property.voidsetTrackerPanel(TrackerPanel panel) Overrides TTrack setTrackerPanel method.voidsetVisible(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, stopEditingMethods 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, updateListenerVisibleMethods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opensourcephysics.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:
getFormatVariablesin classTTrack
-
getFormatMap
- Specified by:
getFormatMapin classTTrack
-
getFormatDescMap
- Specified by:
getFormatDescMapin classTTrack
-
getBaseType
- Specified by:
getBaseTypein classTTrack
-
getVarDimsImpl
- Specified by:
getVarDimsImplin 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-trueto fix the length
-
isFixedLength
public boolean isFixedLength()Gets the fixed length property.- Returns:
trueif length is fixed
-
setReadOnly
public void setReadOnly(boolean readOnly) Sets the readOnly property. When true, the scale and angle are not settable.- Parameters:
readOnly-trueto prevent editing
-
isReadOnly
public boolean isReadOnly()Gets the ReadOnly property.- Returns:
trueif 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-truefor stick mode,falsefor tape mode
-
isStickMode
public boolean isStickMode()Gets the stickMode property.- Returns:
trueif 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:TTrackGets the markByDefault property. When true, the mouse handler should mark a point whenever the active track reports itself incomplete.- Overrides:
isMarkByDefaultin classTTrack- Returns:
trueif this marks by default
-
requiresMarking
public boolean requiresMarking()Implements MarkingRequired interface.- Specified by:
requiresMarkingin interfaceMarkingRequired
-
setLocked
public void setLocked(boolean locked) Overrides TTrack method. -
propertyChange
Responds to property change events. Overrides TTrack method.- Specified by:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classTTrack- Parameters:
e- the property change event
-
setVisible
public void setVisible(boolean visible) Overrides TTrack setVisible method to change notYetShown flag.- Overrides:
setVisiblein classTTrack- Parameters:
visible-trueto 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:
createStepin 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:
autoMarkAtin 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:
getStepLengthin classTTrack- Returns:
- the footprint length
-
getFootprintLength
public int getFootprintLength()Gets the length of the footprints required by this track.- Specified by:
getFootprintLengthin 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:
isViewablein classTTrack- Returns:
trueif this track is viewable
-
isAutoTrackable
protected boolean isAutoTrackable()Determines if at least one point in this track is autotrackable.- Overrides:
isAutoTrackablein classTTrack- Returns:
- true if autotrackable
-
getTargetDescription
Returns a description of a target point with a given index.- Overrides:
getTargetDescriptionin classTTrack- Parameters:
pointIndex- the index- Returns:
- the description
-
getMenu
Returns a menu with items that control this track. -
getMenuItems
protected void getMenuItems()- Overrides:
getMenuItemsin classTTrack
-
getToolbarTrackComponents
Returns a list of point-related toolbar components.- Overrides:
getToolbarTrackComponentsin classTTrack- Parameters:
trackerPanel- the tracker panel- Returns:
- a list of components
-
findInteractive
Implements findInteractive method.- Specified by:
findInteractivein interfaceInteractive- Overrides:
findInteractivein 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:
refreshDatain 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:TTrackGets a map of number fields by name.- Overrides:
getNumberFieldsin 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:TTrackSets the font level.- Overrides:
setFontLevelin classInputTrack- Parameters:
level- the desired font level
-
setTrackerPanel
Overrides TTrack setTrackerPanel method.- Overrides:
setTrackerPanelin 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:InputTrackGets the Ruler. Subclasses override to return the appropriate Ruler type.- Overrides:
getRulerin classInputTrack- Returns:
- the Ruler
-
refreshStep
Refreshes a step by setting it equal to the previous keyframe step.- Specified by:
refreshStepin classInputTrack- Parameters:
step- the step to refresh
-
createInputField
- Specified by:
createInputFieldin classInputTrack
-
getLayoutBounds
- Specified by:
getLayoutBoundsin classInputTrack
-
checkKeyFrame
protected boolean checkKeyFrame()- Specified by:
checkKeyFramein classInputTrack
-
endEditing
- Specified by:
endEditingin classInputTrack
-
setInputValue
- Specified by:
setInputValuein classInputTrack
-
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-