Package org.opensourcephysics.display
Class Trail
java.lang.Object
org.opensourcephysics.display.AbstractTrail
org.opensourcephysics.display.Trail
- All Implemented Interfaces:
Drawable,LogMeasurable,Measurable
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
FieldsFields inherited from class org.opensourcephysics.display.AbstractTrail
closed, color, drawingStroke, enableMeasure, numpts, xmax, xmaxLogscale, xmin, xminLogscale, ymax, ymaxLogscale, ymin, yminLogscale -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPoint(double x, double y) Adds a point to the trail.voidclear()Clears all points from the trail.voidCloses the path by connecting the first point to the last point.voiddraw(DrawingPanel panel, Graphics g) Draws the trail on the panel.static XML.ObjectLoaderReturns the XML.ObjectLoader for this class.booleanGets the connected flag.voidmoveToPoint(double x, double y) Starts a new trail segment by moving to a new point without drawing.voidsetConnected(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, setStrokeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensourcephysics.display.Drawable
isInteractiveMethods inherited from interface org.opensourcephysics.display.LogMeasurable
getXMaxLogscale, getXMinLogscale, getYMaxLogscale, getYMinLogscaleMethods inherited from interface org.opensourcephysics.display.Measurable
getXMax, getXMin, getYMax, getYMin, isMeasured
-
Field Details
-
generalPath
-
-
Constructor Details
-
Trail
public Trail()
-
-
Method Details
-
addPoint
public void addPoint(double x, double y) Adds a point to the trail.- Specified by:
addPointin classAbstractTrail- Parameters:
x- doubley- double
-
moveToPoint
public void moveToPoint(double x, double y) Starts a new trail segment by moving to a new point without drawing.- Parameters:
x- doubley- 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:
closeTrailin classAbstractTrail
-
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:
clearin classAbstractTrail
-
draw
Draws the trail on the panel. -
getLoader
Returns the XML.ObjectLoader for this class.- Returns:
- the object loader
-