You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Maik Schürer proveo GmbH <Ma...@proveo.de> on 2004/10/26 14:10:42 UTC

how to get position and size of a SVG group

I  got a group ( <g> ) by ID from a document and want to know the position
and size of the group.
With 'position' I mean the upper left corner of an imaginary rectangle
arround all elements of the group. 'Size' should be the edge length of the
rectangle...
How can I do this ?
Thanks
Maik


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


Re: how to get position and size of a SVG group

Posted by Maik Schürer proveo GmbH <Ma...@proveo.de>.
Thanks Urs,
yes, thats the way. It works fine.
If you have at minimum a instanceof SVGGraphicsElement, you can get position
and size via getBBox() / getX() etc.
Maik
----- Original Message ----- 
From: "Urs Reupke" <ur...@gmx.net>
To: "Batik Users" <ba...@xml.apache.org>
Sent: Tuesday, October 26, 2004 2:54 PM
Subject: Re: how to get position and size of a SVG group


> Hi,
>
> >I  got a group ( <g> ) by ID from a document and want to know the
position
> > and size of the group.
> > With 'position' I mean the upper left corner of an imaginary rectangle
> > arround all elements of the group. 'Size' should be the edge length of
the
> > rectangle...
>
> I've thought about this myself, recently, and though I have not tested
this,
> I figured the easiest way would be to get the bounding box of the
> g-element by calling "getBBox()" and afterwards checking the respective
> parameters of that bounding box via getX(), getY(), getWidth() and
getHeight().
>
> As I said, it's untested, but I hope it works - if it doesn't, please post
your
> solution to the ML.
>
> Bye
> -Urs
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>


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


Re: how to get position and size of a SVG group

Posted by Urs Reupke <ur...@gmx.net>.
Hi,

>I  got a group ( <g> ) by ID from a document and want to know the position
> and size of the group.
> With 'position' I mean the upper left corner of an imaginary rectangle
> arround all elements of the group. 'Size' should be the edge length of the
> rectangle...

I've thought about this myself, recently, and though I have not tested this,
I figured the easiest way would be to get the bounding box of the
g-element by calling "getBBox()" and afterwards checking the respective
parameters of that bounding box via getX(), getY(), getWidth() and getHeight().

As I said, it's untested, but I hope it works - if it doesn't, please post your
solution to the ML.

Bye
-Urs

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