• 大小: 889KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-13
  • 语言: 其他
  • 标签: ArcEngine  ArcGIS  

资源简介

ArcEngine简单教程——要素的属性查询、空间查询完整demo,包括要素图层的空间查询、属性查询 备份链接:链接:https://pan.baidu.com/s/1h5sRKIczpFErXhw4UPyLww 提取码:lw27 教程博客:https://blog.csdn.net/nominior/article/details/97265885

资源截图

代码片段和文件信息

using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace p3_search
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        #region 空间查询
        private void axMapControl1_OnMapReplaced(object sender ESRI.ArcGIS.Controls.IMapControlEvents2_OnMapReplacedEvent e)
        {
            for (int i = 0; i < axMapControl1.layerCount; i++)
            {
                string l_name = axMapControl1.Map.get_layer(i).Name;
                cb_layer.Items.Add(l_name);
            }
        }

        private Featurelayer get_FL()
        {
            Featurelayer pFeaturelayer = null;

            for (int i = 0; i < axMapControl1.layerCount; i++)
            {
                if (cb_layer.Text == axMapControl1.get_layer(i).Name)
                {
                    pFeaturelayer = axMapControl1.get_layer(i) as Featurelayer;
                    break;
                }
            }
            return pFeaturelayer;
        }

        private void axMapControl1_onmousedown(object sender ESRI.ArcGIS.Controls.IMapControlEvents2_onmousedownEvent e)
        {
            Featurelayer pFeaturelayer = get_FL();
            if (e.button == 2 && pFeaturelayer != null)
            {                              
                IEnvelope box = null;
                if (cb_method.Text == “框选查询“)
                {
                    box = axMapControl1.TrackRectangle() as IEnvelope;
                    ISpatialFilter filter = new SpatialFilterClass();
                    filter.WhereClause = ““;
                    filter.Geometry = box;
                    filter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                    ShowFeatures(pFeaturelayer filter);
                }
                else
                {
                    IGeometry pGeo;
                    if (cb_method.Text == “多边形查询“)
                    {
                        pGeo = axMapControl1.TrackPolygon();
                    }
                    else
                    {
                        pGeo = axMapControl1.TrackCircle();
                    }
                    ISpatialFilter filter = new SpatialFilterClass();
                    filter.WhereClause = ““;
                    filter.Geometry = pGeo;
                    filter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                    ShowFeatures(pFeaturelayer filter);
                }
                
            }
        }
        public void ShowFeatures(IFeaturelayer featurelayer IQueryFilter condition)
        {
            if (featurelayer != null)
            {
            

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-08-18 21:39  p3_search\
     目录           0  2019-08-18 21:39  p3_search\mxd\
     目录           0  2019-08-18 22:23  p3_search\mxd\HuanbaoGeodatabase.gdb\
     文件       16728  2015-02-06 16:50  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000001.freelist
     文件         191  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000001.gdbindexes
     文件        5437  2015-02-06 16:50  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000001.gdbtable
     文件        5152  2015-02-06 16:50  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000001.gdbtablx
     文件         920  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000002.gdbtable
     文件        5152  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000002.gdbtablx
     文件         191  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000003.gdbindexes
     文件        4174  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000003.gdbtable
     文件        5152  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000003.gdbtablx
     文件         179  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000004.gdbtable
     文件        5152  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000004.gdbtablx
     文件         191  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000005.gdbindexes
     文件         223  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000005.gdbtable
     文件        5152  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000005.gdbtablx
     文件       12632  2015-02-06 16:50  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000006.freelist
     文件         191  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000006.gdbindexes
     文件        4700  2015-02-06 16:50  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000006.gdbtable
     文件        5152  2015-02-06 16:50  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000006.gdbtablx
     文件        8536  2015-02-06 16:49  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000007.freelist
     文件        1818  2015-02-06 16:49  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000007.gdbtable
     文件        5152  2015-02-06 16:49  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000007.gdbtablx
     文件       20824  2015-02-06 16:49  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000008.freelist
     文件        9352  2015-02-06 16:49  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000008.gdbtable
     文件        5152  2015-02-06 16:49  p3_search\mxd\HuanbaoGeodatabase.gdb\a00000008.gdbtablx
     文件        4440  2015-02-06 16:46  p3_search\mxd\HuanbaoGeodatabase.gdb\a0000000b.freelist
     文件         191  2014-08-27 11:25  p3_search\mxd\HuanbaoGeodatabase.gdb\a0000000b.gdbindexes
     文件         299  2015-02-06 16:46  p3_search\mxd\HuanbaoGeodatabase.gdb\a0000000b.gdbtable
     文件        5152  2015-02-06 16:46  p3_search\mxd\HuanbaoGeodatabase.gdb\a0000000b.gdbtablx
............此处省略100个文件信息

评论

共有 条评论