com.vividsolutions.jts.geom

Class Geometry

Implemented Interfaces:
Cloneable, Comparable, Serializable
Known Direct Subclasses:
GeometryCollection, LineString, Point, Polygon

public abstract class Geometry
extends java.lang.Object
implements Cloneable, Comparable, Serializable

Basic implementation of Geometry.

clone returns a deep copy of the object.

Binary Predicates

Because it is not clear at this time what semantics for spatial analysis methods involving GeometryCollections would be useful, GeometryCollections are not supported as arguments to binary predicates (other than convexHull) or the relate method.

Set-Theoretic Methods

The spatial analysis methods will return the most specific class possible to represent the result. If the result is homogeneous, a Point, LineString, or Polygon will be returned if the result contains a single element; otherwise, a MultiPoint, MultiLineString, or MultiPolygon will be returned. If the result is heterogeneous a GeometryCollection will be returned.

Because it is not clear at this time what semantics for set-theoretic methods involving GeometryCollections would be useful, GeometryCollections are not supported as arguments to the set-theoretic methods.

Representation of Computed Geometries

The SFS states that the result of a set-theoretic method is the "point-set" result of the usual set-theoretic definition of the operation (SFS 3.2.21.1). However, there are sometimes many ways of representing a point set as a Geometry.

The SFS does not specify an unambiguous representation of a given point set returned from a spatial analysis method. One goal of JTS is to make this specification precise and unambiguous. JTS will use a canonical form for Geometrys returned from spatial analysis methods. The canonical form is a Geometry which is simple and noded:

This definition implies that non-simple geometries which are arguments to spatial analysis methods must be subjected to a line-dissolve process to ensure that the results are simple.

Constructed Points And The Precision Model

The results computed by the set-theoretic methods may contain constructed points which are not present in the input Geometry s. These new points arise from intersections between line segments in the edges of the input Geometrys. In the general case it is not possible to represent constructed points exactly. This is due to the fact that the coordinates of an intersection point may contain twice as many bits of precision as the coordinates of the input line segments. In order to represent these constructed points explicitly, JTS must truncate them to fit the PrecisionModel.

Unfortunately, truncating coordinates moves them slightly. Line segments which would not be coincident in the exact result may become coincident in the truncated representation. This in turn leads to "topology collapses" -- situations where a computed element has a lower dimension than it would in the exact result.

When JTS detects topology collapses during the computation of spatial analysis methods, it will throw an exception. If possible the exception will report the location of the collapse.

#equals(Object) and #hashCode are not overridden, so that when two topologically equal Geometries are added to HashMaps and HashSets, they remain distinct. This behaviour is desired in many cases.

Version:
1.6

Field Summary

protected int
SRID
The ID of the Spatial Reference System used by this Geometry
protected Envelope
envelope
The bounding box of this Geometry.

Constructor Summary

Geometry(GeometryFactory factory)

Method Summary

abstract void
apply(CoordinateFilter filter)
Performs an operation with or on this Geometry's coordinates.
abstract void
apply(GeometryComponentFilter filter)
Performs an operation with or on this Geometry and its component Geometry's.
abstract void
apply(GeometryFilter filter)
Performs an operation with or on this Geometry and its subelement Geometrys (if any).
Geometry
buffer(double distance)
Returns a buffer region around this Geometry having the given width.
Geometry
buffer(double distance, int quadrantSegments)
Returns a buffer region around this Geometry having the given width and with a specified number of segments used to approximate curves.
protected void
checkNotGeometryCollection(Geometry g)
Throws an exception if g's class is GeometryCollection .
Object
clone()
protected int
compare(Collection a, Collection b)
Returns the first non-zero result of compareTo encountered as the two Collections are iterated over.
int
compareTo(Object o)
Returns whether this Geometry is greater than, equal to, or less than another Geometry.
protected abstract int
compareToSameClass(Object o)
Returns whether this Geometry is greater than, equal to, or less than another Geometry having the same class.
protected abstract Envelope
computeEnvelopeInternal()
Returns the minimum and maximum x and y values in this Geometry , or a null Envelope if this Geometry is empty.
boolean
contains(Geometry g)
Returns true if other.within(this) returns true.
Geometry
convexHull()
Returns the smallest convex Polygon that contains all the points in the Geometry.
boolean
crosses(Geometry g)
Returns true if the DE-9IM intersection matrix for the two Geometrys is
  • T*T****** (for a point and a curve, a point and an area or a line and an area)
  • 0******** (for two curves)
