org.geotools.geometry.jts.spatialschema.geometry
Class DirectPosition1D

java.lang.Object
  extended by org.geotools.geometry.jts.spatialschema.geometry.DirectPosition1D
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, org.opengis.geometry.coordinate.Position, org.opengis.geometry.DirectPosition

public class DirectPosition1D
extends java.lang.Object
implements org.opengis.geometry.DirectPosition, java.io.Serializable, java.lang.Cloneable

Holds the coordinates for a one-dimensional position within some coordinate reference system.

Version:
$Id: DirectPosition1D.java 34133 2009-10-12 08:14:05Z mbedward $
Author:
Martin Desruisseaux
See Also:
Serialized Form

Field Summary
 double ordinate
          The ordinate value.
 
Constructor Summary
DirectPosition1D()
          Construct a position initialized to (0) with a null coordinate reference system.
DirectPosition1D(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
          Construct a position with the specified coordinate reference system.
DirectPosition1D(org.opengis.geometry.DirectPosition point)
          Construct a position initialized to the same values than the specified point.
DirectPosition1D(double ordinate)
          Construct a 1D position from the specified ordinate.
 
Method Summary
 DirectPosition1D clone()
          Returns a copy of this position.
 double[] getCoordinate()
          Returns a sequence of numbers that hold the coordinate of this position in its reference system.
 org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
          Returns the coordinate reference system in which the coordinate is given.
 double[] getCoordinates()
          Deprecated. 
 int getDimension()
          The length of coordinate sequence (the number of entries).
 org.opengis.geometry.DirectPosition getDirectPosition()
          Returns always this, the direct position for this position.
 double getOrdinate(int dimension)
          Returns the ordinate at the specified dimension.
 org.opengis.geometry.DirectPosition getPosition()
          Deprecated. 
 int hashCode()
          Returns a hash value for this coordinate.
 void setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
          Set the coordinate reference system in which the coordinate is given.
 void setLocation(org.opengis.geometry.DirectPosition position)
          Set this coordinate to the specified direct position.
 void setOrdinate(int dimension, double value)
          Sets the ordinate value along the specified dimension.
 java.lang.String toString()
          Returns a string representation of this coordinate.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengis.geometry.DirectPosition
equals
 

Field Detail

ordinate

public double ordinate
The ordinate value.

Constructor Detail

DirectPosition1D

public DirectPosition1D()
Construct a position initialized to (0) with a null coordinate reference system.


DirectPosition1D

public DirectPosition1D(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Construct a position with the specified coordinate reference system.


DirectPosition1D

public DirectPosition1D(double ordinate)
Construct a 1D position from the specified ordinate.


DirectPosition1D

public DirectPosition1D(org.opengis.geometry.DirectPosition point)
Construct a position initialized to the same values than the specified point.

Method Detail

getPosition

@Deprecated
public org.opengis.geometry.DirectPosition getPosition()
Deprecated. 

Returns always this, the direct position for this position.

Specified by:
getPosition in interface org.opengis.geometry.coordinate.Position

getDirectPosition

public org.opengis.geometry.DirectPosition getDirectPosition()
Returns always this, the direct position for this position.

Specified by:
getDirectPosition in interface org.opengis.geometry.coordinate.Position

getCoordinateReferenceSystem

public final org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
Returns the coordinate reference system in which the coordinate is given. May be null if this particular DirectPosition is included in a larger object with such a reference to a coordinate reference system.

Specified by:
getCoordinateReferenceSystem in interface org.opengis.geometry.DirectPosition
Returns:
The coordinate reference system, or null.

setCoordinateReferenceSystem

public void setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Set the coordinate reference system in which the coordinate is given.

Parameters:
crs - The new coordinate reference system, or null.

getDimension

public final int getDimension()
The length of coordinate sequence (the number of entries). This is always 1 for DirectPosition1D objects.

Specified by:
getDimension in interface org.opengis.geometry.DirectPosition
Returns:
The dimensionality of this position.

getCoordinate

public double[] getCoordinate()
Returns a sequence of numbers that hold the coordinate of this position in its reference system.

Specified by:
getCoordinate in interface org.opengis.geometry.DirectPosition
Returns:
The coordinates

getCoordinates

@Deprecated
public double[] getCoordinates()
Deprecated. 

Specified by:
getCoordinates in interface org.opengis.geometry.DirectPosition

getOrdinate

public final double getOrdinate(int dimension)
                         throws java.lang.IndexOutOfBoundsException
Returns the ordinate at the specified dimension.

Specified by:
getOrdinate in interface org.opengis.geometry.DirectPosition
Parameters:
dimension - The dimension, which must be 0.
Returns:
The ordinate.
Throws:
java.lang.IndexOutOfBoundsException - if the specified dimension is out of bounds.

setOrdinate

public final void setOrdinate(int dimension,
                              double value)
                       throws java.lang.IndexOutOfBoundsException
Sets the ordinate value along the specified dimension.

Specified by:
setOrdinate in interface org.opengis.geometry.DirectPosition
Parameters:
dimension - The dimension, which must be 0.
value - the ordinate value.
Throws:
java.lang.IndexOutOfBoundsException - if the specified dimension is out of bounds.

setLocation

public void setLocation(org.opengis.geometry.DirectPosition position)
                 throws org.opengis.geometry.MismatchedDimensionException
Set this coordinate to the specified direct position. If the specified position contains a coordinate reference system, then the CRS for this position will be set to the CRS of the specified position.

Parameters:
position - The new position for this point.
Throws:
org.opengis.geometry.MismatchedDimensionException - if this point doesn't have the expected dimension.

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.

Overrides:
toString in class java.lang.Object

hashCode

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

Specified by:
hashCode in interface org.opengis.geometry.DirectPosition
Overrides:
hashCode in class java.lang.Object

clone

public DirectPosition1D clone()
Returns a copy of this position.

Overrides:
clone in class java.lang.Object


Copyright © 1996-2010 Geotools. All Rights Reserved.