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 TypeMethodDescriptionvoid
addPoint
(double x, double y) Adds a point to the trail.void
clear()
Clears all points from the trail.void
Closes the path by connecting the first point to the last point.void
draw
(DrawingPanel panel, Graphics g) Draws the trail on the panel.static XML.ObjectLoader
Returns the XML.ObjectLoader for this class.boolean
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.Drawable
isInteractive
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
-
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:
addPoint
in 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:
closeTrail
in 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:
clear
in classAbstractTrail
-
draw
Draws the trail on the panel. -
getLoader
Returns the XML.ObjectLoader for this class.- Returns:
- the object loader
-