.
Geometry
difference(Geometry other)
Returns a Geometry representing the points making up this Geometry that do not make up other.
boolean
disjoint(Geometry g)
Returns true if the DE-9IM intersection matrix for the two Geometrys is FF*FF****.
double
distance(Geometry g)
Returns the minimum distance between this Geometry and the Geometry g
protected boolean
equal(Coordinate a, Coordinate b, double tolerance)
boolean
equals(Geometry g)
Returns true if the DE-9IM intersection matrix for the two Geometrys is T*F**FFF*.
boolean
equalsExact(Geometry other)
Returns true if the two Geometrys are exactly equal.
abstract boolean
equalsExact(Geometry other, double tolerance)
Returns true if the two Geometrys are exactly equal, up to a specified tolerance.
void
geometryChanged()
Notifies this Geometry that its Coordinates have been changed by an external party (using a CoordinateFilter, for example).
protected void
geometryChangedAction()
Notifies this Geometry that its Coordinates have been changed by an external party.
double
getArea()
Returns the area of this Geometry.
abstract Geometry
getBoundary()
Returns the boundary, or the empty geometry if this Geometry is empty.
abstract int
getBoundaryDimension()
Returns the dimension of this Geometrys inherent boundary.
Point
getCentroid()
Computes the centroid of this Geometry.
abstract Coordinate
getCoordinate()
Returns a vertex of this Geometry.
abstract Coordinate[]
getCoordinates()
Returns this Geometry s vertices.
abstract int
getDimension()
Returns the dimension of this Geometry.
Geometry
getEnvelope()
Returns this Geometrys bounding box.
Envelope
getEnvelopeInternal()
Returns the minimum and maximum x and y values in this Geometry , or a null Envelope if this Geometry is empty.
GeometryFactory
getFactory()
Gets the factory which contains the context in which this geometry was created.
Geometry
getGeometryN(int n)
Returns an element Geometry from a GeometryCollection (or this, if the geometry is not a collection).
abstract String
getGeometryType()
Returns the name of this object's com.vivid.jts.geom interface.
Point
getInteriorPoint()
Computes an interior point of this Geometry.
double
getLength()
Returns the length of this Geometry.
int
getNumGeometries()
Returns the number of Geometrys in a GeometryCollection (or 1, if the geometry is not a collection).
abstract int
getNumPoints()
Returns the count of this Geometrys vertices.
PrecisionModel
getPrecisionModel()
Returns the PrecisionModel used by the Geometry.
int
getSRID()
Deprecated. use getUserData instead
Object
getUserData()
Gets the user data object for this geometry, if any.
protected static boolean
hasNonEmptyElements(Geometry[] geometries)
Returns true if the array contains any non-empty Geometrys.
protected static boolean
hasNullElements(Object[] array)
Returns true if the array contains any null elements.
Geometry
intersection(Geometry other)
Returns a Geometry representing the points shared by this Geometry and other.
boolean
intersects(Geometry g)
Returns true if disjoint returns false.
abstract boolean
isEmpty()
Returns whether or not the set of points in this Geometry is empty.
protected boolean
isEquivalentClass(Geometry other)
Returns whether the two Geometrys are equal, from the point of view of the equalsExact method.
boolean
isRectangle()
abstract boolean
isSimple()
Returns false if the Geometry not simple.
boolean
isValid()
Tests the validity of this Geometry.
boolean
isWithinDistance(Geometry geom, double distance)
Tests whether the distance from this Geometry to another is less than or equal to a specified value.
abstract void
normalize()
Converts this Geometry to normal form (or canonical form ).
boolean
overlaps(Geometry g)
Returns true if the DE-9IM intersection matrix for the two Geometrys is
  • T*T***T** (for two points or two surfaces)
  • 1*T***T** (for two curves)
