org.opensourcephysics.cabrillo.tracker
Class ProtractorStep

java.lang.Object
  extended by org.opensourcephysics.cabrillo.tracker.Step
      extended by org.opensourcephysics.cabrillo.tracker.ProtractorStep
All Implemented Interfaces:
java.lang.Cloneable

public class ProtractorStep
extends Step

This is a Step for a Protractor. It is used for measuring angles.

Author:
Douglas Brown

Field Summary
protected  java.awt.Shape arcHighlight
           
protected  boolean drawLayout1
           
protected  boolean drawLayout2
           
protected  boolean drawLayoutBounds
           
protected  TPoint end1
           
protected  java.util.Map<TrackerPanel,java.awt.Shape> end1Shapes
           
protected  TPoint end2
           
protected  java.util.Map<TrackerPanel,java.awt.Shape> end2Shapes
           
protected static TPoint endPoint1
           
protected static TPoint endPoint2
           
protected  boolean endsEnabled
           
protected static java.awt.Font font
           
protected  org.opensourcephysics.cabrillo.tracker.ProtractorStep.Handle handle
           
protected  java.util.Map<TrackerPanel,java.awt.Rectangle> layout1Bounds
           
protected  java.util.Map<TrackerPanel,java.awt.Rectangle> layout2Bounds
           
protected  java.util.Map<TrackerPanel,java.awt.Rectangle> layoutBounds
           
protected  NumberField lengthField
           
protected  double line1Angle
           
protected  java.util.Map<TrackerPanel,java.awt.Shape> line1Shapes
           
protected  double line2Angle
           
protected  java.util.Map<TrackerPanel,java.awt.Shape> line2Shapes
           
protected static TPoint middle
           
protected  Protractor protractor
           
protected  org.opensourcephysics.cabrillo.tracker.ProtractorStep.Rotator rotator
           
protected  java.util.Map<TrackerPanel,java.awt.Shape> rotatorShapes
           
protected  java.awt.Shape selectedShape
           
protected  java.util.Map<TrackerPanel,java.awt.font.TextLayout> textLayouts
           
protected  java.util.Map<TrackerPanel,java.awt.font.TextLayout> textLayouts1
           
protected  java.util.Map<TrackerPanel,java.awt.font.TextLayout> textLayouts2
           
protected static java.awt.geom.AffineTransform transform
           
protected  TPoint vertex
           
protected  java.awt.Shape vertexCircle
           
protected  java.util.Map<TrackerPanel,java.awt.Shape> vertexShapes
           
 
Fields inherited from class org.opensourcephysics.cabrillo.tracker.Step
dataVisible, defaultIndex, footprint, format, frc, hitRect, marks, n, points, screenPoints, selectionShape, track, valid
 
