Detection of intersecting objects


#1
Our application has multiple GoViews hosted in tab frames, such that one document/view is visible at any time. User activity in one document can necessitate the programmatic insertion of a node or nodes into another not currently visible document. Therefore it seems we either need to calculate the optimal insertion point, a daunting task, or insert the new objects into an upper layer, awaiting the user's manually moving the new objects to a position not over any other objects, at which time the new objects would be moved to the default layer. What GoDiagram methods and events could be used to help determine when movement of a selection has ended, and whether the selection rect or region obscures objects in another layer? Thanks very much for your advice!

#2

GoObject doesn’t have any Intersects predicate, which I believe is what you are asking for. However the next version of GoDiagram (2.2) will have a new predicate:
public bool GoDocument.IsUnoccupied(RectangleF r, GoObject skip)
I believe this will help solve your need. It basically uses the same information that links use for the “AvoidsNodes” functionality. It thus isn’t as precise as true intersection predicates would provide, because it summarizes the document into a grid of 10x10 unit areas.
You’ll still need to code up your own algorithm for how to find an unoccupied area, whether you want the closest spot in a particular direction, or whether you want the closest spot within a particular region, or whatever criteria you have.