예제 #1
0
 public static bool RenewAdvTree(Dictionary <string, List <string> > DicData, AdvTree AdvTree)
 {
     try
     {
         //使用BeginUpdate,減少控制項的重繪頻率,降低系統的負擔.
         AdvTree.BeginUpdate();
         foreach (KeyValuePair <string, List <string> > kvp in DicData)
         {
             Node node1 = new Node();
             node1.Text             = kvp.Key;
             node1.ExpandVisibility = eNodeExpandVisibility.Visible;
             foreach (string i in kvp.Value)
             {
                 Node node2 = new Node();
                 node2.Text            = i;
                 node2.CheckBoxVisible = true;
                 node1.Nodes.Add(node2);
             }
             AdvTree.Nodes.Add(node1);
         }
         AdvTree.EndUpdate();
     }
     catch (System.Exception ex)
     {
         return(false);
     }
     return(true);
 }
예제 #2
0
 public static void updateNodes(Node oRootNode, AdvTree oParentTree)
 {
     oParentTree.BeginUpdate();
     oParentTree.ClearAndDisposeAllNodes();
     oParentTree.Nodes.Add(oRootNode);
     oParentTree.EndUpdate(true);
 }
예제 #3
0
        public bool InitializeOISTree(Com_Dimension inputDimen, AdvTree OISTree)
        {
            try
            {
                OISTree.BeginUpdate();

                //泡泡
                Node singleDimen = new Node();
                singleDimen.Text = inputDimen.ballon.ToString();

                foreach (Node i in OISTree.Nodes)
                {
                    if (i.Cells[0].Text == inputDimen.ballon.ToString())
                    {
                        OISTree.EndUpdate();
                        return(true);
                    }
                }

                //Dimension
                Cell       dimension      = new Cell();
                WebBrowser tempWebBrowser = new WebBrowser();
                tempWebBrowser.Size = new Size(200, 25);
                tempWebBrowser.ScrollBarsEnabled = false;
                string htmlPath = "";
                CaxExcel.CreateHTML(inputDimen, out htmlPath);
                tempWebBrowser.Url      = new Uri(htmlPath);
                dimension.HostedControl = tempWebBrowser;
                singleDimen.Cells.Add(dimension);

                //刀號
                Cell toolNo = new Cell();
                toolNo.Text = inputDimen.toolNoControl;
                singleDimen.Cells.Add(toolNo);

                OISTree.Nodes.Add(singleDimen);

                OISTree.EndUpdate();
            }
            catch (System.Exception ex)
            {
                return(false);
            }
            return(true);
        }
예제 #4
0
        //获取图层属性
        private void ReadLayerProperties(ILayer layer, AdvTree tree)
        {
            tree.BeginUpdate();
            tree.Nodes.Clear();
            if (layer is IFeatureLayer)
            {
                ILayerGeneralProperties layerProperties = layer as ILayerGeneralProperties;
                AddChildNode(tree.Nodes, "LastMaximumScale", layerProperties.LastMaximumScale.ToString());
                AddChildNode(tree.Nodes, "LastMinimumScale", layerProperties.LastMinimumScale.ToString());
                AddChildNode(tree.Nodes, "LayerDescription ", layerProperties.LayerDescription);
            }
            else if (layer is IRasterLayer)
            {
                IRasterLayer rasterLayer = layer as IRasterLayer;
                if (rasterLayer.Raster != null)
                {
                    IRaster  raster                   = rasterLayer.Raster;
                    IRaster2 raster2                  = raster as IRaster2;
                    IRasterBandCollection coll        = raster2 as IRasterBandCollection;
                    IRasterProps          rasterProps = raster2 as IRasterProps;
                    //基本信息
                    Node node = AddChildNode(tree.Nodes, "基本信息", null);
                    AddChildNode(node.Nodes, "行数,列数", rasterProps.Height.ToString() + "," + rasterProps.Width.ToString());
                    AddChildNode(node.Nodes, "波段数", coll.Count.ToString());
                    AddChildNode(node.Nodes, "像元大小(x,y)", rasterProps.MeanCellSize().X.ToString() + "," + rasterProps.MeanCellSize().Y.ToString());
                    AddChildNode(node.Nodes, "波段数", coll.Count.ToString());
                    AddChildNode(node.Nodes, "像素类型", rasterProps.PixelType.ToString());
                    AddChildNode(node.Nodes, "无效值", ClsGetCameraView.getNoDataValue(rasterProps.NoDataValue).ToString());

                    node = AddChildNode(tree.Nodes, "坐标范围", null);
                    AddChildNode(node.Nodes, "上", rasterProps.Extent.YMax.ToString());
                    AddChildNode(node.Nodes, "左", rasterProps.Extent.XMin.ToString());
                    AddChildNode(node.Nodes, "右", rasterProps.Extent.XMax.ToString());
                    AddChildNode(node.Nodes, "下", rasterProps.Extent.YMin.ToString());

                    node = AddChildNode(tree.Nodes, "统计信息", null);
                    ClsGDBDataCommon cls = new ClsGDBDataCommon();
                    for (int i = 0; i < coll.Count; i++)
                    {
                        double[] dValue   = cls.GetRasterStatistics(m_pLayer, i);
                        Node     nodeBand = AddChildNode(node.Nodes, "Band_" + (i + 1).ToString(), null);
                        AddChildNode(nodeBand.Nodes, "最大值", dValue[0].ToString());
                        AddChildNode(nodeBand.Nodes, "最小值", dValue[1].ToString());
                        AddChildNode(nodeBand.Nodes, "平均值", dValue[2].ToString());
                        AddChildNode(nodeBand.Nodes, "标准差", dValue[3].ToString());
                    }
                }
            }
            tree.EndUpdate(true);
            tree.ExpandAll();
        }
예제 #5
0
        private void UpdateContent()
        {
            FTree.Nodes.Clear();
            if (PreparedPages == null)
            {
                return;
            }

            Outline outline = PreparedPages.Outline;

            FTree.BeginUpdate();
            EnumNodes(outline.Xml, FTree.Nodes);
            if (FTree.Nodes.Count == 1)
            {
                FTree.Nodes[0].Expand();
            }
            FTree.EndUpdate();

            // to update tree's scrollbars
            Style = Style;
        }
예제 #6
0
 private void ClearTree(AdvTree advTree)
 {
     advTree.BeginUpdate();
     advTree.Nodes.Clear();
     advTree.EndUpdate(true);
 }
예제 #7
0
 private void AddNode(Node node, AdvTree advTree)
 {
     advTree.BeginUpdate();
     advTree.Nodes.Add(node);
     advTree.EndUpdate();
 }
예제 #8
0
        private Node CreateNode(AdvTree tree)
        {
            IDesignerHost dh = (IDesignerHost)GetService(typeof(IDesignerHost));
            if (dh == null)
                return null;

            Node node = null;
            tree.BeginUpdate();
            try
            {
                IComponentChangeService change = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
                if (change != null)
                {
                    change.OnComponentChanging(this.Component, TypeDescriptor.GetProperties(tree).Find("Nodes", true));
                }

                node = dh.CreateComponent(typeof(Node)) as Node;
                if (node != null)
                {
                    node.Text = node.Name;
                    node.Expanded = true;
                    tree.Nodes.Add(node);
                    
                    if (change != null)
                        change.OnComponentChanged(this.Component, TypeDescriptor.GetProperties(tree).Find("Nodes", true), null, null);
                }
            }
            finally
            {
                tree.EndUpdate();
            }

            return node;
        }