Hi Mathieu,
A couple of things. If you're just modifying the document, you can make your
modifications in a Thread run in the JSVGCanvas's UpdateManager and have your
updates be shown without having to mess with the current transform:
JSVGCanvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(someThread);
If that's not possible and you absolutely need to mess with the rendering
transform you should do something like this:
Store the current rendering transform.
Load the (new) document.
* Wait for the GVT tree to render.
Reapply the stored rendering transform.
What's happening to you is that you're applying the stored transform, then the
document finishes loading and the default rendering transform is applied.
* This is how to wait for the GVT tree to render.
public class GVTClass extends GVTTreeRendererAdapter {
public void gvtRenderingCompleted(GVTTreeRendererEvent event) {
// Set your transform to the canvas here.
}
}
There may be a better solution; in this case, the default transform is briefly
shown before the old one is applied.
Michael________________________________ From: Mathieu Pedrero [mailto:[email protected]] Sent: Tue 6/16/2009 8:30 AM To: [email protected] Subject: Re: About setRenderingTransform() method from JSVGCanvas! I need to be more precise: Here is the method I call (which is supposed to 1) keep the current Affine transform applied to the canvas 2) load the "document" to the canvas (it's the same document that was displayed before: the only changes are some svg groupments which are hidden in this new version of the document. That's why i would like to keep the former affine transform applied). 3) apply the Affine transform. public void actionPerformed(ActionEvent arg0) { modification(); AffineTransform at = Main.fenetre.getCanvas().getRenderingTransform(); Main.fenetre.mAJCanvas(); //equivalent to a setSVGDocument(document). mAJCanvas() is defined previously. Main.fenetre.getCanvas().setRenderingTransform(at); } Moreover, when i try to print the Affine Transforms (as it is done in the following method), the former affine transform is applied, but only for a few seconds. The SVGCanvas returns to an Identyty renderingTransform. public void actionPerformed(ActionEvent arg0) { modification(); AffineTransform at = Main.fenetre.getCanvas().getRenderingTransform(); System.out.println(at); Main.fenetre.mAJCanvas(); Main.fenetre.getCanvas().setRenderingTransform(at); AffineTransform test = Main.fenetre.getCanvas().getRenderingTransform(); System.out.println(test); } Can you help me please? Thanks -- Mathieu 2009/6/16 Mathieu Pedrero <[email protected]> Hi I would like to apply an affine transform to my jsvg canvas. Unfortunately, when I try to use the method setRenderingTransform(newAffineTransform) of my canvas, the newAffineTransform is no applied! Can you help me please? Thanks! -- Mathieu
<<winmail.dat>>
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
