I am displaying points, lines and polygons on ArcMap as features with an addin. I want my end users to be able to change features (move geometries, add vertex, delete vertex etc) and get the updated feature's geometry.
For this purpose, I subscribe to OnChangeFeauture
event with the following piece of code:
IEditEvents_Event editEvent = (IEditEvents_Event)ArcMap.Editor;
editEvent.OnChangeFeature += OnChangeFeature;
OnChangeFeauture
event is fired only if a feature is moved. For points, this is fine, but for lines and polygon an edit doesn't necessarily mean the geometry needs to move (dragged somewhere else).
I subscribed to OnVertexMoved
hoping to receive events if a vertex of line or polygon is moved.
((IEditEvents2_Event)Map.Editor).OnVertexMoved += OnVertexMoved;
UPDATE
OnVertexMoved
event DID work. It has a reference to the vertex as an IPoint
object, which is fine. But when I checked ShapeCopy
property of the selected feature (when that event is fired), it was not updated at all. So when should I expect to get ShapeCopy
updated in an edit session unless it is moved explicitly?
Otherwise, I had to ask users to drag geometry as a whole a little bit even if they move just a vertex (to get their updated geometry). That doesn't make sense at all.