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 |
|
---|
22 | using System.Drawing;
|
---|
23 | using System.Windows.Forms;
|
---|
24 | using HeuristicLab.MainForm;
|
---|
25 | using HeuristicLab.MainForm.WindowsForms;
|
---|
26 |
|
---|
27 | namespace 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 | }
|
---|