Changeset 10300 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphView.cs
- Timestamp:
- 01/07/14 21:44:36 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphView.cs
r10285 r10300 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 22 using System; 23 using System.Linq; 24 using System.Windows.Forms; 25 using HeuristicLab.Core.Views; 1 using HeuristicLab.Core.Views; 26 2 using HeuristicLab.MainForm; 27 3 28 4 namespace HeuristicLab.EvolutionTracking.Views { 29 [View("GenealogyGraph ")]30 [Content(typeof(GenealogyGraph), IsDefaultView = true)]5 [View("GenealogyGraphView")] 6 [Content(typeof(GenealogyGraph), IsDefaultView = false)] 31 7 public sealed partial class GenealogyGraphView : ItemView { 32 public new GenealogyGraph Content {33 get { return ( GenealogyGraph)base.Content; }8 public new IGenealogyGraph Content { 9 get { return (IGenealogyGraph)base.Content; } 34 10 set { base.Content = value; } 35 11 } 36 12 37 public GenealogyGraphView() 38 : base() { 13 public GenealogyGraphView() { 39 14 InitializeComponent(); 40 // set button icons here because if set in the designer file, they get overwritten41 this.highlightAllButton.Image = Common.Resources.VSImageLibrary.Gradient;42 this.simpleLineagesCheckBox.Image = Common.Resources.VSImageLibrary.ArrowDown;43 this.lockGenealogyCheckBox.Image = Common.Resources.VSImageLibrary.ProtectForm;44 15 } 45 16 46 17 protected override void DeregisterContentEvents() { 47 18 // TODO: Deregister your event handlers here 48 Content.GraphUpdated -= GenealogyGraphUpdated;49 19 base.DeregisterContentEvents(); 50 20 } … … 53 23 base.RegisterContentEvents(); 54 24 // TODO: Register your event handlers here 55 Content.GraphUpdated += GenealogyGraphUpdated;56 25 } 57 26 58 27 #region Event Handlers (Content) 59 28 // TODO: Put event handlers of the content here 29 #endregion 30 60 31 protected override void OnContentChanged() { 61 32 base.OnContentChanged(); 62 // genealogyGraphChart.GenealogyGraph = Content ?? null; 33 if (Content == null) { 34 } else { 35 genealogyGraphChart.GenealogyGraph = Content; 36 } 63 37 } 64 private void Content_GraphChanged(object sender, EventArgs e) { 65 } 38 66 39 protected override void SetEnabledStateOfControls() { 67 40 base.SetEnabledStateOfControls(); 68 genealogyGraphChart.Enabled = Content != null;41 // TODO: Enable or disable controls based on whether the content is null or the view is set readonly 69 42 } 70 #endregion71 43 72 44 #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 } 45 // TODO: Put event handlers of child controls here. 86 46 #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 47 } 108 48 }
Note: See TracChangeset
for help on using the changeset viewer.