Changeset 10254 for branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/DataPreprocessingView.cs
- Timestamp:
- 12/18/13 16:24:16 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/DataPreprocessingView.cs
r10247 r10254 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.ComponentModel;4 using System.Drawing;5 using System.Data;6 3 using System.Linq; 7 using System.Text;8 4 using System.Windows.Forms; 9 using HeuristicLab.Core.Views;10 using HeuristicLab.DataPreprocessing.Implementations;11 using HeuristicLab.MainForm;12 5 using HeuristicLab.Common; 13 6 using HeuristicLab.Core; 7 using HeuristicLab.Core.Views; 14 8 using HeuristicLab.Data; 9 using HeuristicLab.MainForm; 10 using HeuristicLab.Optimization; 15 11 using HeuristicLab.Problems.DataAnalysis; 16 12 17 namespace HeuristicLab.DataPreprocessing 18 { 13 namespace HeuristicLab.DataPreprocessing { 19 14 [View("DataPreprocessing View")] 20 15 [Content(typeof(PreprocessingContext), true)] … … 29 24 30 25 InitializeContents(); 31 26 32 27 } 33 28 … … 36 31 ListViewItem listViewItem = new ListViewItem(); 37 32 38 39 40 41 42 33 listViewItem.Text = item.ToString(); 34 //listViewItem.ToolTipText = item.ItemName + ": " + item.ItemDescription; 35 //itemsListView.SmallImageList.Images.Add(content.); 36 //listViewItem.ImageIndex = itemsListView.SmallImageList.Images.Count - 1; 37 //listViewItem.Tag = item; 43 38 return listViewItem; 44 39 } 45 40 46 41 private void InitializeContents() { 47 dataGridContent = new DataGridContent(new DataGridLogic( this.Content));42 dataGridContent = new DataGridContent(new DataGridLogic(Content != null ? this.Content.Data : null)); 48 43 49 listViewItemItemMapping = new Dictionary<ListViewItem, IItem>();44 listViewItemItemMapping = new Dictionary<ListViewItem, IItem>(); 50 45 ListViewItem contentListViewItem = CreateListViewItem(dataGridContent); 51 46 listViewItemItemMapping[contentListViewItem] = dataGridContent; … … 54 49 } 55 50 56 public new Preprocessing DataContent {57 get { return (Preprocessing Data)base.Content; }51 public new PreprocessingContext Content { 52 get { return (PreprocessingContext)base.Content; } 58 53 set { base.Content = value; } 59 54 } … … 61 56 private void listView1_SelectedIndexChanged(object sender, EventArgs e) { 62 57 63 if (contentListView.SelectedItems.Count > 0) 64 { 65 ListViewItem listViewItem = (ListViewItem)contentListView.SelectedItems[0]; 66 this.viewHost.Content = listViewItemItemMapping[listViewItem]; 67 } 58 if (contentListView.SelectedItems.Count > 0) { 59 ListViewItem listViewItem = (ListViewItem)contentListView.SelectedItems[0]; 60 this.viewHost.Content = listViewItemItemMapping[listViewItem]; 61 } 68 62 } 69 63 … … 73 67 } 74 68 75 private void tryOutAlgorithmButton_Click(object sender, EventArgs e) 76 {69 private void tryOutAlgorithmButton_Click(object sender, EventArgs e) { 70 IPreprocessingData Data = Content.Data; 77 71 72 foreach (string variable in Data.VariableNames) { 73 for (int j = 0; j < Data.Rows; j++) { 74 // assume: all double 75 Data.SetCell(variable, j, 1.0); 76 } 77 } 78 79 MessageBox.Show("Success, now cloning... "); 80 81 Dataset dataset = Data.ExportToDataset(); 82 var variables = new CheckedItemList<StringValue>(Data.VariableNames.Select(s => new StringValue(s))).AsReadOnly(); 83 84 var cloner = new Cloner(); 85 86 cloner.RegisterClonedObject(Content.DataAnalysisProblemData.Dataset, dataset); 87 cloner.RegisterClonedObject(Content.DataAnalysisProblemData.TrainingPartition, Data.TrainingPartition); 88 cloner.RegisterClonedObject(Content.DataAnalysisProblemData.TestPartition, Data.TestPartition); 89 cloner.RegisterClonedObject(Content.DataAnalysisProblemData.InputVariables, variables); 90 if (Content.Algorithm != null) { 91 cloner.RegisterClonedObject(Content.Algorithm.Runs, new RunCollection { OptimizerName = Content.Algorithm.Name }); 92 } 93 94 var item = cloner.Clone(Content.ParentItem); 95 96 MainFormManager.MainForm.ShowContent(item); 78 97 } 79 80 //private void button1_Click(object sender, System.EventArgs e)81 //{82 83 // IPreprocessingData Data = Content.Data;84 85 // foreach (string variable in Data.VariableNames)86 // {87 // for (int j = 0; j < Data.Rows; j++)88 // {89 // // assume: all double90 // Data.SetCell(variable, j, 1.0);91 // }92 // }93 94 // MessageBox.Show("Success, now cloning... ");95 96 // Dataset dataset = Data.ExportToDataset();97 // var variables = new CheckedItemList<StringValue>(Data.VariableNames.Select(s => new StringValue(s))).AsReadOnly();98 99 // var cloner = new Cloner();100 101 // cloner.RegisterClonedObject(Content.DataAnalysisProblemData.Dataset, dataset);102 // cloner.RegisterClonedObject(Content.DataAnalysisProblemData.TrainingPartition, Data.TrainingPartition);103 // cloner.RegisterClonedObject(Content.DataAnalysisProblemData.TestPartition, Data.TestPartition);104 // cloner.RegisterClonedObject(Content.DataAnalysisProblemData.InputVariables, variables);105 106 // var item = cloner.Clone(Content.ParentItem);107 108 // MainFormManager.MainForm.ShowContent(item);109 110 // //var clone = null;111 112 //}113 114 115 98 } 116 99 } 117 100 118
Note: See TracChangeset
for help on using the changeset viewer.