Steven Huey wrote:
I have it working now, although it does seem to be a pretty resource intensive operation. I ended up having to use the -Xms and -Xmx options for the command line java tool in order to not get any OutOfMemory errors.
Can you quickly explain what's going on behind the scenes that causes this to be so resource intensive? Is there a better way to accomplish what I'm doing?
When you change the size of a viewport (i.e. an SVG element) The entire graphics tree under that element is recreated so % units can be recalculated.
If you can have a 'g' element and simply adjust the transform on that element it will be _much_ faster.
If it matters, the SVG file I'm working with is about 2MB in size.
- Steve
On Mar 20, 2005, at 8:25 AM, Thomas DeWeese wrote:
Steven Huey wrote:
svgElement = (SVGOMSVGElement) canvas.getSVGDocument().getRootElement(); updateManager.getUpdateRunnableQueue().invokeLater( new Runnable() { public void run() { svgElement.setAttributeNS(null, "viewBox", "# # # #"); } } );
The ecmascript version of this works fine for me with CVS Batik:
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg id="foo" width="450" height="500"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 450 500">
<rect x="10" y="10" width="200" height="300"
fill="red" stroke="blue" stroke-width="10"
onclick="document.rootElement.setAttribute('viewBox', '0 0 220 320')"
/>
</svg>
I end up with a RuntimeException and after checking the SVGOMSVGElement source I found:
public SVGAnimatedRect getViewBox() {
throw new RuntimeException(" !!! TODO: getViewBox()");
}
There is no reason for the set call to trigger getViewBox. Is it possible that your code to calculate the viewBox is calling this method? In which case I guess for now you will need to get the raw attribute and parse it yourself.
Is there any other way to dynamically change the size of the viewBox attribute? I'm also looking to change the height and width attributes at the same time. Basically what I'm trying to accomplish is given a large SVG document view only a specific area within the document so I'm trying to set the width, height, and viewBox attributes accordingly.
Thanks,
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
