|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.geometry.iso.io.wkt.Coordinate
public class Coordinate
A lightweight class used to store coordinates on the 2-dimensional Cartesian
plane. It is distinct from Point
, which is a subclass of
Geometry
. Unlike objects of type Point
(which
contain additional information such as an envelope, a precision model, and
spatial reference system information), a Coordinate
only
contains ordinate values and accessor methods.
Coordinate
s are two-dimensional points, with an additional
z-ordinate. JTS does not support any operations on the z-ordinate except the
basic accessor functions. Constructed coordinates will have a z-ordinate of
NaN
. The standard comparison functions will ignore the
z-ordinate.
Nested Class Summary | |
---|---|
static class |
Coordinate.DimensionalComparator
Compares two Coordinate s, allowing for either a 2-dimensional or
3-dimensional comparison, and handling NaN values correctly. |
Field Summary | |
---|---|
double |
x
The x-coordinate. |
double |
y
The y-coordinate. |
double |
z
The z-coordinate. |
Constructor Summary | |
---|---|
Coordinate()
Constructs a Coordinate at (0,0,NaN). |
|
Coordinate(Coordinate c)
Constructs a Coordinate having the same (x,y,z) values as
other . |
|
Coordinate(double[] coords)
SJ |
|
Coordinate(double x,
double y)
Constructs a Coordinate at (x,y,NaN). |
|
Coordinate(double x,
double y,
double z)
Constructs a Coordinate at (x,y,z). |
Method Summary | |
---|---|
java.lang.Object |
clone()
|
int |
compareTo(java.lang.Object o)
Compares this Coordinate with the specified Coordinate
for order. |
double |
distance(Coordinate p)
|
boolean |
equals(java.lang.Object other)
Returns true if other has the same values
for the x and y ordinates. |
boolean |
equals2D(Coordinate other)
Returns whether the planar projections of the two Coordinate s
are equal. |
boolean |
equals3D(Coordinate other)
Returns true if other has the same values
for x, y and z. |
double[] |
getCoordinates()
SJ |
int |
hashCode()
|
static int |
hashCode(double x)
Returns a hash code for a double value, using the algorithm from Joshua Bloch's book Effective Java" |
void |
setCoordinate(Coordinate other)
Sets this Coordinate s (x,y,z) values to that of
other . |
java.lang.String |
toString()
Returns a String of the form (x,y,z) . |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public double x
public double y
public double z
Constructor Detail |
---|
public Coordinate(double x, double y, double z)
Coordinate
at (x,y,z).
x
- the x-valuey
- the y-valuez
- the z-valuepublic Coordinate(double[] coords)
coords
- public Coordinate()
Coordinate
at (0,0,NaN).
public Coordinate(Coordinate c)
Coordinate
having the same (x,y,z) values as
other
.
c
- the Coordinate
to copy.public Coordinate(double x, double y)
Coordinate
at (x,y,NaN).
x
- the x-valuey
- the y-valueMethod Detail |
---|
public void setCoordinate(Coordinate other)
Coordinate
s (x,y,z) values to that of
other
.
other
- the Coordinate
to copypublic boolean equals2D(Coordinate other)
Coordinate
s
are equal.
other
- a Coordinate
with which to do the 2D
comparison.
true
if the x- and y-coordinates are equal; the
z-coordinates do not have to be equal.public boolean equals(java.lang.Object other)
true
if other
has the same values
for the x and y ordinates. Since Coordinates are 2.5D, this routine
ignores the z value when making the comparison.
equals
in class java.lang.Object
other
- a Coordinate
with which to do the comparison.
true
if other
is a
Coordinate
with the same values for the x and y
ordinates.public int compareTo(java.lang.Object o)
Coordinate
with the specified Coordinate
for order. This method ignores the z value when making the comparison.
Returns:
compareTo
in interface java.lang.Comparable
o
- the Coordinate
with which this
Coordinate
is being compared
Coordinate
is less than,
equal to, or greater than the specified Coordinate
public boolean equals3D(Coordinate other)
true
if other
has the same values
for x, y and z.
other
- a Coordinate
with which to do the 3D
comparison.
true
if other
is a
Coordinate
with the same values for x, y and z.public java.lang.String toString()
String
of the form (x,y,z) .
toString
in class java.lang.Object
String
of the form (x,y,z)public java.lang.Object clone()
clone
in class java.lang.Object
public double distance(Coordinate p)
public int hashCode()
hashCode
in class java.lang.Object
public static int hashCode(double x)
public double[] getCoordinates()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |