So I have some <path> elements in my SVG document and I want to get the
bounding box.
I tried this (basically guessing at the procedure):
public static Rectangle2D getPathBBox(SVGDocument doc, String name) {
SVGRect rect;
SVGOMPathElement pe;
pe = (SVGOMPathElement)doc.getElementById(name);
pe.setSVGContext(new SVGPathElementBridge());
rect = pe.getBBox();
return new Rectangle2D.Double(rect.getX(),rect.getY(),rect.getWidth
(),rect.getHeight());
}
But it went boom:
at org.apache.batik.bridge.AbstractGraphicsNodeBridge.getBBox(Unknown
Source)
at org.apache.batik.dom.svg.SVGLocatableSupport.getBBox(Unknown Source)
at org.apache.batik.dom.svg.SVGGraphicsElement.getBBox(Unknown Source)
at SVGDocUtil.getPathBBox(SVGDocUtil.java:160)
Any help gratefully accepted.
Phil
--
Visit http://www.darkisle.com for photos of castles, cairns and other
historic sites in the British Isles.