コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            _controller = new Controller();
            _controller.Initiate();
            IConceptLattice conceptLattice = new Algorithm();

            /*string fcaFilePath = @"E:\MSSE Program\MSSE 2nd Semester\Software Analytics\Code\my_input.txt";
             * string latticeFilePath = @"E:\MSSE Program\MSSE 2nd Semester\Software Analytics\Code\lattice_input.txt";
             * var concepts = conceptLattice.ConstructConceptLattice(fcaFilePath, latticeFilePath);
             */
            var concepts = conceptLattice.ConstructConceptLattice(_controller.FCAFilePath, _controller.LatticeFilePath);

            nodes = ConvertToNodes(concepts).Values.ToList();
            AddLabel(nodes[0]);

            int maxLevel = nodes.Max(node => node.Level);

            for (int i = 0; i <= maxLevel; i++)
            {
                var sameLevelNodes = nodes.Where(node => node.Level.Equals(i)).ToArray();
                for (int j = 0; j < sameLevelNodes.Count(); j++)
                {
                    Node nd = sameLevelNodes[j];
                    nd.X = this.Size.Width / sameLevelNodes.Count() * (j);
                    nd.Y = 150 * i;
                }
            }

            foreach (var node in nodes)
            {
                DrawIt(node);
                foreach (var child in node.ChildNodes)
                {
                    DrawEdge(node, child);
                }
            }
        }