Changeset 10877


Ignore:
Timestamp:
05/21/14 13:42:43 (5 years ago)
Author:
psteiner
Message:

Filters stored in Content
Preparation DataCompletenessChart

Location:
branches/DataPreprocessing
Files:
1 added
9 edited
2 copied

Legend:

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

    r10865 r10877  
    11namespace HeuristicLab.DataPreprocessing.Views {
    2   partial class HistogramView {
     2  partial class DataCompletenessView
     3  {
    34    /// <summary>
    45    /// Required designer variable.
     
    2425    /// </summary>
    2526    private void InitializeComponent() {
    26       this.optionsBox = new System.Windows.Forms.GroupBox();
    27       this.allInOneCheckBox = new System.Windows.Forms.CheckBox();
    28       this.optionsBox.SuspendLayout();
     27      this.dataTableView1 = new DataPreprocessing.Views.PreprocessingDataTableView();
    2928      this.SuspendLayout();
    3029      //
    31       // optionsBox
     30      // dataTableView1
    3231      //
    33       this.optionsBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    34       this.optionsBox.Controls.Add(this.allInOneCheckBox);
    35       this.optionsBox.Location = new System.Drawing.Point(4, 263);
    36       this.optionsBox.Name = "optionsBox";
    37       this.optionsBox.Size = new System.Drawing.Size(152, 134);
    38       this.optionsBox.TabIndex = 7;
    39       this.optionsBox.TabStop = false;
    40       this.optionsBox.Text = "Options";
     32      this.dataTableView1.Caption = "DataTable View";
     33      this.dataTableView1.Content = null;
     34      this.dataTableView1.Location = new System.Drawing.Point(60, 36);
     35      this.dataTableView1.Name = "dataTableView1";
     36      this.dataTableView1.ReadOnly = false;
     37      this.dataTableView1.Size = new System.Drawing.Size(359, 274);
     38      this.dataTableView1.TabIndex = 0;
    4139      //
    42       // allInOneCheckBox
     40      // DataCompletenessView
    4341      //
    44       this.allInOneCheckBox.AutoSize = true;
    45       this.allInOneCheckBox.Location = new System.Drawing.Point(6, 19);
    46       this.allInOneCheckBox.Name = "allInOneCheckBox";
    47       this.allInOneCheckBox.Size = new System.Drawing.Size(69, 17);
    48       this.allInOneCheckBox.TabIndex = 0;
    49       this.allInOneCheckBox.Text = "All in one";
    50       this.allInOneCheckBox.UseVisualStyleBackColor = true;
    51       this.allInOneCheckBox.CheckedChanged += new System.EventHandler(this.allInOneCheckBox_CheckedChanged);
    52       //
    53       // HistogramView
    54       //
    55       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    56       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    57       this.Controls.Add(this.optionsBox);
    58       this.Name = "HistogramView";
    59       this.Controls.SetChildIndex(this.optionsBox, 0);
    60       this.optionsBox.ResumeLayout(false);
    61       this.optionsBox.PerformLayout();
     42      this.Controls.Add(this.dataTableView1);
     43      this.Name = "DataCompletenessView";
     44      this.Size = new System.Drawing.Size(493, 344);
    6245      this.ResumeLayout(false);
    6346
     
    6649    #endregion
    6750
    68     private System.Windows.Forms.GroupBox optionsBox;
    69     private System.Windows.Forms.CheckBox allInOneCheckBox;
     51    private HeuristicLab.DataPreprocessing.Views.PreprocessingDataTableView dataTableView1;
    7052
    7153  }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataCompletenessView.cs

    r10865 r10877  
    33using HeuristicLab.Analysis;
    44using HeuristicLab.MainForm;
     5using HeuristicLab.Core.Views;
    56
    67namespace HeuristicLab.DataPreprocessing.Views {
    78
    89  [View("Histogram View")]
    9   [Content(typeof(HistogramContent), true)]
    10   public partial class HistogramView : PreprocessingChartView {
     10  [Content(typeof(DataCompletenessChartContent), true)]
     11  public partial class DataCompletenessView : ItemView {
    1112
    12     private const string HISTOGRAM_CHART_TITLE = "Histogram";
     13    protected DataRowVisualProperties.DataRowChartType chartType;
     14    protected string chartTitle;
    1315
    14     public HistogramView() {
    15       InitializeComponent();
    16       chartType = DataRowVisualProperties.DataRowChartType.Histogram;
    17       chartTitle = HISTOGRAM_CHART_TITLE;
    18     }
     16    private const string DEFAULT_CHART_TITLE = "DataCompletenessChart";
    1917
    20     public new HistogramContent Content {
    21       get { return (HistogramContent)base.Content; }
     18    public new DataCompletenessChartContent Content
     19    {
     20      get { return (DataCompletenessChartContent)base.Content; }
    2221      set { base.Content = value; }
    2322    }
    2423
    25     private void allInOneCheckBox_CheckedChanged(object sender, EventArgs e) {
    26       if (allInOneCheckBox.Checked)
    27         Content.AllInOneMode = true;
    28       else
    29         Content.AllInOneMode = false;
    30       GenerateChart();
     24
     25    public DataCompletenessView()
     26    {
     27      InitializeComponent();
     28      chartType = DataRowVisualProperties.DataRowChartType.Line;
     29      chartTitle = DEFAULT_CHART_TITLE;
    3130    }
    3231
     
    3635      if (Content != null)
    3736      {
    38         allInOneCheckBox.Checked = Content.AllInOneMode;
    3937      }
    4038    }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataPreprocessingView.cs

    r10776 r10877  
    5252        var histogramLogic = new ChartLogic(data);
    5353        var filterLogic = new FilterLogic(data);
     54        var dataCompletenessLogic = new ChartLogic(data);
    5455
    5556        var viewShortcuts = new ItemCollection<IViewShortcut> {
     
    6061          new ManipulationContent(manipulationLogic, searchLogic),
    6162          new LineChartContent(lineChartLogic),
    62           new HistogramContent(histogramLogic)
     63          new HistogramContent(histogramLogic)//,
     64          //new DataCompletenessChartContent(dataCompletenessLogic)
    6365        };
    6466
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/FilterView.cs

    r10849 r10877  
    2020      tbFiltered.Text = "0";
    2121      tbPercentage.Text = "0%";
    22       checkedFilterView.Content = new CheckedItemCollection<IFilter>();
    23       checkedFilterView.Content.ItemsAdded += Content_ItemsAdded;
    24       checkedFilterView.Content.ItemsRemoved += Content_ItemsRemoved;
    25       checkedFilterView.Content.CheckedItemsChanged += Content_CheckedItemsChanged;
     22    }
     23
     24    private void InitData()
     25    {
     26        checkedFilterView.Content = Content.Filters;
     27        checkedFilterView.Content.ItemsAdded += Content_ItemsAdded;
     28        checkedFilterView.Content.ItemsRemoved += Content_ItemsRemoved;
     29        checkedFilterView.Content.CheckedItemsChanged += Content_CheckedItemsChanged;
    2630    }
    2731
     
    3640      if (Content != null)
    3741      {
    38         ImportFiltersFromContent();
     42        InitData();
    3943        UpdateFilterInfo();
    4044      }
     
    4246
    4347    private void Content_CheckedItemsChanged(object sender, Collections.CollectionItemsChangedEventArgs<IFilter> e) {
    44      
    45       foreach (IFilter filter in e.Items)
     48      if (Content != null)
    4649      {
    47         filter.Active = checkedFilterView.Content.ItemChecked(filter);
     50        foreach (IFilter filter in e.Items)
     51        {
     52          filter.Active = checkedFilterView.Content.ItemChecked(filter);
     53        }
     54        UpdateFilterInfo();
    4855      }
    49       UpdateFilterInfo();
    50       ExportFiltersToContent();
    51       Refresh();
    52       ResumeRepaint(true);
    5356    }
    5457
    5558    private void UpdateFilterInfo() {
    56       List<IFilter> filters = checkedFilterView.ItemCollection.ToList<IFilter>();
     59        //List<IFilter> filters = checkedFilterView.ItemCollection.ToList<IFilter>();
     60        List<IFilter> filters = Content.Filters.ToList();
    5761
    58       int activeFilters = filters.Count(c => c.Active);
     62        int activeFilters = filters.Count(c => c.Active);
    5963
    60       applyFilterButton.Enabled = (activeFilters > 0);
    61       rBtnAnd.Enabled = (activeFilters > 0);
    62       rBtnOr.Enabled = (activeFilters > 0);
    63       btnReset.Enabled = (activeFilters > 0);
    64       Content.FilterLogic.Reset();
    65       bool[] result = Content.FilterLogic.Preview(filters, rBtnAnd.Checked);
    66      
    67       int filteredCnt = result.Count(c => c);
    68  
    69       tbFiltered.Text = filteredCnt.ToString();
    70       double percentage = result.Length == 0 ? 0.0 : filteredCnt * 100 / result.Length;
    71       tbPercentage.Text = percentage.ToString() + "%";
    72       tbTotal.Text = result.Length.ToString();
     64        applyFilterButton.Enabled = (activeFilters > 0);
     65        rBtnAnd.Enabled = (activeFilters > 0);
     66        rBtnOr.Enabled = (activeFilters > 0);
     67        btnReset.Enabled = (activeFilters > 0);
     68        Content.FilterLogic.Reset();
     69        bool[] result = Content.FilterLogic.Preview(filters, rBtnAnd.Checked);
     70
     71        int filteredCnt = result.Count(c => c);
     72
     73        tbFiltered.Text = filteredCnt.ToString();
     74        double percentage = result.Length == 0 ? 0.0 : filteredCnt * 100 / result.Length;
     75        tbPercentage.Text = percentage.ToString() + "%";
     76        tbTotal.Text = result.Length.ToString();
    7377    }
    7478
    7579    private void applyFilterButton_Click(object sender, EventArgs e) {
    76       List<IFilter> filters = checkedFilterView.ItemCollection.ToList<IFilter>();
    77       Content.FilterLogic.Apply(filters, rBtnAnd.Checked);
     80      if (Content != null)
     81      {
     82        List<IFilter> filters = Content.Filters.ToList();
     83        Content.FilterLogic.Apply(filters, rBtnAnd.Checked);
     84      }
    7885    }
    7986
    8087    //whenever a new filter is added the preprocessing data is set to the filter
    8188    private void Content_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<IFilter> e) {
    82       foreach (IFilter filter in e.Items) {
    83         filter.ConstrainedValue = Content.FilterLogic.PreprocessingData;
     89      if (Content != null)
     90      {
     91        foreach (IFilter filter in e.Items)
     92        {
     93          filter.ConstrainedValue = Content.FilterLogic.PreprocessingData;
     94        }
     95        UpdateFilterInfo();
    8496      }
    85       UpdateFilterInfo();
    86       ExportFiltersToContent();
    8797    }
    8898
    8999    private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IFilter> e) {
    90       UpdateFilterInfo();
    91       ExportFiltersToContent();
     100      if (Content != null)
     101      {
     102        UpdateFilterInfo();
     103      }
    92104    }
    93105
    94106    private void rBtnAnd_CheckedChanged(object sender, EventArgs e)
    95107    {
    96       UpdateFilterInfo();
    97       ExportFiltersToContent();
    98       Content.isAndCombination = rBtnAnd.Checked;
     108      if (Content != null)
     109      {
     110        UpdateFilterInfo();
     111        Content.isAndCombination = rBtnAnd.Checked;
     112      }
    99113    }
    100114
    101115    private void btnReset_Click(object sender, EventArgs e)
    102116    {
    103       Content.FilterLogic.Reset();
    104     }
    105 
    106     private void ImportFiltersFromContent()
    107     {
    108       checkedFilterView.ItemCollection.AddRange(Content.Filters);
    109 
    110       foreach (IFilter filter in checkedFilterView.ItemCollection) {
    111         if (filter.Active)
    112         {
    113           checkedFilterView.Content.SetItemCheckedState(filter, true);
    114         }
    115         else
    116         {
    117           checkedFilterView.Content.SetItemCheckedState(filter, false);
    118         }
    119         rBtnAnd.Checked = Content.isAndCombination;
    120         rBtnOr.Checked = !Content.isAndCombination;
     117      if (Content != null)
     118      {
     119        Content.FilterLogic.Reset();
    121120      }
    122121    }
    123122
    124     private void ExportFiltersToContent()
    125     {
    126       Content.Filters = checkedFilterView.ItemCollection.ToList<IFilter>();
    127     }
    128123  }
    129124}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/HeuristicLab.DataPreprocessing.Views-3.3.csproj

    r10785 r10877  
    8282      <DependentUpon>ComparisonFilterView.cs</DependentUpon>
    8383    </Compile>
     84    <Compile Include="DataCompletenessView.cs">
     85      <SubType>UserControl</SubType>
     86    </Compile>
     87    <Compile Include="DataCompletenessView.Designer.cs">
     88      <DependentUpon>DataCompletenessView.cs</DependentUpon>
     89    </Compile>
    8490    <Compile Include="DataGridContentView.cs">
    8591      <SubType>UserControl</SubType>
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/PreprocessingChartView.Designer.cs

    r10771 r10877  
    4646    /// </summary>
    4747    private void InitializeComponent() {
    48       this.dataTableView = new HeuristicLab.Analysis.Views.PreprocessingDataTableView();
     48      this.dataTableView = new DataPreprocessing.Views.PreprocessingDataTableView();
    4949      this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
    5050      this.checkedItemList = new HeuristicLab.DataPreprocessing.Views.PreprocessingCheckedItemListView();
     
    108108
    109109    private PreprocessingCheckedItemListView checkedItemList;
    110     private Analysis.Views.PreprocessingDataTableView dataTableView;
     110    private DataPreprocessing.Views.PreprocessingDataTableView dataTableView;
    111111    private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
    112112  }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/PreprocessingDataTableView.Designer.cs

    r10771 r10877  
    2020#endregion
    2121
    22 namespace HeuristicLab.Analysis.Views {
     22namespace HeuristicLab.DataPreprocessing.Views
     23{
    2324  partial class PreprocessingDataTableView {
    2425    /// <summary>
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/PreprocessingDataTableView.cs

    r10871 r10877  
    3030using HeuristicLab.DataPreprocessing.Implementations;
    3131using HeuristicLab.MainForm;
    32 
    33 namespace HeuristicLab.Analysis.Views
     32using HeuristicLab.Analysis;
     33using HeuristicLab.Analysis.Views;
     34
     35namespace HeuristicLab.DataPreprocessing.Views
    3436{
    3537  [View("Preprocessing DataTable View")]
     
    150152          dialog.ShowDialog(this);
    151153        }
    152       }
     154    }
    153155      else MessageBox.Show("Nothing to configure.");
    154156    }
     
    166168        if (classification == null)
    167169        {
    168           chart.Series.Add(series);
    169         }
     170        chart.Series.Add(series);
     171      }
    170172      }
    171173
     
    182184        // add dummy series for selction entry in legend
    183185        if (rows.Count() > 0 && chart.Series.FindByName("(Selection)") == null) {
    184           Series series = new Series("(Selection)");
    185           series.IsVisibleInLegend = true;
    186           series.Color = Color.Green;
    187           series.BorderWidth = 1;
    188           series.BorderDashStyle = ChartDashStyle.Solid;
    189           series.BorderColor = Color.Empty;
    190           series.ChartType = SeriesChartType.FastLine;
    191           chart.Series.Add(series);
    192         }
    193 
    194         foreach (var row in rows) {
     186        Series series = new Series("(Selection)");
     187        series.IsVisibleInLegend = true;
     188        series.Color = Color.Green;
     189        series.BorderWidth = 1;
     190        series.BorderDashStyle = ChartDashStyle.Solid;
     191        series.BorderColor = Color.Empty;
     192        series.ChartType = SeriesChartType.FastLine;
     193        chart.Series.Add(series);
     194      }
     195
     196      foreach (var row in rows) {
    195197          row.VisualProperties.IsVisibleInLegend = false;
    196198          row.VisualProperties.Color = Color.Green;
     
    201203
    202204          if (classification == null) {
    203             chart.Series.Add(series);
    204           }
    205         }
    206       }
     205          chart.Series.Add(series);
     206        }
     207      }
     208    }
    207209    }
    208210
     
    212214      if (rows.Count() > 0 && rows.ElementAt(0).VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Line)
    213215      {
    214         //remove selection entry in legend
    215         if (Content.SelectedRows.Count == 0) {
    216           Series series = chart.Series["(Selection)"];
    217           chart.Series.Remove(series);
    218         }
    219 
    220         foreach (var row in rows) {
    221           Series series = chart.Series[row.Name + "(Selected)"];
    222           chart.Series.Remove(series);
    223         }
    224       }
     216      //remove selection entry in legend
     217      if (Content.SelectedRows.Count == 0) {
     218        Series series = chart.Series["(Selection)"];
     219        chart.Series.Remove(series);
     220      }
     221
     222      foreach (var row in rows) {
     223        Series series = chart.Series[row.Name + "(Selected)"];
     224        chart.Series.Remove(series);
     225      }
     226    }
    225227    }
    226228
     
    755757      else
    756758      {
    757         series.Points.Clear();
     759      series.Points.Clear();
    758760        ConfigureSeries(series, row);
    759761        AddPointsToHistogramSeries(series, row, null);
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/HeuristicLab.DataPreprocessing-3.3.csproj

    r10803 r10877  
    7272  </ItemGroup>
    7373  <ItemGroup>
     74    <Compile Include="Implementations\DataCompletenessChartContent.cs" />
    7475    <Compile Include="Implementations\FilteredPreprocessingData.cs" />
    7576    <Compile Include="Implementations\ManipulationContent.cs" />
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/FilterContent.cs

    r10842 r10877  
    3030  public class FilterContent : Item, IViewShortcut {
    3131
    32     private IList<IFilter> filters = new List<IFilter>();
     32    private ICheckedItemCollection<IFilter> filters = new CheckedItemCollection<IFilter>();
    3333
    3434    public static new Image StaticItemImage {
     
    5050    }
    5151
    52     public IList<IFilter> Filters
     52    public ICheckedItemCollection<IFilter> Filters
    5353    {
    5454      get
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingChartContent.cs

    r10818 r10877  
    3737
    3838    private readonly IChartLogic chartLogic;
     39
     40
    3941    public PreprocessingChartContent(IChartLogic chartLogic) {
    4042      this.chartLogic = chartLogic;
Note: See TracChangeset for help on using the changeset viewer.