Class VectorStep
java.lang.Object
org.opensourcephysics.cabrillo.tracker.Step
org.opensourcephysics.cabrillo.tracker.VectorStep
- All Implemented Interfaces:
- PropertyChangeListener,- Cloneable,- EventListener
This is a Step that represents a vector. It is used when tracking vector
 objects (eg Force) or displaying the motion of a PointMass.
- Author:
- Douglas Brown
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected TPointprotected booleanprotected VectorChainprotected intprotected intprotected booleanprotected org.opensourcephysics.cabrillo.tracker.VectorStep.Handleprotected booleanprotected TPointprotected static booleanprotected booleanprotected static doubleprotected TPointprotected TPointprotected Map<Integer,OSPRuntime.TextLayout> protected TPointprotected booleanprotected TPointprotected booleanprotected static booleanprotected org.opensourcephysics.cabrillo.tracker.VectorStep.VisibleTipFields inherited from class org.opensourcephysics.cabrillo.tracker.StepdataVisible, defaultIndex, footprint, format, hitRect, n, panelMarks, points, screenPoints, selectionShape, selectionStroke, trackID, transform, type, TYPE_ACCELERATION, TYPE_UNKNOWN, TYPE_VELOCITY
- 
Constructor SummaryConstructorsConstructorDescriptionVectorStep(TTrack track, int n, double x, double y, double xc, double yc) Constructs a VectorStep with specified imagespace tail coordinates and vector components.VectorStep(TTrack track, int n, double x, double y, double xc, double yc, int type) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidAttaches the tail of this vector to the specified point.clone()Clones this Step.voiddraw(DrawingPanel panel, Graphics _g) Overrides Step draw method.findInteractive(DrawingPanel panel, int xpix, int ypix) Overrides Step findInteractive method.Gets the attachment point.getChain()Gets the vector chain containing this vector, if any.Gets the handle.static intGets the step length.static XML.ObjectLoaderReturns an ObjectLoader to save and load data for this class.protected MarkgetMark(TrackerPanel trackerPanel) Overrides Step getMark method.getTail()Gets the tail.getTip()Gets the tip.Gets the visible tip point.doubleGets the x component.doubleGets the y component.booleanGets the vector label visibility.static booleanGets whether snap-to-point is enabled.booleanGets the rollover visibility.booleanGets whether the tip is enabled.static booleanGets whether snap-to-vector is enabled.voidResponds to property change events.voidsetFirePropertyChangeEvents(boolean fireEvents) Sets firePropertyChangeEvents flag.voidsetFootprint(Footprint footprint) Overrides Step setFootprint method.voidsetLabelVisible(boolean visible) Sets the vector label visibility.static voidsetPointSnapEnabled(boolean enabled) Enables and disables snap-to-point.voidsetRolloverVisible(boolean visible) Sets the rollover visibility.voidsetTipEnabled(boolean enabled) Enables and disables the interactivity of the tip.static voidsetVectorSnapEnabled(boolean enabled) Enables and disables snap-to-vector.voidsetXComponent(double x) Sets the x component.voidsetXYComponents(double x, double y) Sets the x and y components.voidsetYComponent(double y) Sets the y component.voidsnap(TrackerPanel trackerPanel) Snaps to point or vector within snapDistance of tail.toString()Returns a String describing this.Methods inherited from class org.opensourcephysics.cabrillo.tracker.Stepdispose, erase, erase, getDefaultPoint, getFrameNumber, getPointIndex, getPoints, getTrack, remark, remark, repaint, repaint, setDefaultPointIndex, setHitRectCenter
- 
Field Details- 
pointSnapEnabledprotected static boolean pointSnapEnabled
- 
vectorSnapEnabledprotected static boolean vectorSnapEnabled
- 
snapDistanceprotected static double snapDistance
- 
tipPoint
- 
tailPoint
- 
tail
- 
tip
- 
middle
- 
handleprotected org.opensourcephysics.cabrillo.tracker.VectorStep.Handle handle
- 
visibleTipprotected org.opensourcephysics.cabrillo.tracker.VectorStep.VisibleTip visibleTip
- 
dxprotected int dx
- 
dyprotected int dy
- 
tipEnabledprotected boolean tipEnabled
- 
tipShapes
- 
shaftShapes
- 
attachmentPoint
- 
chain
- 
brandNewprotected boolean brandNew
- 
firePropertyChangeEventsprotected boolean firePropertyChangeEvents
- 
labelVisibleprotected boolean labelVisible
- 
rolloverVisibleprotected boolean rolloverVisible
- 
validprotected boolean valid
- 
textLayouts
- 
layoutBounds
 
