Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10696


Ignore:
Timestamp:
04/02/14 11:44:22 (11 years ago)
Author:
mleitner
Message:

Add logic for apply filter button

Location:
branches/DataPreprocessing
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FilterView.Designer.cs

    r10637 r10696  
    130130      //
    131131      this.applyFilterButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     132      this.applyFilterButton.Enabled = false;
    132133      this.applyFilterButton.Location = new System.Drawing.Point(554, 474);
    133134      this.applyFilterButton.Name = "applyFilterButton";
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FilterView.cs

    r10693 r10696  
    5757    {
    5858      List<IFilter> filters = filterView.ItemCollection.ToList<IFilter>();
     59
     60      int activeFilters = filters.Count(c => c.Active);
     61
     62      applyFilterButton.Enabled = (activeFilters > 0);
     63
    5964      bool[] result = Content.FilterLogic.Preview(filters);
    60       int filteredCnt = 0;
    61       for (int i = 0; i < result.Length; i++)
    62       {
    63         if (result[i] == true)
    64           filteredCnt++;
    65       }
     65     
     66      int filteredCnt = result.Count(c => c);
     67 
    6668      tbFiltered.Text = filteredCnt.ToString();
    6769      double percentage = filteredCnt * 100 / result.Length;
     
    7274    private void applyFilterButton_Click(object sender, EventArgs e)
    7375    {
    74       //todo: inform Logic for apply Filter
     76      List<IFilter> filters = filterView.ItemCollection.ToList<IFilter>();
     77      Content.FilterLogic.Apply(filters);
    7578    }
    7679
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/HeuristicLab.DataPreprocessing.Views-3.3.csproj

    r10676 r10696  
    227227    </ProjectReference>
    228228  </ItemGroup>
     229  <ItemGroup>
     230    <EmbeddedResource Include="FilterView.resx">
     231      <DependentUpon>FilterView.cs</DependentUpon>
     232    </EmbeddedResource>
     233  </ItemGroup>
    229234  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    230235  <PropertyGroup>
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/FilterLogic.cs

    r10692 r10696  
    3535    public bool[] Preview(IList<IFilter> filters)
    3636    {
     37       IList<IFilter> activeFilters = filters.Where(f => f.Active && f.ConstraintData != null).ToList<IFilter>();
     38
     39       if (activeFilters.Count == 0) {
     40        return new bool[preprocessingData.Rows];
     41       }
     42
    3743       bool[] result = Enumerable.Repeat<bool>(true, preprocessingData.Rows).ToArray();
    3844
    3945       foreach (IFilter filter in filters)
    4046       {
    41             if (filter.ConstraintData == null || !filter.Active) {
    42               continue;
    43             }
    44 
    4547            bool[] filterResult = filter.Check();
    4648
Note: See TracChangeset for help on using the changeset viewer.