• IFeatureClass 获取字段值


     IMap pMap=axMapControl.Map;
        ILayer pLayer=null;
        for(int i=0;i<pMap.Layercount;i++)
        {
            pLayer=pMap.get_layer(i);
            if (pLayer is IFeatureLayer)
            comboBoxEdit1.Properties.Items.Add(layer.Name);
        

    //根据需要获取指定图层layer

    string layerName="";
        ILayer layer=null;
        for(int i=0;i<pMap.Layercount;i++)
        {
            if(pMap.get_layer(i).Name==layerName)
            {
                layer=pMap.get_layer(i);
            }
        }

    //获取指定图层的所有字段名

     IFeatureLayer featureLayer=layer as IFeatureLayer;
        IfeatureClass featureclass=featureLayer.FeatureClass;
        IFields fields=featureclass.fields;
        for(int i=0;i<featureclass.fields.fieldcount;i++)
        {
            IField field=fields.get_field(i);
            listBoxControl1.Items.Add(field.Name);
            listBoxControl1.SelectedIndex = 0;
        }

    //获取某个特定字段的所有值

    IFeatureClass featureclass=featureLayer.FeatureClass;

    //设定筛选条件获得满足要求的所有Feature

     IQueryFilter queryFilter = new QueryFilterClass();
        queryFilter.WhereClause = "";
        IFeatureCursor featurecursor=featureClass.search(queryFilter,false);
        IFeature feature=featureCursor.NextFeature;

    //获取想要获取的字段值的fieldName的id号

    string name="";
        int index=0;
        for(int i=0;i<fields.fieldcount;i++)
        {
            IField field=fields.get_field(i);
            if(field.Name==name)
            {
                indesx=i;
            }
        }
        while(feature!=null)
        {
            listBoxControl2.Items.Add(feature.get_Value(index).ToString());
            feature=featureCursor.NextFeature;
        }
    

      

  • 相关阅读:
    Hibernate4.0之HibernateSessionFactory源码详解
    Struts.xml中Action的method与路径的三种匹配方法
    codeforces B. Ohana Cleans Up
    codeforces C. Vanya and Scales
    Hibernate主键生成策略
    codeforces B
    FileUpload实现文件上传(包含多文件)
    structs2之多文件上传
    svn的安装与使用
    codeforces Soldier and Number Game(dp+素数筛选)
  • 原文地址:https://www.cnblogs.com/janeaiai/p/4885504.html
Copyright © 2020-2023  润新知