Class SegmentIntersector
- java.lang.Object
-
- org.locationtech.jts.geomgraph.index.SegmentIntersector
-
public class SegmentIntersector extends java.lang.Object
Computes the intersection of line segments, and adds the intersection to the edges containing the segments.- Version:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection[]
bdyNodes
private boolean
hasIntersection
These variables keep track of what types of intersections were found during ALL edges that have been intersected.private boolean
hasProper
private boolean
hasProperInterior
private boolean
includeProper
private boolean
isDone
private boolean
isDoneWhenProperInt
private boolean
isSelfIntersection
private LineIntersector
li
private int
numIntersections
int
numTests
private Coordinate
properIntersectionPoint
private boolean
recordIsolated
-
Constructor Summary
Constructors Constructor Description SegmentIntersector(LineIntersector li, boolean includeProper, boolean recordIsolated)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addIntersections(Edge e0, int segIndex0, Edge e1, int segIndex1)
This method is called by clients of the EdgeIntersector class to test for and add intersections for two segments of the edges being intersected.Coordinate
getProperIntersectionPoint()
boolean
hasIntersection()
boolean
hasProperInteriorIntersection()
A proper interior intersection is a proper intersection which is not contained in the set of boundary nodes set for this SegmentIntersector.boolean
hasProperIntersection()
A proper intersection is an intersection which is interior to at least two line segments.static boolean
isAdjacentSegments(int i1, int i2)
private boolean
isBoundaryPoint(LineIntersector li, java.util.Collection[] bdyNodes)
private boolean
isBoundaryPointInternal(LineIntersector li, java.util.Collection bdyNodes)
boolean
isDone()
private boolean
isTrivialIntersection(Edge e0, int segIndex0, Edge e1, int segIndex1)
A trivial intersection is an apparent self-intersection which in fact is simply the point shared by adjacent line segments.void
setBoundaryNodes(java.util.Collection bdyNodes0, java.util.Collection bdyNodes1)
void
setIsDoneIfProperInt(boolean isDoneWhenProperInt)
-
-
-
Field Detail
-
hasIntersection
private boolean hasIntersection
These variables keep track of what types of intersections were found during ALL edges that have been intersected.
-
hasProper
private boolean hasProper
-
hasProperInterior
private boolean hasProperInterior
-
properIntersectionPoint
private Coordinate properIntersectionPoint
-
li
private LineIntersector li
-
includeProper
private boolean includeProper
-
recordIsolated
private boolean recordIsolated
-
isSelfIntersection
private boolean isSelfIntersection
-
numIntersections
private int numIntersections
-
numTests
public int numTests
-
bdyNodes
private java.util.Collection[] bdyNodes
-
isDone
private boolean isDone
-
isDoneWhenProperInt
private boolean isDoneWhenProperInt
-
-
Constructor Detail
-
SegmentIntersector
public SegmentIntersector(LineIntersector li, boolean includeProper, boolean recordIsolated)
-
-
Method Detail
-
isAdjacentSegments
public static boolean isAdjacentSegments(int i1, int i2)
-
setBoundaryNodes
public void setBoundaryNodes(java.util.Collection bdyNodes0, java.util.Collection bdyNodes1)
-
setIsDoneIfProperInt
public void setIsDoneIfProperInt(boolean isDoneWhenProperInt)
-
isDone
public boolean isDone()
-
getProperIntersectionPoint
public Coordinate getProperIntersectionPoint()
- Returns:
- the proper intersection point, or
null
if none was found
-
hasIntersection
public boolean hasIntersection()
-
hasProperIntersection
public boolean hasProperIntersection()
A proper intersection is an intersection which is interior to at least two line segments. Note that a proper intersection is not necessarily in the interior of the entire Geometry, since another edge may have an endpoint equal to the intersection, which according to SFS semantics can result in the point being on the Boundary of the Geometry.
-
hasProperInteriorIntersection
public boolean hasProperInteriorIntersection()
A proper interior intersection is a proper intersection which is not contained in the set of boundary nodes set for this SegmentIntersector.
-
isTrivialIntersection
private boolean isTrivialIntersection(Edge e0, int segIndex0, Edge e1, int segIndex1)
A trivial intersection is an apparent self-intersection which in fact is simply the point shared by adjacent line segments. Note that closed edges require a special check for the point shared by the beginning and end segments.
-
addIntersections
public void addIntersections(Edge e0, int segIndex0, Edge e1, int segIndex1)
This method is called by clients of the EdgeIntersector class to test for and add intersections for two segments of the edges being intersected. Note that clients (such as MonotoneChainEdges) may choose not to intersect certain pairs of segments for efficiency reasons.
-
isBoundaryPoint
private boolean isBoundaryPoint(LineIntersector li, java.util.Collection[] bdyNodes)
-
isBoundaryPointInternal
private boolean isBoundaryPointInternal(LineIntersector li, java.util.Collection bdyNodes)
-
-