public TOCTreeNode() { this.OID = 0; this.m_pImage = null; this.m_nItemHeight = 18; this.m_Space = 4; this.m_Checked = false; this.m_Text = ""; this.m_IsSelected = false; this.m_Bounds = new Rectangle(0, 0, 10, 10); this.m_TextRect = new Rectangle(0, 0, 0, 0); this.m_ExpandRect = new Rectangle(0, 0, 0, 0); this.m_ImageRect = new Rectangle(0, 0, 0, 0); this.m_ChectRect = new Rectangle(0, 0, 0, 0); this.m_HasButton = false; this.m_HasCheck = false; this.m_HasImage = false; this.m_HasText = false; this.m_ChildNodes = new TOCTreeNodeCollection(); this.m_BackColor = Color.White; this.m_ForeColor = Color.Black; this.m_IsEditing = false; this.m_IsExpanded = false; this.m_IsVisible = true; this.m_pNextVisibleNode = null; this.m_pPrevVisibleNode = null; this.m_pParentNode = null; this.m_NodeFont = new Font("Arial", 8f); this.m_Pen = new Pen(Color.Black, 0f); this.m_pTreeView = null; this.m_pTag = null; this.m_NodeType = NodeType.None; this.m_ChildNodes.Owner = this; this.m_BmpUnCheck = new Bitmap( base.GetType() .Assembly.GetManifestResourceStream("Yutai.ArcGIS.Controls.Controls.TOCTreeview.uncheck.bmp")); this.m_BmpCheck = new Bitmap( base.GetType() .Assembly.GetManifestResourceStream("Yutai.ArcGIS.Controls.Controls.TOCTreeview.checked.bmp")); this.m_BmpUnCheck_nofc = new Bitmap( base.GetType() .Assembly.GetManifestResourceStream( "Yutai.ArcGIS.Controls.Controls.TOCTreeview.unchecked_nofc.bmp")); this.m_BmpCheck_nofc = new Bitmap( base.GetType() .Assembly.GetManifestResourceStream( "Yutai.ArcGIS.Controls.Controls.TOCTreeview.checked_nofc.bmp")); this.m_BmpCheck_novis = new Bitmap( base.GetType() .Assembly.GetManifestResourceStream( "Yutai.ArcGIS.Controls.Controls.TOCTreeview.checked_novis.bmp")); }
private void InsertMapToTree(IBasicMap pMap, TOCTreeNode pMapNode) { int layerCount = pMap.LayerCount; for (int i = 0; i < layerCount; i++) { ILayer pLayer = pMap.get_Layer(i); this.InsertLayerToTree(pMap, pLayer, pMapNode); } }
public void ClearSelection() { for (int i = 0; i < this.m_pSelectedNodes.Count; i++) { TOCTreeNode node = this.m_pSelectedNodes[i] as TOCTreeNode; node.IsSelected = false; } this.m_pLHitNode = null; this.SelectedNode = null; this.m_pSelectedNodes.Clear(); }
private TOCTreeNode FindMapNodeByNode(TOCTreeNode pTOCNode) { if (pTOCNode.Parent != null) { if ((pTOCNode.Parent.TOCNodeType == NodeType.Map) || (pTOCNode.Parent.TOCNodeType == NodeType.MapFrame)) { return(pTOCNode.Parent); } return(this.FindMapNodeByNode(pTOCNode.Parent)); } return(null); }
public void SelectNode(TOCTreeNode pSelectedNode) { if (this.m_pSelectedNodes.IndexOf(pSelectedNode) == -1) { if (this.SelectedNode == null) { this.SelectedNode = pSelectedNode; } pSelectedNode.IsSelected = true; this.m_pSelectedNodes.Add(pSelectedNode); } }
private TOCTreeNode FindMapNode(TOCTreeNode pChildNode) { if (pChildNode.Parent != null) { if ((pChildNode.Parent.GetNodeType() == NodeType.Map) || (pChildNode.Parent.GetNodeType() == NodeType.MapFrame)) { return(pChildNode.Parent); } return(this.FindMapNode(pChildNode.Parent)); } return(null); }
public virtual void Insert(int index, TOCTreeNode node) { if (this.m_pNode != null) { node.SetParent(this.m_pNode); node.SetTreeView(this.m_pNode.TreeView); } else { node.SetTreeView(this.m_pTreeView); } this.m_pTOCTreeNodeCollection.Insert(index, node); }
public virtual int Add(TOCTreeNode pNode) { if (this.m_pNode != null) { pNode.SetParent(this.m_pNode); pNode.SetTreeView(this.m_pNode.TreeView); } else { pNode.SetTreeView(this.m_pTreeView); } return(this.m_pTOCTreeNodeCollection.Add(pNode)); }
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); } } }
private TOCTreeNode FindLayerNode(ILayer pLayer) { TOCTreeNode node2 = null; for (int i = 0; i < this.m_pTOCTreeView.Nodes.Count; i++) { TOCTreeNode pParentNode = this.m_pTOCTreeView.Nodes[i] as TOCTreeNode; node2 = this.FindLayerNode(pParentNode, pLayer); if (node2 != null) { return(node2); } } return(null); }
public virtual TOCTreeNode Add(string name) { TOCTreeNode node = new TOCTreeNode(name); if (this.m_pNode != null) { node.SetParent(this.m_pNode); node.SetTreeView(this.m_pNode.TreeView); } else { node.SetTreeView(this.m_pTreeView); } this.m_pTOCTreeNodeCollection.Add(node); return(node); }
private TOCTreeNode FindItem(TOCTreeNode pRootItem, int OID) { for (int i = 0; i < pRootItem.Nodes.Count; i++) { TOCTreeNodeEx ex = pRootItem.Nodes[i] as TOCTreeNodeEx; if ((ex != null) && (ex.OID == OID)) { return(ex); } TOCTreeNode node = this.FindItem(ex, OID); if (node != null) { return(node); } } return(null); }
private TOCTreeNode FindItem(TOCTreeNode pRootItem, string name) { for (int i = 0; i < pRootItem.Nodes.Count; i++) { TOCTreeNode node = pRootItem.Nodes[i] as TOCTreeNode; if (node.Text == name) { return(node); } TOCTreeNode node2 = this.FindItem(node, name); if (node2 != null) { return(node2); } } return(null); }
private void DoDeleteLayer(TOCTreeNode pSelNode) { IBasicMap tag; TOCTreeNode node = this.FindMapNodeByNode(pSelNode); if (node.TOCNodeType == NodeType.Map) { tag = node.Tag as IBasicMap; } else { tag = (node.Tag as IMapFrame).Map as IBasicMap; } TOCTreeNode node2 = this.FindLayerNodeContain(pSelNode); if (node2.TOCNodeType == NodeType.GroupLayer) { IGroupLayer data = node2.Tag as IGroupLayer; if (data != null) { (tag as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, data, null); this.RefreshTree(); } } else if (tag != null) { if (tag.LayerCount == 0) { if (tag is IMap) { (tag as IMap).SpatialReferenceLocked = false; } tag.SpatialReference = new UnknownCoordinateSystemClass(); if (tag is IMap) { (tag as IMap).MapUnits = esriUnits.esriUnknownUnits; (tag as IMap).DistanceUnits = esriUnits.esriUnknownUnits; } (tag as IActiveView).Extent = (tag as IActiveView).FullExtent; } (tag as IActiveView).Refresh(); this.RefreshTree(); } }
private TOCTreeNode FindMapNodeByMap(IBasicMap pMap) { for (int i = 0; i < this.m_pTOCTreeView.Nodes.Count; i++) { TOCTreeNode node = this.m_pTOCTreeView.Nodes[i] as TOCTreeNode; if (node.Tag is IBasicMap) { if (node.Tag == pMap) { return(node); } } else if ((node.Tag is IMapFrame) && ((node.Tag as IMapFrame).Map == pMap)) { return(node); } } return(null); }
private TOCTreeNode FindLayerNode(TOCTreeNode pParentNode, ILayer pLayer) { TOCTreeNode node2 = null; for (int i = 0; i < pParentNode.Nodes.Count; i++) { TOCTreeNode node = pParentNode.Nodes[i] as TOCTreeNode; if (node.Tag == pLayer) { return(node); } node2 = this.FindLayerNode(node, pLayer); if (node2 != null) { return(node2); } } return(null); }
private bool BulidMenu(TOCTreeNode pNode, PopupMenu LayerPopupMenu) { LayerPopupMenu.ClearLinks(); if (pNode != null) { if (pNode.TOCNodeType == NodeType.Layer) { if (pNode.Tag is ITopologyLayer) { return(false); } LayerPopupMenu.AddItem(this.OpenAttributeTable); LayerPopupMenu.AddItem(this.ZoomToLayer).BeginGroup = true; LayerPopupMenu.AddItem(this.SetVisibleScale); LayerPopupMenu.AddItem(this.LabelFeature).BeginGroup = true; LayerPopupMenu.AddItem(this.ExportLayer).BeginGroup = true; LayerPopupMenu.AddItem(this.LayerProperty).BeginGroup = true; return(true); } if (pNode.TOCNodeType == NodeType.GroupLayer) { LayerPopupMenu.AddItem(this.ZoomToLayer).BeginGroup = true; LayerPopupMenu.AddItem(this.SetVisibleScale); LayerPopupMenu.AddItem(this.ExportLayer).BeginGroup = true; LayerPopupMenu.AddItem(this.LayerProperty).BeginGroup = true; return(true); } if (pNode.TOCNodeType == NodeType.Table) { LayerPopupMenu.AddItem(this.OpenAttributeTable); return(true); } if (pNode.TOCNodeType == NodeType.Map) { LayerPopupMenu.AddItem(this.ExportMap).BeginGroup = true; LayerPopupMenu.AddItem(this.MapFrameProperty).BeginGroup = true; return(true); } } return(false); }
private TOCTreeNode InsertItem(string name, string fcname, TOCTreeNode pParentItem, int ChildOID) { IQueryFilter filter = new QueryFilterClass(); IRow row = this.m_pLayerConfigTable.GetRow(ChildOID); if (row != null) { TOCTreeNode node2; int oID = Convert.ToInt32(row.get_Value(row.Fields.FindField("ParentID"))); if (oID != 0) { row = this.m_pLayerConfigTable.GetRow(oID); string str = row.get_Value(row.Fields.FindField("Name")) as string; TOCTreeNode node = this.FindItem(pParentItem, oID); if (node == null) { node = this.InsertItem(str, "", pParentItem, oID); } if (node == null) { return(null); } node2 = new TOCTreeNodeEx(name) { TOCNodeType = NodeType.Folder }; (node2 as TOCTreeNodeEx).OID = ChildOID; node.Nodes.Add(node2); return(node2); } node2 = new TOCTreeNodeEx(name) { TOCNodeType = NodeType.Folder }; (node2 as TOCTreeNodeEx).OID = ChildOID; pParentItem.Nodes.Add(node2); return(node2); } return(null); }
private void DoNewGroupLayer(TOCTreeNode pSelNode) { IGroupLayer layer = new GroupLayerClass { Name = "新图层组" }; if (pSelNode.TOCNodeType == NodeType.GroupLayer) { IBasicMap tag; (pSelNode.Tag as IGroupLayer).Add(layer); TOCTreeNode node = this.FindMapNodeByNode(pSelNode); if (node.TOCNodeType == NodeType.Map) { tag = node.Tag as IBasicMap; } else { tag = (node.Tag as IMapFrame).Map as IBasicMap; } this.InsertLayerToTree(tag, layer, pSelNode); this.m_pTOCTreeView.Invalidate(); } else if (pSelNode.TOCNodeType == NodeType.Map) { this.m_CanDo = false; (pSelNode.Tag as IBasicMap).AddLayer(layer); if ((this.m_pInMapCtrl != null) && (base.m_FocusMapNode.Tag == pSelNode.Tag)) { this.m_pInMapCtrl.Map.AddLayer(layer); } this.m_CanDo = true; this.InsertLayerToTree(pSelNode.Tag as IBasicMap, layer, pSelNode); this.m_pTOCTreeView.Invalidate(); } }
private void m_pTOCTreeView_NodeReordering(TOCTreeNode FirstNode, TOCTreeNode LastNode) { }
private void m_pTOCTreeView_NodeReordered(TOCTreeNode pFirstOldParent, TOCTreeNode FirstNode, TOCTreeNode pLastOldParent, TOCTreeNode LastNode) { }
private void m_pTOCTreeView_AfterSelect(TOCTreeNode pSelectNode) { this.BulidMenu(pSelectNode, this.m_pLayerPopupMenu); }
private void m_barManager1_ItemClick(object sender, ItemClickEventArgs e) { double mapScale = 0.0; TOCTreeNode selectedNode = this.m_pTOCTreeView.SelectedNode; if (selectedNode != null) { TOCTreeNode node2; if ((selectedNode.TOCNodeType == NodeType.Map) || (selectedNode.TOCNodeType == NodeType.MapFrame)) { node2 = selectedNode; } else { node2 = this.FindMapNodeByNode(selectedNode); } if (node2 != null) { IBasicMap tag = null; if (node2.Tag is IBasicMap) { tag = node2.Tag as IBasicMap; } else { tag = (node2.Tag as IMapFrame).Map as IBasicMap; } try { if (tag is IMap) { mapScale = (tag as IMap).MapScale; } } catch { } switch (e.Item.Name) { case "SetMinimumScale": (selectedNode.Tag as ILayer).MinimumScale = mapScale; break; case "SetMaximumScale": (selectedNode.Tag as ILayer).MaximumScale = mapScale; break; case "ClearScaleRange": (selectedNode.Tag as ILayer).MinimumScale = 0.0; (selectedNode.Tag as ILayer).MaximumScale = 0.0; (tag as IActiveView).Refresh(); break; case "ZoomToLayer": if ((selectedNode.Tag as ILayer).AreaOfInterest != null) { (tag as IActiveView).Extent = (selectedNode.Tag as ILayer).AreaOfInterest; (tag as IActiveView).Refresh(); } break; case "LabelFeature": { IGeoFeatureLayer data = selectedNode.Tag as IGeoFeatureLayer; if (data != null) { data.DisplayAnnotation = !data.DisplayAnnotation; (tag as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, data, null); } break; } case "LabelToAnno": { IFeatureLayer layer2 = selectedNode.Tag as IFeatureLayer; if (layer2 != null) { IFeatureWorkspace workspace = (layer2.FeatureClass as IDataset).Workspace as IFeatureWorkspace; IFDOGraphicsLayerFactory factory = new FDOGraphicsLayerFactoryClass(); } break; } case "OpenAttributeTable": { ITable table = selectedNode.Tag as ITable; if (table != null) { new frmAttributeTable { Table = table, Map = tag }.Show(); } break; } case "AddLayer": if (selectedNode.TOCNodeType != NodeType.GroupLayer) { if (selectedNode.TOCNodeType == NodeType.Map) { this.m_pTOCTreeView.Invalidate(); } else if (selectedNode.TOCNodeType == NodeType.MapFrame) { this.m_pTOCTreeView.Invalidate(); } break; } this.m_pTOCTreeView.Invalidate(); break; case "DeleteLayer": this.DoDeleteLayer(selectedNode); break; case "LayerProperty": this.DoLayerProperty(selectedNode); break; case "MapFrameProperty": this.DoMapFrameProperty(selectedNode); break; case "ExportLayer": { frmExportMap map2 = new frmExportMap { ActiveView = tag as IActiveView, Layer = selectedNode.Tag as ILayer }; map2.ShowDialog(); break; } case "ExportMap": new frmExportMap { ActiveView = tag as IActiveView }.ShowDialog(); break; } } } }
internal virtual int InternalAdd(TOCTreeNode pNode) { return(this.m_pTOCTreeNodeCollection.Add(pNode)); }
public void Remove(TOCTreeNode pNode) { this.m_pTOCTreeNodeCollection.Remove(pNode); }
internal void InteralInsert(int index, TOCTreeNode node) { this.m_pTOCTreeNodeCollection.Insert(index, node); }
internal void SetParent(TOCTreeNode node) { this.m_pParentNode = node; }
private void DoLayerProperty(TOCTreeNode pSelNode) { }