xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "HODAC, Olivier" <OLIVIER.HO...@airbus.com>
Subject RE: locate an SVG element using x, y position
Date Fri, 06 Nov 2009 13:02:28 GMT


Just to end it, I finnally have created as many listener as I have use components. And instead
of navigating the SVG to perform the symbol->use path, I keep the node ref in the listener
so I get the use node immediately.


Thank's everybody



De : thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
Envoyé : mercredi 28 octobre 2009 11:04
À : batik-users@xmlgraphics.apache.org
Cc : batik-users@xmlgraphics.apache.org
Objet : RE: locate an SVG element using x, y position


Hi Oliver, 

"HODAC, Olivier" <OLIVIER.HODAC@airbus.com> wrote on 10/27/2009 12:51:13 PM:

> I succeded in catching the event. Thanks, thomas, I had forgot the 

> The solution of Heidrun is the solution I have implemented as it 
> seems that the evt.getTarget() seems not to point on the right node 
> (in the case I use refs to symbols, see SVG). Do you know why? The 
> getTarget() is not the right method to call? 

   Well getTarget will point at the actual geometry element (like 
a rect, text, or in your case a polygon).  In cases like this I 
normally walk up the tree until I get to the desired element 
(see 'getParent' on DOM Elements).  I'll often add an attribute in 
a custom namespace rather than simply assume that the first symbol 
is the right element. 

> When I write the following piece of code, I point on the polygon 
> Node of the SVG which is the symbol element (=> no ID => 
> NullPointerException). I want to get the use element (top, bottom or
> middle of the SVG) 

   One thing to watch for is that the element it points at will be 
in a 'shadow tree' (a copy we make so we can properly perform the 
CSS cascade).  So you need to do some fancy footwork to navigate across 
the symbol->use boundary (see batik.dom.svg.SVGOMUseShadowRoot.getCSSParentNode). 

This mail has originated outside your organization, either from an external partner or the
Global Internet.
Keep this in mind if you answer this message.

The information in this e-mail is confidential. The contents may not be disclosed or used
by anyone other than the addressee. Access to this e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as
it has been sent over public networks. If you have any concerns over the content of this message
or its Accuracy or Integrity, please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus scanning software
but you should take whatever measures you deem to be appropriate to ensure that this message
and any attachments are virus free.

View raw message