- Timestamp:
- 03/12/14 17:42:42 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataGridContentView.cs
r10585 r10590 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Drawing;25 24 using System.Linq; 26 25 using System.Windows.Forms; 26 using HeuristicLab.Data.Views; 27 27 using HeuristicLab.MainForm; 28 using System.Drawing; 28 29 29 30 namespace HeuristicLab.DataPreprocessing.Views { … … 31 32 [Content(typeof(IDataGridContent), true)] 32 33 public partial class DataGridContentView : CopyOfStringConvertibleMatrixView { 33 34 private int lastClickedRow;35 private int lastClickedColumn;36 34 37 35 private bool notOwnEvent = true; … … 123 121 contextMenu.Show(MousePosition); 124 122 } else { 123 if (!dataGridView.SelectedCells.Contains(dataGridView[e.ColumnIndex, e.RowIndex])) { 124 dataGridView.ClearSelection(); 125 dataGridView[e.ColumnIndex, e.RowIndex].Selected = true; 126 } 125 127 interpolationToolStripMenuItem.Enabled = !(e.RowIndex == 0 || e.RowIndex == Content.Rows); 126 128 contextMenuCell.Show(MousePosition); 127 lastClickedColumn = e.ColumnIndex;128 lastClickedRow = e.RowIndex;129 129 } 130 130 } … … 175 175 } 176 176 177 private Dictionary<int, List<int>> GetSelectedCells() { 178 var selectedCells = new Dictionary<int, List<int>>(); 179 for (int i = 0; i < dataGridView.SelectedCells.Count; i++) { 180 var columnIndex=dataGridView.SelectedCells[i].ColumnIndex; 181 if(!selectedCells.ContainsKey(columnIndex)){ 182 selectedCells.Add(columnIndex,new List<int>()); 183 } 184 selectedCells[columnIndex].Add(dataGridView.SelectedCells[i].RowIndex); 185 } 186 return selectedCells; 187 } 188 177 189 private void ReplaceWithAverage_Click(object sender, EventArgs e) { 178 Content.PreprocessingDataManipulation.ReplaceIndicesByAverageValue( lastClickedColumn, new List<int>() { lastClickedRow });190 Content.PreprocessingDataManipulation.ReplaceIndicesByAverageValue(GetSelectedCells()); 179 191 } 180 192 181 193 private void ReplaceWithMedian_Click(object sender, EventArgs e) { 182 Content.PreprocessingDataManipulation.ReplaceIndicesByMedianValue( lastClickedColumn, new List<int>() { lastClickedRow });194 Content.PreprocessingDataManipulation.ReplaceIndicesByMedianValue(GetSelectedCells()); 183 195 } 184 196 185 197 private void ReplaceWithRandom_Click(object sender, EventArgs e) { 186 Content.PreprocessingDataManipulation.ReplaceIndicesByRandomValue( lastClickedColumn, new List<int>() { lastClickedRow });198 Content.PreprocessingDataManipulation.ReplaceIndicesByRandomValue(GetSelectedCells()); 187 199 } 188 200 189 201 private void ReplaceWithMostCommon_Click(object sender, EventArgs e) { 190 Content.PreprocessingDataManipulation.ReplaceIndicesByMostCommonValue( lastClickedColumn, new List<int>() { lastClickedRow });202 Content.PreprocessingDataManipulation.ReplaceIndicesByMostCommonValue(GetSelectedCells()); 191 203 } 192 204 193 205 private void ReplaceWithInterpolation_Click(object sender, EventArgs e) { 194 Content.PreprocessingDataManipulation.ReplaceIndicesByLinearInterpolationOfNeighbours( lastClickedColumn, new List<int>() { lastClickedRow });206 Content.PreprocessingDataManipulation.ReplaceIndicesByLinearInterpolationOfNeighbours(GetSelectedCells()); 195 207 } 196 208 }
Note: See TracChangeset
for help on using the changeset viewer.