Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/07/20 17:41:18 (4 years ago)
Author:
abeham
Message:

#2521: working on porting orienteering problem
Open points include:

  • Visualization of OrienteeringProblemData
  • Fix visualization of solution
  • Cleanup unused classes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringProblemView.cs

    r17226 r17525  
    3838
    3939    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;
    4540      Content.BestKnownSolutionParameter.ValueChanged -= BestKnownSolutionParameter_ValueChanged;
    4641      base.DeregisterContentEvents();
     
    4843    protected override void RegisterContentEvents() {
    4944      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;
    5545      Content.BestKnownSolutionParameter.ValueChanged += BestKnownSolutionParameter_ValueChanged;
    5646    }
     
    6151        orienteeringSolutionView.Content = null;
    6252      } 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;
    6854      }
    6955    }
     
    7157    protected override void SetEnabledStateOfControls() {
    7258      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;
    9460    }
    9561
    9662    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;
    11364    }
    11465  }
Note: See TracChangeset for help on using the changeset viewer.