Free cookie consent management tool by TermsFeed Policy Generator

source: branches/GP.Grammar.Editor/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/VisualSymbolicExpressionTreeNode.cs @ 6522

Last change on this file since 6522 was 6403, checked in by mkommend, 13 years ago

#1479: Allowed modificiation of the subtree count in grammars and adapted SymbolicExpressionTreeChart to handle different styles for connection lines.

File size: 4.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2011 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;
23
24namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
25  public class VisualSymbolicExpressionTreeNode : object {
26    private static readonly Color defaultLineColor = Color.Black;
27    private static readonly Color defaultTextColor = Color.Black;
28    private static readonly Color defaultFillColor = Color.White;
29    private const int defaultPreferredWidth = 70;
30    private const int defaultPreferredHeight = 46;
31
32    public VisualSymbolicExpressionTreeNode(ISymbolicExpressionTreeNode symbolicExpressionTreeNode) :
33      this(symbolicExpressionTreeNode, defaultLineColor) {
34    }
35
36    public VisualSymbolicExpressionTreeNode(ISymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor) :
37      this(symbolicExpressionTreeNode, lineColor, defaultTextColor) {
38    }
39
40    public VisualSymbolicExpressionTreeNode(ISymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor, Color textColor) :
41      this(symbolicExpressionTreeNode, lineColor, textColor, defaultFillColor) {
42    }
43
44    public VisualSymbolicExpressionTreeNode(ISymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor, Color textColor, Color fillColor) :
45      this(symbolicExpressionTreeNode, lineColor, textColor, fillColor, defaultPreferredWidth, defaultPreferredHeight) {
46    }
47
48    public VisualSymbolicExpressionTreeNode(ISymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor, Color textColor, Color fillColor, int width, int height) {
49      this.symbolicExpressionTreeNode = symbolicExpressionTreeNode;
50      this.lineColor = lineColor;
51      this.textColor = textColor;
52      this.fillColor = fillColor;
53      this.preferredWidth = width;
54      this.preferredHeight = height;
55      this.ToolTip = symbolicExpressionTreeNode.ToString();
56    }
57
58    #region members for internal use only
59    private int x;
60    public int X {
61      get { return x; }
62      internal set { this.x = value; }
63    }
64
65    private int y;
66    public int Y {
67      get { return y; }
68      internal set { this.y = value; }
69    }
70
71    private int width;
72    public int Width {
73      get { return this.width; }
74      internal set { this.width = value; }
75    }
76
77    private int height;
78    public int Height {
79      get { return this.height; }
80      internal set { this.height = value; }
81    }
82    #endregion
83
84    private ISymbolicExpressionTreeNode symbolicExpressionTreeNode;
85    public ISymbolicExpressionTreeNode SymbolicExpressionTreeNode {
86      get { return this.symbolicExpressionTreeNode; }
87    }
88
89    private int preferredWidth;
90    public int PreferredWidth {
91      get { return this.preferredWidth; }
92      set { this.preferredWidth = value; }
93    }
94
95    private int preferredHeight;
96    public int PreferredHeight {
97      get { return this.preferredHeight; }
98      set { this.preferredHeight = value; }
99    }
100
101    private Color lineColor;
102    public Color LineColor {
103      get { return this.lineColor; }
104      set { this.lineColor = value; }
105    }
106
107    private Color textColor;
108    public Color TextColor {
109      get { return this.textColor; }
110      set { this.textColor = value; }
111    }
112
113    private Color fillColor;
114    public Color FillColor {
115      get { return this.fillColor; }
116      set { this.fillColor = value; }
117    }
118
119    private string toolTip;
120    public string ToolTip {
121      get { return toolTip; }
122      set { toolTip = value; }
123    }
124  }
125}
Note: See TracBrowser for help on using the repository browser.