Hi Zenobios,
Zenobios <[EMAIL PROTECTED]> wrote on 07/08/2008 02:29:38 AM:
> What I need is the following:
> Split down a SVG Document into it's groups, where I don't need the
parent
> group to include other groups, since for them a new figure will be
created
> and added to the parent figure (which is associated with the parent
group).
> Maybe a bit difficult to explain.
So it seems to me that you are going to great lengths to reproduce
the 'use' element. So given a 'host' document "A.svg" and a source
of these 'figures' document "B.svg".
You can using DOM create a use element:
Element useE = docA.createElementNS(SVG_NS, "use");
Have it replicate the figure from B.svg:
useE.setAttributeNS(XLINK_NS, "xlink:href", "B.svg#g2337");
useE.setAttributeNS(null, "x", "1234");
useE.setAttributeNS(null, "y", "5678");
Alternately you could potentially import the group (docA.importNode)
you want into the Host document A.svg and simply append it (appendChild).
> the element was created via loading the svg doc and then getting a
special
> element with for instance:
>
> Element e = getSvgDoc().getElementById("g2337");
>
> I tested that e != null and is not. After some testing I figured out,
that I
> have to build the whole document and the get my special element from the
> BridgeContext. But thats not what I need.
Ok, so the code below is ment to build an entire document, for many
'simple' SVG elements it might work anyway, but for some elements the
GVTBuilder will need to have been associated with an SVG Document Element.
Depending on the exact details of what you are doing you may be able to
use the GVTBuilder that came from the 'host' document.
Even if you got that to work, I think your approach needs rethinking,
it seems to me that you are trying to 'fight the system'. I'll say
that almost any time you find yourself mucking with the GVT directly
you should step back and ask if you can accomplish the same thing
through only the DOM. Your mixing of DOM and GVT is a double warning
sign to me that perhaps you aren't aware of what you can accomplish
through simply using the DOM.
> thomas.deweese wrote:
> >
> > Hi Zenobios,
> >
> > Zenobios <[EMAIL PROTECTED]> wrote on 07/07/2008 08:40:46 AM:
> >
> >> sorry for pushing this old thread. But I want to do exactly the same
and
> > I
> >> have exactly the same problem: After build(ctx,element) the returned
> >> GraphicsNode is null...
> >
> > I would suspect that either your elements aren't in the SVG
namespace
> > or 'element' is null. Can you show the code that creates 'element'?
> >
> >> tavolate wrote:
> >> >
> >> > I'm trying to do an SVG Editor with Batik and Eclipse.
> >> > I use the Batik DOM to manage the SVG file and after some process I
> > draw
> >> > the SVG elements as image inside a Figure (Draw2d). For each child
> > node
> >> > (text, rect, g..) inside the SVG DOM I would like to make a
> > GraphicsNode.
> >> > So when I modify for example x and y coordinates with my editor, I
> > have to
> >> > modify x and y coordinates of node and then redraw it.
> >
> >
> >
> >> >
> >> > With the code below, mGVTElement after the build is NULL.
> >> >
> >> >
> >> > thomas.deweese wrote:
> >> >>
> >> >> Hi aGO,
> >> >>
> >> >> tavolate <[EMAIL PROTECTED]> wrote
on
> >> >> 12/06/2007 11:48:17 AM:
> >> >>
> >> >>> is it possible to create a GraphicsNode from an Element of a SVG
> >> >> Document?
> >> >>
> >> >> Yes, you have more or less shown the code below.
> >> >> The code below can't work in all cases (in particular the
> >> >> fact that you have set the context dynamic seems like trouble).
> >> >> So what are you trying to do in a wider sense?
> >> >>
> >> >> Or what problems are you having with the code
> >> >> below?
> >> >>
> >> >>> Ex:
> >> >>>
> >> >>> UserAgentAdapter mUserAgent = new UserAgentAdapter();
> >> >>> BridgeContext mCtx = new BridgeContext(mUserAgent);
> >> >>> mCtx.setDynamicState(BridgeContext.DYNAMIC);
> >> >>> GVTBuilder mBuilder = new DynamicGVTBuilder();
> >> >>>
> >> >>> GraphicsNode mGVTElement = mBuilder.build(mCtx, element);
> >> >>>
> >> >>>
> >> >>> element is a part of SVG document for example a rect tag (I can
get
> > it
> >> >> with
> >> >>> document.getElementByTagName(...)).
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/GVT-Builder-
> >> problem-tp14195869p18315781.html
> >> Sent from the Batik - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> >> For additional commands, e-mail:
[EMAIL PROTECTED]
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/GVT-Builder-
> problem-tp14195869p18332662.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>