org.opensourcephysics.cabrillo.tracker
Class LineFootprint

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

public class LineFootprint
extends java.lang.Object
implements Footprint, java.lang.Cloneable

A LineFootprint returns a line shape for a Point array of length 2.

Author:
Douglas Brown

Field Summary
protected  java.awt.Color color
           
static float[] DASHED_LINE
          A dashed line pattern
static float[] DOTTED_LINE
          A dotted line pattern
protected  java.awt.Shape highlight
           
protected static java.awt.Shape HIGHLIGHT
           
protected  java.awt.Shape[] hitShapes
           
protected  java.awt.geom.Line2D line
           
protected  java.lang.String name
           
protected  java.awt.geom.GeneralPath path
           
protected  java.awt.BasicStroke stroke
           
protected  java.awt.geom.AffineTransform transform
           
 
Constructor Summary
LineFootprint(java.lang.String name)
          Constructs a LineFootprint.
 
Method Summary
 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 LineFootprint.
 java.awt.Shape[] getHitShapes()
          Gets the hit shapes.
 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.
 java.awt.BasicStroke getStroke()
          Gets the stroke.
 void setColor(java.awt.Color color)
          Sets the color.
 void setDashArray(float[] dashArray)
          Sets the dash array.
 void setLineWidth(double w)
          Sets the line width.
 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

name

protected java.lang.String name

highlight

protected java.awt.Shape highlight

transform

protected java.awt.geom.AffineTransform transform

stroke

protected java.awt.BasicStroke stroke

color

protected java.awt.Color color

path

protected java.awt.geom.GeneralPath path

line

protected java.awt.geom.Line2D line

hitShapes

protected java.awt.Shape[] hitShapes

DASHED_LINE

public static final float[] DASHED_LINE
A dashed line pattern


DOTTED_LINE

public static final float[] DOTTED_LINE
A dotted line pattern


HIGHLIGHT

protected static final java.awt.Shape HIGHLIGHT
Constructor Detail

LineFootprint

public LineFootprint(java.lang.String name)
Constructs a LineFootprint.

Parameters:
name - the name
Method Detail

getFootprint

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

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

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. 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(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

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

getShape

public java.awt.Shape getShape(java.awt.Point[] points)
Gets the shape of this footprint.

Specified by:
getShape in interface Footprint
Parameters:
points - an array of Points
Returns:
the shape