com.quinncurtis.chart2djava
Class ChartPoint2D

java.lang.Object
  extended by java.awt.geom.Point2D
      extended by java.awt.geom.Point2D.Double
          extended by com.quinncurtis.chart2djava.ChartPoint2D
All Implemented Interfaces:
java.lang.Cloneable

public class ChartPoint2D
extends java.awt.geom.Point2D.Double

The ChartPoint2D class defines a point representing a location in (x,y) coordinate space. Extrapolated from the original Sun Point2D class.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.Point2D
java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Float
 
Field Summary
 
Fields inherited from class java.awt.geom.Point2D.Double
x, y
 
Constructor Summary
ChartPoint2D()
          Default constructor.
ChartPoint2D(ChartPoint2D p)
          Constructs and initializes a ChartPoint2D with the specified coordinates.
ChartPoint2D(double px, double py)
          Constructs and initializes a ChartPoint2D with the specified coordinates.
ChartPoint2D(java.util.GregorianCalendar px, double py)
          Constructs and initializes a ChartPoint2D with the specified coordinates.
ChartPoint2D(java.awt.geom.Point2D p)
          Constructs and initializes a ChartPoint2D with the specified coordinates.
 
Method Summary
 java.lang.Object clone()
          Creates a new object of the same class and with the same contents as this object.
 double distance(ChartPoint2D pt)
          Returns the distance from this ChartPoint2D to a specified ChartPoint2D.
 double distance(double PX, double PY)
          Returns the distance from this ChartPoint2D to a specified point.
static double distance(double X1, double Y1, double X2, double Y2)
          Returns the distance between two points.
 double distanceSq(ChartPoint2D pt)
          Returns the square of the distance between the specified point and the current point.
 double distanceSq(double PX, double PY)
          Returns the square of the distance between the specified point and the current point.
static double distanceSq(double X1, double Y1, double X2, double Y2)
          Returns the square of the distance between two points.
 java.util.GregorianCalendar getCalendarX()
          Returns the X coordinate of this ChartPoint2D.
 java.util.GregorianCalendar getDateTimeX()
          Returns the X coordinate of this ChartPoint2D.
 java.awt.Point getPoint()
          Returns a Point conversion of ChartPoint2D .
 java.awt.geom.Point2D.Float getPointF()
          Returns a PointF conversion of ChartPoint2D .
 void setLocation(ChartPoint2D p)
          Sets the location of this ChartPoint2D to the specified coordinates.
 void setLocation(java.util.GregorianCalendar px, double py)
          Initializes a ChartPoint2D with the specified coordinates.
 void setPoint(java.awt.Point p)
          Set the coordinates using a Point object .
 void setPointF(java.awt.geom.Point2D.Float p)
          Set the coordinates using a PointF object .
 void setX(double x)
          Sets the x-coordinate
 void setY(double y)
          Sets the x-coordinate
 
Methods inherited from class java.awt.geom.Point2D.Double
getX, getY, setLocation, toString
 
Methods inherited from class java.awt.geom.Point2D
distance, distanceSq, equals, hashCode, setLocation
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChartPoint2D

public ChartPoint2D()
Default constructor.


ChartPoint2D

public ChartPoint2D(ChartPoint2D p)
Constructs and initializes a ChartPoint2D with the specified coordinates.

Parameters:
p - the xy coordinates

ChartPoint2D

public ChartPoint2D(double px,
                    double py)
Constructs and initializes a ChartPoint2D with the specified coordinates.

Parameters:
px - the x-coordinate
py - the y-coordinate

ChartPoint2D

public ChartPoint2D(java.util.GregorianCalendar px,
                    double py)
Constructs and initializes a ChartPoint2D with the specified coordinates.

Parameters:
px - the x-coordinate
py - the y-coordinate

ChartPoint2D

public ChartPoint2D(java.awt.geom.Point2D p)
Constructs and initializes a ChartPoint2D with the specified coordinates.

Parameters:
p - the xy coordinates
Method Detail

clone

public java.lang.Object clone()
Creates a new object of the same class and with the same contents as this object.

Overrides:
clone in class java.awt.geom.Point2D
Returns:
a clone of this instance.

distance

public double distance(ChartPoint2D pt)
Returns the distance from this ChartPoint2D to a specified ChartPoint2D.

Parameters:
pt - the coordinates of the specified point
Returns:
the distance between this ChartPoint2D and the specified ChartPoint2D.

distance

public double distance(double PX,
                       double PY)
Returns the distance from this ChartPoint2D to a specified point.

Overrides:
distance in class java.awt.geom.Point2D
Parameters:
PX - the x-value of the specified point
PY - the y-value of the specified point
Returns:
the distance between this ChartPoint2D and a specified point.

distance

public static double distance(double X1,
                              double Y1,
                              double X2,
                              double Y2)
Returns the distance between two points.

Parameters:
X1 - the x-coordinate of the first point
Y1 - the y-coordinate of the first point
X2 - the x-coordinate of the second point
Y2 - the y-coordinate of the second point
Returns:
the distance between the two sets of specified coordinates.

distanceSq

public double distanceSq(ChartPoint2D pt)
Returns the square of the distance between the specified point and the current point.

Parameters:
pt - the coordinates of the specified point
Returns:
the square of the distance between the current point and the specified point.

distanceSq

public double distanceSq(double PX,
                         double PY)
Returns the square of the distance between the specified point and the current point.

Overrides:
distanceSq in class java.awt.geom.Point2D
Parameters:
PX - the x-value of the specified point
PY - the y-value of the specified point
Returns:
the square of the distance between the current point and the specified point.

distanceSq

public static double distanceSq(double X1,
                                double Y1,
                                double X2,
                                double Y2)
Returns the square of the distance between two points.

Parameters:
X1 - the x-coordinate of the first point
Y1 - the y-coordinate of the first point
X2 - the x-coordinate of the second point
Y2 - the y-coordinate of the second point
Returns:
the square of the distance between the two sets of specified coordinates.

getCalendarX

public java.util.GregorianCalendar getCalendarX()
Returns the X coordinate of this ChartPoint2D.

Returns:
the X coordinate of this ChartPoint2D.

getDateTimeX

public java.util.GregorianCalendar getDateTimeX()
Returns the X coordinate of this ChartPoint2D.

Returns:
the X coordinate of this ChartPoint2D.

getPoint

public java.awt.Point getPoint()
Returns a Point conversion of ChartPoint2D .

Returns:
Returns a Point conversion of ChartPoint2D .

getPointF

public java.awt.geom.Point2D.Float getPointF()
Returns a PointF conversion of ChartPoint2D .

Returns:
Returns a PointF conversion of ChartPoint2D .

setLocation

public void setLocation(ChartPoint2D p)
Sets the location of this ChartPoint2D to the specified coordinates.

Parameters:
p - the coordinate values

setLocation

public void setLocation(java.util.GregorianCalendar px,
                        double py)
Initializes a ChartPoint2D with the specified coordinates.

Parameters:
px - the x-coordinate
py - the y-coordinate

setPoint

public void setPoint(java.awt.Point p)
Set the coordinates using a Point object .

Parameters:
p - Set the coordinates using a Point object .

setPointF

public void setPointF(java.awt.geom.Point2D.Float p)
Set the coordinates using a PointF object .

Parameters:
p - Set the coordinates using a PointF object .

setX

public void setX(double x)
Sets the x-coordinate

Parameters:
x - Sets the x-coordinate.

setY

public void setY(double y)
Sets the x-coordinate

Parameters:
y - Sets the x-coordinate.