I’m using GoView.PickObjectsInRectangle method to select all objects (links and nodes) in a specific rectangle.
I was getting to much links back so I went into Reflector to investigate and found that this method use the object’s Bounds property to determine if the pick-up rectangle intersect with it and not the real geometry of the link.
This cause the method to return links that are not actually intersect with the rectangle, only their virtual bound (which does not mean anything real to me) does.
Is there simple solution to this problem?
I know that the geometry might be complicated, but it is still important.
Are you using Beziers?
No, simple straight lines from one port to another.
That’s how PickObjectsInRectangle works if you use SelectableOnlyIntersectsBounds or AnyIntersectsBounds. If you use SelectableOnlyContained, the whole line will need to be in the selection rect. If you want rectangle intersects some point on the line, you’ll need to code that yourself.
Thank you for the answer.
If you think about it, it you specify that the whole link needs to be contained within the pick rectangle it also means that the bounds of the link contained in the rectangle so it doesn’t make different to me.
Can you point me to which way it the easiest to perform this check myself? Should I use GoLink, GoStroke or maybe GraphicsPath?
You can use GoObject.GetNearestIntersectionPoint (and GoStroke.GetNearestIntersectionPoint) to compute intersections.