/// <summary>
 /// 初始化显示
 /// </summary>
 private void InitShow()
 {
     entryIDToNodeDic = new Dictionary <int, UITreeNode>();
     uiTree.Clear();
     EntryDataInfo[] entryDataInfos = entryData.GetTops();//最上层节点
     if (entryDataInfos != null)
     {
         foreach (EntryDataInfo entryDataInfo in entryDataInfos)
         {
             CreateNodeByEntryDataInfo(entryDataInfo);
         }
     }
     uiTree.UpdateRenderer();
 }
    /// <summary>
    /// 初始化显示
    /// </summary>
    private void InitShow()
    {
        synthesisItemTree.Clear();
        SynthesisDataStruct[] synthesisDataStructs = synthesisStructData.SearchSynthesisData(temp => temp.synthesisType == iSynthesisState.SynthesisType);
        EnumSynthesisItem[]   enumSynthesisItems   = synthesisDataStructs.Select(temp => temp.synthesisItem).Distinct().ToArray();
        //这里需要将枚举转换成对应的文字,但是这里直接使用枚举了(这里添加的是根节点)
        Dictionary <EnumSynthesisItem, UITreeNode> rootNodeDic = enumSynthesisItems.ToDictionary(temp => temp,
                                                                                                 temp =>
        {
            UITreeNode rootNode = synthesisItemTree.CreateTreeNode();
            rootNode.ExplanText = temp.ToString();
            rootNode.IsDisplay  = true;
            rootNode.IsExpand   = true;
            rootNode.value      = null;
            synthesisItemTree.AddTreeNode(rootNode);
            return(rootNode);
        });

        //这里添加的是各自类型的子节点
        foreach (KeyValuePair <EnumSynthesisItem, UITreeNode> rootNode in rootNodeDic)
        {
            SynthesisDataStruct[] tempSynthesisDataStructs = synthesisDataStructs.Where(temp => temp.synthesisItem == rootNode.Key).ToArray();
            foreach (SynthesisDataStruct tempSynthesisDataStruct in tempSynthesisDataStructs)
            {
                UITreeNode createNode = synthesisItemTree.CreateTreeNode();
                createNode.ExplanText = tempSynthesisDataStruct.name;
                createNode.IsDisplay  = true;
                createNode.IsExpand   = true;
                createNode.value      = tempSynthesisDataStruct;
                rootNode.Value.Add(createNode);
            }
        }
        //选择设置第一个选项为当前选项
        if (synthesisItemTree.Count > 0)
        {
            synthesisItemTree[0].IsSelect = true;
        }
    }
    public void ClearButtonClicked()
    {
        System.IO.File.Delete(wexbimFileName);
        SomeValue.fileName = default;
        Destroy(SomeValue.project.ThisGameObject);

        SomeValue.project = default;
        SomeValue.Elements.Clear();
        SomeValue.spatialStructures.Clear();
        MyBimGeomorty.regions.Clear();
        MyBimGeomorty.colors.Clear();
        MyBimGeomorty.products.Clear();

        uiTree.Clear();
        ClearGeneralPropertiesPannel();
        ClearPropertiesPannel();

        Transform target = Camera.main.GetComponent <CameraFollow>().target;

        target.position = Vector3.zero;
        target.rotation = new Quaternion();
        Camera.main.transform.position = new Vector3(0, 0, -1);
        Camera.main.transform.rotation = new Quaternion();
    }
Exemple #4
0
        private void cmdRBTreeTest_Click(object sender, EventArgs e)
        {
            GC.Collect();
            System.Diagnostics.Stopwatch st1 = new System.Diagnostics.Stopwatch();
            {
                List <UIElement> list1 = new List <UIElement>();
                st1.Start();
                for (int i = 0; i < 10000; ++i)
                {
                    Box box1 = new Box(30, 30);
                    list1.Add(box1);
                }
                st1.Stop();
                System.Diagnostics.Debug.WriteLine("list:" + st1.ElapsedMilliseconds);
                st1.Reset();
                list1.TrimExcess();
                list1.Clear();
                GC.Collect();
            }
            //---------------
            {
                LinkedList <UIElement> linkedList = new LinkedList <UIElement>();
                st1.Start();
                for (int i = 0; i < 10000; ++i)
                {
                    Box box1 = new Box(30, 30);
                    linkedList.AddLast(box1);
                }
                st1.Stop();
                System.Diagnostics.Debug.WriteLine("linked-list:" + st1.ElapsedMilliseconds);
                st1.Reset();
                linkedList.Clear();
                GC.Collect();
            }
            //---------------
            {
                var elemTree = new UITree();
                st1.Start();
                for (int i = 0; i < 10000; ++i)
                {
                    Box box1 = new Box(30, 30);
                    elemTree.Add(box1);
                }
                st1.Stop();
                System.Diagnostics.Debug.WriteLine("tree1:" + st1.ElapsedMilliseconds);
                st1.Reset();
                elemTree.Clear();
                GC.Collect();
                //---------------
            }
            {
                var elemTree = new RedBlackTree <RBNode <int> >();
                for (int i = 0; i < 10000; ++i)
                {
                    elemTree.Add(new RBNode <int>(i));
                }

                //find element at specfic position
                st1.Start();
                var node  = elemTree.GetNodeAt(500);
                var node2 = elemTree.GetNodeAt(10000 - 20);
                st1.Stop();
                //---------------
                st1.Reset();
                System.Diagnostics.Debug.WriteLine("tree1:" + st1.ElapsedMilliseconds);
            }
        }