Interface RelatePredicate
-
public interface RelatePredicate
Creates predicate instances for evaluating OGC-standard named topological relationships. Predicates can be evaluated for geometries usingRelateNG
.- Author:
- Martin Davis
-
-
Method Summary
Static Methods Modifier and Type Method Description static TopologyPredicate
contains()
Creates a predicate to determine whether a geometry contains another geometry.static TopologyPredicate
coveredBy()
Creates a predicate to determine whether a geometry is covered by another geometry.static TopologyPredicate
covers()
Creates a predicate to determine whether a geometry covers another geometry.static TopologyPredicate
crosses()
Creates a predicate to determine whether a geometry crosses another geometry.static TopologyPredicate
disjoint()
Creates a predicate to determine whether two geometries are disjoint.static TopologyPredicate
equalsTopo()
Creates a predicate to determine whether two geometries are topologically equal.static TopologyPredicate
intersects()
Creates a predicate to determine whether two geometries intersect.static TopologyPredicate
matches(String imPattern)
Creates a predicate that matches a DE-9IM matrix pattern.static TopologyPredicate
overlaps()
Creates a predicate to determine whether a geometry overlaps another geometry.static TopologyPredicate
touches()
Creates a predicate to determine whether a geometry touches another geometry.static TopologyPredicate
within()
Creates a predicate to determine whether a geometry is within another geometry.
-
-
-
Method Detail
-
intersects
static TopologyPredicate intersects()
Creates a predicate to determine whether two geometries intersect.The
intersects
predicate has the following equivalent definitions:- The two geometries have at least one point in common
- The DE-9IM Intersection Matrix for the two geometries matches
at least one of the patterns
[T********]
[*T*******]
[***T*****]
[****T****]
disjoint() = false
(intersects
is the inverse ofdisjoint
)
- Returns:
- the predicate instance
- See Also:
disjoint()
-
disjoint
static TopologyPredicate disjoint()
Creates a predicate to determine whether two geometries are disjoint.The
disjoint
predicate has the following equivalent definitions:- The two geometries have no point in common
- The DE-9IM Intersection Matrix for the two geometries matches
[FF*FF****]
intersects() = false
(disjoint
is the inverse ofintersects
)
- Returns:
- the predicate instance
- See Also:
intersects()
-
contains
static TopologyPredicate contains()
Creates a predicate to determine whether a geometry contains another geometry.The
contains
predicate has the following equivalent definitions:- 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 matches
the pattern
[T*****FF*]
within(B, A) = true
(contains
is the converse ofwithin()
)
B.contains(A) = false
. (As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.) For a predicate with similar behavior but avoiding this subtle limitation, seecovers()
.- Returns:
- the predicate instance
- See Also:
within()
-
within
static TopologyPredicate within()
Creates a predicate to determine whether a geometry is within another geometry.The
within
predicate has the following equivalent definitions:- 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 matches
[T*F**F***]
contains(B, A) = true
(within
is the converse ofcontains()
)
within(B, A) = false
(As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.) For a predicate with similar behavior but avoiding this subtle limitation, seecoveredBy()
.- Returns:
- the predicate instance
- See Also:
contains()
-
covers
static TopologyPredicate covers()
Creates a predicate to determine whether a geometry covers another geometry.The
covers
predicate has the following equivalent definitions:- Every point of the other geometry is a point of this geometry.
- The DE-9IM Intersection Matrix for the two geometries matches
at least one of the following patterns:
[T*****FF*]
[*T****FF*]
[***T**FF*]
[****T*FF*]
coveredBy(b, a) = true
(covers
is the converse ofcoveredBy()
)
false
.This predicate is similar to
contains()
, but is more inclusive (i.e. returnstrue
for more cases). In particular, unlikecontains
it does not distinguish between points in the boundary and in the interior of geometries. For most cases,covers
should be used in preference tocontains
. As an added benefit,covers
is more amenable to optimization, and hence should be more performant.- Returns:
- the predicate instance
- See Also:
coveredBy()
-
coveredBy
static TopologyPredicate coveredBy()
Creates a predicate to determine whether a geometry is covered by another geometry.The
coveredBy
predicate has the following equivalent definitions:- Every point of this geometry is a point of the other geometry.
- The DE-9IM Intersection Matrix for the two geometries matches
at least one of the following patterns:
[T*F**F***]
[*TF**F***]
[**FT*F***]
[**F*TF***]
covers(B, A) = true
(coveredBy
is the converse ofcovers()
)
false
.This predicate is similar to
within()
, but is more inclusive (i.e. returnstrue
for more cases).- Returns:
- the predicate instance
- See Also:
covers()
-
crosses
static TopologyPredicate crosses()
Creates a predicate to determine whether a geometry crosses another geometry.The
crosses
predicate has the following equivalent definitions:- The geometries have some but not all interior points in common.
- The DE-9IM Intersection Matrix for the two geometries matches
one of the following patterns:
[T*T******]
(for P/L, P/A, and L/A cases)[T*****T**]
(for L/P, A/P, and A/L cases)[0********]
(for L/L cases)
false
.The SFS defined this predicate only for P/L, P/A, L/L, and L/A cases. To make the relation symmetric JTS extends the definition to apply to L/P, A/P and A/L cases as well.
- Returns:
- the predicate instance
-
equalsTopo
static TopologyPredicate equalsTopo()
Creates a predicate to determine whether two geometries are topologically equal.The
equals
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 matches
the pattern
T*F**FFF*
- Returns:
- the predicate instance
-
overlaps
static TopologyPredicate overlaps()
Creates a predicate to determine whether a geometry overlaps another geometry.The
overlaps
predicate has the following equivalent definitions:- The geometries have at least one point each not shared by the other (or equivalently neither covers the other), 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 matches
[T*T***T**]
(for P/P and A/A cases) or[1*T***T**]
(for L/L cases)
false
. This predicate is symmetric.- Returns:
- the predicate instance
-
touches
static TopologyPredicate touches()
Creates a predicate to determine whether a geometry touches another geometry.The
touches
predicate has the following equivalent definitions:- The geometries have at least one point in common, but their interiors do not intersect.
- The DE-9IM Intersection Matrix for the two geometries matches
at least one of the following patterns
[FT*******]
[F**T*****]
[F***T****]
false
, since points have only interiors. This predicate is symmetric.- Returns:
- the predicate instance
-
matches
static TopologyPredicate matches(String imPattern)
Creates a predicate that matches a DE-9IM matrix pattern.- Parameters:
imPattern
- the pattern to match- Returns:
- a predicate that matches the pattern
- See Also:
IntersectionMatrixPattern
-
-