Changeset 12017 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking
- Timestamp:
- 02/16/15 16:52:52 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisGenealogyGraphView.Designer.cs
r11864 r12017 63 63 // splitContainer 64 64 // 65 this.splitContainer.Size = new System.Drawing.Size(1241, 700); 66 this.splitContainer.SplitterDistance = 617; 67 // 68 // viewHost 69 // 70 this.viewHost.Size = new System.Drawing.Size(617, 697); 65 71 // 66 72 // genealogyGraphChart 67 73 // 68 this.genealogyGraphChart.Size = new System.Drawing.Size(6 92, 697);74 this.genealogyGraphChart.Size = new System.Drawing.Size(614, 697); 69 75 // 70 76 // groupBox1 -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymbolicDataAnalysisGenealogyGraphView.cs
r11927 r12017 39 39 private readonly ISymbolicExpressionTreeNodeEqualityComparer comparer; 40 40 41 private ISymbolicExpressionTreeNode selectedSubtree; 42 private ISymbolicExpressionTreeNode SelectedSubtree { 43 get { 44 return selectedSubtree; 45 } 46 set { 47 if (selectedSubtree == value) return; 48 selectedSubtree = value; 49 ClonedSubtree = (ISymbolicExpressionTreeNode)selectedSubtree.Clone(); 50 } 51 } 52 53 private ISymbolicExpressionTreeNode ClonedSubtree { get; set; } 54 41 55 public SymbolicDataAnalysisGenealogyGraphView() { 42 56 InitializeComponent(); … … 100 114 var nodes = graphNode.Data.IterateNodesPrefix().ToList(); 101 115 treeChart_HighlightSubtree(nodes[td.LastSubtreeIndex], Color.Orange); 102 treeChart_HighlightSubtree(nodes[td.LastFragmentIndex], Color.DodgerBlue);116 treeChart_HighlightSubtree(nodes[td.LastFragmentIndex], null, Color.PowderBlue); 103 117 } 104 118 } … … 114 128 bool trace = genealogyGraphChart.TraceFragments; // check whether we are in 'trace' or 'match' mode 115 129 116 if (trace) { 117 // perform fragment tracing 118 var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)genealogyGraphChart.SelectedGraphNode; 119 var subtreeIndex = graphNode.Data.IterateNodesPrefix().ToList().IndexOf(subtree); 120 var traceGraph = TraceCalculator.TraceSubtree(graphNode, subtreeIndex); 121 if (traceGraph.Vertices.Any()) { 122 genealogyGraphChart.UpdateEnabled = false; 123 genealogyGraphChart.ClearArcs(); 124 var genealogyNodes = traceGraph.Vertices.Select(v => Content.GetByContent(v.Data)); 125 genealogyGraphChart.HighlightNodes(genealogyNodes, Color.Black, false); 126 genealogyGraphChart.UpdateEnabled = true; 127 genealogyGraphChart.EnforceUpdate(); 128 MainFormManager.MainForm.ShowContent(traceGraph); // display the fragment graph on the screen 129 } 130 } else { 131 // perform matching like it was done before 132 // currently there is no possibility to specify the subtree matching criteria 133 var trees = Content.Vertices.Select(x => x.Data); 134 var matchingTrees = trees.Where(x => x.Root.ContainsSubtree(subtree, comparer)); 135 136 var matchingVertices = matchingTrees.Select(x => Content.GetByContent(x)); 137 graphChart_HighlightMatchingVertices(matchingVertices); 130 switch (args.Button) { 131 case MouseButtons.Left: 132 SelectedSubtree = subtree; 133 if (trace) { 134 // perform fragment tracing 135 var graphNode = (IGenealogyGraphNode<ISymbolicExpressionTree>)genealogyGraphChart.SelectedGraphNode; 136 var subtreeIndex = graphNode.Data.IterateNodesPrefix().ToList().IndexOf(subtree); 137 var traceGraph = TraceCalculator.TraceSubtree(graphNode, subtreeIndex); 138 if (traceGraph.Vertices.Any()) { 139 genealogyGraphChart.UpdateEnabled = false; 140 genealogyGraphChart.ClearArcs(); 141 var genealogyNodes = traceGraph.Vertices.Select(v => Content.GetByContent(v.Data)); 142 genealogyGraphChart.HighlightNodes(genealogyNodes, Color.Black, false); 143 genealogyGraphChart.UpdateEnabled = true; 144 genealogyGraphChart.EnforceUpdate(); 145 MainFormManager.MainForm.ShowContent(traceGraph); // display the fragment graph on the screen 146 } 147 } else { 148 // perform matching like it was done before 149 // currently there is no possibility to specify the subtree matching criteria 150 var trees = Content.Vertices.Select(x => x.Data); 151 var matchingTrees = trees.Where(x => x.Root.ContainsSubtree(subtree, comparer)); 152 153 var matchingVertices = matchingTrees.Select(x => Content.GetByContent(x)); 154 graphChart_HighlightMatchingVertices(matchingVertices); 155 } 156 break; 157 case MouseButtons.Middle: 158 var index = SelectedSubtree.IterateNodesPrefix().ToList().IndexOf(subtree); 159 if (index > 0) { 160 var s = ClonedSubtree.NodeAt(index); 161 s.Parent.RemoveSubtree(s.Parent.IndexOfSubtree(s)); 162 163 var trees = Content.Vertices.Select(x => x.Data); 164 var matchingTrees = trees.Where(x => x.Root.ContainsSubtree(ClonedSubtree, comparer)); 165 166 var matchingVertices = matchingTrees.Select(x => Content.GetByContent(x)); 167 treeChart_HighlightSubtree(subtree, Color.Black, Color.White); 168 graphChart_HighlightMatchingVertices(matchingVertices); 169 } 170 break; 138 171 } 139 172 } … … 158 191 } 159 192 160 private void treeChart_HighlightSubtree(ISymbolicExpressionTreeNode subtree, Color? color = null) { 161 Color myColor = color ?? Color.RoyalBlue; 193 private void treeChart_HighlightSubtree(ISymbolicExpressionTreeNode subtree, Color? lineColor = null, Color? fillColor = null) { 194 var lc = lineColor ?? Color.RoyalBlue; 195 var fc = fillColor ?? Color.White; 162 196 foreach (var s in subtree.IterateNodesPrefix()) { 163 197 var visualNode = SymbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(s); 164 visualNode.LineColor = myColor; 198 visualNode.LineColor = lc; 199 visualNode.FillColor = fc; 165 200 166 201 foreach (var c in s.Subtrees) { 167 202 var visualArc = SymbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNodeConnection(s, c); 168 visualArc.LineColor = myColor;203 visualArc.LineColor = lc; 169 204 } 170 205 }
Note: See TracChangeset
for help on using the changeset viewer.