JTS Topology Suite version 1.13

com.vividsolutions.jts.noding
Class SegmentIntersectionDetector

java.lang.Object
  extended by com.vividsolutions.jts.noding.SegmentIntersectionDetector
All Implemented Interfaces:
SegmentIntersector

public class SegmentIntersectionDetector
extends java.lang.Object
implements SegmentIntersector

Detects and records an intersection between two SegmentStrings, 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
SegmentIntersectionDetector(LineIntersector li)
          Creates an intersection finder
 
Method Summary
 Coordinate getIntersection()
          Gets the computed location of the intersection.
 Coordinate[] getIntersectionSegments()
          Gets the endpoints of the intersecting segments.
 boolean hasIntersection()
          Tests whether an intersection was found.
 boolean hasNonProperIntersection()
          Tests whether a non-proper intersection was found.
 boolean hasProperIntersection()
          Tests whether a proper intersection was found.
 boolean isDone()
          Reports whether the client of this class needs to continue testing all intersections in an arrangement.
 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.
 void setFindAllIntersectionTypes(boolean findAllTypes)
           
 void setFindProper(boolean findProper)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SegmentIntersectionDetector

public SegmentIntersectionDetector(LineIntersector li)
Creates an intersection finder

Parameters:
li - the LineIntersector to use
Method Detail

setFindProper

public void setFindProper(boolean findProper)

setFindAllIntersectionTypes

public void setFindAllIntersectionTypes(boolean findAllTypes)

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

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

getIntersectionSegments

public Coordinate[] getIntersectionSegments()
Gets the endpoints of the intersecting segments.

Returns:
an array of the segment endpoints (p00, p01, p10, p11)

processIntersections

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).

Specified by:
processIntersections in interface SegmentIntersector

isDone

public boolean isDone()
Description copied from interface: SegmentIntersector
Reports whether the client of this class needs to continue testing all intersections in an arrangement.

Specified by:
isDone in interface SegmentIntersector
Returns:
true if there is no need to continue testing segments

JTS Topology Suite version 1.13