Changeset 5513 for branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4
- Timestamp:
- 02/18/11 10:55:20 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4
- Files:
-
- 6 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/GraphicalSymbolicExpressionTreeView.cs
r5473 r5513 27 27 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views { 28 28 [View("Graphical SymbolicExpressionTree View")] 29 [Content(typeof( SymbolicExpressionTree), true)]29 [Content(typeof(ISymbolicExpressionTree), true)] 30 30 public partial class GraphicalSymbolicExpressionTreeView : ItemView { 31 public new SymbolicExpressionTree Content {32 get { return ( SymbolicExpressionTree)base.Content; }31 public new ISymbolicExpressionTree Content { 32 get { return (ISymbolicExpressionTree)base.Content; } 33 33 set { base.Content = value; } 34 34 } -
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.csproj
r5477 r5513 109 109 </ItemGroup> 110 110 <ItemGroup> 111 <Compile Include=" DefaultSymbolicExpressionGrammarView.cs">112 <SubType>UserControl</SubType> 113 </Compile> 114 <Compile Include=" DefaultSymbolicExpressionGrammarView.Designer.cs">115 <DependentUpon> DefaultSymbolicExpressionGrammarView.cs</DependentUpon>111 <Compile Include="SymbolicExpressionTreeGrammarView.cs"> 112 <SubType>UserControl</SubType> 113 </Compile> 114 <Compile Include="SymbolicExpressionTreeGrammarView.Designer.cs"> 115 <DependentUpon>SymbolicExpressionTreeGrammarView.cs</DependentUpon> 116 116 </Compile> 117 117 <Compile Include="SymbolView.cs"> … … 161 161 </ProjectReference> 162 162 <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj"> 163 <Project>{ 125D3006-67F5-48CB-913E-73C0548F17FA}</Project>163 <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project> 164 164 <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name> 165 165 </ProjectReference> -
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolView.cs
r5473 r5513 23 23 using System.Windows.Forms; 24 24 using HeuristicLab.Core.Views; 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;26 25 using HeuristicLab.MainForm; 27 26 using HeuristicLab.MainForm.WindowsForms; … … 29 28 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views { 30 29 [View("Symbol View")] 31 [Content(typeof( Symbol), false)]30 [Content(typeof(ISymbol), false)] 32 31 public partial class SymbolView : NamedItemView { 33 public new Symbol Content {34 get { return ( Symbol)base.Content; }32 public new ISymbol Content { 33 get { return (ISymbol)base.Content; } 35 34 set { base.Content = value; } 36 35 } -
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs
r5473 r5513 24 24 using System.Drawing; 25 25 using System.Drawing.Imaging; 26 using System.Linq; 26 27 using System.Windows.Forms; 27 28 … … 30 31 private Image image; 31 32 private StringFormat stringFormat; 32 private Dictionary< SymbolicExpressionTreeNode, VisualSymbolicExpressionTreeNode> visualTreeNodes;33 private Dictionary<ISymbolicExpressionTreeNode, VisualSymbolicExpressionTreeNode> visualTreeNodes; 33 34 34 35 public SymbolicExpressionTreeChart() { … … 44 45 } 45 46 46 public SymbolicExpressionTreeChart( SymbolicExpressionTree tree)47 public SymbolicExpressionTreeChart(ISymbolicExpressionTree tree) 47 48 : this() { 48 49 this.Tree = tree; … … 85 86 } 86 87 87 private SymbolicExpressionTree tree;88 public SymbolicExpressionTree Tree {88 private ISymbolicExpressionTree tree; 89 public ISymbolicExpressionTree Tree { 89 90 get { return this.tree; } 90 91 set { 91 92 tree = value; 92 visualTreeNodes = new Dictionary< SymbolicExpressionTreeNode, VisualSymbolicExpressionTreeNode>();93 visualTreeNodes = new Dictionary<ISymbolicExpressionTreeNode, VisualSymbolicExpressionTreeNode>(); 93 94 if (tree != null) { 94 95 foreach (SymbolicExpressionTreeNode node in tree.IterateNodesPrefix()) … … 129 130 } 130 131 131 public VisualSymbolicExpressionTreeNode GetVisualSymbolicExpressionTreeNode( SymbolicExpressionTreeNode symbolicExpressionTreeNode) {132 public VisualSymbolicExpressionTreeNode GetVisualSymbolicExpressionTreeNode(ISymbolicExpressionTreeNode symbolicExpressionTreeNode) { 132 133 if (visualTreeNodes.ContainsKey(symbolicExpressionTreeNode)) 133 134 return visualTreeNodes[symbolicExpressionTreeNode]; … … 207 208 208 209 #region methods for painting the symbolic expression tree 209 private void DrawFunctionTree( SymbolicExpressionTree tree, Graphics graphics, int x, int y, int width, int height) {210 private void DrawFunctionTree(ISymbolicExpressionTree tree, Graphics graphics, int x, int y, int width, int height) { 210 211 DrawFunctionTree(tree.Root, graphics, x, y, width, height, Point.Empty); 211 212 } … … 220 221 /// <param name="width">width of drawing area</param> 221 222 /// <param name="height">height of drawing area</param> 222 private void DrawFunctionTree( SymbolicExpressionTreeNode node, Graphics graphics, int x, int y, int width, int height, Point connectionPoint) {223 private void DrawFunctionTree(ISymbolicExpressionTreeNode node, Graphics graphics, int x, int y, int width, int height, Point connectionPoint) { 223 224 VisualSymbolicExpressionTreeNode visualTreeNode = visualTreeNodes[node]; 224 225 float center_x = x + width / 2; … … 262 263 263 264 //draw terminal node 264 if (node.SubTrees.Count == 0) {265 if (node.SubTrees.Count() == 0) { 265 266 graphics.FillRectangle(nodeFillBrush, visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height); 266 267 graphics.DrawRectangle(nodeLinePen, visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height); … … 280 281 //calculate areas for the subtrees according to their tree size and call drawFunctionTree 281 282 Point connectFrom = new Point(visualTreeNode.X + visualTreeNode.Width / 2, visualTreeNode.Y + visualTreeNode.Height); 282 int[] xBoundaries = new int[node.SubTrees.Count + 1];283 int[] xBoundaries = new int[node.SubTrees.Count() + 1]; 283 284 xBoundaries[0] = x; 284 for (int i = 0; i < node.SubTrees.Count ; i++) {285 xBoundaries[i + 1] = (int)(xBoundaries[i] + (width * (double)node.SubTrees [i].GetSize()) / (node.GetSize() - 1));286 DrawFunctionTree(node.SubTrees [i], graphics, xBoundaries[i], y + height,285 for (int i = 0; i < node.SubTrees.Count(); i++) { 286 xBoundaries[i + 1] = (int)(xBoundaries[i] + (width * (double)node.SubTrees.ElementAt(i).GetSize()) / (node.GetSize() - 1)); 287 DrawFunctionTree(node.SubTrees.ElementAt(i), graphics, xBoundaries[i], y + height, 287 288 xBoundaries[i + 1] - xBoundaries[i], height, connectFrom); 288 289 } -
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeGrammarView.Designer.cs
r5512 r5513 21 21 22 22 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views { 23 partial class DefaultSymbolicExpressionGrammarView {23 partial class SymbolicExpressionTreeGrammarView { 24 24 /// <summary> 25 25 /// Required designer variable. … … 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.checkedItemListView = new HeuristicLab.Core.Views.CheckedItemListView< HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols.Symbol>();47 this.checkedItemListView = new HeuristicLab.Core.Views.CheckedItemListView<ISymbol>(); 48 48 this.SuspendLayout(); 49 49 this.checkedItemListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) … … 68 68 #endregion 69 69 70 protected HeuristicLab.Core.Views.CheckedItemListView< HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols.Symbol> checkedItemListView;70 protected HeuristicLab.Core.Views.CheckedItemListView<ISymbol> checkedItemListView; 71 71 } 72 72 } -
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeGrammarView.cs
r5512 r5513 22 22 using System; 23 23 using System.Windows.Forms; 24 using HeuristicLab.Collections; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Core.Views; 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;27 27 using HeuristicLab.MainForm; 28 28 using HeuristicLab.MainForm.WindowsForms; … … 30 30 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views { 31 31 [View("Symbolic Expression Grammar View")] 32 [Content(typeof( DefaultSymbolicExpressionGrammar), true)]33 public partial class DefaultSymbolicExpressionGrammarView : ItemView {34 private CheckedItemList< Symbol> symbols;32 [Content(typeof(ISymbolicExpressionTreeGrammar), true)] 33 public partial class SymbolicExpressionTreeGrammarView : ItemView { 34 private CheckedItemList<ISymbol> symbols; 35 35 36 public new DefaultSymbolicExpressionGrammar Content {37 get { return ( DefaultSymbolicExpressionGrammar)base.Content; }36 public new ISymbolicExpressionTreeGrammar Content { 37 get { return (ISymbolicExpressionTreeGrammar)base.Content; } 38 38 set { base.Content = value; } 39 39 } 40 40 41 public DefaultSymbolicExpressionGrammarView() {41 public SymbolicExpressionTreeGrammarView() { 42 42 InitializeComponent(); 43 symbols = new CheckedItemList< Symbol>();44 symbols.CheckedItemsChanged += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<HeuristicLab.Collections.IndexedItem<Symbol>>(symbols_CheckedItemsChanged);43 symbols = new CheckedItemList<ISymbol>(); 44 symbols.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IndexedItem<ISymbol>>(symbols_CheckedItemsChanged); 45 45 } 46 46 … … 82 82 83 83 private void symbol_Changed(object sender, EventArgs e) { 84 Symbol symbol = (Symbol)sender;84 ISymbol symbol = (ISymbol)sender; 85 85 symbols.SetItemCheckedState(symbol, symbol.InitialFrequency > 0.0); 86 86 } 87 87 88 private void symbols_CheckedItemsChanged(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<HeuristicLab.Collections.IndexedItem<Symbol>> e) {89 ICheckedItemList< Symbol> checkedItemList = (ICheckedItemList<Symbol>)sender;88 private void symbols_CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbol>> e) { 89 ICheckedItemList<ISymbol> checkedItemList = (ICheckedItemList<ISymbol>)sender; 90 90 foreach (var indexedItem in e.Items) { 91 91 if (checkedItemList.ItemChecked(indexedItem.Value)) { -
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionView.cs
r5473 r5513 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Windows.Forms; 23 24 using HeuristicLab.MainForm; 24 25 using HeuristicLab.MainForm.WindowsForms; 25 26 using HeuristicLab.PluginInfrastructure; 26 using System.Collections.Generic;27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Formatters;28 27 29 28 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views { 30 29 [View("SymbolicExpression View")] 31 [Content(typeof( SymbolicExpressionTree), false)]30 [Content(typeof(ISymbolicExpressionTree), false)] 32 31 public partial class SymbolicExpressionView : AsynchronousContentView { 33 32 … … 45 44 int selectedIndex = -1; 46 45 foreach (ISymbolicExpressionTreeStringFormatter formatter in formatters) { 47 if (formatter is SymbolicExpressionTreeStringFormatter)46 if (formatter is ISymbolicExpressionTreeStringFormatter) 48 47 selectedIndex = treeFormattersList.Count; 49 48 treeFormattersList.Add(formatter); -
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/VisualSymbolicExpressionTreeNode.cs
r5473 r5513 30 30 private const int defaultPreferredHeight = 46; 31 31 32 public VisualSymbolicExpressionTreeNode( SymbolicExpressionTreeNode symbolicExpressionTreeNode) :32 public VisualSymbolicExpressionTreeNode(ISymbolicExpressionTreeNode symbolicExpressionTreeNode) : 33 33 this(symbolicExpressionTreeNode, defaultLineColor) { 34 34 } 35 35 36 public VisualSymbolicExpressionTreeNode( SymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor) :36 public VisualSymbolicExpressionTreeNode(ISymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor) : 37 37 this(symbolicExpressionTreeNode, lineColor, defaultTextColor) { 38 38 } 39 39 40 public VisualSymbolicExpressionTreeNode( SymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor, Color textColor) :40 public VisualSymbolicExpressionTreeNode(ISymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor, Color textColor) : 41 41 this(symbolicExpressionTreeNode, lineColor, textColor, defaultFillColor) { 42 42 } 43 43 44 public VisualSymbolicExpressionTreeNode( SymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor, Color textColor, Color fillColor) :44 public VisualSymbolicExpressionTreeNode(ISymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor, Color textColor, Color fillColor) : 45 45 this(symbolicExpressionTreeNode, lineColor, textColor, fillColor, defaultPreferredWidth, defaultPreferredHeight) { 46 46 } 47 47 48 public VisualSymbolicExpressionTreeNode( SymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor, Color textColor, Color fillColor, int width, int height) {48 public VisualSymbolicExpressionTreeNode(ISymbolicExpressionTreeNode symbolicExpressionTreeNode, Color lineColor, Color textColor, Color fillColor, int width, int height) { 49 49 this.symbolicExpressionTreeNode = symbolicExpressionTreeNode; 50 50 this.lineColor = lineColor; … … 82 82 #endregion 83 83 84 private SymbolicExpressionTreeNode symbolicExpressionTreeNode;85 public SymbolicExpressionTreeNode SymbolicExpressionTreeNode {84 private ISymbolicExpressionTreeNode symbolicExpressionTreeNode; 85 public ISymbolicExpressionTreeNode SymbolicExpressionTreeNode { 86 86 get { return this.symbolicExpressionTreeNode; } 87 87 }
Note: See TracChangeset
for help on using the changeset viewer.