예제 #1
0
        /**
         * @brief call this after _treeNode is added to bttree
         **/
        public void DeclareAddNode(BTNode _treeNode)
        {
            BTNode parent    = m_btTree.FindParent(_treeNode);
            string parentKey = BTEditorRectangle.GetKey(parent);

            if (m_sprites.ContainsKey(parentKey))
            {
                BTEditorRectangle.RecursivelyCreateSprites(m_sprites, parent, this);
                AutoLayoutChart();
                Refresh();
            }
        }
예제 #2
0
 /**
  * @brief recursively layout the nodes
  **/
 private void AutoLayoutChart()
 {
     if (m_btTree != null && m_btTree.Root != null && m_sprites != null)
     {
         string rootKey = BTEditorRectangle.GetKey(m_btTree.Root);
         // auto layout
         Point leftTop = new Point(10, 10);
         if (m_sprites.ContainsKey(rootKey))
         {
             (m_sprites[rootKey] as BTEditorRectangle).AutoRecursivelyLayout(m_sprites, leftTop);
         }
     }
 }
예제 #3
0
 /**
  * @brief recursively create sprites and insert into _sprites
  **/
 internal static void RecursivelyCreateSprites(Dictionary <string, BTEditorSprite> _sprites, BTNode _btNode, BTTreeViewer _btTreeViewer)
 {
     if (_btNode == null)
     {
         return;
     }
     if (!_sprites.ContainsKey(BTEditorRectangle.GetKey(_btNode)))
     {
         BTEditorRectangle node = CreateRectangleNodeFromBTNode(_btNode, _btTreeViewer);
         node.Node = _btNode;
         _sprites.Add(node.GetKey(), node);
     }
     (_sprites[BTEditorRectangle.GetKey(_btNode)] as BTEditorRectangle).RecursivelyCreatChildren(_sprites);
 }
예제 #4
0
        /**
         * @brief get the existing BTEditorRectangle for the given BTNode
         **/
        internal BTEditorRectangle GetRectangle(BTNode _node)
        {
            if (_node == null)
            {
                return(null);
            }
            string key = BTEditorRectangle.GetKey(_node);

            if (m_sprites != null && m_sprites.ContainsKey(key))
            {
                return(m_sprites[key] as BTEditorRectangle);
            }
            return(null);
        }