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 Fernando Mendez <Fe...@enst.fr> on 2004/12/07 16:54:41 UTC

Modifying path elements.

Hello,
 I am trying to modify path elements, and now, in order to modify a 
single point I rewrite the whole d attribute for the path. Is there a 
way to modify only one point in the path without having to rewrite it 
completely?

Thanks in advance for all your help and attention.
Fernando MENDEZ.
ENST - PARIS


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


Re: Modifying path elements.

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

>  I am trying to modify path elements, and now, in order to modify a 
> single point I rewrite the whole d attribute for the path. Is there a 
> way to modify only one point in the path without having to rewrite it 
> completely?

You can use SVG DOM API SVGPathSegList to modify particular point on the
Path.
eg:
SVGPathSegList segList = pathElement.getPathSegList();

then you can iterate the SVGPathSegList.

Check the SVG DOM API for more information on SVGPathSegList

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com



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


RE: Modifying path elements.

Posted by TJ Teegan <tj...@hotmail.com>.
Hello,

I am pretty sure you have to set the path's entire "d" attribute, even if 
you only want to change one point.

The only way I know how to do this in Batik looks something like this:

//Get the element to modify, there are a number of ways to do this, here is 
one
SVGDocument svgDoc = svgCanvas.getSVGDocument();
Element myPath = svgDoc.getElementById("myPath");

//Get the attribute to modify
String currentD = myPath.getAttributeNS(null, "d");

/*
*Provide some code to change the point, store the result in String newD
*/

//Set the new attribute
myPath.setAttributeNS(null, "d", newD);

I am not sure if this is the most efficient way to set an attribute, but it 
works.

Depending on what you are doing you may have to do this through your canvas' 
update thread to see the results.  For more information on that see 
http://xml.apache.org/batik/javaScripting.html#Threads

Sorry if this is alot of information you already know, hopefully some of it 
is helpful.

Good luck,
TJ Teegan


>From: Fernando Mendez <Fe...@enst.fr>
>Reply-To: "Batik Users" <ba...@xml.apache.org>
>To: Batik Users <ba...@xml.apache.org>
>Subject: Modifying path elements.
>Date: Tue, 07 Dec 2004 16:54:41 +0100
>
>Hello,
>I am trying to modify path elements, and now, in order to modify a single 
>point I rewrite the whole d attribute for the path. Is there a way to 
>modify only one point in the path without having to rewrite it completely?
>
>Thanks in advance for all your help and attention.
>Fernando MENDEZ.
>ENST - PARIS
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: batik-users-help@xml.apache.org
>

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


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