Dear All,

I have a component extending the JSVGCanvas class that needs to render an
SVG file from disk.  I am currently calling canvas.setURI(url.toString())
which seems to find and load the file but it then puts up an exception
window complaining of zero dererminants when trying to create an inverse
AffineTransform.  

This is the part of code that loads the document..

    // cl is the source of the SVG url

    JSVGCanvas component = new JSVGCanvas();
    javax.swing.JOptionPane.showMessageDialog(null, cl.getURL().toString());

    component.setURI(cl.getURL().toString());
    document = component.getSVGDocument();

    javax.swing.JOptionPane.showMessageDialog(null, "Document loaded into
component : " + document);

The final line shows null as the document.  Shortly after I get the affine
transform exceptions.
    
The svg file is about as simple as it gets:

<svg xmlns="http://www.w3.org/2000/svg";
xmlns:xlink="http://www.w3.org/1999/xlink"; width="150" height="150">
        <circle style="fill:yellow" cx="200" cy="100" r="90" /> 
</svg>

and the exception is:

java.awt.geom.NoninvertibleTransformException: Determinant is 0         
        at
java.awt.geom.AffineTransform.createInverse(AffineTransform.java:1898)  
        at
org.apache.batik.swing.gvt.JGVTComponent.setRenderingTransform(Unknown
Source)         
        at
org.apache.batik.swing.svg.JSVGComponent.computeRenderingTransform(Unknown
Source)         
        at org.apache.batik.swing.gvt.JGVTComponent.setGraphicsNode(Unknown
Source)         
        at org.apache.batik.swing.svg.JSVGComponent.access$201(Unknown
Source)         
        at
org.apache.batik.swing.svg.JSVGComponent$SVGListener.gvtBuildCompleted(Unkno
wn Source)      
        at org.apache.batik.swing.svg.GVTTreeBuilder$2.run(Unknown Source)

        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)

        at java.awt.EventQueue.dispatchEvent(EventQueue.java:337)       
        at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:131)         
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:98)    
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)    
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)

Is there a better way to load a document from file?  I dont really want the
canvas at this stage.  I know of the SAXSVGDocumentFactory class but the
constructor needs a classname for a SAX parser, which I cannot find.

Can anyone shed light on this problem?

Thanks,
Dave

************************************************************************
This Internet E-mail is intended solely for the person to whom it is addressed. It may 
contain confidential or privileged information. If you have received it in error 
please notify us immediately by telephone and destroy the transmission. You must not 
copy, distribute or take any action in reliance on it.

Aerosystems International               Phone: +44 (0)1935 443000
                                        Fax  : +44 (0)1935 443111
                                        Web  : www.aeroint.com
************************************************************************

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

Reply via email to