// SplitTestUtil.read("LINESTRING (110 260, 280 260, 280 150, 110 150, 110 260)");
//
// LineString line = (LineString)
// SplitTestUtil.read("LINESTRING (150 260, 270 260, 270 180, 160 180, 160 270)");
//
LineString line = (LineString) SplitTestUtil
.read("LINESTRING (260 280, 260 140, 130 140, 130 220, 90 220, 90 190, 180 190, 180 280, 240 280, 240 220, 150 220, 150 160, 240 160, 240 190, 180 190)");
List<LinearRing> ringList = new ArrayList<LinearRing>();
Geometry multiLines = line.union();
Polygonizer polygonizer = new Polygonizer();
polygonizer.add(multiLines);
Collection<Polygon> polyCollection = polygonizer.getPolygons();
// add the rings to the ringList.
for (Polygon pol : polyCollection) {
Coordinate[] polCoord = pol.getExteriorRing().getCoordinates();
LinearRing polygonRing = line.getFactory().createLinearRing(polCoord);
ringList.add(polygonRing);
}
//
// for (Geometry ring : ringList) {
//