Thanks, getGlobalTransform made it.
Here is the code I use, in the case somebody is interested:
AffineTransform theTransform = new AffineTransform(SVGContentManager.TRANSFORM_96DPI);
theTransform.concatenate(theNode.getGlobalTransform());
Rectangle2D theBounds = theNode.getTransformedBounds(theTransform);


I get the bounds in mm, not pixels.
Guillaume

Thomas DeWeese wrote:
Guillaume Pothier wrote:

Hi!

I have a SVG document with its root <svg> tag, a few geometric objects, and a child <svg>, which in turn contains a few geometric objects. Once the GVT tree is built, I get the GraphicNode corresponding to one of the rectangles in the embedded svg node. If I call getTransformedBounds on it, it seems that I am getting its bounds within the embedded svg node, and not relative to the root svg node.


    getTransformedBounds returns the bounds in the coordinate system
defined by the affine you pass in, relative to the Node.  So what Affine
are you passing into the function?

My question: should getTransformedBounds return the bounds relative to the root svg node, and should I try to find the error on my side, or is it normal for getTransformedBounds to return the bounds relative to the parent svg node, in which case, is there a method to obtain the bounds relative to the root svg element?


    It depends on what transform you pass in.  For the Identity Affine
it will return it's bounds in it's parent's coordinate system.  You might
want to look at getGlobalTransform() you probably need to use the
inverse of that affine and remove the transform, if any, from the element
it's self (getTransform()).




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to