Package com.kheops.jmap.spatial
Class Point
java.lang.Object
com.kheops.jmap.spatial.DefaultGeometry
com.kheops.jmap.spatial.Point
- All Implemented Interfaces:
Geometry,PointTypeGeometry,Serializable,Cloneable
- Direct Known Subclasses:
Point.Double,Point.Float,PointM
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTheDoubleclass defines a point specified indoubleprecision.static classTheFloatclass defines a point specified in float precision. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA constant used to represent the precision of a double-precision floating point decimal.static final intA constant used to represent the precision of a single-precision floating point decimal.Fields inherited from interface com.kheops.jmap.spatial.Geometry
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 -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPoint()This is an abstract class that cannot be instantiated directly. -
Method Summary
Modifier and TypeMethodDescriptiondoublearea()Returns the geometry area.boundary()Returns the boundary of this geometry as a line string.abstract Pointclone()Clones this geometry.voidUpdates the geometry bounds from the current geometry.doubledistance(double PX, double PY) Returns the distance from thisPointto a specified point.static doubledistance(double X1, double Y1, double X2, double Y2) Returns the distance between two points.doubleReturns the distance from thisPointto a specifiedPoint.doubledistanceSq(double PX, double PY) Returns the square of the distance from thisPointto a specified point.static doubledistanceSq(double X1, double Y1, double X2, double Y2) Returns the square of the distance between two points.doubledistanceSq(Point pt) Returns the square of the distance from thisPointto a specifiedPoint.booleanbooleanDetermines whether two points are equal.This method returns a point that is typically centered on the geometry.shortReturns the geometry class id.intReturns the geometry type for this geometry.abstract doublegetX()Returns the X coordinate of thisPointindoubleprecision.abstract doublegetY()Returns the Y coordinate of thisPointindoubleprecision.inthashCode()Returns the hashcode for thisPoint.doublelength()Returns the geometry length.abstract voidsetLocation(double x, double y) Sets the location of thisPointto the specifieddoublecoordinates.voidsetLocation(Point p) Sets the location of thisPointto the same coordinates as the specifiedPointobject.abstract voidsetX(double x) Returns the X coordinate of thisPointindoubleprecision.abstract voidsetY(double y) Sets the Y coordinate of thisPointindoubleprecision.booleanspatiallyEquals(Geometry geometry, PrecisionModel precisionModel) Tests if this geometry is equal to the argument, on a topological point of view.booleanspatiallyEquals(Point point, double tolerance) 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 voidtranslate(double dx, double dy) Translates the point by the specified offsetvoidTranslates the point by the specified offsetMethods inherited from class com.kheops.jmap.spatial.DefaultGeometry
asText, spatiallyEquals
-
Field Details
-
PRECISION_FLOAT
public static final int PRECISION_FLOATA constant used to represent the precision of a single-precision floating point decimal.- See Also:
-
PRECISION_DOUBLE
public static final int PRECISION_DOUBLEA constant used to represent the precision of a double-precision floating point decimal.- See Also:
-
-
Constructor Details
-
Point
protected Point()This is an abstract class that cannot be instantiated directly. Type-specific implementation subclasses are available for instantiation and provide a number of formats for storing the information necessary to satisfy the various accessor methods below.
-
-
Method Details
-
getCenteredPoint
Description copied from interface:GeometryThis method returns a point that is typically centered on the geometry. If the geometry is a point, the point is returned. If it is a line, a point on the curve interpolated at 50% is returned. If the geometry is a surface, the centroid is returned if it is inside the polygon, if not, a point inside the polygon (but likely not exactly in the center) will be returned. If the geometry is a collection, the method is called on the first part of the collection.- Specified by:
getCenteredPointin interfaceGeometry- Returns:
- a point likely at the center of the geometry
-
getX
public abstract double getX()Returns the X coordinate of thisPointindoubleprecision.- Returns:
- the X coordinate of this
Point.
-
getY
public abstract double getY()Returns the Y coordinate of thisPointindoubleprecision.- Returns:
- the Y coordinate of this
Point.
-
setX
public abstract void setX(double x) Returns the X coordinate of thisPointindoubleprecision.- Parameters:
x- the X coordinate of thisPoint.
-
setY
public abstract void setY(double y) Sets the Y coordinate of thisPointindoubleprecision.- Parameters:
y- the Y coordinate of thisPoint.
-
setLocation
public abstract void setLocation(double x, double y) Sets the location of thisPointto the specifieddoublecoordinates.- Parameters:
x- x the X coordinate of thisPoint.y- y the Y coordinate of thisPoint.
-
translate
public abstract void translate(double dx, double dy) Translates the point by the specified offset -
translate
Translates the point by the specified offset- Parameters:
p- the X and Y values of the translation
-
setLocation
Sets the location of thisPointto the same coordinates as the specifiedPointobject.- Parameters:
p- the specifiedPointthe which to set thisPoint- Since:
- 1.2
-
distanceSq
public static double distanceSq(double X1, double Y1, double X2, double Y2) Returns the square of the distance between two points.- Parameters:
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 point- Returns:
- the square of the distance between the two sets of specified coordinates.
-
distance
public static double distance(double X1, double Y1, double X2, double Y2) Returns the distance between two points.- Parameters:
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 point- Returns:
- the distance between the two sets of specified coordinates.
-
distanceSq
public double distanceSq(double PX, double PY) Returns the square of the distance from thisPointto a specified point.- Parameters:
PX- the X coordinate of the specified pointPY- the Y coordinate of the specified point- Returns:
- the square of the distance between this
Pointand the specified point.
-
distanceSq
Returns the square of the distance from thisPointto a specifiedPoint.- Parameters:
pt- the specifiedPoint- Returns:
- the square of the distance between this
Pointto a specifiedPoint.
-
distance
public double distance(double PX, double PY) Returns the distance from thisPointto a specified point.- Parameters:
PX- the X coordinate of the specified pointPY- the Y coordinate of the specified point- Returns:
- the distance between this
Pointand a specified point.
-
distance
Returns the distance from thisPointto a specifiedPoint.- Parameters:
pt- the specifiedPoint- Returns:
- the distance between this
Pointand the specifiedPoint.
-
clone
Clones this geometry.- Specified by:
clonein interfaceGeometry- Specified by:
clonein classDefaultGeometry- Returns:
- a deep copy of the current geometry.
-
hashCode
public int hashCode()Returns the hashcode for thisPoint. -
equals
Determines whether two points are equal. Two instances ofPointare equal if the values of theirxandymember fields, representing their position in the coordinate space, are the same. -
equals
-
spatiallyEquals
Description copied from interface:GeometryTests if this geometry is equal to the argument, on a topological point of view.- Specified by:
spatiallyEqualsin interfaceGeometry- Parameters:
geometry- the geometry to be tested.precisionModel- the precision model to use while comparing geometries.- Returns:
- whether both geometries are spatially equals.
-
spatiallyEquals
-
pointIterator
- Specified by:
pointIteratorin interfacePointTypeGeometry
-
getGeometryId
public short getGeometryId()Returns the geometry class id. This method is useful for geometry serialization.- Specified by:
getGeometryIdin interfaceGeometry- Returns:
- the geometry id.
-
getGeometryType
public int getGeometryType()Returns the geometry type for this geometry.- Specified by:
getGeometryTypein interfaceGeometry- Returns:
- the geometry type.
- See Also:
-
transform
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. -
boundary
Returns the boundary of this geometry as a line string.
Always returns null. -
createBounds
public void createBounds()Updates the geometry bounds from the current geometry.
Has no effect on the Point class.- Specified by:
createBoundsin interfaceGeometry
-
area
public double area()Description copied from interface:GeometryReturns the geometry area. If the geometry is not a surface, then 0 shall be returned. -
length
public double length()Description copied from interface:GeometryReturns the geometry length. If the geometry is a surface, then the geometry perimeter shall be returned.
-