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

  • 相关阅读:
    CSS文字的处理
    typeof 检测变量的数据类型
    BZOJ 1257: [CQOI2007]余数之和
    BZOJ 1218: [HNOI2003]激光炸弹
    BZOJ 3251: 树上三角形
    BZOJ 3916: [Baltic2014]friends
    BZOJ 1610: [Usaco2008 Feb]Line连线游戏 暴力
    BZOJ 1593 [Usaco2008 Feb]Hotel 旅馆 双倍经验,线段树
    BZOJ 1096 [ZJOI2007]仓库建设 BZOJ 3437 小P的牧场 BZOJ 3156 防御准备 斜率优化dp
    BZOJ 2582 : Bovine Alliance DFS
  • 原文地址:https://www.cnblogs.com/henyihanwobushi/p/2944128.html
Copyright © 2011-2022 走看看