Package org.locationtech.jts.algorithm
Class PointLocation
java.lang.Object
org.locationtech.jts.algorithm.PointLocation
Functions for locating points within basic geometric
structures such as line segments, lines and rings.
- Author:
- Martin Davis
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isInRing
(Coordinate p, Coordinate[] ring) Tests whether a point lies inside or on a ring.static boolean
isOnLine
(Coordinate p, Coordinate[] line) Tests whether a point lies on the line defined by a list of coordinates.static boolean
isOnLine
(Coordinate p, CoordinateSequence line) Tests whether a point lies on the line defined by aCoordinateSequence
.static boolean
isOnSegment
(Coordinate p, Coordinate p0, Coordinate p1) Tests whether a point lies on a line segment.static int
locateInRing
(Coordinate p, Coordinate[] ring) Determines whether a point lies in the interior, on the boundary, or in the exterior of a ring.
-
Constructor Details
-
PointLocation
public PointLocation()
-
-
Method Details
-
isOnSegment
Tests whether a point lies on a line segment.- Parameters:
p
- the point to testp0
- a point of the line segmentp1
- a point of the line segment- Returns:
- true if the point lies on the line segment
-
isOnLine
Tests whether a point lies on the line defined by a list of coordinates.- Parameters:
p
- the point to testline
- the line coordinates- Returns:
- true if the point is a vertex of the line or lies in the interior of a line segment in the line
-
isOnLine
Tests whether a point lies on the line defined by aCoordinateSequence
.- Parameters:
p
- the point to testline
- the line coordinates- Returns:
- true if the point is a vertex of the line or lies in the interior of a line segment in the line
-
isInRing
Tests whether a point lies inside or on a ring. The ring may be oriented in either direction. A point lying exactly on the ring boundary is considered to be inside the ring.This method does not first check the point against the envelope of the ring.
- Parameters:
p
- point to check for ring inclusionring
- an array of coordinates representing the ring (which must have first point identical to last point)- Returns:
- true if p is inside ring
- See Also:
-
locateInRing
Determines whether a point lies in the interior, on the boundary, or in the exterior of a ring. The ring may be oriented in either direction.This method does not first check the point against the envelope of the ring.
- Parameters:
p
- point to check for ring inclusionring
- an array of coordinates representing the ring (which must have first point identical to last point)- Returns:
- the
Location
of p relative to the ring
-