public abstract class Point extends DefaultGeometry implements PointTypeGeometry
Modifier and Type | Class and Description |
---|---|
static class |
Point.Double
The
Double class defines a point specified in
double precision. |
static class |
Point.Float
The
Float class defines a point specified in float
precision. |
Modifier and Type | Field and Description |
---|---|
static int |
PRECISION_DOUBLE
A constant used to represent the precision of a double-precision floating point decimal.
|
static int |
PRECISION_FLOAT
A constant used to represent the precision of a single-precision floating point decimal.
|
GEOMETRY_ANNOTATION, GEOMETRY_COMPLEX, GEOMETRY_ELLIPSE, GEOMETRY_LINE, GEOMETRY_LINEAR_RING, GEOMETRY_LINESTRING, GEOMETRY_MULTI_ANNOTATION, GEOMETRY_MULTI_LINESTRING, GEOMETRY_MULTI_POINT, GEOMETRY_MULTI_POLYGON, GEOMETRY_POINT, GEOMETRY_POLYGON, GEOMETRY_RECTANGLE
Modifier | Constructor and Description |
---|---|
protected |
Point()
This is an abstract class that cannot be instantiated directly.
|
Modifier and Type | Method and Description |
---|---|
double |
area()
Returns the geometry area.
|
Geometry |
boundary()
Returns the boundary of this geometry as a line string.
|
abstract Point |
clone()
Clones this geometry.
|
void |
createBounds()
Updates the geometry bounds from the current geometry.
|
double |
distance(double PX,
double PY)
Returns the distance from this
Point to a specified point. |
static double |
distance(double X1,
double Y1,
double X2,
double Y2)
Returns the distance between two points.
|
double |
distance(Point pt)
Returns the distance from this
Point to a specified
Point . |
double |
distanceSq(double PX,
double PY)
Returns the square of the distance from this
Point to a
specified point. |
static double |
distanceSq(double X1,
double Y1,
double X2,
double Y2)
Returns the square of the distance between two points.
|
double |
distanceSq(Point pt)
Returns the square of the distance from this
Point to a
specified Point . |
boolean |
equals(java.lang.Object obj)
Determines whether or not two points are equal.
|
boolean |
equals(Point point) |
Point |
getCenteredPoint()
This method returns a point that is typically centered on the geometry.
|
short |
getGeometryId()
Returns the geometry class id.
|
int |
getGeometryType()
Returns the geometry type for this geometry.
|
abstract double |
getX()
Returns the X coordinate of this
Point in
double precision. |
abstract double |
getY()
Returns the Y coordinate of this
Point in
double precision. |
int |
hashCode()
Returns the hashcode for this
Point . |
double |
length()
Returns the geometry length.
|
PointGeometryIterator |
pointIterator() |
abstract void |
setLocation(double x,
double y)
Sets the location of this
Point to the specified
double coordinates. |
void |
setLocation(Point p)
Sets the location of this
Point to the same coordinates as
the specified Point object. |
abstract void |
setX(double x)
Returns the X coordinate of this
Point in
double precision. |
abstract void |
setY(double y)
Sets the Y coordinate of this
Point in
double precision. |
boolean |
spatiallyEquals(Geometry geometry,
PrecisionModel precisionModel)
Tests if this geometry is equal to the argument, on a topological point of view.
|
boolean |
spatiallyEquals(Point point,
double tolerance) |
Geometry |
transform(Transformation tr)
Creates a clone of the current geometry and returns
the new instance transformed with the specified geometry transformation.
The returned geometry can be of any geometry types after the transformation. |
abstract void |
translate(double dx,
double dy)
Translates the point by the specified offset
|
void |
translate(Point p)
Translates the point by the specified offset
|
asText, spatiallyEquals
public static final int PRECISION_FLOAT
public static final int PRECISION_DOUBLE
protected Point()
public Point getCenteredPoint()
Geometry
getCenteredPoint
in interface Geometry
public abstract double getX()
Point
in
double
precision.Point
.public abstract double getY()
Point
in
double
precision.Point
.public abstract void setX(double x)
Point
in
double
precision.x
- the X coordinate of this Point
.public abstract void setY(double y)
Point
in
double
precision.y
- the Y coordinate of this Point
.public abstract void setLocation(double x, double y)
Point
to the specified
double
coordinates.x
- x the X coordinate of this Point
.y
- y the Y coordinate of this Point
.public abstract void translate(double dx, double dy)
public void translate(Point p)
p
- the X and Y values of the translationpublic void setLocation(Point p)
Point
to the same coordinates as
the specified Point
object.p
- the specified Point
the which to set this
Point
public static double distanceSq(double X1, double Y1, double X2, double Y2)
X1
- the X coordinate of the first pointY1
- the Y coordinate of the first pointX2
- the X coordinate of the second pointY2
- the Y coordinate of the second pointpublic static double distance(double X1, double Y1, double X2, double Y2)
X1
- the X coordinate of the first pointY1
- the Y coordinate of the first pointX2
- the X coordinate of the second pointY2
- the Y coordinate of the second pointpublic double distanceSq(double PX, double PY)
Point
to a
specified point.PX
- the X coordinate of the specified pointPY
- the Y coordinate of the specified pointPoint
and
the specified point.public double distanceSq(Point pt)
Point
to a
specified Point
.pt
- the specified Point
Point
to a
specified Point
.public double distance(double PX, double PY)
Point
to a specified point.PX
- the X coordinate of the specified pointPY
- the Y coordinate of the specified pointPoint
and a specified
point.public double distance(Point pt)
Point
to a specified
Point
.pt
- the specified Point
Point
and the specified
Point
.public abstract Point clone()
clone
in interface Geometry
clone
in class DefaultGeometry
public int hashCode()
Point
.hashCode
in class java.lang.Object
Point
.public boolean equals(java.lang.Object obj)
Point
are equal if the values of their x
and
y
member fields, representing their position in the
coordinate space, are the same.equals
in class java.lang.Object
obj
- an object to be compared with this Point
true
if the object to be compared is an instance of
Point
and has the same values; false
otherwise.public boolean equals(Point point)
public boolean spatiallyEquals(Geometry geometry, PrecisionModel precisionModel)
Geometry
spatiallyEquals
in interface Geometry
geometry
- the geometry to be tested.precisionModel
- the precision model to use while comparing geometries.public boolean spatiallyEquals(Point point, double tolerance)
public PointGeometryIterator pointIterator()
pointIterator
in interface PointTypeGeometry
public short getGeometryId()
getGeometryId
in interface Geometry
public int getGeometryType()
getGeometryType
in interface Geometry
for more details.
public Geometry transform(Transformation tr)
public Geometry boundary()
public void createBounds()
createBounds
in interface Geometry
public double area()
Geometry