Ignore:
Timestamp:
07/07/14 16:55:50 (5 years ago)
Author:
gkronber
Message:

#2076,#2159, #2092
multi-ticket merge to stable:

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r9478 r11120  
    5252      Content.ModelChanged += Content_Changed;
    5353      Content.ProblemDataChanged += Content_Changed;
     54      treeChart.Repainted += treeChart_Repainted;
    5455    }
    5556    protected override void DeregisterContentEvents() {
     
    5758      Content.ModelChanged -= Content_Changed;
    5859      Content.ProblemDataChanged -= Content_Changed;
     60      treeChart.Repainted -= treeChart_Repainted;
    5961    }
    6062
     
    6870      UpdateView();
    6971      viewHost.Content = this.Content;
     72    }
     73
     74    private void treeChart_Repainted(object sender, EventArgs e) {
     75      if (nodeImpacts != null && nodeImpacts.Count > 0)
     76        PaintNodeImpacts();
    7077    }
    7178
     
    96103
    97104    private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {
    98       var visualNode = (VisualSymbolicExpressionTreeNode)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
    102109      var parent = symbExprTreeNode.Parent;
    103110      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);
    109113    }
    110114
    111115    private void SwitchNodeWithReplacementNode(ISymbolicExpressionTreeNode parent, int subTreeIndex) {
    112116      ISymbolicExpressionTreeNode subTree = parent.GetSubtree(subTreeIndex);
    113       parent.RemoveSubtree(subTreeIndex);
    114117      if (foldedNodes.ContainsKey(subTree)) {
     118        parent.RemoveSubtree(subTreeIndex);
    115119        var replacementNode = foldedNodes[subTree];
    116120        parent.InsertSubtree(subTreeIndex, replacementNode);
     
    125129      double max = impacts.Max();
    126130      double min = impacts.Min();
    127       foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
    128         VisualSymbolicExpressionTreeNode visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
     131      foreach (var treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
     132        VisualTreeNode<ISymbolicExpressionTreeNode> visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
    129133
    130134        if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) {
     135          visualTree.ToolTip = visualTree.Content.ToString(); // to avoid duplicate tooltips
    131136          double impact = nodeImpacts[treeNode];
    132137
Note: See TracChangeset for help on using the changeset viewer.