org.deegree_impl.model.pt
Class CoordinatePoint

java.lang.Object
  extended byorg.deegree_impl.model.pt.CoordinatePoint
All Implemented Interfaces:
java.lang.Cloneable, Dimensioned, java.io.Serializable

public class CoordinatePoint
extends java.lang.Object
implements Dimensioned, java.lang.Cloneable, java.io.Serializable

A position defined by a list of numbers. The ordinate values are indexed from 0 to (numDim-1), where numDim is the dimension of the coordinate system the coordinate point belongs in.

Version:
1.00
Author:
OpenGIS (www.opengis.org), Martin Desruisseaux
See Also:
PT_CoordinatePoint, Point2D, Serialized Form

Field Summary
 double[] ord
          The ordinates of the coordinate point.
private static long serialVersionUID
          Serial number for interoperability with different versions.
 
Constructor Summary
CoordinatePoint(double[] ord)
          Construct a coordinate with the specified ordinates.
CoordinatePoint(double x, double y)
          Construct a 2D coordinate from the specified ordinates.
CoordinatePoint(double x, double y, double z)
          Construct a 3D coordinate from the specified ordinates.
CoordinatePoint(int numDim)
          Construct a coordinate with the specified number of dimensions.
CoordinatePoint(java.awt.geom.Point2D point)
          Construct a coordinate from the specified Point2D.
 
Method Summary
 java.lang.Object clone()
          Returns a deep copy of this coordinate.
(package private)  void ensureDimensionMatch(int expectedDimension)
          Convenience method for checking the point's dimension validity.
 boolean equals(java.lang.Object object)
          Compares the specified object with this coordinate for equality.
 int getDimension()
          The number of ordinates of a CoordinatePoint.
 double getOrdinate(int dimension)
          Returns the ordinate value along the specified dimension.
 int hashCode()
          Returns a hash value for this coordinate.
(package private) static int hashCode(double[] ord)
          Returns a hash value for the specified ordinates.
 java.awt.geom.Point2D toPoint2D()
          Returns a Point2D with the same coordinate as this CoordinatePoint.
 java.lang.String toString()
          Returns a string representation of this coordinate.
(package private) static java.lang.String toString(java.lang.Object owner, double[] ord)
          Returns a string representation of an object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial number for interoperability with different versions.

See Also:
Constant Field Values

ord

public final double[] ord
The ordinates of the coordinate point.

See Also:
PT_CoordinatePoint.ord
Constructor Detail

CoordinatePoint

public CoordinatePoint(int numDim)
                throws java.lang.NegativeArraySizeException
Construct a coordinate with the specified number of dimensions.

Parameters:
numDim - Number of dimensions.
Throws:
java.lang.NegativeArraySizeException - if numDim is negative.

CoordinatePoint

public CoordinatePoint(double[] ord)
Construct a coordinate with the specified ordinates. The ord array will be copied.


CoordinatePoint

public CoordinatePoint(double x,
                       double y)
Construct a 2D coordinate from the specified ordinates.


CoordinatePoint

public CoordinatePoint(double x,
                       double y,
                       double z)
Construct a 3D coordinate from the specified ordinates.


CoordinatePoint

public CoordinatePoint(java.awt.geom.Point2D point)
Construct a coordinate from the specified Point2D.

Method Detail

getOrdinate

public final double getOrdinate(int dimension)
Returns the ordinate value along the specified dimension. This is equivalent to ord[dimension].


getDimension

public final int getDimension()
The number of ordinates of a CoordinatePoint. This is equivalent to ord.length.

Specified by:
getDimension in interface Dimensioned

ensureDimensionMatch

final void ensureDimensionMatch(int expectedDimension)
                         throws MismatchedDimensionException
Convenience method for checking the point's dimension validity. This method is usually call for argument checking.

Parameters:
expectedDimension - Expected dimension for this point.
Throws:
MismatchedDimensionException - if this point doesn't have the expected dimension.

toPoint2D

public java.awt.geom.Point2D toPoint2D()
                                throws java.lang.IllegalStateException
Returns a Point2D with the same coordinate as this CoordinatePoint. This is a convenience method for interoperability with Java2D.

Throws:
java.lang.IllegalStateException - if this coordinate point is not two-dimensional.

hashCode

public int hashCode()
Returns a hash value for this coordinate. This value need not remain consistent between different implementations of the same class.


hashCode

static int hashCode(double[] ord)
Returns a hash value for the specified ordinates.


equals

public boolean equals(java.lang.Object object)
Compares the specified object with this coordinate for equality.


clone

public java.lang.Object clone()
Returns a deep copy of this coordinate.


toString

public java.lang.String toString()
Returns a string representation of this coordinate. The returned string is implementation dependent. It is usually provided for debugging purposes.


toString

static java.lang.String toString(java.lang.Object owner,
                                 double[] ord)
Returns a string representation of an object. The returned string is implementation dependent. It is usually provided for debugging purposes.