| java.lang.Object org.geotools.geometry.AbstractDirectPosition org.geotools.geometry.GeneralDirectPosition
All known Subclasses: org.geotools.geometry.TransformedDirectPosition,
GeneralDirectPosition | public class GeneralDirectPosition extends AbstractDirectPosition implements Serializable,Cloneable(Code) | | Holds the coordinates for a position within some coordinate reference system. Since
DirectPosition s, as data types, will often be included in larger objects
(such as
) that have references
to
CoordinateReferenceSystem , the
GeneralDirectPosition.getCoordinateReferenceSystem method
may returns
null if this particular
DirectPosition is included
in a larger object with such a reference to a
. In this case, the cordinate 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
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: 2.0 version: $Id: GeneralDirectPosition.java 26137 2007-07-03 17:59:44Z desruisseaux $ author: Martin Desruisseaux See Also: DirectPosition1D See Also: DirectPosition2D See Also: java.awt.geom.Point2D |
Field Summary | |
final public double[] | ordinates The ordinates of the direct position. |
Method Summary | |
public Object | clone() Returns a deep copy of this position. | final public CoordinateReferenceSystem | getCoordinateReferenceSystem() Returns the coordinate reference system in which the coordinate is given. | final public double[] | getCoordinates() Returns a sequence of numbers that hold the coordinate of this position in its
reference system. | final public int | getDimension() The length of coordinate sequence (the number of entries). | final public double | getOrdinate(int dimension) Returns the ordinate at the specified dimension.
Parameters: dimension - The dimension in the range 0 to -1. | public int | hashCode() Returns a hash value for this coordinate. | static int | hashCode(double[] ordinates) Returns a hash value for the specified ordinates. | public void | setCoordinateReferenceSystem(CoordinateReferenceSystem crs) Set the coordinate reference system in which the coordinate is given. | final public void | setLocation(DirectPosition position) Set this coordinate to the specified direct position. | final public void | setLocation(GeneralDirectPosition position) Set this coordinate to the specified direct position. | final public void | setLocation(Point2D point) Set this coordinate to the specified
Point2D . | final public void | setOrdinate(int dimension, double value) Sets the ordinate value along the specified dimension. | public Point2D | toPoint2D() Returns a
Point2D with the same coordinate as this direct position. | public static String | toString(DirectPosition position) Formats the specified position. |
ordinates | final public double[] ordinates(Code) | | The ordinates of the direct position.
|
GeneralDirectPosition | public GeneralDirectPosition(CoordinateReferenceSystem crs)(Code) | | Constructs a position using the specified coordinate reference system.
The number of dimensions is inferred from the coordinate reference system.
since: 2.2 |
GeneralDirectPosition | public GeneralDirectPosition(double[] ordinates)(Code) | | Constructs a position with the specified ordinates.
The
ordinates array will be copied.
|
GeneralDirectPosition | public GeneralDirectPosition(double x, double y)(Code) | | Constructs a 2D position from the specified ordinates. Despite their name, the
(x,y) coordinates don't need to be oriented toward
(
,
).
See the
DirectPosition2D javadoc for details.
|
GeneralDirectPosition | public GeneralDirectPosition(double x, double y, double z)(Code) | | Constructs a 3D position from the specified ordinates. Despite their name, the
(x,y,z) coordinates don't need to be oriented toward
(
,
,
).
|
GeneralDirectPosition | public GeneralDirectPosition(Point2D point)(Code) | | Constructs a position from the specified
Point2D .
|
GeneralDirectPosition | public GeneralDirectPosition(DirectPosition point)(Code) | | Constructs a position initialized to the same values than the specified point.
since: 2.2 |
clone | public Object clone()(Code) | | Returns a deep copy of this position.
|
getCoordinateReferenceSystem | final public CoordinateReferenceSystem getCoordinateReferenceSystem()(Code) | | 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
.
The coordinate reference system, or null . |
getCoordinates | final public double[] getCoordinates()(Code) | | Returns a sequence of numbers that hold the coordinate of this position in its
reference system.
A copy of the . |
getDimension | final public int getDimension()(Code) | | The length of coordinate sequence (the number of entries).
This may be less than or equal to the dimensionality of the
.
The dimensionality of this position. |
getOrdinate | final public double getOrdinate(int dimension) throws IndexOutOfBoundsException(Code) | | Returns the ordinate at the specified dimension.
Parameters: dimension - The dimension in the range 0 to -1. The coordinate at the specified dimension. throws: IndexOutOfBoundsException - if the specified dimension is out of bounds. |
hashCode | public int hashCode()(Code) | | Returns a hash value for this coordinate.
|
hashCode | static int hashCode(double[] ordinates)(Code) | | Returns a hash value for the specified ordinates.
|
setCoordinateReferenceSystem | public void setCoordinateReferenceSystem(CoordinateReferenceSystem crs) throws MismatchedDimensionException(Code) | | Set 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 expectednumber of dimensions. |
setLocation | final public void setLocation(DirectPosition position) throws MismatchedDimensionException(Code) | | Set this coordinate to the specified direct position. If the specified position
contains a
,
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. since: 2.2 |
setLocation | final public void setLocation(GeneralDirectPosition position) throws MismatchedDimensionException(Code) | | Set this coordinate to the specified direct position. This method is identical to
GeneralDirectPosition.setLocation(DirectPosition) , but is slightly faster in the special case
of an
GeneralDirectPosition implementation.
Parameters: position - The new position for this point. throws: MismatchedDimensionException - if this point doesn't have the expected dimension. |
setLocation | final public void setLocation(Point2D point) throws MismatchedDimensionException(Code) | | Set 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. |
setOrdinate | final public void setOrdinate(int dimension, double value) throws IndexOutOfBoundsException(Code) | | Sets the ordinate value along the specified dimension.
Parameters: dimension - the dimension for the ordinate of interest. Parameters: value - the ordinate value of interest. throws: IndexOutOfBoundsException - if the specified dimension is out of bounds. |
|
|