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.
The algorithm used reports if a point lies in the interior, exterior, or exactly on the boundary of the Geometry.
Instance methods are provided to implement
the interface
.
However, they provide no performance
advantage over the class methods.
invalid reference
PointInAreaLocator
This algorithm is suitable for use in cases where
only a few points will be tested.
If many points will be tested,
IndexedPointInAreaLocator may provide better performance.
- Version:
- 1.7
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an instance of a point-in-area locator, using the provided areal geometry. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsPointInPolygon(Coordinate p, Polygon poly) Determines whether a point lies in aPolygon.static booleanisContained(Coordinate p, Geometry geom) Determines whether a point is contained in aGeometry, or lies on its boundary.intlocate(Coordinate p) static intlocate(Coordinate p, Geometry geom) static intlocatePointInPolygon(Coordinate p, Polygon poly)
-
Constructor Details
-
SimplePointInAreaLocator
Create an instance of a point-in-area locator, using the provided areal geometry.- Parameters:
geom- the areal geometry to locate in
-
-
Method Details
-
locate
Determines theLocationof a point in an arealGeometry. The return value is one of:-
if the point is in the geometry interior
invalid reference
Location.INTERIOR -
if the point lies exactly on the boundary
invalid reference
Location.BOUNDARY -
if the point is outside the geometry
invalid reference
Location.EXTERIOR
- Parameters:
p- the point to testgeom- the areal geometry to test- Returns:
- the Location of the point in the geometry
-
-
isContained
Determines whether a point is contained in aGeometry, or lies on its boundary. This is a convenience method forLocation.EXTERIOR != locate(p, geom)
- Parameters:
p- the point to testgeom- the geometry to test- Returns:
- true if the point lies in or on the geometry
-
locatePointInPolygon
Determines theLocationof a point in aPolygon. The return value is one of:-
if the point is in the geometry interior
invalid reference
Location.INTERIOR -
if the point lies exactly on the boundary
invalid reference
Location.BOUNDARY -
if the point is outside the geometry
invalid reference
Location.EXTERIOR
locate(Coordinate, Geometry)instead.- 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
-
locate
Determines theLocationof a point in an arealGeometry. The return value is one of:-
if the point is in the geometry interior
invalid reference
Location.INTERIOR -
if the point lies exactly on the boundary
invalid reference
Location.BOUNDARY -
if the point is outside the geometry
invalid reference
Location.EXTERIOR
- Specified by:
locatein interfacePointOnGeometryLocator- Parameters:
p- the point to test- Returns:
- the Location of the point in the geometry
-
-