private void FrmSymboloTin_Load(object sender, EventArgs e) { string sInstall = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\Style\ESRI.ServerStyle"; axSymbologyControl1.LoadStyleFile(sInstall); axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassColorRamps; pSymbolClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassColorRamps); /* ********************************* * 生成色度带 * *********************************/ for (int i = 0; i < pSymbolClass.get_ItemCount(pSymbolClass.StyleCategory); i++) { stdole.IPictureDisp pPicture = pSymbolClass.PreviewItem(pSymbolClass.GetItem(i), cmbcolor.Width, cmbcolor.Height); Image image = Image.FromHbitmap(new System.IntPtr(pPicture.Handle)); cmbcolor.Items.Add(image); } if (cmbcolor.Items.Count > 0) { cmbcolor.SelectedIndex = 0; } /* ********************************* * 初始化gridview及颜色控件 * *********************************/ if (pTLayer.GetRenderer(0).GetType().Name == "TinFaceRendererClass" || pTLayer.GetRenderer(0).Name == "Faces") { treeshow.SelectedIndex = 1; ITinSingleSymbolRenderer pTinrenderer = pTLayer.GetRenderer(0) as ITinSingleSymbolRenderer; ISimpleFillSymbol psymbol = new SimpleFillSymbolClass(); psymbol = pTinrenderer.Symbol as ISimpleFillSymbol; btncolor.SelectedColor = ClsGDBDataCommon.IColorToColor(psymbol.Color); istrue = true; } else if (pTLayer.GetRenderer(0).Name == "Elevation" || pTLayer.GetRenderer(0).Name == "Edge types") { treeshow.SelectedIndex = 0; btncolor.SelectedColor = System.Drawing.Color.Green; for (int j = 0; j < pTLayer.RendererCount; j++) { if (pTLayer.GetRenderer(j).Name == "Elevation") { ptinColorRampRenderer = pTLayer.GetRenderer(j) as ITinColorRampRenderer; break; } } cmbclasses.SelectedIndex = ptinColorRampRenderer.BreakCount - 1; initialupdatagrid(); } }
private void InsertLayerToTree(IBasicMap pMap, ILayer pLayer, TOCTreeNode pMapNode) { int num; if (pLayer is IGroupLayer) { for (num = 0; num < (pLayer as ICompositeLayer).Count; num++) { this.InsertLayerToTree(pMap, (pLayer as ICompositeLayer).get_Layer(num), pMapNode); } } else { int layerOID = 0; TOCTreeNode node = this.GetParentItem(pLayer, pMapNode, ref layerOID); if (node == null) { node = pMapNode; } TOCTreeNode pNode = new TOCTreeNodeEx(pLayer.Name, true, true); (pNode as TOCTreeNodeEx).OID = layerOID; pNode.Checked = pLayer.Visible; pNode.Tag = pLayer; node.Nodes.Add(pNode); if (pLayer is ITinLayer) { ITinLayer layer = pLayer as ITinLayer; for (num = 0; num < layer.RendererCount; num++) { ITinRenderer renderer = layer.GetRenderer(num); TOCTreeNode node3 = new TOCTreeNodeEx(renderer.Name) { Tag = renderer }; pNode.Nodes.Add(node3); this.InsertLegendInfoToTree((ILegendInfo)renderer, pNode); } } else if (pLayer is IGeoFeatureLayer) { IGeoFeatureLayer layer2 = (IGeoFeatureLayer)pLayer; this.InsertLegendInfoToTree((ILegendInfo)layer2.Renderer, pNode); } else if (pLayer is IRasterLayer) { IRasterLayer layer3 = (IRasterLayer)pLayer; this.InsertLegendInfoToTree((ILegendInfo)layer3.Renderer, pNode); } } }