- Timestamp:
- 09/20/11 11:12:10 (13 years ago)
- Location:
- trunk/sources
- Files:
-
- 7 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:ignore
-
old new 13 13 *.vsp 14 14 *.docstates 15 bin 16 HeuristicLab 3.3.6.0.ReSharper.user
-
- Property svn:mergeinfo changed
/branches/GP.Grammar.Editor (added) merged: 6284-6285,6296,6299,6335,6337,6377,6379,6387,6403,6409,6415,6493-6494,6497,6618,6620,6622,6626,6647,6675,6782,6784,6786,6795
- Property svn:ignore
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.csproj
r5809 r6803 99 99 <Reference Include="System.Drawing" /> 100 100 <Reference Include="System.Windows.Forms" /> 101 <Reference Include="System.Windows.Forms.DataVisualization" /> 101 102 <Reference Include="System.Xml.Linq"> 102 103 <RequiredTargetFramework>3.5</RequiredTargetFramework> … … 109 110 </ItemGroup> 110 111 <ItemGroup> 112 <Compile Include="SymbolicExpressionGrammarAllowedChildSymbolsControl.cs"> 113 <SubType>UserControl</SubType> 114 </Compile> 115 <Compile Include="SymbolicExpressionGrammarAllowedChildSymbolsControl.Designer.cs"> 116 <DependentUpon>SymbolicExpressionGrammarAllowedChildSymbolsControl.cs</DependentUpon> 117 </Compile> 118 <Compile Include="SymbolicExpressionGrammarEditorView.cs"> 119 <SubType>UserControl</SubType> 120 </Compile> 121 <Compile Include="SymbolicExpressionGrammarEditorView.Designer.cs"> 122 <DependentUpon>SymbolicExpressionGrammarEditorView.cs</DependentUpon> 123 </Compile> 124 <Compile Include="SymbolicExpressionGrammarSampleExpressionTreeView.cs"> 125 <SubType>UserControl</SubType> 126 </Compile> 127 <Compile Include="SymbolicExpressionGrammarSampleExpressionTreeView.Designer.cs"> 128 <DependentUpon>SymbolicExpressionGrammarSampleExpressionTreeView.cs</DependentUpon> 129 </Compile> 111 130 <Compile Include="SymbolicExpressionGrammarView.cs"> 112 131 <SubType>UserControl</SubType> … … 142 161 </Compile> 143 162 <Compile Include="VisualSymbolicExpressionTreeNode.cs" /> 163 <Compile Include="VisualSymbolicExpressionTreeNodeConnection.cs" /> 144 164 </ItemGroup> 145 165 <ItemGroup> … … 148 168 <Name>HeuristicLab.Collections-3.3</Name> 149 169 </ProjectReference> 170 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj"> 171 <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project> 172 <Name>HeuristicLab.Common.Resources-3.3</Name> 173 </ProjectReference> 150 174 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> 151 175 <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project> … … 160 184 <Name>HeuristicLab.Core-3.3</Name> 161 185 </ProjectReference> 186 <ProjectReference Include="..\..\HeuristicLab.Data.Views\3.3\HeuristicLab.Data.Views-3.3.csproj"> 187 <Project>{72104A0B-90E7-42F3-9ABE-9BBBADD4B943}</Project> 188 <Name>HeuristicLab.Data.Views-3.3</Name> 189 </ProjectReference> 190 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> 191 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> 192 <Name>HeuristicLab.Data-3.3</Name> 193 </ProjectReference> 162 194 <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj"> 163 195 <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project> … … 172 204 <Name>HeuristicLab.MainForm-3.3</Name> 173 205 </ProjectReference> 206 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> 207 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 208 <Name>HeuristicLab.Operators-3.3</Name> 209 </ProjectReference> 210 <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj"> 211 <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project> 212 <Name>HeuristicLab.Optimization.Views-3.3</Name> 213 </ProjectReference> 214 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 215 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project> 216 <Name>HeuristicLab.Optimization-3.3</Name> 217 </ProjectReference> 174 218 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj"> 175 219 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project> 176 220 <Name>HeuristicLab.PluginInfrastructure-3.3</Name> 221 </ProjectReference> 222 <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj"> 223 <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project> 224 <Name>HeuristicLab.Random-3.3</Name> 225 </ProjectReference> 226 <ProjectReference Include="..\..\HeuristicLab.Visualization.ChartControlsExtensions\3.3\HeuristicLab.Visualization.ChartControlsExtensions-3.3.csproj"> 227 <Project>{315BDA09-3F4F-49B3-9790-B37CFC1C5750}</Project> 228 <Name>HeuristicLab.Visualization.ChartControlsExtensions-3.3</Name> 177 229 </ProjectReference> 178 230 </ItemGroup> -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin.cs.frame
r6548 r6803 30 30 [PluginDependency("HeuristicLab.Collections", "3.3")] 31 31 [PluginDependency("HeuristicLab.Common", "3.3")] 32 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] 32 33 [PluginDependency("HeuristicLab.Core", "3.3")] 33 34 [PluginDependency("HeuristicLab.Core.Views", "3.3")] … … 35 36 [PluginDependency("HeuristicLab.MainForm", "3.3")] 36 37 [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")] 38 [PluginDependency("HeuristicLab.Random","3.3")] 37 39 public class HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin : PluginBase { 38 40 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolView.Designer.cs
r6109 r6803 47 47 this.initialFrequencyLabel = new System.Windows.Forms.Label(); 48 48 this.initialFrequencyTextBox = new System.Windows.Forms.TextBox(); 49 this.enabledCheckBox = new System.Windows.Forms.CheckBox(); 50 this.minimumArityLabel = new System.Windows.Forms.Label(); 51 this.maximumArityLabel = new System.Windows.Forms.Label(); 52 this.minimumArityTextBox = new System.Windows.Forms.TextBox(); 53 this.maximumArityTextBox = new System.Windows.Forms.TextBox(); 49 54 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 50 55 this.SuspendLayout(); … … 73 78 // initialFrequencyTextBox 74 79 // 75 this.initialFrequencyTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 76 80 this.initialFrequencyTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 81 | System.Windows.Forms.AnchorStyles.Right))); 77 82 this.errorProvider.SetIconAlignment(this.initialFrequencyTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 78 83 this.initialFrequencyTextBox.Location = new System.Drawing.Point(93, 26); … … 84 89 this.initialFrequencyTextBox.Validated += new System.EventHandler(this.initialFrequencyTextBox_Validated); 85 90 // 91 // enabledCheckBox 92 // 93 this.enabledCheckBox.AutoSize = true; 94 this.enabledCheckBox.Location = new System.Drawing.Point(93, 104); 95 this.enabledCheckBox.Name = "enabledCheckBox"; 96 this.enabledCheckBox.Size = new System.Drawing.Size(65, 17); 97 this.enabledCheckBox.TabIndex = 5; 98 this.enabledCheckBox.Text = "Enabled"; 99 this.enabledCheckBox.UseVisualStyleBackColor = true; 100 this.enabledCheckBox.CheckedChanged += new System.EventHandler(this.checkBoxEnabled_CheckedChanged); 101 // 102 // minimumArityLabel 103 // 104 this.minimumArityLabel.AutoSize = true; 105 this.minimumArityLabel.Location = new System.Drawing.Point(3, 55); 106 this.minimumArityLabel.Name = "minimumArityLabel"; 107 this.minimumArityLabel.Size = new System.Drawing.Size(74, 13); 108 this.minimumArityLabel.TabIndex = 8; 109 this.minimumArityLabel.Text = "Minimum Arity:"; 110 this.toolTip.SetToolTip(this.minimumArityLabel, "Relative frequency of the symbol in randomly created trees"); 111 // 112 // maximumArityLabel 113 // 114 this.maximumArityLabel.AutoSize = true; 115 this.maximumArityLabel.Location = new System.Drawing.Point(3, 81); 116 this.maximumArityLabel.Name = "maximumArityLabel"; 117 this.maximumArityLabel.Size = new System.Drawing.Size(74, 13); 118 this.maximumArityLabel.TabIndex = 6; 119 this.maximumArityLabel.Text = "Maximum Arity"; 120 this.toolTip.SetToolTip(this.maximumArityLabel, "Relative frequency of the symbol in randomly created trees"); 121 // 122 // minimumArityTextBox 123 // 124 this.minimumArityTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 125 | System.Windows.Forms.AnchorStyles.Right))); 126 this.errorProvider.SetIconAlignment(this.minimumArityTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 127 this.minimumArityTextBox.Location = new System.Drawing.Point(93, 52); 128 this.minimumArityTextBox.Name = "minimumArityTextBox"; 129 this.minimumArityTextBox.ReadOnly = true; 130 this.minimumArityTextBox.Size = new System.Drawing.Size(227, 20); 131 this.minimumArityTextBox.TabIndex = 9; 132 // 133 // maximumArityTextBox 134 // 135 this.maximumArityTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 136 | System.Windows.Forms.AnchorStyles.Right))); 137 this.errorProvider.SetIconAlignment(this.maximumArityTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 138 this.maximumArityTextBox.Location = new System.Drawing.Point(93, 78); 139 this.maximumArityTextBox.Name = "maximumArityTextBox"; 140 this.maximumArityTextBox.ReadOnly = true; 141 this.maximumArityTextBox.Size = new System.Drawing.Size(227, 20); 142 this.maximumArityTextBox.TabIndex = 7; 143 // 86 144 // SymbolView 87 145 // 88 146 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 89 147 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 148 this.Controls.Add(this.minimumArityTextBox); 149 this.Controls.Add(this.minimumArityLabel); 150 this.Controls.Add(this.maximumArityTextBox); 151 this.Controls.Add(this.maximumArityLabel); 90 152 this.Controls.Add(this.initialFrequencyTextBox); 91 153 this.Controls.Add(this.initialFrequencyLabel); 154 this.Controls.Add(this.enabledCheckBox); 92 155 this.Name = "SymbolView"; 93 this.Size = new System.Drawing.Size(320, 51); 156 this.Size = new System.Drawing.Size(320, 123); 157 this.Controls.SetChildIndex(this.enabledCheckBox, 0); 94 158 this.Controls.SetChildIndex(this.initialFrequencyLabel, 0); 95 159 this.Controls.SetChildIndex(this.initialFrequencyTextBox, 0); 160 this.Controls.SetChildIndex(this.maximumArityLabel, 0); 161 this.Controls.SetChildIndex(this.maximumArityTextBox, 0); 162 this.Controls.SetChildIndex(this.minimumArityLabel, 0); 163 this.Controls.SetChildIndex(this.minimumArityTextBox, 0); 96 164 this.Controls.SetChildIndex(this.infoLabel, 0); 97 165 this.Controls.SetChildIndex(this.nameLabel, 0); … … 107 175 protected System.Windows.Forms.Label initialFrequencyLabel; 108 176 protected System.Windows.Forms.TextBox initialFrequencyTextBox; 177 private System.Windows.Forms.CheckBox enabledCheckBox; 178 protected System.Windows.Forms.Label minimumArityLabel; 179 protected System.Windows.Forms.Label maximumArityLabel; 180 protected System.Windows.Forms.TextBox minimumArityTextBox; 181 protected System.Windows.Forms.TextBox maximumArityTextBox; 109 182 110 183 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolView.cs
r6233 r6803 57 57 protected override void SetEnabledStateOfControls() { 58 58 base.SetEnabledStateOfControls(); 59 initialFrequencyTextBox.Enabled = Content != null ;59 initialFrequencyTextBox.Enabled = Content != null || Locked; 60 60 initialFrequencyTextBox.ReadOnly = ReadOnly; 61 enabledCheckBox.Enabled = Content != null || Locked || ReadOnly; 61 62 } 62 63 … … 93 94 } 94 95 } 96 97 private void checkBoxEnabled_CheckedChanged(object sender, EventArgs e) { 98 if (Content != null) 99 Content.Enabled = enabledCheckBox.Checked; 100 } 95 101 #endregion 96 102 … … 99 105 if (Content == null) { 100 106 initialFrequencyTextBox.Text = string.Empty; 107 minimumArityTextBox.Text = string.Empty; 108 maximumArityTextBox.Text = string.Empty; 109 enabledCheckBox.Checked = false; 101 110 } else { 102 111 initialFrequencyTextBox.Text = Content.InitialFrequency.ToString(); 112 minimumArityTextBox.Text = Content.MinimumArity.ToString(); 113 maximumArityTextBox.Text = Content.MaximumArity.ToString(); 114 enabledCheckBox.Checked = Content.Enabled; 103 115 } 104 116 SetEnabledStateOfControls(); 105 117 } 106 118 #endregion 119 107 120 } 108 121 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionGrammarView.cs
r6233 r6803 30 30 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views { 31 31 [View("Symbolic Expression Grammar View")] 32 [Content(typeof(ISymbolicExpressionGrammar), true)]32 [Content(typeof(ISymbolicExpressionGrammar), false)] 33 33 public partial class SymbolicExpressionGrammarView : NamedItemView { 34 34 private CheckedItemList<ISymbol> symbols; … … 90 90 if (!(symbol is IReadOnlySymbol)) { 91 91 symbol.Changed += new EventHandler(symbol_Changed); 92 symbols.Add(symbol, symbol. InitialFrequency > 0.0);92 symbols.Add(symbol, symbol.Enabled); 93 93 } 94 94 } … … 101 101 private void symbol_Changed(object sender, EventArgs e) { 102 102 ISymbol symbol = (ISymbol)sender; 103 symbols.SetItemCheckedState(symbol, symbol. InitialFrequency > 0.0);103 symbols.SetItemCheckedState(symbol, symbol.Enabled); 104 104 } 105 105 106 106 private void symbols_CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbol>> e) { 107 107 ICheckedItemList<ISymbol> checkedItemList = (ICheckedItemList<ISymbol>)sender; 108 foreach (var indexedItem in e.Items) { 109 if (checkedItemList.ItemChecked(indexedItem.Value)) { 110 indexedItem.Value.InitialFrequency = 1.0; 111 } else { 112 indexedItem.Value.InitialFrequency = 0.0; 113 } 114 } 108 foreach (var indexedItem in e.Items) 109 indexedItem.Value.Enabled = checkedItemList.ItemChecked(indexedItem.Value); 115 110 } 116 111 private void ClearSymbols() { -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs
r6375 r6803 31 31 private StringFormat stringFormat; 32 32 private Dictionary<ISymbolicExpressionTreeNode, VisualSymbolicExpressionTreeNode> visualTreeNodes; 33 private Dictionary<Tuple<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>, VisualSymbolicExpressionTreeNodeConnection> visualLines; 33 34 34 35 public SymbolicExpressionTreeChart() { … … 91 92 tree = value; 92 93 visualTreeNodes = new Dictionary<ISymbolicExpressionTreeNode, VisualSymbolicExpressionTreeNode>(); 94 visualLines = new Dictionary<Tuple<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>, VisualSymbolicExpressionTreeNodeConnection>(); 93 95 if (tree != null) { 94 foreach ( SymbolicExpressionTreeNode node in tree.IterateNodesPrefix())96 foreach (ISymbolicExpressionTreeNode node in tree.IterateNodesPrefix()) { 95 97 visualTreeNodes[node] = new VisualSymbolicExpressionTreeNode(node); 98 if (node.Parent != null) visualLines[Tuple.Create(node.Parent, node)] = new VisualSymbolicExpressionTreeNodeConnection(); 99 } 96 100 } 97 101 Repaint(); … … 99 103 } 100 104 105 private bool suspendRepaint; 106 public bool SuspendRepaint { 107 get { return suspendRepaint; } 108 set { suspendRepaint = value; } 109 } 110 101 111 protected override void OnPaint(PaintEventArgs e) { 112 e.Graphics.DrawImage(image, 0, 0); 102 113 base.OnPaint(e); 103 e.Graphics.DrawImage(image, 0, 0);104 114 } 105 115 protected override void OnResize(EventArgs e) { … … 113 123 114 124 public void Repaint() { 115 this.GenerateImage(); 116 this.Refresh(); 125 if (!suspendRepaint) { 126 this.GenerateImage(); 127 this.Refresh(); 128 } 117 129 } 118 130 … … 133 145 return visualTreeNodes[symbolicExpressionTreeNode]; 134 146 return null; 147 } 148 149 public VisualSymbolicExpressionTreeNodeConnection GetVisualSymbolicExpressionTreeNodeConnection(ISymbolicExpressionTreeNode parent, ISymbolicExpressionTreeNode child) { 150 if (child.Parent != parent) throw new ArgumentException(); 151 var key = Tuple.Create(parent, child); 152 VisualSymbolicExpressionTreeNodeConnection connection = null; 153 visualLines.TryGetValue(key, out connection); 154 return connection; 135 155 } 136 156 … … 196 216 } 197 217 198 p rivateVisualSymbolicExpressionTreeNode FindVisualSymbolicExpressionTreeNodeAt(int x, int y) {218 public VisualSymbolicExpressionTreeNode FindVisualSymbolicExpressionTreeNodeAt(int x, int y) { 199 219 foreach (var visualTreeNode in visualTreeNodes.Values) { 200 220 if (x >= visualTreeNode.X && x <= visualTreeNode.X + visualTreeNode.Width && … … 228 248 229 249 SolidBrush textBrush = new SolidBrush(visualTreeNode.TextColor); 230 Pen linePen = new Pen(this.lineColor);231 250 Pen nodeLinePen = new Pen(visualTreeNode.LineColor); 232 251 SolidBrush nodeFillBrush = new SolidBrush(visualTreeNode.FillColor); … … 262 281 263 282 //draw terminal node 264 if (node.Subtree sCount == 0) {283 if (node.SubtreeCount == 0) { 265 284 graphics.FillRectangle(nodeFillBrush, visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height); 266 285 graphics.DrawRectangle(nodeLinePen, visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height); … … 275 294 276 295 //draw connection line to parent node 277 if (!connectionPoint.IsEmpty) 278 graphics.DrawLine(linePen, connectionPoint, new Point(visualTreeNode.X + visualTreeNode.Width / 2, visualTreeNode.Y)); 296 if (!connectionPoint.IsEmpty && node.Parent != null) { 297 var visualLine = GetVisualSymbolicExpressionTreeNodeConnection(node.Parent, node); 298 using (Pen linePen = new Pen(visualLine.LineColor)) { 299 linePen.DashStyle = visualLine.DashStyle; 300 graphics.DrawLine(linePen, connectionPoint, new Point(visualTreeNode.X + visualTreeNode.Width / 2, visualTreeNode.Y)); 301 } 302 } 279 303 280 304 //calculate areas for the subtrees according to their tree size and call drawFunctionTree 281 305 Point connectFrom = new Point(visualTreeNode.X + visualTreeNode.Width / 2, visualTreeNode.Y + visualTreeNode.Height); 282 int[] xBoundaries = new int[node.Subtree sCount + 1];306 int[] xBoundaries = new int[node.SubtreeCount + 1]; 283 307 xBoundaries[0] = x; 284 for (int i = 0; i < node.Subtree sCount; i++) {308 for (int i = 0; i < node.SubtreeCount; i++) { 285 309 xBoundaries[i + 1] = (int)(xBoundaries[i] + (width * (double)node.GetSubtree(i).GetLength()) / (node.GetLength() - 1)); 286 310 DrawFunctionTree(node.GetSubtree(i), graphics, xBoundaries[i], y + height, -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/VisualSymbolicExpressionTreeNode.cs
r5809 r6803 23 23 24 24 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views { 25 public class VisualSymbolicExpressionTreeNode {25 public class VisualSymbolicExpressionTreeNode : object { 26 26 private static readonly Color defaultLineColor = Color.Black; 27 27 private static readonly Color defaultTextColor = Color.Black;
Note: See TracChangeset
for help on using the changeset viewer.