Exemplo n.º 1
0
        private void ShowParseTree(Queue <TreeNode> nodes)
        {
            var form = new Form();

            form.WindowState = FormWindowState.Maximized;
            GViewer viewer = new GViewer();
            var     tree   = new PhyloTree();


            while (nodes.Count > 0)
            {
                TreeNode treeNode = nodes.Dequeue();
                foreach (TreeNode childNode in treeNode.Nodes)
                {
                    Node node = tree.AddNode(treeNode.ToString());
                    node.Attr.FillColor = Microsoft.Msagl.Drawing.Color.Orange;
                    tree.AddEdge(treeNode.ToString(), childNode.ToString());

                    nodes.Enqueue(childNode);
                }
            }

            viewer.Graph = tree;
            form.SuspendLayout();
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;
            form.Controls.Add(viewer);
            form.ResumeLayout();
            form.ShowDialog();
        }
Exemplo n.º 2
0
        void button1_Click(object sender, EventArgs e)
        {
            var tree = new PhyloTree();
            var edge = (PhyloEdge)tree.AddEdge("a", "b");

            //edge.Length = 0.8;
            edge = (PhyloEdge)tree.AddEdge("a", "c");
            //edge.Length = 0.2;
            tree.AddEdge("c", "d");
            tree.AddEdge("c", "e");
            tree.AddEdge("c", "f");
            tree.AddEdge("e", "0");
            tree.AddEdge("e", "1");
            tree.AddEdge("e", "2");

            viewer.Graph = tree;
        }