Esempio 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);
                }
            }
        }
Esempio 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);
     }
 }
Esempio 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);
            }
        }
Esempio 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);
            }
        }