Beispiel #1
0
        private void Loop(ICompositeLayer cpsLayers, int ParentTreeLevel, ref List <CustomLayer> List_cl)
        {
            ParentTreeLevel += 3;
            ILayer Layer = null;

            for (int j = 0; j < cpsLayers.Count; j++)
            {
                Layer = cpsLayers.get_Layer(j);
                if (Layer is ICompositeLayer)
                {
                    #region 添加图层组到下拉列表中
                    CustomLayer itemCps = new CustomLayer(Layer);
                    itemCps.TreeLevel = ParentTreeLevel;
                    List_cl.Add(itemCps);
                    #endregion
                    //子图层
                    Loop(Layer as ICompositeLayer, ParentTreeLevel, ref List_cl);
                }
                else
                {
                    #region 添加图层到下拉列表中
                    CustomLayer item = new CustomLayer(Layer);
                    item.TreeLevel = ParentTreeLevel;
                    List_cl.Add(item);
                    #endregion
                }
            }
        }
Beispiel #2
0
        public List <CustomLayer> GetListCustomLayerDisplayTreeStyle()
        {
            List <CustomLayer> List_cl = new List <CustomLayer>();

            List_cl.Clear();
            if (m_Map != null)
            {
                ILayer layer    = null;
                ILayer tmpLayer = null;
                for (int i = 0; i < m_Map.LayerCount; i++)
                {
                    layer = m_Map.get_Layer(i);
                    if (layer is ICompositeLayer)
                    {   //图层组
                        #region 添加图层组到下拉列表中
                        CustomLayer itemCps = new CustomLayer(layer);
                        itemCps.TreeLevel = 0;
                        List_cl.Add(itemCps);
                        #endregion
                        Loop(layer as ICompositeLayer, 0, ref List_cl);
                    }
                    else
                    {   //图层
                        #region 添加图层到下拉列表中
                        tmpLayer = layer;
                        CustomLayer item = new CustomLayer(tmpLayer);
                        item.TreeLevel = 0;
                        List_cl.Add(item);
                        #endregion
                    }
                }
            }
            return(List_cl);
        }