xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leakha.He...@csiro.au
Subject FW: Refreshing screen display after modifying attributes on graph ics node of tree
Date Fri, 26 Oct 2001 23:43:11 GMT
Hi,

I have an svg document containing more than 1 SVG layer.  The layers are
displayed on the screen.  I want to give the user the ability to turn of
some of the layers after it has been displayed. 

However I am having a problem with this.  I have attempted to set the
graphic nodes in the GVT tree invisible and to redisplay the updated GVT
tree.  However the changes in the GVT Tree are not updated on the display
immediately.  But I noticed that the changes seem to take effect, ie a
layer set to invisible no longer appears, only when you zoom in.   

Question : how can I get the display to reflect the changes in the GVT Tree
immediately.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The code to set the visibility of the graphic nodes and re-rendering is as
follows: 

****************************************************


public class RimisCanvas extends JSVGCanvas  {

    public RimisCanvas() {
        	super();

    }

    public void modifySVG(String id, boolean visflag){
            System.out.println(bridgeContext);
        System.out.println(id);
        System.out.println(visflag);
        System.out.println(svgDocument);
		org.w3c.dom.Element e = svgDocument.getElementById(id);
        System.out.println("e:"+e);
		GraphicsNode gn = bridgeContext.getGraphicsNode(e);
        if (gn instanceof CompositeGraphicsNode){
            CompositeGraphicsNode cgn = (CompositeGraphicsNode)gn;
            for (int i = 0; i<cgn.size();i++){
                 System.out.println("CGN 1:"+cgn.get(i));
                  if (cgn.get(i) instanceof CompositeGraphicsNode){
                    CompositeGraphicsNode cgn2 =
(CompositeGraphicsNode)cgn.get(i);
                    for (int j = 0; j<cgn2.size();j++){
                        System.out.println("j:"+j);
                        System.out.println("CGN
2:"+((CompositeGraphicsNode)cgn2.get(j)).get(0));
                        GraphicsNode shpnode =
(GraphicsNode)((CompositeGraphicsNode)cgn2.get(j)).get(0);
                   	if (visflag) {
                            System.out.print("inside visflag true");
	    	            	shpnode.setVisible(true);
                        } else {
                            System.out.print("inside visflag false");
                            shpnode.setVisible(false);
                        }

                    }
                  }
            }
        AffineTransform at = new AffineTransform(getRenderingTransform());
       setRenderingTransform(at);
    }
}

**************************************************************
++++++++++++++++++++++++++++++++++++++++++++++


The operating system : Windows 2000. Java version : JDK1.3.1.  Batik version
1.1rc2.


Some of the commands I have tried unsuccessfully to repaint are as follows:
	(a) immediateRepaint()
	 (b) invalidate() 
	(c)AffineTransform at = getRenderingTransform()
		 setRenderingTransform(at)


Could you also advise me if there is a better way of setting a layer to be
invisible after it is displayed on the screen.


Thank you.


Regards
Leakha






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


Mime
View raw message