(I am not sure if this is the right way to post a news to this Newsgroup)

Hello,
I want to make an application to view and draw with Java using BATIK.

I made a Program that has drawing tools and other CAD-Functions.
Up to now the Program is saving the Elements in a Vector with the
attributes
(type, startX, startY, endX, endY)
The type defines for example a Line.
Now I want to use Batik to save the data in a DOM structure.
By using SVGGraphics2D, I am able to save the data within the root
element and to write them to a svg-File.

However, I am not able to write the data to a child element within the
DOM structure. The setTopLevelGroup() method of SVGGraphics2D doesn't
seem to work. After applying setTopLevelGroup to a child element, all
data is still appended the root element:

Document doc;
SVGGraphics2D svgGenerator;
Shape currElement;
...
 // following 4 lines don't seem to have any effect
 Element e=svgGenerator.getTopLevelGroup();
 Element g = doc.createElement("g");
 e.appendChild(g);
 svgGenerator.setTopLevelGroup(g);

 // add graphical element to new top level group
svgGenerator.fill(currElement);

Anyone has an idea how to use the setTopLevelGroup() command?

Another question is how Batik works.
I found out that if I open a new svg-File it is parsed
with SAX. Within the Class: "org.apache.batik.bridgeDocumentLoader"

Up to now I am not able to use the Batik DOM for my application.
Also I cannot include my DOM created with GenericDOMImplementation
into the squiggle browser.
(import org.apache.batik.dom.GenericDOMImplementation;)
                   
Can annybody give me a hint how to connect my drawing tool with the
Batik-DOM and how to use it within the svgBrowser?

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++

Jetzt ein- oder umsteigen und USB-Speicheruhr als Prämie sichern!


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

Reply via email to