Skip to main content

Re: SvgTranscoder question

  • From: Elie Naulleau <semiosys@...>
  • To: dev@...
  • Subject: Re: SvgTranscoder question
  • Date: Thu, 07 Aug 2008 19:30:55 +0200
  • Mailing-list: contact dev-help@...; run by ezmlm
  • Organization: Semiosys SARL

Hi Kirill,

Thanks for your answer. You are right it is actually a Batik question. It seems that the Batik mailing list is host on a yahoo group, and I could not post there.

Actually I just found the solution
The trick was to declare "ctx.setDynamicState(BridgeContext.DYNAMIC); "
Otherwise the BridgeContext does not map GraphicsNodes with SVG DOM Nodes.
Cheers,
Elie

UserAgentAdapter ua = new UserAgentAdapter();
        userAgent = ua;
        loader = new DocumentLoader(userAgent);
        ctx = new BridgeContext(userAgent, loader);
        ctx.setDynamicState(BridgeContext.DYNAMIC);
        ua.setBridgeContext(ctx);
       

       
        GVTBuilder builder = new GVTBuilder();
        Document svgDoc;
        try {
            svgDoc = loader.loadDocument(this.uri);
            System.out.println("Building: " + this.uri);
            GraphicsNode gvtRoot = builder.build(ctx, svgDoc);
            renderer.setTree(gvtRoot);
           
            transcodeGraphicsNode(gvtRoot, "");
           
        } catch (IOException ex) {
            Logger.getLogger(SVGCustomTranscoder.class.getName()).log(Level.SEVERE, null, ex);
        }







Kirill Grouchnikov a écrit :
Hi,

In the future i would suggest mailing to the "users" list since that is a more active place.

To your question - i think that it might be better addressed to the Batik developers. It has been quite some time since i've written the SvgTranscoder, and looking in the debugger i don't see any relevant information in the ShapeNode or its ancestors to link back to the original SVG DOM. This might be by Batik's design since sometimes a single SVG construct is transcoded into multiple Java2D nodes. But you'd be much better off asking this question in the Batik lists.

This is not specific to Flamingo's transcoder - that would apply to any application that registers a GVTTreeBuilderListener on a JSVGCanvas and examines the GVT root in the gvtBuildCompleted event.

Thanks
Kirill

----- Original Message ----
From: Elie Naulleau <semiosys@...>
To: dev@...
Sent: Thursday, August 7, 2008 3:53:32 AM
Subject: SvgTranscoder question

Hi all,

I am extending SvgTranscoder into a SVGCustomTranscoder for the
following purpose :

I need to be able to access the generated java2D shapes, through an
array of a map for instance.

so each time we have a
shape = new Something();
I want to add
map.put( shapeId, shape);

Indeed, the initial SVG file is going to be defined by hand, specifiying
for each shape a unique id. Inkscape allow this very well.

<rect  id="myId001" width="174.28572"  height="60"  x="54.285713" 
y="58.076469"
     
style="fill:#ffff00;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
/>



So my question is : how to retrieve the initial SVG node id when
SvgTranscoder uses batik ShapeNode (derived from AbstractGraphicsNode).

ShapeNode seems to have lost any reference to the SVG Dom Node (?)

Any hint ?

Thank you,
Elie


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...





SvgTranscoder question

Elie Naulleau 08/07/2008

<Possible follow-up(s)>

Re: SvgTranscoder question

Kirill Grouchnikov 08/07/2008

Re: SvgTranscoder question

Elie Naulleau 08/07/2008

Re: SvgTranscoder question

Kirill Grouchnikov 08/07/2008
 
 
Close
loading
Please Confirm
Close