SVG Animation testing question
Jack Waroon <[email protected]> Wed, 8 Apr 2015 12:17:06 +0200 (CEST)
| Newsgroups | gmane.text.xml.batik.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I am trying to build a testing environment for SVG animation publishing and to evaluate Batik for this task.
For this I need to be able to walk through the DOM "scene graph" of SVG elements at a given time (i.e. verifying all elements are at expected positions, with expected local transforms or attributes etc.).
I tried to set up SVG animation handling though I am not able to obtain any means to perform this walkthrough.
The initial code looks like this (some simplifications apply):String parser = "org.apache.xerces.parsers.SAXParser";
BatikParserFactory factory = new BatikParserFactory(parser, true); // own class to get a proper XML/SAX parser
factory.setValidating(false);SVGOMDocument document = (SVGOMDocument) factory.createDocument("svg_animation_test_001.svg");TestUserAgent userAgent = new TestUserAgent(); // from Batik's testing suite
SVG12BridgeContext bridge = new SVG12BridgeContext(userAgent);CSSEngine cssEngine = ((SVGDOMImplementation) document.getImplementation()).createCSSEngine(document, bridge);SVGAnimationEngine engine = new SVGAnimationEngine(document, bridge);
engine.setCurrentTime(2.0f);
So at this point I have a SVG document that is parsed, DOM built and time set to 2 seconds. However, I don't know how to obtain any instance allowing me to traverse through DOM corresponding to the given time. I noticed SVGAnimationEngine has a method createDocumentRoot returning TimedDocumentRoot which might be something similar to what I need, however this method is protected and hence not accessible.
Is there any client-side mean for inspecting DOM at a given time? Some class instance I can get or callbacks I can register to?
Thank you!
Jack