Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4651


Ignore:
Timestamp:
10/28/10 16:27:51 (13 years ago)
Author:
mkommend
Message:

Integrated EnhancedChart in all GP specific views (ticket #1228).

Location:
trunk/sources
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionTreeChart.Designer.cs

    r3742 r4651  
    4747      this.components = new System.ComponentModel.Container();
    4848      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     49      this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
     50      this.saveImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     51      this.contextMenuStrip.SuspendLayout();
    4952      this.SuspendLayout();
     53      //
     54      // contextMenuStrip
     55      //
     56      this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     57            this.saveImageToolStripMenuItem});
     58      this.contextMenuStrip.Name = "contextMenuStrip";
     59      this.contextMenuStrip.Size = new System.Drawing.Size(135, 26);
     60      //
     61      // saveImageToolStripMenuItem
     62      //
     63      this.saveImageToolStripMenuItem.Name = "saveImageToolStripMenuItem";
     64      this.saveImageToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
     65      this.saveImageToolStripMenuItem.Text = "Save Image";
     66      this.saveImageToolStripMenuItem.Click += new System.EventHandler(this.saveImageToolStripMenuItem_Click);
    5067      //
    5168      // SymbolicExpressionTreeChart
     
    5370      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    5471      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     72      this.ContextMenuStrip = this.contextMenuStrip;
    5573      this.Name = "SymbolicExpressionTreeChart";
     74      this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseClick);
     75      this.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseDoubleClick);
     76      this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseDown);
    5677      this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseMove);
    57       this.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseDoubleClick);
    58       this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseClick);
    59       this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseDown);
    6078      this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SymbolicExpressionTreeChart_MouseUp);
     79      this.contextMenuStrip.ResumeLayout(false);
    6180      this.ResumeLayout(false);
    6281
     
    6685
    6786    private System.Windows.Forms.ToolTip toolTip;
     87    private System.Windows.Forms.ContextMenuStrip contextMenuStrip;
     88    private System.Windows.Forms.ToolStripMenuItem saveImageToolStripMenuItem;
    6889  }
    6990}
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3/SymbolicExpressionTreeChart.cs

    r4068 r4651  
    2323using System.Collections.Generic;
    2424using System.Drawing;
     25using System.Drawing.Imaging;
    2526using System.Windows.Forms;
    2627
     
    288289    }
    289290    #endregion
     291
     292    #region save image
     293    private void saveImageToolStripMenuItem_Click(object sender, EventArgs e) {
     294      SaveFileDialog saveFileDialog = new SaveFileDialog();
     295
     296      // Sets the current file name filter string, which determines
     297      // the choices that appear in the "Save as file type" or
     298      // "Files of type" box in the dialog box.
     299      saveFileDialog.Filter = "Bitmap (*.bmp)|*.bmp|EMF (*.emf)|*.emf";
     300      saveFileDialog.FilterIndex = 1;
     301      saveFileDialog.RestoreDirectory = true;
     302
     303      if (saveFileDialog.ShowDialog() == DialogResult.OK) {
     304        string filename = saveFileDialog.FileName.ToLower();
     305        if (filename.EndsWith("bmp")) SaveImageAsBitmap(filename);
     306        else if (filename.EndsWith("emf")) SaveImageAsEmf(filename);
     307        else SaveImageAsBitmap(filename);
     308      }
     309    }
     310
     311    private void SaveImageAsBitmap(string filename) {
     312      if (tree == null) return;
     313      Image image = new Bitmap(Width, Height);
     314      using (Graphics g = Graphics.FromImage(image)) {
     315        int height = this.Height / tree.Height;
     316        DrawFunctionTree(tree, g, 0, 0, Width, height);
     317      }
     318      image.Save(filename);
     319    }
     320
     321    private void SaveImageAsEmf(string filename) {
     322      if (tree == null) return;
     323      using (Graphics g = CreateGraphics()) {
     324        using (Metafile file = new Metafile(filename, g.GetHdc())) {
     325          using (Graphics emfFile = Graphics.FromImage(file)) {
     326            int height = this.Height / tree.Height;
     327            DrawFunctionTree(tree, emfFile, 0, 0, Width, height);
     328          }
     329        }
     330        g.ReleaseHdc();
     331      }
     332    }
     333    #endregion
    290334  }
    291335}
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification.Views/3.3/HeuristicLab.Problems.DataAnalysis.Classification.Views-3.3.csproj

    r4565 r4651  
    174174      <Name>HeuristicLab.Problems.DataAnalysis-3.3</Name>
    175175    </ProjectReference>
     176    <ProjectReference Include="..\..\HeuristicLab.Visualization.ChartControlsExtensions\3.3\HeuristicLab.Visualization.ChartControlsExtensions-3.3.csproj">
     177      <Project>{315BDA09-3F4F-49B3-9790-B37CFC1C5750}</Project>
     178      <Name>HeuristicLab.Visualization.ChartControlsExtensions-3.3</Name>
     179    </ProjectReference>
    176180  </ItemGroup>
    177181  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification.Views/3.3/HeuristicLabProblemsDataAnalysisClassificationViewsPlugin.cs.frame

    r4634 r4651  
    3232  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Classification", "3.3")]
    3333  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Regression", "3.3")]
     34  [PluginDependency("HeuristicLab.Visualization.ChartControlsExtensions", "3.3")]
    3435  public class HeuristicLabProblemsDataAnalysisClassificationViewsPlugin : PluginBase {
    3536  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification.Views/3.3/RocCurvesView.Designer.cs

    r4417 r4651  
    2727      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    2828      System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
    29       this.chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
     29      this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
    3030      this.label1 = new System.Windows.Forms.Label();
    3131      this.cmbSamples = new System.Windows.Forms.ComboBox();
     
    9090    #endregion
    9191
    92     private System.Windows.Forms.DataVisualization.Charting.Chart chart;
     92    private HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart chart;
    9393    private System.Windows.Forms.Label label1;
    9494    private System.Windows.Forms.ComboBox cmbSamples;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification.Views/3.3/RocCurvesView.cs

    r4469 r4651  
    4949      cmbSamples.SelectedIndex = 0;
    5050
     51      chart.CustomizeAllChartAreas();
    5152      chart.ChartAreas[0].AxisX.Minimum = 0.0;
    5253      chart.ChartAreas[0].AxisX.Maximum = 1.0;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification.Views/3.3/SymbolicClassificationSolutionView.Designer.cs

    r4417 r4651  
    2626      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    2727      System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
    28       this.chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
     28      this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
    2929      this.JitterTrackBar = new System.Windows.Forms.TrackBar();
    3030      this.label1 = new System.Windows.Forms.Label();
     
    9595    #endregion
    9696
    97     private System.Windows.Forms.DataVisualization.Charting.Chart chart;
     97    private HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart chart;
    9898    private System.Windows.Forms.TrackBar JitterTrackBar;
    9999    private System.Windows.Forms.Label label1;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification.Views/3.3/SymbolicClassificationSolutionView.cs

    r4469 r4651  
    5757      updateInProgress = false;
    5858
     59      this.chart.CustomizeAllChartAreas();
    5960      this.chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
    6061      this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/HeuristicLab.Problems.DataAnalysis.Views-3.3.csproj

    r4065 r4651  
    283283      <Name>HeuristicLab.Problems.DataAnalysis-3.3</Name>
    284284    </ProjectReference>
     285    <ProjectReference Include="..\..\HeuristicLab.Visualization.ChartControlsExtensions\3.3\HeuristicLab.Visualization.ChartControlsExtensions-3.3.csproj">
     286      <Project>{315BDA09-3F4F-49B3-9790-B37CFC1C5750}</Project>
     287      <Name>HeuristicLab.Visualization.ChartControlsExtensions-3.3</Name>
     288    </ProjectReference>
    285289  </ItemGroup>
    286290  <ItemGroup>
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/HeuristicLabProblemsDataAnalysisViewsPlugin.cs.frame

    r4633 r4651  
    2828  [Plugin("HeuristicLab.Problems.DataAnalysis.Views","3.3.1.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Problems.DataAnalysis.Views-3.3.dll", PluginFileType.Assembly)]
    30     [PluginDependency("HeuristicLab.ALGLIB","2.5.0.0")]
     30  [PluginDependency("HeuristicLab.ALGLIB","2.5.0.0")]
    3131  [PluginDependency("HeuristicLab.Collections", "3.3.1.0")]
    3232  [PluginDependency("HeuristicLab.Common", "3.3.1.0")]
     
    4242  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.3.1.0")]
    4343  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Regression", "3.3.1.0")]
     44  [PluginDependency("HeuristicLab.Visualization.ChartControlsExtensions", "3.3")]
    4445  public class HeuristicLabProblemsDataAnalysisViewsPlugin : PluginBase {
    4546  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/LineChartView.Designer.cs

    r3442 r4651  
    4646      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    4747      System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
    48       this.chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
     48      this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
    4949      ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
    5050      this.SuspendLayout();
     
    7979    #endregion
    8080
    81     private System.Windows.Forms.DataVisualization.Charting.Chart chart;
     81    private HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart chart;
    8282  }
    8383}
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/LineChartView.cs

    r4068 r4651  
    4343      InitializeComponent();
    4444      //configure axis
     45      this.chart.CustomizeAllChartAreas();
    4546      this.chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
    4647      this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/ScatterPlotView.Designer.cs

    r3442 r4651  
    4747      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    4848      System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
    49       this.chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
     49      this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
    5050      ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
    5151      this.SuspendLayout();
     
    8282    #endregion
    8383
    84     private System.Windows.Forms.DataVisualization.Charting.Chart chart;
     84    private HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart chart;
    8585  }
    8686}
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/ScatterPlotView.cs

    r4468 r4651  
    6161      this.chart.AxisViewChanged += new EventHandler<System.Windows.Forms.DataVisualization.Charting.ViewEventArgs>(chart_AxisViewChanged);
    6262
    63       //configure axis                 
     63      //configure axis
     64      this.chart.CustomizeAllChartAreas();
    6465      this.chart.ChartAreas[0].AxisX.Title = "Estimated Values";
    6566      this.chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
Note: See TracChangeset for help on using the changeset viewer.