.
IntersectionMatrix
relate(Geometry g)
Returns the DE-9IM intersection matrix for the two Geometrys.
boolean
relate(Geometry g, String intersectionPattern)
Returns true if the elements in the DE-9IM intersection matrix for the two Geometrys match the elements in intersectionPattern , which may be:
  • 0
  • 1
  • 2
  • T ( = 0, 1 or 2)
  • F ( = -1)
  • * ( = -1, 0, 1 or 2)
For more information on the DE-9IM, see the OpenGIS Simple Features Specification.
void
setSRID(int SRID)
Deprecated. use setUserData instead
void
setUserData(Object userData)
A simple scheme for applications to add their own custom data to a Geometry.
Geometry
symDifference(Geometry other)
Returns a set combining the points in this Geometry not in other, and the points in other not in this Geometry.
String
toString()
String
toText()
Returns the Well-known Text representation of this Geometry.
boolean
touches(Geometry g)
Returns true if the DE-9IM intersection matrix for the two Geometrys is FT*******, F**T***** or F***T****.
Geometry
union(Geometry other)
Returns a Geometry representing all the points in this Geometry and other.
boolean
within(Geometry g)
Returns true if the DE-9IM intersection matrix for the two Geometrys is T*F**F***.

Field Details

SRID

protected int SRID
The ID of the Spatial Reference System used by this Geometry

envelope

protected Envelope envelope
The bounding box of this Geometry.

Constructor Details

Geometry

public Geometry(GeometryFactory factory)

Method Details

apply

public abstract void apply(CoordinateFilter filter)
Performs an operation with or on this Geometry's coordinates. If you are using this method to modify the geometry, be sure to call #geometryChanged() afterwards. Note that you cannot use this method to modify this Geometry if its underlying CoordinateSequence's #get method returns a copy of the Coordinate, rather than the actual Coordinate stored (if it even stores Coordinates at all).
Parameters:
filter - the filter to apply to this Geometry's coordinates

apply

public abstract void apply(GeometryComponentFilter filter)
Performs an operation with or on this Geometry and its component Geometry's. Only GeometryCollections and Polygons have component Geometry's; for Polygons they are the LinearRings of the shell and holes.
Parameters:
filter - the filter to apply to this Geometry.

apply

public abstract void apply(GeometryFilter filter)
Performs an operation with or on this Geometry and its subelement Geometrys (if any). Only GeometryCollections and subclasses have subelement Geometry's.
Parameters:
filter - the filter to apply to this Geometry (and its children, if it is a GeometryCollection).

buffer

public Geometry buffer(double distance)
Returns a buffer region around this Geometry having the given width. The buffer of a Geometry is the Minkowski sum or difference of the Geometry with a disc of radius distance.
Parameters:
distance - the width of the buffer, interpreted according to the PrecisionModel of the Geometry
Returns:
all points whose distance from this Geometry are less than or equal to distance

buffer

public Geometry buffer(double distance,
                       int quadrantSegments)
Returns a buffer region around this Geometry having the given width and with a specified number of segments used to approximate curves. The buffer of a Geometry is the Minkowski sum of the Geometry with a disc of radius distance. Curves in the buffer polygon are approximated with line segments. This method allows specifying the accuracy of that approximation.
Parameters:
distance - the width of the buffer, interpreted according to the PrecisionModel of the Geometry
quadrantSegments - the number of segments to use to approximate a quadrant of a circle
Returns:
all points whose distance from this Geometry are less than or equal to distance

