Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.cs @ 18146

Last change on this file since 18146 was 18099, checked in by dpiringe, 2 years ago

#3136

  • set the default template to f(_) when loading a new problem data
  • fixed a bug which caused the drawing of uncolored SubFunctionTreeNodes after using the window splitter
  • implemented a method to paint nodes of SubFunctionTreeNode as colored nodes for ISymbolicDataAnalysisModel
File size: 2.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System.Drawing;
23using System.Windows.Forms;
24using HeuristicLab.MainForm;
25using HeuristicLab.MainForm.WindowsForms;
26
27namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
28  [View("Graphical Representation")]
29  [Content(typeof(ISymbolicDataAnalysisModel), true)]
30  public partial class GraphicalSymbolicDataAnalysisModelView : AsynchronousContentView {
31    public GraphicalSymbolicDataAnalysisModelView()
32      : base() {
33      InitializeComponent();
34    }
35
36    public new ISymbolicDataAnalysisModel Content {
37      get { return (ISymbolicDataAnalysisModel)base.Content; }
38      set { base.Content = value; }
39    }
40
41    protected override void OnContentChanged() {
42      base.OnContentChanged();
43      symbolicExpressionTreeChart.Tree = null;
44      if (Content != null) {
45        symbolicExpressionTreeChart.Tree = Content.SymbolicExpressionTree;
46        RepaintNodes();
47      }
48    }
49
50    protected void RepaintNodes() {
51      var tree = symbolicExpressionTreeChart.Tree;
52      if (tree != null) {
53        foreach (var n in tree.IterateNodesPrefix()) {
54          if (n.Symbol is SubFunctionSymbol) {
55            var visualNode = symbolicExpressionTreeChart.GetVisualSymbolicExpressionTreeNode(n);
56            visualNode.FillColor = Color.LightCyan;
57            visualNode.LineColor = Color.SlateGray;
58          }
59        }
60        symbolicExpressionTreeChart.RepaintNodes();
61      }
62    }
63  }
64}
Note: See TracBrowser for help on using the repository browser.