Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/31/14 13:38:42 (11 years ago)
Author:
mkommend
Message:

#1837: Corrected project files and merged trunk changes to the sliding window branch.

Location:
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r9708 r10681  
    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
     
    7072    }
    7173
     74    private void treeChart_Repainted(object sender, EventArgs e) {
     75      if (nodeImpacts != null && nodeImpacts.Count > 0)
     76        PaintNodeImpacts();
     77    }
     78
    7279    private void UpdateView() {
    7380      if (Content == null || Content.Model == null || Content.ProblemData == null) return;
     
    7582      treeChart.Tree = tree.Root.SubtreeCount > 1 ? new SymbolicExpressionTree(tree.Root) : new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0));
    7683
    77       var replacementValues = CalculateReplacementValues(tree);
     84      var impactAndReplacementValues = CalculateImpactAndReplacementValues(tree);
     85      nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1);
     86      var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2);
    7887      foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) {
    7988        foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value);
    8089      }
    81 
    82       nodeImpacts = CalculateImpactValues(tree);
    8390      PaintNodeImpacts();
    8491    }
     
    8693    protected abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree);
    8794    protected abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree);
     95    protected abstract Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree);
    8896    protected abstract void UpdateModel(ISymbolicExpressionTree tree);
    8997
     
    96104
    97105    private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {
    98       var visualNode = (VisualSymbolicExpressionTreeNode)sender;
    99       var symbExprTreeNode = (SymbolicExpressionTreeNode)visualNode.SymbolicExpressionTreeNode;
     106      var visualNode = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender;
     107      var symbExprTreeNode = (SymbolicExpressionTreeNode)visualNode.Content;
    100108      if (symbExprTreeNode == null) return;
    101109      var tree = Content.Model.SymbolicExpressionTree;
     
    125133      double max = impacts.Max();
    126134      double min = impacts.Min();
    127       foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
    128         VisualSymbolicExpressionTreeNode visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
     135      foreach (var treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
     136        VisualTreeNode<ISymbolicExpressionTreeNode> visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
    129137
    130138        if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) {
Note: See TracChangeset for help on using the changeset viewer.