Class ProtractorStep
java.lang.Object
org.opensourcephysics.cabrillo.tracker.Step
org.opensourcephysics.cabrillo.tracker.ProtractorStep
- All Implemented Interfaces:
Cloneable
This is a Step for a Protractor. It is used for measuring angles.
- Author:
- Douglas Brown
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean
protected boolean
protected boolean
protected boolean
protected TPoint
protected TPoint
protected static TPoint
protected static TPoint
protected boolean
protected static NumberField
protected org.opensourcephysics.cabrillo.tracker.ProtractorStep.Handle
protected double
protected double
protected static TPoint
protected Map<Integer,
OSPRuntime.TextLayout> protected Map<Integer,
OSPRuntime.TextLayout> protected Map<Integer,
OSPRuntime.TextLayout> protected Protractor
protected org.opensourcephysics.cabrillo.tracker.ProtractorStep.Rotator
protected Shape
protected static AffineTransform
protected TPoint
protected org.opensourcephysics.cabrillo.tracker.MultiShape
Fields inherited from class org.opensourcephysics.cabrillo.tracker.Step
dataVisible, defaultIndex, footprint, format, hitRect, n, panelMarks, points, screenPoints, selectionShape, selectionStroke, trackID, type, TYPE_ACCELERATION, TYPE_UNKNOWN, TYPE_VELOCITY, valid
-
Constructor Summary
ConstructorsConstructorDescriptionProtractorStep
(Protractor track, int n, double x1, double y1, double x2, double y2) Constructs a ProtractorStep with specified end point coordinates in image space. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Clones this Step.void
draw
(DrawingPanel panel, Graphics _g) Overrides Step draw method.findInteractive
(DrawingPanel panel, int xpix, int ypix) Overrides Step findInteractive method.double
getArmLength
(TPoint end) Gets the world length of the base or arm.getFormattedLength
(TPoint end) Formats the specified length value.static int
Gets the step length.protected Mark
getMark
(TrackerPanel trackerPanel) Overrides Step getMark method.double
getProtractorAngle
(boolean refreshField) Gets the protractor angle.boolean
Gets whether the ends are enabled.protected void
moveVertexTo
(double x, double y) Moves the protractor so the vertex is at the specified position.int
n()
Returns the frame number.void
setArmLength
(TPoint end, double length) Sets the arm length of this tape.void
setEndsEnabled
(boolean enabled) Enables and disables the interactivity of the ends.void
setFootprint
(Footprint footprint) Overrides Step setFootprint method.void
setProtractorAngle
(double theta) Sets the protractor angle of this tape.toString()
Returns a String describing this.Methods inherited from class org.opensourcephysics.cabrillo.tracker.Step
dispose, erase, erase, getDefaultPoint, getFrameNumber, getPointIndex, getPoints, getTrack, remark, remark, repaint, repaint, setDefaultPointIndex, setHitRectCenter
-
Field Details
-
transform
-
endPoint1
-
endPoint2
-
middle
-
formatField
-
protractor
-
vertex
-
end1
-
end2
-
handle
protected org.opensourcephysics.cabrillo.tracker.ProtractorStep.Handle handle -
rotator
protected org.opensourcephysics.cabrillo.tracker.ProtractorStep.Rotator rotator -
line1Angle
protected double line1Angle -
line2Angle
protected double line2Angle -
endsEnabled
protected boolean endsEnabled -
drawArcCircle
protected boolean drawArcCircle -
drawLayoutBounds
protected boolean drawLayoutBounds -
drawLayout1
protected boolean drawLayout1 -
drawLayout2
protected boolean drawLayout2 -
drawLayoutAngle
protected boolean drawLayoutAngle -
vertexCircle
protected org.opensourcephysics.cabrillo.tracker.MultiShape vertexCircle -
panelVertexShapes
-
panelEnd1Shapes
-
panelEnd2Shapes
-
panelLine1Shapes
-
panelLine2Shapes
-
panelRotatorShapes
-
panelTextLayouts
-
panelLayoutBounds
-
panelTextLayouts1
-
panelLayout1Bounds
-
panelTextLayouts2
-
panelLayout2Bounds
-
selectedShape
-
-
Constructor Details
-
ProtractorStep
Constructs a ProtractorStep 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
-
setEndsEnabled
public void setEndsEnabled(boolean enabled) Enables and disables the interactivity of the ends.- Parameters:
enabled
-true
to enable the ends
-
isEndsEnabled
public boolean isEndsEnabled()Gets whether the ends are enabled.- Returns:
true
if the ends are enabled
-
setFootprint
Overrides Step setFootprint method.- Overrides:
setFootprint
in classStep
- Parameters:
footprint
- the footprint
-
findInteractive
Overrides Step findInteractive method.- Overrides:
findInteractive
in 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. -
getMark
Overrides Step getMark method. -
getFormattedLength
Formats the specified length value.- Parameters:
length
- the length value to format- Returns:
- the formatted length string
-
getProtractorAngle
public double getProtractorAngle(boolean refreshField) Gets the protractor angle.- Parameters:
refreshField
- true to refresh the protractor angleField- Returns:
- the angle in radians
-
setProtractorAngle
public void setProtractorAngle(double theta) Sets the protractor angle of this tape.- Parameters:
theta
- the angle in radians
-
getArmLength
Gets the world length of the base or arm.- Parameters:
end
- TPoint end1 or end2- Returns:
- the length in world units
-
setArmLength
Sets the arm length of this tape.- Parameters:
end
- the arm endlength
- the desired length in world units
-
moveVertexTo
protected void moveVertexTo(double x, double y) Moves the protractor so the vertex is at the specified position.- Parameters:
x
-y
-
-
clone
Clones this Step. -
toString
Returns a String describing this. -
n
public int n()Returns the frame number.- Returns:
- the frame number
-
getLength
public static int getLength()Gets the step length.- Returns:
- the length of the points array
-