热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

ArcEngine获取IMap所有图层方法

获得要素图层通过UID获取1<summary>2获得要素图层UID获取(第一种方法)3&l
获得要素图层通过UID获取
 1         /// 
 2         /// 获得要素图层UID获取(第一种方法)
 3         /// 
 4         /// IMap对象
 5         /// 
 6         public List GetFeatureLayersUID(IMap pMap)
 7         {
 8             UID uid = new UIDClass();
 9             uid.Value = "{40A9E885-5533-11d0-98BE-00805F7CED21}";
10             IEnumLayer Layer = pMap.Layers[uid, true];
11             ILayer ilayer = Layer.Next();
12             //遍历地图
13             while (ilayer != null)
14             {
15                 pList.Add(ilayer as IFeatureLayer);
16                 ilayer = Layer.Next();
17             }
18             return pList;
19 
20         }

 

通过IMap 递归遍历要素
 1 /// 
 2 /// 获得要素图层
 3 /// 
 4 /// IMap对象
 5 /// 
 6 public List GetFeatureLayers(IMap pMap)
 7 {
 8     //遍历地图(需要递归判断)
 9     for (int i = 0; i )
10     {
11         GetIFeatureLayer(pMap.get_Layer(i));
12     }
13     return pList;
14 }
15 
16 /// 
17 /// 执行得到所有图层
18 /// 
19 /// 图层对象
20 /// 
21 public void GetIFeatureLayer(ILayer layer)
22 {
23     if (layer is IFeatureLayer)
24     {
25         //获得图层要素
26         pFeatLayer = layer as IFeatureLayer;
27         pList.Add(pFeatLayer);
28     }
29     else if (layer is CadAnnotationLayer)
30     {
31     }
32     else if (layer is IRasterLayer)
33     {
34     }
35     else if (layer is ILasDatasetLayer)
36     {
37     }
38     else if (layer is IGroupLayer)
39     {
40         //遍历图层组
41         pCompLayer = layer as ICompositeLayer;
42         getlist(pCompLayer);
43     }
44 
45 
46 }
47 /// 
48 /// 递归所有图层
49 /// 
50 /// IGroupLayer中所有的图层
51 /// 
52 public void getlist(ICompositeLayer pCompLayer)
53 {
54     for (int j = 0; j )
55     {
56         if (pCompLayer.get_Layer(j) is IFeatureLayer)
57         {
58             pFeatLayer = pCompLayer.get_Layer(j) as IFeatureLayer;
59             pList.Add(pFeatLayer);
60         }
61         else if (pCompLayer.get_Layer(j) is IGroupLayer)
62         {
63             getlist(pCompLayer.get_Layer(j) as ICompositeLayer);
64         }
65         else if (pCompLayer.get_Layer(j) is CadAnnotationLayer)
66         {
67             continue;
68         }
69         else if (pCompLayer.get_Layer(j) is IRasterLayer)
70         {
71             continue;
72         }
73         else if (pCompLayer.get_Layer(j) is ILasDatasetLayer)
74         {
75             continue;
76         }
77     }
78 }

 


推荐阅读
author-avatar
沙漏虎
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有