public ILayerItem AddLayer(string fname)
        {
            ILayerItem newLayer = new LayerItemCanvasViewer();

            newLayer.Name = fname;
            this.Items.Add(newLayer);
            return(newLayer);
        }
        private void GetItems(ICanvas canvas)
        {
            if (canvas == null || canvas.LayerContainer == null)
            {
                return;
            }
            foreach (GeoDo.RSS.Core.DrawEngine.ILayer layer in canvas.LayerContainer.Layers)
            {
                if (layer is IVectorHostLayer)
                {
                    IVectorHostLayer hostLayer = layer as IVectorHostLayer;
                    IMap             map       = hostLayer.Map as IMap;
                    if (map != null)
                    {
                        LayerItemGroup vectorGroup = new LayerItemGroup("矢量层", "矢量层");
                        vectorGroup.IsVisible = true;

                        /*
                         * 为了能够在层管理器中修改整个地图的参数将tag设置为map对象
                         */
                        //vectorGroup.Tag = layer;
                        vectorGroup.Tag = map;
                        if (map.LayerContainer.Layers != null && map.LayerContainer.Layers.Count() != 0)
                        {
                            foreach (CodeCell.AgileMap.Core.ILayer it in map.LayerContainer.Layers)
                            {
                                LayerItemCanvasViewer item = new LayerItemCanvasViewer(enumLayerTypes.BaseVector, null);
                                item.Name      = it.Name;
                                item.IsVisible = it.IsRendered;
                                item.Tag       = it;
                                vectorGroup.Items.Add(item);
                            }
                        }
                        this.Items.Add(vectorGroup);
                    }
                }
                else if (layer is IRenderLayer)
                {
                    LayerItemCanvasViewer item = new LayerItemCanvasViewer(enumLayerTypes.Raster, null);
                    item.Name       = layer.Name;
                    item.IsVisible  = (layer as IRenderLayer).Visible;
                    item.IsSelected = true;
                    item.Tag        = layer;
                    this.Items.Add(item);
                }
            }
        }