Class ProtractorStep

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

public class ProtractorStep extends Step
This is a Step for a Protractor. It is used for measuring angles.
Author:
Douglas Brown
  • Field Details

    • transform

      protected static AffineTransform transform
    • endPoint1

      protected static TPoint endPoint1
    • endPoint2

      protected static TPoint endPoint2
    • middle

      protected static TPoint middle
    • formatField

      protected static NumberField formatField
    • 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
    • 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

      protected Map<Integer,Shape> panelVertexShapes
    • panelEnd1Shapes

      protected Map<Integer,Shape> panelEnd1Shapes
    • panelEnd2Shapes

      protected Map<Integer,Shape> panelEnd2Shapes
    • panelLine1Shapes

      protected Map<Integer,Shape> panelLine1Shapes
    • panelLine2Shapes

      protected Map<Integer,Shape> panelLine2Shapes
    • panelRotatorShapes

      protected Map<Integer,Shape> panelRotatorShapes
    • panelTextLayouts

      protected Map<Integer,OSPRuntime.TextLayout> panelTextLayouts
    • panelLayoutBounds

      protected Map<Integer,Rectangle> panelLayoutBounds
    • panelTextLayouts1

      protected Map<Integer,OSPRuntime.TextLayout> panelTextLayouts1
    • panelLayout1Bounds

      protected Map<Integer,Rectangle> panelLayout1Bounds
    • panelTextLayouts2

      protected Map<Integer,OSPRuntime.TextLayout> panelTextLayouts2
    • panelLayout2Bounds

      protected Map<Integer,Rectangle> panelLayout2Bounds
    • selectedShape

      protected Shape selectedShape
  • Constructor Details

    • 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 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

      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, 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 String getFormattedLength(TPoint end)
      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

      public double getArmLength(TPoint end)
      Gets the world length of the base or arm.
      Parameters:
      end - TPoint end1 or end2
      Returns:
      the length in world units
    • setArmLength

      public void setArmLength(TPoint end, double length)
      Sets the arm length of this tape.
      Parameters:
      end - the arm end
      length - 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

      public Object clone()
      Clones this Step.
      Overrides:
      clone in class Step
      Returns:
      a clone of this step
    • toString

      public 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