public class SimplePointInAreaLocator extends java.lang.Object implements PointOnGeometryLocator
Polygonal
Geometry
,
using a simple O(n) algorithm.
This algorithm is suitable for use in cases where
only one or a few points will be tested against a given area.
The algorithm used is only guaranteed to return correct results for points which are not on the boundary of the Geometry.
Constructor and Description |
---|
SimplePointInAreaLocator(Geometry geom) |
Modifier and Type | Method and Description |
---|---|
static boolean |
containsPointInPolygon(Coordinate p,
Polygon poly)
Determines whether a point lies in a
Polygon . |
int |
locate(Coordinate p)
|
static int |
locate(Coordinate p,
Geometry geom)
|
private static int |
locateInGeometry(Coordinate p,
Geometry geom) |
static int |
locatePointInPolygon(Coordinate p,
Polygon poly)
|
private static int |
locatePointInRing(Coordinate p,
LinearRing ring)
Determines whether a point lies in a LinearRing,
using the ring envelope to short-circuit if possible.
|
private Geometry geom
public SimplePointInAreaLocator(Geometry geom)
public static int locate(Coordinate p, Geometry geom)
Location
of a point in an areal Geometry
.
Computes Location.BOUNDARY
if the point lies exactly
on a geometry line segment.p
- the point to testgeom
- the areal geometry to testprivate static int locateInGeometry(Coordinate p, Geometry geom)
public static int locatePointInPolygon(Coordinate p, Polygon poly)
Location
of a point in a Polygon
.
Computes Location.BOUNDARY
if the point lies exactly
on the polygon boundary.p
- the point to testpoly
- the geometry to testpublic static boolean containsPointInPolygon(Coordinate p, Polygon poly)
Polygon
.
If the point lies on the polygon boundary it is
considered to be inside.p
- the point to testpoly
- the geometry to testprivate static int locatePointInRing(Coordinate p, LinearRing ring)
p
- the point to testring
- a linear ringpublic int locate(Coordinate p)
PointOnGeometryLocator
locate
in interface PointOnGeometryLocator
p
- the point to test