예제 #1
0
 private void InsertMapFrameToTree(IElement pElement, TOCTreeNodeCollection pParantNodes)
 {
     if (pElement is IMapFrame)
     {
         IMapFrame frame = (IMapFrame)pElement;
         string    name  = frame.Map.Name;
         if (name == "")
         {
             name = "Scene";
         }
         TOCTreeNode pNode  = new TOCTreeNodeEx(name, false, true);
         Bitmap      bitmap =
             new Bitmap(
                 base.GetType()
                 .Assembly.GetManifestResourceStream("Yutai.ArcGIS.Controls.Controls.TOCTreeview.layers.bmp"));
         pNode.Image = bitmap;
         pNode.Tag   = frame;
         pParantNodes.Add(pNode);
         this.InsertMapToTree((IBasicMap)frame.Map, pNode);
     }
     else if (pElement is IGroupElement)
     {
         IGroupElement element  = (IGroupElement)pElement;
         IEnumElement  elements = element.Elements;
         elements.Reset();
         for (IElement element3 = elements.Next(); element3 != null; element3 = elements.Next())
         {
             this.InsertMapFrameToTree(element3, pParantNodes);
         }
     }
 }
예제 #2
0
        private void InsertLegendInfoToTree(ILegendInfo pLegendInfo, TOCTreeNode pParantNode)
        {
            int         legendGroupCount = pLegendInfo.LegendGroupCount;
            TOCTreeNode pNode            = pParantNode;
            TOCTreeNode node2            = null;

            for (int i = 0; i < legendGroupCount; i++)
            {
                ILegendGroup group = pLegendInfo.get_LegendGroup(i);
                if (legendGroupCount > 1)
                {
                    pNode = new TOCTreeNodeEx(group.Heading)
                    {
                        Tag = group
                    };
                    pParantNode.Nodes.Add(pNode);
                }
                int classCount = group.ClassCount;
                for (int j = 0; j < classCount; j++)
                {
                    ILegendClass class2 = group.get_Class(j);
                    node2 = new TOCTreeNodeEx(class2.Label, false, true)
                    {
                        Tag = class2
                    };
                    pNode.Nodes.Add(node2);
                }
            }
        }
예제 #3
0
        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);
                }
            }
        }
예제 #4
0
 public void RefreshTree()
 {
     try
     {
         this.m_pTOCTreeView.Nodes.Clear();
         if (this.m_pPageLayoutCtrl != null)
         {
             IPageLayout        pageLayout = this.m_pPageLayoutCtrl.PageLayout;
             IActiveView        view       = pageLayout as IActiveView;
             IGraphicsContainer container  = pageLayout as IGraphicsContainer;
             container.Reset();
             for (IElement element = container.Next(); element != null; element = container.Next())
             {
                 this.InsertMapFrameToTree(element, this.m_pTOCTreeView.Nodes);
             }
         }
         else if (this.m_pMapCtrl != null)
         {
             string name = this.m_pMapCtrl.Map.Name;
             if (name == "")
             {
                 name = "Scene";
             }
             TOCTreeNode pNode = new TOCTreeNodeEx(name, false, true);
             base.m_FocusMapNode          = pNode;
             base.m_FocusMapNode.NodeFont = new Font("Arial", 8f, FontStyle.Bold);
             Bitmap bitmap =
                 new Bitmap(
                     base.GetType()
                     .Assembly.GetManifestResourceStream(
                         "Yutai.ArcGIS.Controls.Controls.TOCTreeview.layers.bmp"));
             pNode.Image = bitmap;
             pNode.Tag   = this.m_pMapCtrl.Map;
             this.m_pTOCTreeView.Nodes.Add(pNode);
             this.InsertMapToTree(this.m_pMapCtrl.Map as IBasicMap, pNode);
         }
     }
     catch (Exception exception)
     {
         Logger.Current.Error("", exception, "");
     }
     this.m_pTOCTreeView.ExpandAll();
     this.m_pTOCTreeView.Calculate();
     this.m_pTOCTreeView.SetScroll();
     this.m_pTOCTreeView.Invalidate(this.m_pTOCTreeView.ClientRectangle);
 }
예제 #5
0
 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);
 }
예제 #6
0
        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);
        }