Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions src/Plugins/MW5.ShapeEditor/Services/GeoprocessingService.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -204,39 +204,31 @@ private void RemoveSelectedShapesWithPrompt(ILayer layer)

private void RemoveSelectedShapesNoPrompt(IMuteMap map, IFeatureSet fs, int layerHandle)
{

// First try to delete each feature - some may get cancelled
var features = fs.Features;
var list = map.History;
var actualDeletes = new List<int>();

try
{
list.BeginBatch();
for (int i = features.Count - 1; i >= 0; i--)
{
if (!features[i].Selected) continue;

var args = new BeforeDeleteShapeEventArgs(DeleteTarget.Shape, false, true);
_broadcaster.BroadcastEvent(p => p.BeforeDeleteShape_, _context.Map, args);
if (!args.Cancel && features.EditDelete(i))
if (!args.Cancel && list.Add(UndoOperation.RemoveShape, layerHandle, i))
{
actualDeletes.Add(i);
features.EditDelete(i);
}
}
}
finally
{
// Then add this to the undo history
var list = map.History;
list.BeginBatch();
foreach (var i in actualDeletes)
{
list.Add(UndoOperation.RemoveShape, layerHandle, i);
}
list.EndBatch();
}

_broadcaster.BroadcastEvent(p => p.LayerFeatureCountChanged_, fs, new LayerEventArgs(layerHandle));
}

}
}