Hi Landon,

"Redefined Horizons" <[EMAIL PROTECTED]> wrote on 01/17/2008 
11:50:59 AM:

> 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...

   This might be a useful addition for some use cases however normally
using the document structure to reject groups based on bbox works
pretty well.  Also already Batik has issues with very large documents
(where such an index would be most useful) so it may be a problem
space that Batik doesn't fit well into.

   That all said it depends a little what sorts of items would be
indexed. So if you wanted to find vertexes or path segments 
it might be useful.

> 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, usingcode 
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]
> 

Reply via email to