public class RectangleContains
extends java.lang.Object
Geometry
is a rectangle.
This class works for all input geometries, including
GeometryCollection
s.
As a further optimization, this class can be used to test many geometries against a single rectangle in a slightly more efficient way.
Constructor and Description |
---|
RectangleContains(Polygon rectangle)
Create a new contains computer for two geometries.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Geometry geom) |
static boolean |
contains(Polygon rectangle,
Geometry b)
Tests whether a rectangle contains a given geometry.
|
private boolean |
isContainedInBoundary(Geometry geom) |
private boolean |
isLineSegmentContainedInBoundary(Coordinate p0,
Coordinate p1)
Tests if a line segment is contained in the boundary of the target rectangle.
|
private boolean |
isLineStringContainedInBoundary(LineString line)
Tests if a linestring is completely contained in the boundary of the target rectangle.
|
private boolean |
isPointContainedInBoundary(Coordinate pt)
Tests if a point is contained in the boundary of the target rectangle.
|
private boolean |
isPointContainedInBoundary(Point point) |
private Envelope rectEnv
public RectangleContains(Polygon rectangle)
rectangle
- a rectangular geometrypublic static boolean contains(Polygon rectangle, Geometry b)
rectangle
- a rectangular Polygonb
- a Geometry of any typepublic boolean contains(Geometry geom)
private boolean isContainedInBoundary(Geometry geom)
private boolean isPointContainedInBoundary(Point point)
private boolean isPointContainedInBoundary(Coordinate pt)
pt
- the point to testprivate boolean isLineStringContainedInBoundary(LineString line)
line
- the linestring to testprivate boolean isLineSegmentContainedInBoundary(Coordinate p0, Coordinate p1)
p0
- an endpoint of the segmentp1
- an endpoint of the segment