Class VectorSum
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.cabrillo.tracker.TTrack
org.opensourcephysics.cabrillo.tracker.Vector
org.opensourcephysics.cabrillo.tracker.VectorSum
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,Drawable
,Interactive
,Measurable
,Trackable
A VectorSum draws a series of VectorSteps that represent a
vector sum of its set of vectors.
- Author:
- Douglas Brown
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensourcephysics.cabrillo.tracker.Vector
Vector.FrameData
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 VectorSumInspector
protected JMenuItem
protected Vector[]
Fields inherited from class org.opensourcephysics.cabrillo.tracker.Vector
allVariables, dataVariables, fieldVariables, formatDescriptionMap, formatMap, formatVariables, labelsVisibleItem, tailsToOriginItem, visMap
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 TypeMethodDescriptionvoid
Adds a vector to this sum.boolean
Determines if the specified vector is in this sum.createStep
(int n, double x, double y, double xc, double yc) Overrides vector method.void
dispose()
Cleans up associated resources when this track is deleted or cleared.void
draw
(DrawingPanel panel, Graphics _g) Overrides Vector draw method.findInteractive
(DrawingPanel panel, int xpix, int ypix) Finds the interactive drawable object located at the specified pixel position.Gets the vector sum inspector.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.getToolbarPointComponents
(TrackerPanel trackerPanel, TPoint point) Overrides TTrack getToolbarPointComponents method.Vector[]
Gets the array of vectors in this sum.void
initialize
(TrackerPanel panel) Finish up any unfinished loading business that for whatever reason was not finished upon loading a track.boolean
Overrides TTrack isDependent method to return true.boolean
isStepComplete
(int n) Overrides TTrack isStepComplete method.void
Responds to property change events.void
removeVector
(Vector vec) Removes a vector from this sum.void
setFontLevel
(int level) Sets the font level.void
setLocked
(boolean locked) Overrides TTrack setLocked method.void
setTrackerPanel
(TrackerPanel panel) Adds events for TrackerPanel.toString()
Overrides Object toString method.Methods inherited from class org.opensourcephysics.cabrillo.tracker.Vector
createStep, getBaseType, getFootprintLength, getFormatDescMap, getFormatMap, getFormatVariables, getNumberFields, getStepLength, getToolbarTrackComponents, getVarDimsImpl, isLabelsVisible, isVectorsVisible, refreshData, setLabelsVisible, setMarking, setVectorsVisible
Methods inherited from class org.opensourcephysics.cabrillo.tracker.TTrack
addFixedItem, addFootprint, addListener, addListenerNCF, addPanelEvents, addStepListener, addTextColumn, assembleMenu, autoMarkAt, clearColumns, convertTextToDataColumn, createAllVariables, createWarningDialog, delete, delete, deleteStep, erase, erase, finalize, fireStepsChanged, getAllVariables, getAttachmentDescription, getAttachmentLength, getAttachments, getBaseTrackName, getBaseTypeInt, getColor, getCustomFormatPatterns, getData, getData, getDataDescription, getDataName, getDefaultFormatPatterns, getDefaultFormatPatterns, getDescription, getFootprint, getFootprint, getFootprintName, getFootprints, getFootprints, getFormatPatterns, getFrameForData, getIcon, getID, getMarkedPoint, getMarkingCursor, getMenuItems, getMessage, getName, getName, getNameDialog, getNextVisibleStep, getNumberFieldsForStep, getPlotViews, getPreferredDataOrder, getPreviousVisibleStep, getProperty, getPropertyNames, getSkippedStepWarningDialog, getStep, getStep, getSteps, getStepSizeWarningDialog, getTableViews, getTargetDescription, getTargetIndex, getTextColumnEntry, getTextColumnNames, getTrack, getTrailLength, getValues, getVarFormatPattern, getVariableDimensions, getVariablesFromFormatterDisplayName, getX, getXMax, getXMin, getY, getYMax, getYMin, invalidateData, isAttached, isAutoAdvance, isAutoTrackable, isAutoTrackable, isDataValid, isEmpty, isEnabled, isFullyAttached, isLocked, isMarkByDefault, isMarking, isMeasured, isStepVisible, isTrailVisible, isViewable, isVisible, loadAttachmentsFromNames, refreshAttachments, refreshAttachmentsLater, refreshData, refreshDecimalSeparators, remark, remark, removeActiveTrack, removeDeleteTrackItem, removeListener, removeListenerNCF, removePanelEvents, removeStepListener, removeTextColumn, renameTextColumn, repaint, repaint, repaintAll, repaintStep, restorePatterns, savePatterns, setActive, setAnglesInRadians, setAutoAdvance, setColor, setColorToDefault, setDefaultNameAndColor, setDescription, setEnabled, setFixedPosition, setFootprint, setFootprint, setFootprints, setFootprints, setFormatPattern, setInitialFormatPatterns, setMarkByDefault, setName, setProperty, setTargetIndex, setTargetIndex, setTargetIndex, setTextColumnEntry, setTrailLength, setTrailVisible, setViewable, setVisible, 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
-
vectors
-
vectorNames
-
inspectorItem
-
tails
-
inspector
-
-
Constructor Details
-
VectorSum
public VectorSum()Constructs an empty VectorSum. -
VectorSum
Constructs a VectorSum with specified vectors.- Parameters:
vectors
- an array of vectors
-
-
Method Details
-
draw
Overrides Vector draw method. -
initialize
Description copied from class:TTrack
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.- Overrides:
initialize
in classTTrack
-
findInteractive
Finds the interactive drawable object located at the specified pixel position.- Specified by:
findInteractive
in interfaceInteractive
- Overrides:
findInteractive
in classVector
- 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
-
addVector
Adds a vector to this sum.- Parameters:
vec
- the vector
-
removeVector
Removes a vector from this sum.- Parameters:
vec
- the vector
-
getVectors
Gets the array of vectors in this sum.- Returns:
- a shallow clone of the vectors array
-
contains
Determines if the specified vector is in this sum.- Parameters:
vec
- the vector- Returns:
true
if vector is in this sum
-
createStep
Overrides vector method. Saves the specified tail position, then updates the step.- Overrides:
createStep
in classVector
- Parameters:
n
- the frame numberx
- the tail x coordinate in image spacey
- the tail y coordinate in image spacexc
- ignoredyc
- ignored- Returns:
- the new step
-
setFontLevel
public void setFontLevel(int level) Description copied from class:TTrack
Sets the font level.- Overrides:
setFontLevel
in classTTrack
- Parameters:
level
- the desired font level
-
setLocked
public void setLocked(boolean locked) Overrides TTrack setLocked method. VectorSum is always locked. -
isStepComplete
public boolean isStepComplete(int n) Overrides TTrack isStepComplete method. Always returns true.- Overrides:
isStepComplete
in classTTrack
- Parameters:
n
- the frame number- Returns:
true
always since sum gets data from vectors
-
isDependent
public boolean isDependent()Overrides TTrack isDependent method to return true.- Overrides:
isDependent
in classTTrack
- Returns:
true
since sum is dependent on its vectors
-
setTrackerPanel
Adds events for TrackerPanel.- Overrides:
setTrackerPanel
in classTTrack
- Parameters:
panel
- the new TrackerPanel
-
propertyChange
Responds to property change events.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Overrides:
propertyChange
in classVector
- Parameters:
e
- the property change event
-
dispose
public void dispose()Cleans up associated resources when this track is deleted or cleared. -
getMenu
Returns a menu with items that control this track. -
getToolbarPointComponents
Overrides TTrack getToolbarPointComponents method.- Overrides:
getToolbarPointComponents
in classVector
- Parameters:
trackerPanel
- the tracker panelpoint
- the TPoint- Returns:
- a list of components
-
toString
Overrides Object toString method. -
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-
getInspector
Gets the vector sum inspector.- Returns:
- the vector sum inspector
-