Class NodingIntersectionFinder

Hierarchy: Object , NodingIntersectionFinder
All Implemented Interfaces: SegmentIntersector
public class NodingIntersectionFinder
implements SegmentIntersector
public NodingIntersectionFinder(LineIntersector li)
Creates an intersection finder which finds an intersection if one exists
Parameters:
li - li the LineIntersector to use
public static NodingIntersectionFinder createAnyIntersectionFinder(LineIntersector li)
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 - li a line intersector
Returns:
a finder which tests if there is at least one intersection.
public static NodingIntersectionFinder createAllIntersectionsFinder(LineIntersector li)
Creates a finder which finds all intersections. The intersections are recorded for later inspection.
Parameters:
li - li a line intersector
Returns:
a finder which finds all intersections.
public static NodingIntersectionFinder createInteriorIntersectionsFinder(LineIntersector li)
Creates a finder which finds all interior intersections. The intersections are recorded for later inspection.
Parameters:
li - li a line intersector
Returns:
a finder which finds all interior intersections.
public static NodingIntersectionFinder createIntersectionCounter(LineIntersector li)
Creates an finder which counts all intersections. The intersections are note recorded to reduce memory usage.
Parameters:
li - li a line intersector
Returns:
a finder which counts all intersections.
public static NodingIntersectionFinder createInteriorIntersectionCounter(LineIntersector li)
Creates an finder which counts all interior intersections. The intersections are note recorded to reduce memory usage.
Parameters:
li - li a line intersector
Returns:
a finder which counts all interior intersections.
public void setFindAllIntersections(boolean findAllIntersections)
Sets whether all intersections should be computed. When this is false (the default value) the value of isDone() is true after the first intersection is found.

Default is false.

Parameters:
findAllIntersections - findAllIntersections whether all intersections should be computed
public void setInteriorIntersectionsOnly(boolean isInteriorIntersectionsOnly)
Sets whether only interior (proper) intersections will be found.
Parameters:
isInteriorIntersectionsOnly - isInteriorIntersectionsOnly whether to find only interior intersections
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 - isCheckEndSegmentsOnly whether to test only end segments
public void setKeepIntersections(boolean keepIntersections)
Sets whether intersection points are recorded. If the only need is to count intersection points, this can be set to false.

Default is true.

Parameters:
keepIntersections - keepIntersections indicates whether intersections should be recorded
public List getIntersections()
Gets the intersections found.
Returns:
a List of Coordinate
public int count()
Gets the count of intersections found.
Returns:
the intersection count
public boolean hasIntersection()
Tests whether an intersection was found.
Returns:
true if an intersection was found
public Coordinate 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
public Coordinate[] getIntersectionSegments()
Gets the endpoints of the intersecting segments.
Returns:
an array of the segment endpoints (p00, p01, p10, p11)
public void processIntersections(SegmentString e0, int segIndex0, SegmentString e1, int segIndex1)
This method is called by clients of the SegmentIntersector class to process intersections for two segments of the SegmentStrings being intersected. Note that some clients (such as MonotoneChains) may optimize away this call for segment pairs which they have determined do not intersect (e.g. by an disjoint envelope test).
public boolean isDone()