Changeset 10799
- Timestamp:
- 05/06/14 15:33:50 (11 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs
r10565 r10799 39 39 private const int preferredNodeWidth = 70; 40 40 private const int preferredNodeHeight = 46; 41 private constint minHorizontalDistance = 30;42 private constint minVerticalDistance = 30;41 private int minHorizontalDistance = 30; 42 private int minVerticalDistance = 30; 43 43 44 44 public SymbolicExpressionTreeChart() { … … 62 62 reingoldTilfordToolStripMenuItem.Checked = true; 63 63 } 64 65 //private ILayoutEngine<ISymbolicExpressionTreeNode> TreeLayoutEngine {66 // get { return layoutEngine; }67 // set {68 // layoutEngine = value;69 // InitializeLayout();70 // Repaint();71 // }72 //}73 64 74 65 public SymbolicExpressionTreeChart(ISymbolicExpressionTree tree) … … 412 403 413 404 private void reingoldTilfordToolStripMenuItem_Click(object sender, EventArgs e) { 405 minHorizontalDistance = 30; 414 406 layoutEngine = new ReingoldTilfordLayoutEngine<ISymbolicExpressionTreeNode>(n => n.Subtrees) { 415 407 NodeWidth = preferredNodeWidth, … … 424 416 425 417 private void boxesToolStripMenuItem_Click(object sender, EventArgs e) { 418 minHorizontalDistance = 1; // the boxes layout engine has no horizontal requirements, it automatically spaces nodes with boxes 426 419 layoutEngine = new BoxesLayoutEngine<ISymbolicExpressionTreeNode>(n => n.Subtrees, n => n.GetLength(), n => n.GetDepth()) { 427 420 NodeWidth = preferredNodeWidth, -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r10564 r10799 105 105 private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) { 106 106 var visualNode = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender; 107 if (visualNode.Content == null) { throw new Exception("Visual node content cannot be null."); } 107 108 var symbExprTreeNode = (SymbolicExpressionTreeNode)visualNode.Content; 108 if (symbExprTreeNode == null) return; 109 var tree = Content.Model.SymbolicExpressionTree; 109 if (!foldedNodes.ContainsKey(symbExprTreeNode)) return; // constant nodes cannot be folded 110 110 var parent = symbExprTreeNode.Parent; 111 111 int indexOfSubtree = parent.IndexOfSubtree(symbExprTreeNode); 112 if (foldedNodes.ContainsKey(symbExprTreeNode)) { 113 // undo node folding 114 SwitchNodeWithReplacementNode(parent, indexOfSubtree); 115 } 116 UpdateModel(tree); 112 SwitchNodeWithReplacementNode(parent, indexOfSubtree); 113 UpdateModel(Content.Model.SymbolicExpressionTree); 117 114 } 118 115 119 116 private void SwitchNodeWithReplacementNode(ISymbolicExpressionTreeNode parent, int subTreeIndex) { 120 117 ISymbolicExpressionTreeNode subTree = parent.GetSubtree(subTreeIndex); 121 parent.RemoveSubtree(subTreeIndex);122 118 if (foldedNodes.ContainsKey(subTree)) { 119 parent.RemoveSubtree(subTreeIndex); 123 120 var replacementNode = foldedNodes[subTree]; 124 121 parent.InsertSubtree(subTreeIndex, replacementNode); … … 137 134 138 135 if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) { 136 visualTree.ToolTip = visualTree.Content.ToString(); // to avoid duplicate tooltips 139 137 double impact = nodeImpacts[treeNode]; 140 138
Note: See TracChangeset
for help on using the changeset viewer.