Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/07/13 15:35:12 (11 years ago)
Author:
jhelm
Message:

#1966: Fixed a bug which caused the stacking-contraint to be wrongly enforced; Did some cleanup;

File:
1 edited

Legend:

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

    r9593 r9598  
    4444      } else {
    4545        Content.Name = "Packing Plan";
    46         for (int i = 0; i < Content.NrOfBins; i++)
    47           binSelection.Items.Add(i);
     46        int i = 0;
     47        foreach (var bp in Content.BinPackings)
     48          binSelection.Items.Add(i++ + " (" + Math.Round(bp.PackingDensity * 100, 2) + "%)");
     49
    4850        binSelection.SelectedIndex = 0;
    4951        UpdateModel();
     
    5355
    5456    private void UpdateModel() {
    55       int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0;
     57      int currentBin = (binSelection != null) ? (int)(binSelection.SelectedIndex) : 0;
    5658      var bin = Content.BinPackings[currentBin].BinMeasures;
    5759      packingPlan3D.InitializeContainer(bin.Width, bin.Height, bin.Depth);
     
    7173      itemSelection.SelectedIndex = -1;
    7274      itemSelection.Items.Clear();
    73       int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0;
     75      int currentBin = (binSelection != null) ? (int)(binSelection.SelectedIndex) : 0;
    7476      //for (int i = 0; i < Content.PackingItemPositions.Count; i++) {
    7577      //  if (Content.PackingItemPositions[i].AssignedBin == currentBin)
     
    106108        } else {
    107109          Content.Name = "Packing Plan";
    108           for (int i = 0; i < Content.NrOfBins; i++)
    109             binSelection.Items.Add(i);
     110          int i = 0;
     111          foreach (var bp in Content.BinPackings)
     112            binSelection.Items.Add(i++ + " (" + Math.Round(bp.PackingDensity * 100, 2) + "%)");
    110113          binSelection.SelectedIndex = 0;
    111114          UpdateModel();
Note: See TracChangeset for help on using the changeset viewer.