- 
- 
Constructor Details- 
VectorStepConstructs a VectorStep with specified imagespace tail coordinates and vector components.- Parameters:
- track- the track
- n- the frame number
- x- the x coordinate
- y- the y coordinate
- xc- the x component
- yc- the y component
 
- 
VectorStep
 
- 
- 
Method Details- 
getTipGets the tip.- Returns:
- the tip
 
- 
getTailGets the tail.- Returns:
- the tail
 
- 
getHandleGets the handle.- Returns:
- the handle
 
- 
getVisibleTipGets the visible tip point.- Returns:
- the visible tip
 
- 
setXComponentpublic void setXComponent(double x) Sets the x component.- Parameters:
- x- the x component
 
- 
setYComponentpublic void setYComponent(double y) Sets the y component.- Parameters:
- y- the y component
 
- 
setXYComponentspublic void setXYComponents(double x, double y) Sets the x and y components.- Parameters:
- x- the x component
- y- the y component
 
- 
getXComponentpublic double getXComponent()Gets the x component.- Returns:
- the x component
 
- 
getYComponentpublic double getYComponent()Gets the y component.- Returns:
- the y component
 
- 
isLabelVisiblepublic boolean isLabelVisible()Gets the vector label visibility.- Returns:
- trueif label is visible
 
- 
setLabelVisiblepublic void setLabelVisible(boolean visible) Sets the vector label visibility.- Parameters:
- visible-- trueto make label visible
 
- 
isRolloverVisiblepublic boolean isRolloverVisible()Gets the rollover visibility.- Returns:
- trueif labels are visible on rollover only
 
- 
setRolloverVisiblepublic void setRolloverVisible(boolean visible) Sets the rollover visibility.- Parameters:
- visible-- trueto make labels visible on rollover only
 
- 
setPointSnapEnabledpublic static void setPointSnapEnabled(boolean enabled) Enables and disables snap-to-point.- Parameters:
- enabled-- trueto enable snap-to-point
 
- 
isPointSnapEnabledpublic static boolean isPointSnapEnabled()Gets whether snap-to-point is enabled.- Returns:
- trueif snap-to-point is enabled
 
- 
setVectorSnapEnabledpublic static void setVectorSnapEnabled(boolean enabled) Enables and disables snap-to-vector.- Parameters:
- enabled-- trueto enable snap-to-vector
 
- 
isVectorSnapEnabledpublic static boolean isVectorSnapEnabled()Gets whether snap-to-vector is enabled.- Returns:
- trueif snap-to-vector is enabled
 
- 
snapSnaps to point or vector within snapDistance of tail.- Parameters:
- trackerPanel- the tracker panel drawing this
 
- 
getChainGets the vector chain containing this vector, if any.- Returns:
- the chain
 
- 
attachAttaches the tail of this vector to the specified point. Detaches if the point is null.- Parameters:
- pt- the attachment point
 
- 
getAttachmentPointGets the attachment point.- Returns:
- the attachment point
 
- 
setTipEnabledpublic void setTipEnabled(boolean enabled) Enables and disables the interactivity of the tip.- Parameters:
- enabled-- trueto enable the tip
 
- 
isTipEnabledpublic boolean isTipEnabled()Gets whether the tip is enabled.- Returns:
- trueif the tip is enabled
 
- 
setFootprintOverrides Step setFootprint method.- Overrides:
- setFootprintin class- Step
- Parameters:
- footprint- the footprint
 
- 
drawOverrides Step draw method.
- 
findInteractiveOverrides Step findInteractive method.- Overrides:
- findInteractivein class- Step
- Parameters:
- panel- the drawing panel
- xpix- the x pixel position
- ypix- the y pixel position
- Returns:
- the TPoint that is hit, or null
 
- 
getMarkOverrides Step getMark method.
- 
propertyChangeResponds to property change events. VectorStep receives the following events: "location" from an attached TPoint.- Specified by:
- propertyChangein interface- PropertyChangeListener
- Parameters:
- e- the property change event
 
- 
setFirePropertyChangeEventspublic void setFirePropertyChangeEvents(boolean fireEvents) Sets firePropertyChangeEvents flag.- Parameters:
- fireEvents-- trueto request this to fire property change events
 
- 
cloneClones this Step.
- 
toStringReturns a String describing this.
- 
getLengthpublic static int getLength()Gets the step length.- Returns:
- the length of the points array
 
- 
getLoaderReturns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
 
 
-