ShapeEditor.AddPoint

The ShapeEditor.AddPoint function does work as expected.

When calling the AddPoint function it appears a new part is being added to the shape. I asked about this several years ago and I believe it has to do with Digitizing but there is very little documentation on that. Is there a reason this can’t simply add a new point to the shape?

Thanks
ToddH

Hello Todd.

Taking a quick look at the code, I don’t yet understand all about the digitizing flag, but it has to be true in order to add the point, and it looks like it will always add a Part.

Although I’m aware of your context, if you can get a reference to the Shape itself, and call the AddPoint method of the Shape, it will not add a Part.

Hope that helps. If it’s not that simple, maybe post that section of your code, and we can take a deeper look.

Regards,
Jerry.

We are trying to use the ShapeEditor to create a new polygon based on coordinates provided by the user. I have tried to use insertpoint in the editors raw data, there may be another way to do this I’m not familiar with.

Finally getting time to look at this a bit more.

In the ShapeEditor, the digitizing flag is set to true if you are creating a new shape, false if you are editing an existing one. The ShapeEditor only allows the user to create single part polygons, so I don’t understand why the AddPoint function would also add a part.

Currently the AddPoint is forcing a new part to be created:
_activeShape->AddPoint(x, y, -1, -1, PartNew);

Change this to:
_activeShape->AddPoint(x, y, -1, -1, PartNone);

Adds a point to the polygon as expected.

Is there a reason this function is creating a new part each time it’s called?

Thanks
ToddH