Package org.locationtech.jts.geom.prep
Class AbstractPreparedPolygonContains
- java.lang.Object
-
- org.locationtech.jts.geom.prep.PreparedPolygonPredicate
-
- org.locationtech.jts.geom.prep.AbstractPreparedPolygonContains
-
- Direct Known Subclasses:
PreparedPolygonContains
,PreparedPolygonCovers
abstract class AbstractPreparedPolygonContains extends PreparedPolygonPredicate
A base class containing the logic for computes the contains and covers spatial relationship predicates for aPreparedPolygon
relative to all otherGeometry
classes. Uses short-circuit tests and indexing to improve performance.Contains and covers are very similar, and differ only in how certain cases along the boundary are handled. These cases require full topological evaluation to handle, so all the code in this class is common to both predicates.
It is not possible to short-circuit in all cases, in particular in the case where line segments of the test geometry touches the polygon linework. In this case full topology must be computed. (However, if the test geometry consists of only points, this can be evaluated in an optimized fashion.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
hasNonProperIntersection
private boolean
hasProperIntersection
private boolean
hasSegmentIntersection
protected boolean
requireSomePointInInterior
This flag controls a difference between contains and covers.-
Fields inherited from class org.locationtech.jts.geom.prep.PreparedPolygonPredicate
prepPoly
-
-
Constructor Summary
Constructors Constructor Description AbstractPreparedPolygonContains(PreparedPolygon prepPoly)
Creates an instance of this operation.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
eval(Geometry geom)
Evaluate the contains or covers relationship for the given geometry.private void
findAndClassifyIntersections(Geometry geom)
protected abstract boolean
fullTopologicalPredicate(Geometry geom)
Computes the full topological predicate.private boolean
isProperIntersectionImpliesNotContainedSituation(Geometry testGeom)
private boolean
isSingleShell(Geometry geom)
Tests whether a geometry consists of a single polygon with no holes.-
Methods inherited from class org.locationtech.jts.geom.prep.PreparedPolygonPredicate
isAllTestComponentsInTarget, isAllTestComponentsInTargetInterior, isAnyTargetComponentInAreaTest, isAnyTestComponentInTarget, isAnyTestComponentInTargetInterior
-
-
-
-
Field Detail
-
requireSomePointInInterior
protected boolean requireSomePointInInterior
This flag controls a difference between contains and covers. For contains the value is true. For covers the value is false.
-
hasSegmentIntersection
private boolean hasSegmentIntersection
-
hasProperIntersection
private boolean hasProperIntersection
-
hasNonProperIntersection
private boolean hasNonProperIntersection
-
-
Constructor Detail
-
AbstractPreparedPolygonContains
public AbstractPreparedPolygonContains(PreparedPolygon prepPoly)
Creates an instance of this operation.- Parameters:
prepPoly
- the PreparedPolygon to evaluate
-
-
Method Detail
-
eval
protected boolean eval(Geometry geom)
Evaluate the contains or covers relationship for the given geometry.- Parameters:
geom
- the test geometry- Returns:
- true if the test geometry is contained
-
isProperIntersectionImpliesNotContainedSituation
private boolean isProperIntersectionImpliesNotContainedSituation(Geometry testGeom)
-
isSingleShell
private boolean isSingleShell(Geometry geom)
Tests whether a geometry consists of a single polygon with no holes.- Returns:
- true if the geometry is a single polygon with no holes
-
findAndClassifyIntersections
private void findAndClassifyIntersections(Geometry geom)
-
fullTopologicalPredicate
protected abstract boolean fullTopologicalPredicate(Geometry geom)
Computes the full topological predicate. Used when short-circuit tests are not conclusive.- Parameters:
geom
- the test geometry- Returns:
- true if this prepared polygon has the relationship with the test geometry
-
-