checkNotGeometryCollection

protected void checkNotGeometryCollection(Geometry g)
Throws an exception if g's class is GeometryCollection . (Its subclasses do not trigger an exception).
Parameters:
g - the Geometry to check

clone

public Object clone()

compare

protected int compare(Collection a,
                      Collection b)
Returns the first non-zero result of compareTo encountered as the two Collections are iterated over. If, by the time one of the iterations is complete, no non-zero result has been encountered, returns 0 if the other iteration is also complete. If b completes before a, a positive number is returned; if a before b, a negative number.
Parameters:
a - a Collection of Comparables
b - a Collection of Comparables
Returns:
the first non-zero compareTo result, if any; otherwise, zero

compareTo

public int compareTo(Object o)
Returns whether this Geometry is greater than, equal to, or less than another Geometry.

If their classes are different, they are compared using the following ordering:

  • Point (lowest)
  • MultiPoint
  • LineString
  • LinearRing
  • MultiLineString
  • Polygon
  • MultiPolygon
  • GeometryCollection (highest)
If the two Geometrys have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.
Parameters:
o - a Geometry with which to compare this Geometry
Returns:
a positive number, 0, or a negative number, depending on whether this object is greater than, equal to, or less than o, as defined in "Normal Form For Geometry" in the JTS Technical Specifications

compareToSameClass

protected abstract int compareToSameClass(Object o)
Returns whether this Geometry is greater than, equal to, or less than another Geometry having the same class.
Parameters:
o - a Geometry having the same class as this Geometry
Returns:
a positive number, 0, or a negative number, depending on whether this object is greater than, equal to, or less than o, as defined in "Normal Form For Geometry" in the JTS Technical Specifications

computeEnvelopeInternal

protected abstract Envelope computeEnvelopeInternal()
Returns the minimum and maximum x and y values in this Geometry , or a null Envelope if this Geometry is empty. Unlike getEnvelopeInternal, this method calculates the Envelope each time it is called; getEnvelopeInternal caches the result of this method.
Returns:
this Geometrys bounding box; if the Geometry is empty, Envelope#isNull will return true

contains

public boolean contains(Geometry g)
Returns true if other.within(this) returns true.
Parameters:
Returns:
true if this Geometry contains other

convexHull

public Geometry convexHull()
Returns the smallest convex Polygon that contains all the points in the Geometry. This obviously applies only to Geometry s which contain 3 or more points; the results for degenerate cases are specified as follows:
Number of Points in argument Geometry Geometry class of result
0 empty GeometryCollection
1 Point
2 LineString
3 or more Polygon
Returns:
the minimum-area convex polygon containing this Geometry' s points

crosses

public boolean crosses(Geometry g)
Returns true if the DE-9IM intersection matrix for the two Geometrys is
  • T*T****** (for a point and a curve, a point and an area or a line and an area)
  • 0******** (for two curves)
.
Parameters:
Returns:
true if the two Geometrys cross. For this function to return true, the Geometry s must be a point and a curve; a point and a surface; two curves; or a curve and a surface.

difference

public Geometry difference(Geometry other)
Returns a Geometry representing the points making up this Geometry that do not make up other. This method returns the closure of the resultant Geometry.
Parameters:
other - the Geometry with which to compute the difference
Returns:
the point set difference of this Geometry with other

disjoint

public boolean disjoint(Geometry g)
Returns true if the DE-9IM intersection matrix for the two Geometrys is FF*FF****.
Parameters:
Returns:
true if the two Geometrys are disjoint

distance

public double distance(Geometry g)
Returns the minimum distance between this Geometry and the Geometry g
Parameters:
g - the Geometry from which to compute the distance

equal

protected boolean equal(Coordinate a,
                        Coordinate b,
                        double tolerance)

equals

public boolean equals(Geometry g)
Returns true if the DE-9IM intersection matrix for the two Geometrys is T*F**FFF*.
Parameters:
Returns:
true if the two Geometrys are equal

