Author
Topic: Find loop by click (Read 3199 times)

dinekro

I have the following question.In the drawing, there are many closed loops. Let's say its are closed polylines.My problem is: When the user clicks on the screen. I must find loop, inside of which was made-clicking.

Write in C #.

The first thing that comes to mind:1) Implement the routine: test point owned to a closed polyline.2) Find all the circuits in BoundaryBox which gets the input point.3) Check for each hit.

Looks somewhat complicated for such a simple, at first glance, the problem.

At first I went the other way. I thought that the method Editor.Snap (snapMode, inputPoint) returns the nearest snap point. Then I would choose the snap mode "nearest", and get a point at the nearest loop (polyline). Most likely this would be the desired loop. But, as far as I understand, this method not suitable...

Maybe there is any native way to implement this simple task? I thought I still use TraceBoundary, but it creates a new object. But I want that the object that the drawing.Maybe, if we transform the polylines to the blocks - will be easier?