Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/15/13 22:23:36 (11 years ago)
Author:
jhelm
Message:

#1966: Did some major refactoring in Decoder-classes; Added MoveEvaluator classes for different encodings and dimensions; Added new crossover-class for MCV encoding;

Location:
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan2DView.cs

    r9440 r9495  
    1818    public PackingPlan2DView() {
    1919      InitializeComponent();
     20    }       
     21
     22    protected override void DeregisterContentEvents() {
     23      Content.QualityChanged -= new EventHandler(Content_QualityChanged);
     24      base.DeregisterContentEvents();
     25    }
     26    protected override void RegisterContentEvents() {
     27      base.RegisterContentEvents();
     28      Content.QualityChanged += new EventHandler(Content_QualityChanged);
    2029    }
    2130
     
    4655    private void Redraw(PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> plan) {     
    4756      int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0;
    48       var bin = plan.PackingBinMeasures;
     57      var bin = plan.GetPackingBinMeasuresForBinNr(currentBin);
    4958      packingPlan2D.InitializeContainer(bin.Width, bin.Height);
    5059      int i = 0;
     
    6574    }
    6675
     76
     77
     78    private void Content_QualityChanged(object sender, EventArgs e) {
     79      if (InvokeRequired)
     80        Invoke(new EventHandler(Content_QualityChanged), sender, e);
     81      else {
     82        binSelection.Items.Clear();
     83        if (Content == null) {
     84          Redraw();
     85        } else {
     86          for (int i = 0; i < Content.NrOfBins; i++)
     87            binSelection.Items.Add(i);
     88          Redraw(Content);
     89        }
     90        packingPlan2D.Invalidate();
     91        packingPlan2D.Update();
     92      }
     93    } 
    6794  }
    6895}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.cs

    r9440 r9495  
    1818    public PackingPlan3DView() {
    1919      InitializeComponent();
    20       this.nameTextBox.Text = "XX";
     20      this.nameTextBox.Text = "Packing Plan";
    2121    }
    2222
     23
     24    protected override void DeregisterContentEvents() {
     25      Content.QualityChanged -= new EventHandler(Content_QualityChanged);
     26      base.DeregisterContentEvents();
     27    }
     28    protected override void RegisterContentEvents() {
     29      base.RegisterContentEvents();
     30      Content.QualityChanged += new EventHandler(Content_QualityChanged);
     31    }
    2332
    2433    public new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> Content {
     
    3443        packingPlan3D.InitializeContainer(0, 0, 0);
    3544      } else {
    36         Content.Name = "XX";
     45        Content.Name = "Packing Plan";
    3746        for (int i = 0; i < Content.NrOfBins; i++)
    3847          binSelection.Items.Add(i);
     
    4554    private void UpdateModel() {
    4655      int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0;
    47       var bin = Content.PackingBinMeasures;
     56      var bin = Content.GetPackingBinMeasuresForBinNr(currentBin);
    4857      packingPlan3D.InitializeContainer(bin.Width, bin.Height, bin.Depth);
    4958      int i = 0;
     
    5867        i++;
    5968      }
    60 
    61       int selectedItem = -1;
    62       if ((itemSelection != null && itemSelection.SelectedItem != null)) {
    63         if (!Int32.TryParse(itemSelection.SelectedItem.ToString(), out selectedItem)) {
    64           //if (itemSelection.SelectedItem.ToString().Equals("enum"))
    65           //  packingPlan3D.StartItemEnumeration();
    66           selectedItem = -1;
    67         } else
    68           packingPlan3D.SelectItem(selectedItem);
    69       }
    7069    }
    7170
     
    8079          itemSelection.Items.Add(i);
    8180      }
    82       //itemSelection.Items.Add("enum");
    8381
    8482      packingPlan3D.Invalidate();
     
    8886    private void itemSelection_SelectedIndexChanged(object sender, EventArgs e) {
    8987      UpdateModel();
     88
     89      int selectedItem = -1;
     90      if ((itemSelection != null && itemSelection.SelectedItem != null) && Int32.TryParse(itemSelection.SelectedItem.ToString(), out selectedItem)) {
     91        packingPlan3D.SelectItem(selectedItem);
     92      } else     
     93        packingPlan3D.UnselectItem();
     94
    9095      packingPlan3D.Invalidate();
    9196      packingPlan3D.Update();
    9297    }
    9398
     99    private void Content_QualityChanged(object sender, EventArgs e) {
     100      if (InvokeRequired)
     101        Invoke(new EventHandler(Content_QualityChanged), sender, e);
     102      else {
     103        binSelection.Items.Clear();
     104        if (Content == null) {
     105          packingPlan3D.InitializeContainer(0, 0, 0);
     106        } else {
     107          Content.Name = "Packing Plan";
     108          for (int i = 0; i < Content.NrOfBins; i++)
     109            binSelection.Items.Add(i);
     110          binSelection.SelectedIndex = 0;
     111          UpdateModel();
     112          packingPlan3D.StartRendering();
     113        }
     114      }
     115    } 
    94116  }
    95117}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Plugin.cs

    r9473 r9495  
    2626  /// Plugin class for HeuristicLab.Problems.BinPacking.Views plugin.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Problems.BinPacking.Views", "3.3.7.9440")]
     28  [Plugin("HeuristicLab.Problems.BinPacking.Views", "3.3.7.9473")]
    2929  [PluginFile("HeuristicLab.Problems.BinPacking.Views-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Common", "3.3")]
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Properties/AssemblyInfo.cs

    r9473 r9495  
    5454// by using the '*' as shown below:
    5555[assembly: AssemblyVersion("3.3.0.0")]
    56 [assembly: AssemblyFileVersion("3.3.7.9440")]
     56[assembly: AssemblyFileVersion("3.3.7.9473")]
Note: See TracChangeset for help on using the changeset viewer.