equalsExact

public boolean equalsExact(Geometry other)
Returns true if the two Geometrys are exactly equal. Two Geometries are exactly equal iff:
  • they have the same class
  • they have the same values of Coordinates in their internal Coordinate lists, in exactly the same order.
If this and the other Geometrys are composites and any children are not Geometrys, returns false.

This provides a stricter test of equality than equals.

Parameters:
other - the Geometry with which to compare this Geometry
Returns:
true if this and the other Geometry are of the same class and have equal internal data.

equalsExact

public abstract boolean equalsExact(Geometry other,
                                    double tolerance)
Returns true if the two Geometrys are exactly equal, up to a specified tolerance. Two Geometries are exactly within a tolerance equal iff:
  • they have the same class
  • they have the same values of Coordinates, within the given tolerance distance, in their internal Coordinate lists, in exactly the same order.
If this and the other Geometrys are composites and any children are not Geometrys, returns false.
Parameters:
other - the Geometry with which to compare this Geometry
Returns:
true if this and the other Geometry are of the same class and have equal internal data.

geometryChanged

public void geometryChanged()

geometryChangedAction

protected void geometryChangedAction()
Notifies this Geometry that its Coordinates have been changed by an external party. When #geometryChanged is called, this method will be called for this Geometry and its component Geometries.

getArea

public double getArea()
Returns the area of this Geometry. Areal Geometries have a non-zero area. They override this function to compute the area. Others return 0.0
Returns:
the area of the Geometry

getBoundary

public abstract Geometry getBoundary()
Returns the boundary, or the empty geometry if this Geometry is empty. For a discussion of this function, see the OpenGIS Simple Features Specification. As stated in SFS Section 2.1.13.1, "the boundary of a Geometry is a set of Geometries of the next lower dimension."
Returns:
the closure of the combinatorial boundary of this Geometry

getBoundaryDimension

public abstract int getBoundaryDimension()
Returns the dimension of this Geometrys inherent boundary.
Returns:
the dimension of the boundary of the class implementing this interface, whether or not this object is the empty geometry. Returns Dimension.FALSE if the boundary is the empty geometry.

getCentroid

public Point getCentroid()
Computes the centroid of this Geometry. The centroid is equal to the centroid of the set of component Geometries of highest dimension (since the lower-dimension geometries contribute zero "weight" to the centroid)
Returns:
a Point which is the centroid of this Geometry

getCoordinate

public abstract Coordinate getCoordinate()
Returns a vertex of this Geometry.
Returns:
a Coordinate which is a vertex of this Geometry. Returns null if this Geometry is empty

getCoordinates

public abstract Coordinate[] getCoordinates()
Returns this Geometry s vertices. If you modify the coordinates in this array, be sure to call #geometryChanged afterwards. The Geometrys contained by composite Geometrys must be Geometry's; that is, they must implement getCoordinates.
Returns:
the vertices of this Geometry

getDimension

public abstract int getDimension()
Returns the dimension of this Geometry.
Returns:
the dimension of the class implementing this interface, whether or not this object is the empty geometry

getEnvelope

public Geometry getEnvelope()
Returns this Geometrys bounding box. If this Geometry is the empty geometry, returns an empty Point. If the Geometry is a point, returns a non-empty Point. Otherwise, returns a Polygon whose points are (minx, miny), (maxx, miny), (maxx, maxy), (minx, maxy), (minx, miny).
Returns:
an empty Point (for empty Geometrys), a Point (for Points) or a Polygon (in all other cases)

getEnvelopeInternal

public Envelope getEnvelopeInternal()
Returns the minimum and maximum x and y values in this Geometry , or a null Envelope if this Geometry is empty.
Returns:
this Geometrys bounding box; if the Geometry is empty, Envelope#isNull will return true

getFactory

