vmm.ode
Class OrbitPoints2D

java.lang.Object
  extended by vmm.ode.OrbitPoints2D

public class OrbitPoints2D
extends java.lang.Object

This 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
static int DOTS
          A constant for selecting whether the points should be drawn as individual dots or should be connectined by lines.
static int LINES
          A constant for selecting whether the points should be drawn as individual dots or should be connectined by lines.
 
Constructor Summary
OrbitPoints2D()
           
 
Method Summary
 boolean addNow(View view, java.awt.geom.Point2D pt)
          Adds a point to the list, and show the new point in the specified view.
 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.
 void addPoint(java.awt.geom.Point2D pt)
          Adds a specified point to the end of the list.
 void addPoints(java.awt.geom.Point2D[] pts)
          Adds all the points from an array to the curve by calling addPoint(Point2D) for each element in the array.
 void clear()
          Removes all points from the list.
 void draw(java.awt.Graphics2D g, View view, Transform transform)
          Draws the entire list of points.
 void drawPoint(View view, int index)
          Draws the point at the specified index, with a connecting line to the preceding point if appropriate.
 java.awt.Color getColor()
          Get the color that will be used to draw the points.
 double getDotDiameter()
          Returns the diameter of the dots that are used to draw points, when the draw style is DOTS.
 java.awt.geom.Point2D getPoint(int i)
          Gets the i-th point from the list.
 int getPointCount()
          Returns the number of points currently in the list.
 int getStyle()
          Get the style used to draw the points, either OrbitPoint2D.LINES or OrbitPoint2D.DOTS.
 void setColor(java.awt.Color color)
          Set the color that will be used to draw the points.
 void setDotDiameter(double dotDiameter)
          Sets diameter of the dots that are used to draw points, when the draw style is DOTS.
 void setStyle(int style)
          Set the style used to draw the points, either OrbitPoint2D.LINES or OrbitPoint2D.DOTS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

OrbitPoints2D

public OrbitPoints2D()
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 is DOTS.

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 is DOTS. 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 calling addPoint(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.


draw

public void draw(java.awt.Graphics2D g,
                 View view,
                 Transform transform)
Draws the entire list of points.