Exemple #1
0
 public void Add(DF2DRaster rd)
 {
     if (this.Exists(rd.GetRasterLayerName()))
     {
         return;
     }
     this.listRaster.Add(rd);
 }
Exemple #2
0
        public static void AddComLayerNode(TreeList parentTree, TreeNodeComLayer node, ILayer layer, List <ILayer> loadlayer)
        {
            object           renderer = null;
            TreeNodeComLayer comLayerNode;

            if (layer is ICadLayer)
            {
                return;
            }
            if (node == null)//如果当前节点为空
            {
                comLayerNode = new TreeNodeComLayer()
                {
                    Name = layer.Name, CustomValue = layer
                };
                comLayerNode.OwnNode    = parentTree.AppendNode(new object[] { comLayerNode.Name }, (TreeListNode)null);//为树创建根节点
                comLayerNode.ImageIndex = 0;
                node             = comLayerNode;
                rootNode         = comLayerNode;
                rootNode.Visible = true;
            }
            else
            {
                comLayerNode = new TreeNodeComLayer()
                {
                    Name = layer.Name, CustomValue = layer
                };
                comLayerNode.Visible = true;
                if (comLayerNode.Name.Contains("注记"))
                {
                    comLayerNode.ImageIndex = 10;
                }
                else
                {
                    comLayerNode.ImageIndex = 0;
                }
                node.Add(comLayerNode);                 //为当前节点添加子节点
            }
            if (layer is ESRI.ArcGIS.Carto.IGroupLayer) //如果图层是复合图层组
            {
                ICompositeLayer comLayer = layer as ICompositeLayer;
                for (int i = 0; i < comLayer.Count; i++)
                {
                    AddComLayerNode(parentTree, comLayerNode, comLayer.get_Layer(i), loadlayer);//递归
                    comLayerNode.CollapseAll();
                }
            }
            else if (layer is IGeoFeatureLayer) //如果图层是地理要素图层
            {
                loadlayer.Add(layer);           //将该图层添加到待加载图层
                IGeoFeatureLayer geoFtLayer = layer as IGeoFeatureLayer;

                if (geoFtLayer == null)
                {
                    return;
                }
                if (geoFtLayer.FeatureClass == null)
                {
                    node.CollapseAll(); return;
                }
                esriGeometryType geoType = geoFtLayer.FeatureClass.ShapeType;
                switch (geoType)
                {
                case esriGeometryType.esriGeometryPoint:
                case esriGeometryType.esriGeometryMultipoint:
                    comLayerNode.ImageIndex = 4;
                    break;

                case esriGeometryType.esriGeometryLine:
                case esriGeometryType.esriGeometryPolyline:
                    comLayerNode.ImageIndex = 5;
                    break;

                case esriGeometryType.esriGeometryPolygon:
                    comLayerNode.ImageIndex = 6;
                    break;
                }
                renderer = geoFtLayer.Renderer;

                AddSymbolNode(comLayerNode, renderer);//对当前树节点进行符号化
                node.CollapseAll();
                comLayerNode.CollapseAll();
                if (geoFtLayer.FeatureClass == null)
                {
                    return;
                }
                DF2DFeatureClass dffc = new DF2DFeatureClass(geoFtLayer.FeatureClass, comLayerNode);//根据当前要素类创建DF2DFC,并添加到管理类
                dffc.SetLayer(layer);
                DF2DFeatureClassManager.Instance.Add(dffc);
                DF2DFeatureClassManager.Instance.Add(comLayerNode);
            }

            else if (layer is IRasterLayer) //如果图层是栅格图层
            {
                loadlayer.Add(layer);       //将该图层添加到待加载图层
                //comLayerNode.Visible = true; //当前图层为可见(显示影像图)
                IRasterLayer rasterLayer = layer as IRasterLayer;
                IRaster      raster      = rasterLayer.Raster;
                if (raster == null)
                {
                    return;
                }
                DF2DRaster dfrd = new DF2DRaster(raster, comLayerNode);
                dfrd.SetLayer(layer);
                DF2DRasterManager.Instance.Add(dfrd);
            }
            else if (layer is IAnnotationLayer)
            {
                loadlayer.Add(layer);
                IFeatureLayer featureLayer = layer as IFeatureLayer;
                if (featureLayer.FeatureClass == null)
                {
                    return;
                }
                DF2DFeatureClass dffc = new DF2DFeatureClass(featureLayer.FeatureClass, comLayerNode);
                dffc.SetLayer(layer);
                DF2DFeatureClassManager.Instance.Add(dffc);
                DF2DFeatureClassManager.Instance.Add(comLayerNode);
            }


            else
            {
                loadlayer.Add(layer);//其它图层也加入待加载图层
            }
        }