/** * Writes the body for a <code>MultiPolygon</code> object. MultiPolygons are encoded into SVG path * elements. This function writes the different polygons in one d-attribute of an SVG path * element, separated by an 'M' character. (in other words, it calls the super.writeBody for each * polygon). * * @param o The <code>MultiPolygon</code> to be encoded. */ public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException { document.writeElement("path", asChild); document.writeAttribute("fill-rule", "evenodd"); document.writeAttributeStart("d"); MultiPolygon mpoly = (MultiPolygon) o; for (int i = 0; i < mpoly.getNumGeometries(); i++) { Polygon poly = (Polygon) mpoly.getGeometryN(i); LineString shell = poly.getExteriorRing(); int nHoles = poly.getNumInteriorRing(); document.writeClosedPathContent(shell.getCoordinates()); for (int j = 0; j < nHoles; j++) { document.writeClosedPathContent(poly.getInteriorRingN(j).getCoordinates()); } } document.writeAttributeEnd(); }