Package org.locationtech.jts.algorithm
Class PointLocator
- java.lang.Object
-
- org.locationtech.jts.algorithm.PointLocator
-
public class PointLocator extends java.lang.ObjectComputes the topological (Location) of a single point to aGeometry. ABoundaryNodeRulemay be specified to control the evaluation of whether the point lies on the boundary or not The default rule is to use the the SFS Boundary Determination RuleNotes:
LinearRings do not enclose any area - points inside the ring are still in the EXTERIOR of the ring.
- Version:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description private BoundaryNodeRuleboundaryRuleprivate booleanisInprivate intnumBoundaries
-
Constructor Summary
Constructors Constructor Description PointLocator()PointLocator(BoundaryNodeRule boundaryRule)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcomputeLocation(Coordinate p, Geometry geom)booleanintersects(Coordinate p, Geometry geom)Convenience method to test a point for intersection with a Geometryintlocate(Coordinate p, Geometry geom)Computes the topological relationship (Location) of a single point to a Geometry.private intlocateInPolygon(Coordinate p, Polygon poly)private intlocateInPolygonRing(Coordinate p, LinearRing ring)private intlocateOnLineString(Coordinate p, LineString l)private intlocateOnPoint(Coordinate p, Point pt)private voidupdateLocationInfo(int loc)
-
-
-
Field Detail
-
boundaryRule
private BoundaryNodeRule boundaryRule
-
isIn
private boolean isIn
-
numBoundaries
private int numBoundaries
-
-
Constructor Detail
-
PointLocator
public PointLocator()
-
PointLocator
public PointLocator(BoundaryNodeRule boundaryRule)
-
-
Method Detail
-
intersects
public boolean intersects(Coordinate p, Geometry geom)
Convenience method to test a point for intersection with a Geometry- Parameters:
p- the coordinate to testgeom- the Geometry to test- Returns:
trueif the point is in the interior or boundary of the Geometry
-
locate
public int locate(Coordinate p, Geometry geom)
Computes the topological relationship (Location) of a single point to a Geometry. It handles both single-element and multi-element Geometries. The algorithm for multi-part Geometries takes into account the SFS Boundary Determination Rule.- Returns:
- the
Locationof the point relative to the input Geometry
-
computeLocation
private void computeLocation(Coordinate p, Geometry geom)
-
updateLocationInfo
private void updateLocationInfo(int loc)
-
locateOnPoint
private int locateOnPoint(Coordinate p, Point pt)
-
locateOnLineString
private int locateOnLineString(Coordinate p, LineString l)
-
locateInPolygonRing
private int locateInPolygonRing(Coordinate p, LinearRing ring)
-
locateInPolygon
private int locateInPolygon(Coordinate p, Polygon poly)
-
-