/** * Computes the {@link Polygon} formed by this ring and any contained holes. * * @return the {@link Polygon} formed by this ring and its holes. */ public Polygon getPolygon() { LinearRing[] holeLR = null; if (holes != null) { holeLR = new LinearRing[holes.size()]; for (int i = 0; i < holes.size(); i++) { holeLR[i] = (LinearRing) holes.get(i); } } Polygon poly = factory.createPolygon(ring, holeLR); return poly; }