Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8803
  • 博文数量: 9
  • 博客积分: 240
  • 博客等级: 二等列兵
  • 技术积分: 65
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-30 15:42
文章分类
文章存档

2011年(9)

我的朋友
最近访客

分类: WINDOWS

2011-08-30 17:18:48

 public IFeature getSelLayerFeature(int nIndexLayer)
        {
            IFeature fea = null;

            IFeatureLayer pFeaLayer;
            pFeaLayer = this.m_axMapControl.Map.get_Layer(nIndexLayer) as IFeatureLayer;
            IFeatureSelection pFeatSel = (IFeatureSelection)pFeaLayer;
            ISelectionSet pSelectionSet = pFeatSel.SelectionSet;
            if (pSelectionSet.Count == 0)
            {
            
                Console.WriteLine("在 '" + pFeaLayer.Name + "' 图层没有要素被选中!");
                return null;
            }
            int id = -1;
            IEnumIDs ids = pSelectionSet.IDs;
            id = ids.Next();
            //    Console.WriteLine(id.ToString());
            if(id!=-1)
            {
                fea = pFeaLayer.FeatureClass.GetFeature(id);
            }

         
            return fea;
        }

本文来自: 

阅读(297) | 评论(0) | 转发(0) |
0

上一篇:设置使用工具

下一篇:获取图层符号ISymbol

给主人留下些什么吧!~~