zoukankan      html  css  js  c++  java
  • 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;
    
                });
    
            }
        }
    }
    

      

  • 相关阅读:
    30行代码实现微信自动回复机器人
    用Python来P图
    部署Scrapy分布式爬虫项目
    为什么自学Python看不进去?0基础入门Python有哪些捷径?
    学Python Web开发框架到什么程度可以找到开发的工作?
    Python不能帮你找到女朋友,却能让你成为有钱的单身狗
    SQL 的基本使用概念简介
    Python 面向对象编程的一些知识点总结
    一 数据的概括性度量
    三 k-近邻算法(k-Nearest Neighbors KNN)
  • 原文地址:https://www.cnblogs.com/gisoracle/p/12462525.html
Copyright © 2011-2022 走看看