org.opensourcephysics.display
Class Trail

java.lang.Object
  extended byorg.opensourcephysics.display.Trail
All Implemented Interfaces:
Drawable, Measurable

public class Trail
extends java.lang.Object
implements Drawable, Measurable

Title: Trail Description: A trail of pixels on the screen. This object is often used to show the path of a moving object.


Field Summary
 java.awt.Color color
           
 
Constructor Summary
Trail()
           
 
Method Summary
 void addPoint(double x, double y)
          Adds a point to the trail.
 void clear()
          Clears all points from the trail.
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draw the trail on the panel.
static XML.ObjectLoader getLoader()
          Returns the XML.ObjectLoader for this class.
 double getXMax()
          Gets the maximum x value in the trail.
 double getXMin()
          Gets the minimum x value in the trail.
 double getYMax()
          Gets the maximum y value in the trail.
 double getYMin()
          Gets the minimum y value in the trail.
 boolean isConnected()
          Gets the connected flag.
 boolean isMeasured()
          Determines if this trail scales the drawing panel.
 void moveToPoint(double x, double y)
          Starts a new trail segment by moving to a new point without drawing.
 void setConnected(boolean connected)
          Sets the connectd flag.
 void setMeasured(boolean _enableMeasure)
          Enables the measured flag so that this circle effects the scale of a drawing panel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

color

public java.awt.Color color
Constructor Detail

Trail

public Trail()
Method Detail

addPoint

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

Parameters:
x - double
y - double

moveToPoint

public void moveToPoint(double x,
                        double y)
Starts a new trail segment by moving to a new point without drawing.

Parameters:
x - double
y - double

setConnected

public void setConnected(boolean connected)
Sets the connectd flag. Successive points are connetected by straight lines. Each point is marked as a colored pixel if the trail is not connected.

Parameters:
connected - boolean

isConnected

public boolean isConnected()
Gets the connected flag.


clear

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


draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draw the trail on the panel.

Specified by:
draw in interface Drawable
Parameters:
g -
panel -

getLoader

public static XML.ObjectLoader getLoader()
Returns the XML.ObjectLoader for this class.

Returns:
the object loader

setMeasured

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

Returns:
minimum

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