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 boolean
protected Stroke
protected boolean
protected int
protected double
protected double
protected double
protected double
protected double
protected double
protected double
protected double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
addPoint
(double x, double y) Adds a point to the trail.abstract void
clear()
Clears all points from the trail.abstract void
Closes the path by connecting the first point to the last point.int
Gets the number of points stored in the trail.Gets the drawing stroke.double
getXMax()
Gets the maximum x value in the trail.double
Gets the maximum x needed to draw this object on a log scale.double
getXMin()
Gets the minimum x value in the trail.double
Gets the minimum x needed to draw this object on a log scale.double
getYMax()
Gets the maximum y value in the trail.double
Gets the maximum y needed to draw this object on a log scale on a log scale.double
getYMin()
Gets the minimum y value in the trail.double
Gets the minimum y needed to draw this object on a log scale.boolean
Determines if this trail scales the drawing panel.void
setDashedStroke
(int dashPoint, int dashLength) Sets the the dash line stroke.void
setMeasured
(boolean _enableMeasure) Enables the measured flag so that this circle effects the scale of a drawing panel.void
Sets the drawing stroke.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
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:
isMeasured
in interfaceMeasurable
- Returns:
- boolean
-
getXMin
public double getXMin()Gets the minimum x value in the trail.- Specified by:
getXMin
in interfaceMeasurable
- Returns:
- double
-
getXMax
public double getXMax()Gets the maximum x value in the trail.- Specified by:
getXMax
in interfaceMeasurable
- Returns:
- double
-
getYMin
public double getYMin()Gets the minimum y value in the trail.- Specified by:
getYMin
in interfaceMeasurable
- Returns:
- double
-
getYMax
public double getYMax()Gets the maximum y value in the trail.- Specified by:
getYMax
in 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
-