Class SimplePointInAreaLocator
java.lang.Object
org.locationtech.jts.algorithm.locate.SimplePointInAreaLocator
- All Implemented Interfaces:
PointOnGeometryLocator
Computes the location of points
relative to a
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.
- Version:
- 1.7
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
containsPointInPolygon
(Coordinate p, Polygon poly) Determines whether a point lies in aPolygon
.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.
-
Field Details
-
geom
-
-
Constructor Details
-
SimplePointInAreaLocator
-
-
Method Details
-
locate
Determines theLocation
of a point in an arealGeometry
. Computesinvalid reference
Location.BOUNDARY
- Parameters:
p
- the point to testgeom
- the areal geometry to test- Returns:
- the Location of the point in the geometry
-
locateInGeometry
-
locatePointInPolygon
Determines theLocation
of a point in aPolygon
. Computesinvalid reference
Location.BOUNDARY
- Parameters:
p
- the point to testpoly
- the geometry to test- Returns:
- the Location of the point in the polygon
-
containsPointInPolygon
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
-
locatePointInRing
Determines whether a point lies in a LinearRing, using the ring envelope to short-circuit if possible.- Parameters:
p
- the point to testring
- a linear ring- Returns:
- true if the point lies inside the ring
-
locate
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
-