Class ProtractorFootprint

java.lang.Object
org.opensourcephysics.cabrillo.tracker.ProtractorFootprint
All Implemented Interfaces:
Cloneable, Footprint

public class ProtractorFootprint extends Object implements Footprint, Cloneable
A ProtractorFootprint returns a pair of lines that meet at a vertex at one end and have a specified end shape at the other. This requires a Point array of length 3.
Author:
Douglas Brown
  • Field Details

    • DOTTED_LINE

      public static final float[] DOTTED_LINE
    • STIPPLED_LINE

      public static final float[] STIPPLED_LINE
    • arcRadius

      protected static int arcRadius
    • name

      protected String name
    • baseStroke

      protected BasicStroke baseStroke
    • stroke

      protected BasicStroke stroke
    • color

      protected Color color
    • hitShapes

      protected Shape[] hitShapes
    • circle

      protected Shape circle
    • radius

      protected int radius
  • Constructor Details

    • ProtractorFootprint

      public ProtractorFootprint(String name, int r)
      Constructs a ProtractorFootprint.
      Parameters:
      name - the name
      r - the radius
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Footprint
      Gets the name of the footprint.
      Specified by:
      getName in interface Footprint
      Returns:
      the name
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: Footprint
      Gets the display name of the footprint.
      Specified by:
      getDisplayName in interface Footprint
      Returns:
      the name
    • getLength

      public int getLength()
      Description copied from interface: Footprint
      Gets the point array length required by this footprint.
      Specified by:
      getLength in interface Footprint
      Returns:
      the length
    • getIcon

      public ResizableIcon getIcon(int w, int h)
      Description copied from interface: Footprint
      Gets an icon representing the footprint.
      Specified by:
      getIcon in interface Footprint
      Parameters:
      w - width of the icon
      h - height of the icon
      Returns:
      the icon
    • getMark

      public Mark getMark(Point[] points)
      Description copied from interface: Footprint
      Gets the footprint mark.
      Specified by:
      getMark in interface Footprint
      Parameters:
      points - a Point array
      Returns:
      the mark
    • getHitShapes

      public Shape[] getHitShapes()
      Description copied from interface: Footprint
      Gets the hit shapes associated with the footprint.
      Specified by:
      getHitShapes in interface Footprint
      Returns:
      an array of hit shapes
    • setStroke

      public void setStroke(BasicStroke stroke)
      Description copied from interface: Footprint
      Sets the stroke. Accepts only basic strokes.
      Specified by:
      setStroke in interface Footprint
      Parameters:
      stroke - the desired stroke
    • getStroke

      public BasicStroke getStroke()
      Description copied from interface: Footprint
      Gets the stroke.
      Specified by:
      getStroke in interface Footprint
      Returns:
      the basic stroke
    • setColor

      public void setColor(Color color)
      Description copied from interface: Footprint
      Sets the color.
      Specified by:
      setColor in interface Footprint
      Parameters:
      color - the desired color
    • getColor

      public Color getColor()
      Description copied from interface: Footprint
      Gets the color.
      Specified by:
      getColor in interface Footprint
      Returns:
      the color
    • setArcVisible

      public void setArcVisible(boolean vis)
    • getCircleShape

      public org.opensourcephysics.cabrillo.tracker.MultiShape getCircleShape(Point p)
      Gets a circle shape.
      Parameters:
      p - the desired screen point of the circle
      Returns:
      the circle shape
    • getArcAdjustShape

      public org.opensourcephysics.cabrillo.tracker.MultiShape getArcAdjustShape(Point vertex, Point rotator)
      Gets an arcAdjust shape.
      Parameters:
      vertex - the screen point of the vertex
      rotator - the screen point of the rotator
      Returns:
      the arc-adjusting shape
    • getShape

      public org.opensourcephysics.cabrillo.tracker.MultiShape getShape(Point[] points, int scale)
      Gets the shape of this footprint for a Point array {vertex, end1, end2}. Also sets up hit shapes {vertex, end1, end2, line1, line2, rotator}
      Specified by:
      getShape in interface Footprint
      Parameters:
      points - an array of Points
      scale - an integer magnification
      Returns:
      the shape
    • getFootprint

      public static Footprint getFootprint(String name)
      Gets a predefined Footprint.
      Parameters:
      name - the name of the footprint
      Returns:
      the footprint