smooth.add(ls);
}
// apply smoothing
LineSmoother smoother = new LineSmoother(gf);
Polygonizer polygonizer = new Polygonizer();
for (int i = 0; i < smooth.size(); i++) {
polygonizer.add(smoother.smooth(smooth.get(i), 0.5));
}
polygonizer.add(keep);
Collection<Polygon> polys = (Collection<Polygon>) polygonizer.getPolygons();
poly = gf.createMultiPolygon(polys.toArray(new Polygon[polys.size()]));
if(!polygonizer.getInvalidRingLines().isEmpty())
System.err.println("invalid ring lines found!");
if(!polygonizer.getDangles().isEmpty())
System.err.println("dangles found!");
if(!polygonizer.getCutEdges().isEmpty())
System.err.println("cut edges found!");
if(!poly.isValid())
throw new RuntimeException("invalid polygon!");