Changeset 13593 for trunk/sources
- Timestamp:
- 02/07/16 23:12:22 (9 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.Designer.cs
r13550 r13593 53 53 this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView(); 54 54 this.characteristicsTabPage = new System.Windows.Forms.TabPage(); 55 this.characteristicSplitContainer = new System.Windows.Forms.SplitContainer();56 this.calculatorListView = new System.Windows.Forms.ListView();57 this.characteristicColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));58 this.calculateButton = new System.Windows.Forms.Button();59 this.characteristicsMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView();60 55 this.uploadCharacteristicsButton = new System.Windows.Forms.Button(); 61 56 this.downloadCharacteristicsButton = new System.Windows.Forms.Button(); 57 this.flaAnalysisTabPage = new System.Windows.Forms.TabPage(); 58 this.calculatorListView = new System.Windows.Forms.ListView(); 59 this.calculateButton = new System.Windows.Forms.Button(); 60 this.calculatorSplitContainer = new System.Windows.Forms.SplitContainer(); 61 this.calculatorViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 62 this.characteristicsMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView(); 62 63 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 63 64 this.tabControl.SuspendLayout(); 64 65 this.parametersTabPage.SuspendLayout(); 65 66 this.characteristicsTabPage.SuspendLayout(); 66 ((System.ComponentModel.ISupportInitialize)(this.characteristicSplitContainer)).BeginInit(); 67 this.characteristicSplitContainer.Panel1.SuspendLayout(); 68 this.characteristicSplitContainer.Panel2.SuspendLayout(); 69 this.characteristicSplitContainer.SuspendLayout(); 67 this.flaAnalysisTabPage.SuspendLayout(); 68 ((System.ComponentModel.ISupportInitialize)(this.calculatorSplitContainer)).BeginInit(); 69 this.calculatorSplitContainer.Panel1.SuspendLayout(); 70 this.calculatorSplitContainer.Panel2.SuspendLayout(); 71 this.calculatorSplitContainer.SuspendLayout(); 70 72 this.SuspendLayout(); 71 73 // … … 138 140 this.tabControl.Controls.Add(this.parametersTabPage); 139 141 this.tabControl.Controls.Add(this.characteristicsTabPage); 142 this.tabControl.Controls.Add(this.flaAnalysisTabPage); 140 143 this.tabControl.Location = new System.Drawing.Point(6, 53); 141 144 this.tabControl.Name = "tabControl"; … … 170 173 // characteristicsTabPage 171 174 // 172 this.characteristicsTabPage.Controls.Add(this.characteristic SplitContainer);175 this.characteristicsTabPage.Controls.Add(this.characteristicsMatrixView); 173 176 this.characteristicsTabPage.Controls.Add(this.uploadCharacteristicsButton); 174 177 this.characteristicsTabPage.Controls.Add(this.downloadCharacteristicsButton); … … 181 184 this.characteristicsTabPage.UseVisualStyleBackColor = true; 182 185 // 183 // characteristicSplitContainer184 //185 this.characteristicSplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)186 | System.Windows.Forms.AnchorStyles.Left)187 | System.Windows.Forms.AnchorStyles.Right)));188 this.characteristicSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;189 this.characteristicSplitContainer.Location = new System.Drawing.Point(0, 35);190 this.characteristicSplitContainer.Name = "characteristicSplitContainer";191 //192 // characteristicSplitContainer.Panel1193 //194 this.characteristicSplitContainer.Panel1.Controls.Add(this.calculatorListView);195 this.characteristicSplitContainer.Panel1.Controls.Add(this.calculateButton);196 //197 // characteristicSplitContainer.Panel2198 //199 this.characteristicSplitContainer.Panel2.Controls.Add(this.characteristicsMatrixView);200 this.characteristicSplitContainer.Size = new System.Drawing.Size(692, 279);201 this.characteristicSplitContainer.SplitterDistance = 221;202 this.characteristicSplitContainer.TabIndex = 2;203 //204 // calculatorListView205 //206 this.calculatorListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)207 | System.Windows.Forms.AnchorStyles.Left)208 | System.Windows.Forms.AnchorStyles.Right)));209 this.calculatorListView.CheckBoxes = true;210 this.calculatorListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {211 this.characteristicColumnHeader});212 this.calculatorListView.Location = new System.Drawing.Point(3, 0);213 this.calculatorListView.Name = "calculatorListView";214 this.calculatorListView.Size = new System.Drawing.Size(215, 244);215 this.calculatorListView.TabIndex = 0;216 this.calculatorListView.UseCompatibleStateImageBehavior = false;217 this.calculatorListView.View = System.Windows.Forms.View.Details;218 this.calculatorListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.calculatorListView_ItemChecked);219 //220 // characteristicColumnHeader221 //222 this.characteristicColumnHeader.Text = "Characteristic";223 this.characteristicColumnHeader.Width = 211;224 //225 // calculateButton226 //227 this.calculateButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)228 | System.Windows.Forms.AnchorStyles.Right)));229 this.calculateButton.Location = new System.Drawing.Point(6, 250);230 this.calculateButton.Name = "calculateButton";231 this.calculateButton.Size = new System.Drawing.Size(212, 23);232 this.calculateButton.TabIndex = 0;233 this.calculateButton.Text = "Calculate";234 this.calculateButton.UseVisualStyleBackColor = true;235 this.calculateButton.Click += new System.EventHandler(this.calculateButton_Click);236 //237 // characteristicsMatrixView238 //239 this.characteristicsMatrixView.Caption = "StringConvertibleMatrix View";240 this.characteristicsMatrixView.Content = null;241 this.characteristicsMatrixView.Dock = System.Windows.Forms.DockStyle.Fill;242 this.characteristicsMatrixView.Location = new System.Drawing.Point(0, 0);243 this.characteristicsMatrixView.Name = "characteristicsMatrixView";244 this.characteristicsMatrixView.ReadOnly = false;245 this.characteristicsMatrixView.ShowRowsAndColumnsTextBox = false;246 this.characteristicsMatrixView.ShowStatisticalInformation = false;247 this.characteristicsMatrixView.Size = new System.Drawing.Size(467, 279);248 this.characteristicsMatrixView.TabIndex = 1;249 //250 186 // uploadCharacteristicsButton 251 187 // … … 267 203 this.downloadCharacteristicsButton.UseVisualStyleBackColor = true; 268 204 this.downloadCharacteristicsButton.Click += new System.EventHandler(this.downloadCharacteristicsButton_Click); 205 // 206 // flaAnalysisTabPage 207 // 208 this.flaAnalysisTabPage.Controls.Add(this.calculatorSplitContainer); 209 this.flaAnalysisTabPage.Location = new System.Drawing.Point(4, 22); 210 this.flaAnalysisTabPage.Name = "flaAnalysisTabPage"; 211 this.flaAnalysisTabPage.Padding = new System.Windows.Forms.Padding(3); 212 this.flaAnalysisTabPage.Size = new System.Drawing.Size(692, 314); 213 this.flaAnalysisTabPage.TabIndex = 2; 214 this.flaAnalysisTabPage.Text = "FLA Analysis"; 215 this.flaAnalysisTabPage.UseVisualStyleBackColor = true; 216 // 217 // calculatorListView 218 // 219 this.calculatorListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 220 | System.Windows.Forms.AnchorStyles.Left) 221 | System.Windows.Forms.AnchorStyles.Right))); 222 this.calculatorListView.HideSelection = false; 223 this.calculatorListView.Location = new System.Drawing.Point(0, 0); 224 this.calculatorListView.Name = "calculatorListView"; 225 this.calculatorListView.Size = new System.Drawing.Size(225, 276); 226 this.calculatorListView.TabIndex = 1; 227 this.calculatorListView.UseCompatibleStateImageBehavior = false; 228 this.calculatorListView.View = System.Windows.Forms.View.List; 229 this.calculatorListView.SelectedIndexChanged += new System.EventHandler(this.calculatorListView_SelectedIndexChanged); 230 // 231 // calculateButton 232 // 233 this.calculateButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 234 | System.Windows.Forms.AnchorStyles.Right))); 235 this.calculateButton.Location = new System.Drawing.Point(0, 282); 236 this.calculateButton.Name = "calculateButton"; 237 this.calculateButton.Size = new System.Drawing.Size(225, 23); 238 this.calculateButton.TabIndex = 2; 239 this.calculateButton.Text = "Calculate"; 240 this.calculateButton.UseVisualStyleBackColor = true; 241 this.calculateButton.Click += new System.EventHandler(this.calculateButton_Click); 242 // 243 // calculatorSplitContainer 244 // 245 this.calculatorSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill; 246 this.calculatorSplitContainer.Location = new System.Drawing.Point(3, 3); 247 this.calculatorSplitContainer.Name = "calculatorSplitContainer"; 248 // 249 // calculatorSplitContainer.Panel1 250 // 251 this.calculatorSplitContainer.Panel1.Controls.Add(this.calculatorListView); 252 this.calculatorSplitContainer.Panel1.Controls.Add(this.calculateButton); 253 // 254 // calculatorSplitContainer.Panel2 255 // 256 this.calculatorSplitContainer.Panel2.Controls.Add(this.calculatorViewHost); 257 this.calculatorSplitContainer.Size = new System.Drawing.Size(686, 308); 258 this.calculatorSplitContainer.SplitterDistance = 228; 259 this.calculatorSplitContainer.TabIndex = 3; 260 // 261 // calculatorViewHost 262 // 263 this.calculatorViewHost.Caption = "View"; 264 this.calculatorViewHost.Content = null; 265 this.calculatorViewHost.Dock = System.Windows.Forms.DockStyle.Fill; 266 this.calculatorViewHost.Enabled = false; 267 this.calculatorViewHost.Location = new System.Drawing.Point(0, 0); 268 this.calculatorViewHost.Name = "calculatorViewHost"; 269 this.calculatorViewHost.ReadOnly = false; 270 this.calculatorViewHost.Size = new System.Drawing.Size(454, 308); 271 this.calculatorViewHost.TabIndex = 0; 272 this.calculatorViewHost.ViewsLabelVisible = true; 273 this.calculatorViewHost.ViewType = null; 274 // 275 // characteristicsMatrixView 276 // 277 this.characteristicsMatrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 278 | System.Windows.Forms.AnchorStyles.Left) 279 | System.Windows.Forms.AnchorStyles.Right))); 280 this.characteristicsMatrixView.Caption = "StringConvertibleMatrix View"; 281 this.characteristicsMatrixView.Content = null; 282 this.characteristicsMatrixView.Location = new System.Drawing.Point(3, 35); 283 this.characteristicsMatrixView.Name = "characteristicsMatrixView"; 284 this.characteristicsMatrixView.ReadOnly = false; 285 this.characteristicsMatrixView.ShowRowsAndColumnsTextBox = false; 286 this.characteristicsMatrixView.ShowStatisticalInformation = false; 287 this.characteristicsMatrixView.Size = new System.Drawing.Size(686, 276); 288 this.characteristicsMatrixView.TabIndex = 2; 269 289 // 270 290 // OKBProblemView … … 291 311 this.parametersTabPage.ResumeLayout(false); 292 312 this.characteristicsTabPage.ResumeLayout(false); 293 this.characteristicSplitContainer.Panel1.ResumeLayout(false); 294 this.characteristicSplitContainer.Panel2.ResumeLayout(false); 295 ((System.ComponentModel.ISupportInitialize)(this.characteristicSplitContainer)).EndInit(); 296 this.characteristicSplitContainer.ResumeLayout(false); 313 this.flaAnalysisTabPage.ResumeLayout(false); 314 this.calculatorSplitContainer.Panel1.ResumeLayout(false); 315 this.calculatorSplitContainer.Panel2.ResumeLayout(false); 316 ((System.ComponentModel.ISupportInitialize)(this.calculatorSplitContainer)).EndInit(); 317 this.calculatorSplitContainer.ResumeLayout(false); 297 318 this.ResumeLayout(false); 298 319 this.PerformLayout(); … … 310 331 private System.Windows.Forms.TabPage characteristicsTabPage; 311 332 private Core.Views.ParameterCollectionView parameterCollectionView; 312 private Data.Views.StringConvertibleMatrixView characteristicsMatrixView;313 333 private System.Windows.Forms.Button uploadCharacteristicsButton; 314 334 private System.Windows.Forms.Button downloadCharacteristicsButton; 315 private System.Windows.Forms. SplitContainer characteristicSplitContainer;335 private System.Windows.Forms.TabPage flaAnalysisTabPage; 316 336 private System.Windows.Forms.ListView calculatorListView; 317 private System.Windows.Forms.ColumnHeader characteristicColumnHeader;318 337 private System.Windows.Forms.Button calculateButton; 338 private System.Windows.Forms.SplitContainer calculatorSplitContainer; 339 private MainForm.WindowsForms.ViewHost calculatorViewHost; 340 private Data.Views.StringConvertibleMatrixView characteristicsMatrixView; 319 341 320 342 -
trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.cs
r13552 r13593 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Linq;25 using System.Windows.Forms;26 22 using HeuristicLab.Common.Resources; 27 23 using HeuristicLab.Core.Views; … … 30 26 using HeuristicLab.Optimization; 31 27 using HeuristicLab.PluginInfrastructure; 28 using System; 29 using System.Collections.Generic; 30 using System.Linq; 31 using System.Windows.Forms; 32 32 33 33 namespace HeuristicLab.Clients.OKB.RunCreation { … … 91 91 uploadCharacteristicsButton.Enabled = Content != null && Content.ProblemId != -1 && !Locked && !ReadOnly 92 92 && characteristicsMatrixView.Content != null && characteristicsMatrixView.Content.Rows > 0; 93 calculateButton.Enabled = Content != null && Content.ProblemId != -1 && !Locked && !ReadOnly && calculatorListView.CheckedItems.Count > 0;93 calculateButton.Enabled = Content != null && Content.ProblemId != -1 && !Locked && !ReadOnly; 94 94 } 95 95 … … 105 105 if (Content == null || Content.ProblemId == -1) return; 106 106 var problem = Content.CloneProblem(); 107 var calculators = ApplicationManager.Manager.GetInstances<ICharacteristicCalculator>(). Where(x => x.CanCalculate(problem)).ToList();107 var calculators = ApplicationManager.Manager.GetInstances<ICharacteristicCalculator>().ToList(); 108 108 try { 109 109 calculatorListView.BeginUpdate(); 110 110 foreach (var calc in calculators) { 111 calc.Problem = problem; 111 112 var group = calculatorListView.Groups.Add(calc.Name, calc.Name); 112 113 group.Tag = calc; 113 foreach (var c in calc.Characteristics) { 114 var item = calculatorListView.Items.Add(c, c); 115 item.Group = group; 116 item.Checked = true; 117 } 114 115 var paramItem = calculatorListView.Items.Add(calc.Name + ".Parameters", "Parameters"); 116 paramItem.Group = group; 117 paramItem.Tag = "param"; 118 119 var charactItem = calculatorListView.Items.Add(calc.Name + ".Characteristics", "Characteristics"); 120 charactItem.Group = group; 121 charactItem.Tag = "chara"; 118 122 } 119 123 } finally { calculatorListView.EndUpdate(); } … … 189 193 } catch (Exception ex) { ErrorHandling.ShowErrorDialog(ex); } 190 194 } 195 private void calculatorListView_SelectedIndexChanged(object sender, EventArgs e) { 196 if (InvokeRequired) { 197 Invoke((Action<object, EventArgs>)calculatorListView_SelectedIndexChanged, sender, e); 198 return; 199 } 200 if (calculatorListView.SelectedIndices.Count == 0) calculatorViewHost.Content = null; 201 else { 202 var item = calculatorListView.SelectedItems[0]; 203 if ((string)item.Tag == "param") { 204 calculatorViewHost.Content = ((ICharacteristicCalculator)item.Group.Tag); 205 } else if ((string)item.Tag == "chara") { 206 calculatorViewHost.Content = ((ICharacteristicCalculator)item.Group.Tag).Characteristics; 207 } 208 } 209 } 191 210 private void calculateButton_Click(object sender, EventArgs e) { 192 var characteristics = calculatorListView.CheckedItems.OfType<ListViewItem>().GroupBy(x => x.Group).ToList(); 193 if (characteristics.Count == 0) return; 194 var problem = Content.CloneProblem(); 211 var calculators = calculatorListView.Groups.OfType<ListViewGroup>() 212 .Select(x => (ICharacteristicCalculator)x.Tag) 213 .Where(x => x.Characteristics.CheckedItems.Any() 214 && x.CanCalculate()).ToList(); 215 if (calculators.Count == 0) return; 216 195 217 var results = new Dictionary<string, Value>(); 196 foreach (var c in characteristics) { 197 var calc = (ICharacteristicCalculator)c.Key.Tag; 198 foreach (var result in calc.Calculate(problem, c.Select(x => x.Text).ToArray())) 199 results[result.Key] = RunCreationClient.Instance.ConvertToValue(result.Value, result.Key); 218 foreach (var calc in calculators) { 219 foreach (var result in calc.Calculate()) 220 results[result.Name] = RunCreationClient.Instance.ConvertToValue(result.Value, result.Name); 200 221 } 201 222 var matrix = (characteristicsMatrixView.Content as StringMatrix) ?? (new StringMatrix(results.Count, 3)); … … 231 252 } 232 253 } 233 SetEnabledStateOfControls(); 234 } 235 private void calculatorListView_ItemChecked(object sender, ItemCheckedEventArgs e) { 254 characteristicsMatrixView.Content = matrix; 236 255 SetEnabledStateOfControls(); 237 256 } -
trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/ICharacteristicCalculator.cs
r13552 r13593 22 22 using System.Collections.Generic; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 24 25 25 26 namespace HeuristicLab.Optimization { 26 public interface ICharacteristicCalculator : INamedItem { 27 IEnumerable<string> Characteristics { get; } 28 bool CanCalculate(IProblem problem); 29 IEnumerable<KeyValuePair<string, IItem>> Calculate(IProblem problem, IEnumerable<string> characteristics = null); 27 public interface ICharacteristicCalculator : IParameterizedNamedItem { 28 IProblem Problem { get; set; } 29 ReadOnlyCheckedItemList<StringValue> Characteristics { get; } 30 31 bool CanCalculate(); 32 IEnumerable<IResult> Calculate(); 30 33 } 31 34 }
Note: See TracChangeset
for help on using the changeset viewer.