Hi Nazer,
I think I had the same problem some time ago. Before you can use
getBBox() you have to build the GVT-Tree in order to get this
information.
You can do this in the following way:
SVGDocument svgDoc =
(SVGDocument)loader.loadDocument(file.toURL().toString());
loader.dispose();
BridgeContext ctx = new BridgeContext(userAgent,
loader);
ctx.setDynamicState(BridgeContext.DYNAMIC);
GVTBuilder builder = new GVTBuilder();
builder.build(ctx, svgDoc);
// use getBBox() afterwards
After this, SVGLocatable.getBBox() shouldn't return null any longer.
Florian
-----Original Message-----
From: Nazar Stasiv (Lohika, Inc) [mailto:[EMAIL PROTECTED]
Sent: Monday, August 14, 2006 3:16 PM
To: [email protected]
Subject: Re: SVGOMGElement and coordinates?
SVGLocatable.getBBox(elem) returns null No javadoc comments are there to
unveil the reason of such behaviour
Is there the other way to get coordinates of SVGOMGElement ?
[EMAIL PROTECTED] wrote:
> Hi Nazer,
>
> "Nazar Stasiv (Lohika, Inc)" <[EMAIL PROTECTED]> wrote on 08/14/2006
> 07:29:19 AM:
>
>
>> I use batik to operate SVG at runtime.
>>
>> The question is how can I get SVGOMGElement coordinates when walking
DOM
>> tree of the SVG document?
>>
>
> You should look at the SVG DOM. In particular the 'getBBox'
method.
> There are also methods get 'getIntersectionList' that could be useful.
>
>
>
>> The reason I'm asking such a thing it that requirements are to
display
>> info popup near named elements of SVG. If I had coordinates of such
an
>> element I could use DOM to add new element to the tree with computed
>> coordinates for correct positioning of the info popup.
>>
>
> This is typically done with mouse over/out event handlers. This
> allows you to receive a DOM event when the mouse enters/exits a
particular
> element or group in the SVG document. If you need the sensitive area
to
> be larger than the rendered area you can add a hidden element
> (visibility="hidden" pointer-events="fill") that can cover the
expanded
> area and tie your event handler to that.
>
>
> ---------------------------------------------------------------------
> 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]