ArcGIS Pro批量线分割面,也可以线分割线
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ArcGIS.Core.CIM; using ArcGIS.Core.Data; using ArcGIS.Core.Geometry; using ArcGIS.Desktop.Catalog; using ArcGIS.Desktop.Core; using ArcGIS.Desktop.Editing; using ArcGIS.Desktop.Extensions; using ArcGIS.Desktop.Framework; using ArcGIS.Desktop.Framework.Contracts; using ArcGIS.Desktop.Framework.Dialogs; using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Mapping; namespace TKPrint { internal class MapTool1 : MapTool { public MapTool1() { IsSketchTool = true; SketchType = SketchGeometryType.Line; SketchOutputMode = SketchOutputMode.Map; } protected override Task OnToolActivateAsync(bool active) { return base.OnToolActivateAsync(active); } protected override Task<bool> OnSketchCompleteAsync(Geometry geometry) { QueuedTask.Run(() => { //Delete all the selected features in the active view //Select using a polygon (for example) var selection = MapView.Active.SelectFeatures(geometry).Select( k => new KeyValuePair<MapMember, List<long>>(k.Key as MapMember, k.Value)); foreach (var a in selection) { Layer featureLayer = a.Key as Layer; foreach (var id in a.Value) { var deleteFeatures = new EditOperation(); deleteFeatures.Name = "Delete Features"; deleteFeatures.ShowProgressor = true; deleteFeatures.EditOperationType = EditOperationType.Long; deleteFeatures.Cut(featureLayer, id, geometry);
//deleteFeatures.Split(featureLayer, id, geometry); deleteFeatures.ExecuteAsync(); } } //deleteFeatures.Delete(selection); //Execute to execute the operation //Must be called within QueuedTask.Run }); return base.OnSketchCompleteAsync(geometry); } } }