xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steiner, Dominik" <Dominik.Stei...@gigatronik.com>
Subject AW: MVC and batik?
Date Tue, 23 Aug 2005 11:40:28 GMT
Hi Thomas,

Thank you for getting back to me so quickly.
Perhaps writing can help to (dis)solve my confusion.

I already tried to use interactors, but as they don't allow for multiple events getting processed
at the same time (drawing and at the same time zooming and panning)

By layered model I just want to have different layers in my canvas (for drawing, a background,
the drawn shapes, etc), which I can easily insert into the SVGDocument as <g>-nodes.

So the DOM-tree and the elements would be my model. 

	1) But how can I move the SVGDocument out of the JSVGCanvas into a 	separate model class?

Then the model should update the view component that registers with it, so in this case the
GVT tree, which batik manages automatically.

But the controller which receives the mouse events has to change the model (the elements of
the DOM tree), but these don't specify any appropriate geometrical information, I would have
to fiddle them out of the attributes strings, especially for complex path elements.

I already tried using the overlay and the SVGGenerator for inserting the java2d shapes into
my DOM tree. This works fine for drawing pure java2d objects but when I want my DOM tree objects
to be interactive by registering EventListener with them, 

	2) How do I get the conversion from element to java2d shape which I 	can 	then manipulate
and rewrite to the DOM-Tree via the 	SVGGenerator?

I'm already failing to interactively change a <g>-Element which contains various paths
as child elements. 

	3) I guess that I would need to attach a transformation to it, but how 	do I do that starting
from the handle()-method of the listener which I 	register with this element?

This still sounds confusing, doesn't it? 
But I think basically what I want to do is not only interactively draw shapes but also change
the existing elements of the DOM tree, by registering EventListener with them...

Perhaps you can point me out where my error of thinking lies.... I'm deeply grateful for any
hints... :-)


-----Urspr√ľngliche Nachricht-----
Von: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com] 
Gesendet: Dienstag, 23. August 2005 11:56
An: batik-users@xmlgraphics.apache.org
Betreff: Re: MVC and batik?

Hi Steiner,

Steiner, Dominik wrote:

> I'm just wondering if there is a good way of implementing the MVC 
> pattern in Batik? I was fiddling with it the last few days and e.g. 
> tried to move the svgdocument which I think is the model out of the 
> canvas into a layer model. But this didn't work.

     I'm not sure I follow you.  There are different ways to
partition the universe so I'm unsure what you are trying to do.
So to Batik the SVG document is essentially the Model the View
is the GVT tree we use for rendering and the Controller is the
Bridge (it keeps the view in sync with the model).

     This of course shouldn't impact most users of the toolkit, they
just play with the model and things happen, so I suspect that this
isn't really what you are talking about.  Also I don't understand
what you mean by a 'layer' model....

> So I'm wondering if I'm just confused and trying to do the impossible or 
> if someone has practical design hints for batik in general and a svg 
> draw program in special.

     Well the simplest way to do a draw program is to simply
add elements to the Canvas.  The interactors/overlays are good
to maintain very high interactive performance while the user
draws or drags elements around (typical move a proxy type stuff).

     If you are encounter other issues I might be able to make
suggestions but I don't know where to go from here.

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

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

View raw message