Archie, Thank you very much for the quick response. If you have the patience I had a couple of follow up questions:
I found the Javadoc for the SVGLocatable interface here: http://www.yworks.com/products/yDoc/showcase/batik-1.5/org/w3c/dom/svg/SVGLocatable.html But I didn't find it here: http://xmlgraphics.apache.org/batik/javadoc/ Is there a reason for this? Is http://xmlgraphics.apache.org/batik/javadoc/ the correct place for the most current Apache Batik Javadoc? I'm a little confused about this part of the code you provided: ((SVGLocatable)node).getBBox(); I know that you are calling the getBBox() method of an interface that implements the SVGLocatable interface. Would this implementation be obtained from a DOM Document object, or directly from a JSVGCanvas? Are you also performing some type of cast in this line? A bounding box is exactly what I need to enable selection management and precision snapping, so I would like to figure out how to use the existing technique in Batik that you have mentioned. Thank you for the help. Landon P.S. - I wonder if the JSVGCanvas (or SVG Document) would benefit from a support class that contained a simple spatial index. This would allow for very quick access to objects based on location, instead of having to iterate through every shape. Just a thought... On Jan 17, 2008 8:08 AM, Archie Cobbs <[EMAIL PROTECTED]> wrote: > On Jan 17, 2008 9:33 AM, Redefined Horizons <[EMAIL PROTECTED]> > wrote: > > > Is the ability to work with user selections of shapes built into the > > JSVGCanvas, or is it something I will need to add? (It looks like I > > will need to add it, but I thought I would check here before I wrote > > something from scratch.) > > > > That's something you will have to add. Batik has no notion of a "current > selection". > > > > Is there an existing method that will allow me to obtain all the > > shapes on a JSVGCanvas that are within a specified radius of a mouse > > click? What about obtianing all the shape elements in a DOM of an SVG > > document that are withing a specified radius of a coordinate in the > > SVG coordinate system? > > It's easy to find the bounding box of any graphical element, using code like > this: > > SVGRect bbox = ((SVGLocatable)node).getBBox(); > > This will be in local coordinates however, so you may want to convert that > to global coordinates. The matrix to do this is gotten like this: > > ((SVGLocatable)node).getTransformToElement(topNode)); > > where topNode is the top <svg> node. > > So if the bounding box is a good enough approximation to "where a shape is" > then you can use it to determine distance from mouse clicks, etc.. > > -Archie > > -- > Archie L. Cobbs > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
