Changeset 9973
- Timestamp:
- 09/16/13 18:52:52 (11 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 added
- 10 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/SymbolicClassificationSolutionView.Designer.cs
r9456 r9973 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SymbolicDiscriminantFunctionClassificationSolutionView));48 47 this.btnSimplify = new System.Windows.Forms.Button(); 49 48 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); … … 54 53 this.detailsGroupBox.SuspendLayout(); 55 54 this.SuspendLayout(); 55 exportButton.Visible = false; 56 56 // 57 57 // splitContainer -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/SymbolicDiscriminantFunctionClassificationSolutionView.Designer.cs
r9456 r9973 54 54 this.detailsGroupBox.SuspendLayout(); 55 55 this.SuspendLayout(); 56 exportButton.Visible = false; 56 57 // 57 58 // splitContainer -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionSolutionView.Designer.cs
r9456 r9973 60 60 // 61 61 this.splitContainer.Panel1.Controls.Add(this.btnSimplify); 62 this.splitContainer.Size = new System.Drawing.Size(480, 275);63 this.splitContainer.SplitterDistance = 255;64 //65 // itemsGroupBox66 //67 this.itemsGroupBox.Size = new System.Drawing.Size(486, 294);68 //69 // itemsListView70 //71 this.itemsListView.Size = new System.Drawing.Size(249, 238);72 //73 // detailsGroupBox74 //75 this.detailsGroupBox.Size = new System.Drawing.Size(215, 246);76 62 // 77 63 // addButton … … 83 69 this.toolTip.SetToolTip(this.removeButton, "Remove"); 84 70 // 85 // viewHost86 //87 this.viewHost.Size = new System.Drawing.Size(203, 221);88 //89 71 // btnSimplify 90 72 // 91 73 this.btnSimplify.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 92 this.btnSimplify.Location = new System.Drawing.Point(17 7, 4);74 this.btnSimplify.Location = new System.Drawing.Point(172, 4); 93 75 this.btnSimplify.Name = "btnSimplify"; 94 76 this.btnSimplify.Size = new System.Drawing.Size(75, 23); … … 100 82 // SymbolicRegressionSolutionView 101 83 // 102 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);103 84 this.Name = "SymbolicRegressionSolutionView"; 104 85 this.Size = new System.Drawing.Size(486, 294); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis.Views/3.4/SymbolicTimeSeriesPrognosisSolutionView.Designer.cs
r9456 r9973 54 54 this.SuspendLayout(); 55 55 // 56 // exportButton 57 // 58 this.exportButton.Visible = false; 59 // 56 60 // splitContainer 57 61 // … … 60 64 // 61 65 this.splitContainer.Panel1.Controls.Add(this.btnSimplify); 62 this.splitContainer.Size = new System.Drawing.Size(480, 275);63 this.splitContainer.SplitterDistance = 255;64 //65 // itemsGroupBox66 //67 this.itemsGroupBox.Size = new System.Drawing.Size(486, 294);68 //69 // itemsListView70 //71 this.itemsListView.Size = new System.Drawing.Size(249, 238);72 //73 // detailsGroupBox74 //75 this.detailsGroupBox.Size = new System.Drawing.Size(215, 246);76 66 // 77 67 // addButton … … 83 73 this.toolTip.SetToolTip(this.removeButton, "Remove"); 84 74 // 85 // viewHost86 //87 this.viewHost.Size = new System.Drawing.Size(203, 221);88 //89 75 // btnSimplify 90 76 // 91 77 this.btnSimplify.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 92 this.btnSimplify.Location = new System.Drawing.Point(17 7, 4);78 this.btnSimplify.Location = new System.Drawing.Point(172, 4); 93 79 this.btnSimplify.Name = "btnSimplify"; 94 80 this.btnSimplify.Size = new System.Drawing.Size(75, 23); … … 100 86 // SymbolicTimeSeriesPrognosisSolutionView 101 87 // 102 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);103 88 this.Name = "SymbolicTimeSeriesPrognosisSolutionView"; 104 this.Size = new System.Drawing.Size(486, 294);105 89 this.splitContainer.Panel1.ResumeLayout(false); 106 90 this.splitContainer.Panel2.ResumeLayout(false); … … 110 94 this.detailsGroupBox.ResumeLayout(false); 111 95 this.ResumeLayout(false); 96 112 97 } 113 98 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Exporters/SymbolicSolutionExcelExporter.cs
r9937 r9973 34 34 35 35 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 36 public class ExportSymbolicSolutionToExcelMenuItem : MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {36 public class SymbolicSolutionExcelExporter : IDataAnalysisSolutionExporter { 37 37 private const string TRAININGSTART = "TrainingStart"; 38 38 private const string TRAININGEND = "TrainingEnd"; … … 40 40 private const string TESTEND = "TestEnd"; 41 41 42 public override string Name { 43 get { return "Export Symbolic Solution To Excel"; } 44 } 45 public override IEnumerable<string> Structure { 46 get { return new string[] { "&Data Analysis" }; } 47 } 48 public override int Position { 49 get { return 5200; } 50 } 51 public override string ToolTipText { 52 get { return "Create excel file of symbolic data analysis solutions."; } 53 } 54 55 protected override void OnToolStripItemSet(EventArgs e) { 56 base.OnToolStripItemSet(e); 57 ToolStripItem.Enabled = false; 58 var menuItem = ToolStripItem.OwnerItem as ToolStripMenuItem; 59 if (menuItem != null) 60 menuItem.DropDownOpening += menuItem_DropDownOpening; 61 } 62 63 private void menuItem_DropDownOpening(object sender, EventArgs e) { 64 IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView; 65 Control control = activeView as Control; 66 activeView = control.GetNestedControls((c) => c.Visible) 67 .OfType<IContentView>().FirstOrDefault(v => v.Content is ISymbolicDataAnalysisSolution && v.Content is IRegressionSolution); 68 ToolStripItem.Enabled = activeView != null; 69 } 70 71 public override void Execute() { 72 IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView; 73 Control control = activeView as Control; 74 activeView = control.GetNestedControls((c) => c.Visible) 75 .OfType<IContentView>().First(v => v.Content is ISymbolicDataAnalysisSolution && v.Content is IRegressionSolution); 76 var solution = (ISymbolicDataAnalysisSolution)activeView.Content; 42 43 public string FileTypeFilter { 44 get { return "Excel 2007 file (*.xlsx)|*.xlsx"; } 45 } 46 public bool Supports(IDataAnalysisSolution solution) { 47 return solution is ISymbolicDataAnalysisSolution && 48 solution is IRegressionSolution; 49 } 50 51 public void Export(IDataAnalysisSolution solution, string fileName) { 52 var symbSolution = solution as ISymbolicDataAnalysisSolution; 53 if (symbSolution == null) throw new NotSupportedException("This solution cannot be exported to Excel"); 77 54 var formatter = new SymbolicDataAnalysisExpressionExcelFormatter(); 78 var formula = formatter.Format(solution.Model.SymbolicExpressionTree, solution.ProblemData.Dataset); 79 control = (Control)activeView; 80 81 82 SaveFileDialog saveFileDialog = new SaveFileDialog(); 83 saveFileDialog.Filter = "Excel Workbook|*.xlsx"; 84 saveFileDialog.Title = "Save an Excel File"; 85 if (saveFileDialog.ShowDialog() == DialogResult.OK) { 86 string fileName = saveFileDialog.FileName; 87 using (BackgroundWorker bg = new BackgroundWorker()) { 88 MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(control, "Exportion solution to " + fileName + "."); 89 bg.DoWork += (b, e) => ExportChart(fileName, solution, formula); 90 bg.RunWorkerCompleted += (o, e) => MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(control); 91 bg.RunWorkerAsync(); 92 } 93 } 55 var formula = formatter.Format(symbSolution.Model.SymbolicExpressionTree, solution.ProblemData.Dataset); 56 ExportChart(fileName, symbSolution, formula); 94 57 } 95 58 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
r9587 r9973 119 119 </ItemGroup> 120 120 <ItemGroup> 121 <Compile Include="Exporters\SymbolicSolutionExcelExporter.cs" /> 121 122 <Compile Include="InteractiveSymbolicExpressionTreeChart.cs"> 122 123 <SubType>UserControl</SubType> … … 131 132 <DependentUpon>MathSymbolicDataAnalysisModelView.cs</DependentUpon> 132 133 </Compile> 133 <Compile Include="MenuItems\ExportSymbolicSolutionToExcelMenuItem.cs" />134 134 <Compile Include="Plugin.cs" /> 135 135 <Compile Include="TextualSymbolicDataAnalysisModelView.cs"> -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/MenuItems/CreateEnsembleMenuItem.cs
r9860 r9973 37 37 } 38 38 public override IEnumerable<string> Structure { 39 get { return new string[] { "& Data Analysis" }; }39 get { return new string[] { "&Edit", "&Data Analysis" }; } 40 40 } 41 41 public override int Position { -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/MenuItems/ShrinkDataAnalysisRunsMenuItem.cs
r9866 r9973 41 41 } 42 42 public override IEnumerable<string> Structure { 43 get { return new string[] { "& Data Analysis" }; }43 get { return new string[] { "&Edit", "&Data Analysis" }; } 44 44 } 45 45 public override int Position { -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.Designer.cs
r9456 r9973 44 44 /// </summary> 45 45 private void InitializeComponent() { 46 this.exportButton = new System.Windows.Forms.Button(); 47 this.exportFileDialog = new System.Windows.Forms.SaveFileDialog(); 46 48 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 47 49 this.splitContainer.Panel1.SuspendLayout(); … … 54 56 // splitContainer 55 57 // 58 // 59 // splitContainer.Panel2 60 // 61 this.splitContainer.Panel2.Controls.Add(this.exportButton); 56 62 // 57 63 // itemsGroupBox … … 67 73 this.toolTip.SetToolTip(this.removeButton, "Remove"); 68 74 // 75 // exportButton 76 // 77 this.exportButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 78 this.exportButton.Location = new System.Drawing.Point(215, 4); 79 this.exportButton.Name = "exportButton"; 80 this.exportButton.Size = new System.Drawing.Size(54, 23); 81 this.exportButton.TabIndex = 6; 82 this.exportButton.Text = "Export"; 83 this.exportButton.UseVisualStyleBackColor = true; 84 this.exportButton.Click += new System.EventHandler(this.exportButton_Click); 85 // 69 86 // DataAnalysisSolutionView 70 87 // 71 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);72 88 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 73 89 this.Name = "DataAnalysisSolutionView"; … … 84 100 #endregion 85 101 102 private System.Windows.Forms.SaveFileDialog exportFileDialog; 103 protected System.Windows.Forms.Button exportButton; 104 86 105 } 87 106 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs
r9456 r9973 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.ComponentModel; 24 25 using System.Drawing; 25 26 using System.Linq; … … 30 31 using HeuristicLab.Optimization; 31 32 using HeuristicLab.Optimization.Views; 33 using HeuristicLab.PluginInfrastructure; 32 34 33 35 namespace HeuristicLab.Problems.DataAnalysis.Views { 36 34 37 [View("DataAnalysisSolution View")] 35 38 [Content(typeof(DataAnalysisSolution), false)] 36 public partial class DataAnalysisSolutionView : NamedItemCollectionView<IResult>{39 public partial class DataAnalysisSolutionView : Bla { 37 40 public DataAnalysisSolutionView() { 38 41 InitializeComponent(); … … 49 52 addButton.Enabled = false; 50 53 removeButton.Enabled = false; 54 if (Content == null) { 55 exportButton.Enabled = false; 56 } else { 57 exportButton.Enabled = !Locked; 58 } 51 59 } 52 60 … … 117 125 } else 118 126 base.itemsListView_SelectedIndexChanged(sender, e); 127 } 128 129 130 private void exportButton_Click(object sender, EventArgs e) { 131 var exporters = ApplicationManager.Manager.GetInstances<IDataAnalysisSolutionExporter>() 132 .Where(exporter => exporter.Supports(Content)).ToArray(); 133 exportFileDialog.Filter = exporters.Skip(1) 134 .Aggregate(exporters.First().FileTypeFilter, (s, exporter) => s + "|" + exporter.FileTypeFilter); 135 var result = exportFileDialog.ShowDialog(); 136 if (result == DialogResult.OK) { 137 138 var name = exportFileDialog.FileName; 139 var selectedExporter = exporters.Single(exporter => exporter.FileTypeFilter == exportFileDialog.Filter); 140 141 using (BackgroundWorker bg = new BackgroundWorker()) { 142 MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Exportion solution to " + name + "."); 143 bg.DoWork += (_, __) => selectedExporter.Export(Content, name); 144 bg.RunWorkerCompleted += (_, __) => MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this); 145 bg.RunWorkerAsync(); 146 } 147 } 119 148 } 120 149 … … 190 219 #endregion 191 220 } 221 222 public class Bla : NamedItemCollectionView<IResult> { 223 224 } 225 192 226 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r9762 r9973 148 148 </Compile> 149 149 <Compile Include="Interfaces\Classification\IDiscriminantFunctionThresholdCalculator.cs" /> 150 <Compile Include="Interfaces\IDataAnalysisSolutionExporter.cs" /> 150 151 <Compile Include="Interfaces\IDependencyCalculator.cs" /> 151 152 <Compile Include="Interfaces\Regression\IRegressionEnsembleModel.cs">
Note: See TracChangeset
for help on using the changeset viewer.