Ignore:
Timestamp:
07/30/14 16:37:39 (8 years ago)
Author:
pfleck
Message:

#2208

  • Added visualization in the visualization tab of the problem
  • Fixed bug in shaking operator when tour only consists of start and end point
File:
1 edited

Legend:

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

    r11189 r11245  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.MainForm;
    2324using HeuristicLab.Optimization.Views;
     
    3637      InitializeComponent();
    3738    }
     39
     40    protected override void DeregisterContentEvents() {
     41      Content.CoordinatesParameter.ValueChanged -= new EventHandler(CoordinatesParameter_ValueChanged);
     42      Content.ScoresParameter.ValueChanged -= new EventHandler(ScoresParameter_ValueChanged);
     43      Content.BestKnownQualityParameter.ValueChanged -= new EventHandler(BestKnownQualityParameter_ValueChanged);
     44      Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged);
     45      base.DeregisterContentEvents();
     46    }
     47    protected override void RegisterContentEvents() {
     48      base.RegisterContentEvents();
     49      Content.CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged);
     50      Content.ScoresParameter.ValueChanged += new EventHandler(ScoresParameter_ValueChanged);
     51      Content.BestKnownQualityParameter.ValueChanged += new EventHandler(BestKnownQualityParameter_ValueChanged);
     52      Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged);
     53    }
     54
     55    protected override void OnContentChanged() {
     56      base.OnContentChanged();
     57      if (Content == null) {
     58        orienteeringSolutionView.Content = null;
     59      } else {
     60        orienteeringSolutionView.Content = new OrienteeringSolution(Content.BestKnownSolution, Content.Coordinates, Content.Scores, Content.BestKnownQuality);
     61      }
     62    }
     63
     64    protected override void SetEnabledStateOfControls() {
     65      base.SetEnabledStateOfControls();
     66      orienteeringSolutionView.Enabled = Content != null;
     67    }
     68
     69    private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
     70      orienteeringSolutionView.Content.Coordinates = Content.Coordinates;
     71    }
     72    private void ScoresParameter_ValueChanged(object sender, EventArgs e) {
     73      orienteeringSolutionView.Content.Scores = Content.Scores;
     74    }
     75    private void BestKnownQualityParameter_ValueChanged(object sender, EventArgs e) {
     76      orienteeringSolutionView.Content.Quality = Content.BestKnownQuality;
     77    }
     78    private void BestKnownSolutionParameter_ValueChanged(object sender, EventArgs e) {
     79      orienteeringSolutionView.Content.IntegerVector = Content.BestKnownSolution;
     80    }
    3881  }
    3982}
Note: See TracChangeset for help on using the changeset viewer.