ArcGIS Pro 刪除選擇范圍的數據和批量裁剪clip


  protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
        {
            QueuedTask.Run(() =>
            {
                var deleteFeatures = new EditOperation();
                deleteFeatures.Name = "Delete Features";
                Polygon polygon = geometry as Polygon;

                //Delete all the selected features in the active view
                //Select using a polygon (for example)
                var selection = MapView.Active.SelectFeatures(polygon).Select(
                      k => new KeyValuePair<MapMember, List<long>>(k.Key as MapMember, k.Value));

                deleteFeatures.Delete(selection);

                //Execute to execute the operation
                //Must be called within QueuedTask.Run
                deleteFeatures.Execute();
            });
            return base.OnSketchCompleteAsync(geometry);

        }

 

  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.Clip(featureLayer, id, geometry);
                        deleteFeatures.ExecuteAsync();
                    }
                }
                //deleteFeatures.Delete(selection);

                //Execute to execute the operation
                //Must be called within QueuedTask.Run
                
            });
            return base.OnSketchCompleteAsync(geometry);

        }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM