You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Mathieu Pedrero <ma...@centraliens-lille.org> on 2009/07/06 13:46:06 UTC
Adding basic shapes to an existing document.
Hello!
I've got a svg document displayed on a JSVGCanvas. I would like to add some
basic shapes (as circles, rectangles) by an action of the user, on this
document, into a g group called "Layer1", for example.
I know i have to modify the document, but i'm a little bit lost with the
different types of trees and elements which are used in the batik project,
and related in the javadoc API (node, element, SVGElement, SVGOMElement and
so on...).
Can you make me a quick summary of the different types of trees used in the
Batik project, tell me which one i have to study in my case?
Thank you for your help!
--
Mathieu
RE: Adding basic shapes to an existing document.
Posted by "Bishop, Michael W. CTR USJFCOM JFL" <mi...@jfcom.mil>.
Most of this can be done in straight DOM without much use of Batik. I've spent the last couple of years working on an SVG whiteboard application which started as what you describe.
Collect data from user's input. For instance, if you're going to drag a rectangle with the mouse, capture the starting mouse press coordinates and the mouse release coordinates (AWT).
Transform these points through the inverse of the viewing transform of the JSVGCanvas (AWT/Batik).
Create a new element in the SVG namespace and set the appropriate attributes (x, y, width, height) using DOM.
Append the element to the <g> group (DOM) in a thread run in the JSVGCanvas's update manager (Batik).
________________________________
From: mathieu.pedrero@gmail.com on behalf of Mathieu Pedrero
Sent: Mon 7/6/2009 7:46 AM
To: batik-users@xmlgraphics.apache.org
Subject: Adding basic shapes to an existing document.
Hello!
I've got a svg document displayed on a JSVGCanvas. I would like to add some basic shapes (as circles, rectangles) by an action of the user, on this document, into a g group called "Layer1", for example.
I know i have to modify the document, but i'm a little bit lost with the different types of trees and elements which are used in the batik project, and related in the javadoc API (node, element, SVGElement, SVGOMElement and so on...).
Can you make me a quick summary of the different types of trees used in the Batik project, tell me which one i have to study in my case?
Thank you for your help!
--
Mathieu