arcgisengine如何实现新建图层组(new group layers)功能

arcgisengine如何实现arcmap里的new groupl ayers功能,新建图层组,可以向图层组添加数据。

TIM截图20180302165116.png

查了半天没找到方法,求思路方法。。。
已邀请:

朱新颖

赞同来自: 柚子

GroupLayerClass类不可以吗?

cannel

赞同来自: 柚子

加载地图下面,其中map可以从mapcontrol或者hookhelper获取:
            IGroupLayer groupLayer = new GroupLayerClass();
            groupLayer.Name = "新组图层";

            ....FocusMap.AddLayer(groupLayer);
 
加载到组图层下面的:
            IGroupLayer groupLayer = new GroupLayerClass();
            groupLayer.Name = "新组图层";

            IGroupLayer groupLayerCurrent = ....CurrentLayer as IGroupLayer;
            groupLayerCurrent.Add(groupLayer);
 
其中CurrentLayer 的获取可以监听toccontrol的OnMouseDown事件获取
        private void axTOCControl1_OnMouseDown(object sender, ITOCControlEvents_OnMouseDownEvent e)
        {
            try
            {
                esriTOCControlItem tocControlItem = esriTOCControlItem.esriTOCControlItemNone;
                ILayer layer = null;
                object lengedGroup = null;
                object index = null;
                IBasicMap biscMap = null;

                this.axTOCControl1.HitTest(e.x, e.y, ref tocControlItem, ref biscMap, ref layer, ref lengedGroup, ref index);

                if (this.m_LayerCurrent != layer)
                {
                    this.m_LayerCurrent = layer;
                    MapService mapService = MapService.GetInstance();
                    //触发当前图层改变事件
                    mapService.OnCurrentLayerChanged(layer, null);
                }
 
以上代码均是部分截取,不能直接执行

xiaosi9524 - GISER

赞同来自:

新建要素集再想里面添加要素类就行了

要回复问题请先登录注册