Class LineFootprint

java.lang.Object
org.opensourcephysics.cabrillo.tracker.LineFootprint
All Implemented Interfaces:
Cloneable, Footprint
Direct Known Subclasses:
ArrowFootprint, DoubleArrowFootprint, DoubleCrosshairFootprint, MultiLineFootprint, OutlineFootprint

public class LineFootprint extends Object implements Footprint, Cloneable
A LineFootprint returns a line shape for a Point array of length 2.
Author:
Douglas Brown
  • Field Details

    • hitLine

      protected static Line2D hitLine
    • name

      protected String name
    • highlight

      protected org.opensourcephysics.cabrillo.tracker.MultiShape highlight
    • transform

      protected AffineTransform transform
    • baseStroke

      protected BasicStroke baseStroke
    • stroke

      protected BasicStroke stroke
    • color

      protected Color color
    • path

      protected GeneralPath path
    • line

      protected Line2D line
    • hitShapes

      protected Shape[] hitShapes
    • rotatorStroke

      protected BasicStroke rotatorStroke
    • DASHED_LINE

      public static final float[] DASHED_LINE
    • DOTTED_LINE

      public static final float[] DOTTED_LINE
    • WIDE_DOTTED_LINE

      public static final float[] WIDE_DOTTED_LINE
  • Constructor Details

    • LineFootprint

      public LineFootprint(String name)
      Constructs a LineFootprint.
      Parameters:
      name - the name
  • Method Details

    • getFootprint

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

      protected static Footprint getFootprint(Collection<LineFootprint> footprints, String name)
    • getName

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

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

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

      public ResizableIcon getIcon(int w, int h)
      Gets the icon.
      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)
      Gets the footprint mark.
      Specified by:
      getMark in interface Footprint
      Parameters:
      points - a Point array
      Returns:
      the mark
    • getHitShapes

      public Shape[] getHitShapes()
      Gets the hit shapes. Shape[0] is for p0, Shape[1] for p1 and Shape[2] for the line
      Specified by:
      getHitShapes in interface Footprint
      Returns:
      the hit shapes
    • setStroke

      public void setStroke(BasicStroke stroke)
      Sets the stroke.
      Specified by:
      setStroke in interface Footprint
      Parameters:
      stroke - the desired stroke
    • getStroke

      public BasicStroke getStroke()
      Gets the stroke.
      Specified by:
      getStroke in interface Footprint
      Returns:
      the stroke
    • setDashArray

      public void setDashArray(float[] dashArray)
      Sets the dash array.
      Parameters:
      dashArray - the desired dash array
    • setLineWidth

      public void setLineWidth(double w)
      Sets the line width.
      Parameters:
      w - the desired line width
    • setColor

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

      public Color getColor()
      Gets the color.
      Specified by:
      getColor in interface Footprint
      Returns:
      the color
    • getShape

      public org.opensourcephysics.cabrillo.tracker.MultiShape getShape(Point[] points, int scale)
      Gets the shape of this footprint.
      Specified by:
      getShape in interface Footprint
      Parameters:
      points - an array of Points
      scale - an integer magnification
      Returns:
      the shape
    • getHighlightShape

      public org.opensourcephysics.cabrillo.tracker.MultiShape getHighlightShape()
      Gets the highlight shape of this footprint. This should be called immediately following getShape() as the highlight is created there.
      Returns:
      the shape
    • getRotatorShape

      public org.opensourcephysics.cabrillo.tracker.MultiShape getRotatorShape(Point center, Point anchor, Point rotator)
      Gets a rotator shape.
      Parameters:
      center - the screen point of line center
      anchor - the screen point of the anchor on the shaft
      rotator - the screen point of the rotator
      Returns:
      the rotator shape
    • checkStrokes

      protected void checkStrokes()