Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DatasetFeatureCorrelation/HeuristicLab.Problems.DataAnalysis.Views/3.4/CorrelationHeatMapView.cs @ 8471

Last change on this file since 8471 was 8318, checked in by sforsten, 12 years ago

#1292:

  • added cloning method and constructor to ExtendedHeatMap
  • renamed a variable in ExtendedHeatMapView
  • added backwards compatibility code in DataAnalysisProblemData
File size: 2.9 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System.ComponentModel;
23using System.Windows.Forms;
24using HeuristicLab.Core.Views;
25using HeuristicLab.MainForm;
26
27namespace HeuristicLab.Problems.DataAnalysis.Views {
28  [View("CorrelationHeatMap View")]
29  [Content(typeof(ExtendedHeatMap), true)]
30  public partial class CorrelationHeatMapView : ItemView {
31
32    public new ExtendedHeatMap Content {
33      get { return (ExtendedHeatMap)base.Content; }
34      set { base.Content = value; }
35    }
36
37    public CorrelationHeatMapView() {
38      InitializeComponent();
39    }
40
41    protected override void RegisterContentEvents() {
42      base.RegisterContentEvents();
43      Content.ProgressCalculation += new DataAnalysis.ExtendedHeatMap.ProgressCalculationHandler(Content_ProgressCalculation);
44    }
45
46    protected void Content_ProgressCalculation(object sender, ProgressChangedEventArgs e) {
47      if (!HeatMapProgressBar.Visible && e.ProgressPercentage != HeatMapProgressBar.Maximum) {
48        HeatMapProgressBar.Show();
49      } else if (e.ProgressPercentage == HeatMapProgressBar.Maximum) {
50        HeatMapProgressBar.Hide();
51      }
52      HeatMapProgressBar.Value = e.ProgressPercentage;
53    }
54
55    protected override void OnContentChanged() {
56      base.OnContentChanged();
57      ExtendedHeatMapView.Content = Content;
58      if (Content != null) {
59        CorrelationCalcComboBox.DataSource = Content.CorrelationCalculators;
60        PartitionComboBox.DataSource = Content.Partitions;
61      }
62    }
63
64    private void CorrelationCalcComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
65      CalculateHeatMap();
66    }
67
68    private void PartitionComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
69      CalculateHeatMap();
70    }
71
72    private void CalculateHeatMap() {
73      string calc = (string)CorrelationCalcComboBox.SelectedItem;
74      string partition = (string)PartitionComboBox.SelectedItem;
75      if (calc != null && partition != null) {
76        Content.Recalculate(calc, partition);
77        base.OnContentChanged();
78      }
79    }
80  }
81}
Note: See TracBrowser for help on using the repository browser.