org.geotoolkit.geometry
Class DirectPosition2D

Object
  extended by Point2D
      extended by Point2D.Double
          extended by DirectPosition2D
              extended by DirectPosition2D
All Implemented Interfaces:
Serializable, Cloneable, Position, DirectPosition

Deprecated. Moved to Apache SIS as DirectPosition2D.

@Deprecated
public class DirectPosition2D
extends DirectPosition2D
implements Cloneable

Holds the coordinates for a two-dimensional position within some coordinate reference system. This class inherits x and y fields. But despite their names, they don't need to be oriented toward East and North. The (x,y) axis can have any orientation and should be understood as "ordinate 0" and "ordinate 1" values instead. This is not specific to this implementation; in Java2D too, the visual axis orientation depend on the affine transform in the graphics context.

The rational for avoiding axis orientation restriction is that other DirectPosition implementation do not have such restriction, and it would be hard to generalize. For example there is no clear "x" or "y" classification for North-East direction.


Caution when used in collections
Do not mix instances of this class with ordinary Point2D instances in a HashSet or as HashMap keys. It is not possible to meet both Point2D.hashCode() and DirectPosition.hashCode() contract, and this class chooses to implements the later. Consequently, DirectPosition2D.hashCode() is inconsistent with Point2D.equals(java.lang.Object) but is consistent with DirectPosition.equals(java.lang.Object).

In other words, it is safe to add instances of DirectPosition2D in a HashSet<DirectPosition>, but it is unsafe to add them in a HashSet<Point2D>. Collections that do not rely on Object.hashCode(), like ArrayList, are safe in all cases.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class Point2D
Point2D.Double, Point2D.Float
 
Field Summary
 
Fields inherited from class Point2D.Double
x, y
 
Constructor Summary
DirectPosition2D()
          Deprecated. Constructs a position initialized to (0,0) with a null coordinate reference system.
DirectPosition2D(CoordinateReferenceSystem crs)
          Deprecated. Constructs a position with the specified coordinate reference system.
DirectPosition2D(CoordinateReferenceSystem crs, double x, double y)
          Deprecated. Constructs a 2D position from the specified ordinates in the specified CRS.
DirectPosition2D(DirectPosition point)
          Deprecated. Constructs a position initialized to the same values than the specified point.
DirectPosition2D(double x, double y)
          Deprecated. Constructs a 2D position from the specified ordinates.
DirectPosition2D(Point2D point)
          Deprecated. Constructs a position from the specified Point2D.
DirectPosition2D(String wkt)
          Deprecated. Constructs a position initialized to the values parsed from the given string in Well Known Text (WKT) format.
 
Method Summary
 void setLocation(DirectPosition position)
          Deprecated. Sets this coordinate to the specified direct position.
 Point2D toPoint2D()
          Deprecated. Returns a Point2D with the same coordinate as this direct position.
 
Methods inherited from class DirectPosition2D
clone, equals, getCoordinate, getCoordinateReferenceSystem, getDimension, getDirectPosition, getOrdinate, hashCode, setCoordinateReferenceSystem, setLocation, setOrdinate, toString
 
Methods inherited from class Point2D.Double
getX, getY, setLocation
 
Methods inherited from class Point2D
distance, distance, distance, distanceSq, distanceSq, distanceSq
 
Methods inherited from class Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Cloneable
clone
 

Constructor Detail

DirectPosition2D

public DirectPosition2D()
Deprecated. 
Constructs a position initialized to (0,0) with a null coordinate reference system.


DirectPosition2D

public DirectPosition2D(CoordinateReferenceSystem crs)
Deprecated. 
Constructs a position with the specified coordinate reference system.

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

DirectPosition2D

public DirectPosition2D(double x,
                        double y)
Deprecated. 
Constructs a 2D position from the specified ordinates. Despite their name, the (x,y) coordinates don't need to be oriented toward (East, North). Those parameter names simply match the x and y fields. See the class javadoc for details.

Parameters:
x - The x value.
y - The y value.

DirectPosition2D

public DirectPosition2D(CoordinateReferenceSystem crs,
                        double x,
                        double y)
Deprecated. 
Constructs a 2D position from the specified ordinates in the specified CRS. Despite their name, the (x,y) coordinates don't need to be oriented toward (East, North). Those parameter names simply match the x and y fields. The actual axis orientations are determined by the specified CRS. See the class javadoc for details.

Parameters:
crs - The coordinate reference system, or null.
x - The x value.
y - The y value.

DirectPosition2D

public DirectPosition2D(Point2D point)
Deprecated. 
Constructs a position from the specified Point2D.

Parameters:
point - The point to copy.

DirectPosition2D

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

Parameters:
point - The point to copy.
Throws:
MismatchedDimensionException - if this point doesn't have the expected dimension.

DirectPosition2D

public DirectPosition2D(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)

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.
MismatchedDimensionException - If the given point is not two-dimensional.
Since:
3.09
See Also:
AbstractDirectPosition.toString(DirectPosition), CoordinateFormat
Method Detail

setLocation

public 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.

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

toPoint2D

public Point2D toPoint2D()
Deprecated. 
Returns a Point2D with the same coordinate as this direct position.

Returns:
This position as a point.


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