- Timestamp:
- 07/07/14 16:55:50 (10 years ago)
- Location:
- stable
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 10496,10499,10520-10523,10531,10561,10564-10565,10799-10800,10862,10885,10953,10956,11065
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views merged: 10521-10522,10561,10564,10799,10956
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r9478 r11120 52 52 Content.ModelChanged += Content_Changed; 53 53 Content.ProblemDataChanged += Content_Changed; 54 treeChart.Repainted += treeChart_Repainted; 54 55 } 55 56 protected override void DeregisterContentEvents() { … … 57 58 Content.ModelChanged -= Content_Changed; 58 59 Content.ProblemDataChanged -= Content_Changed; 60 treeChart.Repainted -= treeChart_Repainted; 59 61 } 60 62 … … 68 70 UpdateView(); 69 71 viewHost.Content = this.Content; 72 } 73 74 private void treeChart_Repainted(object sender, EventArgs e) { 75 if (nodeImpacts != null && nodeImpacts.Count > 0) 76 PaintNodeImpacts(); 70 77 } 71 78 … … 96 103 97 104 private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) { 98 var visualNode = (Visual SymbolicExpressionTreeNode)sender;99 var symbExprTreeNode = (SymbolicExpressionTreeNode)visualNode.SymbolicExpressionTreeNode;100 if (symbExprTreeNode == null) return;101 var tree = Content.Model.SymbolicExpressionTree;105 var visualNode = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender; 106 if (visualNode.Content == null) { throw new Exception("Visual node content cannot be null."); } 107 var symbExprTreeNode = (SymbolicExpressionTreeNode)visualNode.Content; 108 if (!foldedNodes.ContainsKey(symbExprTreeNode)) return; // constant nodes cannot be folded 102 109 var parent = symbExprTreeNode.Parent; 103 110 int indexOfSubtree = parent.IndexOfSubtree(symbExprTreeNode); 104 if (foldedNodes.ContainsKey(symbExprTreeNode)) { 105 // undo node folding 106 SwitchNodeWithReplacementNode(parent, indexOfSubtree); 107 } 108 UpdateModel(tree); 111 SwitchNodeWithReplacementNode(parent, indexOfSubtree); 112 UpdateModel(Content.Model.SymbolicExpressionTree); 109 113 } 110 114 111 115 private void SwitchNodeWithReplacementNode(ISymbolicExpressionTreeNode parent, int subTreeIndex) { 112 116 ISymbolicExpressionTreeNode subTree = parent.GetSubtree(subTreeIndex); 113 parent.RemoveSubtree(subTreeIndex);114 117 if (foldedNodes.ContainsKey(subTree)) { 118 parent.RemoveSubtree(subTreeIndex); 115 119 var replacementNode = foldedNodes[subTree]; 116 120 parent.InsertSubtree(subTreeIndex, replacementNode); … … 125 129 double max = impacts.Max(); 126 130 double min = impacts.Min(); 127 foreach ( ISymbolicExpressionTreeNodetreeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {128 Visual SymbolicExpressionTreeNodevisualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);131 foreach (var treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) { 132 VisualTreeNode<ISymbolicExpressionTreeNode> visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode); 129 133 130 134 if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) { 135 visualTree.ToolTip = visualTree.Content.ToString(); // to avoid duplicate tooltips 131 136 double impact = nodeImpacts[treeNode]; 132 137 -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs
r9456 r11120 33 33 internal sealed partial class InteractiveSymbolicExpressionTreeChart : SymbolicExpressionTreeChart { 34 34 private ISymbolicExpressionTreeNode tempNode; // node in clipboard (to be cut/copy/pasted etc) 35 private Visual SymbolicExpressionTreeNodecurrSelected; // currently selected node35 private VisualTreeNode<ISymbolicExpressionTreeNode> currSelected; // currently selected node 36 36 private enum EditOp { NoOp, CopySubtree, CutSubtree } 37 37 private EditOp lastOp = EditOp.NoOp; … … 65 65 pasteToolStripMenuItem.Visible = false; 66 66 } else { 67 var node = currSelected. SymbolicExpressionTreeNode;67 var node = currSelected.Content; 68 68 insertNodeToolStripMenuItem.Visible = true; 69 69 changeNodeToolStripMenuItem.Visible = true; … … 77 77 pasteToolStripMenuItem.Enabled = tempNode != null && insertNodeToolStripMenuItem.Enabled 78 78 && !(lastOp == EditOp.CutSubtree 79 && tempNode.IterateNodesBreadth().Contains(currSelected. SymbolicExpressionTreeNode));79 && tempNode.IterateNodesBreadth().Contains(currSelected.Content)); 80 80 } 81 81 } 82 82 83 83 protected override void OnSymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) { 84 currSelected = (Visual SymbolicExpressionTreeNode)sender; ;84 currSelected = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender; ; 85 85 if (currSelected != null) { 86 86 currSelected.LineColor = Color.FromArgb(130, currSelected.LineColor); … … 104 104 105 105 private void insertNodeToolStripMenuItem_Click(object sender, EventArgs e) { 106 if (currSelected == null || currSelected. SymbolicExpressionTreeNodeis SymbolicExpressionTreeTerminalNode) return;107 var parent = currSelected. SymbolicExpressionTreeNode;106 if (currSelected == null || currSelected.Content is SymbolicExpressionTreeTerminalNode) return; 107 var parent = currSelected.Content; 108 108 109 109 using (var dialog = new InsertNodeDialog()) { … … 138 138 if (currSelected == null) return; 139 139 140 var node = (ISymbolicExpressionTreeNode)currSelected. SymbolicExpressionTreeNode.Clone();141 var originalNode = currSelected. SymbolicExpressionTreeNode;140 var node = (ISymbolicExpressionTreeNode)currSelected.Content.Clone(); 141 var originalNode = currSelected.Content; 142 142 143 143 ISymbolicExpressionTreeNode newNode = null; … … 180 180 } 181 181 } 182 tempNode = currSelected. SymbolicExpressionTreeNode;182 tempNode = currSelected.Content; 183 183 foreach (var node in tempNode.IterateNodesPostfix()) { 184 184 var visualNode = GetVisualSymbolicExpressionTreeNode(node); … … 194 194 } 195 195 private void removeNodeToolStripMenuItem_Click(object sender, EventArgs e) { 196 var node = currSelected. SymbolicExpressionTreeNode;196 var node = currSelected.Content; 197 197 if (node == tempNode) tempNode = null; 198 198 ModifyTree(Tree, node.Parent, node, null, removeSubtree: false); … … 200 200 } 201 201 private void removeSubtreeToolStripMenuItem_Click(object sender, EventArgs e) { 202 var node = currSelected. SymbolicExpressionTreeNode;202 var node = currSelected.Content; 203 203 if (node.IterateNodesPostfix().Contains(tempNode)) tempNode = null; 204 204 ModifyTree(Tree, node.Parent, node, null, removeSubtree: true); … … 209 209 if (!(lastOp == EditOp.CopySubtree || lastOp == EditOp.CutSubtree)) return; 210 210 // check if the copied/cut node (stored in the tempNode) can be inserted as a child of the current selected node 211 var node = currSelected. SymbolicExpressionTreeNode;211 var node = currSelected.Content; 212 212 if (node is ConstantTreeNode || node is VariableTreeNode) return; 213 213 // check if the currently selected node can accept the copied node as a child … … 218 218 if (tempNode.IterateNodesBreadth().Contains(node)) 219 219 throw new ArgumentException();// cannot cut/paste a node into itself 220 ModifyTree(Tree, tempNode.Parent, tempNode, null); //remove node from its original parent 220 ModifyTree(Tree, tempNode.Parent, tempNode, null); //remove node from its original parent 221 221 ModifyTree(Tree, node, null, tempNode); //insert it as a child to the new parent 222 222 break; -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TextualSymbolicDataAnalysisModelView.designer.cs
r11118 r11120 48 48 this.SuspendLayout(); 49 49 // 50 // expressionTreeView50 // symbolicExpressionTreeView 51 51 // 52 52 this.symbolicExpressionTreeView.AllowDrop = true; … … 55 55 this.symbolicExpressionTreeView.Dock = System.Windows.Forms.DockStyle.Fill; 56 56 this.symbolicExpressionTreeView.Location = new System.Drawing.Point(0, 0); 57 this.symbolicExpressionTreeView.Name = " expressionTreeView";57 this.symbolicExpressionTreeView.Name = "symbolicExpressionTreeView"; 58 58 this.symbolicExpressionTreeView.ReadOnly = false; 59 59 this.symbolicExpressionTreeView.Size = new System.Drawing.Size(352, 413); 60 60 this.symbolicExpressionTreeView.TabIndex = 0; 61 61 // 62 // SymbolicExpressionModelView62 // TextualSymbolicDataAnalysisModelView 63 63 // 64 64 this.AllowDrop = true; 65 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);66 65 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 67 66 this.Controls.Add(this.symbolicExpressionTreeView); 68 this.Name = " SymbolicExpressionModelView";67 this.Name = "TextualSymbolicDataAnalysisModelView"; 69 68 this.Size = new System.Drawing.Size(352, 413); 70 69 this.ResumeLayout(false);
Note: See TracChangeset
for help on using the changeset viewer.