deegree 2.1 (2007/11/08 09:57 build-328-official)

org.deegree.model.csct.pt
Class CoordinatePoint

java.lang.Object
  extended by org.deegree.model.csct.pt.CoordinatePoint
All Implemented Interfaces:
Serializable, Cloneable, Dimensioned

public class CoordinatePoint
extends Object
implements Dimensioned, Cloneable, 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:
Point2D, Serialized Form

Field Summary
 double[] ord
          The ordinates of the coordinate point.
 
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(Point2D point)
          Construct a coordinate from the specified Point2D.
 
Method Summary
 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(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.
 Point2D toPoint2D()
          Returns a Point2D with the same coordinate as this CoordinatePoint.
 String toString()
          Returns a string representation of this coordinate.
(package private) static String toString(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

ord

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

Constructor Detail

CoordinatePoint

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

Parameters:
numDim - Number of dimensions.
Throws:
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(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 Point2D toPoint2D()
                  throws IllegalStateException
Returns a Point2D with the same coordinate as this CoordinatePoint. This is a convenience method for interoperability with Java2D.

Throws:
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.

Overrides:
hashCode in class Object

hashCode

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


equals

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

Overrides:
equals in class Object

clone

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

Overrides:
clone in class Object

toString

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

Overrides:
toString in class Object

toString

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


deegree 2.1 (2007/11/08 09:57 build-328-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://deegree.sourceforge.net