Class RectangleContains
- java.lang.Object
-
- org.locationtech.jts.operation.predicate.RectangleContains
-
public class RectangleContains extends java.lang.ObjectOptimized implementation of the contains spatial predicate for cases where the firstGeometryis a rectangle. This class works for all input geometries, includingGeometryCollections.As a further optimization, this class can be used to test many geometries against a single rectangle in a slightly more efficient way.
- Version:
- 1.7
-
-
Constructor Summary
Constructors Constructor Description RectangleContains(Polygon rectangle)Create a new contains computer for two geometries.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Geometry geom)static booleancontains(Polygon rectangle, Geometry b)Tests whether a rectangle contains a given geometry.private booleanisContainedInBoundary(Geometry geom)private booleanisLineSegmentContainedInBoundary(Coordinate p0, Coordinate p1)Tests if a line segment is contained in the boundary of the target rectangle.private booleanisLineStringContainedInBoundary(LineString line)Tests if a linestring is completely contained in the boundary of the target rectangle.private booleanisPointContainedInBoundary(Coordinate pt)Tests if a point is contained in the boundary of the target rectangle.private booleanisPointContainedInBoundary(Point point)
-
-
-
Field Detail
-
rectEnv
private Envelope rectEnv
-
-
Constructor Detail
-
RectangleContains
public RectangleContains(Polygon rectangle)
Create a new contains computer for two geometries.- Parameters:
rectangle- a rectangular geometry
-
-
Method Detail
-
contains
public static boolean contains(Polygon rectangle, Geometry b)
Tests whether a rectangle contains a given geometry.- Parameters:
rectangle- a rectangular Polygonb- a Geometry of any type- Returns:
- true if the geometries intersect
-
contains
public boolean contains(Geometry geom)
-
isContainedInBoundary
private boolean isContainedInBoundary(Geometry geom)
-
isPointContainedInBoundary
private boolean isPointContainedInBoundary(Point point)
-
isPointContainedInBoundary
private boolean isPointContainedInBoundary(Coordinate pt)
Tests if a point is contained in the boundary of the target rectangle.- Parameters:
pt- the point to test- Returns:
- true if the point is contained in the boundary
-
isLineStringContainedInBoundary
private boolean isLineStringContainedInBoundary(LineString line)
Tests if a linestring is completely contained in the boundary of the target rectangle.- Parameters:
line- the linestring to test- Returns:
- true if the linestring is contained in the boundary
-
isLineSegmentContainedInBoundary
private boolean isLineSegmentContainedInBoundary(Coordinate p0, Coordinate p1)
Tests if a line segment is contained in the boundary of the target rectangle.- Parameters:
p0- an endpoint of the segmentp1- an endpoint of the segment- Returns:
- true if the line segment is contained in the boundary
-
-