zoukankan      html  css  js  c++  java
  • 我研究出来的属性查询,贴自己的代码,请大家指教

    //把所有的字段都读进来

    private void Form2_Load(object sender, EventArgs e)

            {
                
                int i;
                ILayer pLayer=mFormShow1.axMapControl1.Map.get_Layer(0);
                IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer;
                IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
                IField pField;
                for (i = 0; i < pFeatureClass.Fields.FieldCount; i++)
                {
                    pField = pFeatureClass.Fields.get_Field(i);
                    comboBox1.Items.Add(pField.Name);
                }


            }
    //根据条件进行查询
            private void button1_Click(object sender, EventArgs e)
            {
                
                ILayer pLayer = mFormShow1.axMapControl1.get_Layer(0);
                IGeoFeatureLayer pGeoFeatureLayer = (IGeoFeatureLayer)pLayer;
                ITable pTable = (ITable)pGeoFeatureLayer;
                IQueryFilter pQueryFilter = new QueryFilterClass();

                IFeatureCursor pFeatureCursor;
                ICursor pCursor;
                IFeature pFeature;

                pQueryFilter.WhereClause = comboBox1.Text + comboBox2.Text + textBox1.Text;
                pCursor = pTable.Search(pQueryFilter, true);
                pFeatureCursor = (IFeatureCursor)pCursor;

                pFeature = pFeatureCursor.NextFeature();

                while (pFeature != null)
                {
                    mFormShow1.axMapControl1.Map.SelectFeature(pGeoFeatureLayer, pFeature);
                    pFeature = pFeatureCursor.NextFeature();
                
                }
                mFormShow1.axMapControl1.Refresh();
                int RowCount = pTable.RowCount(pQueryFilter);
                MessageBox.Show(RowCount.ToString());



            }
  • 相关阅读:
    kendoui 时间选择框
    vue+webpack+win10搭建项目
    arcgis for javascript 自定义infowindow
    如何将 Microsoft Bot Framework 机器人部署以及网页应用
    STM32Cube_FW_F1_V1.0.0固件库学习(五) Systick
    STM32Cube_FW_F1_V1.0.0固件库学习(四)外部中断 下
    STM32Cube_FW_F1_V1.0.0固件库学习(四)外部中断 中
    STM32Cube_FW_F1_V1.0.0固件库学习(二)工程设置
    STM32Cube_FW_F1_V1.0.0固件库学习(四)中断概念 上
    STM32Cube_FW_F1_V1.0.0固件库学习(三)GPIO LED&KEY
  • 原文地址:https://www.cnblogs.com/zhangjun1130/p/1400078.html
Copyright © 2011-2022 走看看