org.opensourcephysics.display
Class AbstractTrail

java.lang.Object
  extended by org.opensourcephysics.display.AbstractTrail
All Implemented Interfaces:
Drawable, Measurable
Direct Known Subclasses:
Trail, TrailBezier

public abstract class AbstractTrail
extends java.lang.Object
implements Drawable, Measurable

AbstractTrail defines a trail of pixels on the screen. This object is often used to show the path of a moving object.

Version:
1.0
Author:
Wolfgang Christian

Field Summary
protected  boolean closed
           
 java.awt.Color color
           
protected  java.awt.Stroke drawingStroke
           
protected  boolean enableMeasure
           
protected  int numpts
           
protected  double xmax
           
protected  double xmaxLogscale
           
protected  double xmin
           
protected  double xminLogscale
           
protected  double ymax
           
protected  double ymaxLogscale
           
protected  double ymin
           
protected  double yminLogscale
           
 
Constructor Summary
AbstractTrail()
           
 
Method Summary
abstract  void addPoint(double x, double y)
          Adds a point to the trail.
abstract  void clear()
          Clears all points from the trail.
abstract  void closeTrail()
          Closes the path by connecting the first point to the last point.
 int getNumberOfPoints()
          Gets the number of points stored in the trail.
 java.awt.Stroke getStroke()
          Gets the drawing stroke.
 double getXMax()
          Gets the maximum x value in the trail.
 double getXMaxLogscale()
          Gets the maximum x needed to draw this object on a log scale.
 double getXMin()
          Gets the minimum x value in the trail.
 double getXMinLogscale()
          Gets the minimum x needed to draw this object on a log scale.
 double getYMax()
          Gets the maximum y value in the trail.
 double getYMaxLogscale()
          Gets the maximum y needed to draw this object on a log scale on a log scale.
 double getYMin()
          Gets the minimum y value in the trail.
 double getYMinLogscale()
          Gets the minimum y needed to draw this object on a log scale.
 boolean isMeasured()
          Determines if this trail scales the drawing panel.
 void setDashedStroke(int dashPoint, int dashLength)
          Sets the the dash line stroke.
 void setMeasured(boolean _enableMeasure)
          Enables the measured flag so that this circle effects the scale of a drawing panel.
 void setStroke(java.awt.Stroke stroke)
          Sets the drawing stroke.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.display.Drawable
draw
 

Field Detail

color

public java.awt.Color color

enableMeasure

protected boolean enableMeasure

xmin

protected double xmin

xmax

protected double xmax

ymin

protected double ymin

ymax

protected double ymax

xmaxLogscale

protected double xmaxLogscale

ymaxLogscale

protected double ymaxLogscale

xminLogscale

protected double xminLogscale

yminLogscale

protected double yminLogscale

numpts

protected int numpts

closed

protected boolean closed

drawingStroke

protected java.awt.Stroke drawingStroke
Constructor Detail

AbstractTrail

public AbstractTrail()
Method Detail

addPoint

public abstract void addPoint(double x,
                              double y)
Adds a point to the trail.

Parameters:
x - double
y - double

closeTrail

public abstract void closeTrail()
Closes the path by connecting the first point to the last point. Points cannot be added to a closed path;


clear

public abstract void clear()
Clears all points from the trail.


setStroke

public void setStroke(java.awt.Stroke stroke)
Sets the drawing stroke.

Parameters:
stroke - Stroke

setDashedStroke

public void setDashedStroke(int dashPoint,
                            int dashLength)
Sets the the dash line stroke.

Parameters:
int - dashPoint
int - dashLength

getStroke

public java.awt.Stroke getStroke()
Gets the drawing stroke.

Returns:
Stroke

getNumberOfPoints

public int getNumberOfPoints()
Gets the number of points stored in the trail.

Returns:
int

setMeasured

public void setMeasured(boolean _enableMeasure)
Enables the measured flag so that this circle effects the scale of a drawing panel.


isMeasured

public boolean isMeasured()
Determines if this trail scales the drawing panel.

Specified by:
isMeasured in interface Measurable
Returns:
boolean

getXMin

public double getXMin()
Gets the minimum x value in the trail.

Specified by:
getXMin in interface Measurable
Returns:
double

getXMax

public double getXMax()
Gets the maximum x value in the trail.

Specified by:
getXMax in interface Measurable
Returns:
double

getYMin

public double getYMin()
Gets the minimum y value in the trail.

Specified by:
getYMin in interface Measurable
Returns:
double

getYMax

public double getYMax()
Gets the maximum y value in the trail.

Specified by:
getYMax in interface Measurable
Returns:
double

getXMinLogscale

public double getXMinLogscale()
Gets the minimum x needed to draw this object on a log scale.

Returns:
minimum

getXMaxLogscale

public double getXMaxLogscale()
Gets the maximum x needed to draw this object on a log scale.

Returns:
maximum

getYMinLogscale

public double getYMinLogscale()
Gets the minimum y needed to draw this object on a log scale.

Returns:
minimum

getYMaxLogscale

public double getYMaxLogscale()
Gets the maximum y needed to draw this object on a log scale on a log scale.

Returns:
maximum