Constructor Summary
ProtractorStep(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
 java.lang.Object clone()
          Clones this Step.
 void draw(DrawingPanel panel, java.awt.Graphics _g)
          Overrides Step draw method.
 Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
          Overrides Step findInteractive method.
 double getArmLength(TPoint end)
          Gets the world length of arm 1.
 java.awt.Rectangle getBounds(TrackerPanel trackerPanel)
          Overrides Step getBounds method.
 java.lang.String getFormattedLength(double length)
          Formats the specified length value.
static int getLength()
          Gets the step length.
protected  Mark getMark(TrackerPanel trackerPanel)
          Overrides Step getMark method.
 double getProtractorAngle()
          Gets the protractor angle.
 boolean isEndsEnabled()
          Gets whether the ends are enabled.
 int n()
          Returns the frame number.
 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.
 java.lang.String toString()
          Returns a String describing this.
 
Methods inherited from class org.opensourcephysics.cabrillo.tracker.Step
erase, erase, getDefaultPoint, getFrameNumber, getPointIndex, getPoints, getTrack, remark, remark, repaint, repaint, setDefaultPointIndex, setHitRectCenter
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

transform

protected static java.awt.geom.AffineTransform transform

font

protected static java.awt.Font font

endPoint1

protected static TPoint endPoint1

endPoint2

protected static TPoint endPoint2

middle

protected static TPoint middle

protractor

protected Protractor protractor

vertex

protected TPoint vertex

end1

protected TPoint end1

end2

protected TPoint 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

drawLayoutBounds

protected boolean drawLayoutBounds

drawLayout1

protected boolean drawLayout1

drawLayout2

protected boolean drawLayout2

vertexCircle

protected java.awt.Shape vertexCircle

arcHighlight

protected java.awt.Shape arcHighlight

vertexShapes

protected java.util.Map<TrackerPanel,java.awt.Shape> vertexShapes

end1Shapes

protected java.util.Map<TrackerPanel,java.awt.Shape> end1Shapes

end2Shapes

protected java.util.Map<TrackerPanel,java.awt.Shape> end2Shapes

line1Shapes

protected java.util.Map<TrackerPanel,java.awt.Shape> line1Shapes

line2Shapes

protected java.util.Map<TrackerPanel,java.awt.Shape> line2Shapes

rotatorShapes

protected java.util.Map<TrackerPanel,java.awt.Shape> rotatorShapes

textLayouts

protected java.util.Map<TrackerPanel,java.awt.font.TextLayout> textLayouts

layoutBounds

protected java.util.Map<TrackerPanel,java.awt.Rectangle> layoutBounds

textLayouts1

protected java.util.Map<TrackerPanel,java.awt.font.TextLayout> textLayouts1

layout1Bounds

protected java.util.Map<TrackerPanel,java.awt.Rectangle> layout1Bounds

textLayouts2

protected java.util.Map<TrackerPanel,java.awt.font.TextLayout> textLayouts2

layout2Bounds

protected java.util.Map<TrackerPanel,java.awt.Rectangle> layout2Bounds

selectedShape

protected java.awt.Shape selectedShape

lengthField

protected NumberField lengthField
Constructor Detail

ProtractorStep

public ProtractorStep(Protractor track,
                      int n,
                      double x1,
                      double y1,
                      double x2,
                      double y2)
Constructs a ProtractorStep with specified end point coordinates in image space.

Parameters:
track - the track
n - the frame number
x1 - the x coordinate of end 1
y1 - the y coordinate of end 1
x2 - the x coordinate of end 2
y2 - the y coordinate of end 2
Method Detail

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

public void setFootprint(Footprint footprint)
Overrides Step setFootprint method.

Overrides:
setFootprint in class Step
Parameters:
footprint - the footprint

findInteractive

public Interactive findInteractive(DrawingPanel panel,
                                   int xpix,
                                   int ypix)
Overrides Step findInteractive method.

Overrides:
findInteractive in class Step
Parameters:
panel - the drawing panel
xpix - the x pixel position
ypix - the y pixel position
Returns:
the Interactive that is hit, or null

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics _g)
Overrides Step draw method.

Overrides:
draw in class Step
Parameters:
panel - the drawing panel requesting the drawing
_g - the graphics context on which to draw

getMark

protected Mark getMark(TrackerPanel trackerPanel)
Overrides Step getMark method.

Overrides:
getMark in class Step
Parameters:
trackerPanel - the tracker panel
Returns:
the mark

getFormattedLength

public java.lang.String getFormattedLength(double length)
Formats the specified length value.

Parameters:
length - the length value to format
Returns:
the formatted length string

getBounds

public java.awt.Rectangle getBounds(TrackerPanel trackerPanel)
Overrides Step getBounds method.

Overrides:
getBounds in class Step
Parameters:
trackerPanel - the tracker panel drawing the step
Returns:
the bounding rectangle

getProtractorAngle

public double getProtractorAngle()
Gets the protractor angle.

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

public double getArmLength(TPoint end)
Gets the world length of arm 1.

Parameters:
end - TPoint end1 or end2
Returns:
the length in world units

clone

public java.lang.Object clone()
Clones this Step.

Overrides:
clone in class Step
Returns:
a clone of this step

toString

public java.lang.String toString()
Returns a String describing this.

Overrides:
toString in class Step
Returns:
a descriptive string

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