Finding innermost closed region at a view point


I have a GoView where User draws basic shapes (GoStroke, GoRectangle, GoEllipse, GoPolygon...etc). Whenever user context clicks on a point and wants to fill immediate closing region, I would like to create
a new GoObject/GoShape with that region as bounds and fill it using black brush. Could you please suggest the best way to accomplish this task.

I don’t know an easy way. We do support a vector drawing class called “GoDrawing”. There are some pre-defined “GoFigures” that use the GoDrawing class, but you can also define your own shapes with code.

(Northwoods.Go.Drawing API reference is included in the GoWin.chm help file)

FireHazard, for example, is defined by the code:

GoDrawing s = new GoDrawing();
s.SameEndPoints = true;
s.ReshapablePoints = false;
s.StartAt(.1f, 1);
s.CurveTo(-.26f, .63f, .45f, .44f, .29f, 0);
s.CurveTo(.48f, .17f, .54f, .35f, .51f, .42f);
s.CurveTo(.59f, .29f, .58f, .28f, .59f, .18f);
s.CurveTo(.8f, .34f, .88f, .43f, .75f, .6f);
s.CurveTo(.87f, .48f, .88f, .43f, .88f, .31f);
s.CurveTo(1.18f, .76f, .82f, .8f, .9f, 1);
s.LineTo(.1f, 1);

and you can fill these with brush colors, including gradients, (see the example from the User Guide).

so, that’s a mechanism for creating the shape you need. How you determine the points along the edge of other shapes… that requires some math.