Package org.locationtech.jts.noding
Class SegmentIntersectionDetector
java.lang.Object
org.locationtech.jts.noding.SegmentIntersectionDetector
- All Implemented Interfaces:
SegmentIntersector
Detects and records an intersection between two
SegmentString
s,
if one exists. Only a single intersection is recorded.
This strategy can be configured to search for proper intersections.
In this case, the presence of any kind of intersection will still be recorded,
but searching will continue until either a proper intersection has been found
or no intersections are detected.- Version:
- 1.7
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an intersection finder using aRobustLineIntersector
.Creates an intersection finder using a given LineIntersector. -
Method Summary
Modifier and TypeMethodDescriptionGets the computed location of the intersection.Gets the endpoints of the intersecting segments.boolean
Tests whether an intersection was found.boolean
Tests whether a non-proper intersection was found.boolean
Tests whether a proper intersection was found.boolean
isDone()
Tests whether processing can terminate, because all required information has been obtained (e.g. an intersection of the desired type has been detected).void
processIntersections
(SegmentString e0, int segIndex0, SegmentString e1, int segIndex1) This method is called by clients of theSegmentIntersector
class to process intersections for two segments of theSegmentString
s being intersected.void
setFindAllIntersectionTypes
(boolean findAllTypes) Sets whether processing can terminate once any intersection is found.void
setFindProper
(boolean findProper) Sets whether processing must continue until a proper intersection is found.
-
Constructor Details
-
SegmentIntersectionDetector
public SegmentIntersectionDetector()Creates an intersection finder using aRobustLineIntersector
. -
SegmentIntersectionDetector
Creates an intersection finder using a given LineIntersector.- Parameters:
li
- the LineIntersector to use
-
-
Method Details
-
setFindProper
public void setFindProper(boolean findProper) Sets whether processing must continue until a proper intersection is found.- Parameters:
findProper
- true if processing should continue until a proper intersection is found
-
setFindAllIntersectionTypes
public void setFindAllIntersectionTypes(boolean findAllTypes) Sets whether processing can terminate once any intersection is found.- Parameters:
findAllTypes
- true if processing can terminate once any intersection is found.
-
hasIntersection
public boolean hasIntersection()Tests whether an intersection was found.- Returns:
- true if an intersection was found
-
hasProperIntersection
public boolean hasProperIntersection()Tests whether a proper intersection was found.- Returns:
- true if a proper intersection was found
-
hasNonProperIntersection
public boolean hasNonProperIntersection()Tests whether a non-proper intersection was found.- Returns:
- true if a non-proper intersection was found
-
getIntersection
Gets the computed location of the intersection. Due to round-off, the location may not be exact.- Returns:
- the coordinate for the intersection location
-
getIntersectionSegments
Gets the endpoints of the intersecting segments.- Returns:
- an array of the segment endpoints (p00, p01, p10, p11)
-
processIntersections
This method is called by clients of theSegmentIntersector
class to process intersections for two segments of theSegmentString
s being intersected. Note that some clients (such asMonotoneChain
s) may optimize away this call for segment pairs which they have determined do not intersect (e.g. by an disjoint envelope test).- Specified by:
processIntersections
in interfaceSegmentIntersector
-
isDone
public boolean isDone()Tests whether processing can terminate, because all required information has been obtained (e.g. an intersection of the desired type has been detected).- Specified by:
isDone
in interfaceSegmentIntersector
- Returns:
- true if processing can terminate
-