• 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 ProAppModule1
    {
        internal class MapTool2 : MapTool
        {
            public MapTool2()
            {
                IsSketchTool = true;
                SketchType = SketchGeometryType.Polygon;
                SketchOutputMode = SketchOutputMode.Map;
            }
    
            protected override Task OnToolActivateAsync(bool active)
            {
                return base.OnToolActivateAsync(active);
            }
    
    
            protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
    
            {
    
                return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
    
                {
    
                    // Using the active map view to select
    
                    // the features that intersect the sketch geometry
    
                    ActiveMapView.SelectFeatures(geometry);
                    
    
                    return true;
    
                });
    
            }
        }
    }
    

      ==================

    矩形选择
    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 ProAppModule1
    {
        internal class MapToolSelect : MapTool
        {
            public MapToolSelect()
    
            {
    
                IsSketchTool = true;
    
                SketchType = SketchGeometryType.Rectangle;
    
                SketchOutputMode = SketchOutputMode.Screen;
    
            }
    
    
    
            protected override Task OnToolActivateAsync(bool active)
    
            {
    
                return base.OnToolActivateAsync(active);
    
            }
    
    
    
            protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
    
            {
    
                return ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
    
                {
    
                    // Using the active map view to select
    
                    // the features that intersect the sketch geometry
    
                    ActiveMapView.SelectFeatures(geometry);
    
                    return true;
    
                });
    
            }
        }
    }
    

      

  • 相关阅读:
    Rsync实现文件同步的算法(转载)
    Python模拟登录cnblogs
    负载均衡中四层和七层的介绍(转帖)
    Lvs+Keepalived实现MySQL高可用
    MySQL配置主主及主从备份
    Vim扩展YouCompleteMe插件
    使用Git
    Django回忆录
    Ansible安装配置及使用
    Hive学习之四 《Hive分区表场景案例应用案例,企业日志加载》 详解
  • 原文地址:https://www.cnblogs.com/gisoracle/p/12462525.html
Copyright © 2020-2023  润新知