public GeometryFactory getFactory()
Gets the factory which contains the context in which this geometry was created.
Returns:
the factory for this geometry

getGeometryN

public Geometry getGeometryN(int n)
Returns an element Geometry from a GeometryCollection (or this, if the geometry is not a collection).
Parameters:
n - the index of the geometry element
Returns:
the n'th geometry contained in this geometry

getGeometryType

public abstract String getGeometryType()
Returns the name of this object's com.vivid.jts.geom interface.
Returns:
the name of this Geometrys most specific com.vividsolutions.jts.geom interface

getInteriorPoint

public Point getInteriorPoint()
Computes an interior point of this Geometry. An interior point is guaranteed to lie in the interior of the Geometry, if it possible to calculate such a point exactly. Otherwise, the point may lie on the boundary of the geometry.
Returns:
a Point which is in the interior of this Geometry

getLength

public double getLength()
Returns the length of this Geometry. Linear geometries return their length. Areal geometries return their perimeter. They override this function to compute the area. Others return 0.0
Returns:
the length of the Geometry

getNumGeometries

public int getNumGeometries()
Returns the number of Geometrys in a GeometryCollection (or 1, if the geometry is not a collection).
Returns:
the number of geometries contained in this geometry

getNumPoints

public abstract int getNumPoints()
Returns the count of this Geometrys vertices. The Geometry s contained by composite Geometrys must be Geometry's; that is, they must implement getNumPoints
Returns:
the number of vertices in this Geometry

getPrecisionModel

public PrecisionModel getPrecisionModel()
Returns the PrecisionModel used by the Geometry.
Returns:
the specification of the grid of allowable points, for this Geometry and all other Geometrys

getSRID

public int getSRID()

Deprecated. use getUserData instead

Returns the ID of the Spatial Reference System used by the Geometry.

JTS supports Spatial Reference System information in the simple way defined in the SFS. A Spatial Reference System ID (SRID) is present in each Geometry object. Geometry provides basic accessor operations for this field, but no others. The SRID is represented as an integer.

Returns:
the ID of the coordinate space in which the Geometry is defined.

getUserData

public Object getUserData()
Gets the user data object for this geometry, if any.
Returns:
the user data object, or null if none set

hasNonEmptyElements

protected static boolean hasNonEmptyElements(Geometry[] geometries)
Returns true if the array contains any non-empty Geometrys.
Parameters:
geometries - an array of Geometrys; no elements may be null
Returns:
true if any of the Geometrys isEmpty methods return false

hasNullElements

protected static boolean hasNullElements(Object[] array)
Returns true if the array contains any null elements.
Parameters:
array - an array to validate
Returns:
true if any of arrays elements are null

intersection

public Geometry intersection(Geometry other)
Returns a Geometry representing the points shared by this Geometry and other.
Parameters:
other - the Geometry with which to compute the intersection
Returns:
the points common to the two Geometrys

intersects

public boolean intersects(Geometry g)
Returns true if disjoint returns false.
Parameters:
Returns:
true if the two Geometrys intersect

isEmpty

public abstract boolean isEmpty()
Returns whether or not the set of points in this Geometry is empty.
Returns:
true if this Geometry equals the empty geometry

isEquivalentClass

protected boolean isEquivalentClass(Geometry other)
Returns whether the two Geometrys are equal, from the point of view of the equalsExact method. Called by equalsExact . In general, two Geometry classes are considered to be "equivalent" only if they are the same class. An exception is LineString , which is considered to be equivalent to its subclasses.
Parameters:
other - the Geometry with which to compare this Geometry for equality
Returns:
true if the classes of the two Geometry s are considered to be equal by the equalsExact method.

isRectangle

public boolean isRectangle()

isSimple

public abstract boolean isSimple()
Returns false if the Geometry not simple. Subclasses provide their own definition of "simple". If this Geometry is empty, returns true.

In general, the SFS specifications of simplicity seem to follow the following rule:

  • A Geometry is simple iff the only self-intersections are at boundary points.
