Interface RelatePredicate
RelateNG.- Author:
- Martin Davis
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic TopologyPredicatecontains()Creates a predicate to determine whether a geometry contains another geometry.static TopologyPredicateCreates a predicate to determine whether a geometry is covered by another geometry.static TopologyPredicatecovers()Creates a predicate to determine whether a geometry covers another geometry.static TopologyPredicatecrosses()Creates a predicate to determine whether a geometry crosses another geometry.static TopologyPredicatedisjoint()Creates a predicate to determine whether two geometries are disjoint.static TopologyPredicateCreates a predicate to determine whether two geometries are topologically equal.static TopologyPredicateCreates a predicate to determine whether two geometries intersect.static TopologyPredicateCreates a predicate that matches a DE-9IM matrix pattern.static TopologyPredicateoverlaps()Creates a predicate to determine whether a geometry overlaps another geometry.static TopologyPredicatetouches()Creates a predicate to determine whether a geometry touches another geometry.static TopologyPredicatewithin()Creates a predicate to determine whether a geometry is within another geometry.
-
Method Details
-
intersects
Creates a predicate to determine whether two geometries intersect.The
intersectspredicate 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
(intersectsis the inverse ofdisjoint)
- Returns:
- the predicate instance
- See Also:
-
disjoint
Creates a predicate to determine whether two geometries are disjoint.The
disjointpredicate 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
(disjointis the inverse ofintersects)
- Returns:
- the predicate instance
- See Also:
-
contains
Creates a predicate to determine whether a geometry contains another geometry.The
containspredicate 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
(containsis 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
Creates a predicate to determine whether a geometry is within another geometry.The
withinpredicate 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
(withinis 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:
-
covers
Creates a predicate to determine whether a geometry covers another geometry.The
coverspredicate 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
(coversis the converse ofcoveredBy())
false.This predicate is similar to
contains(), but is more inclusive (i.e. returnstruefor more cases). In particular, unlikecontainsit does not distinguish between points in the boundary and in the interior of geometries. For most cases,coversshould be used in preference tocontains. As an added benefit,coversis more amenable to optimization, and hence should be more performant.- Returns:
- the predicate instance
- See Also:
-
coveredBy
Creates a predicate to determine whether a geometry is covered by another geometry.The
coveredBypredicate 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
(coveredByis the converse ofcovers())
false.This predicate is similar to
within(), but is more inclusive (i.e. returnstruefor more cases).- Returns:
- the predicate instance
- See Also:
-
crosses
Creates a predicate to determine whether a geometry crosses another geometry.The
crossespredicate 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
Creates a predicate to determine whether two geometries are topologically equal.The
equalspredicate 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
Creates a predicate to determine whether a geometry overlaps another geometry.The
overlapspredicate 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
Creates a predicate to determine whether a geometry touches another geometry.The
touchespredicate 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
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:
-