Exemplo n.º 1
0
        private void AddNode(Node t, TreeNode parent)
        {
            TreeNode newNode = new TreeNode(new InformationNode(t.ToString()));

            //Console.WriteLine(t.ToString());

            if (parent.TrueNode == null)
            {
                parent.TrueNode = newNode;
            }
            else
            {
                parent.FalseNode = newNode;
            }
            if (t is DecisionNode)
            {
                if (((DecisionNode)t).TrueNode != null)
                {
                    AddNode(((DecisionNode)t).TrueNode, newNode);
                }
                if (((DecisionNode)t).FalseNode != null)
                {
                    AddNode(((DecisionNode)t).FalseNode, newNode);
                }
            }
        }
Exemplo n.º 2
0
 private void Draw_Tree(object sender, MouseEventArgs e)
 {
     this.rootNode = manager.getTreeRootNode();
     if (rootNode != null)
     {
         this.graphRoot = new TreeNode(new InformationNode(rootNode.ToString()));
         this.GenerateTree(rootNode);
         this.Arrange();
     }
     else
     {
         MessageBox.Show("The tree needs to be trained first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 3
0
        private void GenerateTree(Node rootTree)
        {
            this.graphRoot = new TreeNode(new InformationNode(rootTree.ToString()));
            //Console.WriteLine(rootTree.ToString());

            if (((DecisionNode)rootTree).TrueNode != null)
            {
                AddNode(((DecisionNode)rootTree).TrueNode, this.graphRoot);
            }

            if (((DecisionNode)rootTree).FalseNode != null)
            {
                AddNode(((DecisionNode)rootTree).TrueNode, this.graphRoot);
            }
        }
Exemplo n.º 4
0
        public void SetManager(DepartmentManager manager)
        {
            this.manager = manager;

            this.rootNode = manager.getTreeRootNode();
            if (rootNode != null)
            {
                this.graphRoot = new TreeNode(new InformationNode(rootNode.ToString()));
                this.GenerateTree(rootNode);
                this.Arrange();
            }
            else
            {
                MessageBox.Show("The tree needs to be trained first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }