org.geotoolkit.geometry
Class GeneralDirectPosition

Object
  extended by AbstractDirectPosition
      extended by AbstractDirectPosition
          extended by GeneralDirectPosition
All Implemented Interfaces:
Serializable, Cloneable, Position, DirectPosition
Direct Known Subclasses:
TransformedDirectPosition

Deprecated. Moved to Apache SIS as GeneralDirectPosition.

@Deprecated
public class GeneralDirectPosition
extends AbstractDirectPosition
implements Serializable, Cloneable

Holds the coordinates for a position within some coordinate reference system. Since DirectPositions, as data types, will often be included in larger objects (such as geometries) that have references to CoordinateReferenceSystem, the getCoordinateReferenceSystem() method may returns null if this particular DirectPosition is included in such larger object. In this case, the coordinate reference system is implicitly assumed to take on the value of the containing object's CoordinateReferenceSystem.

This particular implementation of DirectPosition is said "General" because it uses an array of ordinates of an arbitrary length. If the direct position is know to be always two-dimensional, then DirectPosition2D may provides a more efficient implementation.

Most methods in this implementation are final for performance reason.

Since:
1.2
Version:
3.16
Author:
Martin Desruisseaux (IRD, Geomatys)
See Also:
DirectPosition1D, DirectPosition2D, Point2D, Serialized Form
Module:
referencing/geotk-referencing (download)    View source code for this class

Field Summary
 double[] ordinates
          Deprecated. The ordinates of the direct position.
 
Constructor Summary
GeneralDirectPosition(CoordinateReferenceSystem crs)
          Deprecated. Constructs a position using the specified coordinate reference system.
GeneralDirectPosition(DirectPosition point)
          Deprecated. Constructs a position initialized to the same values than the specified point.
GeneralDirectPosition(double... ordinates)
          Deprecated. Constructs a position with the specified ordinates.
GeneralDirectPosition(int numDim)
          Deprecated. Constructs a position with the specified number of dimensions.
GeneralDirectPosition(Point2D point)
          Deprecated. Constructs a position from the specified Point2D.
GeneralDirectPosition(String wkt)
          Deprecated. Constructs a position initialized to the values parsed from the given string in Well Known Text (WKT) format.
 
Method Summary
 GeneralDirectPosition clone()
          Deprecated. Returns a deep copy of this position.
 double[] getCoordinate()
          Deprecated. Returns a sequence of numbers that hold the coordinate of this position in its reference system.
 CoordinateReferenceSystem getCoordinateReferenceSystem()
          Deprecated. Returns the coordinate reference system in which the coordinate is given.
 int getDimension()
          Deprecated. The length of coordinate sequence (the number of entries).
 double getOrdinate(int dimension)
          Deprecated. Returns the ordinate at the specified dimension.
 int hashCode()
          Deprecated. Returns a hash value for this coordinate.
 void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
          Deprecated. Sets the coordinate reference system in which the coordinate is given.
 void setLocation(DirectPosition position)
          Deprecated. Sets this coordinate to the specified direct position.
 void setLocation(double... ordinates)
          Deprecated. Sets the ordinate values along all dimensions.
 void setLocation(GeneralDirectPosition position)
          Deprecated. Sets this coordinate to the specified direct position.
 void setLocation(Point2D point)
          Deprecated. Sets this coordinate to the specified Point2D.
 void setOrdinate(int dimension, double value)
          Deprecated. Sets the ordinate value along the specified dimension.
 Point2D toPoint2D()
          Deprecated. Returns a Point2D with the same coordinate as this direct position.
 
Methods inherited from class AbstractDirectPosition
toString
 
Methods inherited from class AbstractDirectPosition
equals, getDirectPosition, normalize, toString
 
Methods inherited from class Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ordinates

public final double[] ordinates
Deprecated. 
The ordinates of the direct position. The length of this array is the dimension of this direct position.

Constructor Detail

GeneralDirectPosition

public GeneralDirectPosition(CoordinateReferenceSystem crs)
Deprecated. 
Constructs a position using the specified coordinate reference system. The number of dimensions is inferred from the coordinate reference system.

Parameters:
crs - The coordinate reference system to be given to this position.
Since:
2.2

GeneralDirectPosition

public GeneralDirectPosition(int numDim)
                      throws NegativeArraySizeException
Deprecated. 
Constructs a position with the specified number of dimensions.

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

GeneralDirectPosition

public GeneralDirectPosition(double... ordinates)
Deprecated. 
Constructs a position with the specified ordinates. The ordinates array will be copied.

Parameters:
ordinates - The ordinate values to copy.

GeneralDirectPosition

public GeneralDirectPosition(Point2D point)
Deprecated. 
Constructs a position from the specified Point2D. Despite their name, the (x,y) ordinates don't need to be oriented toward (East, North). See the DirectPosition2D javadoc for details.

