Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/06/13 03:12:42 (11 years ago)
Author:
jhelm
Message:

#1966: Applied some heavy refactoring on the decoder-classes and cleaned up the code a bit;

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

    r9495 r9593  
    5555    private void Redraw(PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> plan) {     
    5656      int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0;
    57       var bin = plan.GetPackingBinMeasuresForBinNr(currentBin);
     57      var bin = plan.BinPackings[currentBin].BinMeasures;
    5858      packingPlan2D.InitializeContainer(bin.Width, bin.Height);
    59       int i = 0;
    60       foreach (var item in plan.PackingItemMeasures) {
    61         var position = plan.PackingItemPositions[i++];
    62         if (position.AssignedBin == currentBin)
     59      foreach (var entry in plan.BinPackings[currentBin].ItemMeasures) {
     60        var position = plan.BinPackings[currentBin].ItemPositions[entry.Key];
    6361          packingPlan2D.AddItemToContainer(
    64             position.Rotated ? item.Height : item.Width,
    65             position.Rotated ? item.Width : item.Height,
    66             position.X, position.Y, i.ToString());
     62            position.Rotated ? entry.Value.Height : entry.Value.Width,
     63            position.Rotated ? entry.Value.Width : entry.Value.Height,
     64            position.X, position.Y, entry.Key.ToString());
    6765      }
    6866    }
     
    7068    private void binSelection_SelectedIndexChanged(object sender, EventArgs e) {
    7169      Redraw(Content);
    72       packingPlan2D.Invalidate();
    73       packingPlan2D.Update();
     70      packingPlan2D.Refresh();
     71      packingPlan2D.Refresh();
     72      packingPlan2D.Refresh();
     73      packingPlan2D.Refresh();
     74      packingPlan2D.Refresh();
    7475    }
    7576
     
    8889          Redraw(Content);
    8990        }
    90         packingPlan2D.Invalidate();
    91         packingPlan2D.Update();
     91        packingPlan2D.Refresh();
     92        packingPlan2D.Refresh();
     93        packingPlan2D.Refresh();
     94        packingPlan2D.Refresh();
     95        packingPlan2D.Refresh();
    9296      }
    9397    } 
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.cs

    r9495 r9593  
    5454    private void UpdateModel() {
    5555      int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0;
    56       var bin = Content.GetPackingBinMeasuresForBinNr(currentBin);
     56      var bin = Content.BinPackings[currentBin].BinMeasures;
    5757      packingPlan3D.InitializeContainer(bin.Width, bin.Height, bin.Depth);
    58       int i = 0;
    59       foreach (var item in Content.PackingItemMeasures) {
    60         var position = Content.PackingItemPositions[i];
    61         if (position.AssignedBin == currentBin)
    62           packingPlan3D.AddItemToContainer(
    63             position.Rotated ? item.Depth : item.Width,
    64             item.Height,
    65             position.Rotated ? item.Width : item.Depth,
    66             position.X, position.Y, position.Z, i);
    67         i++;
     58      foreach (var entry in Content.BinPackings[currentBin].ItemMeasures) {
     59        var position = Content.BinPackings[currentBin].ItemPositions[entry.Key];
     60        packingPlan3D.AddItemToContainer(
     61        position.Rotated ? entry.Value.Depth : entry.Value.Width,
     62        entry.Value.Height,
     63        position.Rotated ? entry.Value.Width : entry.Value.Depth,
     64        position.X, position.Y, position.Z, entry.Key, entry.Value.Material);
    6865      }
    6966    }
     
    7572      itemSelection.Items.Clear();
    7673      int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0;
    77       for (int i = 0; i < Content.PackingItemPositions.Count; i++) {
    78         if (Content.PackingItemPositions[i].AssignedBin == currentBin)
    79           itemSelection.Items.Add(i);
     74      //for (int i = 0; i < Content.PackingItemPositions.Count; i++) {
     75      //  if (Content.PackingItemPositions[i].AssignedBin == currentBin)
     76      //    itemSelection.Items.Add(i);
     77      //}
     78      foreach (var entry in Content.BinPackings[currentBin].ItemMeasures) {
     79        itemSelection.Items.Add(entry.Key);
    8080      }
    8181
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Plugin.cs

    r9495 r9593  
    2626  /// Plugin class for HeuristicLab.Problems.BinPacking.Views plugin.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Problems.BinPacking.Views", "3.3.7.9473")]
     28  [Plugin("HeuristicLab.Problems.BinPacking.Views", "3.3.7.9495")]
    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

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