- Timestamp:
- 01/22/15 00:31:03 (9 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs
r11506 r11817 94 94 } 95 95 96 public GenealogyGraphChart() 97 : base() { 96 public GenealogyGraphChart() { 98 97 InitializeComponent(); 99 98 … … 198 197 return; 199 198 } 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) { 202 201 SelectedVisualNode = null; 203 202 return; 204 203 } 205 if (SelectedVisualNode == visualNodes[0]) return;206 SelectedVisualNode = visualNodes[0]as VisualGenealogyGraphNode;204 if (SelectedVisualNode == primitive) return; 205 SelectedVisualNode = primitive as VisualGenealogyGraphNode; 207 206 if (SelectedVisualNode == null) return; 208 207 … … 259 258 var arcs = GenealogyGraph.Vertices.SelectMany(n => n.InArcs).ToList(); 260 259 foreach (var arc in arcs) { arc.Weight = 1.0; } // reset weights 261 var rank = GenealogyGraph.Ranks. Keys.Max();262 foreach (var g gn in GenealogyGraph.Ranks[rank]) {263 foreach (var ancestor in g gn.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) { 264 263 foreach (var arc in ancestor.InArcs) { 265 264 arc.Weight++; … … 357 356 internal static class Util { 358 357 public static Color GetColor(this IGenealogyGraphNode node) { 358 if (double.IsNaN(node.Quality)) 359 return ColorGradient.Colors[0]; 359 360 var colorIndex = (int)Math.Round(node.Quality * ColorGradient.Colors.Count); 360 361 if (colorIndex >= ColorGradient.Colors.Count) return ColorGradient.Colors.Last(); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphView.Designer.cs
r11506 r11817 1 1 2 2 namespace HeuristicLab.EvolutionTracking.Views { 3 partial class GenealogyGraphView {3 partial class GenealogyGraphView<T> { 4 4 /// <summary> 5 5 /// Required designer variable. … … 26 26 private void InitializeComponent() { 27 27 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(); 28 33 this.genealogyGraphChart = new HeuristicLab.EvolutionTracking.Views.GenealogyGraphChart(); 29 this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();30 34 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 31 35 this.splitContainer.Panel1.SuspendLayout(); 32 36 this.splitContainer.Panel2.SuspendLayout(); 33 37 this.splitContainer.SuspendLayout(); 38 this.groupBox.SuspendLayout(); 34 39 this.SuspendLayout(); 35 40 // 36 41 // splitContainer 37 42 // 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); 40 47 this.splitContainer.Name = "splitContainer"; 41 48 // … … 47 54 // 48 55 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; 51 58 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); 52 124 // 53 125 // genealogyGraphChart 54 126 // 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))); 55 130 this.genealogyGraphChart.BackColor = System.Drawing.SystemColors.Control; 56 this.genealogyGraphChart.Dock = System.Windows.Forms.DockStyle.Fill;57 131 this.genealogyGraphChart.GenealogyGraph = null; 58 132 this.genealogyGraphChart.Location = new System.Drawing.Point(0, 0); … … 61 135 this.genealogyGraphChart.ScaleOnResize = true; 62 136 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; 65 139 this.genealogyGraphChart.TraceFragments = false; 66 //67 // viewHost68 //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;80 140 // 81 141 // GenealogyGraphView … … 83 143 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 84 144 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 145 this.Controls.Add(this.groupBox); 85 146 this.Controls.Add(this.splitContainer); 86 147 this.Name = "GenealogyGraphView"; 87 this.Size = new System.Drawing.Size( 894, 678);148 this.Size = new System.Drawing.Size(1400, 800); 88 149 this.splitContainer.Panel1.ResumeLayout(false); 89 150 this.splitContainer.Panel2.ResumeLayout(false); 90 151 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); 91 152 this.splitContainer.ResumeLayout(false); 153 this.groupBox.ResumeLayout(false); 154 this.groupBox.PerformLayout(); 92 155 this.ResumeLayout(false); 93 156 … … 99 162 protected MainForm.WindowsForms.ViewHost viewHost; 100 163 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; 101 168 102 169 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphView.cs
r11253 r11817 1 1 using System.Windows.Forms; 2 using HeuristicLab.Co mmon;2 using HeuristicLab.Core; 3 3 using HeuristicLab.Core.Views; 4 4 using HeuristicLab.MainForm; … … 6 6 namespace HeuristicLab.EvolutionTracking.Views { 7 7 [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; } 12 12 set { base.Content = value; } 13 13 } … … 20 20 // TODO: Deregister your event handlers here 21 21 genealogyGraphChart.GenealogyGraphNodeClicked -= graphChart_GenealogyGraphNodeClicked; 22 genealogyGraphChart.GenealogyGraphNodeDoubleClicked -= graphChart_GenealogyGraphNodeDoubleClicked; 22 23 base.DeregisterContentEvents(); 23 24 } … … 27 28 // TODO: Register your event handlers here 28 29 genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked; 30 genealogyGraphChart.GenealogyGraphNodeDoubleClicked += graphChart_GenealogyGraphNodeDoubleClicked; 29 31 } 30 32 … … 45 47 // TODO: Put event handlers of child controls here. 46 48 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; 51 71 } 52 72 #endregion
Note: See TracChangeset
for help on using the changeset viewer.