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 Max Weis <ma...@gmail.com> on 2014/03/20 22:07:43 UTC

Path-Data from SVG not complete

<http://batik.2283329.n4.nabble.com/file/n4655935/postSVG.jpg> 



Hello, 
I try to parse the path data from an SVG file into a (JAVA) shape. 
the result is, however, as can be seen in the images is not complete. 
Can you tell me if I do something wrong e.g.when iterating the d-attributes? 


CODE:


String parser = XMLResourceDescriptor.getXMLParserClassName();
	    SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);

	    Document doc = f.createDocument(getClass().getResource(path)
		    .toString());

	    PathParser pp = new PathParser();
	    AWTPathProducer ap = new AWTPathProducer();
	    pp.setPathHandler(ap);

	    NodeList nl = doc.getElementsByTagName("path");

	    for (int i = 0; i < nl.getLength(); i++) {
		Element elm = (Element) nl.item(i);

		// Get path data
		String pathData = elm.getAttribute("d");
		pp.parse(pathData);



--
View this message in context: http://batik.2283329.n4.nabble.com/Path-Data-from-SVG-not-complete-tp4655935.html
Sent from the Batik - Users mailing list archive at Nabble.com.

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


Re: Path-Data from SVG not complete

Posted by Max Weis <ma...@gmail.com>.
thanks, done. 
I should have discovering my mistake earlier. 
The parse method is not iterated. 
so I have just put together each path to a complete

// Get path data
		String pathData = elm.getAttribute("d");
		pp.parse(pathData);
		Area area=new Area(ap.getShape());
		mainArea.add(area);



--
View this message in context: http://batik.2283329.n4.nabble.com/Path-Data-from-SVG-not-complete-tp4655935p4655938.html
Sent from the Batik - Users mailing list archive at Nabble.com.

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