public class InteriorIntersectionFinder extends java.lang.Object implements SegmentIntersector
SegmentString
s,
if one exists. Only the first intersection found is reported.Modifier and Type | Field and Description |
---|---|
private boolean |
findAllIntersections |
private Coordinate |
interiorIntersection |
private int |
intersectionCount |
private java.util.List |
intersections |
private Coordinate[] |
intSegments |
private boolean |
isCheckEndSegmentsOnly |
private boolean |
keepIntersections |
private LineIntersector |
li |
Constructor and Description |
---|
InteriorIntersectionFinder(LineIntersector li)
Creates an intersection finder which finds an interior intersection
if one exists
|
Modifier and Type | Method and Description |
---|---|
int |
count()
Gets the count of intersections found.
|
static InteriorIntersectionFinder |
createAllIntersectionsFinder(LineIntersector li)
Creates an intersection finder which finds all interior intersections.
|
static InteriorIntersectionFinder |
createAnyIntersectionFinder(LineIntersector li)
Creates an intersection finder which tests if there is at least one interior intersection.
|
static InteriorIntersectionFinder |
createIntersectionCounter(LineIntersector li)
Creates an intersection finder which counts all interior intersections.
|
Coordinate |
getInteriorIntersection()
Gets the computed location of the intersection.
|
java.util.List |
getIntersections()
Gets the intersections found.
|
Coordinate[] |
getIntersectionSegments()
Gets the endpoints of the intersecting segments.
|
boolean |
hasIntersection()
Tests whether an intersection was found.
|
boolean |
isDone()
Reports whether the client of this class
needs to continue testing all intersections in an arrangement.
|
private boolean |
isEndSegment(SegmentString segStr,
int index)
Tests whether a segment in a
SegmentString is an end segment. |
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 SegmentString s being intersected. |
void |
setCheckEndSegmentsOnly(boolean isCheckEndSegmentsOnly)
Sets whether only end segments should be tested for interior intersection.
|
void |
setFindAllIntersections(boolean findAllIntersections)
Sets whether all intersections should be computed.
|
void |
setKeepIntersections(boolean keepIntersections)
Sets whether intersection points are recorded.
|
private boolean findAllIntersections
private boolean isCheckEndSegmentsOnly
private LineIntersector li
private Coordinate interiorIntersection
private Coordinate[] intSegments
private java.util.List intersections
private int intersectionCount
private boolean keepIntersections
public InteriorIntersectionFinder(LineIntersector li)
li
- the LineIntersector to usepublic static InteriorIntersectionFinder createAnyIntersectionFinder(LineIntersector li)
li
- a line intersectorpublic static InteriorIntersectionFinder createAllIntersectionsFinder(LineIntersector li)
li
- a line intersectorpublic static InteriorIntersectionFinder createIntersectionCounter(LineIntersector li)
li
- a line intersectorpublic void setFindAllIntersections(boolean findAllIntersections)
false
(the default value)
the value of isDone()
is true
after the first intersection is found.
Default is false
.
findAllIntersections
- whether all intersections should be computedpublic void setKeepIntersections(boolean keepIntersections)
false
.
Default is true
.
keepIntersections
- indicates whether intersections should be recordedpublic java.util.List getIntersections()
Coordinate
public int count()
public void setCheckEndSegmentsOnly(boolean isCheckEndSegmentsOnly)
isCheckEndSegmentsOnly
- whether to test only end segmentspublic boolean hasIntersection()
public Coordinate getInteriorIntersection()
public Coordinate[] getIntersectionSegments()
public void processIntersections(SegmentString e0, int segIndex0, SegmentString e1, int segIndex1)
SegmentIntersector
class to process
intersections for two segments of the SegmentString
s being intersected.
Note that some clients (such as MonotoneChain
s) may optimize away
this call for segment pairs which they have determined do not intersect
(e.g. by an disjoint envelope test).processIntersections
in interface SegmentIntersector
private boolean isEndSegment(SegmentString segStr, int index)
SegmentString
is an end segment.
(either the first or last).segStr
- a segment stringindex
- the index of a segment in the segment stringpublic boolean isDone()
SegmentIntersector
isDone
in interface SegmentIntersector