获取Map中选择的要素
2015-05-13 17:29
363 查看
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">1、使用IEnumFeturea对象获取map中的FeatureSelection,该方法可以获取所有图层的选择要素。IMap中的FeatureSelection可不是IFeatureSelection,而是ISelection。</span>
2、使用ISelectionSet,IEnumIDs,FeatureClass.GetFeature()方法获取某个图层中的选择要素
在map中获取要素时,这样是可以的,不过不能得到要素的完整属性信息,貌似只能拿到ID值。
ISelection pSelection = pMap.FeatureSelection; IEnumFeature enumFeature = pSelection asIEnumFeature; IFeature feature = enumFeature.Next(); while (feature != null) { array.Add(feature); feature=enumFeature.Next(); }
那如果要得到完整的属性信息怎么办呢?IEnumFeatureSetup起到大作用了。如下所示:
ISelection selection = pMap.FeatureSelection; IEnumFeatureSetup enumFeatureSetup = selection as IEnumFeatureSetup;//这里很必要 enumFeatureSetup.AllFields = true; //这里很必要 IEnumFeature enumFeature = enumFeatureSetup as IEnumFeature; enumFeature.Reset(); IFeature feature = enumFeature.Next(); while (feature != null) { stringvalue = feature.get_Value(index).ToString();//就可以得到任意字段的值了 feature = enumFeature.Next(); }
转自http://www.myexception.cn/cgi/1393341.html
相关文章推荐
- ArcGIS Engine中如何获取Map中已经选择的要素呢
- ArcGIS Engine中如何获取Map中已经选择的要素呢
- ArcEngine选择要素闪烁,Mapcontrol刷新并取消闪烁
- 【029】获取选择要素的属性
- QtableView选择范围操作 通过MAP存储选择行 获取最上行号和最下行号 上移下移一行等一系列操作
- jsp页面使用el 按key获取map中的对应值GOOD
- AE要素选择(点选和拉框选择)
- jQuery 获取对象 基本选择与层级
- jQuery 获取对象 基本选择与层级
- jQuery获取Select选择的Text和 Value(转)
- 四级联动地址选择,从数据动态获取数据
- Android 4.4从图库选择图片,获取图片路径并裁剪
- javascript文件夹选择框的两种解决方案(主要是获取用户选择的文件夹的路径)
- 语句选择执行,MAP,FIELD directives
- 如何获取Google Map API Key
- 【转】STL中map与hash_map容器的选择
- winform DataGridView 选择行 获取数据
- 动态赋值js像map一样,获取数组中最大值,最小值
- jQuery获取Radio选择的Value值,jQuery获取CheckBox选择的Value值
- jQuery获取 Select选择的Text和Value: