source: branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphView.cs @ 12225

Last change on this file since 12225 was 12225, checked in by bburlacu, 5 years ago

#1772: Work in progress for calculating sampling counts for subtrees in the population: updated TraceCalculator to aggregate tracing statistics, updated SymbolicDataAnalysisGenealogyGraphView, added SymbolicDataAnalysisSubtreeSampleCountAnalyzer.

File size: 3.0 KB
Line 
1using System.Windows.Forms;
2using HeuristicLab.Core;
3using HeuristicLab.Core.Views;
4using HeuristicLab.MainForm;
5
6namespace HeuristicLab.EvolutionTracking.Views {
7  [View("GenealogyGraphView")]
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; }
12      set { base.Content = value; }
13    }
14
15    public GenealogyGraphView() {
16      InitializeComponent();
17    }
18
19    protected override void DeregisterContentEvents() {
20      // TODO: Deregister your event handlers here
21      genealogyGraphChart.GenealogyGraphNodeClicked -= graphChart_GenealogyGraphNodeClicked;
22      genealogyGraphChart.GenealogyGraphNodeDoubleClicked -= graphChart_GenealogyGraphNodeDoubleClicked;
23      base.DeregisterContentEvents();
24    }
25
26    protected override void RegisterContentEvents() {
27      base.RegisterContentEvents();
28      // TODO: Register your event handlers here
29      genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked;
30      genealogyGraphChart.GenealogyGraphNodeDoubleClicked += graphChart_GenealogyGraphNodeDoubleClicked;
31    }
32
33    #region Event Handlers (Content)
34    // TODO: Put event handlers of the content here
35    protected override void OnContentChanged() {
36      base.OnContentChanged();
37      if (Content != null && Content != genealogyGraphChart.GenealogyGraph) { genealogyGraphChart.GenealogyGraph = Content; }
38    }
39    #endregion
40
41    protected override void SetEnabledStateOfControls() {
42      base.SetEnabledStateOfControls();
43      // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
44    }
45
46    #region Event Handlers (child controls)
47    // TODO: Put event handlers of child controls here.
48    public virtual void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs args) {
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;
71    }
72    #endregion
73  }
74}
Note: See TracBrowser for help on using the repository browser.