Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisGenealogyGraphView.cs @ 10462

Last change on this file since 10462 was 10462, checked in by bburlacu, 10 years ago

#1772: Fixed bug in configuration of the tracking operators, fixed null reference exception when trying to access fragments in SymbolicDataAnalysisGenealogyGraphView

File size: 1.3 KB
Line 
1using System.Drawing;
2using System.Linq;
3using System.Windows.Forms;
4using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
5using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
6using HeuristicLab.EvolutionTracking;
7using HeuristicLab.EvolutionTracking.Views;
8using HeuristicLab.MainForm;
9using HeuristicLab.MainForm.WindowsForms;
10
11namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
12  [View("GenealogyGraphView")]
13  [Content(typeof(GenealogyGraph), IsDefaultView = false)]
14  public class SymbolicDataAnalysisGenealogyGraphView : GenealogyGraphView {
15    public override void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs args) {
16      base.graphChart_GenealogyGraphNodeClicked(sender, args);
17      var visualNode = (VisualGenealogyGraphNode)sender;
18      var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)visualNode.Data;
19      IFragment<ISymbolicExpressionTreeNode> fragment = null;
20      if (graphNode.InArcs != null)
21        fragment = (IFragment<ISymbolicExpressionTreeNode>)graphNode.InArcs.Last().Data;
22      if (fragment != null) {
23        var treeView = (GraphicalSymbolicExpressionTreeView)viewHost.ActiveView;
24        treeView.HighlightSubtree(fragment.Root, Color.RoyalBlue);
25      }
26    }
27  }
28}
Note: See TracBrowser for help on using the repository browser.