org.opensourcephysics.cabrillo.tracker
Class ProtractorFootprint

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

public class ProtractorFootprint
extends java.lang.Object
implements Footprint, java.lang.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 Summary
protected static int arcRadius
           
protected  java.awt.Shape circle
           
protected  java.awt.Color color
           
static float[] DOTTED_LINE
           
protected  java.awt.Shape[] hitShapes
           
protected  java.lang.String name
           
protected  int radius
           
protected  java.awt.BasicStroke stroke
           
 
Constructor Summary
ProtractorFootprint(java.lang.String name, int r)
          Constructs a ProtractorFootprint.
 
Method Summary
 java.awt.Shape getArcAdjustShape(java.awt.Point vertex, java.awt.Point rotator)
          Gets an arcAdjust shape.
 java.awt.Shape getCircleShape(java.awt.Point p)
          Gets a circle shape.
 java.awt.Color getColor()
          Gets the color.
 java.lang.String getDisplayName()
          Gets the display name of the footprint.
static Footprint getFootprint(java.lang.String name)
          Gets a predefined Footprint.
 java.awt.Shape[] getHitShapes()
          Gets the hit shapes {vertex, end1, end2, line1, line2, rotator}.
 javax.swing.Icon getIcon(int w, int h)
          Gets the icon.
 int getLength()
          Gets the minimum point array length required by this footprint.
 Mark getMark(java.awt.Point[] points)
          Gets the footprint mark.
 java.lang.String getName()
          Gets the name of this footprint.
 java.awt.Shape getShape(java.awt.Point[] points)
          Gets the shape of this footprint for a Point array {vertex, end1, end2}.
 java.awt.BasicStroke getStroke()
          Gets the stroke.
 void setColor(java.awt.Color color)
          Sets the color.
 void setStroke(java.awt.BasicStroke stroke)
          Sets the stroke.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOTTED_LINE

public static final float[] DOTTED_LINE

arcRadius

protected static int arcRadius

name

protected java.lang.String name

stroke

protected java.awt.BasicStroke stroke

color

protected java.awt.Color color

hitShapes

protected java.awt.Shape[] hitShapes

circle

protected java.awt.Shape circle

radius

protected int radius
Constructor Detail

ProtractorFootprint

public ProtractorFootprint(java.lang.String name,
                           int r)
Constructs a ProtractorFootprint.

Parameters:
name - the name
r - the radius
Method Detail

getName

public java.lang.String getName()
Gets the name of this footprint.

Specified by:
getName in interface Footprint
Returns:
the name

getDisplayName

public java.lang.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 javax.swing.Icon 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(java.awt.Point[] points)
Gets the footprint mark.

Specified by:
getMark in interface Footprint
Parameters:
points - a Point array
Returns:
the mark

getHitShapes

public java.awt.Shape[] getHitShapes()
Gets the hit shapes {vertex, end1, end2, line1, line2, rotator}.

Specified by:
getHitShapes in interface Footprint
Returns:
the hit shapes

setStroke

public void setStroke(java.awt.BasicStroke stroke)
Sets the stroke.

Specified by:
setStroke in interface Footprint
Parameters:
stroke - the desired stroke

getStroke

public java.awt.BasicStroke getStroke()
Gets the stroke.

Specified by:
getStroke in interface Footprint
Returns:
the stroke

setColor

public void setColor(java.awt.Color color)
Sets the color.

Specified by:
setColor in interface Footprint
Parameters:
color - the desired color

getColor

public java.awt.Color getColor()
Gets the color.

Specified by:
getColor in interface Footprint
Returns:
the color

getCircleShape

public java.awt.Shape getCircleShape(java.awt.Point p)
Gets a circle shape.

Parameters:
p - the desired screen point of the circle
Returns:
the circle shape

getArcAdjustShape

public java.awt.Shape getArcAdjustShape(java.awt.Point vertex,
                                        java.awt.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 java.awt.Shape getShape(java.awt.Point[] points)
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
Returns:
the shape

getFootprint

public static Footprint getFootprint(java.lang.String name)
Gets a predefined Footprint.

Parameters:
name - the name of the footprint
Returns:
the footprint