Holds the coordinates for a two-dimensional position on top of {@link Point2D}. This implementation is provided for inter-operability between Java2D and GeoAPI.
This class inherits {@linkplain #x x} and {@linkplain #y y} fields.But despite their names, they don't need to be oriented toward {@linkplain AxisDirection#EAST East} and{@linkplain AxisDirection#NORTH North} respectively. The (x,y) axis can have anydirection 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 {@linkplain java.awt.Graphics2D#getTransform() affine transform in the graphics context}.
{@note The rational for avoiding axis orientation restriction is that other
DirectPosition
implementations 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.}{@section Caution when used in collections}Do not mix instances of this class with ordinary {@link Point2D} instancesin a {@code HashSet} or as {@code HashMap} keys.It is not possible to meet both {@link Point2D#hashCode()} and {@link DirectPosition#hashCode()}contracts, and this class chooses to implements the later. Consequently, the {@link #hashCode()}method of this class is inconsistent with {@link Point2D#equals(Object)} but is consistent with{@link DirectPosition#equals(Object)}.
In other words, it is safe to add instances of {@code DirectPosition2D} in a{@code HashSet}, but it is unsafe to add them in a {@code HashSet}. Collections that do not rely on hash codes, like {@code ArrayList}, are safe in all cases.
@author Martin Desruisseaux (IRD, Geomatys)
@since 0.3 (derived from geotk-2.0)
@version 0.3
@module
@see DirectPosition1D
@see GeneralDirectPosition
@see Point2D