Hello all,

I'm trying to draw a selection box on top of an existing svg document
and I'm  having trouble getting access to the graphic object to
presumably draw on. The larger goal is I'm trying to implement a mouse
drag select function for my application. I got all the mouse listeners
and rect transforms sorted out I just cant get access to something to
draw on. I dont have to modify the DOM for the rect to draw because it
is temporary, all I want to do is find out what elements are in its
bounding box of the rect change some attributes of the elements and
remove the rect when they mouse up.

Any clues for the clueless?
 
When I get down to ;

SVGGraphics2D g = new SVGGraphics2D(document);

It throws an error 
org.apache.batik.svggen.SVGGraphics2DRuntimeException: domFactory should
not be null
        at org.apache.batik.svggen.SVGGeneratorContext.setDOMFactory(Unknown
Source)
        at org.apache.batik.svggen.SVGGeneratorContext.<init>(Unknown Source)
        at org.apache.batik.svggen.SVGGeneratorContext.createDefault(Unknown
Source)
        at org.apache.batik.svggen.SVGGraphics2D.<init>(Unknown Source)

... code context follows ...

canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
                canvas.addSVGLoadEventDispatcherListener
                    (new SVGLoadEventDispatcherAdapter() {
                            public void svgLoadEventDispatchStarted
                                (SVGLoadEventDispatcherEvent e) {
                                // At this time the document is available...
                                document = canvas.getSVGDocument();
                               
                                
                                // Registers the listeners on the document
                                // just before the SVGLoad event is
                                // dispatched.
                                registerListeners();
                                // It is time to pack the frame.
                               // frame.pack();
                            }
                        });
                

                
                try{
                canvas.setURI(seatingURL.toString());
                }catch(Exception ed){System.out.println(ed.toString());}
                
                
                
//            Set the JSVGCanvas listeners.

canvas.addSVGDocumentLoaderListener(new SVGDocumentLoaderAdapter() {
                    public void documentLoadingStarted(SVGDocumentLoaderEvent
e) {
                       // label.setText("Document Loading...");
                        if (debug) System.out.println("Document Loading...");
                        
}

public void documentLoadingCompleted(SVGDocumentLoaderEvent e) {
                       // label.setText("Document Loaded.");
                        if (debug) System.out.println("Document Loaded.");
                        

                                Document document = e.getSVGDocument();
                                Element  documentElement = 
                                (Element)document.getDocumentElement();

                        
                    }
                });

canvas.addGVTTreeBuilderListener(new GVTTreeBuilderAdapter() {
                    public void gvtBuildStarted(GVTTreeBuilderEvent e) {
                      //  label.setText("Build Started...");
                        if (debug) System.out.println("Build Started...");
                    }
                    public void gvtBuildCompleted(GVTTreeBuilderEvent e) {
                     //   label.setText("Build Done.");
                        if (debug) System.out.println("Build Done.");
                        
                      
                    }
                });

canvas.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
                    public void gvtRenderingPrepare(GVTTreeRendererEvent e) {
                    //    label.setText("Rendering Started...");
                        if (debug) System.out.println("Rendering Started...");
                    }

 public void gvtRenderingCompleted(GVTTreeRendererEvent e) {

                   
canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new
Runnable() {

public void run() {
// now change the DOM and we will get a free repaint!   
                                                
updateDOM();
 }
});
                
 }
 });
                
                
SVGGraphics2D g = new SVGGraphics2D(document); // (bang!)

-- 
David Avery
[EMAIL PROTECTED]
Ph: 512.439.1209


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

Reply via email to