Class PolygonHoleJoiner
- java.lang.Object
-
- org.locationtech.jts.triangulate.polygon.PolygonHoleJoiner
-
public class PolygonHoleJoiner extends Object
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 Constructor Description PolygonHoleJoiner(Polygon polygon)
Creates a new hole joiner.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Coordinate[]
compute()
Computes the joined ring.static Coordinate[]
join(Polygon polygon)
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 Detail
-
PolygonHoleJoiner
public PolygonHoleJoiner(Polygon polygon)
Creates a new hole joiner.- Parameters:
polygon
- the polygon to join
-
-
Method Detail
-
joinAsPolygon
public static Polygon joinAsPolygon(Polygon polygon)
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
public static Coordinate[] join(Polygon polygon)
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
public Coordinate[] compute()
Computes the joined ring.- Returns:
- the points in the joined ring
-
-