Class NodingIntersectionFinder
java.lang.Object
org.locationtech.jts.noding.NodingIntersectionFinder
- All Implemented Interfaces:
SegmentIntersector
Finds non-noded intersections in a set of
SegmentStrings,
if any exist.
Non-noded intersections include:
- Interior intersections which lie in the interior of a segment (with another segment interior or with a vertex or endpoint)
- Vertex intersections which occur at vertices in the interior of
SegmentStrings (with a segment string endpoint or with another interior vertex)
setInteriorIntersectionsOnly(boolean).
By default only the first intersection is found,
but all can be found by setting setFindAllIntersections(boolean)
- Version:
- 1.7
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an intersection finder which finds an intersection if one exists -
Method Summary
Modifier and TypeMethodDescriptionintcount()Gets the count of intersections found.static NodingIntersectionFinderCreates a finder which finds all intersections.static NodingIntersectionFinderCreates a finder which tests if there is at least one intersection.static NodingIntersectionFinderCreates an finder which counts all interior intersections.static NodingIntersectionFinderCreates a finder which finds all interior intersections.static NodingIntersectionFinderCreates an finder which counts all intersections.Gets the computed location of the intersection.Gets the intersections found.Gets the endpoints of the intersecting segments.booleanTests whether an intersection was found.booleanisDone()Reports whether the client of this class needs to continue testing all intersections in an arrangement.voidprocessIntersections(SegmentString e0, int segIndex0, SegmentString e1, int segIndex1) This method is called by clients of theSegmentIntersectorclass to process intersections for two segments of theSegmentStrings being intersected.voidsetCheckEndSegmentsOnly(boolean isCheckEndSegmentsOnly) Sets whether only end segments should be tested for intersection.voidsetFindAllIntersections(boolean findAllIntersections) Sets whether all intersections should be computed.voidsetInteriorIntersectionsOnly(boolean isInteriorIntersectionsOnly) Sets whether only interior (proper) intersections will be found.voidsetKeepIntersections(boolean keepIntersections) Sets whether intersection points are recorded.
-
Constructor Details
-
NodingIntersectionFinder
Creates an intersection finder which finds an intersection if one exists- Parameters:
li- the LineIntersector to use
-
-
Method Details
-
createAnyIntersectionFinder
Creates a finder which tests if there is at least one intersection. Uses short-circuiting for efficient performance. The intersection found is recorded.- Parameters:
li- a line intersector- Returns:
- a finder which tests if there is at least one intersection.
-
createAllIntersectionsFinder
Creates a finder which finds all intersections. The intersections are recorded for later inspection.- Parameters:
li- a line intersector- Returns:
- a finder which finds all intersections.
-
createInteriorIntersectionsFinder
Creates a finder which finds all interior intersections. The intersections are recorded for later inspection.- Parameters:
li- a line intersector- Returns:
- a finder which finds all interior intersections.
-
createIntersectionCounter
Creates an finder which counts all intersections. The intersections are note recorded to reduce memory usage.- Parameters:
li- a line intersector- Returns:
- a finder which counts all intersections.
-
createInteriorIntersectionCounter
Creates an finder which counts all interior intersections. The intersections are note recorded to reduce memory usage.- Parameters:
li- a line intersector- Returns:
- a finder which counts all interior intersections.
-
setFindAllIntersections
public void setFindAllIntersections(boolean findAllIntersections) Sets whether all intersections should be computed. When this isfalse(the default value) the value ofisDone()istrueafter the first intersection is found.Default is
false.- Parameters:
findAllIntersections- whether all intersections should be computed
-
setInteriorIntersectionsOnly
public void setInteriorIntersectionsOnly(boolean isInteriorIntersectionsOnly) Sets whether only interior (proper) intersections will be found.- Parameters:
isInteriorIntersectionsOnly- whether to find only interior intersections
-
setCheckEndSegmentsOnly
public void setCheckEndSegmentsOnly(boolean isCheckEndSegmentsOnly) Sets whether only end segments should be tested for intersection. This is a performance optimization that may be used if the segments have been previously noded by an appropriate algorithm. It may be known that any potential noding failures will occur only in end segments.- Parameters:
isCheckEndSegmentsOnly- whether to test only end segments
-
setKeepIntersections
public void setKeepIntersections(boolean keepIntersections) Sets whether intersection points are recorded. If the only need is to count intersection points, this can be set tofalse.Default is
true.- Parameters:
keepIntersections- indicates whether intersections should be recorded
-
getIntersections
-
count
public int count()Gets the count of intersections found.- Returns:
- the intersection count
-
hasIntersection
public boolean hasIntersection()Tests whether an intersection was found.- Returns:
- true if an 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 theSegmentIntersectorclass to process intersections for two segments of theSegmentStrings being intersected. Note that some clients (such asMonotoneChains) may optimize away this call for segment pairs which they have determined do not intersect (e.g. by an disjoint envelope test).- Specified by:
processIntersectionsin interfaceSegmentIntersector
-
isDone
public boolean isDone()Description copied from interface:SegmentIntersectorReports whether the client of this class needs to continue testing all intersections in an arrangement.- Specified by:
isDonein interfaceSegmentIntersector- Returns:
- true if there is no need to continue testing segments
-