Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9055


Ignore:
Timestamp:
12/14/12 11:18:01 (12 years ago)
Author:
mkommend
Message:

#1763: Minor refactoring in tree simplifier and according views. Additionally model updates are displayed in the according views.

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.cs

    r8110 r9055  
    4040    protected override void OnContentChanged() {
    4141      base.OnContentChanged();
     42      symbolicExpressionTreeView.Content = null;
    4243      if (Content != null)
    4344        symbolicExpressionTreeView.Content = Content.SymbolicExpressionTree;
    44       else
    45         symbolicExpressionTreeView.Content = null;
    4645    }
    4746  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs

    r9043 r9055  
    6767      // viewHost
    6868      //
    69       this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    70             | System.Windows.Forms.AnchorStyles.Left) 
     69      this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     70            | System.Windows.Forms.AnchorStyles.Left)
    7171            | System.Windows.Forms.AnchorStyles.Right)));
    7272      this.viewHost.Caption = "View";
     
    126126      // flowLayoutPanel
    127127      //
    128       this.flowLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
     128      this.flowLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
    129129            | System.Windows.Forms.AnchorStyles.Right)));
    130130      this.flowLayoutPanel.Controls.Add(this.btnSimplify);
     
    170170      // treeChart
    171171      //
    172       this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    173             | System.Windows.Forms.AnchorStyles.Left) 
     172      this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     173            | System.Windows.Forms.AnchorStyles.Left)
    174174            | System.Windows.Forms.AnchorStyles.Right)));
    175175      this.treeChart.BackgroundColor = System.Drawing.Color.White;
     
    184184      this.treeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);
    185185      this.treeChart.Tree = null;
    186       this.treeChart.SymbolicExpressionTreeNodeClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeClicked);
    187186      this.treeChart.SymbolicExpressionTreeNodeDoubleClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeDoubleClicked);
    188187      //
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r9043 r9055  
    108108        treeStatusValue.ForeColor = Color.Green;
    109109      } else {
    110         btnOptimizeConstants.Enabled = true;
    111         btnSimplify.Enabled = true;
     110        btnOptimizeConstants.Enabled = false;
     111        btnSimplify.Enabled = false;
    112112        treeStatusValue.Text = "Invalid";
    113113        treeStatusValue.ForeColor = Color.Red;
     
    167167      constantTreeNode.Value = value;
    168168      return constantTreeNode;
    169     }
    170 
    171     private void treeChart_SymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) {
    172169    }
    173170
     
    186183        parent.InsertSubtree(indexOfSubtree, originalNode);
    187184        changedNodes.Remove(symbExprTreeNode);
    188         UpdateModel(tree);
    189185      } else if (foldedNodes.ContainsKey(symbExprTreeNode)) {
    190186        // undo node folding
    191187        SwitchNodeWithReplacementNode(parent, indexOfSubtree);
    192         UpdateModel(tree);
    193       }
     188      }
     189      UpdateModel(tree);
    194190    }
    195191
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs

    r9043 r9055  
    7979
    8080    protected override void OnSymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) {
    81       if (currSelected != null) {
    82         currSelected.LineColor = Color.FromArgb(255, currSelected.LineColor);
    83         RepaintNode(currSelected);
    84       }
    8581      currSelected = (VisualSymbolicExpressionTreeNode)sender; ;
    8682      if (currSelected != null) {
     
    8884        RepaintNode(currSelected);
    8985      }
     86      base.OnSymbolicExpressionTreeNodeClicked(sender, e);
    9087    }
    9188
    9289    protected override void SymbolicExpressionTreeChart_MouseClick(object sender, MouseEventArgs e) {
    93       var visualTreeNode = FindVisualSymbolicExpressionTreeNodeAt(e.X, e.Y);
    94       if (visualTreeNode != null) {
    95         OnSymbolicExpressionTreeNodeClicked(visualTreeNode, e);
    96       } else if (currSelected != null) {
     90      if (currSelected != null) {
    9791        currSelected.LineColor = Color.FromArgb(255, currSelected.LineColor);
    9892        RepaintNode(currSelected);
    99         currSelected = null;
    100       }
     93      }
     94      base.SymbolicExpressionTreeChart_MouseClick(sender, e);
    10195    }
    10296
     
    173167    private void copySubtree() {
    174168      if (tempNode != null) {
    175         foreach (var subtree in tempNode.IterateNodesBreadth()) {
    176           var vNode = GetVisualSymbolicExpressionTreeNode(subtree);
    177           vNode.LineColor = Color.FromArgb(255, vNode.LineColor); // reset the alpha value to 255
     169        foreach (var subtree in tempNode.IterateNodesPostfix()) {
     170          var visualNode = GetVisualSymbolicExpressionTreeNode(subtree);
     171          visualNode.LineColor = Color.FromArgb(255, visualNode.LineColor); // reset the alpha value to 255
     172          visualNode.TextColor = Color.FromArgb(255, visualNode.TextColor);
    178173          if (subtree.Parent != null) {
    179             var vArc = GetVisualSymbolicExpressionTreeNodeConnection(subtree.Parent, subtree);
    180             vArc.LineColor = Color.FromArgb(255, vArc.LineColor);
     174            var visualLine = GetVisualSymbolicExpressionTreeNodeConnection(subtree.Parent, subtree);
     175            visualLine.LineColor = Color.FromArgb(255, visualLine.LineColor);
    181176          }
    182177        }
     
    197192    private void removeNodeToolStripMenuItem_Click(object sender, EventArgs e) {
    198193      var node = currSelected.SymbolicExpressionTreeNode;
     194      if (node == tempNode) tempNode = null;
    199195      ModifyTree(Tree, node.Parent, node, null, removeSubtree: false);
    200196      currSelected = null; // because the currently selected node was just deleted
     
    202198    private void removeSubtreeToolStripMenuItem_Click(object sender, EventArgs e) {
    203199      var node = currSelected.SymbolicExpressionTreeNode;
     200      if (node.IterateNodesPostfix().Contains(tempNode)) tempNode = null;
    204201      ModifyTree(Tree, node.Parent, node, null, removeSubtree: true);
    205202      currSelected = null; // because the currently selected node was just deleted
Note: See TracChangeset for help on using the changeset viewer.