Parameters:
point - The position to copy.

GeneralDirectPosition

public GeneralDirectPosition(DirectPosition point)
Deprecated. 
Constructs a position initialized to the same values than the specified point.

Parameters:
point - The position to copy.
Since:
2.2

GeneralDirectPosition

public GeneralDirectPosition(String wkt)
                      throws NumberFormatException,
                             IllegalArgumentException
Deprecated. 
Constructs a position initialized to the values parsed from the given string in Well Known Text (WKT) format. The given string is typically a POINT element like below:
POINT(6 10)
However this constructor is lenient to other types like POINT ZM.

Parameters:
wkt - The POINT or other kind of element to parse.
Throws:
NumberFormatException - If a number can not be parsed.
IllegalArgumentException - If the parenthesis are not balanced.
Since:
3.09
See Also:
AbstractDirectPosition.toString(DirectPosition), CoordinateFormat
Method Detail

getCoordinateReferenceSystem

public final CoordinateReferenceSystem getCoordinateReferenceSystem()
Deprecated. 
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 CRS.

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

setCoordinateReferenceSystem

public void setCoordinateReferenceSystem(CoordinateReferenceSystem crs)
                                  throws MismatchedDimensionException
Deprecated. 
Sets the coordinate reference system in which the coordinate is given.

Parameters:
crs - The new coordinate reference system, or null.
Throws:
MismatchedDimensionException - if the specified CRS doesn't have the expected number of dimensions.

getDimension

public final int getDimension()
Deprecated. 
The length of coordinate sequence (the number of entries). This may be less than or equal to the dimensionality of the coordinate reference system.

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

getCoordinate

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

Specified by:
getCoordinate in interface DirectPosition
Overrides:
getCoordinate in class AbstractDirectPosition
Returns:
A copy of the coordinates.

getOrdinate

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

Specified by:
getOrdinate in interface DirectPosition
Parameters:
dimension - The dimension in the range 0 to dimension-1.
Returns:
The coordinate at the specified dimension.
Throws:
IndexOutOfBoundsException - if the specified dimension is out of bounds.

setOrdinate

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

Specified by:
setOrdinate in interface DirectPosition
Parameters:
dimension - the dimension for the ordinate of interest.
value - the ordinate value of interest.
Throws:
IndexOutOfBoundsException - if the specified dimension is out of bounds.

setLocation

public final void setLocation(double... ordinates)
                       throws MismatchedDimensionException
Deprecated. 
Sets the ordinate values along all dimensions.

Parameters:
ordinates - The new ordinates values. or a null array for setting all ordinate values to NaN.
Throws:
MismatchedDimensionException - If the length of the specified array is not equals to the dimension of this position.
Since:
3.16

setLocation

public final void setLocation(DirectPosition position)
                       throws MismatchedDimensionException
Deprecated. 
Sets 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.

Overrides:
setLocation in class AbstractDirectPosition
Parameters:
position - The new position for this point, or null for setting all ordinate values to NaN.
Throws:
MismatchedDimensionException - if the given position doesn't have the expected dimension.
Since:
2.2

setLocation

public final void setLocation(GeneralDirectPosition position)
                       throws MismatchedDimensionException
Deprecated. 
Sets this coordinate to the specified direct position. This method is identical to setLocation(DirectPosition), but is slightly faster in the special case of an GeneralDirectPosition implementation.

Parameters:
position - The new position for this point, or null for setting all ordinate values to NaN.
Throws:
MismatchedDimensionException - if the given position doesn't have the expected dimension.

setLocation

public final void setLocation(Point2D point)
                       throws MismatchedDimensionException
Deprecated. 
Sets this coordinate to the specified Point2D. This coordinate must be two-dimensional.

Parameters:
point - The new coordinate for this point.
Throws:
MismatchedDimensionException - if this coordinate point is not two-dimensional.

toPoint2D

public Point2D toPoint2D()
                  throws IllegalStateException
Deprecated. 
Returns a Point2D with the same coordinate as this direct position. This is a convenience method for inter-operability with Java2D.

Returns:
This position as a two-dimensional point.
Throws:
IllegalStateException - if this coordinate point is not two-dimensional.

hashCode

public int hashCode()
Deprecated. 
Returns a hash value for this coordinate.

Specified by:
hashCode in interface DirectPosition
Overrides:
hashCode in class AbstractDirectPosition

clone

public GeneralDirectPosition clone()
Deprecated. 
Returns a deep copy of this position.

Overrides:
clone in class Object
Returns:
A copy of this object.
See Also:
Object.clone()


Copyright © 2009-2013 Geotoolkit.org. All Rights Reserved.