Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14075


Ignore:
Timestamp:
07/14/16 22:38:23 (8 years ago)
Author:
mkommend
Message:

#2559: Merged r13502, r13504, r13507, r13508, r13512, r13514, r13517 into stable.

Location:
stable
Files:
4 deleted
43 edited
5 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.DataPreprocessing.Views

  • stable/HeuristicLab.DataPreprocessing.Views/3.4/CheckedFilterCollectionView.Designer.cs

    r10785 r14075  
    1 using HeuristicLab.Core.Views;
    2 using HeuristicLab.DataPreprocessing.Filter;
    3 namespace HeuristicLab.DataPreprocessing.Views
    4 {
    5   partial class CheckedFilterCollectionView
    6   {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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
     22namespace HeuristicLab.DataPreprocessing.Views {
     23  partial class CheckedFilterCollectionView {
    724    /// <summary>
    825    /// Required designer variable.
     
    1431    /// </summary>
    1532    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    16     protected override void Dispose(bool disposing)
    17     {
    18       if (disposing && (components != null))
    19       {
     33    protected override void Dispose(bool disposing) {
     34      if (disposing && (components != null)) {
    2035        components.Dispose();
    2136      }
     
    2944    /// the contents of this method with the code editor.
    3045    /// </summary>
    31     private void InitializeComponent()
    32     {
     46    private void InitializeComponent() {
    3347      components = new System.ComponentModel.Container();
    3448      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/CheckedFilterCollectionView.cs

    r11114 r14075  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.ComponentModel;
    4 using System.Drawing;
    5 using System.Linq;
    6 using System.Text;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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;
    723using System.Windows.Forms;
     24using HeuristicLab.Core;
    825using HeuristicLab.Core.Views;
    9 using HeuristicLab.Collections;
     26using HeuristicLab.DataPreprocessing.Filter;
    1027using HeuristicLab.MainForm;
    11 using HeuristicLab.Core;
    12 using HeuristicLab.DataPreprocessing.Filter;
    1328
    14 namespace HeuristicLab.DataPreprocessing.Views
    15 {
     29namespace HeuristicLab.DataPreprocessing.Views {
    1630  [View("CheckedFilterCollection View")]
    1731  [Content(typeof(ICheckedItemCollection<>), false)]
    1832  [Content(typeof(CheckedItemCollection<>), false)]
    19   public partial class CheckedFilterCollectionView : CheckedItemCollectionView<IFilter>
    20   {
    21     public CheckedFilterCollectionView()
    22     {
     33  public partial class CheckedFilterCollectionView : CheckedItemCollectionView<IFilter> {
     34    public CheckedFilterCollectionView() {
    2335      InitializeComponent();
    2436    }
    2537
    26     protected override void addButton_Click(object sender, EventArgs e)
    27     {
     38    protected override void addButton_Click(object sender, EventArgs e) {
    2839      IFilter filter = new ComparisonFilter();
    2940      Content.Add(filter);
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/DataCompletenessView.Designer.cs

    r10979 r14075  
    1 namespace HeuristicLab.DataPreprocessing.Views {
    2   partial class DataCompletenessView
    3   {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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
     22namespace HeuristicLab.DataPreprocessing.Views {
     23  partial class DataCompletenessView {
    424    /// <summary>
    525    /// Required designer variable.
     
    3454      // chart
    3555      //
    36       this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    37             | System.Windows.Forms.AnchorStyles.Left) 
     56      this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     57            | System.Windows.Forms.AnchorStyles.Left)
    3858            | System.Windows.Forms.AnchorStyles.Right)));
    3959      chartArea1.Name = "ChartArea1";
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/DataCompletenessView.cs

    r11002 r14075  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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;
     23using System.Collections.Generic;
     24using System.Drawing;
    225using System.Windows.Forms;
    3 using HeuristicLab.Analysis;
     26using System.Windows.Forms.DataVisualization.Charting;
     27using HeuristicLab.Core.Views;
    428using HeuristicLab.MainForm;
    5 using HeuristicLab.Core.Views;
    6 using System.Collections.Generic;
    7 using HeuristicLab.DataPreprocessing.Implementations;
    8 using System.Drawing;
    9 using System.Windows.Forms.DataVisualization.Charting;
    1029
    1130namespace HeuristicLab.DataPreprocessing.Views {
     
    1332  [View("Histogram View")]
    1433  [Content(typeof(DataCompletenessChartContent), true)]
    15   public partial class DataCompletenessView : ItemView
    16   {
     34  public partial class DataCompletenessView : ItemView {
    1735
    1836    //list of columns, bool indicates wether the cell is a missing value or not
     
    2240    private static Color colorMissingVal = Color.Orange;
    2341
    24     public new DataCompletenessChartContent Content
    25     {
     42    public new DataCompletenessChartContent Content {
    2643      get { return (DataCompletenessChartContent)base.Content; }
    2744      set { base.Content = value; }
     
    2946
    3047
    31     public DataCompletenessView()
    32     {
     48    public DataCompletenessView() {
    3349      InitializeComponent();
    3450    }
    3551
    36     protected override void OnContentChanged()
    37     {
     52    protected override void OnContentChanged() {
    3853      base.OnContentChanged();
    39       if (Content != null)
    40       {
     54      if (Content != null) {
    4155        InitData();
    4256      }
    4357    }
    4458
    45     private void InitData()
    46     {
     59    private void InitData() {
    4760      IDictionary<int, IList<int>> missingValueIndices = Content.SearchLogic.GetMissingValueIndices();
    48       for (int i = 0; i < Content.SearchLogic.Columns; i++)
    49       {
     61      for (int i = 0; i < Content.SearchLogic.Columns; i++) {
    5062        //append column
    5163        List<bool> column = new List<bool>();
     
    6072    }
    6173
    62     private void PrepareChart()
    63     {
     74    private void PrepareChart() {
    6475      chart.Titles.Add("DataCompletenessChart");
    6576      chart.EnableDoubleClickResetsZoom = true;
     
    7485      //custom x axis label
    7586      double from = 0.5;
    76       foreach (String columnName in Content.SearchLogic.VariableNames)
    77       {
     87      foreach (String columnName in Content.SearchLogic.VariableNames) {
    7888        double to = from + 1;
    7989        chart.ChartAreas[0].AxisX.CustomLabels.Add(from, to, columnName);
     
    8494    }
    8595
    86     private void CreateSeries(List<List<int>> yValuesPerColumn)
    87     {
     96    private void CreateSeries(List<List<int>> yValuesPerColumn) {
    8897      //prepare series
    8998      int seriesCount = DetermineSeriesCount(yValuesPerColumn);
    90       for (int i = 0; i < seriesCount; i++)
    91       {
     99      for (int i = 0; i < seriesCount; i++) {
    92100        chart.Series.Add(CreateSeriesName(i));
    93101        Series series = chart.Series[CreateSeriesName(i)];
     
    95103        series.IsVisibleInLegend = false;
    96104        series["PointWidth"] = "1.0";
    97         if (i % 2 == 0)
    98         {
     105        if (i % 2 == 0) {
    99106          if (i == 0) //show legend for non missing values only once
    100107            series.IsVisibleInLegend = true;
    101108          series.Color = colorNonMissingVal;
    102         }
    103         else
    104         {
     109        } else {
    105110          if (i == 1) //show legend for missing values only once
    106111            series.IsVisibleInLegend = true;
     
    109114      }
    110115      //fill series
    111       for (int i = 0; i < yValuesPerColumn.Count; i++)
    112       {
     116      for (int i = 0; i < yValuesPerColumn.Count; i++) {
    113117        List<int> column = yValuesPerColumn[i];
    114118        for (int j = 0; j < seriesCount; j++) {
     
    122126    }
    123127
    124     private String CreateSeriesName(int index)
    125     {
     128    private String CreateSeriesName(int index) {
    126129      if (index == 0)
    127130        return "non-missing value";
     
    132135
    133136    #region data_preparation_for_chartseries
    134     private int DetermineSeriesCount(List<List<int>> yValuesPerColumn)
    135     {
     137    private int DetermineSeriesCount(List<List<int>> yValuesPerColumn) {
    136138      int highest = 0;
    137139      foreach (List<int> values in yValuesPerColumn) {
     
    141143    }
    142144
    143     private List<List<int>> ProcessMatrixForCharting(List<List<bool>> matrix, IDictionary<int, IList<int>> missingValueIndices)
    144     {
     145    private List<List<int>> ProcessMatrixForCharting(List<List<bool>> matrix, IDictionary<int, IList<int>> missingValueIndices) {
    145146      List<List<int>> columnsYValues = new List<List<int>>();
    146       for (int i=0; i < matrix.Count; i++) //column
     147      for (int i = 0; i < matrix.Count; i++) //column
    147148      {
    148149        List<int> yValues = new List<int>();
     
    150151        bool missingState = false;
    151152        int valueCount = 0;
    152         for (int j = 0; j < column.Count; j++ ) {
    153           if (missingState == missingValueIndices[i].Contains(j))
    154           {
     153        for (int j = 0; j < column.Count; j++) {
     154          if (missingState == missingValueIndices[i].Contains(j)) {
    155155            valueCount++;
    156           }
    157           else
    158           {
     156          } else {
    159157            yValues.Add(valueCount);
    160158            valueCount = 1;
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs

    r13289 r14075  
    3131namespace HeuristicLab.DataPreprocessing.Views {
    3232  [View("Data Grid Content View")]
    33   [Content(typeof(IDataGridContent), true)]
     33  [Content(typeof(DataGridContent), true)]
    3434  public partial class DataGridContentView : StringConvertibleMatrixView {
    3535
     
    4242    private Tuple<int, int> currentCell;
    4343
    44     public new IDataGridContent Content {
    45       get { return (IDataGridContent)base.Content; }
     44    public new DataGridContent Content {
     45      get { return (DataGridContent)base.Content; }
    4646      set { base.Content = value; }
    4747    }
     
    145145    protected override void PasteValuesToDataGridView() {
    146146      string[,] values = SplitClipboardString(Clipboard.GetText());
     147      if (values.Length == 0) return;
    147148      int rowIndex = 0;
    148149      int columnIndex = 0;
     
    151152        columnIndex = dataGridView.CurrentCell.ColumnIndex;
    152153      }
    153       if (Content.Rows < values.GetLength(1) + rowIndex) Content.Rows = values.GetLength(1) + rowIndex;
    154       if (Content.Columns < values.GetLength(0) + columnIndex) Content.Columns = values.GetLength(0) + columnIndex;
     154
     155      bool containsHeader = false;
     156      var firstRow = Enumerable.Range(0, values.GetLength(0)).Select(col => values[col, 0]).ToList();
     157      if ((Content.Selection.Values.Sum(s => s.Count) == Content.Rows * Content.Columns)
     158          || (rowIndex == 0 && columnIndex == 0 && Content.Rows <= values.GetLength(1) && Content.Columns <= values.GetLength(0))) {
     159        // All is selected -or- top left selected and everything will be replaced
     160        double temp;
     161        containsHeader = !firstRow.All(string.IsNullOrEmpty) && firstRow.Any(r => !double.TryParse(r, out temp));
     162        if (containsHeader)
     163          rowIndex = columnIndex = 0;
     164      }
     165
     166      int newRows = values.GetLength(1) + rowIndex - (containsHeader ? 1 : 0);
     167      int newColumns = values.GetLength(0) + columnIndex;
     168      if (Content.Rows < newRows) Content.Rows = newRows;
     169      if (Content.Columns < newColumns) Content.Columns = newColumns;
    155170
    156171      ReplaceTransaction(() => {
    157172        Content.PreProcessingData.InTransaction(() => {
    158           for (int row = 0; row < values.GetLength(1); row++) {
     173          for (int row = containsHeader ? 1 : 0; row < values.GetLength(1); row++) {
    159174            for (int col = 0; col < values.GetLength(0); col++) {
    160               Content.SetValue(values[col, row], row + rowIndex, col + columnIndex);
     175              Content.SetValue(values[col, row], row + rowIndex - (containsHeader ? 1 : 0), col + columnIndex);
    161176            }
     177          }
     178          if (containsHeader) {
     179            for (int i = 0; i < firstRow.Count; i++)
     180              if (string.IsNullOrWhiteSpace(firstRow[i]))
     181                firstRow[i] = string.Format("<{0}>", i);
     182            Content.PreProcessingData.RenameColumns(firstRow);
    162183          }
    163184        });
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingMenuItem.cs

    r13502 r14075  
    2121
    2222using System.Collections.Generic;
     23using System.Windows.Forms;
    2324using HeuristicLab.MainForm;
    2425using HeuristicLab.Optimizer;
     26using HeuristicLab.Problems.DataAnalysis;
    2527
    2628namespace HeuristicLab.DataPreprocessing.Views {
     
    3133      }
    3234      public override IEnumerable<string> Structure {
    33         get { return new string[] { "&Edit" }; }
     35        get { return new string[] { "&Edit", "&Data Analysis" }; }
    3436      }
    3537      public override int Position {
    36         get { return 6000; }
     38        get { return 5500; }
    3739      }
    3840      public override string ToolTipText {
     
    4143
    4244      public override void Execute() {
    43         MainFormManager.MainForm.ShowContent(new PreprocessingContext());
     45        MainFormManager.MainForm.ShowContent(new PreprocessingContext(new RegressionProblemData()));
     46      }
     47
     48      public override Keys ShortCutKeys {
     49        get { return Keys.Control | Keys.D; }
    4450      }
    4551    }
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs

    r12718 r14075  
    2121
    2222using System;
     23using System.IO;
     24using System.Threading.Tasks;
    2325using System.Windows.Forms;
    2426using HeuristicLab.Common;
     
    2628using HeuristicLab.Core.Views;
    2729using HeuristicLab.MainForm;
     30using HeuristicLab.Problems.DataAnalysis;
     31using HeuristicLab.Problems.Instances.DataAnalysis;
     32using HeuristicLab.Problems.Instances.DataAnalysis.Views;
    2833
    2934namespace HeuristicLab.DataPreprocessing.Views {
    3035  [View("DataPreprocessing View")]
    3136  [Content(typeof(PreprocessingContext), true)]
    32   [Content(typeof(IPreprocessingContext), false)]
    33   public partial class DataPreprocessingView : ItemView {
     37  public partial class DataPreprocessingView : NamedItemView {
    3438
    3539    public DataPreprocessingView() {
     
    3741    }
    3842
    39     public new IPreprocessingContext Content {
    40       get { return (IPreprocessingContext)base.Content; }
     43    public new PreprocessingContext Content {
     44      get { return (PreprocessingContext)base.Content; }
    4145      set { base.Content = value; }
    4246    }
     
    6064          new CorrelationMatrixContent(Content),
    6165          new DataCompletenessChartContent(searchLogic),
    62          
     66
    6367          new FilterContent(filterLogic),
    6468          new ManipulationContent(manipulationLogic, searchLogic, filterLogic),
     
    6771
    6872        viewShortcutListView.Content = viewShortcuts.AsReadOnly();
    69 
    7073        viewShortcutListView.ItemsListView.Items[0].Selected = true;
    7174        viewShortcutListView.Select();
    7275
     76        applyTypeContextMenuStrip.Items.Clear();
     77        exportTypeContextMenuStrip.Items.Clear();
     78        foreach (var exportOption in Content.GetSourceExportOptions()) {
     79          var applyMenuItem = new ToolStripMenuItem(exportOption.Key) { Tag = exportOption.Value };
     80          applyMenuItem.Click += applyToolStripMenuItem_Click;
     81          applyTypeContextMenuStrip.Items.Add(applyMenuItem);
     82
     83          var exportMenuItem = new ToolStripMenuItem(exportOption.Key) { Tag = exportOption.Value };
     84          exportMenuItem.Click += exportToolStripMenuItem_Click;
     85          exportTypeContextMenuStrip.Items.Add(exportMenuItem);
     86        }
     87        var exportCsvMenuItem = new ToolStripMenuItem(".csv");
     88        exportCsvMenuItem.Click += exportCsvMenuItem_Click;
     89        exportTypeContextMenuStrip.Items.Add(exportCsvMenuItem);
    7390      } else {
    7491        viewShortcutListView.Content = null;
    7592      }
    7693    }
    77 
    7894    protected override void RegisterContentEvents() {
    7995      base.RegisterContentEvents();
     96      Content.Reset += Content_Reset;
    8097      Content.Data.FilterChanged += Data_FilterChanged;
    8198    }
     
    83100    protected override void DeregisterContentEvents() {
    84101      base.DeregisterContentEvents();
     102      Content.Reset -= Content_Reset;
    85103      Content.Data.FilterChanged -= Data_FilterChanged;
     104    }
     105
     106    void Content_Reset(object sender, EventArgs e) {
     107      OnContentChanged(); // Reset by setting new content
    86108    }
    87109
     
    94116      viewShortcutListView.Enabled = Content != null;
    95117      applyInNewTabButton.Enabled = Content != null;
    96       exportProblemButton.Enabled = Content != null && Content.Problem != null;
     118      exportProblemButton.Enabled = Content != null && Content.CanExport;
    97119      undoButton.Enabled = Content != null;
    98120    }
    99121
     122    #region New
     123    private void newButton_Click(object sender, EventArgs e) {
     124      newProblemDataTypeContextMenuStrip.Show(Cursor.Position);
     125    }
     126    private void newRegressionToolStripMenuItem_Click(object sender, EventArgs e) {
     127      Content.Import(new RegressionProblemData());
     128    }
     129    private void newClassificationToolStripMenuItem_Click(object sender, EventArgs e) {
     130      Content.Import(new ClassificationProblemData());
     131    }
     132    private void newTimeSeriesToolStripMenuItem_Click(object sender, EventArgs e) {
     133      Content.Import(new TimeSeriesPrognosisProblemData());
     134    }
     135    #endregion
     136
     137    #region Import
     138    private void importButton_Click(object sender, EventArgs e) {
     139      importProblemDataTypeContextMenuStrip.Show(Cursor.Position);
     140    }
     141    private void importRegressionToolStripMenuItem_Click(object sender, EventArgs e) {
     142      Import(new RegressionCSVInstanceProvider(), new RegressionImportTypeDialog(),
     143        (dialog => ((RegressionImportTypeDialog)dialog).ImportType));
     144    }
     145    private void importClassificationToolStripMenuItem_Click(object sender, EventArgs e) {
     146      Import(new ClassificationCSVInstanceProvider(), new ClassificationImportTypeDialog(),
     147        (dialog => ((ClassificationImportTypeDialog)dialog).ImportType));
     148    }
     149    private void importTimeSeriesToolStripMenuItem_Click(object sender, EventArgs e) {
     150      Import(new TimeSeriesPrognosisCSVInstanceProvider(), new TimeSeriesPrognosisImportTypeDialog(),
     151        (dialog => ((TimeSeriesPrognosisImportTypeDialog)dialog).ImportType));
     152    }
     153    private void Import<TProblemData, TImportType>(DataAnalysisInstanceProvider<TProblemData, TImportType> instanceProvider, DataAnalysisImportTypeDialog importTypeDialog,
     154      Func<DataAnalysisImportTypeDialog, TImportType> getImportType)
     155      where TProblemData : class, IDataAnalysisProblemData
     156      where TImportType : DataAnalysisImportType {
     157      if (importTypeDialog.ShowDialog() == DialogResult.OK) {
     158        Task.Run(() => {
     159          TProblemData instance;
     160          var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
     161          // lock active view and show progress bar
     162          var activeView = (IContentView)MainFormManager.MainForm.ActiveView;
     163
     164          try {
     165            var progress = mainForm.AddOperationProgressToContent(activeView.Content, "Loading problem instance.");
     166
     167            instanceProvider.ProgressChanged += (o, args) => { progress.ProgressValue = args.ProgressPercentage / 100.0; };
     168
     169            instance = instanceProvider.ImportData(importTypeDialog.Path, getImportType(importTypeDialog), importTypeDialog.CSVFormat);
     170          } catch (IOException ex) {
     171            MessageBox.Show(string.Format("There was an error parsing the file: {0}", Environment.NewLine + ex.Message), "Error while parsing", MessageBoxButtons.OK, MessageBoxIcon.Error);
     172            mainForm.RemoveOperationProgressFromContent(activeView.Content);
     173            return;
     174          }
     175          try {
     176            Content.Import(instance);
     177          } catch (IOException ex) {
     178            MessageBox.Show(string.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(importTypeDialog.Path), Environment.NewLine + ex.Message), "Cannot load instance");
     179          } finally {
     180            mainForm.RemoveOperationProgressFromContent(activeView.Content);
     181          }
     182        });
     183      }
     184    }
     185    #endregion
     186
     187    #region Apply
     188    private void applyInNewTabButton_Click(object sender, EventArgs e) {
     189      applyTypeContextMenuStrip.Show(Cursor.Position);
     190    }
     191    private void applyToolStripMenuItem_Click(object sender, EventArgs e) {
     192      var menuItem = (ToolStripMenuItem)sender;
     193      var itemCreator = (Func<IItem>)menuItem.Tag;
     194      MainFormManager.MainForm.ShowContent(itemCreator());
     195    }
     196    #endregion
     197
     198    #region Export
    100199    private void exportProblemButton_Click(object sender, EventArgs e) {
    101       var problem = Content.ExportProblem();
    102 
     200      exportTypeContextMenuStrip.Show(Cursor.Position);
     201    }
     202    private void exportToolStripMenuItem_Click(object sender, EventArgs e) {
     203      var menuItem = (ToolStripMenuItem)sender;
     204      var itemCreator = (Func<IItem>)menuItem.Tag;
    103205      var saveFileDialog = new SaveFileDialog {
    104206        Title = "Save Item",
     
    108210      };
    109211
    110       var content = problem as IStorableContent;
    111212      if (saveFileDialog.ShowDialog() == DialogResult.OK) {
    112         bool compressed = saveFileDialog.FilterIndex != 1;
    113         ContentManager.Save(content, saveFileDialog.FileName, compressed);
    114       }
    115     }
    116 
    117     private void applyInNewTabButton_Click(object sender, EventArgs e) {
    118       var item = Content.Export();
    119 
    120       MainFormManager.MainForm.ShowContent(item);
    121     }
    122 
     213        Task.Run(() => {
     214          bool compressed = saveFileDialog.FilterIndex != 1;
     215          var storable = itemCreator() as IStorableContent;
     216          if (storable != null) {
     217            var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
     218            var activeView = (IContentView)MainFormManager.MainForm.ActiveView;
     219            try {
     220              mainForm.AddOperationProgressToContent(activeView.Content, "Exporting data.");
     221              ContentManager.Save(storable, saveFileDialog.FileName, compressed);
     222            } finally {
     223              mainForm.RemoveOperationProgressFromContent(activeView.Content);
     224            }
     225          }
     226        });
     227      }
     228    }
     229    private void exportCsvMenuItem_Click(object sender, EventArgs e) {
     230      var saveFileDialog = new SaveFileDialog {
     231        Title = "Save Data",
     232        DefaultExt = "csv",
     233        Filter = "CSV files|*.csv|All files|*.*",
     234        FilterIndex = 1
     235      };
     236
     237      if (saveFileDialog.ShowDialog() == DialogResult.OK) {
     238        Task.Run(() => {
     239          var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
     240          var activeView = (IContentView)MainFormManager.MainForm.ActiveView;
     241          try {
     242            var problemData = Content.CreateNewProblemData();
     243            mainForm.AddOperationProgressToContent(activeView.Content, "Exporting data.");
     244            if (problemData is TimeSeriesPrognosisProblemData)
     245              Export(new TimeSeriesPrognosisCSVInstanceProvider(), problemData, saveFileDialog.FileName);
     246            else if (problemData is RegressionProblemData)
     247              Export(new RegressionCSVInstanceProvider(), problemData, saveFileDialog.FileName);
     248            else if (problemData is ClassificationProblemData)
     249              Export(new ClassificationCSVInstanceProvider(), problemData, saveFileDialog.FileName);
     250          } finally {
     251            mainForm.RemoveOperationProgressFromContent(activeView.Content);
     252          }
     253        });
     254      }
     255    }
     256    private void Export<TProblemData, TImportType>(DataAnalysisInstanceProvider<TProblemData, TImportType> instanceProvider,
     257      IDataAnalysisProblemData problemData, string path)
     258      where TProblemData : class, IDataAnalysisProblemData where TImportType : DataAnalysisImportType {
     259      instanceProvider.ExportData((TProblemData)problemData, path);
     260    }
     261    #endregion
     262
     263    #region Undo / Redo
    123264    private void undoButton_Click(object sender, EventArgs e) {
    124265      Content.Data.Undo();
    125266    }
     267    #endregion
    126268  }
    127269}
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.designer.cs

    r12009 r14075  
    5050      this.applyInNewTabButton = new System.Windows.Forms.Button();
    5151      this.exportProblemButton = new System.Windows.Forms.Button();
    52       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    5352      this.lblFilterActive = new System.Windows.Forms.Label();
     53      this.redoButton = new System.Windows.Forms.Button();
     54      this.newButton = new System.Windows.Forms.Button();
     55      this.importButton = new System.Windows.Forms.Button();
     56      this.newProblemDataTypeContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
     57      this.newRegressionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     58      this.newClassificationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     59      this.newTimeSeriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     60      this.importProblemDataTypeContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
     61      this.importRegressionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     62      this.importClassificationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     63      this.importTimeSeriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    5464      this.viewShortcutListView = new HeuristicLab.DataPreprocessing.Views.ViewShortcutListView();
     65      this.applyTypeContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
     66      this.exportTypeContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
     67      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     68      this.newProblemDataTypeContextMenuStrip.SuspendLayout();
     69      this.importProblemDataTypeContextMenuStrip.SuspendLayout();
    5570      this.SuspendLayout();
    5671      //
     72      // nameTextBox
     73      //
     74      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     75      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
     76      this.nameTextBox.Size = new System.Drawing.Size(755, 20);
     77      //
     78      // infoLabel
     79      //
     80      this.infoLabel.Location = new System.Drawing.Point(819, 3);
     81      //
    5782      // undoButton
    5883      //
    5984      this.undoButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Undo;
    60       this.undoButton.Location = new System.Drawing.Point(64, 3);
     85      this.undoButton.Location = new System.Drawing.Point(131, 26);
    6186      this.undoButton.Name = "undoButton";
    6287      this.undoButton.Size = new System.Drawing.Size(24, 24);
    63       this.undoButton.TabIndex = 3;
     88      this.undoButton.TabIndex = 5;
    6489      this.toolTip.SetToolTip(this.undoButton, "Undo");
    6590      this.undoButton.UseVisualStyleBackColor = true;
     
    6994      //
    7095      this.applyInNewTabButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play;
    71       this.applyInNewTabButton.Location = new System.Drawing.Point(34, 3);
     96      this.applyInNewTabButton.Location = new System.Drawing.Point(69, 26);
    7297      this.applyInNewTabButton.Name = "applyInNewTabButton";
    7398      this.applyInNewTabButton.Size = new System.Drawing.Size(24, 24);
    7499      this.applyInNewTabButton.TabIndex = 2;
    75       this.toolTip.SetToolTip(this.applyInNewTabButton, "Apply in new tab");
     100      this.toolTip.SetToolTip(this.applyInNewTabButton, "Apply in new Tab");
    76101      this.applyInNewTabButton.UseVisualStyleBackColor = true;
    77102      this.applyInNewTabButton.Click += new System.EventHandler(this.applyInNewTabButton_Click);
     
    79104      // exportProblemButton
    80105      //
    81       this.exportProblemButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Save;
    82       this.exportProblemButton.Location = new System.Drawing.Point(4, 3);
     106      this.exportProblemButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.SaveAs;
     107      this.exportProblemButton.Location = new System.Drawing.Point(99, 26);
    83108      this.exportProblemButton.Name = "exportProblemButton";
    84109      this.exportProblemButton.Size = new System.Drawing.Size(24, 24);
    85       this.exportProblemButton.TabIndex = 1;
    86       this.toolTip.SetToolTip(this.exportProblemButton, "Export problem");
     110      this.exportProblemButton.TabIndex = 3;
     111      this.toolTip.SetToolTip(this.exportProblemButton, "Export to File");
    87112      this.exportProblemButton.UseVisualStyleBackColor = true;
    88113      this.exportProblemButton.Click += new System.EventHandler(this.exportProblemButton_Click);
     
    91116      //
    92117      this.lblFilterActive.AutoSize = true;
    93       this.lblFilterActive.Location = new System.Drawing.Point(220, 12);
     118      this.lblFilterActive.Location = new System.Drawing.Point(203, 31);
    94119      this.lblFilterActive.Name = "lblFilterActive";
    95120      this.lblFilterActive.Size = new System.Drawing.Size(277, 13);
     
    98123      this.lblFilterActive.Visible = false;
    99124      //
     125      // redoButton
     126      //
     127      this.redoButton.Enabled = false;
     128      this.redoButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Redo;
     129      this.redoButton.Location = new System.Drawing.Point(161, 26);
     130      this.redoButton.Name = "redoButton";
     131      this.redoButton.Size = new System.Drawing.Size(24, 24);
     132      this.redoButton.TabIndex = 6;
     133      this.toolTip.SetToolTip(this.redoButton, "Redo (not implemented yet)");
     134      this.redoButton.UseVisualStyleBackColor = true;
     135      //
     136      // newButton
     137      //
     138      this.newButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.NewDocument;
     139      this.newButton.Location = new System.Drawing.Point(6, 26);
     140      this.newButton.Name = "newButton";
     141      this.newButton.Size = new System.Drawing.Size(24, 24);
     142      this.newButton.TabIndex = 3;
     143      this.newButton.UseVisualStyleBackColor = true;
     144      this.newButton.Click += new System.EventHandler(this.newButton_Click);
     145      //
     146      // importButton
     147      //
     148      this.importButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Open;
     149      this.importButton.Location = new System.Drawing.Point(36, 26);
     150      this.importButton.Name = "importButton";
     151      this.importButton.Size = new System.Drawing.Size(24, 24);
     152      this.importButton.TabIndex = 3;
     153      this.importButton.UseVisualStyleBackColor = true;
     154      this.importButton.Click += new System.EventHandler(this.importButton_Click);
     155      //
     156      // newProblemDataTypeContextMenuStrip
     157      //
     158      this.newProblemDataTypeContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     159            this.newRegressionToolStripMenuItem,
     160            this.newClassificationToolStripMenuItem,
     161            this.newTimeSeriesToolStripMenuItem});
     162      this.newProblemDataTypeContextMenuStrip.Name = "newProblemDataTypeContextMenuStrip";
     163      this.newProblemDataTypeContextMenuStrip.Size = new System.Drawing.Size(190, 70);
     164      //
     165      // newRegressionToolStripMenuItem
     166      //
     167      this.newRegressionToolStripMenuItem.Name = "newRegressionToolStripMenuItem";
     168      this.newRegressionToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
     169      this.newRegressionToolStripMenuItem.Text = "Regression";
     170      this.newRegressionToolStripMenuItem.Click += new System.EventHandler(this.newRegressionToolStripMenuItem_Click);
     171      //
     172      // newClassificationToolStripMenuItem
     173      //
     174      this.newClassificationToolStripMenuItem.Name = "newClassificationToolStripMenuItem";
     175      this.newClassificationToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
     176      this.newClassificationToolStripMenuItem.Text = "Classification";
     177      this.newClassificationToolStripMenuItem.Click += new System.EventHandler(this.newClassificationToolStripMenuItem_Click);
     178      //
     179      // newTimeSeriesToolStripMenuItem
     180      //
     181      this.newTimeSeriesToolStripMenuItem.Name = "newTimeSeriesToolStripMenuItem";
     182      this.newTimeSeriesToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
     183      this.newTimeSeriesToolStripMenuItem.Text = "Time Series Prognosis";
     184      this.newTimeSeriesToolStripMenuItem.Click += new System.EventHandler(this.newTimeSeriesToolStripMenuItem_Click);
     185      //
     186      // importProblemDataTypeContextMenuStrip
     187      //
     188      this.importProblemDataTypeContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     189            this.importRegressionToolStripMenuItem,
     190            this.importClassificationToolStripMenuItem,
     191            this.importTimeSeriesToolStripMenuItem});
     192      this.importProblemDataTypeContextMenuStrip.Name = "newProblemDataTypeContextMenuStrip";
     193      this.importProblemDataTypeContextMenuStrip.Size = new System.Drawing.Size(190, 92);
     194      //
     195      // importRegressionToolStripMenuItem
     196      //
     197      this.importRegressionToolStripMenuItem.Name = "importRegressionToolStripMenuItem";
     198      this.importRegressionToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
     199      this.importRegressionToolStripMenuItem.Text = "Regression";
     200      this.importRegressionToolStripMenuItem.Click += new System.EventHandler(this.importRegressionToolStripMenuItem_Click);
     201      //
     202      // importClassificationToolStripMenuItem
     203      //
     204      this.importClassificationToolStripMenuItem.Name = "importClassificationToolStripMenuItem";
     205      this.importClassificationToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
     206      this.importClassificationToolStripMenuItem.Text = "Classification";
     207      this.importClassificationToolStripMenuItem.Click += new System.EventHandler(this.importClassificationToolStripMenuItem_Click);
     208      //
     209      // importTimeSeriesToolStripMenuItem
     210      //
     211      this.importTimeSeriesToolStripMenuItem.Name = "importTimeSeriesToolStripMenuItem";
     212      this.importTimeSeriesToolStripMenuItem.Size = new System.Drawing.Size(189, 22);
     213      this.importTimeSeriesToolStripMenuItem.Text = "Time Series Prognosis";
     214      this.importTimeSeriesToolStripMenuItem.Click += new System.EventHandler(this.importTimeSeriesToolStripMenuItem_Click);
     215      //
    100216      // viewShortcutListView
    101217      //
    102       this.viewShortcutListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    103             | System.Windows.Forms.AnchorStyles.Left) 
     218      this.viewShortcutListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     219            | System.Windows.Forms.AnchorStyles.Left)
    104220            | System.Windows.Forms.AnchorStyles.Right)));
    105221      this.viewShortcutListView.Caption = "ViewShortcutCollection View";
    106222      this.viewShortcutListView.Content = null;
    107       this.viewShortcutListView.Location = new System.Drawing.Point(4, 33);
     223      this.viewShortcutListView.Location = new System.Drawing.Point(4, 56);
    108224      this.viewShortcutListView.Name = "viewShortcutListView";
    109225      this.viewShortcutListView.ReadOnly = false;
    110       this.viewShortcutListView.Size = new System.Drawing.Size(831, 413);
    111       this.viewShortcutListView.TabIndex = 4;
     226      this.viewShortcutListView.Size = new System.Drawing.Size(831, 390);
     227      this.viewShortcutListView.TabIndex = 7;
     228      //
     229      // applyTypeContextMenuStrip
     230      //
     231      this.applyTypeContextMenuStrip.Name = "newProblemDataTypeContextMenuStrip";
     232      this.applyTypeContextMenuStrip.Size = new System.Drawing.Size(61, 4);
     233      //
     234      // exportTypeContextMenuStrip
     235      //
     236      this.exportTypeContextMenuStrip.Name = "newProblemDataTypeContextMenuStrip";
     237      this.exportTypeContextMenuStrip.Size = new System.Drawing.Size(61, 4);
    112238      //
    113239      // DataPreprocessingView
     
    115241      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    116242      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     243      this.Controls.Add(this.newButton);
     244      this.Controls.Add(this.importButton);
     245      this.Controls.Add(this.applyInNewTabButton);
     246      this.Controls.Add(this.exportProblemButton);
     247      this.Controls.Add(this.undoButton);
     248      this.Controls.Add(this.redoButton);
    117249      this.Controls.Add(this.lblFilterActive);
    118250      this.Controls.Add(this.viewShortcutListView);
    119       this.Controls.Add(this.undoButton);
    120       this.Controls.Add(this.applyInNewTabButton);
    121       this.Controls.Add(this.exportProblemButton);
    122251      this.Name = "DataPreprocessingView";
    123252      this.Size = new System.Drawing.Size(838, 449);
     253      this.Controls.SetChildIndex(this.viewShortcutListView, 0);
     254      this.Controls.SetChildIndex(this.lblFilterActive, 0);
     255      this.Controls.SetChildIndex(this.redoButton, 0);
     256      this.Controls.SetChildIndex(this.undoButton, 0);
     257      this.Controls.SetChildIndex(this.exportProblemButton, 0);
     258      this.Controls.SetChildIndex(this.applyInNewTabButton, 0);
     259      this.Controls.SetChildIndex(this.importButton, 0);
     260      this.Controls.SetChildIndex(this.newButton, 0);
     261      this.Controls.SetChildIndex(this.infoLabel, 0);
     262      this.Controls.SetChildIndex(this.nameTextBox, 0);
     263      this.Controls.SetChildIndex(this.nameLabel, 0);
     264      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
     265      this.newProblemDataTypeContextMenuStrip.ResumeLayout(false);
     266      this.importProblemDataTypeContextMenuStrip.ResumeLayout(false);
    124267      this.ResumeLayout(false);
    125268      this.PerformLayout();
     
    132275    private System.Windows.Forms.Button applyInNewTabButton;
    133276    private System.Windows.Forms.Button undoButton;
    134     private System.Windows.Forms.ToolTip toolTip;
    135277    private ViewShortcutListView viewShortcutListView;
    136278    private System.Windows.Forms.Label lblFilterActive;
    137 
     279    private System.Windows.Forms.Button redoButton;
     280    private System.Windows.Forms.Button newButton;
     281    private System.Windows.Forms.Button importButton;
     282    private System.Windows.Forms.ContextMenuStrip newProblemDataTypeContextMenuStrip;
     283    private System.Windows.Forms.ToolStripMenuItem newRegressionToolStripMenuItem;
     284    private System.Windows.Forms.ToolStripMenuItem newClassificationToolStripMenuItem;
     285    private System.Windows.Forms.ToolStripMenuItem newTimeSeriesToolStripMenuItem;
     286    private System.Windows.Forms.ContextMenuStrip importProblemDataTypeContextMenuStrip;
     287    private System.Windows.Forms.ToolStripMenuItem importRegressionToolStripMenuItem;
     288    private System.Windows.Forms.ToolStripMenuItem importClassificationToolStripMenuItem;
     289    private System.Windows.Forms.ToolStripMenuItem importTimeSeriesToolStripMenuItem;
     290    private System.Windows.Forms.ContextMenuStrip applyTypeContextMenuStrip;
     291    private System.Windows.Forms.ContextMenuStrip exportTypeContextMenuStrip;
    138292  }
    139293}
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessorStarter.cs

    r12718 r14075  
    2121
    2222using System.Windows.Forms;
     23using HeuristicLab.Core;
    2324using HeuristicLab.MainForm;
    2425using HeuristicLab.Optimization;
     
    3334      IDataAnalysisProblem problem;
    3435      GetMostOuterContent(currentView as Control, out algorithm, out problem);
    35       var context = new PreprocessingContext(problemData, algorithm, problem);
     36      var context = new PreprocessingContext(problemData, algorithm ?? problem ?? problemData as IItem);
    3637      MainFormManager.MainForm.ShowContent(context);
    3738    }
     
    4243
    4344      while (control != null) {
    44         IContentView contentView = control as IContentView;
     45        var contentView = control as IContentView;
    4546        if (contentView != null) {
    4647          var newAlgorithm = contentView.Content as IAlgorithm;
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/FilterView.Designer.cs

    r11044 r14075  
    1 namespace HeuristicLab.DataPreprocessing.Views
    2 {
    3   partial class FilterView
    4   {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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
     22namespace HeuristicLab.DataPreprocessing.Views {
     23  partial class FilterView {
    524    /// <summary>
    625    /// Required designer variable.
     
    1231    /// </summary>
    1332    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    14     protected override void Dispose(bool disposing)
    15     {
    16       if (disposing && (components != null))
    17       {
     33    protected override void Dispose(bool disposing) {
     34      if (disposing && (components != null)) {
    1835        components.Dispose();
    1936      }
     
    2744    /// the contents of this method with the code editor.
    2845    /// </summary>
    29     private void InitializeComponent()
    30     {
     46    private void InitializeComponent() {
    3147      this.groupBoxFilter = new System.Windows.Forms.GroupBox();
    3248      this.checkedFilterView = new HeuristicLab.DataPreprocessing.Views.CheckedFilterCollectionView();
     
    5369      // groupBoxFilter
    5470      //
    55       this.groupBoxFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     71      this.groupBoxFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    5672            | System.Windows.Forms.AnchorStyles.Right)));
    5773      this.groupBoxFilter.Controls.Add(this.checkedFilterView);
     
    7793      // groupBoxFilterInfo
    7894      //
    79       this.groupBoxFilterInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     95      this.groupBoxFilterInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    8096            | System.Windows.Forms.AnchorStyles.Right)));
    8197      this.groupBoxFilterInfo.Controls.Add(this.lblPercentage);
     
    103119      // tbPercentage
    104120      //
    105       this.tbPercentage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     121      this.tbPercentage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    106122            | System.Windows.Forms.AnchorStyles.Right)));
    107123      this.tbPercentage.Enabled = false;
     
    113129      // tbFiltered
    114130      //
    115       this.tbRemaining.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     131      this.tbRemaining.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    116132            | System.Windows.Forms.AnchorStyles.Right)));
    117133      this.tbRemaining.Enabled = false;
     
    132148      // tbTotal
    133149      //
    134       this.tbTotal.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     150      this.tbTotal.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    135151            | System.Windows.Forms.AnchorStyles.Right)));
    136152      this.tbTotal.Enabled = false;
     
    193209      // groupBox1
    194210      //
    195       this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     211      this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    196212            | System.Windows.Forms.AnchorStyles.Right)));
    197213      this.groupBox1.Controls.Add(this.label4);
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/FilterView.cs

    r11044 r14075  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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;
    223using System.Collections.Generic;
    324using System.Linq;
    4 using System.Windows.Forms;
    525using HeuristicLab.Collections;
    6 using HeuristicLab.Core;
    726using HeuristicLab.Core.Views;
    8 using HeuristicLab.Data;
    927using HeuristicLab.DataPreprocessing.Filter;
    1028using HeuristicLab.MainForm;
     
    2240    }
    2341
    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;
     42    private void InitData() {
     43      checkedFilterView.Content = Content.Filters;
     44      checkedFilterView.Content.ItemsAdded += Content_ItemsAdded;
     45      checkedFilterView.Content.ItemsRemoved += Content_ItemsRemoved;
     46      checkedFilterView.Content.CheckedItemsChanged += Content_CheckedItemsChanged;
    3047    }
    3148
     
    3552    }
    3653
    37     protected override void OnContentChanged()
    38     {
     54    protected override void OnContentChanged() {
    3955      base.OnContentChanged();
    40       if (Content != null)
    41       {
     56      if (Content != null) {
    4257        InitData();
    4358        UpdateFilterInfo();
     
    4661
    4762    private void Content_CheckedItemsChanged(object sender, Collections.CollectionItemsChangedEventArgs<IFilter> e) {
    48       if (Content != null)
    49       {
    50         foreach (IFilter filter in e.Items)
    51         {
     63      if (Content != null) {
     64        foreach (IFilter filter in e.Items) {
    5265          filter.Active = checkedFilterView.Content.ItemChecked(filter);
    5366        }
     
    5770
    5871    private void UpdateFilterInfo() {
    59         List<IFilter> filters = Content.Filters.ToList();
    60         int activeFilters = filters.Count(c => c.Active);
    61         applyFilterButton.Enabled = (activeFilters > 0);
    62         rBtnAnd.Enabled = (activeFilters > 0);
    63         rBtnOr.Enabled = (activeFilters > 0);
    64         Content.FilterLogic.Reset();
    65         bool[] result = Content.FilterLogic.Preview(filters, rBtnAnd.Checked);
     72      List<IFilter> filters = Content.Filters.ToList();
     73      int activeFilters = filters.Count(c => c.Active);
     74      applyFilterButton.Enabled = (activeFilters > 0);
     75      rBtnAnd.Enabled = (activeFilters > 0);
     76      rBtnOr.Enabled = (activeFilters > 0);
     77      Content.FilterLogic.Reset();
     78      bool[] result = Content.FilterLogic.Preview(filters, rBtnAnd.Checked);
    6679
    67         int filteredCnt = result.Count(c => !c);
     80      int filteredCnt = result.Count(c => !c);
    6881
    69         tbRemaining.Text = filteredCnt.ToString();
    70         double percentage = result.Length == 0 ? 0.0 : filteredCnt * 100 / (double)result.Length;
    71         tbPercentage.Text = String.Format("{0:0.0000}%", percentage);
    72         tbTotal.Text = result.Length.ToString();
     82      tbRemaining.Text = filteredCnt.ToString();
     83      double percentage = result.Length == 0 ? 0.0 : filteredCnt * 100 / (double)result.Length;
     84      tbPercentage.Text = String.Format("{0:0.0000}%", percentage);
     85      tbTotal.Text = result.Length.ToString();
    7386    }
    7487
    7588    private void applyFilterButton_Click(object sender, EventArgs e) {
    76       if (Content != null)
    77       {
     89      if (Content != null) {
    7890        List<IFilter> filters = Content.Filters.ToList();
    7991        //apply filters
     
    8193        //deactivate checked filters
    8294        filters = checkedFilterView.Content.CheckedItems.ToList();
    83         foreach (IFilter filter in filters)
    84         {
     95        foreach (IFilter filter in filters) {
    8596          checkedFilterView.Content.SetItemCheckedState(filter, false);
    8697          filter.Active = false;
     
    92103    //whenever a new filter is added the preprocessing data is set to the filter
    93104    private void Content_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<IFilter> e) {
    94       if (Content != null)
    95       {
    96         foreach (IFilter filter in e.Items)
    97         {
     105      if (Content != null) {
     106        foreach (IFilter filter in e.Items) {
    98107          filter.ConstrainedValue = Content.FilterLogic.PreprocessingData;
    99108        }
     
    102111
    103112    private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IFilter> e) {
    104       if (Content != null)
    105       {
     113      if (Content != null) {
    106114        UpdateFilterInfo();
    107115      }
    108116    }
    109117
    110     private void rBtnAnd_CheckedChanged(object sender, EventArgs e)
    111     {
    112       if (Content != null)
    113       {
     118    private void rBtnAnd_CheckedChanged(object sender, EventArgs e) {
     119      if (Content != null) {
    114120        UpdateFilterInfo();
    115121        Content.IsAndCombination = rBtnAnd.Checked;
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/HeuristicLab.DataPreprocessing.Views-3.4.csproj

    r13289 r14075  
    9797  </ItemGroup>
    9898  <ItemGroup>
     99    <Compile Include="DataPreprocessingMenuItem.cs" />
    99100    <Compile Include="PreprocessingFeatureCorrelationView.cs">
    100101      <SubType>UserControl</SubType>
     
    254255      <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project>
    255256      <Name>HeuristicLab.Collections-3.3</Name>
     257      <Private>False</Private>
    256258    </ProjectReference>
    257259    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
     
    305307      <Private>False</Private>
    306308    </ProjectReference>
     309    <ProjectReference Include="..\..\HeuristicLab.Optimizer\3.3\HeuristicLab.Optimizer-3.3.csproj">
     310      <Project>{C664305E-497C-4533-A140-967DEDB05C19}</Project>
     311      <Name>HeuristicLab.Optimizer-3.3</Name>
     312      <Private>False</Private>
     313    </ProjectReference>
    307314    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
    308315      <Project>{94186a6a-5176-4402-ae83-886557b53cca}</Project>
     
    318325      <Project>{df87c13e-a889-46ff-8153-66dcaa8c5674}</Project>
    319326      <Name>HeuristicLab.Problems.DataAnalysis-3.4</Name>
     327      <Private>False</Private>
     328    </ProjectReference>
     329    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances.DataAnalysis.Views\3.3\HeuristicLab.Problems.Instances.DataAnalysis.Views-3.3.csproj">
     330      <Project>{72232235-B6CF-4E6C-B086-9E9E11AA0717}</Project>
     331      <Name>HeuristicLab.Problems.Instances.DataAnalysis.Views-3.3</Name>
     332      <Private>False</Private>
     333    </ProjectReference>
     334    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances.DataAnalysis\3.3\HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj">
     335      <Project>{94C7714E-29D4-4D6D-B213-2C18D627AB75}</Project>
     336      <Name>HeuristicLab.Problems.Instances.DataAnalysis-3.3</Name>
     337      <Private>False</Private>
     338    </ProjectReference>
     339    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
     340      <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
     341      <Name>HeuristicLab.Problems.Instances-3.3</Name>
    320342      <Private>False</Private>
    321343    </ProjectReference>
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/HistogramView.Designer.cs

    r12718 r14075  
    1 namespace HeuristicLab.DataPreprocessing.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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
     22namespace HeuristicLab.DataPreprocessing.Views {
    223  partial class HistogramView {
    324    /// <summary>
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/HistogramView.cs

    r12718 r14075  
    1919 */
    2020#endregion
     21
    2122using System;
    22 using System.Windows.Forms;
    2323using HeuristicLab.Analysis;
    2424using HeuristicLab.MainForm;
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/LineChartView.Designer.cs

    r10736 r14075  
    1 namespace HeuristicLab.DataPreprocessing.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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
     22namespace HeuristicLab.DataPreprocessing.Views {
    223  partial class LineChartView {
    324    /// <summary>
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/LineChartView.cs

    r12009 r14075  
    2121
    2222using System;
    23 using System.Windows.Forms;
    2423using HeuristicLab.Analysis;
    2524using HeuristicLab.MainForm;
     
    4645    private void allInOneCheckBox_CheckedChanged(object sender, EventArgs e) {
    4746      Content.AllInOneMode = allInOneCheckBox.Checked;
    48  
     47
    4948      GenerateChart();
    5049    }
    5150
    52     protected override void OnContentChanged()
    53     {
     51    protected override void OnContentChanged() {
    5452      base.OnContentChanged();
    55       if (Content != null)
    56       {
     53      if (Content != null) {
    5754        allInOneCheckBox.Checked = Content.AllInOneMode;
    5855      }
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/ManipulationView.Designer.cs

    r12718 r14075  
    1 namespace HeuristicLab.DataPreprocessing.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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
     22namespace HeuristicLab.DataPreprocessing.Views {
    223  partial class ManipulationView {
    324    /// <summary>
     
    91112      // lstMethods
    92113      //
    93       this.lstMethods.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     114      this.lstMethods.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    94115            | System.Windows.Forms.AnchorStyles.Right)));
    95116      this.lstMethods.FormattingEnabled = true;
     
    124145      // grpBoxData
    125146      //
    126       this.grpBoxData.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     147      this.grpBoxData.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    127148            | System.Windows.Forms.AnchorStyles.Right)));
    128149      this.grpBoxData.Controls.Add(this.tabsData);
     
    138159      // tabsData
    139160      //
    140       this.tabsData.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     161      this.tabsData.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    141162            | System.Windows.Forms.AnchorStyles.Right)));
    142163      this.tabsData.Controls.Add(this.tabPage1);
     
    416437      // grpBoxPreview
    417438      //
    418       this.grpBoxPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    419             | System.Windows.Forms.AnchorStyles.Left) 
     439      this.grpBoxPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     440            | System.Windows.Forms.AnchorStyles.Left)
    420441            | System.Windows.Forms.AnchorStyles.Right)));
    421442      this.grpBoxPreview.Controls.Add(this.tabsPreview);
     
    431452      // tabsPreview
    432453      //
    433       this.tabsPreview.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     454      this.tabsPreview.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    434455            | System.Windows.Forms.AnchorStyles.Right)));
    435456      this.tabsPreview.Controls.Add(this.tabPreviewInactive);
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/Plugin.cs.frame

    r13316 r14075  
    4141  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
    4242  [PluginDependency("HeuristicLab.Optimization", "3.3")]
     43  [PluginDependency("HeuristicLab.Optimizer", "3.3")]
    4344  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
    4445  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Views", "3.4")]
     46  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
     47  [PluginDependency("HeuristicLab.Problems.Instances.DataAnalysis", "3.3")]
     48  [PluginDependency("HeuristicLab.Problems.Instances.DataAnalysis.Views", "3.3")]
    4549  [PluginDependency("HeuristicLab.Visualization.ChartControlsExtensions", "3.3")]
    4650  public class HeuristicLabDataPreprocessingViewPlugin : PluginBase {
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.Designer.cs

    r12009 r14075  
    2020#endregion
    2121
    22 using HeuristicLab.Data;
    2322namespace HeuristicLab.DataPreprocessing.Views {
    2423  partial class PreprocessingChartView {
     
    6564      // tableLayoutPanel
    6665      //
    67       this.tableLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    68             | System.Windows.Forms.AnchorStyles.Left) 
     66      this.tableLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     67            | System.Windows.Forms.AnchorStyles.Left)
    6968            | System.Windows.Forms.AnchorStyles.Right)));
    7069      this.tableLayoutPanel.AutoScroll = true;
     
    8281      // checkedItemList
    8382      //
    84       this.checkedItemList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     83      this.checkedItemList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    8584            | System.Windows.Forms.AnchorStyles.Left)));
    8685      this.checkedItemList.Caption = "View";
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs

    r12718 r14075  
    2828using HeuristicLab.Core.Views;
    2929using HeuristicLab.Data;
    30 using HeuristicLab.DataPreprocessing.Implementations;
    3130using HeuristicLab.MainForm;
    3231
    3332namespace HeuristicLab.DataPreprocessing.Views {
    34 
    3533  [View("Preprocessing Chart View")]
    3634  [Content(typeof(PreprocessingChartContent), false)]
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedItemListView.cs

    r12009 r14075  
    2222#endregion
    2323
    24 using System.Windows.Forms;
    2524using HeuristicLab.Core;
    2625using HeuristicLab.Core.Views;
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingDataTableView.Designer.cs

    r12009 r14075  
    2020#endregion
    2121
    22 namespace HeuristicLab.DataPreprocessing.Views
    23 {
     22namespace HeuristicLab.DataPreprocessing.Views {
    2423  partial class PreprocessingDataTableView {
    2524    /// <summary>
     
    5756      // chart
    5857      //
    59       this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    60             | System.Windows.Forms.AnchorStyles.Left) 
     58      this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     59            | System.Windows.Forms.AnchorStyles.Left)
    6160            | System.Windows.Forms.AnchorStyles.Right)));
    6261      this.chart.BorderlineColor = System.Drawing.Color.Black;
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingDataTableView.cs

    r12718 r14075  
    2626using System.Windows.Forms;
    2727using System.Windows.Forms.DataVisualization.Charting;
     28using HeuristicLab.Analysis;
     29using HeuristicLab.Analysis.Views;
    2830using HeuristicLab.Collections;
    2931using HeuristicLab.Core.Views;
    30 using HeuristicLab.DataPreprocessing.Implementations;
    3132using HeuristicLab.MainForm;
    32 using HeuristicLab.Analysis;
    33 using HeuristicLab.Analysis.Views;
    3433
    3534namespace HeuristicLab.DataPreprocessing.Views {
     
    746745
    747746      //  shift the chart to the left so the bars are placed on the intervals
    748       if (Classification != null || valueFrequencies.First().Item1 < doubleRange.First()) {
     747      if (Classification != null || (valueFrequencies.Any() && valueFrequencies.First().Item1 < doubleRange.First())) {
    749748        series.Points.Add(new DataPoint(min - intervalWidth, 0));
    750749        series.Points.Add(new DataPoint(max + intervalWidth, 0));
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingFeatureCorrelationView.Designer.cs

    r12009 r14075  
    4747    /// </summary>
    4848    private void InitializeComponent() {
    49       this.components = new System.ComponentModel.Container();     
     49      this.components = new System.ComponentModel.Container();
    5050      this.ResumeLayout(false);
    5151    }
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingFeatureCorrelationView.cs

    r12009 r14075  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    23 using System.ComponentModel;
    24 using System.Linq;
    2522using System.Windows.Forms;
    26 using HeuristicLab.Data;
     23using HeuristicLab.DataPreprocessing;
    2724using HeuristicLab.MainForm;
    2825using HeuristicLab.MainForm.WindowsForms;
    29 using HeuristicLab.PluginInfrastructure;
    30 using System;
    31 using HeuristicLab.DataPreprocessing;
    32 using HeuristicLab.Problems.DataAnalysis.Views;
    3326
    3427namespace HeuristicLab.Problems.DataAnalysis.Views {
     
    3730  public partial class PreprocessingFeatureCorrelationView : AsynchronousContentView {
    3831
    39     public new CorrelationMatrixContent Content
    40     {
    41       get { return (CorrelationMatrixContent) base.Content; }
     32    public new CorrelationMatrixContent Content {
     33      get { return (CorrelationMatrixContent)base.Content; }
    4234      set { base.Content = value; }
    4335    }
     
    5547    protected override void RegisterContentEvents() {
    5648      base.RegisterContentEvents();
    57       Content.Changed += Data_Changed;     
     49      Content.Changed += Data_Changed;
    5850    }
    5951
    6052    protected override void DeregisterContentEvents() {
    61       Content.Changed -= Data_Changed;     
     53      Content.Changed -= Data_Changed;
    6254      base.DeregisterContentEvents();
    6355    }
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingScatterPlotView.Designer.cs

    r12009 r14075  
    5656      // chart
    5757      //
    58       this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    59             | System.Windows.Forms.AnchorStyles.Left) 
     58      this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     59            | System.Windows.Forms.AnchorStyles.Left)
    6060            | System.Windows.Forms.AnchorStyles.Right)));
    6161      this.chart.BorderlineColor = System.Drawing.Color.Black;
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingScatterPlotView.cs

    r12009 r14075  
    462462      if (chartDoubleClick != null)
    463463        chartDoubleClick(this, e);
    464     } 
     464    }
    465465  }
    466466}
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/RenameColumnsDialog.Designer.cs

    r13289 r14075  
    7878      this.dataGridView.AllowUserToAddRows = false;
    7979      this.dataGridView.AllowUserToDeleteRows = false;
    80       this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    81             | System.Windows.Forms.AnchorStyles.Left) 
     80      this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     81            | System.Windows.Forms.AnchorStyles.Left)
    8282            | System.Windows.Forms.AnchorStyles.Right)));
    8383      this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.Designer.cs

    r10987 r14075  
    1 namespace HeuristicLab.DataPreprocessing.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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
     22namespace HeuristicLab.DataPreprocessing.Views {
    223  partial class ScatterPlotMultiView {
    324    /// <summary>
     
    2950      // tableLayoutPanel
    3051      //
    31       this.tableLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    32             | System.Windows.Forms.AnchorStyles.Left) 
     52      this.tableLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     53            | System.Windows.Forms.AnchorStyles.Left)
    3354            | System.Windows.Forms.AnchorStyles.Right)));
    3455      this.tableLayoutPanel.AutoScroll = true;
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs

    r10992 r14075  
    77using HeuristicLab.Common;
    88using HeuristicLab.Core.Views;
    9 using HeuristicLab.DataPreprocessing.Implementations;
    109using HeuristicLab.MainForm;
    1110
    1211namespace HeuristicLab.DataPreprocessing.Views {
    13 
    1412  [View("Scatter Plot Multi View")]
    1513  [Content(typeof(ScatterPlotContent), false)]
     
    8179          tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, (tableLayoutPanel.Height - HEADER_HEIGHT) / variables.Count));
    8280        }
    83           // fixed size
     81        // fixed size
    8482        else {
    8583          tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, FIXED_CHART_WIDTH));
     
    111109            tableLayoutPanel.Controls.Add(pcv, y, x);
    112110          }
    113             //scatter plot
     111          //scatter plot
    114112          else {
    115113            ScatterPlot scatterPlot = Content.CreateScatterPlot(variables[x - 1], variables[y - 1]);
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.Designer.cs

    r11043 r14075  
    1 namespace HeuristicLab.DataPreprocessing.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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
     22namespace HeuristicLab.DataPreprocessing.Views {
    223  partial class ScatterPlotSingleView {
    324    /// <summary>
     
    3051      this.comboBoxYVariable = new System.Windows.Forms.ComboBox();
    3152      this.comboBoxXVariable = new System.Windows.Forms.ComboBox();
     53      this.label3 = new System.Windows.Forms.Label();
     54      this.comboBoxColor = new System.Windows.Forms.ComboBox();
    3255      this.groupBox1.SuspendLayout();
    3356      this.SuspendLayout();
     
    3558      // scatterPlotView
    3659      //
    37       this.scatterPlotView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    38             | System.Windows.Forms.AnchorStyles.Left) 
     60      this.scatterPlotView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     61            | System.Windows.Forms.AnchorStyles.Left)
    3962            | System.Windows.Forms.AnchorStyles.Right)));
    4063      this.scatterPlotView.Caption = "ScatterPlot View";
     
    4871      // groupBox1
    4972      //
     73      this.groupBox1.Controls.Add(this.label3);
    5074      this.groupBox1.Controls.Add(this.label2);
    5175      this.groupBox1.Controls.Add(this.label1);
     76      this.groupBox1.Controls.Add(this.comboBoxColor);
    5277      this.groupBox1.Controls.Add(this.comboBoxYVariable);
    5378      this.groupBox1.Controls.Add(this.comboBoxXVariable);
    5479      this.groupBox1.Location = new System.Drawing.Point(3, 3);
    5580      this.groupBox1.Name = "groupBox1";
    56       this.groupBox1.Size = new System.Drawing.Size(160, 140);
     81      this.groupBox1.Size = new System.Drawing.Size(160, 215);
    5782      this.groupBox1.TabIndex = 1;
    5883      this.groupBox1.TabStop = false;
     
    99124      this.comboBoxXVariable.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedIndexChanged);
    100125      //
     126      // label3
     127      //
     128      this.label3.AutoSize = true;
     129      this.label3.Location = new System.Drawing.Point(17, 141);
     130      this.label3.Name = "label3";
     131      this.label3.Size = new System.Drawing.Size(31, 13);
     132      this.label3.TabIndex = 3;
     133      this.label3.Text = "Color";
     134      //
     135      // comboBoxColor
     136      //
     137      this.comboBoxColor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     138      this.comboBoxColor.FormattingEnabled = true;
     139      this.comboBoxColor.Location = new System.Drawing.Point(20, 164);
     140      this.comboBoxColor.Margin = new System.Windows.Forms.Padding(3, 10, 3, 3);
     141      this.comboBoxColor.Name = "comboBoxColor";
     142      this.comboBoxColor.Size = new System.Drawing.Size(121, 21);
     143      this.comboBoxColor.TabIndex = 1;
     144      this.comboBoxColor.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedIndexChanged);
     145      //
    101146      // ScatterPlotSingleView
    102147      //
     
    121166    private System.Windows.Forms.ComboBox comboBoxYVariable;
    122167    private System.Windows.Forms.ComboBox comboBoxXVariable;
     168    private System.Windows.Forms.ComboBox comboBoxColor;
     169    private System.Windows.Forms.Label label3;
    123170  }
    124171}
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.cs

    r10998 r14075  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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;
    223using System.Collections.Generic;
    324using System.Linq;
    4 using System.Windows.Forms;
    525using HeuristicLab.Analysis;
    626using HeuristicLab.Core.Views;
     
    1838    }
    1939
    20     public ScatterPlotSingleView()
    21     {
     40    public ScatterPlotSingleView() {
    2241      InitializeComponent();
    2342    }
    2443
    2544    public void InitData() {
    26 
    2745      IEnumerable<string> variables = Content.PreprocessingData.GetDoubleVariableNames();
    2846
     
    3048      comboBoxXVariable.Items.Clear();
    3149      comboBoxYVariable.Items.Clear();
     50      comboBoxColor.Items.Clear();
    3251      comboBoxXVariable.Items.AddRange(variables.ToArray());
    3352      comboBoxYVariable.Items.AddRange(variables.ToArray());
     53      comboBoxColor.Items.Add("-");
     54      for (int i = 0; i < Content.PreprocessingData.Columns; ++i) {
     55        if (Content.PreprocessingData.VariableHasType<double>(i)) {
     56          double distinctValueCount = Content.PreprocessingData.GetValues<double>(i).GroupBy(x => x).Count();
     57          if (distinctValueCount <= 20)
     58            comboBoxColor.Items.Add(Content.PreprocessingData.GetVariableName(i));
     59        }
     60      }
    3461
    3562      // use x and y variable from content
    36       if (Content.SelectedXVariable != null && Content.SelectedYVariable != null) {
     63      if (Content.SelectedXVariable != null && Content.SelectedYVariable != null && Content.SelectedColorVariable != null) {
    3764        comboBoxXVariable.SelectedItem = Content.SelectedXVariable;
    3865        comboBoxYVariable.SelectedItem = Content.SelectedYVariable;
     66        comboBoxColor.SelectedItem = Content.SelectedColorVariable;
    3967      } else {
    4068        if (variables.Count() >= 2) {
    4169          comboBoxXVariable.SelectedIndex = 0;
    4270          comboBoxYVariable.SelectedIndex = 1;
     71          comboBoxColor.SelectedIndex = 0;
    4372          UpdateScatterPlot();
    44 
    4573        }
    4674      }
     
    5987
    6088    private void UpdateScatterPlot() {
    61       if (comboBoxXVariable.SelectedItem != null && comboBoxYVariable.SelectedItem != null) {
     89      if (comboBoxXVariable.SelectedItem != null && comboBoxYVariable.SelectedItem != null && comboBoxColor.SelectedItem != null) {
    6290        //get scatter plot with selected x and y variable
    63         ScatterPlot scatterPlot = Content.CreateScatterPlot((string)comboBoxXVariable.SelectedItem, (string)comboBoxYVariable.SelectedItem);
     91        ScatterPlot scatterPlot = Content.CreateScatterPlot(
     92          (string)comboBoxXVariable.SelectedItem,
     93          (string)comboBoxYVariable.SelectedItem,
     94          (string)comboBoxColor.SelectedItem);
    6495        scatterPlotView.Content = scatterPlot;
    6596
     
    6798        this.Content.SelectedXVariable = (string)comboBoxXVariable.SelectedItem;
    6899        this.Content.SelectedYVariable = (string)comboBoxYVariable.SelectedItem;
     100        this.Content.SelectedColorVariable = (string)comboBoxColor.SelectedItem;
    69101      }
    70102    }
    71 
    72103  }
    73 
    74 
    75104}
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/SearchAndReplaceDialog.Designer.cs

    r10930 r14075  
    1 namespace HeuristicLab.DataPreprocessing.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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
     22namespace HeuristicLab.DataPreprocessing.Views {
    223  partial class SearchAndReplaceDialog {
    324    /// <summary>
     
    4465      // tabSearchReplace
    4566      //
    46       this.tabSearchReplace.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    47             | System.Windows.Forms.AnchorStyles.Left) 
     67      this.tabSearchReplace.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     68            | System.Windows.Forms.AnchorStyles.Left)
    4869            | System.Windows.Forms.AnchorStyles.Right)));
    4970      this.tabSearchReplace.Controls.Add(this.tabSearch);
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/SearchAndReplaceDialog.cs

    r10930 r14075  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2015 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;
    223using System.Windows.Forms;
    324
     
    2041    NotEqual
    2142  }
    22 
    23 
    2443
    2544  public partial class SearchAndReplaceDialog : Form {
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/ViewShortcutListView.Designer.cs

    r12009 r14075  
    1919 */
    2020#endregion
    21 
    2221
    2322namespace HeuristicLab.DataPreprocessing.Views {
     
    4645    /// </summary>
    4746    private void InitializeComponent() {
     47      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
     48      this.splitContainer.Panel1.SuspendLayout();
     49      this.splitContainer.Panel2.SuspendLayout();
     50      this.splitContainer.SuspendLayout();
     51      this.itemsGroupBox.SuspendLayout();
     52      this.detailsGroupBox.SuspendLayout();
    4853      this.SuspendLayout();
     54      //
     55      // splitContainer
     56      //
     57      this.splitContainer.Size = new System.Drawing.Size(526, 364);
     58      //
     59      // itemsGroupBox
     60      //
     61      this.itemsGroupBox.Size = new System.Drawing.Size(532, 383);
     62      //
     63      // itemsListView
     64      //
     65      this.itemsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
     66      this.itemsListView.Dock = System.Windows.Forms.DockStyle.Fill;
     67      this.itemsListView.Location = new System.Drawing.Point(0, 0);
     68      this.itemsListView.Size = new System.Drawing.Size(200, 364);
     69      //
     70      // detailsGroupBox
     71      //
     72      this.detailsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
     73      this.detailsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
     74      this.detailsGroupBox.Location = new System.Drawing.Point(0, 0);
     75      this.detailsGroupBox.Size = new System.Drawing.Size(322, 364);
     76      //
     77      // addButton
     78      //
     79      this.toolTip.SetToolTip(this.addButton, "Add");
     80      this.addButton.Visible = false;
     81      //
     82      // removeButton
     83      //
     84      this.toolTip.SetToolTip(this.removeButton, "Remove");
     85      this.removeButton.Visible = false;
     86      //
     87      // moveUpButton
     88      //
     89      this.toolTip.SetToolTip(this.moveUpButton, "Move Up");
     90      this.moveUpButton.Visible = false;
     91      //
     92      // moveDownButton
     93      //
     94      this.toolTip.SetToolTip(this.moveDownButton, "Move Down");
     95      this.moveDownButton.Visible = false;
     96      //
     97      // viewHost
     98      //
     99      this.viewHost.Size = new System.Drawing.Size(310, 339);
     100      //
     101      // showDetailsCheckBox
     102      //
     103      this.showDetailsCheckBox.Visible = false;
    49104      //
    50105      // ViewShortcutListView
    51106      //
    52       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    53107      this.Name = "ViewShortcutListView";
    54108      this.Size = new System.Drawing.Size(532, 383);
     109      this.splitContainer.Panel1.ResumeLayout(false);
     110      this.splitContainer.Panel2.ResumeLayout(false);
     111      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
     112      this.splitContainer.ResumeLayout(false);
     113      this.itemsGroupBox.ResumeLayout(false);
     114      this.detailsGroupBox.ResumeLayout(false);
    55115      this.ResumeLayout(false);
     116
    56117    }
    57118
  • stable/HeuristicLab.DataPreprocessing/3.4

  • stable/HeuristicLab.DataPreprocessing/3.4/Content/CorrelationMatrixContent.cs

    r13508 r14075  
    3939    public DataAnalysisProblemData ProblemData {
    4040      get {
    41         return (DataAnalysisProblemData)Context.CreateNewProblemData();
    42         //var creator = new ProblemDataCreator(Context);
    43         //return (DataAnalysisProblemData)creator.CreateProblemData();
     41        var problemData = (DataAnalysisProblemData)Context.CreateNewProblemData();
     42        foreach (var input in problemData.InputVariables)
     43          problemData.InputVariables.SetItemCheckedState(input, true);
     44        // CorrelationView hides non-input columns per default
     45        return problemData;
    4446      }
    4547    }
  • stable/HeuristicLab.DataPreprocessing/3.4/Content/DataGridContent.cs

    r13508 r14075  
    2626using HeuristicLab.Common;
    2727using HeuristicLab.Core;
     28using HeuristicLab.Data;
    2829
    2930namespace HeuristicLab.DataPreprocessing {
    3031
    3132  [Item("DataGrid", "Represents a data grid.")]
    32   public class DataGridContent : Item, IViewShortcut, IDataGridContent {
     33  public class DataGridContent : Item, IStringConvertibleMatrix, IViewShortcut {
    3334
    3435    public ITransactionalPreprocessingData PreProcessingData { get; private set; }
  • stable/HeuristicLab.DataPreprocessing/3.4/Data/TransactionalPreprocessingData.cs

    r13508 r14075  
    216216    }
    217217
     218
     219    public override void InsertRow(int rowIndex) {
     220      SaveSnapshot(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);
     221      foreach (IList column in variableValues) {
     222        Type type = column.GetType().GetGenericArguments()[0];
     223        column.Insert(rowIndex, type.IsValueType ? Activator.CreateInstance(type) : null);
     224      }
     225      if (TrainingPartition.Start <= rowIndex && rowIndex <= TrainingPartition.End) {
     226        TrainingPartition.End++;
     227        if (TrainingPartition.End <= TestPartition.Start) {
     228          TestPartition.Start++;
     229          TestPartition.End++;
     230        }
     231      } else if (TestPartition.Start <= rowIndex && rowIndex <= TestPartition.End) {
     232        TestPartition.End++;
     233        if (TestPartition.End <= TrainingPartition.Start) {
     234          TestPartition.Start++;
     235          TestPartition.End++;
     236        }
     237      }
     238      if (!IsInTransaction)
     239        OnChanged(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);
     240    }
     241    public override void DeleteRow(int rowIndex) {
     242      SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);
     243      foreach (IList column in variableValues) {
     244        column.RemoveAt(rowIndex);
     245      }
     246      if (TrainingPartition.Start <= rowIndex && rowIndex <= TrainingPartition.End) {
     247        TrainingPartition.End--;
     248        if (TrainingPartition.End <= TestPartition.Start) {
     249          TestPartition.Start--;
     250          TestPartition.End--;
     251        }
     252      } else if (TestPartition.Start <= rowIndex && rowIndex <= TestPartition.End) {
     253        TestPartition.End--;
     254        if (TestPartition.End <= TrainingPartition.Start) {
     255          TestPartition.Start--;
     256          TestPartition.End--;
     257        }
     258      }
     259      if (!IsInTransaction)
     260        OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);
     261    }
    218262    public override void DeleteRowsWithIndices(IEnumerable<int> rows) {
    219263      SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, -1);
     
    222266          column.RemoveAt(rowIndex);
    223267        }
     268        if (TrainingPartition.Start <= rowIndex && rowIndex <= TrainingPartition.End) {
     269          TrainingPartition.End--;
     270          if (TrainingPartition.End <= TestPartition.Start) {
     271            TestPartition.Start--;
     272            TestPartition.End--;
     273          }
     274        } else if (TestPartition.Start <= rowIndex && rowIndex <= TestPartition.End) {
     275          TestPartition.End--;
     276          if (TestPartition.End <= TrainingPartition.Start) {
     277            TestPartition.Start--;
     278            TestPartition.End--;
     279          }
     280        }
    224281      }
    225282      if (!IsInTransaction)
    226283        OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, -1);
    227       ResetPartitions();
    228     }
    229 
    230     public override void InsertRow(int rowIndex) {
    231       SaveSnapshot(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);
    232       foreach (IList column in variableValues) {
    233         Type type = column.GetType().GetGenericArguments()[0];
    234         column.Insert(rowIndex, type.IsValueType ? Activator.CreateInstance(type) : null);
    235       }
    236       if (!IsInTransaction)
    237         OnChanged(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);
    238       ResetPartitions();
    239     }
    240 
    241     public override void DeleteRow(int rowIndex) {
    242       SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);
    243       foreach (IList column in variableValues) {
    244         column.RemoveAt(rowIndex);
    245       }
    246       if (!IsInTransaction)
    247         OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);
    248       ResetPartitions();
    249284    }
    250285
     
    308343      if (listeners != null) listeners(this, EventArgs.Empty);
    309344    }
    310 
    311 
    312     private void ResetPartitions() {
    313       TrainingPartition = new IntRange();
    314       TestPartition = new IntRange();
    315     }
    316 
    317345    #endregion
    318346
  • stable/HeuristicLab.DataPreprocessing/3.4/HeuristicLab.DataPreprocessing-3.4.csproj

    r11920 r14075  
    7878  </ItemGroup>
    7979  <ItemGroup>
    80     <Compile Include="Implementations\ScatterPlotContent.cs" />
    81     <Compile Include="Implementations\DataCompletenessChartContent.cs" />
    82     <Compile Include="Implementations\FilteredPreprocessingData.cs" />
    83     <Compile Include="Implementations\ManipulationContent.cs" />
    84     <Compile Include="Implementations\PreprocessingChartContent.cs" />
    85     <Compile Include="Implementations\PreprocessingData.cs" />
    86     <Compile Include="Implementations\PreprocessingDataTable.cs" />
    87     <Compile Include="Interfaces\IViewChartShortcut.cs" />
    88     <Compile Include="Interfaces\IFilteredPreprocessingData.cs" />
    89     <Compile Include="Implementations\CorrelationMatrixContent.cs" />
     80    <Compile Include="Content\ScatterPlotContent.cs" />
     81    <Compile Include="Content\DataCompletenessChartContent.cs" />
     82    <Compile Include="Data\FilteredPreprocessingData.cs" />
     83    <Compile Include="Content\ManipulationContent.cs" />
     84    <Compile Include="Content\PreprocessingChartContent.cs" />
     85    <Compile Include="Data\PreprocessingData.cs" />
     86    <Compile Include="Content\PreprocessingDataTable.cs" />
     87    <Compile Include="Content\IViewChartShortcut.cs" />
     88    <Compile Include="Data\IFilteredPreprocessingData.cs" />
     89    <Compile Include="Content\CorrelationMatrixContent.cs" />
    9090    <Compile Include="PreprocessingTransformator.cs" />
    91     <Compile Include="Utils\DataPreprocessingChangedEvent.cs" />
    92     <Compile Include="Implementations\Filter\ComparisonFilter.cs" />
    93     <Compile Include="Implementations\Filter\IFilter.cs" />
    94     <Compile Include="Implementations\ManipulationLogic.cs" />
    95     <Compile Include="Interfaces\IPreprocessingData.cs" />
    96     <Compile Include="Interfaces\IDataGridLogic.cs" />
    97     <Compile Include="Implementations\FilterContent.cs" />
    98     <Compile Include="Implementations\FilterLogic.cs" />
    99     <Compile Include="Implementations\HistogramContent.cs" />
    100     <Compile Include="Implementations\LineChartContent.cs" />
    101     <Compile Include="Implementations\StatisticsContent.cs" />
    102     <Compile Include="Implementations\TransformationContent.cs" />
    103     <Compile Include="Interfaces\IFilterLogic.cs" />
    104     <Compile Include="Interfaces\IManipulationLogic.cs" />
    105     <Compile Include="Interfaces\ITransformationLogic.cs" />
    106     <Compile Include="Interfaces\IViewShortcut.cs" />
     91    <Compile Include="Data\DataPreprocessingChangedEvent.cs" />
     92    <Compile Include="Logic\Filter\ComparisonFilter.cs" />
     93    <Compile Include="Logic\Filter\IFilter.cs" />
     94    <Compile Include="Logic\ManipulationLogic.cs" />
     95    <Compile Include="Data\IPreprocessingData.cs" />
     96    <Compile Include="Content\FilterContent.cs" />
     97    <Compile Include="Logic\FilterLogic.cs" />
     98    <Compile Include="Content\HistogramContent.cs" />
     99    <Compile Include="Content\LineChartContent.cs" />
     100    <Compile Include="Content\StatisticsContent.cs" />
     101    <Compile Include="Content\TransformationContent.cs" />
     102    <Compile Include="Content\IViewShortcut.cs" />
    107103    <Compile Include="ProblemDataCreator.cs" />
    108104    <None Include="Plugin.cs.frame" />
    109     <Compile Include="Implementations\DataGridContent.cs" />
    110     <Compile Include="Implementations\PreprocessingContext.cs" />
    111     <Compile Include="Implementations\TransactionalPreprocessingData.cs" />
    112     <Compile Include="Implementations\SearchLogic.cs" />
    113     <Compile Include="Implementations\StatisticsLogic.cs" />
    114     <Compile Include="Interfaces\IDataGridContent.cs" />
    115     <Compile Include="Interfaces\IPreprocessingContext.cs" />
    116     <Compile Include="Interfaces\ISearchLogic.cs" />
    117     <Compile Include="Interfaces\IStatisticsLogic.cs" />
    118     <Compile Include="Interfaces\ITransactionalPreprocessingData.cs" />
     105    <Compile Include="Content\DataGridContent.cs" />
     106    <Compile Include="PreprocessingContext.cs" />
     107    <Compile Include="Data\TransactionalPreprocessingData.cs" />
     108    <Compile Include="Logic\SearchLogic.cs" />
     109    <Compile Include="Logic\StatisticsLogic.cs" />
     110    <Compile Include="Data\ITransactionalPreprocessingData.cs" />
    119111    <Compile Include="Plugin.cs" />
    120112    <Compile Include="Properties\AssemblyInfo.cs" />
     
    160152      <Private>False</Private>
    161153    </ProjectReference>
     154    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
     155      <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
     156      <Name>HeuristicLab.Persistence-3.3</Name>
     157      <Private>False</Private>
     158    </ProjectReference>
    162159    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
    163160      <Project>{94186a6a-5176-4402-ae83-886557b53cca}</Project>
  • stable/HeuristicLab.DataPreprocessing/3.4/Plugin.cs.frame

    r13316 r14075  
    3535  [PluginDependency("HeuristicLab.Data","3.3")]
    3636  [PluginDependency("HeuristicLab.Optimization", "3.3")]
     37  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    3738  [PluginDependency("HeuristicLab.Problems.DataAnalysis","3.4")]
    3839  public class HeuristicLabDataPreprocessingPlugin : PluginBase {
  • stable/HeuristicLab.DataPreprocessing/3.4/PreprocessingContext.cs

    r13502 r14075  
    3030namespace HeuristicLab.DataPreprocessing {
    3131  [Item("PreprocessingContext", "PreprocessingContext")]
     32  [StorableClass]
    3233  public class PreprocessingContext : NamedItem, IStorableContent {
    3334
    3435    public string Filename { get; set; }
    35 
    36     public IEnumerable<KeyValuePair<string, Func<IItem>>> ExportPossibilities {
    37       get {
    38         var algorithm = Source as IAlgorithm;
    39         if (algorithm != null)
    40           yield return new KeyValuePair<string, Func<IItem>>(algorithm.Name, () => ExportAlgorithm(algorithm));
    41 
    42         var problem = algorithm != null ? algorithm.Problem as IDataAnalysisProblem : Source as IDataAnalysisProblem;
    43         if (problem != null)
    44           yield return new KeyValuePair<string, Func<IItem>>(problem.Name, () => ExportProblem(problem));
    45 
    46         var problemData = problem != null ? problem.ProblemData : Source as IDataAnalysisProblemData;
    47         if (problemData != null)
    48           yield return new KeyValuePair<string, Func<IItem>>(problemData.Name, () => ExportProblemData(problemData));
    49 
    50         // ToDo: Export CSV
    51       }
    52     }
    53     public bool CanExport {
    54       get { return Source is IAlgorithm || Source is IDataAnalysisProblem || Source is IDataAnalysisProblemData; }
    55     }
    5636
    5737    [Storable]
     
    6141    private IItem Source { get; set; }
    6242
     43    public event EventHandler Reset;
    6344
    64     public PreprocessingContext() : this(new RegressionProblemData()) { }
    65     public PreprocessingContext(IItem source) {
    66       Import(source);
    67 
     45    #region Constructors
     46    public PreprocessingContext(IDataAnalysisProblemData problemData, IItem source = null)
     47      : base("Data Preprocessing") {
     48      if (problemData == null) throw new ArgumentNullException("problemData");
     49      Import(problemData, source);
    6850    }
    6951
    7052    [StorableConstructor]
    71     private PreprocessingContext(bool deserializing)
     53    protected PreprocessingContext(bool deserializing)
    7254      : base(deserializing) { }
    7355    protected PreprocessingContext(PreprocessingContext original, Cloner cloner)
     
    7658      Data = cloner.Clone(original.Data);
    7759    }
    78 
    7960    public override IDeepCloneable Clone(Cloner cloner) {
    8061      return new PreprocessingContext(this, cloner);
    8162    }
     63    #endregion
    8264
    8365    #region Import
    84     public void Import(IItem source) {
    85       Source = source;
    86 
    87       var dataSource = ExtractProblemData(source);
    88       Data = new FilteredPreprocessingData(new TransactionalPreprocessingData(dataSource));
     66    public void Import(IDataAnalysisProblemData problemData, IItem source = null) {
     67      if (problemData == null) throw new ArgumentNullException("problemData");
     68      if (source != null && ExtractProblemData(source) != problemData)
     69        throw new ArgumentException("The ProblemData extracted from the Source is different than the given ProblemData.");
     70      Source = source ?? problemData;
     71      var namedSource = Source as INamedItem;
     72      if (namedSource != null)
     73        Name = "Preprocessing " + namedSource.Name;
     74      Data = new FilteredPreprocessingData(new TransactionalPreprocessingData(problemData));
     75      OnReset();
     76      // Reset GUI:
     77      // - OnContentChanged for PreprocessingView!
     78      // event? task(async import)?
    8979    }
    90 
    9180    private IDataAnalysisProblemData ExtractProblemData(IItem source) {
    9281      var algorithm = source as Algorithm;
     
    9887
    9988    #region Export
    100     public IItem Export() {
    101       var creator = new ProblemDataCreator(this);
    102       if (Source is IAlgorithm)
    103         return ExportAlgorithm((IAlgorithm)Source);
    104       if (Source is IDataAnalysisProblem)
    105         return ExportProblem((IDataAnalysisProblem)Source);
    106       if (Source is IDataAnalysisProblemData)
    107         return ExportProblemData((IDataAnalysisProblemData)Source);
    108       return null;
     89    public bool CanExport {
     90      get { return Source is IAlgorithm || Source is IDataAnalysisProblem || Source is IDataAnalysisProblemData; }
    10991    }
     92    public IEnumerable<KeyValuePair<string, Func<IItem>>> GetSourceExportOptions() {
     93      var algorithm = Source as IAlgorithm;
     94      if (algorithm != null)
     95        yield return new KeyValuePair<string, Func<IItem>>(
     96          algorithm.GetType().GetPrettyName(),
     97          () => ExportAlgorithm(algorithm));
     98
     99      var problem = algorithm != null ? algorithm.Problem as IDataAnalysisProblem : Source as IDataAnalysisProblem;
     100      if (problem != null)
     101        yield return new KeyValuePair<string, Func<IItem>>(
     102          problem.GetType().GetPrettyName(),
     103          () => ExportProblem(problem));
     104
     105      var problemData = problem != null ? problem.ProblemData : Source as IDataAnalysisProblemData;
     106      if (problemData != null)
     107        yield return new KeyValuePair<string, Func<IItem>>(
     108          problemData.GetType().GetPrettyName(),
     109          () => ExportProblemData(problemData));
     110    }
     111
    110112    private IAlgorithm ExportAlgorithm(IAlgorithm source) {
    111113      var preprocessedAlgorithm = (IAlgorithm)source.Clone();
     
    113115      preprocessedAlgorithm.Runs.Clear();
    114116      var problem = (IDataAnalysisProblem)preprocessedAlgorithm.Problem;
    115       SetNewProblemData(problem);
     117      problem.ProblemDataParameter.ActualValue = CreateNewProblemData();
    116118      return preprocessedAlgorithm;
    117119    }
    118120    private IDataAnalysisProblem ExportProblem(IDataAnalysisProblem source) {
    119121      var preprocessedProblem = (IDataAnalysisProblem)source.Clone();
    120       SetNewProblemData(preprocessedProblem);
     122      preprocessedProblem.ProblemDataParameter.ActualValue = CreateNewProblemData();
    121123      return preprocessedProblem;
    122124    }
    123125    private IDataAnalysisProblemData ExportProblemData(IDataAnalysisProblemData source) {
     126      return CreateNewProblemData();
     127    }
     128
     129    public IDataAnalysisProblemData CreateNewProblemData() {
    124130      var creator = new ProblemDataCreator(this);
    125       return creator.CreateProblemData(source);
    126     }
    127     private void SetNewProblemData(IDataAnalysisProblem problem) {
    128       var data = ExtractProblemData(problem.ProblemData);
    129       problem.ProblemDataParameter.ActualValue = data;
    130       problem.Name = "Preprocessed " + problem.Name;
     131      var oldProblemData = ExtractProblemData(Source);
     132      var newProblemData = creator.CreateProblemData(oldProblemData);
     133      newProblemData.Name = "Preprocessed " + oldProblemData.Name;
     134      return newProblemData;
    131135    }
    132136    #endregion
     137
     138    protected virtual void OnReset() {
     139      if (Reset != null)
     140        Reset(this, EventArgs.Empty);
     141    }
    133142  }
    134143}
  • stable/HeuristicLab.DataPreprocessing/3.4/ProblemDataCreator.cs

    r13289 r14075  
    2929  public class ProblemDataCreator {
    3030
    31     private readonly IPreprocessingContext context;
     31    private readonly PreprocessingContext context;
    3232
    3333    private Dataset ExportedDataset {
     
    3939    private IList<ITransformation> Transformations { get { return context.Data.Transformations; } }
    4040
    41     public ProblemDataCreator(IPreprocessingContext context) {
     41    public ProblemDataCreator(PreprocessingContext context) {
    4242      this.context = context;
    4343    }
    4444
    45     public IDataAnalysisProblemData CreateProblemData() {
     45    public IDataAnalysisProblemData CreateProblemData(IDataAnalysisProblemData oldProblemData) {
    4646      if (context.Data.Rows == 0 || context.Data.Columns == 0) return null;
    4747
    48       var oldProblemData = context.ProblemData;
    4948      IDataAnalysisProblemData problemData;
    5049
    51       if (oldProblemData is RegressionProblemData) {
     50      if (oldProblemData is TimeSeriesPrognosisProblemData) {
     51        problemData = CreateTimeSeriesPrognosisData((TimeSeriesPrognosisProblemData)oldProblemData);
     52      } else if (oldProblemData is RegressionProblemData) {
    5253        problemData = CreateRegressionData((RegressionProblemData)oldProblemData);
    5354      } else if (oldProblemData is ClassificationProblemData) {
     
    7071    }
    7172
     73    private IDataAnalysisProblemData CreateTimeSeriesPrognosisData(TimeSeriesPrognosisProblemData oldProblemData) {
     74      var targetVariable = oldProblemData.TargetVariable;
     75      if (!context.Data.VariableNames.Contains(targetVariable))
     76        targetVariable = context.Data.VariableNames.First();
     77      var inputVariables = GetDoubleInputVariables(targetVariable);
     78      var newProblemData = new TimeSeriesPrognosisProblemData(ExportedDataset, inputVariables, targetVariable, Transformations) {
     79        TrainingHorizon = oldProblemData.TrainingHorizon,
     80        TestHorizon = oldProblemData.TestHorizon
     81      };
     82      return newProblemData;
     83    }
     84
    7285    private IDataAnalysisProblemData CreateRegressionData(RegressionProblemData oldProblemData) {
    7386      var targetVariable = oldProblemData.TargetVariable;
     
    8497        targetVariable = context.Data.VariableNames.First();
    8598      var inputVariables = GetDoubleInputVariables(targetVariable);
    86       var newProblemData = new ClassificationProblemData(ExportedDataset, inputVariables, targetVariable, Transformations);
    87       newProblemData.PositiveClass = oldProblemData.PositiveClass;
     99      var newProblemData = new ClassificationProblemData(ExportedDataset, inputVariables, targetVariable, Transformations) {
     100        PositiveClass = oldProblemData.PositiveClass
     101      };
    88102      return newProblemData;
    89103    }
Note: See TracChangeset for help on using the changeset viewer.