Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
com.vividsolutions.jts.geom.Geometry
public abstract class Geometry
extends java.lang.Object
implements Cloneable, Comparable, Serializable
GeometryCollection
s would be useful,
GeometryCollection
s are not supported as arguments to binary
predicates (other than convexHull
) or the relate
method.
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 GeometryCollection
s would be useful,
GeometryCollections
are not supported as arguments to the set-theoretic methods.
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
Geometry
s returned from spatial analysis methods. The canonical
form is a Geometry
which is simple and noded:
isSimple
.
LineString
s. It
means that all intersection points on LineString
s will be
present as endpoints of LineString
s in the result.
Geometry
s. These new points arise from intersections between line segments in the
edges of the input Geometry
s. 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.
Field Summary | |
protected int |
|
protected Envelope |
|
Constructor Summary | |
|
Method Summary | |
abstract void |
|
abstract void |
|
abstract void |
|
Geometry |
|
Geometry |
|
Geometry |
|
protected void |
|
Object |
|
protected int |
|
int |
|
int |
|
protected abstract int |
|
protected abstract int |
|
protected abstract Envelope |
|
boolean | |
Geometry |
|
boolean | |
boolean | |
boolean | |
Geometry |
|
boolean | |
double | |
protected boolean |
|
boolean | |
boolean |
|
abstract boolean |
|
void |
|
protected void |
|
double |
|
abstract Geometry |
|
abstract int |
|
Point |
|
abstract Coordinate |
|
abstract Coordinate[] |
|
abstract int |
|
Geometry |
|
Envelope |
|
GeometryFactory |
|
Geometry |
|
abstract String |
|
Point |
|
double |
|
int |
|
abstract int |
|
PrecisionModel |
|
int |
|
Object |
|
protected static boolean |
|
protected static boolean |
|
Geometry |
|
boolean |
|
abstract boolean |
|
protected boolean |
|
boolean | |
abstract boolean | |
boolean |
|
boolean |
|
abstract void |
|
boolean | |
IntersectionMatrix |
|
boolean |
|
void |
|
void |
|
Geometry |
|
String |
|
String |
|
boolean | |
Geometry | |
boolean |
public abstract void apply(CoordinateFilter filter)
Performs an operation with or on thisGeometry
'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 thisGeometry
's coordinates
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 thisGeometry
.
public abstract void apply(GeometryFilter filter)
Performs an operation with or on thisGeometry
and its subelementGeometry
s (if any). Only GeometryCollections and subclasses have subelement Geometry's.
- Parameters:
filter
- the filter to apply to thisGeometry
(and its children, if it is aGeometryCollection
).
public Geometry buffer(double distance)
Computes a buffer area 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 radiusabs(distance)
. The buffer is constructed using 8 segments per quadrant to represent curves. The end cap style is CAP_ROUND.
- Parameters:
distance
- the width of the buffer (may be positive, negative or 0)
- Returns:
- an area geometry representing the buffer region
- See Also:
buffer(double,int)
,buffer(double,int,int)
public Geometry buffer(double distance, int quadrantSegments)
Computes a buffer area around this geometry having the given width and with a specified accuracy of approximation for circular arcs. Buffer area boundaries can contain circular arcs. To represent these arcs using linear geometry they must be approximated with line segments. ThequadrantSegments
argument allows controlling the accuracy of the approximation by specifying the number of line segments used to represent a quadrant of a circle
- Parameters:
distance
- the width of the buffer (may be positive, negative or 0)quadrantSegments
- the number of line segments used to represent a quadrant of a circle
- Returns:
- an area geometry representing the buffer region
- See Also:
buffer(double)
,buffer(double,int,int)
public Geometry buffer(double distance, int quadrantSegments, int endCapStyle)
Computes a buffer area around this geometry having the given width and with a specified accuracy of approximation for circular arcs, and using a specified end cap style. Buffer area boundaries can contain circular arcs. To represent these arcs using linear geometry they must be approximated with line segments. ThequadrantSegments
argument allows controlling the accuracy of the approximation by specifying the number of line segments used to represent a quadrant of a circle The end cap style specifies the buffer geometry that will be created at the ends of linestrings. The styles provided are:
- BufferOp.CAP_ROUND - (default) a semi-circle
- BufferOp.CAP_BUTT - a straight line perpendicular to the end segment
- BufferOp.CAP_SQUARE - a half-square
- Parameters:
distance
- the width of the buffer (may be positive, negative or 0)quadrantSegments
- the number of line segments used to represent a quadrant of a circleendCapStyle
- the end cap style to use
- Returns:
- an area geometry representing the buffer region
- See Also:
buffer(double)
,buffer(double,int)
,BufferOp
protected void checkNotGeometryCollection(Geometry g)
Throws an exception ifg
's class isGeometryCollection
. (Its subclasses do not trigger an exception).
- Parameters:
g
- theGeometry
to check
public Object clone()
protected int compare(Collection a, Collection b)
Returns the first non-zero result ofcompareTo
encountered as the twoCollection
s 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. Ifb
completes beforea
, a positive number is returned; if a before b, a negative number.
- Parameters:
a
- aCollection
ofComparable
sb
- aCollection
ofComparable
s
- Returns:
- the first non-zero
compareTo
result, if any; otherwise, zero
public int compareTo(Object o)
Returns whether thisGeometry
is greater than, equal to, or less than anotherGeometry
. If their classes are different, they are compared using the following ordering:If the two
- Point (lowest)
- MultiPoint
- LineString
- LinearRing
- MultiLineString
- Polygon
- MultiPolygon
- GeometryCollection (highest)
Geometry
s have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.
- Parameters:
o
- aGeometry
with which to compare thisGeometry
- 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
public int compareTo(Object o, CoordinateSequenceComparator comp)
Returns whether thisGeometry
is greater than, equal to, or less than anotherGeometry
, using the givenCoordinateSequenceComparator
. If their classes are different, they are compared using the following ordering:If the two
- Point (lowest)
- MultiPoint
- LineString
- LinearRing
- MultiLineString
- Polygon
- MultiPolygon
- GeometryCollection (highest)
Geometry
s have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.
- Parameters:
o
- aGeometry
with which to compare thisGeometry
comp
- aCoordinateSequenceComparator
- 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
protected abstract int compareToSameClass(Object o)
Returns whether thisGeometry
is greater than, equal to, or less than anotherGeometry
having the same class.
- Parameters:
o
- aGeometry
having the same class as thisGeometry
- 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
protected abstract int compareToSameClass(Object o, CoordinateSequenceComparator comp)
Returns whether thisGeometry
is greater than, equal to, or less than anotherGeometry
of the same class. using the givenCoordinateSequenceComparator
.
- Parameters:
o
- aGeometry
having the same class as thisGeometry
comp
- aCoordinateSequenceComparator
- 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
protected abstract Envelope computeEnvelopeInternal()
Returns the minimum and maximum x and y values in thisGeometry
, or a nullEnvelope
if thisGeometry
is empty. UnlikegetEnvelopeInternal
, this method calculates theEnvelope
each time it is called;getEnvelopeInternal
caches the result of this method.
- Returns:
- this
Geometry
s bounding box; if theGeometry
is empty,Envelope#isNull
will returntrue
public boolean contains(Geometry g)
Returnstrue
if this geometry contains the specified geometry. Thecontains
predicate has the following equivalent definitions:An implication of the definition is that "Polygons do not contain their boundary". In other words, if a geometry G is a subset of the points in the boundary of a polygon P,
- Every point of the other geometry is a point of this geometry, and the interiors of the two geometries have at least one point in common.
- The DE-9IM Intersection Matrix for the two geometries is
T*****FF*
g.within(this)
(contains
is the inverse ofwithin
)P.contains(G) = false
- Parameters:
g
- theGeometry
with which to compare thisGeometry
- Returns:
true
if thisGeometry
containsg
- See Also:
within(Geometry)
public Geometry convexHull()
Computes the smallest convexPolygon
that contains all the points in theGeometry
. This obviously applies only toGeometry
s which contain 3 or more points; the results for degenerate cases are specified as follows:
Number of Point
s in argumentGeometry
Geometry
class of result0 empty GeometryCollection
1 Point
2 LineString
3 or more Polygon
- Returns:
- the minimum-area convex polygon containing this
Geometry
' s points
public boolean coveredBy(Geometry g)
Returnstrue
if this geometry is covered by the specified geometry. ThecoveredBy
predicate has the following equivalent definitions:Note the difference between
- Every point of this geometry is a point of the other geometry.
- The DE-9IM Intersection Matrix for the two geometries is
T*F**F***
or*TF**F***
or**FT*F***
or**F*TF***
g.covers(this)
(coveredBy
is the inverse ofcovers
)coveredBy
andwithin
-coveredBy
is a more inclusive relation
- Parameters:
g
- theGeometry
with which to compare thisGeometry
- Returns:
true
if thisGeometry
is covered byg
- See Also:
within(Geometry)
,covers(Geometry)
public boolean covers(Geometry g)
Returnstrue
if this geometry covers the specified geometry. Thecovers
predicate has the following equivalent definitions:Note the difference between
- Every point of the other geometry is a point of this geometry.
- The DE-9IM Intersection Matrix for the two geometries is
T*****FF*
or*T****FF*
or***T**FF*
or****T*FF*
g.coveredBy(this)
(covers
is the inverse ofcoverdBy
)covers
andcontains
-covers
is a more inclusive relation. In particular, unlikecontains
it does not distinguish between points in the boundary and in the interior of geometries. For most situations,covers
should be used in preference tocontains
. As an added benefit,covers
is more amenable to optimization, and hence should be more performant.
- Parameters:
g
- theGeometry
with which to compare thisGeometry
- Returns:
true
if thisGeometry
coversg
- See Also:
contains(Geometry)
,coveredBy(Geometry)
public boolean crosses(Geometry g)
Returnstrue
if this geometry crosses the specified geometry. Thecrosses
predicate has the following equivalent definitions:For any other combination of dimensions this predicate returns
- The geometries have some but not all interior points in common.
- The DE-9IM Intersection Matrix for the two geometries is
- T*T****** (for P/L, P/A, and L/A situations)
- T*****T** (for L/P, L/A, and A/L situations)
- 0******** (for L/L situations)
false
. The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. JTS extends the definition to apply to L/P, A/P and A/L situations as well. This makes the relation symmetric.
- Parameters:
g
- theGeometry
with which to compare thisGeometry
- Returns:
true
if the twoGeometry
s cross.
public Geometry difference(Geometry other)
Computes aGeometry
representing the points making up thisGeometry
that do not make upother
. This method returns the closure of the resultantGeometry
.
- Parameters:
other
- theGeometry
with which to compute the difference
- Returns:
- the point set difference of this
Geometry
withother
public boolean disjoint(Geometry g)
Returnstrue
if this geometry is disjoint to the specified geometry. Thedisjoint
predicate has the following equivalent definitions:
- The two geometries have no point in common
- The DE-9IM Intersection Matrix for the two geometries is FF*FF****
- !
g.intersects(this)
(disjoint
is the inverse ofintersects
)
- Parameters:
g
- theGeometry
with which to compare thisGeometry
- Returns:
true
if the twoGeometry
s are disjoint
- See Also:
intersects(Geometry)
public double distance(Geometry g)
Returns the minimum distance between thisGeometry
and theGeometry
g
- Parameters:
g
- theGeometry
from which to compute the distance
public boolean equals(Geometry g)
Returnstrue
if this geometry is equal to the specified geometry. Theequals
predicate has the following equivalent definitions:
- The two geometries have at least one point in common, and no point of either geometry lies in the exterior of the other geometry.
- The DE-9IM Intersection Matrix for the two geometries is T*F**FFF*
- Parameters:
- Returns:
true
if the twoGeometry
s are equal
public boolean equalsExact(Geometry other)
Returns true if the twoGeometry
s are exactly equal. Two Geometries are exactly equal iff:If this and the other
- they have the same class
- they have the same values of Coordinates in their internal Coordinate lists, in exactly the same order.
Geometry
s are composites and any children are notGeometry
s, returns false. This provides a stricter test of equality thanequals
.
- Parameters:
other
- theGeometry
with which to compare thisGeometry
- Returns:
true
if this and the otherGeometry
are of the same class and have equal internal data.
public abstract boolean equalsExact(Geometry other, double tolerance)
Returns true if the twoGeometry
s are exactly equal, up to a specified distance tolerance. Two Geometries are exactly equal within a distance tolerance if and only if:If this and the other
- they have the same class
- they have the same values for their vertices, within the given tolerance distance, in exactly the same order.
Geometry
s are composites and any children are notGeometry
s, returnsfalse
.
- Parameters:
other
- theGeometry
with which to compare thisGeometry
- Returns:
true
if this and the otherGeometry
are of the same class and have equal internal data.
public void geometryChanged()
Notifies this Geometry that its Coordinates have been changed by an external party (using a CoordinateFilter, for example). The Geometry will flush and/or update any information it has cached (such as itsEnvelope
).
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.
- See Also:
apply(GeometryComponentFilter)
public double getArea()
Returns the area of thisGeometry
. 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
public abstract Geometry getBoundary()
Returns the boundary, or the empty geometry if thisGeometry
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
public abstract int getBoundaryDimension()
Returns the dimension of thisGeometry
s 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.
public Point getCentroid()
Computes the centroid of thisGeometry
. 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
public abstract Coordinate getCoordinate()
Returns a vertex of thisGeometry
.
- Returns:
- a
Coordinate
which is a vertex of thisGeometry
. Returnsnull
if this Geometry is empty
public abstract Coordinate[] getCoordinates()
Returns thisGeometry
s vertices. If you modify the coordinates in this array, be sure to call #geometryChanged afterwards. TheGeometry
s contained by compositeGeometry
s must be Geometry's; that is, they must implementgetCoordinates
.
- Returns:
- the vertices of this
Geometry
public abstract int getDimension()
Returns the dimension of thisGeometry
.
- Returns:
- the dimension of the class implementing this interface, whether or not this object is the empty geometry
public Geometry getEnvelope()
Returns thisGeometry
s bounding box. If thisGeometry
is the empty geometry, returns an emptyPoint
. If theGeometry
is a point, returns a non-emptyPoint
. Otherwise, returns aPolygon
whose points are (minx, miny), (maxx, miny), (maxx, maxy), (minx, maxy), (minx, miny).
- Returns:
- an empty
Point
(for emptyGeometry
s), aPoint
(forPoint
s) or aPolygon
(in all other cases)
public Envelope getEnvelopeInternal()
Returns the minimum and maximum x and y values in thisGeometry
, or a nullEnvelope
if thisGeometry
is empty.
- Returns:
- this
Geometry
s bounding box; if theGeometry
is empty,Envelope#isNull
will returntrue
public GeometryFactory getFactory()
Gets the factory which contains the context in which this geometry was created.
- Returns:
- the factory for this geometry
public Geometry getGeometryN(int n)
Returns an elementGeometry
from aGeometryCollection
(orthis
, if the geometry is not a collection).
- Parameters:
n
- the index of the geometry element
- Returns:
- the n'th geometry contained in this geometry
public abstract String getGeometryType()
Returns the name of this object'scom.vivid.jts.geom
interface.
- Returns:
- the name of this
Geometry
s most specificcom.vividsolutions.jts.geom
interface
public Point getInteriorPoint()
Computes an interior point of thisGeometry
. 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
public double getLength()
Returns the length of thisGeometry
. 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
public int getNumGeometries()
Returns the number ofGeometry
s in aGeometryCollection
(or 1, if the geometry is not a collection).
- Returns:
- the number of geometries contained in this geometry
public abstract int getNumPoints()
Returns the count of thisGeometry
s vertices. TheGeometry
s contained by compositeGeometry
s must be Geometry's; that is, they must implementgetNumPoints
- Returns:
- the number of vertices in this
Geometry
public PrecisionModel getPrecisionModel()
Returns thePrecisionModel
used by theGeometry
.
- Returns:
- the specification of the grid of allowable points, for this
Geometry
and all otherGeometry
s
public int getSRID()
Returns the ID of the Spatial Reference System used by theGeometry
. JTS supports Spatial Reference System information in the simple way defined in the SFS. A Spatial Reference System ID (SRID) is present in eachGeometry
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.
public Object getUserData()
Gets the user data object for this geometry, if any.
- Returns:
- the user data object, or
null
if none set
protected static boolean hasNonEmptyElements(Geometry[] geometries)
Returns true if the array contains any non-emptyGeometry
s.
- Parameters:
geometries
- an array ofGeometry
s; no elements may benull
- Returns:
true
if any of theGeometry
sisEmpty
methods returnfalse
protected static boolean hasNullElements(Object[] array)
Returns true if the array contains anynull
elements.
- Parameters:
array
- an array to validate
- Returns:
true
if any ofarray
s elements arenull
public Geometry intersection(Geometry other)
Computes aGeometry
representing the points shared by thisGeometry
andother
.
- Parameters:
other
- theGeometry
with which to compute the intersection
- Returns:
- the points common to the two
Geometry
s
public boolean intersects(Geometry g)
Returnstrue
if this geometry intersects the specified geometry. Theintersects
predicate has the following equivalent definitions:
- The two geometries have at least one point in common
- !
g.disjoint(this)
(intersects
is the inverse ofdisjoint
)
- Parameters:
g
- theGeometry
with which to compare thisGeometry
- Returns:
true
if the twoGeometry
s intersect
- See Also:
disjoint(Geometry)
public abstract boolean isEmpty()
Returns whether or not the set of points in thisGeometry
is empty.
- Returns:
true
if thisGeometry
equals the empty geometry
protected boolean isEquivalentClass(Geometry other)
Returns whether the twoGeometry
s are equal, from the point of view of theequalsExact
method. Called byequalsExact
. In general, twoGeometry
classes are considered to be "equivalent" only if they are the same class. An exception isLineString
, which is considered to be equivalent to its subclasses.
- Parameters:
other
- theGeometry
with which to compare thisGeometry
for equality
- Returns:
true
if the classes of the twoGeometry
s are considered to be equal by theequalsExact
method.
public boolean isRectangle()
public abstract boolean isSimple()
Tests whether thisGeometry
is simple. In general, the SFS specification of simplicity follows the rule:Simplicity is defined for each
- A Geometry is simple iff the only self-intersections are at boundary points.
Geometry
subclass as follows:
- Valid polygonal geometries are simple by definition, so
isSimple
trivially returns true.- Linear geometries are simple iff they do not self-intersect at points other than boundary points.
- Zero-dimensional geometries (points) are simple iff they have no repeated points.
- Empty
Geometry
s are always simple
- Returns:
true
if thisGeometry
has any points of self-tangency, self-intersection or other anomalous points
- See Also:
isValid()
public boolean isValid()
Tests the validity of thisGeometry
. Subclasses provide their own definition of "valid".
- Returns:
true
if thisGeometry
is valid
- See Also:
IsValidOp
public boolean isWithinDistance(Geometry geom, double distance)
Tests whether the distance from thisGeometry
to another is less than or equal to a specified value.
- Parameters:
geom
- the Geometry to check the distance todistance
- the distance value to compare
- Returns:
true
if the geometries are less thandistance
apart.
public abstract void normalize()
Converts thisGeometry
to normal form (or canonical form ). Normal form is a unique representation forGeometry
s. It can be used to test whether twoGeometry
s 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.
public boolean overlaps(Geometry g)
Returnstrue
if this geometry overlaps the specified geometry. Theoverlaps
predicate has the following equivalent definitions:If the geometries are of different dimension this predicate returns
- The geometries have some but not all points in common, they have the same dimension, and the intersection of the interiors of the two geometries has the same dimension as the geometries themselves.
- The DE-9IM Intersection Matrix for the two geometries is
T*T***T**
(for two points or two surfaces) or1*T***T**
(for two curves)false
.
- Parameters:
g
- theGeometry
with which to compare thisGeometry
- Returns:
true
if the twoGeometry
s overlap.
public IntersectionMatrix relate(Geometry g)
Returns the DE-9IMIntersectionMatrix
for the twoGeometry
s.
- Parameters:
- Returns:
- an
IntersectionMatrix
describing the intersections of the interiors, boundaries and exteriors of the twoGeometry
s
public boolean relate(Geometry g, String intersectionPattern)
Returnstrue
if the elements in the DE-9IMIntersectionMatrix
for the twoGeometry
s match the elements inintersectionPattern
. The pattern is a 9-character string, with symbols drawn from the following set:For more information on the DE-9IM, see the OpenGIS Simple Features Specification.
- 0 (dimension 0)
- 1 (dimension 1)
- 2 (dimension 2)
- T ( matches 0, 1 or 2)
- F ( matches FALSE)
- * ( matches any value)
- Parameters:
intersectionPattern
- the pattern against which to check the intersection matrix for the twoGeometry
s
- Returns:
true
if the DE-9IM intersection matrix for the twoGeometry
s matchintersectionPattern
- See Also:
IntersectionMatrix
public void setSRID(int SRID)
Sets the ID of the Spatial Reference System used by theGeometry
.
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
public Geometry symDifference(Geometry other)
Returns a set combining the points in thisGeometry
not inother
, and the points inother
not in thisGeometry
. This method returns the closure of the resultantGeometry
.
- Parameters:
other
- theGeometry
with which to compute the symmetric difference
- Returns:
- the point set symmetric difference of this
Geometry
withother
public String toString()
public String toText()
Returns the Well-known Text representation of thisGeometry
. For a definition of the Well-known Text format, see the OpenGIS Simple Features Specification.
- Returns:
- the Well-known Text representation of this
Geometry
public boolean touches(Geometry g)
Returnstrue
if this geometry touches the specified geometry. Thetouches
predicate has the following equivalent definitions:If both geometries have dimension 0, this predicate returns
- The geometries have at least one point in common, but their interiors do not intersect.
- The DE-9IM Intersection Matrix for the two geometries is FT*******, F**T***** or F***T****
false
- Parameters:
g
- theGeometry
with which to compare thisGeometry
- Returns:
true
if the twoGeometry
s touch; Returnsfalse
if bothGeometry
s are points
public Geometry union(Geometry other)
Computes aGeometry
representing all the points in thisGeometry
andother
.
- Parameters:
other
- theGeometry
with which to compute the union
- Returns:
- a set combining the points of this
Geometry
and the points ofother
public boolean within(Geometry g)
Returnstrue
if this geometry is within the specified geometry. Thewithin
predicate has the following equivalent definitions:An implication of the definition is that "The boundary of a Polygon is not within the Polygon". In other words, if a geometry G is a subset of the points in the boundary of a polygon P,
- Every point of this geometry is a point of the other geometry, and the interiors of the two geometries have at least one point in common.
- The DE-9IM Intersection Matrix for the two geometries is T*F**F***
g.contains(this)
(within
is the inverse ofcontains
)G.within(P) = false
- Parameters:
g
- theGeometry
with which to compare thisGeometry
- Returns:
true
if thisGeometry
is withinother
- See Also:
contains(Geometry)