Changeset 11817
- Timestamp:
- 01/22/15 00:31:03 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking
- Files:
-
- 2 deleted
- 5 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/GraphicalSymbolicExpressionTreeView.cs
r11208 r11817 52 52 symbolicExpressionTreeChart.Enabled = Content != null; 53 53 } 54 55 public SymbolicExpressionTreeChart SymbolicExpressionTreeChart { 56 get { 57 return symbolicExpressionTreeChart; 58 } 59 } 54 60 } 55 61 } -
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 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
r11694 r11817 279 279 <DependentUpon>FragmentGraphView.cs</DependentUpon> 280 280 </Compile> 281 <Compile Include="Tracking\SymboldDataAnalysisGenealogyView.cs"> 282 <SubType>UserControl</SubType> 283 </Compile> 284 <Compile Include="Tracking\SymboldDataAnalysisGenealogyView.Designer.cs"> 285 <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon> 286 </Compile> 287 <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs"> 288 <SubType>UserControl</SubType> 289 </Compile> 290 <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs"> 291 <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon> 281 <Compile Include="Tracking\SymbolicDataAnalysisGenealogyGraphView.cs"> 282 <SubType>UserControl</SubType> 283 </Compile> 284 <Compile Include="Tracking\SymbolicDataAnalysisGenealogyGraphView.Designer.cs"> 285 <DependentUpon>SymbolicDataAnalysisGenealogyGraphView.cs</DependentUpon> 292 286 </Compile> 293 287 <Compile Include="Tracking\SymbolicDataAnalysisExpressionLineageExplorerView.cs"> -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisGenealogyGraphView.Designer.cs
r11816 r11817 20 20 #endregion 21 21 22 using System.Drawing;23 22 24 23 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 25 partial class Symbol dDataAnalysisGenealogyView {24 partial class SymbolicDataAnalysisGenealogyGraphView { 26 25 /// <summary> 27 26 /// Required designer variable. … … 41 40 42 41 #region Component Designer generated code 43 44 42 /// <summary> 45 43 /// Required method for Designer support - do not modify … … 48 46 private void InitializeComponent() { 49 47 this.components = new System.ComponentModel.Container(); 50 this.splitContainer1 = new System.Windows.Forms.SplitContainer();51 this.symbolicExpressionTreeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();52 this.groupBox1 = new System.Windows.Forms.GroupBox();53 this.hotPaths_button = new System.Windows.Forms.Button();54 this.simpleLineages_checkBox = new System.Windows.Forms.CheckBox();55 this.lockGraph_checkBox = new System.Windows.Forms.CheckBox();56 this.trace_checkBox = new System.Windows.Forms.CheckBox();57 this.genealogyGraphChart = new HeuristicLab.Problems.DataAnalysis.Symbolic.Views.SymbolicDataAnalysisExpressionGenealogyGraphChart();58 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();59 this.splitContainer1.Panel1.SuspendLayout();60 this.splitContainer1.Panel2.SuspendLayout();61 this.splitContainer1.SuspendLayout();62 this.groupBox1.SuspendLayout();63 48 this.SuspendLayout(); 64 49 // 65 // splitContainer1 66 // 67 this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 68 | System.Windows.Forms.AnchorStyles.Left) 69 | System.Windows.Forms.AnchorStyles.Right))); 70 this.splitContainer1.Location = new System.Drawing.Point(0, 57); 71 this.splitContainer1.Name = "splitContainer1"; 72 // 73 // splitContainer1.Panel1 74 // 75 this.splitContainer1.Panel1.Controls.Add(this.genealogyGraphChart); 76 // 77 // splitContainer1.Panel2 78 // 79 this.splitContainer1.Panel2.Controls.Add(this.symbolicExpressionTreeChart); 80 this.splitContainer1.Size = new System.Drawing.Size(1244, 695); 81 this.splitContainer1.SplitterDistance = 605; 82 this.splitContainer1.TabIndex = 0; 83 // 84 // symbolicExpressionTreeChart 85 // 86 this.symbolicExpressionTreeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 87 | System.Windows.Forms.AnchorStyles.Left) 88 | System.Windows.Forms.AnchorStyles.Right))); 89 this.symbolicExpressionTreeChart.BackgroundColor = System.Drawing.Color.White; 90 this.symbolicExpressionTreeChart.LineColor = System.Drawing.Color.Black; 91 this.symbolicExpressionTreeChart.Location = new System.Drawing.Point(0, 0); 92 this.symbolicExpressionTreeChart.Name = "symbolicExpressionTreeChart"; 93 this.symbolicExpressionTreeChart.Size = new System.Drawing.Size(635, 692); 94 this.symbolicExpressionTreeChart.Spacing = 5; 95 this.symbolicExpressionTreeChart.SuspendRepaint = false; 96 this.symbolicExpressionTreeChart.TabIndex = 0; 97 this.symbolicExpressionTreeChart.TextFont = new System.Drawing.Font("Microsoft Sans Serif", 10F); 98 this.symbolicExpressionTreeChart.Tree = null; 99 // 100 // groupBox1 101 // 102 this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 103 | System.Windows.Forms.AnchorStyles.Right))); 104 this.groupBox1.Controls.Add(this.hotPaths_button); 105 this.groupBox1.Controls.Add(this.simpleLineages_checkBox); 106 this.groupBox1.Controls.Add(this.lockGraph_checkBox); 107 this.groupBox1.Controls.Add(this.trace_checkBox); 108 this.groupBox1.Location = new System.Drawing.Point(3, 3); 109 this.groupBox1.Name = "groupBox1"; 110 this.groupBox1.Size = new System.Drawing.Size(1241, 48); 111 this.groupBox1.TabIndex = 4; 112 this.groupBox1.TabStop = false; 113 this.groupBox1.Text = "Controls"; 114 // 115 // hotPaths_button 116 // 117 this.hotPaths_button.Location = new System.Drawing.Point(263, 15); 118 this.hotPaths_button.Name = "hotPaths_button"; 119 this.hotPaths_button.Size = new System.Drawing.Size(75, 23); 120 this.hotPaths_button.TabIndex = 7; 121 this.hotPaths_button.Text = "Hot paths"; 122 this.hotPaths_button.UseVisualStyleBackColor = true; 123 this.hotPaths_button.Click += new System.EventHandler(this.hotPaths_button_Click); 124 // 125 // simpleLineages_checkBox 126 // 127 this.simpleLineages_checkBox.AutoSize = true; 128 this.simpleLineages_checkBox.Location = new System.Drawing.Point(94, 19); 129 this.simpleLineages_checkBox.Name = "simpleLineages_checkBox"; 130 this.simpleLineages_checkBox.Size = new System.Drawing.Size(103, 17); 131 this.simpleLineages_checkBox.TabIndex = 6; 132 this.simpleLineages_checkBox.Text = "Simple Lineages"; 133 this.simpleLineages_checkBox.UseVisualStyleBackColor = true; 134 this.simpleLineages_checkBox.CheckedChanged += new System.EventHandler(this.simpleLineages_checkBox_CheckedChanged); 135 // 136 // lockGraph_checkBox 137 // 138 this.lockGraph_checkBox.AutoSize = true; 139 this.lockGraph_checkBox.Location = new System.Drawing.Point(6, 19); 140 this.lockGraph_checkBox.Name = "lockGraph_checkBox"; 141 this.lockGraph_checkBox.Size = new System.Drawing.Size(82, 17); 142 this.lockGraph_checkBox.TabIndex = 5; 143 this.lockGraph_checkBox.Text = "Lock Graph"; 144 this.lockGraph_checkBox.UseVisualStyleBackColor = true; 145 this.lockGraph_checkBox.CheckedChanged += new System.EventHandler(this.lockGraph_checkBox_CheckedChanged); 146 // 147 // trace_checkBox 148 // 149 this.trace_checkBox.AutoSize = true; 150 this.trace_checkBox.Location = new System.Drawing.Point(203, 19); 151 this.trace_checkBox.Name = "trace_checkBox"; 152 this.trace_checkBox.Size = new System.Drawing.Size(54, 17); 153 this.trace_checkBox.TabIndex = 4; 154 this.trace_checkBox.Text = "Trace"; 155 this.trace_checkBox.UseVisualStyleBackColor = true; 156 this.trace_checkBox.CheckedChanged += new System.EventHandler(this.trace_checkBox_CheckedChanged); 157 // 158 // genealogyGraphChart 159 // 160 this.genealogyGraphChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 161 | System.Windows.Forms.AnchorStyles.Left) 162 | System.Windows.Forms.AnchorStyles.Right))); 163 this.genealogyGraphChart.BackColor = System.Drawing.SystemColors.Control; 164 this.genealogyGraphChart.GenealogyGraph = null; 165 this.genealogyGraphChart.Location = new System.Drawing.Point(-5, 0); 166 this.genealogyGraphChart.LockGenealogy = false; 167 this.genealogyGraphChart.Name = "genealogyGraphChart"; 168 this.genealogyGraphChart.ScaleOnResize = true; 169 this.genealogyGraphChart.SimpleLineages = false; 170 this.genealogyGraphChart.Size = new System.Drawing.Size(607, 692); 171 this.genealogyGraphChart.TabIndex = 0; 172 this.genealogyGraphChart.TraceFragments = false; 173 // 174 // SymboldDataAnalysisGenealogyView 50 // SymbolicDataAnalysisGenealogyGraphView 175 51 // 176 52 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 177 53 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 178 this.Controls.Add(this.groupBox1); 179 this.Controls.Add(this.splitContainer1); 180 this.Name = "SymboldDataAnalysisGenealogyView"; 54 this.Name = "SymbolicDataAnalysisGenealogyGraphView"; 181 55 this.Size = new System.Drawing.Size(1247, 755); 182 this.splitContainer1.Panel1.ResumeLayout(false);183 this.splitContainer1.Panel2.ResumeLayout(false);184 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();185 this.splitContainer1.ResumeLayout(false);186 this.groupBox1.ResumeLayout(false);187 this.groupBox1.PerformLayout();188 56 this.ResumeLayout(false); 189 190 57 } 191 58 192 59 #endregion 193 194 private System.Windows.Forms.SplitContainer splitContainer1;195 private SymbolicDataAnalysisExpressionGenealogyGraphChart genealogyGraphChart;196 private Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart symbolicExpressionTreeChart;197 private System.Windows.Forms.GroupBox groupBox1;198 private System.Windows.Forms.CheckBox simpleLineages_checkBox;199 private System.Windows.Forms.CheckBox lockGraph_checkBox;200 private System.Windows.Forms.CheckBox trace_checkBox;201 private System.Windows.Forms.Button hotPaths_button;202 203 60 } 204 61 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisGenealogyGraphView.cs
r11744 r11817 25 25 using System.Linq; 26 26 using System.Windows.Forms; 27 using HeuristicLab.Core.Views;28 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 29 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views; … … 33 32 34 33 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 35 [View("Symbol dDataAnalysisGenealogyView")]34 [View("SymbolicDataAnalysisGenealogyGraphView")] 36 35 [Content(typeof(IGenealogyGraph<ISymbolicExpressionTree>), IsDefaultView = true)] 37 public partial class Symbol dDataAnalysisGenealogyView : ItemView{36 public partial class SymbolicDataAnalysisGenealogyGraphView : SymbolicDataAnalysisGenealogyGraphViewDesignable { 38 37 private readonly ISymbolicExpressionTreeNodeSimilarityComparer comparer; 39 38 40 public Symbol dDataAnalysisGenealogyView() {39 public SymbolicDataAnalysisGenealogyGraphView() { 41 40 InitializeComponent(); 42 43 41 comparer = new SymbolicExpressionTreeNodeSimilarityComparer(); 42 viewHost.ViewType = typeof(GraphicalSymbolicExpressionTreeView); 44 43 } 45 46 public new IGenealogyGraph<ISymbolicExpressionTree> Content {47 get { return (IGenealogyGraph<ISymbolicExpressionTree>)base.Content; }48 set { base.Content = value; }49 }50 51 44 #region event handlers 52 53 45 protected override void OnContentChanged() { 54 46 base.OnContentChanged(); 55 if (Content != null) { 56 genealogyGraphChart.GenealogyGraph = Content; 47 if (Content != null) { genealogyGraphChart.GenealogyGraph = Content; } 48 } 49 #endregion 50 51 public SymbolicExpressionTreeChart SymbolicExpressionTreeChart { 52 get { 53 var view = (GraphicalSymbolicExpressionTreeView)base.viewHost.ActiveView; 54 return view == null ? null : view.SymbolicExpressionTreeChart; 57 55 } 58 56 } 59 57 60 #endregion61 62 58 protected override void RegisterContentEvents() { 63 genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked;64 genealogyGraphChart.GenealogyGraphNodeDoubleClicked += graphChart_GenealogyGraphNodeDoubleClicked;65 symbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked += treeChart_SymbolicExpressionNodeClicked;66 59 base.RegisterContentEvents(); 60 if (SymbolicExpressionTreeChart != null) 61 SymbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked += treeChart_SymbolicExpressionTreeNodeClicked; 67 62 } 68 63 69 64 protected override void DeregisterContentEvents() { 65 if (SymbolicExpressionTreeChart != null) 66 SymbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked -= treeChart_SymbolicExpressionTreeNodeClicked; 70 67 base.DeregisterContentEvents(); 71 genealogyGraphChart.GenealogyGraphNodeClicked -= graphChart_GenealogyGraphNodeClicked;72 symbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked -= treeChart_SymbolicExpressionNodeClicked;73 68 } 74 69 75 public void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs args) { 70 public override void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs args) { 71 base.graphChart_GenealogyGraphNodeClicked(sender, args); 76 72 var visualNode = (VisualGenealogyGraphNode)sender; 77 73 var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)visualNode.Data; 78 var tree = graphNode.Data;79 symbolicExpressionTreeChart.Tree = tree;80 74 if (graphNode.InArcs.Any()) { 81 75 var fragment = graphNode.InArcs.Last().Data as IFragment<ISymbolicExpressionTreeNode>; … … 95 89 } 96 90 97 public void graphChart_GenealogyGraphNodeDoubleClicked(object sender, MouseEventArgs arcs) { 98 var visualNode = (VisualGenealogyGraphNode)sender; 99 var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)visualNode.Data; 100 // var tree = graphNode.Data; 101 // var model = new RegressionModel(); 102 // var solution = new RegressionSolution() 103 // MainFormManager.MainForm.ShowContent(tree); 104 } 105 106 public void treeChart_SymbolicExpressionNodeClicked(object sender, MouseEventArgs args) { 91 public void treeChart_SymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs args) { 107 92 var visualNode = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender; 108 93 var subtree = visualNode.Content; … … 112 97 treeChart_HighlightSubtree(subtree); 113 98 114 bool trace = genealogyGraphChart.TraceFragments; // check whether the mode is 'trace' or 'match'99 bool trace = genealogyGraphChart.TraceFragments; // check whether we are in 'trace' or 'match' mode 115 100 116 101 if (trace) { … … 118 103 var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)genealogyGraphChart.SelectedGraphNode; 119 104 var subtreeIndex = graphNode.Data.IterateNodesPrefix().ToList().IndexOf(subtree); 120 var fragmentGraph = SymbolicDataAnalysisExpressionTracing.TraceSubtree(graphNode, subtreeIndex); 105 // var fragmentGraph = SymbolicDataAnalysisExpressionTracing.TraceSubtree(graphNode, subtreeIndex); 106 var traceGraph = TraceCalculator.TraceSubtree(graphNode, subtreeIndex); 121 107 122 if ( fragmentGraph.Vertices.Any()) {123 var genealogyNodes = fragmentGraph.Vertices.Select(v => Content.GetByContent(v.Data));108 if (traceGraph.Vertices.Any()) { 109 var genealogyNodes = traceGraph.Vertices.Select(v => Content.GetByContent(v.Data)); 124 110 genealogyGraphChart.HighlightNodes(genealogyNodes); 125 foreach (var a in fragmentGraph.Arcs) {111 foreach (var a in traceGraph.Arcs) { 126 112 genealogyGraphChart.HighlightArc(Content.GetByContent(a.Target.Data), Content.GetByContent(a.Source.Data)); 127 113 } 128 MainFormManager.MainForm.ShowContent( fragmentGraph); // display the fragment graph on the screen114 MainFormManager.MainForm.ShowContent(traceGraph); // display the fragment graph on the screen 129 115 } 130 116 } else { … … 148 134 149 135 private void treeChart_ClearColors() { 150 foreach (var node in symbolicExpressionTreeChart.Tree.IterateNodesPrefix()) {151 var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node);136 foreach (var node in SymbolicExpressionTreeChart.Tree.IterateNodesPrefix()) { 137 var visualNode = SymbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(node); 152 138 if (visualNode != null) { 153 139 visualNode.LineColor = Color.Black; … … 155 141 } 156 142 } 157 symbolicExpressionTreeChart.RepaintNodes();143 SymbolicExpressionTreeChart.RepaintNodes(); 158 144 } 159 145 160 146 private void treeChart_HighlightSubtree(ISymbolicExpressionTreeNode subtree, Color? color = null) { 161 Color myColor = color == null ? Color.RoyalBlue : (Color)color;147 Color myColor = color ?? Color.RoyalBlue; 162 148 foreach (var s in subtree.IterateNodesPrefix()) { 163 var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(s);149 var visualNode = SymbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(s); 164 150 visualNode.LineColor = myColor; 165 151 // visualNode.FillColor = myColor; 166 152 167 153 foreach (var c in s.Subtrees) { 168 var visualArc = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNodeConnection(s, c);154 var visualArc = SymbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNodeConnection(s, c); 169 155 visualArc.LineColor = myColor; 170 156 } 171 157 } 172 symbolicExpressionTreeChart.RepaintNodes(); 173 } 174 175 #region events for configuring the behavior of the genealogy chart (trace/match, simple lineages, etc) 176 private void trace_checkBox_CheckedChanged(object sender, System.EventArgs e) { 177 genealogyGraphChart.TraceFragments = trace_checkBox.Checked; 178 } 179 180 private void simpleLineages_checkBox_CheckedChanged(object sender, System.EventArgs e) { 181 genealogyGraphChart.SimpleLineages = simpleLineages_checkBox.Checked; 182 } 183 184 private void lockGraph_checkBox_CheckedChanged(object sender, System.EventArgs e) { 185 genealogyGraphChart.LockGenealogy = lockGraph_checkBox.Checked; 186 } 187 #endregion 188 189 private void hotPaths_button_Click(object sender, System.EventArgs e) { 190 genealogyGraphChart.HighlightHotPaths(); 158 SymbolicExpressionTreeChart.RepaintNodes(); 191 159 } 192 160 } 161 162 public class SymbolicDataAnalysisGenealogyGraphViewDesignable : GenealogyGraphView<ISymbolicExpressionTree> { } 193 163 }
Note: See TracChangeset
for help on using the changeset viewer.