public abstract class AbstractGeometry extends Object implements GeometryJTS
Geometry.DIMENSIONS, Geometry.OPERATIONS, Geometry.SUBTYPES, Geometry.TYPES, Geometry.ValidationStatus| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
logger |
BEST, E, EXTENDED_GEOMSUBTYPE_OFFSET, EXTENDED_GEOMTYPE_OFFSET, N, NE, NW, S, SE, SELECTHANDLER, STRETCHINGHANDLER, SW, W| Constructor and Description |
|---|
AbstractGeometry(int type,
int subtype) |
| Modifier and Type | Method and Description |
|---|---|
double |
area() |
Geometry |
buffer(double distance)
Computes a buffer area around this geometry having the given width
This is a utility method to wrap the invocation to the operation
Geometry.OPERATIONS.BUFFER. |
Point |
centroid() |
Geometry[] |
closestPoints(Geometry other) |
int |
compareTo(Object o) |
boolean |
contains(double x,
double y) |
boolean |
contains(double x,
double y,
double w,
double h) |
boolean |
contains(Geometry geometry)
Tests whether this geometry contains the specified geometry.
|
boolean |
contains(Point2D p) |
boolean |
contains(Rectangle2D r) |
byte[] |
convertToEWKB()
Return a byte array with the equivalent in EWKB format of the Geometry.
|
byte[] |
convertToEWKB(int srs) |
byte[] |
convertToEWKBForcingType(int srs,
int type) |
byte[] |
convertToWKB()
Return a byte array with the equivalent in WKB format of the Geometry.
|
byte[] |
convertToWKB(int srs) |
byte[] |
convertToWKBForcingType(int srs,
int type) |
String |
convertToWKT()
Return a string with the equivalent in WKT format of the Geometry.
|
Geometry |
convexHull() |
boolean |
coveredBy(Geometry geometry) |
boolean |
covers(Geometry geometry) |
boolean |
crosses(Geometry geometry) |
Geometry |
difference(Geometry other) |
boolean |
disjoint(Geometry geometry) |
double |
distance(Geometry other)
Returns the minimum distance between this Geometry and the specified
geometry.
|
boolean |
ensureOrientation(boolean ccw)
Ensures the orientation of the geometry according to the parameter, flipping it if necessary.
|
boolean |
equals(Object obj) |
boolean |
fastIntersects(double x,
double y,
double w,
double h)
Used by the drawing strategies to quickly test whether this geometry
intersects with the visible rectangle.
|
Rectangle |
getBounds() |
Rectangle2D |
getBounds2D()
Returns this geometry's boundary rectangle.
|
Envelope |
getEnvelope()
Returns the minimum bounding box for this Geometry.
|
GeometryType |
getGeometryType()
Instance of the GeometryType associated to this geometry.
|
Point |
getInteriorPoint()
This method returns a point which is inside the geometry.
|
Shape |
getInternalShape()
Useful to have the real shape behind the scenes.
|
protected GeometryManager |
getManager() |
int |
getType()
If this geometry is a predefined interface then this method returns one
of
Geometry.TYPES contants. |
Geometry.ValidationStatus |
getValidationStatus()
Check if the geometry is valid and returns the validation status.
|
Geometry |
intersection(Geometry other) |
boolean |
intersects(double x,
double y,
double w,
double h) |
boolean |
intersects(Geometry geometry) |
boolean |
intersects(Rectangle2D r)
Returns true if this geometry intersects the rectangle passed as
parameter.
|
Object |
invokeOperation(int index,
GeometryOperationContext ctx)
Invokes a geometry operation given its index and context.
|
Object |
invokeOperation(String opName,
GeometryOperationContext ctx)
Invokes a geometry operation given its name and context.
|
boolean |
isCCW() |
boolean |
isSimple()
Returns
true if this Geometry has no interior point of
self-intersection or self-tangency. |
boolean |
isValid()
Check if the geometry is valid.
|
boolean |
isWithinDistance(Geometry other,
double distance) |
Geometry |
makeValid()
Try to fix the geometry and return the new geometry.
|
void |
move(double dx,
double dy)
Shifts geometry by given amount in x and y axes
|
protected void |
notifyDeprecated(String message) |
boolean |
out(Geometry geometry)
Returns true if passed as a parameter geometry is completely out of geometry.
|
boolean |
overlaps(Geometry geometry)
Tests whether this geometry overlaps the specified geometry.
|
double |
perimeter() |
void |
rotate(double radAngle,
double basex,
double basey)
Rotates the geometry by radAngle radians using the given
coordinates as center of rotation.
|
void |
scale(Point basePoint,
double sx,
double sy)
Scales geometry in x and y axes by given scale factors
using the given point as center of projection.
|
Geometry |
snapTo(Geometry other,
double snapTolerance) |
String |
toString() |
boolean |
touches(Geometry geometry) |
Geometry |
union(Geometry other) |
boolean |
within(Geometry geometry) |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetJTS, is3DcloneGeometry, flip, getDimension, getGeneralPath, getHandlers, getPathIterator, getPathIterator, getShape, getShape, offset, reProject, toLines, toPoints, toPolygons, transformpublic GeometryType getGeometryType()
GeometrygetGeometryType in interface Geometryprotected GeometryManager getManager()
public boolean contains(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException
GeometryGeometry.OPERATIONS.CONTAINS.contains in interface Geometrygeometry - the Geometry with which to compare this GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic int compareTo(Object o)
compareTo in interface Comparablepublic boolean intersects(double x,
double y,
double w,
double h)
intersects in interface Shapepublic boolean contains(double x,
double y,
double w,
double h)
public boolean contains(Rectangle2D r)
public double distance(Geometry other) throws GeometryOperationNotSupportedException, GeometryOperationException
GeometryGeometry.OPERATIONS.DISTANCE.distance in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic boolean isWithinDistance(Geometry other, double distance) throws GeometryOperationNotSupportedException, GeometryOperationException
isWithinDistance in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic boolean overlaps(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException
GeometryGeometry.OPERATIONS.OVERLAPS.overlaps in interface Geometrygeometry - the Geometry with which to compare this GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic boolean coveredBy(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException
coveredBy in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic boolean covers(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException
covers in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic boolean crosses(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException
crosses in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic boolean intersects(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException
intersects in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic boolean touches(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException
touches in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic boolean disjoint(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException
disjoint in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic boolean within(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException
within in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic double area()
throws GeometryOperationNotSupportedException,
GeometryOperationException
area in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic double perimeter()
throws GeometryOperationNotSupportedException,
GeometryOperationException
perimeter in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic boolean intersects(Rectangle2D r)
Geometryintersects in interface Shapeintersects in interface Geometryr - Rectangle.this intersects r.public boolean fastIntersects(double x,
double y,
double w,
double h)
GeometryfastIntersects in interface Geometryx - The minimum X coordinate.y - The minimum Y coordinate.w - The width of the envelope.h - The height of the envelope.this intersects the rectangle defined by the
parameters.public Envelope getEnvelope()
GeometryReturns the minimum bounding box for this Geometry. This shall be the coordinate region spanning the minimum and maximum value for each ordinate taken on by DirectPositions in this Geometry. The simplest representation for an envelope consists of two DirectPositions, the first one containing all the minimums for each ordinate, and second one containing all the maximums.
getEnvelope in interface Geometrypublic boolean isSimple()
Geometrytrue if this Geometry has no interior point of
self-intersection or self-tangency. In mathematical formalisms, this
means that every point in the interior of the object must have a metric
neighborhood whose intersection with the object is isomorphic to an
n-sphere, where n is the dimension of this Geometry.public boolean isCCW()
throws GeometryOperationNotSupportedException,
GeometryOperationException
isCCW in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic Object invokeOperation(int index, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException
GeometryinvokeOperation in interface Geometryindex - Unique index of the operation. Operation code.ctx - The context of the geometry operation.GeometryOperationNotSupportedException - It is thrown when the operation has been not registered for
this geometry.GeometryOperationException - It is thrown when there is an error executing the operation.public Object invokeOperation(String opName, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException
GeometryinvokeOperation in interface GeometryopName - Operation name.ctx - The context of the geometry operation.GeometryOperationNotSupportedException - It is thrown when the operation has been not registered for
this geometry.GeometryOperationException - It is thrown when there is an error executing the operation.public int getType()
GeometryGeometry.TYPES contants.getType in interface GeometryGeometry.TYPES or a runtime constant if it is an extended
type.public byte[] convertToWKB()
throws GeometryOperationNotSupportedException,
GeometryOperationException
GeometryGeometry.OPERATIONS.CONVERTTOWKB.convertToWKB in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic byte[] convertToWKB(int srs)
throws GeometryOperationNotSupportedException,
GeometryOperationException
convertToWKB in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic byte[] convertToWKBForcingType(int srs,
int type)
throws GeometryOperationNotSupportedException,
GeometryOperationException
convertToWKBForcingType in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic byte[] convertToEWKB()
throws GeometryOperationNotSupportedException,
GeometryOperationException
GeometryOPERATIONS#CONVERTTOEWKB.convertToEWKB in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic byte[] convertToEWKB(int srs)
throws GeometryOperationNotSupportedException,
GeometryOperationException
convertToEWKB in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic byte[] convertToEWKBForcingType(int srs,
int type)
throws GeometryOperationNotSupportedException,
GeometryOperationException
convertToEWKBForcingType in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic String convertToWKT() throws GeometryOperationNotSupportedException, GeometryOperationException
GeometryGeometry.OPERATIONS.CONVERTTOWKT.convertToWKT in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic Geometry buffer(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException
GeometryGeometry.OPERATIONS.BUFFER.buffer in interface Geometrydistance - the width of the bufferGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic Geometry snapTo(Geometry other, double snapTolerance) throws GeometryOperationNotSupportedException, GeometryOperationException
snapTo in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic Point getInteriorPoint() throws GeometryOperationNotSupportedException, GeometryOperationException
GeometrygetInteriorPoint in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic boolean isValid()
Geometrypublic Geometry.ValidationStatus getValidationStatus()
GeometrygetValidationStatus in interface Geometrypublic Geometry makeValid()
Geometrypublic Rectangle2D getBounds2D()
GeometrygetBounds2D in interface ShapegetBounds2D in interface Geometrypublic Shape getInternalShape()
GeometrygetInternalShape in interface Geometrypublic void rotate(double radAngle,
double basex,
double basey)
Geometrypublic void move(double dx,
double dy)
Geometrypublic void scale(Point basePoint, double sx, double sy)
Geometrypublic Geometry[] closestPoints(Geometry other) throws GeometryOperationNotSupportedException, GeometryOperationException
closestPoints in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic Geometry convexHull() throws GeometryOperationNotSupportedException, GeometryOperationException
convexHull in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic Geometry difference(Geometry other) throws GeometryOperationNotSupportedException, GeometryOperationException
difference in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic Geometry intersection(Geometry other) throws GeometryOperationNotSupportedException, GeometryOperationException
intersection in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic Geometry union(Geometry other) throws GeometryOperationNotSupportedException, GeometryOperationException
union in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic Point centroid() throws GeometryOperationNotSupportedException, GeometryOperationException
centroid in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionprotected void notifyDeprecated(String message)
public boolean ensureOrientation(boolean ccw)
throws GeometryOperationNotSupportedException,
GeometryOperationException
GeometryensureOrientation in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationExceptionpublic boolean out(Geometry geometry) throws GeometryOperationNotSupportedException, GeometryOperationException
Geometryout in interface GeometryGeometryOperationNotSupportedExceptionGeometryOperationException