Пример #1
0
        private void UpdateContainer()
        {
            if (m_root == null)
            {
                return;
            }

            m_root.SetContainer(m_treeNodeContainer);
        }
Пример #2
0
        private HLODTreeNode ConvertNode(HLODTreeNodeContainer container, SpaceNode rootNode)
        {
            HLODTreeNode root = new HLODTreeNode();

            root.SetContainer(container);

            Queue <HLODTreeNode> hlodTreeNodes = new Queue <HLODTreeNode>();
            Queue <SpaceNode>    spaceNodes    = new Queue <SpaceNode>();
            Queue <int>          levels        = new Queue <int>();

            hlodTreeNodes.Enqueue(root);
            spaceNodes.Enqueue(rootNode);
            levels.Enqueue(0);

            while (hlodTreeNodes.Count > 0)
            {
                var hlodTreeNode = hlodTreeNodes.Dequeue();
                var spaceNode    = spaceNodes.Dequeue();
                int level        = levels.Dequeue();

                convertedTable[spaceNode] = hlodTreeNode;

                hlodTreeNode.Level  = level;
                hlodTreeNode.Bounds = spaceNode.Bounds;
                if (spaceNode.HasChild() == true)
                {
                    List <HLODTreeNode> childTreeNodes = new List <HLODTreeNode>(spaceNode.GetChildCount());
                    for (int i = 0; i < spaceNode.GetChildCount(); ++i)
                    {
                        var treeNode = new HLODTreeNode();
                        treeNode.SetContainer(container);
                        childTreeNodes.Add(treeNode);

                        hlodTreeNodes.Enqueue(treeNode);
                        spaceNodes.Enqueue(spaceNode.GetChild(i));
                        levels.Enqueue(level + 1);
                    }

                    hlodTreeNode.SetChildTreeNode(childTreeNodes);
                }
            }

            return(root);
        }