Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/10/10 11:32:52 (14 years ago)
Author:
svonolfe
Message:

Improved VRP visualization (#1039)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting.Views/3.3/VehicleRoutingProblemView.cs

    r4068 r4185  
    2424using HeuristicLab.MainForm;
    2525using HeuristicLab.Optimization.Views;
     26using HeuristicLab.Core.Views;
     27using HeuristicLab.Core;
    2628
    2729namespace HeuristicLab.Problems.VehicleRouting.Views {
    2830  [View("VehicleRouting Problem View")]
    2931  [Content(typeof(VehicleRoutingProblem), true)]
    30   public partial class VehicleRoutingProblemView : ProblemView {
     32  public partial class VehicleRoutingProblemView : NamedItemView {
    3133    public new VehicleRoutingProblem Content {
    3234      get { return (VehicleRoutingProblem)base.Content; }
     
    3638    public VehicleRoutingProblemView() {
    3739      InitializeComponent();
     40    }
     41
     42    protected override void DeregisterContentEvents() {
     43      Content.CoordinatesParameter.ValueChanged -= new EventHandler(CoordinatesParameter_ValueChanged);
     44      base.DeregisterContentEvents();
     45    }
     46    protected override void RegisterContentEvents() {
     47      base.RegisterContentEvents();
     48      Content.CoordinatesParameter.ValueChanged += new EventHandler(CoordinatesParameter_ValueChanged);
     49    }
     50
     51    protected override void OnContentChanged() {
     52      base.OnContentChanged();
     53      if (Content == null) {
     54        parameterCollectionView.Content = null;
     55        vrpSolutionView.Content = null;
     56      } else {
     57        parameterCollectionView.Content = ((IParameterizedNamedItem)Content).Parameters;
     58        vrpSolutionView.Content = new VRPSolution(Content.Coordinates);
     59      }
     60    }
     61
     62    protected override void SetEnabledStateOfControls() {
     63      base.SetEnabledStateOfControls();
     64      parameterCollectionView.Enabled = Content != null;
     65      vrpSolutionView.Enabled = Content != null;
     66      importButton.Enabled = Content != null && !ReadOnly;
    3867    }
    3968
     
    4675      }
    4776    }
     77
     78    private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
     79      vrpSolutionView.Content.Coordinates = Content.Coordinates;
     80    }
    4881  }
    4982}
Note: See TracChangeset for help on using the changeset viewer.