Changeset 17525 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringProblemView.cs
- Timestamp:
- 05/07/20 17:41:18 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringProblemView.cs
r17226 r17525 38 38 39 39 protected override void DeregisterContentEvents() { 40 Content.CoordinatesParameter.ValueChanged -= CoordinatesParameter_ValueChanged;41 Content.StartingPointParameter.ValueChanged -= StartingPointParameter_ValueChanged;42 Content.TerminalPointParameter.ValueChanged -= TerminalPointParameter_ValueChanged;43 Content.ScoresParameter.ValueChanged -= ScoresParameter_ValueChanged;44 Content.BestKnownQualityParameter.ValueChanged -= BestKnownQualityParameter_ValueChanged;45 40 Content.BestKnownSolutionParameter.ValueChanged -= BestKnownSolutionParameter_ValueChanged; 46 41 base.DeregisterContentEvents(); … … 48 43 protected override void RegisterContentEvents() { 49 44 base.RegisterContentEvents(); 50 Content.CoordinatesParameter.ValueChanged += CoordinatesParameter_ValueChanged;51 Content.StartingPointParameter.ValueChanged += StartingPointParameter_ValueChanged;52 Content.TerminalPointParameter.ValueChanged += TerminalPointParameter_ValueChanged;53 Content.ScoresParameter.ValueChanged += ScoresParameter_ValueChanged;54 Content.BestKnownQualityParameter.ValueChanged += BestKnownQualityParameter_ValueChanged;55 45 Content.BestKnownSolutionParameter.ValueChanged += BestKnownSolutionParameter_ValueChanged; 56 46 } … … 61 51 orienteeringSolutionView.Content = null; 62 52 } else { 63 orienteeringSolutionView.Content = new OrienteeringSolution(Content.BestKnownSolution, 64 Content.Coordinates, Content.StartingPointParameter.Value, Content.TerminalPointParameter.Value, Content.Scores); 65 if (Content.BestKnownSolution != null) { 66 EvaluateBestSolution(); 67 } 53 orienteeringSolutionView.Content = Content.BestKnownSolution; 68 54 } 69 55 } … … 71 57 protected override void SetEnabledStateOfControls() { 72 58 base.SetEnabledStateOfControls(); 73 orienteeringSolutionView.Enabled = Content != null; 74 } 75 76 private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) { 77 orienteeringSolutionView.Content.Coordinates = Content.Coordinates; 78 } 79 80 private void StartingPointParameter_ValueChanged(object sender, EventArgs e) { 81 orienteeringSolutionView.Content.StartingPoint.Value = Content.StartingPoint; 82 } 83 84 private void TerminalPointParameter_ValueChanged(object sender, EventArgs e) { 85 orienteeringSolutionView.Content.TerminalPoint.Value = Content.TerminalPoint; 86 } 87 88 private void ScoresParameter_ValueChanged(object sender, EventArgs e) { 89 orienteeringSolutionView.Content.Scores = Content.Scores; 90 } 91 92 private void BestKnownQualityParameter_ValueChanged(object sender, EventArgs e) { 93 orienteeringSolutionView.Content.Quality = Content.BestKnownQuality; 59 orienteeringSolutionView.Enabled = Content != null && !ReadOnly && !Locked; 94 60 } 95 61 96 62 private void BestKnownSolutionParameter_ValueChanged(object sender, EventArgs e) { 97 orienteeringSolutionView.Content.IntegerVector = Content.BestKnownSolution; 98 if (Content.BestKnownSolution != null) 99 EvaluateBestSolution(); 100 else { 101 var solution = orienteeringSolutionView.Content; 102 solution.Penalty = null; 103 solution.Distance = null; 104 } 105 } 106 107 private void EvaluateBestSolution() { 108 var evaluation = Content.Evaluator.Evaluate(Content.BestKnownSolution, Content.Scores, Content.DistanceMatrix, 109 Content.MaximumDistance, Content.PointVisitingCosts); 110 orienteeringSolutionView.Content.Quality = evaluation.Quality; 111 orienteeringSolutionView.Content.Penalty = evaluation.Penalty; 112 orienteeringSolutionView.Content.Distance = evaluation.Distance; 63 orienteeringSolutionView.Content = Content.BestKnownSolution; 113 64 } 114 65 }
Note: See TracChangeset
for help on using the changeset viewer.