예제 #1
0
 private void Classify()
 {
     Groups = ClassificationUtil.Classify(GridData, Mode, (int)groupCountControl.Value);
     groupsList.Items.Clear();
     foreach (var group in Groups)
     {
         groupsList.Items.Add("Група " + (groupsList.Items.Count + 1));
     }
     groupsList.SelectedIndex = 0;
 }
예제 #2
0
        private void BuildTree()
        {
            TreeData.TreeDataTableDataTable dtTree =
                new TreeData.TreeDataTableDataTable();
            var tree = ClassificationUtil.ExtractTree(GridData, Mode, (int)groupCountControl.Value);

            foreach (var treeEntry in tree)
            {
                TreeNode node  = treeEntry.Item2;
                var      label = node is LeafNode ? ((LeafNode)node).ImageName.Split(Path.DirectorySeparatorChar).Last() : "";
                dtTree.AddTreeDataTableRow(node.Id, treeEntry.Item1, label, node.GroupRoot);
            }
            //instantiate the object
            var myTree = new TreeBuilder(dtTree);
            var rootId = tree.Find(t => t.Item1 == "").Item2.Id;

            treeBox.Image = Image.FromStream(
                myTree.GenerateTree(rootId,
                                    System.Drawing.Imaging.ImageFormat.Bmp));
        }