I have floor plan drawings, where rooms are divided by polygons. Inside these rooms are block references, line, arcs, ... witch is the content of those rooms. I am trying to associate all objects with their "surrounding" polyline.
Now for business reasons, the SelectCrossingPolygon method is perfect, but it does not support selecting objects outside of the current viewing area. But I cannot afford to have my user's screen stop moving by itself, zomming on the rooms to select what's inside it. And moreover, I don't realy need to select these items, but I just need to identify them.
Is there some similar mechanism that would allow me to obtain all objects crossing or within a certain set of points (forming a polygon)? Mabee a DatabaseService method?
In the past, I have developped a pretty good PointInPolygon algorithm, but that is eighter based on the bounding box of the objects of its center point (center of the bounding box), witch can lead to errors (imagine a convex L shaped desk fitted around a column). This is to some extent acceptable most of the time but creates irregularities in the associations, and does not consider odly-shaped block definitions, where the selection methods do....
Any ideas are welcom!
Thanks in advance!
I do this kind of stuff all the time. You need to address the following challenges to get this to work
This is not a huge challenge, but you will be writing a lot of code. Also, you have to handle a TON of gray areas, like what constitutes "In" the room; if the point is on the line; where is the insert point of the blockref, etc.
Good luck
HomeBoy Out
Thanks for the response!
Unfortunatly, that will not solve my problem. This would give me (pretty mutch) exactly the same results has the PointInPolygon (mathematical - winding number algorithm) approach. The only thing it would add would be to probably consider correctly any arcs in the polyline. With VBA (our current production version of the app is in VBA), the IntersectsWith methods was too slow compared to the mathematical solution even considering this advantage....
What it will not give me is the consideration of the actual visual dimentions of the block; it only considers its centroid. Again, if we have a long L shaped desk that folows the boundary of a room, the desk might not be positioned in the same room as its centroid.
Unless there is a garentee that the centroid of an object WILL ALWAISE be on a "graphical" part of that object... And that is a possibility, I am far from being a geometry expert, but I taugh it was not in fact garenteed to be on a visible part of that object....
Thanks alot for the input! Happy to know that I'm not the only one doing this kind of thing in this world! 😉
I've been fighting this problem of having to have the objects in the current view for the Selection routines to work for years now, and the slowness of the IntersectWith method is not the main problem, if you are using large coordinate systems (like a State Geographical) then it will return incorrect intersection results.
You can "simulate" the Crossing polyline by creating an area object (I did it with a hatch in VBA) which will give you everything that intersects (Inside or crossing). Problem is that intersectwith uses the bounding box for block refs, so you will get some false hits. For those items, you can roll through the points that make up the geometry in the block def, and see if they are inside your pline.
HomeBoy Out