Changeset 11503 for branches/HeuristicLab.EvolutionTracking
- Timestamp:
- 10/26/14 22:20:26 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
r11253 r11503 283 283 <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon> 284 284 </Compile> 285 <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs" /> 285 <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.cs"> 286 <SubType>UserControl</SubType> 287 </Compile> 286 288 <Compile Include="Tracking\SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs"> 287 289 <DependentUpon>SymbolicDataAnalysisExpressionGenealogyGraphChart.cs</DependentUpon> … … 370 372 </Content> 371 373 </ItemGroup> 372 <ItemGroup>373 <EmbeddedResource Include="Tracking\SymboldDataAnalysisGenealogyView.resx">374 <DependentUpon>SymboldDataAnalysisGenealogyView.cs</DependentUpon>375 </EmbeddedResource>376 </ItemGroup>377 374 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 378 375 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymboldDataAnalysisGenealogyView.cs
r11253 r11503 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Drawing; … … 61 62 protected override void RegisterContentEvents() { 62 63 genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked; 64 genealogyGraphChart.GenealogyGraphNodeDoubleClicked += graphChart_GenealogyGraphNodeDoubleClicked; 63 65 symbolicExpressionTreeChart.SymbolicExpressionTreeNodeClicked += treeChart_SymbolicExpressionNodeClicked; 64 66 base.RegisterContentEvents(); … … 78 80 79 81 if (graphNode.InArcs.Any()) { 80 var fragment = (IFragment<ISymbolicExpressionTreeNode>)graphNode.InArcs.Last().Data;82 var fragment = graphNode.InArcs.Last().Data as IFragment<ISymbolicExpressionTreeNode>; 81 83 if (fragment != null) { 82 84 treeChart_HighlightSubtree(graphNode.Data.NodeAt(fragment.Index1)); 85 } else { 86 var td = graphNode.InArcs.Last().Data as Tuple<int, int, int, int>; 87 if (td != null) { 88 var s = graphNode.Data.NodeAt(td.Item1); 89 var f = graphNode.Data.NodeAt(td.Item2); 90 treeChart_HighlightSubtree(s, Color.Orange); 91 treeChart_HighlightSubtree(f, Color.RoyalBlue); 92 } 83 93 } 84 94 } 95 } 96 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 MainFormManager.MainForm.ShowContent(tree); 85 102 } 86 103 … … 109 126 var matchingTrees = trees.Where(x => x.Root.ContainsSubtree(subtree, comparer)); 110 127 111 var matchingVertices = matchingTrees.Select(x => Content.GetByContent(x)) .Cast<IGenealogyGraphNode<ISymbolicExpressionTree>>();128 var matchingVertices = matchingTrees.Select(x => Content.GetByContent(x)); 112 129 graphChart_highlightMatchingVertices(matchingVertices); 113 130 } … … 133 150 } 134 151 135 private void treeChart_HighlightSubtree(ISymbolicExpressionTreeNode subtree) { 152 private void treeChart_HighlightSubtree(ISymbolicExpressionTreeNode subtree, Color? color = null) { 153 Color myColor = color == null ? Color.RoyalBlue : (Color)color; 136 154 foreach (var s in subtree.IterateNodesPrefix()) { 137 155 var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(s); 138 visualNode.LineColor = Color.RoyalBlue;139 visualNode.FillColor = Color.LightBlue;156 visualNode.LineColor = myColor; 157 // visualNode.FillColor = myColor; 140 158 141 159 foreach (var c in s.Subtrees) { 142 160 var visualArc = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNodeConnection(s, c); 143 visualArc.LineColor = Color.RoyalBlue;161 visualArc.LineColor = myColor; 144 162 } 145 163 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisExpressionGenealogyGraphChart.Designer.cs
r10746 r11503 1 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 1 using System.Windows.Forms; 2 3 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 2 4 partial class SymbolicDataAnalysisExpressionGenealogyGraphChart { 3 5 /// <summary> … … 24 26 /// </summary> 25 27 private void InitializeComponent() { 26 components = new System.ComponentModel.Container(); 28 ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); 29 this.SuspendLayout(); 30 // 31 // pictureBox 32 // 33 this.pictureBox.MouseDoubleClick += new MouseEventHandler(this.pictureBox_DoubleClick); 34 // 35 // SymbolicDataAnalysisExpressionGenealogyGraphChart 36 // 37 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 27 38 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 39 this.Name = "SymbolicDataAnalysisExpressionGenealogyGraphChart"; 40 this.Controls.SetChildIndex(this.pictureBox, 0); 41 ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); 42 this.ResumeLayout(false); 43 28 44 } 29 45 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisExpressionGenealogyGraphChart.cs
r10746 r11503 20 20 #endregion 21 21 22 using System.Linq; 23 using System.Windows.Forms; 22 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 23 25 using HeuristicLab.EvolutionTracking; … … 34 36 set { base.GenealogyGraph = value; } 35 37 } 38 39 private void pictureBox_DoubleClick(object sender, MouseEventArgs e) { 40 var visualNodes = Chart.GetAllPrimitives(e.Location).Where(p => p is VisualGenealogyGraphNode).ToList(); 41 if (!visualNodes.Any()) { 42 SelectedVisualNode = null; 43 return; 44 } 45 var visualNode = visualNodes.First(); 46 47 base.OnGenealogyGraphNodeDoubleClicked(visualNode, e); 48 } 36 49 // add event handlers here for processing events coming from the tree chart 37 50 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/TraceCalculator.cs
r11493 r11503 187 187 private void ConnectLast(IGenealogyGraphNode<ISymbolicExpressionTree> g, int si, IGenealogyGraphNode<ISymbolicExpressionTree> last) { 188 188 IFragment<ISymbolicExpressionTreeNode> fragment = g.Parents.Any() ? (IFragment<ISymbolicExpressionTreeNode>)g.InArcs.Last().Data : null; 189 var n = traceGraph.GetByContent(g.Data);190 if (n == null) {191 n = g.Copy();192 traceGraph.AddVertex(n);193 }194 189 int fi = fragment == null ? 0 : fragment.Index1; // fragment index 195 traceMap[n] = new Tuple<int, int>(si, fi);190 var n = GetTraceNode(g, si, fi); // will append n to the trace graph if it does not exist 196 191 if (last == null) 197 192 return; … … 201 196 var td = new Tuple<int, int, int, int>(si, fi, lastSi, lastFi); // trace data 202 197 var arc = n.InArcs.SingleOrDefault(a => a.Source == last && a.Data.Equals(td)); 203 if (arc != null)204 return;205 arc = new GenealogyGraphArc(last, n) { Data = td };206 traceGraph.AddArc(arc);198 if (arc == null) { 199 arc = new GenealogyGraphArc(last, n) { Data = td }; 200 traceGraph.AddArc(arc); 201 } 207 202 } 208 203 }
Note: See TracChangeset
for help on using the changeset viewer.