Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/22/15 00:31:03 (10 years ago)
Author:
bburlacu
Message:

#1772: Refactored genealogy graph views. Added an additional class specializing GenealogyGraphView<ISymbolicExpressionTree> for the sole purpose of making the SymbolicDataAnalysisGenealogyGraphView work with the designer. Added property to expose the SymbolicExpressionTreeChart in the GraphicalSymbolicExpressionTreeView in order to be able to wire mouse click events.

Location:
branches/HeuristicLab.EvolutionTracking
Files:
2 deleted
5 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/GraphicalSymbolicExpressionTreeView.cs

    r11208 r11817  
    5252      symbolicExpressionTreeChart.Enabled = Content != null;
    5353    }
     54
     55    public SymbolicExpressionTreeChart SymbolicExpressionTreeChart {
     56      get {
     57        return symbolicExpressionTreeChart;
     58      }
     59    }
    5460  }
    5561}
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs

    r11506 r11817  
    9494    }
    9595
    96     public GenealogyGraphChart()
    97       : base() {
     96    public GenealogyGraphChart() {
    9897      InitializeComponent();
    9998
     
    198197        return;
    199198      }
    200       var visualNodes = Chart.GetAllPrimitives(e.Location).Where(p => p is VisualGenealogyGraphNode).ToList();
    201       if (!visualNodes.Any()) {
     199      var primitive = Chart.GetAllPrimitives(e.Location).FirstOrDefault(p => p is VisualGenealogyGraphNode);
     200      if (primitive == null) {
    202201        SelectedVisualNode = null;
    203202        return;
    204203      }
    205       if (SelectedVisualNode == visualNodes[0]) return;
    206       SelectedVisualNode = visualNodes[0] as VisualGenealogyGraphNode;
     204      if (SelectedVisualNode == primitive) return;
     205      SelectedVisualNode = primitive as VisualGenealogyGraphNode;
    207206      if (SelectedVisualNode == null) return;
    208207
     
    259258      var arcs = GenealogyGraph.Vertices.SelectMany(n => n.InArcs).ToList();
    260259      foreach (var arc in arcs) { arc.Weight = 1.0; } // reset weights
    261       var rank = GenealogyGraph.Ranks.Keys.Max();
    262       foreach (var ggn in GenealogyGraph.Ranks[rank]) {
    263         foreach (var ancestor in ggn.Ancestors) {
     260      var rank = GenealogyGraph.Ranks.Max(x => x.Key);
     261      foreach (var graphNode in GenealogyGraph.GetByRank(rank)) {
     262        foreach (var ancestor in graphNode.Ancestors) {
    264263          foreach (var arc in ancestor.InArcs) {
    265264            arc.Weight++;
     
    357356  internal static class Util {
    358357    public static Color GetColor(this IGenealogyGraphNode node) {
     358      if (double.IsNaN(node.Quality))
     359        return ColorGradient.Colors[0];
    359360      var colorIndex = (int)Math.Round(node.Quality * ColorGradient.Colors.Count);
    360361      if (colorIndex >= ColorGradient.Colors.Count) return ColorGradient.Colors.Last();
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphView.Designer.cs

    r11506 r11817  
    11
    22namespace HeuristicLab.EvolutionTracking.Views {
    3   partial class GenealogyGraphView {
     3  partial class GenealogyGraphView<T> {
    44    /// <summary>
    55    /// Required designer variable.
     
    2626    private void InitializeComponent() {
    2727      this.splitContainer = new System.Windows.Forms.SplitContainer();
     28      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     29      this.groupBox = new System.Windows.Forms.GroupBox();
     30      this.lockGraph_checkBox = new System.Windows.Forms.CheckBox();
     31      this.simpleLineages_checkBox = new System.Windows.Forms.CheckBox();
     32      this.trace_checkBox = new System.Windows.Forms.CheckBox();
    2833      this.genealogyGraphChart = new HeuristicLab.EvolutionTracking.Views.GenealogyGraphChart();
    29       this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    3034      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    3135      this.splitContainer.Panel1.SuspendLayout();
    3236      this.splitContainer.Panel2.SuspendLayout();
    3337      this.splitContainer.SuspendLayout();
     38      this.groupBox.SuspendLayout();
    3439      this.SuspendLayout();
    3540      //
    3641      // splitContainer
    3742      //
    38       this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
    39       this.splitContainer.Location = new System.Drawing.Point(0, 0);
     43      this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     44            | System.Windows.Forms.AnchorStyles.Left)
     45            | System.Windows.Forms.AnchorStyles.Right)));
     46      this.splitContainer.Location = new System.Drawing.Point(3, 55);
    4047      this.splitContainer.Name = "splitContainer";
    4148      //
     
    4754      //
    4855      this.splitContainer.Panel2.Controls.Add(this.viewHost);
    49       this.splitContainer.Size = new System.Drawing.Size(894, 678);
    50       this.splitContainer.SplitterDistance = 417;
     56      this.splitContainer.Size = new System.Drawing.Size(1394, 742);
     57      this.splitContainer.SplitterDistance = 694;
    5158      this.splitContainer.TabIndex = 0;
     59      //
     60      // viewHost
     61      //
     62      this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     63            | System.Windows.Forms.AnchorStyles.Left)
     64            | System.Windows.Forms.AnchorStyles.Right)));
     65      this.viewHost.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     66      this.viewHost.Caption = "View";
     67      this.viewHost.Content = null;
     68      this.viewHost.Enabled = false;
     69      this.viewHost.Location = new System.Drawing.Point(0, 0);
     70      this.viewHost.Name = "viewHost";
     71      this.viewHost.ReadOnly = false;
     72      this.viewHost.Size = new System.Drawing.Size(697, 743);
     73      this.viewHost.TabIndex = 0;
     74      this.viewHost.ViewsLabelVisible = true;
     75      this.viewHost.ViewType = null;
     76      //
     77      // groupBox
     78      //
     79      this.groupBox.Controls.Add(this.lockGraph_checkBox);
     80      this.groupBox.Controls.Add(this.simpleLineages_checkBox);
     81      this.groupBox.Controls.Add(this.trace_checkBox);
     82      this.groupBox.Location = new System.Drawing.Point(3, 4);
     83      this.groupBox.Name = "groupBox";
     84      this.groupBox.Size = new System.Drawing.Size(411, 44);
     85      this.groupBox.TabIndex = 1;
     86      this.groupBox.TabStop = false;
     87      this.groupBox.Text = "Genealogy Options";
     88      //
     89      // lockGraph_checkBox
     90      //
     91      this.lockGraph_checkBox.Appearance = System.Windows.Forms.Appearance.Button;
     92      this.lockGraph_checkBox.AutoSize = true;
     93      this.lockGraph_checkBox.Location = new System.Drawing.Point(157, 15);
     94      this.lockGraph_checkBox.Name = "lockGraph_checkBox";
     95      this.lockGraph_checkBox.Size = new System.Drawing.Size(73, 23);
     96      this.lockGraph_checkBox.TabIndex = 0;
     97      this.lockGraph_checkBox.Text = "Lock Graph";
     98      this.lockGraph_checkBox.UseVisualStyleBackColor = true;
     99      this.lockGraph_checkBox.CheckedChanged += new System.EventHandler(this.lockGraph_checkBox_CheckedChanged);
     100      //
     101      // simpleLineages_checkBox
     102      //
     103      this.simpleLineages_checkBox.Appearance = System.Windows.Forms.Appearance.Button;
     104      this.simpleLineages_checkBox.AutoSize = true;
     105      this.simpleLineages_checkBox.Location = new System.Drawing.Point(57, 15);
     106      this.simpleLineages_checkBox.Name = "simpleLineages_checkBox";
     107      this.simpleLineages_checkBox.Size = new System.Drawing.Size(94, 23);
     108      this.simpleLineages_checkBox.TabIndex = 0;
     109      this.simpleLineages_checkBox.Text = "Simple Lineages";
     110      this.simpleLineages_checkBox.UseVisualStyleBackColor = true;
     111      this.simpleLineages_checkBox.CheckedChanged += new System.EventHandler(this.simpleLineages_checkBox_CheckedChanged);
     112      //
     113      // trace_checkBox
     114      //
     115      this.trace_checkBox.Appearance = System.Windows.Forms.Appearance.Button;
     116      this.trace_checkBox.AutoSize = true;
     117      this.trace_checkBox.Location = new System.Drawing.Point(6, 15);
     118      this.trace_checkBox.Name = "trace_checkBox";
     119      this.trace_checkBox.Size = new System.Drawing.Size(45, 23);
     120      this.trace_checkBox.TabIndex = 0;
     121      this.trace_checkBox.Text = "Trace";
     122      this.trace_checkBox.UseVisualStyleBackColor = true;
     123      this.trace_checkBox.CheckedChanged += new System.EventHandler(this.trace_checkBox_CheckedChanged);
    52124      //
    53125      // genealogyGraphChart
    54126      //
     127      this.genealogyGraphChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     128            | System.Windows.Forms.AnchorStyles.Left)
     129            | System.Windows.Forms.AnchorStyles.Right)));
    55130      this.genealogyGraphChart.BackColor = System.Drawing.SystemColors.Control;
    56       this.genealogyGraphChart.Dock = System.Windows.Forms.DockStyle.Fill;
    57131      this.genealogyGraphChart.GenealogyGraph = null;
    58132      this.genealogyGraphChart.Location = new System.Drawing.Point(0, 0);
     
    61135      this.genealogyGraphChart.ScaleOnResize = true;
    62136      this.genealogyGraphChart.SimpleLineages = false;
    63       this.genealogyGraphChart.Size = new System.Drawing.Size(417, 678);
    64       this.genealogyGraphChart.TabIndex = 2;
     137      this.genealogyGraphChart.Size = new System.Drawing.Size(689, 738);
     138      this.genealogyGraphChart.TabIndex = 0;
    65139      this.genealogyGraphChart.TraceFragments = false;
    66       //
    67       // viewHost
    68       //
    69       this.viewHost.Caption = "View";
    70       this.viewHost.Content = null;
    71       this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    72       this.viewHost.Enabled = false;
    73       this.viewHost.Location = new System.Drawing.Point(0, 0);
    74       this.viewHost.Name = "viewHost";
    75       this.viewHost.ReadOnly = false;
    76       this.viewHost.Size = new System.Drawing.Size(473, 678);
    77       this.viewHost.TabIndex = 0;
    78       this.viewHost.ViewsLabelVisible = true;
    79       this.viewHost.ViewType = null;
    80140      //
    81141      // GenealogyGraphView
     
    83143      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    84144      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     145      this.Controls.Add(this.groupBox);
    85146      this.Controls.Add(this.splitContainer);
    86147      this.Name = "GenealogyGraphView";
    87       this.Size = new System.Drawing.Size(894, 678);
     148      this.Size = new System.Drawing.Size(1400, 800);
    88149      this.splitContainer.Panel1.ResumeLayout(false);
    89150      this.splitContainer.Panel2.ResumeLayout(false);
    90151      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
    91152      this.splitContainer.ResumeLayout(false);
     153      this.groupBox.ResumeLayout(false);
     154      this.groupBox.PerformLayout();
    92155      this.ResumeLayout(false);
    93156
     
    99162    protected MainForm.WindowsForms.ViewHost viewHost;
    100163    protected GenealogyGraphChart genealogyGraphChart;
     164    private System.Windows.Forms.GroupBox groupBox;
     165    protected System.Windows.Forms.CheckBox trace_checkBox;
     166    protected System.Windows.Forms.CheckBox simpleLineages_checkBox;
     167    protected System.Windows.Forms.CheckBox lockGraph_checkBox;
    101168
    102169  }
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphView.cs

    r11253 r11817  
    11using System.Windows.Forms;
    2 using HeuristicLab.Common;
     2using HeuristicLab.Core;
    33using HeuristicLab.Core.Views;
    44using HeuristicLab.MainForm;
     
    66namespace HeuristicLab.EvolutionTracking.Views {
    77  [View("GenealogyGraphView")]
    8   [Content(typeof(IGenealogyGraph), IsDefaultView = false)]
    9   public partial class GenealogyGraphView : ItemView {
    10     public new IGenealogyGraph Content {
    11       get { return (IGenealogyGraph)base.Content; }
     8  [Content(typeof(IGenealogyGraph<>), IsDefaultView = false)]
     9  public partial class GenealogyGraphView<T> : ItemView where T : class,IItem {
     10    public new IGenealogyGraph<T> Content {
     11      get { return (IGenealogyGraph<T>)base.Content; }
    1212      set { base.Content = value; }
    1313    }
     
    2020      // TODO: Deregister your event handlers here
    2121      genealogyGraphChart.GenealogyGraphNodeClicked -= graphChart_GenealogyGraphNodeClicked;
     22      genealogyGraphChart.GenealogyGraphNodeDoubleClicked -= graphChart_GenealogyGraphNodeDoubleClicked;
    2223      base.DeregisterContentEvents();
    2324    }
     
    2728      // TODO: Register your event handlers here
    2829      genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked;
     30      genealogyGraphChart.GenealogyGraphNodeDoubleClicked += graphChart_GenealogyGraphNodeDoubleClicked;
    2931    }
    3032
     
    4547    // TODO: Put event handlers of child controls here.
    4648    public virtual void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs args) {
    47       var content = ((VisualGenealogyGraphNode)sender).Data.Data;
    48       if (content != null) {
    49         viewHost.Content = (IContent)content;
    50       }
     49      var visualNode = (VisualGenealogyGraphNode)sender;
     50      var graphNode = (IGenealogyGraphNode<T>)visualNode.Data;
     51      if (graphNode == null) return;
     52      var content = graphNode.Data;
     53      if (content == null) return;
     54      viewHost.Content = content;
     55    }
     56    public virtual void graphChart_GenealogyGraphNodeDoubleClicked(object sender, MouseEventArgs arcs) {
     57    }
     58    #endregion
     59
     60    #region events for configuring the behavior of the genealogy chart (trace/match, simple lineages, etc)
     61    private void trace_checkBox_CheckedChanged(object sender, System.EventArgs e) {
     62      genealogyGraphChart.TraceFragments = trace_checkBox.Checked;
     63    }
     64
     65    private void simpleLineages_checkBox_CheckedChanged(object sender, System.EventArgs e) {
     66      genealogyGraphChart.SimpleLineages = simpleLineages_checkBox.Checked;
     67    }
     68
     69    private void lockGraph_checkBox_CheckedChanged(object sender, System.EventArgs e) {
     70      genealogyGraphChart.LockGenealogy = lockGraph_checkBox.Checked;
    5171    }
    5272    #endregion
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r11694 r11817  
    279279      <DependentUpon>FragmentGraphView.cs</DependentUpon>
    280280    </Compile>
    281     <Compile Include="Tracking\SymboldDataAnalysisGenealogyView.cs">
    282       <SubType>UserControl</SubType>
    283     </Compile>
    284     <Compile Include="Tracking\SymboldDataAnalysisGenealogyView.Designer.cs">
    285       <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon>
    286     </Compile>
    287     <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs">
    288       <SubType>UserControl</SubType>
    289     </Compile>
    290     <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs">
    291       <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon>
     281    <Compile Include="Tracking\SymbolicDataAnalysisGenealogyGraphView.cs">
     282      <SubType>UserControl</SubType>
     283    </Compile>
     284    <Compile Include="Tracking\SymbolicDataAnalysisGenealogyGraphView.Designer.cs">
     285      <DependentUpon>SymbolicDataAnalysisGenealogyGraphView.cs</DependentUpon>
    292286    </Compile>
    293287    <Compile Include="Tracking\SymbolicDataAnalysisExpressionLineageExplorerView.cs">
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisGenealogyGraphView.Designer.cs

    r11816 r11817  
    2020#endregion
    2121
    22 using System.Drawing;
    2322
    2423namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    25   partial class SymboldDataAnalysisGenealogyView {
     24  partial class SymbolicDataAnalysisGenealogyGraphView {
    2625    /// <summary>
    2726    /// Required designer variable.
     
    4140
    4241    #region Component Designer generated code
    43 
    4442    /// <summary>
    4543    /// Required method for Designer support - do not modify
     
    4846    private void InitializeComponent() {
    4947      this.components = new System.ComponentModel.Container();
    50       this.splitContainer1 = new System.Windows.Forms.SplitContainer();
    51       this.symbolicExpressionTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
    52       this.groupBox1 = new System.Windows.Forms.GroupBox();
    53       this.hotPaths_button = new System.Windows.Forms.Button();
    54       this.simpleLineages_checkBox = new System.Windows.Forms.CheckBox();
    55       this.lockGraph_checkBox = new System.Windows.Forms.CheckBox();
    56       this.trace_checkBox = new System.Windows.Forms.CheckBox();
    57       this.genealogyGraphChart = new HeuristicLab.Problems.DataAnalysis.Symbolic.Views.SymbolicDataAnalysisExpressionGenealogyGraphChart();
    58       ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
    59       this.splitContainer1.Panel1.SuspendLayout();
    60       this.splitContainer1.Panel2.SuspendLayout();
    61       this.splitContainer1.SuspendLayout();
    62       this.groupBox1.SuspendLayout();
    6348      this.SuspendLayout();
    6449      //
    65       // splitContainer1
    66       //
    67       this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    68             | System.Windows.Forms.AnchorStyles.Left)
    69             | System.Windows.Forms.AnchorStyles.Right)));
    70       this.splitContainer1.Location = new System.Drawing.Point(0, 57);
    71       this.splitContainer1.Name = "splitContainer1";
    72       //
    73       // splitContainer1.Panel1
    74       //
    75       this.splitContainer1.Panel1.Controls.Add(this.genealogyGraphChart);
    76       //
    77       // splitContainer1.Panel2
    78       //
    79       this.splitContainer1.Panel2.Controls.Add(this.symbolicExpressionTreeChart);
    80       this.splitContainer1.Size = new System.Drawing.Size(1244, 695);
    81       this.splitContainer1.SplitterDistance = 605;
    82       this.splitContainer1.TabIndex = 0;
    83       //
    84       // symbolicExpressionTreeChart
    85       //
    86       this.symbolicExpressionTreeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    87             | System.Windows.Forms.AnchorStyles.Left)
    88             | System.Windows.Forms.AnchorStyles.Right)));
    89       this.symbolicExpressionTreeChart.BackgroundColor = System.Drawing.Color.White;
    90       this.symbolicExpressionTreeChart.LineColor = System.Drawing.Color.Black;
    91       this.symbolicExpressionTreeChart.Location = new System.Drawing.Point(0, 0);
    92       this.symbolicExpressionTreeChart.Name = "symbolicExpressionTreeChart";
    93       this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(635, 692);
    94       this.symbolicExpressionTreeChart.Spacing = 5;
    95       this.symbolicExpressionTreeChart.SuspendRepaint = false;
    96       this.symbolicExpressionTreeChart.TabIndex = 0;
    97       this.symbolicExpressionTreeChart.TextFont = new System.Drawing.Font("Microsoft Sans Serif", 10F);
    98       this.symbolicExpressionTreeChart.Tree = null;
    99       //
    100       // groupBox1
    101       //
    102       this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    103             | System.Windows.Forms.AnchorStyles.Right)));
    104       this.groupBox1.Controls.Add(this.hotPaths_button);
    105       this.groupBox1.Controls.Add(this.simpleLineages_checkBox);
    106       this.groupBox1.Controls.Add(this.lockGraph_checkBox);
    107       this.groupBox1.Controls.Add(this.trace_checkBox);
    108       this.groupBox1.Location = new System.Drawing.Point(3, 3);
    109       this.groupBox1.Name = "groupBox1";
    110       this.groupBox1.Size = new System.Drawing.Size(1241, 48);
    111       this.groupBox1.TabIndex = 4;
    112       this.groupBox1.TabStop = false;
    113       this.groupBox1.Text = "Controls";
    114       //
    115       // hotPaths_button
    116       //
    117       this.hotPaths_button.Location = new System.Drawing.Point(263, 15);
    118       this.hotPaths_button.Name = "hotPaths_button";
    119       this.hotPaths_button.Size = new System.Drawing.Size(75, 23);
    120       this.hotPaths_button.TabIndex = 7;
    121       this.hotPaths_button.Text = "Hot paths";
    122       this.hotPaths_button.UseVisualStyleBackColor = true;
    123       this.hotPaths_button.Click += new System.EventHandler(this.hotPaths_button_Click);
    124       //
    125       // simpleLineages_checkBox
    126       //
    127       this.simpleLineages_checkBox.AutoSize = true;
    128       this.simpleLineages_checkBox.Location = new System.Drawing.Point(94, 19);
    129       this.simpleLineages_checkBox.Name = "simpleLineages_checkBox";
    130       this.simpleLineages_checkBox.Size = new System.Drawing.Size(103, 17);
    131       this.simpleLineages_checkBox.TabIndex = 6;
    132       this.simpleLineages_checkBox.Text = "Simple Lineages";
    133       this.simpleLineages_checkBox.UseVisualStyleBackColor = true;
    134       this.simpleLineages_checkBox.CheckedChanged += new System.EventHandler(this.simpleLineages_checkBox_CheckedChanged);
    135       //
    136       // lockGraph_checkBox
    137       //
    138       this.lockGraph_checkBox.AutoSize = true;
    139       this.lockGraph_checkBox.Location = new System.Drawing.Point(6, 19);
    140       this.lockGraph_checkBox.Name = "lockGraph_checkBox";
    141       this.lockGraph_checkBox.Size = new System.Drawing.Size(82, 17);
    142       this.lockGraph_checkBox.TabIndex = 5;
    143       this.lockGraph_checkBox.Text = "Lock Graph";
    144       this.lockGraph_checkBox.UseVisualStyleBackColor = true;
    145       this.lockGraph_checkBox.CheckedChanged += new System.EventHandler(this.lockGraph_checkBox_CheckedChanged);
    146       //
    147       // trace_checkBox
    148       //
    149       this.trace_checkBox.AutoSize = true;
    150       this.trace_checkBox.Location = new System.Drawing.Point(203, 19);
    151       this.trace_checkBox.Name = "trace_checkBox";
    152       this.trace_checkBox.Size = new System.Drawing.Size(54, 17);
    153       this.trace_checkBox.TabIndex = 4;
    154       this.trace_checkBox.Text = "Trace";
    155       this.trace_checkBox.UseVisualStyleBackColor = true;
    156       this.trace_checkBox.CheckedChanged += new System.EventHandler(this.trace_checkBox_CheckedChanged);
    157       //
    158       // genealogyGraphChart
    159       //
    160       this.genealogyGraphChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    161             | System.Windows.Forms.AnchorStyles.Left)
    162             | System.Windows.Forms.AnchorStyles.Right)));
    163       this.genealogyGraphChart.BackColor = System.Drawing.SystemColors.Control;
    164       this.genealogyGraphChart.GenealogyGraph = null;
    165       this.genealogyGraphChart.Location = new System.Drawing.Point(-5, 0);
    166       this.genealogyGraphChart.LockGenealogy = false;
    167       this.genealogyGraphChart.Name = "genealogyGraphChart";
    168       this.genealogyGraphChart.ScaleOnResize = true;
    169       this.genealogyGraphChart.SimpleLineages = false;
    170       this.genealogyGraphChart.Size = new System.Drawing.Size(607, 692);
    171       this.genealogyGraphChart.TabIndex = 0;
    172       this.genealogyGraphChart.TraceFragments = false;
    173       //
    174       // SymboldDataAnalysisGenealogyView
     50      // SymbolicDataAnalysisGenealogyGraphView
    17551      //
    17652      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    17753      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    178       this.Controls.Add(this.groupBox1);
    179       this.Controls.Add(this.splitContainer1);
    180       this.Name = "SymboldDataAnalysisGenealogyView";
     54      this.Name = "SymbolicDataAnalysisGenealogyGraphView";
    18155      this.Size = new System.Drawing.Size(1247, 755);
    182       this.splitContainer1.Panel1.ResumeLayout(false);
    183       this.splitContainer1.Panel2.ResumeLayout(false);
    184       ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
    185       this.splitContainer1.ResumeLayout(false);
    186       this.groupBox1.ResumeLayout(false);
    187       this.groupBox1.PerformLayout();
    18856      this.ResumeLayout(false);
    189 
    19057    }
    19158
    19259    #endregion
    193 
    194     private System.Windows.Forms.SplitContainer splitContainer1;
    195     private SymbolicDataAnalysisExpressionGenealogyGraphChart genealogyGraphChart;
    196     private Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart symbolicExpressionTreeChart;
    197     private System.Windows.Forms.GroupBox groupBox1;
    198     private System.Windows.Forms.CheckBox simpleLineages_checkBox;
    199     private System.Windows.Forms.CheckBox lockGraph_checkBox;
    200     private System.Windows.Forms.CheckBox trace_checkBox;
    201     private System.Windows.Forms.Button hotPaths_button;
    202 
    20360  }
    20461}
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisGenealogyGraphView.cs

    r11744 r11817  
    2525using System.Linq;
    2626using System.Windows.Forms;
    27 using HeuristicLab.Core.Views;
    2827using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2928using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
     
    3332
    3433namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    35   [View("SymboldDataAnalysisGenealogyView")]
     34  [View("SymbolicDataAnalysisGenealogyGraphView")]
    3635  [Content(typeof(IGenealogyGraph<ISymbolicExpressionTree>), IsDefaultView = true)]
    37   public partial class SymboldDataAnalysisGenealogyView : ItemView {
     36  public partial class SymbolicDataAnalysisGenealogyGraphView : SymbolicDataAnalysisGenealogyGraphViewDesignable {
    3837    private readonly ISymbolicExpressionTreeNodeSimilarityComparer comparer;
    3938
    40     public SymboldDataAnalysisGenealogyView() {
     39    public SymbolicDataAnalysisGenealogyGraphView() {
    4140      InitializeComponent();
    42 
    4341      comparer = new SymbolicExpressionTreeNodeSimilarityComparer();
     42      viewHost.ViewType = typeof(GraphicalSymbolicExpressionTreeView);
    4443    }
    45 
    46     public new IGenealogyGraph<ISymbolicExpressionTree> Content {
    47       get { return (IGenealogyGraph<ISymbolicExpressionTree>)base.Content; }
    48       set { base.Content = value; }
    49     }
    50 
    5144    #region event handlers
    52 
    5345    protected override void OnContentChanged() {
    5446      base.OnContentChanged();
    55       if (Content != null) {
    56         genealogyGraphChart.GenealogyGraph = Content;
     47      if (Content != null) { genealogyGraphChart.GenealogyGraph = Content; }
     48    }
     49    #endregion
     50
     51    public SymbolicExpressionTreeChart SymbolicExpressionTreeChart {
     52      get {
     53        var view = (GraphicalSymbolicExpressionTreeView)base.viewHost.ActiveView;
     54        return view == null ? null : view.SymbolicExpressionTreeChart;
    5755      }
    5856    }
    5957
    60     #endregion
    61 
    6258    protected override void RegisterContentEvents() {
    63       genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked;
    64       genealogyGraphChart.GenealogyGraphNodeDoubleClicked += graphChart_GenealogyGraphNodeDoubleClicked;
    65       symbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked += treeChart_SymbolicExpressionNodeClicked;
    6659      base.RegisterContentEvents();
     60      if (SymbolicExpressionTreeChart != null)
     61        SymbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked += treeChart_SymbolicExpressionTreeNodeClicked;
    6762    }
    6863
    6964    protected override void DeregisterContentEvents() {
     65      if (SymbolicExpressionTreeChart != null)
     66        SymbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked -= treeChart_SymbolicExpressionTreeNodeClicked;
    7067      base.DeregisterContentEvents();
    71       genealogyGraphChart.GenealogyGraphNodeClicked -= graphChart_GenealogyGraphNodeClicked;
    72       symbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked -= treeChart_SymbolicExpressionNodeClicked;
    7368    }
    7469
    75     public void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs args) {
     70    public override void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs args) {
     71      base.graphChart_GenealogyGraphNodeClicked(sender, args);
    7672      var visualNode = (VisualGenealogyGraphNode)sender;
    7773      var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)visualNode.Data;
    78       var tree = graphNode.Data;
    79       symbolicExpressionTreeChart.Tree = tree;
    8074      if (graphNode.InArcs.Any()) {
    8175        var fragment = graphNode.InArcs.Last().Data as IFragment<ISymbolicExpressionTreeNode>;
     
    9589    }
    9690
    97     public void graphChart_GenealogyGraphNodeDoubleClicked(object sender, MouseEventArgs arcs) {
    98       var visualNode = (VisualGenealogyGraphNode)sender;
    99       var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)visualNode.Data;
    100       //      var tree = graphNode.Data;
    101       //      var model = new RegressionModel();
    102       //      var solution = new RegressionSolution()
    103       //      MainFormManager.MainForm.ShowContent(tree);
    104     }
    105 
    106     public void treeChart_SymbolicExpressionNodeClicked(object sender, MouseEventArgs args) {
     91    public void treeChart_SymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs args) {
    10792      var visualNode = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender;
    10893      var subtree = visualNode.Content;
     
    11297      treeChart_HighlightSubtree(subtree);
    11398
    114       bool trace = genealogyGraphChart.TraceFragments; // check whether the mode is 'trace' or 'match'
     99      bool trace = genealogyGraphChart.TraceFragments; // check whether we are in 'trace' or 'match' mode
    115100
    116101      if (trace) {
     
    118103        var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)genealogyGraphChart.SelectedGraphNode;
    119104        var subtreeIndex = graphNode.Data.IterateNodesPrefix().ToList().IndexOf(subtree);
    120         var fragmentGraph = SymbolicDataAnalysisExpressionTracing.TraceSubtree(graphNode, subtreeIndex);
     105        //        var fragmentGraph = SymbolicDataAnalysisExpressionTracing.TraceSubtree(graphNode, subtreeIndex);
     106        var traceGraph = TraceCalculator.TraceSubtree(graphNode, subtreeIndex);
    121107
    122         if (fragmentGraph.Vertices.Any()) {
    123           var genealogyNodes = fragmentGraph.Vertices.Select(v => Content.GetByContent(v.Data));
     108        if (traceGraph.Vertices.Any()) {
     109          var genealogyNodes = traceGraph.Vertices.Select(v => Content.GetByContent(v.Data));
    124110          genealogyGraphChart.HighlightNodes(genealogyNodes);
    125           foreach (var a in fragmentGraph.Arcs) {
     111          foreach (var a in traceGraph.Arcs) {
    126112            genealogyGraphChart.HighlightArc(Content.GetByContent(a.Target.Data), Content.GetByContent(a.Source.Data));
    127113          }
    128           MainFormManager.MainForm.ShowContent(fragmentGraph); // display the fragment graph on the screen
     114          MainFormManager.MainForm.ShowContent(traceGraph); // display the fragment graph on the screen
    129115        }
    130116      } else {
     
    148134
    149135    private void treeChart_ClearColors() {
    150       foreach (var node in symbolicExpressionTreeChart.Tree.IterateNodesPrefix()) {
    151         var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node);
     136      foreach (var node in SymbolicExpressionTreeChart.Tree.IterateNodesPrefix()) {
     137        var visualNode = SymbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node);
    152138        if (visualNode != null) {
    153139          visualNode.LineColor = Color.Black;
     
    155141        }
    156142      }
    157       symbolicExpressionTreeChart.RepaintNodes();
     143      SymbolicExpressionTreeChart.RepaintNodes();
    158144    }
    159145
    160146    private void treeChart_HighlightSubtree(ISymbolicExpressionTreeNode subtree, Color? color = null) {
    161       Color myColor = color == null ? Color.RoyalBlue : (Color)color;
     147      Color myColor = color ?? Color.RoyalBlue;
    162148      foreach (var s in subtree.IterateNodesPrefix()) {
    163         var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(s);
     149        var visualNode = SymbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(s);
    164150        visualNode.LineColor = myColor;
    165151        //        visualNode.FillColor = myColor;
    166152
    167153        foreach (var c in s.Subtrees) {
    168           var visualArc = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNodeConnection(s, c);
     154          var visualArc = SymbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNodeConnection(s, c);
    169155          visualArc.LineColor = myColor;
    170156        }
    171157      }
    172       symbolicExpressionTreeChart.RepaintNodes();
    173     }
    174 
    175     #region events for configuring the behavior of the genealogy chart (trace/match, simple lineages, etc)
    176     private void trace_checkBox_CheckedChanged(object sender, System.EventArgs e) {
    177       genealogyGraphChart.TraceFragments = trace_checkBox.Checked;
    178     }
    179 
    180     private void simpleLineages_checkBox_CheckedChanged(object sender, System.EventArgs e) {
    181       genealogyGraphChart.SimpleLineages = simpleLineages_checkBox.Checked;
    182     }
    183 
    184     private void lockGraph_checkBox_CheckedChanged(object sender, System.EventArgs e) {
    185       genealogyGraphChart.LockGenealogy = lockGraph_checkBox.Checked;
    186     }
    187     #endregion
    188 
    189     private void hotPaths_button_Click(object sender, System.EventArgs e) {
    190       genealogyGraphChart.HighlightHotPaths();
     158      SymbolicExpressionTreeChart.RepaintNodes();
    191159    }
    192160  }
     161
     162  public class SymbolicDataAnalysisGenealogyGraphViewDesignable : GenealogyGraphView<ISymbolicExpressionTree> { }
    193163}
Note: See TracChangeset for help on using the changeset viewer.