Hi Zhao,

"comlong zhao" <[EMAIL PROTECTED]> wrote on 08/09/2006 04:13:03 AM:

>          First, I want to ask what is difference between the GVTtree and 
the 
> GraphicsNode. If the GVTtree is changed, whether the GraphicsNode is 
changed 
> too?  more details more better. thanks a lot.

    The GVT tree is the collection of GraphicsNodes.  Put another way
the GraphicsNodes are the nodes in the GVT tree.

>          For my project, I do not use the JSVGCanvas, the event is come 
from 
> Canvas3D. I use the AWTEventDispatcher, the instance named "ad".  I use 
the 
> normal way that

    The code all looks pretty good. The important thing to know is that
an event is only dispatched in the SVG tree if the mouse event is over
an SVG element. 
 
>         ad.setRootNode(gvtRoot);
>         ad.setBaseTransform(curTxf);     //curTxf is the AffineTransform

     The mouse coordinates in evt are transformed to the user coordinate
system of the root SVG element by 'curTxf' this point is then checked to
see if it is inside any of the SVG elements if it is then a mouse event
is dispatched.   Otherwise no event will be dispatched.  Also obviously 
you must have an event handler that modifies the document, simply 
dispatching
an event won't change anything.

     I would start with a very simple SVG document that just contains a
very large rectangle (much larger than the 'displayed' document) and have
a mousemove handler that prints the clientX/Y of the DOM event to see what 
you
are getting and if they make sense.

>          And then from the Frame I could call the MouseEvent of like 
this:
>      public void mouseEvent1(final MouseEvent evt){        //transport 
the 
> parameter of evt to this method 
>         final Element rect = r;       // the element r has been 
initialized 
>         RunnableQueue rq = manager.getUpdateRunnableQueue();     // add 
the 
> event to RunableQueue
>           try {   rq.invokeAndWait(new Runnable() {
>                         public void run() {
>                             ad.mouseClicked(evt);               // set 
mouse 
> event to change the GTV tree
>                            rect.setAttributeNS(null, "x", ""+5); // 
> setAttribute of the document
>                        }; 
>                     });
>             } catch (InterruptedException ie) {
>                 ie.printStackTrace();
>             }
>            if(manager.getUpdateTracker().hasChanged())      // test 
whether 
> the GVTtree has been changed 
>             System.out.println("GTV changed");    }

>        But unfortunately, I could find the GVTtree has been changed only 
by 
> the Attribute changed. If I removed the line of attribute, it seems that 
the 
> GTVTree will not been changed.  I want to know whether this is a right 
way 
> that just only setRootNode() and then call the mouseCliked(). Or I 
should add 
> some code. For the RunableQueue, I think this way is right, because if I 

> removed it, I can not see the result of the Attribute changed. 
>        What should I do to change the GVTtree by one mouseclick?
>        Thanks a lot
>         Regards
>          zhao

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to