Class TapeStep
java.lang.Object
org.opensourcephysics.cabrillo.tracker.Step
org.opensourcephysics.cabrillo.tracker.TapeStep
- All Implemented Interfaces:
Cloneable
This is a Step for a TapeMeasure. It is used for measuring distances and
angles and for setting the scale and angle of an ImageCoordSystem.
- Author:
- Douglas Brown
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected booleanprotected TPointprotected TPointprotected static TPointprotected static TPointprotected booleanprotected org.opensourcephysics.cabrillo.tracker.TapeStep.Handleprotected TPointprotected Map<Integer,OSPRuntime.TextLayout> protected org.opensourcephysics.cabrillo.tracker.TapeStep.Rotatorprotected org.opensourcephysics.cabrillo.tracker.TapeStep.Rotatorprotected org.opensourcephysics.cabrillo.tracker.MultiShape[]protected Shapeprotected TapeMeasureprotected doubleprotected doubleprotected doubleFields inherited from class org.opensourcephysics.cabrillo.tracker.Step
dataVisible, defaultIndex, footprint, format, hitRect, n, panelMarks, points, screenPoints, selectionShape, selectionStroke, trackID, transform, type, TYPE_ACCELERATION, TYPE_UNKNOWN, TYPE_VELOCITY, valid -
Constructor Summary
ConstructorsConstructorDescriptionTapeStep(TapeMeasure track, int n, double x1, double y1, double x2, double y2) Constructs a TapeStep with specified end point coordinates in image space. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidRotates the tips about a TPoint axis to display current xAxisToTapeAngle.protected voidMoves the tips of the tape to display current worldLength.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 default point.getEnd1()Gets end 1.getEnd2()Gets end 2.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.doubleGets the world angle of this tape.doublegetTapeLength(boolean fromEnds) Gets the scaled world length of this tape, with side effect of updating angle and length fields.booleanGets whether the ends are enabled.voidsetEndsEnabled(boolean enabled) Enables and disables the interactivity of the ends.voidsetFootprint(Footprint footprint) Overrides Step setFootprint method.voidsetTapeAngle(double theta) Sets the world angle of this tape.voidsetTapeLength(double length) Sets the world length of this tape and posts an undoable edit.toString()Returns a String describing this.Methods inherited from class org.opensourcephysics.cabrillo.tracker.Step
dispose, erase, erase, getFrameNumber, getPointIndex, getPoints, getTrack, remark, remark, repaint, repaint, setDefaultPointIndex, setHitRectCenter
-
Field Details
-
endPoint1
-
endPoint2
-
tape
-
end1
-
end2
-
middle
-
handle
protected org.opensourcephysics.cabrillo.tracker.TapeStep.Handle handle -
rotator1
protected org.opensourcephysics.cabrillo.tracker.TapeStep.Rotator rotator1 -
rotator2
protected org.opensourcephysics.cabrillo.tracker.TapeStep.Rotator rotator2 -
worldLength
protected double worldLength -
xAxisToTapeAngle
protected double xAxisToTapeAngle -
tapeAngle
protected double tapeAngle -
endsEnabled
protected boolean endsEnabled -
drawLayout
protected boolean drawLayout -
drawLayoutBounds
protected boolean drawLayoutBounds -
adjustingTips
protected boolean adjustingTips -
panelEnd1Shapes
-
panelEnd2Shapes
-
panelShaftShapes
-
panelRotatorShapes
-
panelTextLayouts
-
panelLayoutBounds
-
rotatorDrawShapes
protected org.opensourcephysics.cabrillo.tracker.MultiShape[] rotatorDrawShapes -
selectedShape
-
-
Constructor Details
-
TapeStep
Constructs a TapeStep with specified end point coordinates in image space.- Parameters:
track- the trackn- the frame numberx1- the x coordinate of end 1y1- the y coordinate of end 1x2- the x coordinate of end 2y2- the y coordinate of end 2
-
-
Method Details
-
getEnd1
Gets end 1.- Returns:
- end 1
-
getEnd2
Gets end 2.- Returns:
- end 2
-
getHandle
Gets the handle.- Returns:
- the handle
-
setEndsEnabled
public void setEndsEnabled(boolean enabled) Enables and disables the interactivity of the ends.- Parameters:
enabled-trueto enable the ends
-
isEndsEnabled
public boolean isEndsEnabled()Gets whether the ends are enabled.- Returns:
trueif the ends are enabled
-
setFootprint
Overrides Step setFootprint method.- Overrides:
setFootprintin classStep- Parameters:
footprint- the footprint
-
findInteractive
Overrides Step findInteractive method.- Overrides:
findInteractivein classStep- Parameters:
panel- the drawing panelxpix- the x pixel positionypix- the y pixel position- Returns:
- the Interactive that is hit, or null
-
draw
Overrides Step draw method. -
getDefaultPoint
Gets the default point. The default point is the point initially selected when the step is created. Overrides step getDefaultPoint method.- Overrides:
getDefaultPointin classStep- Returns:
- the default TPoint
-
getMark
Overrides Step getMark method. -
getTapeLength
public double getTapeLength(boolean fromEnds) Gets the scaled world length of this tape, with side effect of updating angle and length fields.- Parameters:
fromEnds- true if calculated from the current tip positions- Returns:
- the length in world units
-
getTapeAngle
public double getTapeAngle()Gets the world angle of this tape. Call this method only after getTapeLength(), which does the real work.- Returns:
- the angle relative to the positive x-axis
-
setTapeLength
public void setTapeLength(double length) Sets the world length of this tape and posts an undoable edit.- Parameters:
length- the length in world units
-
setTapeAngle
public void setTapeAngle(double theta) Sets the world angle of this tape.- Parameters:
theta- the angle in radians
-
clone
Clones this Step. -
toString
Returns a String describing this. -
getLength
public static int getLength()Gets the step length.- Returns:
- the length of the points array
-
adjustTipsToLength
protected void adjustTipsToLength()Moves the tips of the tape to display current worldLength. -
adjustTipsToAngle
Rotates the tips about a TPoint axis to display current xAxisToTapeAngle. If the TPoint is null the axis is determined from selection and attachment status.- Parameters:
p- the TPoint, may be null
-
getLoader
Returns an ObjectLoader to save and load data for this class.- Returns:
- the object loader
-