- Timestamp:
- 04/23/14 15:51:41 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataGridContentView.cs
r10769 r10785 220 220 for (int i = 0; i < Content.FilterLogic.PreprocessingData.Columns; i++) { 221 221 comparisonFilter.ConstraintColumn = i; 222 bool[] filteredRows = Content.FilterLogic.Preview(filters );222 bool[] filteredRows = Content.FilterLogic.Preview(filters, true); 223 223 foundCells[i] = filteredRows.Select((value, index) => new { Index = index, Value = value }) 224 224 .Where(pair => pair.Value) -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FilterView.Designer.cs
r10713 r10785 30 30 { 31 31 this.groupBoxFilter = new System.Windows.Forms.GroupBox(); 32 this.checkedFilterView = new HeuristicLab.DataPreprocessing.Views.CheckedFilterCollectionView(); 32 33 this.groupBoxFilterInfo = new System.Windows.Forms.GroupBox(); 33 34 this.lblPercentage = new System.Windows.Forms.Label(); … … 38 39 this.lblTotal = new System.Windows.Forms.Label(); 39 40 this.applyFilterButton = new System.Windows.Forms.Button(); 41 this.rBtnOr = new System.Windows.Forms.RadioButton(); 42 this.rBtnAnd = new System.Windows.Forms.RadioButton(); 43 this.btnReset = new System.Windows.Forms.Button(); 44 this.groupBoxFilter.SuspendLayout(); 40 45 this.groupBoxFilterInfo.SuspendLayout(); 41 46 this.SuspendLayout(); … … 45 50 this.groupBoxFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 46 51 | System.Windows.Forms.AnchorStyles.Right))); 52 this.groupBoxFilter.Controls.Add(this.checkedFilterView); 47 53 this.groupBoxFilter.Location = new System.Drawing.Point(4, 4); 48 54 this.groupBoxFilter.Name = "groupBoxFilter"; … … 52 58 this.groupBoxFilter.Text = "Filter"; 53 59 // 60 // checkedFilterView 61 // 62 this.checkedFilterView.Caption = "filterView"; 63 this.checkedFilterView.Content = null; 64 this.checkedFilterView.Dock = System.Windows.Forms.DockStyle.Fill; 65 this.checkedFilterView.Location = new System.Drawing.Point(3, 16); 66 this.checkedFilterView.Name = "checkedFilterView"; 67 this.checkedFilterView.ReadOnly = false; 68 this.checkedFilterView.ShowDetails = true; 69 this.checkedFilterView.Size = new System.Drawing.Size(652, 308); 70 this.checkedFilterView.TabIndex = 0; 71 // 54 72 // groupBoxFilterInfo 55 73 // 56 this.groupBoxFilterInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 57 | System.Windows.Forms.AnchorStyles.Left) 74 this.groupBoxFilterInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 58 75 | System.Windows.Forms.AnchorStyles.Right))); 59 76 this.groupBoxFilterInfo.Controls.Add(this.lblPercentage); … … 139 156 this.applyFilterButton.Click += new System.EventHandler(this.applyFilterButton_Click); 140 157 // 158 // rBtnOr 159 // 160 this.rBtnOr.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 161 this.rBtnOr.AutoSize = true; 162 this.rBtnOr.Enabled = false; 163 this.rBtnOr.Location = new System.Drawing.Point(60, 480); 164 this.rBtnOr.Name = "rBtnOr"; 165 this.rBtnOr.Size = new System.Drawing.Size(36, 17); 166 this.rBtnOr.TabIndex = 3; 167 this.rBtnOr.Text = "Or"; 168 this.rBtnOr.UseVisualStyleBackColor = true; 169 // 170 // rBtnAnd 171 // 172 this.rBtnAnd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 173 this.rBtnAnd.AutoSize = true; 174 this.rBtnAnd.Checked = true; 175 this.rBtnAnd.Enabled = false; 176 this.rBtnAnd.Location = new System.Drawing.Point(10, 480); 177 this.rBtnAnd.Name = "rBtnAnd"; 178 this.rBtnAnd.Size = new System.Drawing.Size(44, 17); 179 this.rBtnAnd.TabIndex = 4; 180 this.rBtnAnd.TabStop = true; 181 this.rBtnAnd.Text = "And"; 182 this.rBtnAnd.UseVisualStyleBackColor = true; 183 this.rBtnAnd.CheckedChanged += new System.EventHandler(this.rBtnAnd_CheckedChanged); 184 // 185 // btnReset 186 // 187 this.btnReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 188 this.btnReset.Enabled = false; 189 this.btnReset.Location = new System.Drawing.Point(473, 473); 190 this.btnReset.Name = "btnReset"; 191 this.btnReset.Size = new System.Drawing.Size(75, 23); 192 this.btnReset.TabIndex = 5; 193 this.btnReset.Text = "Reset"; 194 this.btnReset.UseVisualStyleBackColor = true; 195 this.btnReset.Click += new System.EventHandler(this.btnReset_Click); 196 // 141 197 // FilterView 142 198 // 143 199 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 144 200 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 201 this.Controls.Add(this.btnReset); 202 this.Controls.Add(this.rBtnAnd); 203 this.Controls.Add(this.rBtnOr); 145 204 this.Controls.Add(this.applyFilterButton); 146 205 this.Controls.Add(this.groupBoxFilterInfo); … … 148 207 this.Name = "FilterView"; 149 208 this.Size = new System.Drawing.Size(670, 506); 209 this.groupBoxFilter.ResumeLayout(false); 150 210 this.groupBoxFilterInfo.ResumeLayout(false); 151 211 this.groupBoxFilterInfo.PerformLayout(); 152 212 this.ResumeLayout(false); 213 this.PerformLayout(); 153 214 154 215 } … … 165 226 private System.Windows.Forms.TextBox tbFiltered; 166 227 private System.Windows.Forms.Label lblFiltered; 228 private System.Windows.Forms.RadioButton rBtnOr; 229 private System.Windows.Forms.RadioButton rBtnAnd; 230 private CheckedFilterCollectionView checkedFilterView; 231 private System.Windows.Forms.Button btnReset; 167 232 168 233 -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FilterView.cs
r10713 r10785 14 14 [Content(typeof(FilterContent), true)] 15 15 public partial class FilterView : ItemView { 16 private CheckedItemCollectionView<IFilter> filterView;16 //private CheckedItemCollectionView<IFilter> filterView; 17 17 18 18 public FilterView() { … … 21 21 tbFiltered.Text = "0"; 22 22 tbPercentage.Text = "0%"; 23 filterView = new CheckedItemCollectionView<IFilter>(); 24 filterView.Dock = DockStyle.Fill; 23 checkedFilterView.Content = new CheckedItemCollection<IFilter>(); 24 //filterView = new CheckedItemCollectionView<IFilter>(); 25 //filterView = new CheckedFilterCollectionView(); 26 /*filterView.Dock = DockStyle.Fill; 25 27 filterView.Content = new CheckedItemCollection<IFilter>(); 26 filterView.Content.ItemsAdded += Content_ItemsAdded; 27 filterView.Content.ItemsRemoved += Content_ItemsRemoved; 28 filterView.Content.CheckedItemsChanged += Content_CheckedItemsChanged; 29 groupBoxFilter.Controls.Add(filterView); 28 * */ 29 checkedFilterView.Content.ItemsAdded += Content_ItemsAdded; 30 checkedFilterView.Content.ItemsRemoved += Content_ItemsRemoved; 31 checkedFilterView.Content.CheckedItemsChanged += Content_CheckedItemsChanged; 32 //groupBoxFilter.Controls.Add(filterView);*/ 30 33 } 31 34 32 35 public new FilterContent Content { 33 36 get { return (FilterContent)base.Content; } 34 set { base.Content = value; }37 set { base.Content = value; UpdateFilterInfo(); } 35 38 } 36 39 … … 39 42 foreach (IFilter filter in e.Items) 40 43 { 41 /* if (filterView.Content.CheckedItems.Contains(filter) && (filter.ConstraintData == null || string.IsNullOrEmpty(((StringValue)filter.ConstraintData).Value)) )42 {43 filter.ConstraintData = new StringValue("0");44 }45 * */46 44 filter.Active = !filter.Active; 47 45 } … … 52 50 53 51 private void UpdateFilterInfo() { 54 List<IFilter> filters = filterView.ItemCollection.ToList<IFilter>();52 List<IFilter> filters = checkedFilterView.ItemCollection.ToList<IFilter>(); 55 53 56 54 int activeFilters = filters.Count(c => c.Active); 57 55 58 56 applyFilterButton.Enabled = (activeFilters > 0); 57 rBtnAnd.Enabled = (activeFilters > 0); 58 rBtnOr.Enabled = (activeFilters > 0); 59 btnReset.Enabled = (activeFilters > 0); 59 60 60 bool[] result = Content.FilterLogic.Preview(filters );61 bool[] result = Content.FilterLogic.Preview(filters, rBtnAnd.Checked); 61 62 62 int filteredCnt = result.Count(c => !c);63 int filteredCnt = result.Count(c => c); 63 64 64 65 tbFiltered.Text = filteredCnt.ToString(); … … 69 70 70 71 private void applyFilterButton_Click(object sender, EventArgs e) { 71 List<IFilter> filters = filterView.ItemCollection.ToList<IFilter>();72 Content.FilterLogic.Apply(filters );72 List<IFilter> filters = checkedFilterView.ItemCollection.ToList<IFilter>(); 73 Content.FilterLogic.Apply(filters, rBtnAnd.Checked); 73 74 } 74 75 … … 78 79 filter.ConstrainedValue = Content.FilterLogic.PreprocessingData; 79 80 filter.Active = true; 80 filterView.Content.SetItemCheckedState(filter, false);81 checkedFilterView.Content.SetItemCheckedState(filter, false); 81 82 } 82 83 UpdateFilterInfo(); … … 87 88 } 88 89 90 private void rBtnAnd_CheckedChanged(object sender, EventArgs e) 91 { 92 UpdateFilterInfo(); 93 } 94 95 private void btnReset_Click(object sender, EventArgs e) 96 { 97 Content.FilterLogic.Reset(); 98 } 99 89 100 } 90 101 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/HeuristicLab.DataPreprocessing.Views-3.3.csproj
r10778 r10785 64 64 </ItemGroup> 65 65 <ItemGroup> 66 <Compile Include="CheckedFilterCollectionView.cs"> 67 <SubType>UserControl</SubType> 68 </Compile> 69 <Compile Include="CheckedFilterCollectionView.Designer.cs"> 70 <DependentUpon>CheckedFilterCollectionView.cs</DependentUpon> 71 </Compile> 66 72 <Compile Include="CheckedTransformationCollectionView.cs"> 67 73 <SubType>UserControl</SubType> -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/Filter/ComparisonFilter.cs
r10716 r10785 128 128 } 129 129 130 result[row] = base.Check(item);130 result[row] = !base.Check(item); 131 131 } 132 132 -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/FilterLogic.cs
r10783 r10785 35 35 } 36 36 37 public bool[] Preview(IList<IFilter> filters )37 public bool[] Preview(IList<IFilter> filters, bool isAndCombination) 38 38 { 39 39 IList<IFilter> activeFilters = filters.Where(f => f.Active && f.ConstraintData != null).ToList<IFilter>(); … … 44 44 45 45 bool[] result = Enumerable.Repeat<bool>(true, preprocessingData.Rows).ToArray(); 46 foreach (IFilter filter in activeFilters) 47 { 48 bool[] filterResult = filter.Check(); 49 for (int row = 0; row < result.Length; ++row) 50 { 51 result[row] = isAndCombination ? result[row] && filterResult[row] : result[row] || filterResult[row]; 52 } 53 } 46 54 47 foreach (IFilter filter in activeFilters)48 {49 bool[] filterResult = filter.Check();50 51 for(int row = 0; row < result.Length; ++row) {52 result[row] = result[row] && filterResult[row];53 }54 }55 55 56 56 preprocessingData.SetFilter(result); … … 59 59 } 60 60 61 public void Apply(IList<IFilter> filters )61 public void Apply(IList<IFilter> filters, bool isAndCombination) 62 62 { 63 preprocessingData.SetFilter(Preview(filters ));63 preprocessingData.SetFilter(Preview(filters, isAndCombination)); 64 64 preprocessingData.PersistFilter(); 65 65 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IFilterLogic.cs
r10638 r10785 24 24 namespace HeuristicLab.DataPreprocessing { 25 25 public interface IFilterLogic { 26 bool[] Preview(IList<IFilter> filters );27 void Apply(IList<IFilter> filters );26 bool[] Preview(IList<IFilter> filters, bool isAndCombination); 27 void Apply(IList<IFilter> filters, bool isAndCombination); 28 28 IPreprocessingData PreprocessingData{get;} 29 void Reset(); 29 30 } 30 31 }
Note: See TracChangeset
for help on using the changeset viewer.