Undo/Redo Delete Connected Line Features on a Point Feature

265
1
08-06-2020 05:32 PM
KrisCulin
Occasional Contributor

Hello,

When a user deletes a point in our Pro config, we need to delete any 'connected' links (lines) as well.

So if you have a point "J-1" connected to a link "P-1" connected to a point "J-2" and you select and delete "J-1", then I need to also delete "P-1".

I've got this implemented.  However, when undo is used, that link is not restored.  Right now I am using RemoveRows on the feature class table and passing in the list of objectids to remove.

I am currently using Pro SDK 2.5.  With 2.6, there is the EditStarted event.  Could this be used so that I could chain an operation that deletes the connected links?

Any ideas on how to better handle this use case (without going to 2.5)?

Kris

0 Kudos
1 Reply
SeanJones
Esri Regular Contributor

Hey Kris,

The row, edit started and editcompleting events all pass through the current edit operation that allow you to make additional edits that will appear as one operation on the stack.

eg. Delete additional features during row delete

    private void onRowDeletedEvent(RowChangedEventArgs obj)
    {
      if (_lastEdit != obj.Guid) //reentrancy check
      {
        //delete the next objectID too
        var nextID = obj.Row.GetObjectID() + 1;
        obj.Operation.Delete(_layer, nextID);
        _lastEdit = obj.Guid;
      }
    }

Since EditStarted and EditCompleting are global events, you wont know what the edit is unless its one of yours that you can identify through EditOperation.EventToken.

0 Kudos