コード例 #1
1
        private void btnDraw_Click(object sender, RoutedEventArgs e)
        {
            switch (cbFunction.SelectedItem.ToString())
            {
                case "Spectral Graph for GB-S3VDD": //Draw Visual Spectral Graph for GB-S3VDD
                    //Clear old Edge
                    for (int i = 0; i < drawingPad.Children.Count; ++i)
                    {
                        string obj = drawingPad.Children[i].ToString();

                        if (obj.IndexOf("Line") != -1)
                        {
                            drawingPad.Children.RemoveAt(i);
                            i--;
                        }
                    }

                    dataset = new Dataset(lstPoint.ToArray());

                    graph = new GraphBase(dataset, double.Parse(txtXichma.Text), int.Parse(txtK.Text));
                    graph.myCanvas = drawingPad;
                    graph.DrawSG_for_GBS3VDD();

                    tbStatus.Text = "Visual Spectral Graph for GB-S3VDD (with k = " + txtK.Text + " & σ = " + txtXichma.Text + ") completed !";
                    break;
                case "Spectral Graph": //Draw Visual spectral graph
                    //Clear old Edge
                    for (int i = 0; i < drawingPad.Children.Count; ++i)
                    {
                        string obj = drawingPad.Children[i].ToString();

                        if (obj.IndexOf("Line") != -1)
                        {
                            drawingPad.Children.RemoveAt(i);
                            i--;
                        }
                    }

                    dataset = new Dataset(lstPoint.ToArray());

                    graph = new GraphBase(dataset, double.Parse(txtXichma.Text), int.Parse(txtK.Text));
                    graph.myCanvas = drawingPad;
                    graph.DrawVSG();

                    tbStatus.Text = "Visual Spectral Graph (with k = " + txtK.Text + " & σ = " + txtXichma.Text + ") completed !";
                    break;
            }
        }
コード例 #2
0
        private void btnOpenData_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                drawingPad.Children.Clear();
                lstPoint.Clear();
                dataset = null;
                OpenFileDialog openDlg = new OpenFileDialog();
                openDlg.ShowDialog();
                dataset = Dataset.Read(openDlg.FileName);
                datasetName = openDlg.FileName;

                switch (cbFunction.SelectedItem.ToString())
                {
                    case "Spectral Graph for GB-S3VDD":
                    case "Spectral Graph":
                    case "Clustering":
                        lstPoint = dataset.Data.ToList();
                        graph = new GraphBase(dataset, double.Parse(txtXichma.Text), int.Parse(txtK.Text));
                        graph.myCanvas = drawingPad;
                        graph.DrawDataset();
                        break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }