Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10916


Ignore:
Timestamp:
05/28/14 15:34:34 (10 years ago)
Author:
rstoll
Message:
  • Fixed FindAll -> selection was very slow, CopyOfStringConvertibleMatrix had registered an event as well which slowed down everything (more or less)
Location:
branches/DataPreprocessing
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab 3.3.sln

    r10766 r10916  
    11
    22Microsoft Visual Studio Solution File, Format Version 12.00
    3 # Visual Studio 2013
    4 VisualStudioVersion = 12.0.30110.0
    5 MinimumVisualStudioVersion = 10.0.40219.1
     3# Visual Studio 2012
    64Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{96396439-A764-4022-A8D2-BE021449B8D1}"
    75  ProjectSection(SolutionItems) = preProject
     
    108    ..\documentation\License\gpl-3.0.txt = ..\documentation\License\gpl-3.0.txt
    119    MergeConfigs.cmd = MergeConfigs.cmd
     10    Performance1.psess = Performance1.psess
    1211    PreBuildEvent.cmd = PreBuildEvent.cmd
    1312  EndProjectSection
     
    19221921    HideSolutionNode = FALSE
    19231922  EndGlobalSection
     1923  GlobalSection(Performance) = preSolution
     1924    HasPerformanceSessions = true
     1925  EndGlobalSection
    19241926EndGlobal
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/CopyOfStringConvertibleMatrixView.cs

    r10691 r10916  
    7979    }
    8080
     81    // Was private before
     82    protected virtual void dataGridView_SelectionChanged(object sender, EventArgs e) {
     83      string stringFormat = "{0,20:0.0000}";
     84      statisticsTextBox.Text = string.Empty;
     85      if (dataGridView.SelectedCells.Count > 1) {
     86        List<double> selectedValues = new List<double>();
     87        foreach (DataGridViewCell cell in dataGridView.SelectedCells) {
     88          double value;
     89          if (!double.TryParse(cell.Value.ToString(), out value)) return;
     90          selectedValues.Add(value);
     91        }
     92        if (selectedValues.Count > 1) {
     93          StringBuilder labelText = new StringBuilder();
     94          labelText.Append("Count: " + string.Format(stringFormat, selectedValues.Count) + "    ");
     95          labelText.Append("Sum: " + string.Format(stringFormat, selectedValues.Sum()) + "    ");
     96          labelText.Append("Min: " + string.Format(stringFormat, selectedValues.Min()) + "    ");
     97          labelText.Append("Max: " + string.Format(stringFormat, selectedValues.Max()) + "    ");
     98          labelText.Append("Average: " + string.Format(stringFormat, selectedValues.Average()) + "    ");
     99          labelText.Append("Standard Deviation: " + string.Format(stringFormat, selectedValues.StandardDeviation()) + "    ");
     100
     101          statisticsTextBox.Text = labelText.ToString();
     102        }
     103      }
     104    }
     105
    81106    #region unchanged copied from original - see  HeuristicLab.Data.Views.StringConvertibleMatrix
    82107
     
    572597    }
    573598
    574     private void dataGridView_SelectionChanged(object sender, EventArgs e) {
    575       string stringFormat = "{0,20:0.0000}";
    576       statisticsTextBox.Text = string.Empty;
    577       if (dataGridView.SelectedCells.Count > 1) {
    578         List<double> selectedValues = new List<double>();
    579         foreach (DataGridViewCell cell in dataGridView.SelectedCells) {
    580           double value;
    581           if (!double.TryParse(cell.Value.ToString(), out value)) return;
    582           selectedValues.Add(value);
    583         }
    584         if (selectedValues.Count > 1) {
    585           StringBuilder labelText = new StringBuilder();
    586           labelText.Append("Count: " + string.Format(stringFormat, selectedValues.Count) + "    ");
    587           labelText.Append("Sum: " + string.Format(stringFormat, selectedValues.Sum()) + "    ");
    588           labelText.Append("Min: " + string.Format(stringFormat, selectedValues.Min()) + "    ");
    589           labelText.Append("Max: " + string.Format(stringFormat, selectedValues.Max()) + "    ");
    590           labelText.Append("Average: " + string.Format(stringFormat, selectedValues.Average()) + "    ");
    591           labelText.Append("Standard Deviation: " + string.Format(stringFormat, selectedValues.StandardDeviation()) + "    ");
    592 
    593           statisticsTextBox.Text = labelText.ToString();
    594         }
    595       }
    596     }
     599   
    597600  }
    598601    #endregion
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataGridContentView.cs

    r10911 r10916  
    7474      _highlightedCellsBackground = new Dictionary<int, IList<int>>();
    7575      currentCell = null;
    76       DataGridView.SelectionChanged += DataGridView_SelectionChanged;
    77     }
    78 
    79     void DataGridView_SelectionChanged(object sender, EventArgs e) {
    80       if (!isSearching && Content != null) {
    81         Content.DataGridLogic.SetSelection(GetSelectedCells());
     76    }
     77
     78    protected override void dataGridView_SelectionChanged(object sender, EventArgs e) {
     79      if (Content != null) {
     80        if (!isSearching) {
     81          base.dataGridView_SelectionChanged(sender, e);
     82          Content.DataGridLogic.SetSelection(GetSelectedCells());
     83        }
    8284      }
    8385    }
     
    103105      OnContentChanged();
    104106      searchIterator = null;
    105     }   
     107    }
    106108
    107109    protected override void DeregisterContentEvents() {
     
    129131      if (!dataGridView.ReadOnly) {
    130132        string errorMessage;
    131         if (Content != null){
     133        if (Content != null) {
    132134          if (dataGridView.IsCurrentCellInEditMode && Content.FilterLogic.IsFiltered()) {
    133135            errorMessage = "A filter is active, you cannot modify data. Press ESC to exit edit mode.";
     
    192194    }
    193195
    194     void DataGridView_SelectionChanged_FindAndReplace(object sender, EventArgs e) {
     196    private void DataGridView_SelectionChanged_FindAndReplace(object sender, EventArgs e) {
    195197      if (Content != null) {
    196198        if (!isSearching && AreMultipleCellsSelected()) {
     
    276278      isSearching = true;
    277279      SuspendRepaint();
    278       foreach (var column in FindAll(findAndReplaceDialog.GetSearchText())) {
     280      var selectedCells = FindAll(findAndReplaceDialog.GetSearchText());
     281      foreach (var column in selectedCells) {
    279282        foreach (var cell in column.Value) {
    280283          dataGridView[column.Key, cell].Selected = true;
     
    283286      ResumeRepaint(true);
    284287      isSearching = false;
    285       DataGridView_SelectionChanged(null, null);
     288      Content.DataGridLogic.SetSelection(selectedCells);
     289      //update statistic in base
     290      base.dataGridView_SelectionChanged(sender, e);
    286291    }
    287292
Note: See TracChangeset for help on using the changeset viewer.