Class PolygonHoleJoiner
java.lang.Object
org.locationtech.jts.triangulate.polygon.PolygonHoleJoiner
Transforms a polygon with holes into a single self-touching (invalid) ring
by joining holes to the exterior shell or to another hole
with out-and-back line segments.
The holes are added in order of their envelopes (leftmost/lowest first).
As the result shell develops, a hole may be added to what was
originally another hole.
There is no attempt to optimize the quality of the join lines. In particular, holes may be joined by lines longer than is optimal. However, holes which touch the shell or other holes are joined at the touch point.
The class does not require the input polygon to have normal orientation (shell CW and rings CCW). The output ring is always CW.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompute()
Computes the joined ring.static Coordinate[]
Joins the shell and holes of a polygon and returns the result as sequence of Coordinates.static Polygon
joinAsPolygon
(Polygon polygon) Joins the shell and holes of a polygon and returns the result as an (invalid) Polygon.
-
Constructor Details
-
PolygonHoleJoiner
Creates a new hole joiner.- Parameters:
polygon
- the polygon to join
-
-
Method Details
-
joinAsPolygon
Joins the shell and holes of a polygon and returns the result as an (invalid) Polygon.- Parameters:
inputPolygon
- the polygon to join- Returns:
- the result polygon
-
join
Joins the shell and holes of a polygon and returns the result as sequence of Coordinates.- Parameters:
inputPolygon
- the polygon to join- Returns:
- the result coordinates
-
compute
Computes the joined ring.- Returns:
- the points in the joined ring
-