您的位置:首页 > 其它

AE开发----获取地图上当前选中的要…

2015-05-07 10:09 169 查看
            // 获取地图上当前选中的要素(一)

            int selCount = axMapControl1.Map.SelectionCount;

            IEnumFeature pEnumFeature = axMapControl1.Map.FeatureSelection as IEnumFeature;

            IFeature pFeature = pEnumFeature.Next();

            while (pFeature != null)

            {

                string str1 = pFeature.OID.ToString();

                string str2 = pFeature.get_Value(2).ToString();

                pFeature = pEnumFeature.Next();

            }

 

          // 获取地图上当前选中的要素(二)

            IMap map = axMapControl1.Map;

            ISelection selection = map.FeatureSelection;

            IEnumFeatureSetup iEnumFeatureSetup = (IEnumFeatureSetup)selection;

            iEnumFeatureSetup.AllFields = true;

            IEnumFeature pEnumFeature = (IEnumFeature)iEnumFeatureSetup;

            pEnumFeature.Reset();

            IFeature pFeature = pEnumFeature.Next();    

            while (pFeature != null)

            {

                string str1 = pFeature.OID.ToString();

                string str2 = pFeature.get_Value(2).ToString();

                pFeature = pEnumFeature.Next();

            }

注:以上两种方法均在电脑上测试通过,至于之间的区别还得慢慢消化。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: