xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: how to access a GraphicsNode
Date Tue, 05 Aug 2008 09:54:10 GMT
Hi Paul,

Paul Solomon <pauls@clearboxsystems.com.au> wrote on 08/03/2008 11:10:51 
AM:

> I am new to using Batik and I am currently trying to implement CAD 
> type software. Currently I can load and save docs and add elements 
> to a existing doc. I have a DOM doc and a dynamic bridge to a GVT, 
> and I am painting to a Panel using the gvt tree.

   I must ask, why aren't you using the JSVGCanvas?  It does a lot
of stuff for you (like partial updates, maintaining a buffered image
for faster screen updates etc)...

> I am now trying to work out how to modify existing elements. I would
> like to do the following:
> 
> 1. Receive notification is there is a mouseover an element.

   I would add a mouse over listener in the DOM.  You asked about 
a 'wider' mouse over sensitive region.  Batik doesn't provide 
anything natively, however you could fake it by adding a copy
(or 'use'ing the primary content) with a thicker stroke attribute, 
and setting  visibility to hidden, and pointer-events to 'all').

   If you wanted to adjust the behavior of the GVT node hit
code then you would basically have to replace all of the
hit code in the GVT package...

> 2. provide user feedback for mouseover (thicker stroke etc)

   With the Canvas you can just update the attributes of the element
through the DOM and it will update on the screen.

   e.setAttributeNS(null, "stroke-width", "3");

> 3. allow user click/drag of objects to reposition then.

   This is typically done by adjusting the affine transform
on the element.


> Can anyone give me pointers on relevant interfaces / docs on how to 
> achieve these tasks?

   My primary suggestion would be to stick to using the SVG DOM
to do these tasks.  Direct use of the GVT isn't encouraged but
it's "forbidden" either, just understand that support of the SVG
standard is it's primary purpose.

PS. As far as building a link between GVT nodes or DOM nodes
and other structures the simplest mechanism would be a Java
HashTable...

Mime
View raw message