Changeset 17953 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs
- Timestamp:
- 04/21/21 15:27:58 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs
r17226 r17953 1 #region License Information2 / * HeuristicLab3 * Copyright (C) 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 modify8 * it under the terms of the GNU General Public License as published by9 * the Free Software Foundation, either version 3 of the License, or10 * (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 of14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 * GNU General Public License for more details.16 *17 * You should have received a copy of the GNU General Public License18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.19 */20 #endregion1 //#region License Information 2 ///* HeuristicLab 3 // * Copyright (C) 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 21 22 using System; 23 using System.Windows.Forms; 24 using HeuristicLab.MainForm; 25 using HeuristicLab.MainForm.WindowsForms; 26 using HeuristicLab.Optimization.Views; 22 //TODO: ProblemView - Refactor to new problem view and add visualization 27 23 28 namespace HeuristicLab.Problems.QuadraticAssignment.Views { 29 [View("Quadratic Assignment Problem View")] 30 [Content(typeof(QuadraticAssignmentProblem), IsDefaultView = true)] 31 public sealed partial class QuadraticAssignmentProblemView : ProblemView { 32 public new QuadraticAssignmentProblem Content { 33 get { return (QuadraticAssignmentProblem)base.Content; } 34 set { base.Content = value; } 35 } 24 //using System; 25 //using System.Windows.Forms; 26 //using HeuristicLab.MainForm; 27 //using HeuristicLab.MainForm.WindowsForms; 28 //using HeuristicLab.Optimization.Views; 36 29 37 public QuadraticAssignmentProblemView() { 38 InitializeComponent(); 39 } 30 //namespace HeuristicLab.Problems.QuadraticAssignment.Views { 31 // [View("Quadratic Assignment Problem View")] 32 // [Content(typeof(QuadraticAssignmentProblem), IsDefaultView = true)] 33 // public sealed partial class QuadraticAssignmentProblemView : ProblemView { 34 // public new QuadraticAssignmentProblem Content { 35 // get { return (QuadraticAssignmentProblem)base.Content; } 36 // set { base.Content = value; } 37 // } 40 38 41 protected override void RegisterContentEvents() { 42 base.RegisterContentEvents(); 43 Content.DistancesParameter.ValueChanged += new EventHandler(DistanceMatrixParameter_ValueChanged); 44 Content.WeightsParameter.ValueChanged += new EventHandler(WeightsParameter_ValueChanged); 45 Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged); 46 } 39 // public QuadraticAssignmentProblemView() { 40 // InitializeComponent(); 41 // } 47 42 48 protected override void DeregisterContentEvents() {49 Content.DistancesParameter.ValueChanged -= new EventHandler(DistanceMatrixParameter_ValueChanged);50 Content.WeightsParameter.ValueChanged -= new EventHandler(WeightsParameter_ValueChanged);51 Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged);52 base.DeregisterContentEvents();53 }43 // protected override void RegisterContentEvents() { 44 // base.RegisterContentEvents(); 45 // Content.DistancesParameter.ValueChanged += new EventHandler(DistanceMatrixParameter_ValueChanged); 46 // Content.WeightsParameter.ValueChanged += new EventHandler(WeightsParameter_ValueChanged); 47 // Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged); 48 // } 54 49 55 private void DistanceMatrixParameter_ValueChanged(object sender, EventArgs e) { 56 qapView.Distances = Content.Distances; 57 } 50 // protected override void DeregisterContentEvents() { 51 // Content.DistancesParameter.ValueChanged -= new EventHandler(DistanceMatrixParameter_ValueChanged); 52 // Content.WeightsParameter.ValueChanged -= new EventHandler(WeightsParameter_ValueChanged); 53 // Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged); 54 // base.DeregisterContentEvents(); 55 // } 58 56 59 private void WeightsParameter_ValueChanged(object sender, EventArgs e) {60 qapView.Weights = Content.Weights;61 }57 // private void DistanceMatrixParameter_ValueChanged(object sender, EventArgs e) { 58 // qapView.Distances = Content.Distances; 59 // } 62 60 63 private void BestKnownSolutionParameter_ValueChanged(object sender, EventArgs e) {64 qapView.Assignment = Content.BestKnownSolution;65 }61 // private void WeightsParameter_ValueChanged(object sender, EventArgs e) { 62 // qapView.Weights = Content.Weights; 63 // } 66 64 67 protected override void OnContentChanged() { 68 base.OnContentChanged(); 69 if (Content != null) { 70 qapView.Distances = Content.Distances; 71 qapView.Weights = Content.Weights; 72 qapView.Assignment = Content.BestKnownSolution; 73 } else { 74 qapView.Distances = null; 75 qapView.Weights = null; 76 qapView.Assignment = null; 77 } 78 } 79 } 80 } 65 // private void BestKnownSolutionParameter_ValueChanged(object sender, EventArgs e) { 66 // qapView.Assignment = Content.BestKnownSolution; 67 // } 68 69 // protected override void OnContentChanged() { 70 // base.OnContentChanged(); 71 // if (Content != null) { 72 // qapView.Distances = Content.Distances; 73 // qapView.Weights = Content.Weights; 74 // qapView.Assignment = Content.BestKnownSolution; 75 // } else { 76 // qapView.Distances = null; 77 // qapView.Weights = null; 78 // qapView.Assignment = null; 79 // } 80 // } 81 // } 82 //}
Note: See TracChangeset
for help on using the changeset viewer.