Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/08/15 12:53:55 (9 years ago)
Author:
mkommend
Message:

#2335: Merged changes into trunk.

Location:
trunk/sources/HeuristicLab.Data.Views
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data.Views

    • Property svn:mergeinfo set to (toggle deleted branches)
      /branches/DataPreprocessingImprovements/HeuristicLab.Data.Viewsmergedeligible
      /branches/HLScript/HeuristicLab.Data.Viewsmergedeligible
      /stable/HeuristicLab.Data.Viewsmergedeligible
      /branches/1721-RandomForestPersistence/HeuristicLab.Data.Views10321-10322
      /branches/Algorithms.GradientDescent/HeuristicLab.Data.Views5516-5520
      /branches/Benchmarking/sources/HeuristicLab.Data.Views6917-7005
      /branches/CloningRefactoring/HeuristicLab.Data.Views4656-4721
      /branches/CodeEditor/HeuristicLab.Data.Views11700-11806
      /branches/DataAnalysis Refactoring/HeuristicLab.Data.Views5471-5808
      /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Data.Views5815-6180
      /branches/DataAnalysis/HeuristicLab.Data.Views4458-4459,​4462,​4464
      /branches/DataPreprocessing/HeuristicLab.Data.Views10085-11101
      /branches/GP.Grammar.Editor/HeuristicLab.Data.Views6284-6795
      /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Data.Views5060
      /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Data.Views6123-9799
      /branches/LogResidualEvaluator/HeuristicLab.Data.Views10202-10483
      /branches/NET40/sources/HeuristicLab.Data.Views5138-5162
      /branches/NSGA-II Changes/HeuristicLab.Data.Views12033-12122
      /branches/ParallelEngine/HeuristicLab.Data.Views5175-5192
      /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Data.Views7568-7810
      /branches/QAPAlgorithms/HeuristicLab.Data.Views6350-6627
      /branches/Restructure trunk solution/HeuristicLab.Data.Views6828
      /branches/RuntimeOptimizer/HeuristicLab.Data.Views8943-9078
      /branches/ScatterSearch (trunk integration)/HeuristicLab.Data.Views7787-8333
      /branches/SlaveShutdown/HeuristicLab.Data.Views8944-8956
      /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Data.Views10204-10479
      /branches/SuccessProgressAnalysis/HeuristicLab.Data.Views5370-5682
      /branches/Trunk/HeuristicLab.Data.Views6829-6865
      /branches/UnloadJobs/HeuristicLab.Data.Views9168-9215
      /branches/VNS/HeuristicLab.Data.Views5594-5752
      /branches/histogram/HeuristicLab.Data.Views5959-6341
  • trunk/sources/HeuristicLab.Data.Views/3.3

  • trunk/sources/HeuristicLab.Data.Views/3.3/HeuristicLab.Data.Views-3.3.csproj

    r12602 r12676  
    4141    <DebugType>full</DebugType>
    4242    <Optimize>false</Optimize>
    43     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     43    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    4444    <DefineConstants>DEBUG;TRACE</DefineConstants>
    4545    <ErrorReport>prompt</ErrorReport>
     
    105105  </PropertyGroup>
    106106  <ItemGroup>
     107    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     108      <SpecificVersion>False</SpecificVersion>
     109      <HintPath>..\..\..\..\..\..\HL Preprocessing\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
     110    </Reference>
     111    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     112      <SpecificVersion>False</SpecificVersion>
     113      <HintPath>..\..\..\..\..\..\HL Preprocessing\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
     114    </Reference>
     115    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     116      <SpecificVersion>False</SpecificVersion>
     117      <HintPath>..\..\..\..\..\..\HL Preprocessing\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
     118    </Reference>
     119    <Reference Include="HeuristicLab.Core.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     120      <SpecificVersion>False</SpecificVersion>
     121      <HintPath>..\..\..\..\..\..\HL Preprocessing\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
     122    </Reference>
     123    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     124      <SpecificVersion>False</SpecificVersion>
     125      <HintPath>..\..\..\..\..\..\HL Preprocessing\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     126    </Reference>
     127    <Reference Include="HeuristicLab.MainForm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     128      <SpecificVersion>False</SpecificVersion>
     129      <HintPath>..\..\..\..\..\..\HL Preprocessing\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
     130    </Reference>
     131    <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     132      <SpecificVersion>False</SpecificVersion>
     133      <HintPath>..\..\..\..\..\..\HL Preprocessing\trunk\sources\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>
     134    </Reference>
     135    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     136      <SpecificVersion>False</SpecificVersion>
     137      <HintPath>..\..\..\..\..\..\HL Preprocessing\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
     138    </Reference>
    107139    <Reference Include="System" />
    108140    <Reference Include="System.Core">
     
    230262    <None Include="HeuristicLab.snk" />
    231263    <None Include="Properties\AssemblyInfo.cs.frame" />
    232   </ItemGroup>
    233   <ItemGroup>
    234     <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
    235       <Project>{0e27a536-1c4a-4624-a65e-dc4f4f23e3e1}</Project>
    236       <Name>HeuristicLab.Common.Resources-3.3</Name>
    237       <Private>False</Private>
    238     </ProjectReference>
    239     <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    240       <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
    241       <Name>HeuristicLab.Common-3.3</Name>
    242       <Private>False</Private>
    243     </ProjectReference>
    244     <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">
    245       <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project>
    246       <Name>HeuristicLab.Core.Views-3.3</Name>
    247       <Private>False</Private>
    248     </ProjectReference>
    249     <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
    250       <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
    251       <Name>HeuristicLab.Core-3.3</Name>
    252       <Private>False</Private>
    253     </ProjectReference>
    254     <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
    255       <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
    256       <Name>HeuristicLab.Data-3.3</Name>
    257       <Private>False</Private>
    258     </ProjectReference>
    259     <ProjectReference Include="..\..\HeuristicLab.MainForm.WindowsForms\3.3\HeuristicLab.MainForm.WindowsForms-3.3.csproj">
    260       <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>
    261       <Name>HeuristicLab.MainForm.WindowsForms-3.3</Name>
    262       <Private>False</Private>
    263     </ProjectReference>
    264     <ProjectReference Include="..\..\HeuristicLab.MainForm\3.3\HeuristicLab.MainForm-3.3.csproj">
    265       <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project>
    266       <Name>HeuristicLab.MainForm-3.3</Name>
    267       <Private>False</Private>
    268     </ProjectReference>
    269     <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
    270       <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
    271       <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
    272       <Private>False</Private>
    273     </ProjectReference>
    274264  </ItemGroup>
    275265  <ItemGroup>
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r12151 r12676  
    109109        dataGridView.Columns.Clear();
    110110        virtualRowIndices = new int[0];
    111       } else
     111      } else if (!dataGridView.IsCurrentCellInEditMode) {
    112112        UpdateData();
     113      }
    113114    }
    114115
     
    295296    }
    296297
    297     private void dataGridView_KeyDown(object sender, KeyEventArgs e) {
     298    protected virtual void dataGridView_KeyDown(object sender, KeyEventArgs e) {
    298299      if (!ReadOnly && e.Control && e.KeyCode == Keys.V)
    299300        PasteValuesToDataGridView();
     
    398399    }
    399400
    400     private void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
     401    protected virtual void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
    401402      if (Content != null) {
    402403        if (e.Button == MouseButtons.Left && Content.SortableView) {
    403           bool addToSortedIndices = (Control.ModifierKeys & Keys.Control) == Keys.Control;
    404           SortOrder newSortOrder = SortOrder.Ascending;
    405           if (sortedColumnIndices.Any(x => x.Key == e.ColumnIndex)) {
    406             SortOrder oldSortOrder = sortedColumnIndices.Where(x => x.Key == e.ColumnIndex).First().Value;
    407             int enumLength = Enum.GetValues(typeof(SortOrder)).Length;
    408             newSortOrder = oldSortOrder = (SortOrder)Enum.Parse(typeof(SortOrder), ((((int)oldSortOrder) + 1) % enumLength).ToString());
    409           }
    410 
    411           if (!addToSortedIndices)
    412             sortedColumnIndices.Clear();
    413 
    414           if (sortedColumnIndices.Any(x => x.Key == e.ColumnIndex)) {
    415             int sortedIndex = sortedColumnIndices.FindIndex(x => x.Key == e.ColumnIndex);
    416             if (newSortOrder != SortOrder.None)
    417               sortedColumnIndices[sortedIndex] = new KeyValuePair<int, SortOrder>(e.ColumnIndex, newSortOrder);
    418             else
    419               sortedColumnIndices.RemoveAt(sortedIndex);
    420           } else
    421             if (newSortOrder != SortOrder.None)
    422               sortedColumnIndices.Add(new KeyValuePair<int, SortOrder>(e.ColumnIndex, newSortOrder));
    423           Sort();
     404          SortColumn(e.ColumnIndex);
    424405        }
    425406      }
     
    438419      dataGridView.Invalidate();
    439420    }
     421
     422    protected virtual void SortColumn(int columnIndex) {
     423      bool addToSortedIndices = (Control.ModifierKeys & Keys.Control) == Keys.Control;
     424      SortOrder newSortOrder = SortOrder.Ascending;
     425      if (sortedColumnIndices.Any(x => x.Key == columnIndex)) {
     426        SortOrder oldSortOrder = sortedColumnIndices.Where(x => x.Key == columnIndex).First().Value;
     427        int enumLength = Enum.GetValues(typeof(SortOrder)).Length;
     428        newSortOrder = oldSortOrder = (SortOrder)Enum.Parse(typeof(SortOrder), ((((int)oldSortOrder) + 1) % enumLength).ToString());
     429      }
     430
     431      if (!addToSortedIndices)
     432        sortedColumnIndices.Clear();
     433
     434      if (sortedColumnIndices.Any(x => x.Key == columnIndex)) {
     435        int sortedIndex = sortedColumnIndices.FindIndex(x => x.Key == columnIndex);
     436        if (newSortOrder != SortOrder.None)
     437          sortedColumnIndices[sortedIndex] = new KeyValuePair<int, SortOrder>(columnIndex, newSortOrder);
     438        else
     439          sortedColumnIndices.RemoveAt(sortedIndex);
     440      } else
     441        if (newSortOrder != SortOrder.None)
     442          sortedColumnIndices.Add(new KeyValuePair<int, SortOrder>(columnIndex, newSortOrder));
     443      Sort();
     444    }
     445
    440446    protected virtual int[] Sort(IEnumerable<KeyValuePair<int, SortOrder>> sortedColumns) {
    441447      int[] newSortedIndex = Enumerable.Range(0, Content.Rows).ToArray();
     
    510516    }
    511517
    512     private void dataGridView_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) {
     518    protected virtual void dataGridView_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) {
    513519      if (Content == null) return;
    514520      if (e.Button == MouseButtons.Right && Content.ColumnNames.Count() != 0)
     
    543549
    544550    protected virtual void dataGridView_SelectionChanged(object sender, EventArgs e) {
    545       string stringFormat = "{0,20:0.0000}";
    546551      statisticsTextBox.Text = string.Empty;
    547552      if (dataGridView.SelectedCells.Count > 1) {
     
    553558        }
    554559        if (selectedValues.Count > 1) {
    555           StringBuilder labelText = new StringBuilder();
    556           labelText.Append("Count: " + string.Format(stringFormat, selectedValues.Count) + "    ");
    557           labelText.Append("Sum: " + string.Format(stringFormat, selectedValues.Sum()) + "    ");
    558           labelText.Append("Min: " + string.Format(stringFormat, selectedValues.Min()) + "    ");
    559           labelText.Append("Max: " + string.Format(stringFormat, selectedValues.Max()) + "    ");
    560           labelText.Append("Average: " + string.Format(stringFormat, selectedValues.Average()) + "    ");
    561           labelText.Append("Standard Deviation: " + string.Format(stringFormat, selectedValues.StandardDeviation()) + "    ");
    562 
    563           statisticsTextBox.Text = labelText.ToString();
    564         }
    565       }
     560          statisticsTextBox.Text = CreateStatisticsText(selectedValues);
     561        }
     562      }
     563    }
     564
     565    protected virtual string CreateStatisticsText(ICollection<double> values) {
     566      string stringFormat = "{0,20:0.0000}";
     567      int overallCount = values.Count;
     568      values = values.Where(x => !double.IsNaN(x)).ToList();
     569      if (!values.Any()) {
     570        return "";
     571      }
     572      StringBuilder statisticsText = new StringBuilder();
     573      statisticsText.Append("Count: " + values.Count + "    ");
     574      statisticsText.Append("Sum: " + string.Format(stringFormat, values.Sum()) + "    ");
     575      statisticsText.Append("Min: " + string.Format(stringFormat, values.Min()) + "    ");
     576      statisticsText.Append("Max: " + string.Format(stringFormat, values.Max()) + "    ");
     577      statisticsText.Append("Average: " + string.Format(stringFormat, values.Average()) + "    ");
     578      statisticsText.Append("Standard Deviation: " + string.Format(stringFormat, values.StandardDeviation()) + "    ");
     579      if (overallCount > 0)
     580        statisticsText.Append("Missing Values: " + string.Format(stringFormat, ((overallCount - values.Count) / (double)overallCount) * 100) + "%    ");
     581      return statisticsText.ToString();
    566582    }
    567583  }
Note: See TracChangeset for help on using the changeset viewer.