Class SimplePointInAreaLocator
- java.lang.Object
-
- org.locationtech.jts.algorithm.locate.SimplePointInAreaLocator
-
- All Implemented Interfaces:
PointOnGeometryLocator
public class SimplePointInAreaLocator extends java.lang.Object implements PointOnGeometryLocator
Computes the location of points relative to aPolygonal
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.
- Version:
- 1.7
-
-
Constructor Summary
Constructors Constructor Description SimplePointInAreaLocator(Geometry geom)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
containsPointInPolygon(Coordinate p, Polygon poly)
Determines whether a point lies in aPolygon
.int
locate(Coordinate p)
static int
locate(Coordinate p, Geometry geom)
static int
locatePointInPolygon(Coordinate p, Polygon poly)
-
-
-
Constructor Detail
-
SimplePointInAreaLocator
public SimplePointInAreaLocator(Geometry geom)
-
-
Method Detail
-
locate
public static int locate(Coordinate p, Geometry geom)
Determines theLocation
of a point in an arealGeometry
. ComputesLocation.BOUNDARY
if the point lies exactly on a geometry line segment.- Parameters:
p
- the point to testgeom
- the areal geometry to test- Returns:
- the Location of the point in the geometry
-
locatePointInPolygon
public static int locatePointInPolygon(Coordinate p, Polygon poly)
Determines theLocation
of a point in aPolygon
. ComputesLocation.BOUNDARY
if the point lies exactly on the polygon boundary.- Parameters:
p
- the point to testpoly
- the geometry to test- Returns:
- the Location of the point in the polygon
-
containsPointInPolygon
public static boolean containsPointInPolygon(Coordinate p, Polygon poly)
Determines whether a point lies in aPolygon
. If the point lies on the polygon boundary it is considered to be inside.- Parameters:
p
- the point to testpoly
- the geometry to test- Returns:
- true if the point lies in or on the polygon
-
locate
public int locate(Coordinate p)
Description copied from interface:PointOnGeometryLocator
- Specified by:
locate
in interfacePointOnGeometryLocator
- Parameters:
p
- the point to test- Returns:
- the location of the point in the geometry
-
-