org.opensourcephysics.display
Class Trail

java.lang.Object
  extended by org.opensourcephysics.display.AbstractTrail
      extended by org.opensourcephysics.display.Trail
All Implemented Interfaces:
Drawable, LogMeasurable, Measurable

public class Trail
extends AbstractTrail
implements LogMeasurable

Title: Trail Description: 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
 
Fields inherited from class org.opensourcephysics.display.AbstractTrail
closed, color, drawingStroke, enableMeasure, numpts, xmax, xmaxLogscale, xmin, xminLogscale, ymax, ymaxLogscale, ymin, yminLogscale
 
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 closeTrail()
          Closes the path by connecting the first point to the last point.
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the trail on the panel.
static XML.ObjectLoader getLoader()
          Returns the XML.ObjectLoader for this class.
 boolean isConnected()
          Gets the connected flag.
 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.
 
Methods inherited from class org.opensourcephysics.display.AbstractTrail
getNumberOfPoints, getStroke, getXMax, getXMaxLogscale, getXMin, getXMinLogscale, getYMax, getYMaxLogscale, getYMin, getYMinLogscale, isMeasured, setDashedStroke, setMeasured, setStroke
 
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.LogMeasurable
getXMaxLogscale, getXMinLogscale, getYMaxLogscale, getYMinLogscale
 
Methods inherited from interface org.opensourcephysics.display.Measurable
getXMax, getXMin, getYMax, getYMin, isMeasured
 

Constructor Detail

Trail

public Trail()
Method Detail

addPoint

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

Specified by:
addPoint in class AbstractTrail
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

closeTrail

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

Specified by:
closeTrail in class AbstractTrail

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.

Parameters:
connected - boolean

clear

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

Specified by:
clear in class AbstractTrail

draw

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

Specified by:
draw in interface Drawable
Parameters:
g -

getLoader

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

Returns:
the object loader