vmm3d.ode
Class OrbitPoints2D
- java.lang.Object
-
- vmm3d.ode.OrbitPoints2D
-
public class OrbitPoints2D extends java.lang.ObjectThis class really just represents a list of points that can be drawn as dots or a connected sequence of line segments. It is possible to add points and have those points show up in a View without redrawing the entire contents of the View. (The new points are just added to the existing bitmap in the View.) This class is meant for storing the points on the soltion curve of an ODE in two dimensions.
-
-
Field Summary
Fields Modifier and Type Field and Description static intDOTSA constant for selecting whether the points should be drawn as individual dots or should be connectined by lines.static intLINESA constant for selecting whether the points should be drawn as individual dots or should be connectined by lines.
-
Constructor Summary
Constructors Constructor and Description OrbitPoints2D()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanaddNow(View view, java.awt.geom.Point2D pt)Adds a point to the list, and show the new point in the specified view.booleanaddNow(View view, java.awt.geom.Point2D[] pts)Adds an array full of specified points to the list, and shows them in the specfied view.voidaddPoint(java.awt.geom.Point2D pt)Adds a specified point to the end of the list.voidaddPoints(java.awt.geom.Point2D[] pts)Adds all the points from an array to the curve by callingaddPoint(Point2D)for each element in the array.voidclear()Removes all points from the list.voiddraw(org.freehep.graphics2d.VectorGraphics g, View view, Transform transform)Draws the entire list of points.voiddrawPoint(View view, int index)Draws the point at the specified index, with a connecting line to the preceding point if appropriate.java.awt.ColorgetColor()Get the color that will be used to draw the points.doublegetDotDiameter()Returns the diameter of the dots that are used to draw points, when the draw style isDOTS.java.awt.geom.Point2DgetPoint(int i)Gets the i-th point from the list.intgetPointCount()Returns the number of points currently in the list.intgetStyle()Get the style used to draw the points, either OrbitPoint2D.LINES or OrbitPoint2D.DOTS.voidsetColor(java.awt.Color color)Set the color that will be used to draw the points.voidsetDotDiameter(double dotDiameter)Sets diameter of the dots that are used to draw points, when the draw style isDOTS.voidsetStyle(int style)Set the style used to draw the points, either OrbitPoint2D.LINES or OrbitPoint2D.DOTS.
-
-
-
Field Detail
-
LINES
public static final int LINES
A constant for selecting whether the points should be drawn as individual dots or should be connectined by lines.- See Also:
- Constant Field Values
-
DOTS
public static final int DOTS
A constant for selecting whether the points should be drawn as individual dots or should be connectined by lines.- See Also:
- Constant Field Values
-
-
Method Detail
-
getPointCount
public int getPointCount()
Returns the number of points currently in the list.
-
getPoint
public java.awt.geom.Point2D getPoint(int i)
Gets the i-th point from the list. Points are numbered 0, 1, 2, ..., getPointCount() - 1. An error will occur if i is outside this range.
-
getColor
public java.awt.Color getColor()
Get the color that will be used to draw the points. A null value indicates that the current drawing color will be used.
-
setColor
public void setColor(java.awt.Color color)
Set the color that will be used to draw the points. A null value indicates that the current drawing color will be used.
-
getStyle
public int getStyle()
Get the style used to draw the points, either OrbitPoint2D.LINES or OrbitPoint2D.DOTS.
-
setStyle
public void setStyle(int style)
Set the style used to draw the points, either OrbitPoint2D.LINES or OrbitPoint2D.DOTS. Other values are ignored.
-
getDotDiameter
public double getDotDiameter()
Returns the diameter of the dots that are used to draw points, when the draw style isDOTS.- See Also:
setDotDiameter(double)
-
setDotDiameter
public void setDotDiameter(double dotDiameter)
Sets diameter of the dots that are used to draw points, when the draw style isDOTS. The diameter is specified in pixels. Values less than 1 are quitely changed to 1.
-
clear
public void clear()
Removes all points from the list. This method does NOT cause a redraw.
-
addPoint
public void addPoint(java.awt.geom.Point2D pt)
Adds a specified point to the end of the list. This method does NOT cause a redraw. A class that uses this method should make sure that any View that contains the orbit is redrawn. NOTE: A null value will not cause an error. It will simply produce a break in the curve.- See Also:
addNow(View, Point2D)
-
addPoints
public void addPoints(java.awt.geom.Point2D[] pts)
Adds all the points from an array to the curve by callingaddPoint(Point2D)for each element in the array. The value of pts must be non-null. A class that uses this method should make sure that any View that contains the orbit is redrawn. NOTE: Null values IN THE ARRAY will not cause an error. They will simply produce breaks in the curve.- See Also:
addNow(View, Point2D[])
-
addNow
public boolean addNow(View view, java.awt.geom.Point2D pt)
Adds a point to the list, and show the new point in the specified view. It does NOT immediately appear in other views of the orbit; it will only appear when those views are redrawn. This method tries to add the point to the bitmap of the specified view, without redrawing the View; if this succeeds the return value of the method is true. However, if it fails, nothing is done, and the return value of the method is false -- uses of this class can use the return value to test whether the View needs to be redrawn.- Parameters:
view- The view where the point is to immediately appear. If this is null, the point is still added to the list, but no immediately visible changes are made.pt- The point to be added. A null value is not an error; it will just cause a gap in the curve.
-
addNow
public boolean addNow(View view, java.awt.geom.Point2D[] pts)
Adds an array full of specified points to the list, and shows them in the specfied view. If possible, the points will be added to the View's bitmap without redrawing the bitmap. ; if this succeeds the return value of the method is true. However, if it fails, nothing is done, and the return value of the method is false -- uses of this class can use the return value to test whether the View needs to be redrawn.- Parameters:
view- The view where the point is to immediately appear. If this is null, the point is still added to the list, but no immediately visible changes are made.pts- The points to be added. The value must be non-null. A null value in this array is not an error; it will just cause a gap in the curve.
-
drawPoint
public void drawPoint(View view, int index)
Draws the point at the specified index, with a connecting line to the preceding point if appropriate. An error occurs if the index is not in the range 0, 1, ..., getPointCount() - 1.
-
-
DMelt 3.0 © DataMelt by jWork.ORG