xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scooter <dylan_bro...@hotmail.com>
Subject Using getBBox()
Date Tue, 10 Apr 2007 16:32:23 GMT

Hi all,

I'm trying to retrieve the bounding box of an SVG Element from Java, and
seem to be failing. Could anyone explain why the following returns "null"?

Thanks in advance for any help,

Dylan

-----------------

    public BBoxTest() {
    	DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
        SVGDocument doc = (SVGDocument)
impl.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", null);
                
        Element rect =
doc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI,
SVG12Constants.SVG_RECT_TAG);
        rect.setAttributeNS(null, "x", "50");
        rect.setAttributeNS(null, "y", "50");
        rect.setAttributeNS(null, "fill", "red");
        rect.setAttributeNS(null, "height", "200");
        rect.setAttributeNS(null, "width", "200");
        doc.getDocumentElement().appendChild(rect);
                
        SVGRect locatable = ((SVGLocatable)rect).getBBox();
        System.out.println(locatable);    
    }

-- 
View this message in context: http://www.nabble.com/Using-getBBox%28%29-tf3553824.html#a9922517
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message