Tim Hesse wrote:

> I need to "extract" the elements within a bounding rectangle which
> would entail slicing lines and polys that are in the rectangle but
> run over the edges of the bounding rectangle.
>
> Any help for things to look at would be greatly appreciated, tia

Let's call your "bounding rectangle" the Big Box.

I'm assuming that you don't just want to rely on using the Big Box as a 
clipPath for the other content, since that would solve the problem (in terms 
of drawing their intersection) but without having those things available for 
subsequent data analysis.

I've never really worked on this problem but I think I'd proceed as follows:

1. Find all the drawn objects in the SVGDocument. I'd probably loop through 
the W3C list of nodetypes of drawn objects :
'path', 'text', 'rect', 'circle', 'ellipse', 'line', 'polyline', 'polygon', 
'image' and 'use'. I'd add <g> to that list and then do a
getElementsByTagName on each type of rendered object until I have a big list 
of just the objects that are drawn on the canvas, hence avoiding <filter> 
and <def> and the like.

2. Find the bounding box of each drawn object using getBBox()

2a. If the drawn object is entirely inside the BigBox then it's easy
2b If it's entirely outside the BigBox, then its easy
2c. If its partly inside, then calculate the intersection of the box with 
the object using the advice of Kevin Lindsey at 
http://www.kevlindev.com/gui/math/intersection/index.htm
2d. If the object we're looking at is a text object, then ick -- give it to 
a student and let them work on it.

I'll be interested to see if others suggest something more straightforward, 
since this is just what came to mind.

David




-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to