Class ConnectedInteriorTester
- java.lang.Object
-
- org.locationtech.jts.operation.valid.ConnectedInteriorTester
-
public class ConnectedInteriorTester extends java.lang.Object
This class tests that the interior of an areaGeometry
(Polygon
orMultiPolygon
) is connected. This can happen if:- a shell self-intersects
- one or more holes form a connected chain touching a shell at two different points
- one or more holes form a ring around a subset of the interior
- Version:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description private Coordinate
disconnectedRingcoord
private GeometryFactory
geometryFactory
private GeometryGraph
geomGraph
-
Constructor Summary
Constructors Constructor Description ConnectedInteriorTester(GeometryGraph geomGraph)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.List
buildEdgeRings(java.util.Collection dirEdges)
Form DirectedEdges in graph into Minimal EdgeRings.static Coordinate
findDifferentPoint(Coordinate[] coord, Coordinate pt)
Coordinate
getCoordinate()
private boolean
hasUnvisitedShellEdge(java.util.List edgeRings)
Check if any shell ring has an unvisited edge.boolean
isInteriorsConnected()
private void
setInteriorEdgesInResult(PlanarGraph graph)
private void
visitInteriorRing(LineString ring, PlanarGraph graph)
protected void
visitLinkedDirectedEdges(DirectedEdge start)
private void
visitShellInteriors(Geometry g, PlanarGraph graph)
Mark all the edges for the edgeRings corresponding to the shells of the input polygons.
-
-
-
Field Detail
-
geometryFactory
private GeometryFactory geometryFactory
-
geomGraph
private GeometryGraph geomGraph
-
disconnectedRingcoord
private Coordinate disconnectedRingcoord
-
-
Constructor Detail
-
ConnectedInteriorTester
public ConnectedInteriorTester(GeometryGraph geomGraph)
-
-
Method Detail
-
findDifferentPoint
public static Coordinate findDifferentPoint(Coordinate[] coord, Coordinate pt)
-
getCoordinate
public Coordinate getCoordinate()
-
isInteriorsConnected
public boolean isInteriorsConnected()
-
setInteriorEdgesInResult
private void setInteriorEdgesInResult(PlanarGraph graph)
-
buildEdgeRings
private java.util.List buildEdgeRings(java.util.Collection dirEdges)
Form DirectedEdges in graph into Minimal EdgeRings. (Minimal Edgerings must be used, because only they are guaranteed to provide a correct isHole computation)
-
visitShellInteriors
private void visitShellInteriors(Geometry g, PlanarGraph graph)
Mark all the edges for the edgeRings corresponding to the shells of the input polygons. Only ONE ring gets marked for each shell - if there are others which remain unmarked this indicates a disconnected interior.
-
visitInteriorRing
private void visitInteriorRing(LineString ring, PlanarGraph graph)
-
visitLinkedDirectedEdges
protected void visitLinkedDirectedEdges(DirectedEdge start)
-
hasUnvisitedShellEdge
private boolean hasUnvisitedShellEdge(java.util.List edgeRings)
Check if any shell ring has an unvisited edge. A shell ring is a ring which is not a hole and which has the interior of the parent area on the RHS. (Note that there may be non-hole rings with the interior on the LHS, since the interior of holes will also be polygonized into CW rings by the linkAllDirectedEdges() step)- Returns:
- true if there is an unvisited edge in a non-hole ring
-
-