Hi Olivier "HODAC, Olivier" <olivier.ho...@airbus.com> wrote on 09/02/2009 10:04:16 AM:
> I want to change dynamically in java the position and some > attributes of my initial svg file. I am focussing for the moment on > the transform attribute (to move and rescale my object) and the fill > attr ( to change the color) I am doing the following. You can see that > I have to create the whole transform value string each time (I could > have used the format method, by the way) by hand > Is there a way to do that with some ready to use classes (ex: > TransformableElement.setTransform(X_POS, value)) ? If you check out the SVG DOM there are interfaces to get the transform list associated with an element. Note that, at least in Batik, everything is still based on the DOM String so we will effectively do what you are doing. Something like: ((SVGTransformable) getElt()).getTransform().getBaseVal().getItem(0).setTranslate(x, y); The getItem is needed because it tracks 'complex' transform attributes. This can be useful as it would allow you to keep your scale transform independent of the translate (otherwise you may need to multiply your transform values by the scale values).