Changeset 14983


Ignore:
Timestamp:
05/15/17 16:30:45 (4 years ago)
Author:
pfleck
Message:

#2709 Adapted DataTable/ScatterPlotControl to the recent (re-) merge of the -View and -Control.

Location:
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/LineChartView.cs

    r14902 r14983  
    3838    protected Dictionary<string, DataRow> allInOneDataRows;
    3939    protected DataTable allInOneDataTable;
    40     protected DataTableControl allInOneDataTableControl;
     40    protected DataTableView allInOneDataTableView;
    4141
    4242    public LineChartView() {
     
    4545
    4646      allInOneDataRows = new Dictionary<string, DataRow>();
    47       allInOneDataTable= new DataTable();
     47      allInOneDataTable = new DataTable();
    4848    }
    4949
     
    7171      return Content.AllInOneMode ? 1 : base.GetNumberOfVisibleDataTables();
    7272    }
    73     protected override IEnumerable<DataTableControl> GetVisibleDataTables() {
     73    protected override IEnumerable<DataTableView> GetVisibleDataTables() {
    7474      if (Content.AllInOneMode) {
    75         if (allInOneDataTableControl == null)
    76           allInOneDataTableControl = new DataTableControl() { Content = allInOneDataTable };
    77         return new[] { allInOneDataTableControl };
     75        if (allInOneDataTableView == null)
     76          allInOneDataTableView = new DataTableView() { Content = allInOneDataTable };
     77        return new[] { allInOneDataTableView };
    7878      }
    7979      return base.GetVisibleDataTables();
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs

    r14975 r14983  
    3737  public partial class PreprocessingChartView : PreprocessingCheckedVariablesView {
    3838    protected Dictionary<string, DataTable> dataTables;
    39     protected Dictionary<string, DataTableControl> dataTableControls;
     39    protected Dictionary<string, DataTableView> dataTableViews;
    4040
    4141    public static readonly Color[] Colors = {
     
    5151      InitializeComponent();
    5252      dataTables = new Dictionary<string, DataTable>();
    53       dataTableControls = new Dictionary<string, DataTableControl>();
     53      dataTableViews = new Dictionary<string, DataTableView>();
    5454    }
    5555
     
    6666    }
    6767
    68     protected virtual IEnumerable<DataTableControl> GetVisibleDataTables() {
     68    protected virtual IEnumerable<DataTableView> GetVisibleDataTables() {
    6969      foreach (var name in Content.VariableItemList.CheckedItems) {
    70         if (!dataTableControls.ContainsKey(name.Value.Value))
    71           dataTableControls.Add(name.Value.Value, new DataTableControl() { Content = dataTables[name.Value.Value] });
    72         yield return dataTableControls[name.Value.Value];
     70        if (!dataTableViews.ContainsKey(name.Value.Value))
     71          dataTableViews.Add(name.Value.Value, new DataTableView() { Content = dataTables[name.Value.Value], ShowName = false });
     72        yield return dataTableViews[name.Value.Value];
    7373      }
    7474    }
     
    8080    protected virtual void InitData() {
    8181      dataTables.Clear();
    82       dataTableControls.Clear();
     82      dataTableViews.Clear();
    8383      foreach (var variable in Content.VariableItemList.Select(v => v.Value)) {
    8484        dataTables.Add(variable, CreateDataTable(variable));
     
    129129      base.RemoveVariable(name);
    130130      dataTables.Remove(name);
    131       dataTableControls.Remove(name);
     131      dataTableViews.Remove(name);
    132132
    133133      GenerateLayout();
     
    139139      var newDataTable = CreateDataTable(name);
    140140      dataTables.Add(name, newDataTable);
    141       dataTableControls[name].Content = newDataTable;
     141      dataTableViews[name].Content = newDataTable;
    142142      GenerateLayout();
    143143    }
     
    191191    }
    192192
    193     private void AddDataTableToTableLayout(DataTableControl dataTable, int row, int col) {
     193    private void AddDataTableToTableLayout(DataTableView dataTable, int row, int col) {
    194194      //dataView.Classification = Classification;
    195195      //dataView.IsDetailedChartViewEnabled = IsDetailedChartViewEnabled;
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs

    r14975 r14983  
    416416          foreach (var dataRow in dataTable.Rows)
    417417            dataRow.VisualProperties.IsVisibleInLegend = groupingComboBox.SelectedIndex > 0;
    418           var pcv = new DataTableControl {
     418          var pcv = new DataTableView {
    419419            Name = key.ToString(),
    420420            Content = dataTable,
    421421            Dock = DockStyle.Fill,
     422            ShowName = false
    422423            //ShowLegend = false,
    423424            //XAxisFormat = "G3"
     
    444445          }
    445446          scatterPlot.VisualProperties.Title = string.Empty;
    446           var scatterPlotControl = new ScatterPlotControl {
     447          var scatterPlotView = new ScatterPlotView {
    447448            Name = key.ToString(),
    448449            Content = scatterPlot,
    449450            Dock = DockStyle.Fill,
     451            ShowName = false
    450452            //ShowLegend = false,
    451453            //XAxisFormat = "G3"
    452454          };
    453           //scatterPlotControl.DoubleClick += ScatterPlotDoubleClick; // ToDo: not working; double click is already handled by the chart
    454           bodyCache.Add(key, scatterPlotControl);
     455          //scatterPlotView.DoubleClick += ScatterPlotDoubleClick; // ToDo: not working; double click is already handled by the chart
     456          bodyCache.Add(key, scatterPlotView);
    455457        }
    456458      }
     
    536538    //Open scatter plot in new tab with new content when double clicked
    537539    private void ScatterPlotDoubleClick(object sender, EventArgs e) {
    538       var scatterPlotControl = (ScatterPlotControl)sender;
     540      var scatterPlotView = (ScatterPlotView)sender;
    539541      var scatterContent = new SingleScatterPlotContent(Content.PreprocessingData);
    540       ScatterPlot scatterPlot = scatterPlotControl.Content;
     542      ScatterPlot scatterPlot = scatterPlotView.Content;
    541543
    542544      //Extract variable names from scatter plot and set them in content
     
    552554    //open histogram in new tab with new content when double clicked
    553555    private void HistogramDoubleClick(object sender, EventArgs e) {
    554       DataTableControl pcv = (DataTableControl)sender;
     556      DataTableView pcv = (DataTableView)sender;
    555557      HistogramContent histoContent = new HistogramContent(Content.PreprocessingData);  // create new content     
    556558                                                                                        //ToDo: histoContent.VariableItemList = Content.CreateVariableItemList();
     
    655657      int pointSize = (int)pointSizeNumericUpDown.Value;
    656658      foreach (var control in bodyCache.ToList()) {
    657         var scatterPlotControl = control.Value as ScatterPlotControl;
    658         if (scatterPlotControl != null) {
    659           foreach (var row in scatterPlotControl.Content.Rows) {
     659        var scatterPlotView = control.Value as ScatterPlotView;
     660        if (scatterPlotView != null) {
     661          foreach (var row in scatterPlotView.Content.Rows) {
    660662            row.VisualProperties.PointSize = pointSize;
    661663          }
     
    666668      float opacity = (float)pointOpacityNumericUpDown.Value;
    667669      foreach (var control in bodyCache.ToList()) {
    668         var scatterPlotControl = control.Value as ScatterPlotControl;
    669         if (scatterPlotControl != null) {
    670           foreach (var row in scatterPlotControl.Content.Rows) {
     670        var scatterPlotView = control.Value as ScatterPlotView;
     671        if (scatterPlotView != null) {
     672          foreach (var row in scatterPlotView.Content.Rows) {
    671673            var color = row.VisualProperties.Color;
    672674            if (color.IsEmpty)
     
    700702        }
    701703
    702         var scatterPlotControl = control.Value as ScatterPlotControl;
    703         if (scatterPlotControl != null) {
    704           foreach (var row in scatterPlotControl.Content.Rows) {
     704        var scatterPlotView = control.Value as ScatterPlotView;
     705        if (scatterPlotView != null) {
     706          foreach (var row in scatterPlotView.Content.Rows) {
    705707            row.VisualProperties.IsRegressionVisibleInLegend = false;
    706708            row.VisualProperties.RegressionType = regressionType;
     
    726728        }
    727729
    728         var histogramControl = control.Value as DataTableControl;
     730        var histogramControl = control.Value as DataTableView;
    729731        if (histogramControl != null) {
    730732          foreach (var row in histogramControl.Content.Rows) {
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.Designer.cs

    r14725 r14983  
    4646    private void InitializeComponent() {
    4747      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScatterPlotSingleView));
    48       this.scatterPlotControl = new HeuristicLab.Analysis.Views.ScatterPlotControl();
     48      this.scatterPlotView = new HeuristicLab.Analysis.Views.ScatterPlotView();
    4949      this.groupBox1 = new System.Windows.Forms.GroupBox();
    5050      this.useGradientCheckBox = new System.Windows.Forms.CheckBox();
     
    7676      this.SuspendLayout();
    7777      //
    78       // scatterPlotControl
    79       //
    80       this.scatterPlotControl.Caption = "View";
    81       this.scatterPlotControl.Content = null;
    82       this.scatterPlotControl.Dock = System.Windows.Forms.DockStyle.Fill;
    83       this.scatterPlotControl.Location = new System.Drawing.Point(0, 0);
    84       this.scatterPlotControl.Name = "scatterPlotControl";
    85       this.scatterPlotControl.ReadOnly = false;
    86       this.scatterPlotControl.Size = new System.Drawing.Size(618, 517);
    87       this.scatterPlotControl.TabIndex = 0;
     78      // ScatterPlotView
     79      //
     80      this.scatterPlotView.Caption = "View";
     81      this.scatterPlotView.Content = null;
     82      this.scatterPlotView.Dock = System.Windows.Forms.DockStyle.Fill;
     83      this.scatterPlotView.Location = new System.Drawing.Point(0, 0);
     84      this.scatterPlotView.Name = "scatterPlotView";
     85      this.scatterPlotView.ReadOnly = false;
     86      this.scatterPlotView.Size = new System.Drawing.Size(618, 517);
     87      this.scatterPlotView.TabIndex = 0;
    8888      //
    8989      // groupBox1
     
    269269      // splitContainer1.Panel2
    270270      //
    271       this.splitContainer1.Panel2.Controls.Add(this.scatterPlotControl);
     271      this.splitContainer1.Panel2.Controls.Add(this.scatterPlotView);
    272272      this.splitContainer1.Panel2.Controls.Add(this.gradientPanel);
    273273      this.splitContainer1.Size = new System.Drawing.Size(863, 517);
     
    345345    #endregion
    346346
    347     private HeuristicLab.Analysis.Views.ScatterPlotControl scatterPlotControl;
     347    private HeuristicLab.Analysis.Views.ScatterPlotView scatterPlotView;
    348348    private System.Windows.Forms.GroupBox groupBox1;
    349349    private System.Windows.Forms.Label label2;
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.cs

    r14917 r14983  
    118118        vp.YAxisTitle = yVariable;
    119119
    120         scatterPlotControl.Content = scatterPlot;
     120        scatterPlotView.Content = scatterPlot;
    121121
    122122        //save selected x and y variable in content
     
    128128
    129129    private void comboBoxXVariable_SelectedIndexChanged(object sender, EventArgs e) {
    130       var oldPlot = scatterPlotControl.Content;
     130      var oldPlot = scatterPlotView.Content;
    131131      UpdateScatterPlot();
    132       var newPlot = scatterPlotControl.Content;
     132      var newPlot = scatterPlotView.Content;
    133133
    134134      if (oldPlot == null || newPlot == null) return;
     
    146146
    147147    private void comboBoxYVariable_SelectedIndexChanged(object sender, EventArgs e) {
    148       var oldPlot = scatterPlotControl.Content;
     148      var oldPlot = scatterPlotView.Content;
    149149      UpdateScatterPlot();
    150       var newPlot = scatterPlotControl.Content;
     150      var newPlot = scatterPlotView.Content;
    151151
    152152      if (oldPlot == null || newPlot == null) return;
     
    187187      int order = (int)polynomialRegressionOrderNumericUpDown.Value;
    188188
    189       foreach (var row in scatterPlotControl.Content.Rows) {
     189      foreach (var row in scatterPlotView.Content.Rows) {
    190190        row.VisualProperties.IsRegressionVisibleInLegend = false;
    191191        row.VisualProperties.RegressionType = regressionType;
     
    199199
    200200      // remove rows and re-add them later to avoid firing visual property changd events
    201       var rows = scatterPlotControl.Content.Rows.ToDictionary(r => r.Name, r => r);
    202       scatterPlotControl.Content.Rows.Clear();
     201      var rows = scatterPlotView.Content.Rows.ToDictionary(r => r.Name, r => r);
     202      scatterPlotView.Content.Rows.Clear();
    203203
    204204      if (useGradientCheckBox.Checked) {
     
    224224        }
    225225      }
    226       scatterPlotControl.Content.Rows.AddRange(rows.Values);
     226      scatterPlotView.Content.Rows.AddRange(rows.Values);
    227227    }
    228228
Note: See TracChangeset for help on using the changeset viewer.