Free cookie consent management tool by TermsFeed Policy Generator

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

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

#1772: Fixed namespaces.

File size: 4.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Linq;
24using System.Windows.Forms;
25using HeuristicLab.Core.Views;
26using HeuristicLab.MainForm;
27
28namespace HeuristicLab.EvolutionTracking.Views {
29  [View("GenealogyGraph")]
30  [Content(typeof(GenealogyGraph), IsDefaultView = true)]
31  public sealed partial class GenealogyGraphView : ItemView {
32    public new GenealogyGraph Content {
33      get { return (GenealogyGraph)base.Content; }
34      set { base.Content = value; }
35    }
36
37    public GenealogyGraphView()
38      : base() {
39      InitializeComponent();
40      // set button icons here because if set in the designer file, they get overwritten
41      this.highlightAllButton.Image = Common.Resources.VSImageLibrary.Gradient;
42      this.simpleLineagesCheckBox.Image = Common.Resources.VSImageLibrary.ArrowDown;
43      this.lockGenealogyCheckBox.Image = Common.Resources.VSImageLibrary.ProtectForm;
44    }
45
46    protected override void DeregisterContentEvents() {
47      // TODO: Deregister your event handlers here
48      Content.GraphUpdated -= GenealogyGraphUpdated;
49      base.DeregisterContentEvents();
50    }
51
52    protected override void RegisterContentEvents() {
53      base.RegisterContentEvents();
54      // TODO: Register your event handlers here
55      Content.GraphUpdated += GenealogyGraphUpdated;
56    }
57
58    #region Event Handlers (Content)
59    // TODO: Put event handlers of the content here
60    protected override void OnContentChanged() {
61      base.OnContentChanged();
62      genealogyGraphChart.GenealogyGraph = Content ?? null;
63    }
64    private void Content_GraphChanged(object sender, EventArgs e) {
65    }
66    protected override void SetEnabledStateOfControls() {
67      base.SetEnabledStateOfControls();
68      genealogyGraphChart.Enabled = Content != null;
69    }
70    #endregion
71
72    #region Event Handlers (child controls)
73    private void GenealogyGraphUpdated(object sender, EventArgs args) {
74      genealogyGraphChart.GenealogyGraph = Content;
75    }
76    void MatchNodesAndRepaint() {
77      genealogyGraphChart.Chart.UpdateEnabled = false;
78      genealogyGraphChart.ClearPrimitives(); // clear node colors
79
80      genealogyGraphChart.Chart.UpdateEnabled = true;
81      genealogyGraphChart.Chart.EnforceUpdate();
82    }
83
84    private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {
85    }
86    #endregion
87    private void simpleLineagesCheckBox_CheckedChanged(object sender, EventArgs e) {
88      genealogyGraphChart.SimpleLineages = simpleLineagesCheckBox.Checked;
89    }
90
91    private void highlightAllButton_Click(object sender, EventArgs e) {
92    }
93
94    private void lockGenealogyCheckBox_CheckedChanged(object sender, EventArgs e) {
95      genealogyGraphChart.LockGenealogy = lockGenealogyCheckBox.Checked;
96    }
97
98    private void highlightRootParentsButton_Click(object sender, EventArgs e) {
99      var nodes = genealogyGraphChart.GenealogyGraph.Nodes.Where(n => n.InArcs != null && n.InArcs.Count == 2).Select(n => (GenealogyGraphNode)n.InArcs[0].Source).ToList();
100      genealogyGraphChart.HighlightNodes(nodes);
101    }
102
103    private void highlightSecondaryParentsButton_Click(object sender, EventArgs e) {
104      var nodes = genealogyGraphChart.GenealogyGraph.Nodes.Where(n => n.InArcs != null && n.InArcs.Count == 2).Select(n => (GenealogyGraphNode)n.InArcs[1].Source).ToList();
105      genealogyGraphChart.HighlightNodes(nodes);
106    }
107  }
108}
Note: See TracBrowser for help on using the repository browser.