[email protected] wrote:
Right. The easiest way to map things is to get the bbox of
'node' (same as position above).
Tom,
I was trying to avoid this, because at the time that 'node' is imported,
the GVT tree isn't computed so node.getBBox() returns null. I did
figure out how to get it computed as follows:
UserAgentAdapter agent = new UserAgentAdapter();
BridgeContext ctx = new BridgeContext(agent);
GVTBuilder builder = new GVTBuilder();
GraphicsNode rootGN = builder.build(ctx, ourDoc);
And then all the bboxes are available. Question: does invoking a
GVTBuilder() at this point have any bad side effects or is there another
way of doing this? Remember I am doing this inside the UpdateManager's
thread.
So far I have discovered that I can get the translation done by just
setting the viewport on the SVG element as follows:
node.setAttribute("x", Double.toString(position.getX()));
node.setAttribute("y", Double.toString(position.getY()));
node.setAttribute("width", Double.toString(position.getWidth()));
node.setAttribute("height",
Double.toString(position.getHeight()));
This way I don't need the bbox of 'node'. However, once I need
rotation it all gets screwed up both in terms of position and scale.
I'm still working on that but I wanted to follow up on your helpful post
with what I had so far.
--
Alan Deikman