AttributesImpl attr = new AttributesImpl(); SVGUtils.addAttribute(attr, SVGConstants.XML_ID, getId()); SVGUtils.addAttribute(attr, "x", "" + bounds.getMinimumX()); SVGUtils.addAttribute(attr, "y", "" + bounds.getMinimumY()); SVGUtils.addAttribute(attr, SVGConstants.SVG_ATTRIBUTE_WIDTH, "" + bounds.getWidth()); SVGUtils.addAttribute(attr, SVGConstants.SVG_ATTRIBUTE_HEIGHT, "" + bounds.getHeight());
Bounds bounds = this.hatch.getBounds(); double dotLength = (bounds.getWidth() + bounds.getHeight()) / 2 * 0.002;
    public void toSAX(ContentHandler handler, Map svgContext)            throws SAXException {        if (!this.hatch.isSolid()) {            // we have to create a tile with all lines            Bounds bounds = this.hatch.getBounds();            double dotLength = (bounds.getWidth() + bounds.getHeight()) / 2 * 0.0005;            AttributesImpl attr = new AttributesImpl();            SVGUtils.addAttribute(attr, SVGConstants.XML_ID, getId());            SVGUtils.addAttribute(attr, "x", "" + bounds.getMinimumX());            SVGUtils.addAttribute(attr, "y", "" + bounds.getMinimumY());            SVGUtils.addAttribute(attr, SVGConstants.SVG_ATTRIBUTE_WIDTH, ""                    + bounds.getWidth());            SVGUtils.addAttribute(attr, SVGConstants.SVG_ATTRIBUTE_HEIGHT, ""                    + bounds.getHeight());            SVGUtils.addAttribute(attr,                    SVGConstants.SVG_ATTRIBUTE_PATTERN_UNITS, "userSpaceOnUse");            SVGUtils.startElement(handler, SVGConstants.SVG_PATTERN, attr);            attr = new AttributesImpl();            SVGUtils.startElement(handler, SVGConstants.SVG_TITLE, attr);            SVGUtils.characters(handler, this.hatch.getName());            SVGUtils.endElement(handler, SVGConstants.SVG_TITLE);            // we convert the pattern as one path element           // StringBuffer buf = new StringBuffer();//            Iterator i = patterns.iterator();            // System.out.println("PATTERN:\nName:" + hatch.getName());//            while (i.hasNext()) {//                HatchLinePattern pattern = (HatchLinePattern) i.next();////                attr = new AttributesImpl();//                SVGUtils.addAttribute(attr, "d", this.createLineType(bounds,//                        pattern, dotLength));//                SVGUtils.addAttribute(attr, "stroke", "red");//                SVGUtils.addAttribute(attr, "stroke-width", "0.01%");//                SVGUtils.emptyElement(handler, SVGConstants.SVG_PATH, attr);//            }            SVGUtils.endElement(handler, SVGConstants.SVG_PATTERN);        }    }