Class SimplePointInAreaLocator

Hierarchy: Object , SimplePointInAreaLocator
All Implemented Interfaces: PointOnGeometryLocator
public class SimplePointInAreaLocator
implements 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 PointInAreaLocator. However, they provide no performance advantage over the class methods.

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.

Other

  • version: 1.7
public SimplePointInAreaLocator(Geometry geom)
Create an instance of a point-in-area locator, using the provided areal geometry.
Parameters:
geom - geom the areal geometry to locate in
public static int locate(Coordinate p, Geometry geom)
Determines the Location of a point in an areal Geometry. The return value is one of:
Parameters:
p - p the point to test
geom - geom the areal geometry to test
Returns:
the Location of the point in the geometry
public static boolean isContained(Coordinate p, Geometry geom)
Determines whether a point is contained in a Geometry, or lies on its boundary. This is a convenience method for
  Location.EXTERIOR != locate(p, geom)
 
Parameters:
p - p the point to test
geom - geom the geometry to test
Returns:
true if the point lies in or on the geometry
public static int locatePointInPolygon(Coordinate p, Polygon poly)
Determines the Location of a point in a Polygon. The return value is one of: This method is provided for backwards compatibility only. Use locate(Coordinate, Geometry) instead.
Parameters:
p - p the point to test
poly - poly the geometry to test
Returns:
the Location of the point in the polygon
public static boolean containsPointInPolygon(Coordinate p, Polygon poly)
Determines whether a point lies in a Polygon. If the point lies on the polygon boundary it is considered to be inside.
Parameters:
p - p the point to test
poly - poly the geometry to test
Returns:
true if the point lies in or on the polygon
public int locate(Coordinate p)
Determines the Location of a point in an areal Geometry. The return value is one of:
Parameters:
p - p the point to test
Returns:
the Location of the point in the geometry