Package org.opensourcephysics.display
Class AbstractTrail
java.lang.Object
org.opensourcephysics.display.AbstractTrail
- All Implemented Interfaces:
Drawable,Measurable
- Direct Known Subclasses:
Trail,TrailBezier
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
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Strokeprotected booleanprotected intprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddPoint(double x, double y) Adds a point to the trail.abstract voidclear()Clears all points from the trail.abstract voidCloses the path by connecting the first point to the last point.intGets the number of points stored in the trail.Gets the drawing stroke.doublegetXMax()Gets the maximum x value in the trail.doubleGets the maximum x needed to draw this object on a log scale.doublegetXMin()Gets the minimum x value in the trail.doubleGets the minimum x needed to draw this object on a log scale.doublegetYMax()Gets the maximum y value in the trail.doubleGets the maximum y needed to draw this object on a log scale on a log scale.doublegetYMin()Gets the minimum y value in the trail.doubleGets the minimum y needed to draw this object on a log scale.booleanDetermines if this trail scales the drawing panel.voidsetDashedStroke(int dashPoint, int dashLength) Sets the the dash line stroke.voidsetMeasured(boolean _enableMeasure) Enables the measured flag so that this circle effects the scale of a drawing panel.voidSets the drawing stroke.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensourcephysics.display.Drawable
draw, isInteractive
-
Field Details
-
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
-
-
Constructor Details
-
AbstractTrail
public AbstractTrail()
-
-
Method Details
-
addPoint
public abstract void addPoint(double x, double y) Adds a point to the trail.- Parameters:
x- doubley- 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
Sets the drawing stroke.- Parameters:
stroke- Stroke
-
setDashedStroke
public void setDashedStroke(int dashPoint, int dashLength) Sets the the dash line stroke.- Parameters:
int- dashPointint- dashLength
-
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:
isMeasuredin interfaceMeasurable- Returns:
- boolean
-
getXMin
public double getXMin()Gets the minimum x value in the trail.- Specified by:
getXMinin interfaceMeasurable- Returns:
- double
-
getXMax
public double getXMax()Gets the maximum x value in the trail.- Specified by:
getXMaxin interfaceMeasurable- Returns:
- double
-
getYMin
public double getYMin()Gets the minimum y value in the trail.- Specified by:
getYMinin interfaceMeasurable- Returns:
- double
-
getYMax
public double getYMax()Gets the maximum y value in the trail.- Specified by:
getYMaxin interfaceMeasurable- 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
-