Changeset 10746 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking
- Timestamp:
- 04/14/14 17:15:32 (11 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking
- Files:
-
- 1 added
- 10 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/FragmentGraphView.cs
r10732 r10746 13 13 [Content(typeof(IGenealogyGraph<IFragment<ISymbolicExpressionTreeNode>>), IsDefaultView = true)] 14 14 public sealed partial class FragmentGraphView : ItemView { 15 private int PreferredSpacing = 50; 15 private const int PreferredHorizontalSpacing = 10; 16 private const int PreferredVerticalSpacing = 25; 16 17 17 18 private ReingoldTilfordLayoutEngine<TileLayoutNode> layoutEngine; … … 31 32 32 33 layoutEngine = new ReingoldTilfordLayoutEngine<TileLayoutNode>(n => n.Children) { 33 HorizontalSpacing = 50,34 VerticalSpacing = 50,34 HorizontalSpacing = PreferredHorizontalSpacing, 35 VerticalSpacing = PreferredVerticalSpacing, 35 36 }; 36 37 symbolicExpressionEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode>(n => n.Subtrees) { 37 HorizontalSpacing = 50,38 VerticalSpacing = 50,38 HorizontalSpacing = PreferredHorizontalSpacing, 39 VerticalSpacing = PreferredVerticalSpacing, 39 40 NodeWidth = 80, 40 41 NodeHeight = 40 … … 74 75 layoutEngine.NodeWidth = maxTileWidth; 75 76 layoutEngine.NodeHeight = maxTileHeight; 76 layoutEngine.HorizontalSpacing = Preferred Spacing;77 layoutEngine.VerticalSpacing = Preferred Spacing;77 layoutEngine.HorizontalSpacing = PreferredHorizontalSpacing; 78 layoutEngine.VerticalSpacing = PreferredVerticalSpacing; 78 79 79 80 var visualNodes = layoutEngine.CalculateLayout(fragmentRoot); … … 92 93 var aPos = aTile.Position; 93 94 94 var lowerLeftMarker = new FixedSizeCircle(chart, aTile.Position, 5, new Pen(Color.Red), new SolidBrush(Color.Transparent)); 95 var upperRightMarker = new FixedSizeCircle(chart, new PointD(aPos.X + aSize.Width, aPos.Y + aSize.Height), 5, 96 new Pen(Color.Blue), new SolidBrush(Color.Transparent)); 97 symbolicExpressionChartControl.Add(lowerLeftMarker); symbolicExpressionChartControl.Add(upperRightMarker); 95 // mark swapped fragment 96 if (node.Content.Index != 0) { 97 var subtree = node.Content.Root.NodeAt(node.Content.Index); 98 foreach (var s in subtree.IterateNodesPrefix()) { 99 var primitive = aTile.GetPrimitive(s); 100 if (primitive != null) { 101 var rpb = primitive as RectangularPrimitiveBase; 102 if (rpb != null) { 103 rpb.Pen = new Pen(Color.RoyalBlue); 104 } 105 } 106 } 107 } 108 109 // mark the subtree that was replaced by the fragment 110 if (node.Children.Any() && node.Content.Index != 0) { 111 var child = node.Children.First(); 112 { 113 var subtree = child.Content.Root.NodeAt(node.Content.Index); 114 var tile = tileDictionary[child].Tile; 115 foreach (var s in subtree.IterateNodesPrefix()) { 116 var primitive = tile.GetPrimitive(s); 117 if (primitive != null) { 118 var rpb = primitive as RectangularPrimitiveBase; 119 if (rpb != null) { 120 rpb.Pen = new Pen(Color.DarkOrange); 121 } 122 } 123 } 124 } 125 } 98 126 99 127 foreach (var child in node.Children) { … … 104 132 var line = new Line(chart, new PointD(aPos.X + aSize.Width / 2.0, aPos.Y + aSize.Height), new PointD(bPos.X + bSize.Width / 2.0, bPos.Y)); 105 133 symbolicExpressionChartControl.Add(line); 134 135 106 136 } 107 137 } 108 // symbolicExpressionChartControl.FlipVertical();109 138 symbolicExpressionChartControl.UpdateEnabled = true; 110 139 symbolicExpressionChartControl.EnforceUpdate(); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Tracking/SymboldDataAnalysisGenealogyView.cs
r10732 r10746 182 182 var fragmentLength = fragment.Root.GetLength(); 183 183 184 var fragmentNode = new FragmentNode { Content = new Fragment<ISymbolicExpressionTreeNode> { Root = subtree }, Rank = graphNode.Rank }; 184 var fragmentNode = new FragmentNode { 185 Content = new Fragment<ISymbolicExpressionTreeNode> { 186 Root = subtree, 187 }, 188 Rank = graphNode.Rank 189 }; 190 185 191 if (parentNode != null) { 186 if (parentNode == fragmentNode) 192 if (parentNode == fragmentNode) { 187 193 throw new Exception("Node cannot be a child of itself!"); 194 } 188 195 var arc = new GenealogyGraphArc { Source = parentNode, Target = fragmentNode }; 189 196 parentNode.AddForwardArc(arc); 190 197 } 191 198 fragmentGraph.AddVertex(fragmentNode); 199 192 200 parentNode = fragmentNode; 193 201 … … 213 221 if (subtreeIndex < fragment.Index && fragment.Index < subtreeIndex + subtreeLength) { 214 222 if (fragmentLength >= subtreeLength) throw new Exception("Subtree contains fragment, so fragment length should be less than the subtree length."); 215 223 fragmentNode.Content.Index = fragment.Index - subtreeIndex; 216 224 graphNode = parentVertices[0]; 225 // debug check 217 226 tree = graphNode.Content; 218 227 subtree = tree.NodeAt(subtreeIndex); 228 if (subtree.GetLength() <= fragmentNode.Content.Index) { 229 throw new Exception("Index exceeds subtree length."); 230 } 219 231 // track subtree 220 232 Trace(graphNode, subtree, fragmentGraph, fragmentNode); … … 222 234 // track fragment 223 235 if (parentVertices.Count > 1) { 236 // save the index of the current fragment in the tree where it was swapped 224 237 graphNode = parentVertices[1]; 225 238 tree = graphNode.Content;
Note: See TracChangeset
for help on using the changeset viewer.