For all empty Geometrys, isSimple = true.
Returns:
true if this Geometry has any points of self-tangency, self-intersection or other anomalous points

isValid

public boolean isValid()
Tests the validity of this Geometry. Subclasses provide their own definition of "valid".
Returns:
true if this Geometry is valid

isWithinDistance

public boolean isWithinDistance(Geometry geom,
                                double distance)
Tests whether the distance from this Geometry to another is less than or equal to a specified value.
Parameters:
geom - the Geometry to check the distance to
distance - the distance value to compare
Returns:
true if the geometries are less than distance apart.

normalize

public abstract void normalize()
Converts this Geometry to normal form (or canonical form ). Normal form is a unique representation for Geometry s. It can be used to test whether two Geometrys are equal in a way that is independent of the ordering of the coordinates within them. Normal form equality is a stronger condition than topological equality, but weaker than pointwise equality. The definitions for normal form use the standard lexicographical ordering for coordinates. "Sorted in order of coordinates" means the obvious extension of this ordering to sequences of coordinates.

overlaps

public boolean overlaps(Geometry g)
Returns true if the DE-9IM intersection matrix for the two Geometrys is
  • T*T***T** (for two points or two surfaces)
  • 1*T***T** (for two curves)
.
Parameters:
Returns:
true if the two Geometrys overlap. For this function to return true, the Geometry s must be two points, two curves or two surfaces.

relate

public IntersectionMatrix relate(Geometry g)
Returns the DE-9IM intersection matrix for the two Geometrys.
Parameters:
Returns:
a matrix describing the intersections of the interiors, boundaries and exteriors of the two Geometrys

relate

public boolean relate(Geometry g,
                      String intersectionPattern)
Returns true if the elements in the DE-9IM intersection matrix for the two Geometrys match the elements in intersectionPattern , which may be:
  • 0
  • 1
  • 2
  • T ( = 0, 1 or 2)
  • F ( = -1)
  • * ( = -1, 0, 1 or 2)
For more information on the DE-9IM, see the OpenGIS Simple Features Specification.
Parameters:
intersectionPattern - the pattern against which to check the intersection matrix for the two Geometrys
Returns:
true if the DE-9IM intersection matrix for the two Geometrys match intersectionPattern

setSRID

public void setSRID(int SRID)

Deprecated. use setUserData instead

Sets the ID of the Spatial Reference System used by the Geometry.

setUserData

public void setUserData(Object userData)
A simple scheme for applications to add their own custom data to a Geometry. An example use might be to add an object representing a Coordinate Reference System.

Note that user data objects are not present in geometries created by construction methods.

Parameters:
userData - an object, the semantics for which are defined by the application using this Geometry

symDifference

public Geometry symDifference(Geometry other)
Returns a set combining the points in this Geometry not in other, and the points in other not in this Geometry. This method returns the closure of the resultant Geometry.
Parameters:
other - the Geometry with which to compute the symmetric difference
Returns:
the point set symmetric difference of this Geometry with other

toString

public String toString()

toText

public String toText()
Returns the Well-known Text representation of this Geometry. For a definition of the Well-known Text format, see the OpenGIS Simple Features Specification.
Returns:
the Well-known Text representation of this Geometry

touches

public boolean touches(Geometry g)
Returns true if the DE-9IM intersection matrix for the two Geometrys is FT*******, F**T***** or F***T****.
Parameters:
Returns:
true if the two Geometrys touch; Returns false if both Geometrys are points

union

public Geometry union(Geometry other)
Returns a Geometry representing all the points in this Geometry and other.
Parameters:
other - the Geometry with which to compute the union
Returns:
a set combining the points of this Geometry and the points of other

within

public boolean within(Geometry g)
Returns true if the DE-9IM intersection matrix for the two Geometrys is T*F**F***.
Parameters:
Returns:
true if this Geometry is within other