Changeset 52 for trunk/sources
- Timestamp:
- 03/06/08 02:48:48 (17 years ago)
- Location:
- trunk/sources/HeuristicLab.Operators
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators/CombinedOperator.cs
r48 r52 71 71 scope.AddVariable(new Variable(SubOperators[i].Name, SubOperators[i])); 72 72 } 73 74 foreach (IVariableInfo variableInfo in VariableInfos) { 75 IItem value = GetVariableValue(variableInfo.FormalName, scope, true, true); 76 if (scope.GetVariable(variableInfo.FormalName) != null) 77 scope.RemoveVariable(variableInfo.FormalName); 78 scope.AddVariable(new Variable(variableInfo.FormalName, value)); 79 } 80 73 81 return new AtomicOperation(OperatorGraph.InitialOperator, scope); 74 82 } else { -
trunk/sources/HeuristicLab.Operators/CombinedOperatorView.Designer.cs
r2 r52 56 56 this.descriptionTabPage = new System.Windows.Forms.TabPage(); 57 57 this.descriptionTextBox = new System.Windows.Forms.TextBox(); 58 this.removeVariableInfoButton = new System.Windows.Forms.Button(); 59 this.addVariableInfoButton = new System.Windows.Forms.Button(); 58 60 this.tabControl.SuspendLayout(); 59 61 this.operatorGraphTabPage.SuspendLayout(); … … 101 103 // variableInfosTabPage 102 104 // 105 this.variableInfosTabPage.Controls.Add(this.removeVariableInfoButton); 106 this.variableInfosTabPage.Controls.Add(this.addVariableInfoButton); 103 107 this.variableInfosTabPage.Controls.Add(this.operatorBaseVariableInfosView); 104 108 this.variableInfosTabPage.Location = new System.Drawing.Point(4, 22); … … 112 116 // operatorBaseVariableInfosView 113 117 // 118 this.operatorBaseVariableInfosView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 119 | System.Windows.Forms.AnchorStyles.Left) 120 | System.Windows.Forms.AnchorStyles.Right))); 114 121 this.operatorBaseVariableInfosView.Caption = "Operator"; 115 this.operatorBaseVariableInfosView.Dock = System.Windows.Forms.DockStyle.Fill;116 122 this.operatorBaseVariableInfosView.Location = new System.Drawing.Point(3, 3); 117 123 this.operatorBaseVariableInfosView.Name = "operatorBaseVariableInfosView"; 118 124 this.operatorBaseVariableInfosView.Operator = null; 119 this.operatorBaseVariableInfosView.Size = new System.Drawing.Size(383, 303);125 this.operatorBaseVariableInfosView.Size = new System.Drawing.Size(383, 274); 120 126 this.operatorBaseVariableInfosView.TabIndex = 0; 127 this.operatorBaseVariableInfosView.SelectedVariableInfosChanged += new System.EventHandler(this.operatorBaseVariableInfosView_SelectedVariableInfosChanged); 121 128 // 122 129 // variablesTabPage … … 184 191 this.descriptionTextBox.TabIndex = 0; 185 192 this.descriptionTextBox.Validated += new System.EventHandler(this.descriptionTextBox_Validated); 193 // 194 // removeVariableInfoButton 195 // 196 this.removeVariableInfoButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 197 this.removeVariableInfoButton.Enabled = false; 198 this.removeVariableInfoButton.Location = new System.Drawing.Point(84, 283); 199 this.removeVariableInfoButton.Name = "removeVariableInfoButton"; 200 this.removeVariableInfoButton.Size = new System.Drawing.Size(75, 23); 201 this.removeVariableInfoButton.TabIndex = 2; 202 this.removeVariableInfoButton.Text = "&Remove"; 203 this.removeVariableInfoButton.UseVisualStyleBackColor = true; 204 this.removeVariableInfoButton.Click += new System.EventHandler(this.removeVariableInfoButton_Click); 205 // 206 // addVariableInfoButton 207 // 208 this.addVariableInfoButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 209 this.addVariableInfoButton.Location = new System.Drawing.Point(3, 283); 210 this.addVariableInfoButton.Name = "addVariableInfoButton"; 211 this.addVariableInfoButton.Size = new System.Drawing.Size(75, 23); 212 this.addVariableInfoButton.TabIndex = 1; 213 this.addVariableInfoButton.Text = "&Add..."; 214 this.addVariableInfoButton.UseVisualStyleBackColor = true; 215 this.addVariableInfoButton.Click += new System.EventHandler(this.addVariableInfoButton_Click); 186 216 // 187 217 // CombinedOperatorView … … 216 246 private HeuristicLab.Core.OperatorBaseVariablesView operatorBaseVariablesView; 217 247 private HeuristicLab.Core.ConstrainedItemBaseView constrainedItemBaseView; 248 private System.Windows.Forms.Button removeVariableInfoButton; 249 private System.Windows.Forms.Button addVariableInfoButton; 218 250 219 251 } -
trunk/sources/HeuristicLab.Operators/CombinedOperatorView.cs
r2 r52 79 79 CombinedOperator.SetDescription(descriptionTextBox.Text); 80 80 } 81 82 private void operatorBaseVariableInfosView_SelectedVariableInfosChanged(object sender, EventArgs e) { 83 removeVariableInfoButton.Enabled = operatorBaseVariableInfosView.SelectedVariableInfos.Count > 0; 84 } 85 86 #region Click Events 87 private void addVariableInfoButton_Click(object sender, EventArgs e) { 88 AddVariableInfoDialog dialog = new AddVariableInfoDialog(); 89 if (dialog.ShowDialog(this) == DialogResult.OK) { 90 if (CombinedOperator.GetVariableInfo(dialog.VariableInfo.FormalName) != null) 91 Auxiliary.ShowErrorMessageBox("A variable info with the same formal name already exists."); 92 else 93 CombinedOperator.AddVariableInfo(dialog.VariableInfo); 94 } 95 dialog.Dispose(); 96 } 97 private void removeVariableInfoButton_Click(object sender, EventArgs e) { 98 IVariableInfo[] selected = new IVariableInfo[operatorBaseVariableInfosView.SelectedVariableInfos.Count]; 99 operatorBaseVariableInfosView.SelectedVariableInfos.CopyTo(selected, 0); 100 for (int i = 0; i < selected.Length; i++) 101 CombinedOperator.RemoveVariableInfo(selected[i].FormalName); 102 } 103 #endregion 81 104 } 82 105 }
Note: See TracChangeset
for help on using the changeset viewer.