Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/20/16 13:08:13 (9 years ago)
Author:
gkronber
Message:

#1966: finished view for 3d packings

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

Legend:

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

    r13532 r13558  
    8282      this.elementHost.Size = new System.Drawing.Size(229, 290);
    8383      this.elementHost.TabIndex = 6;
    84       this.elementHost.Text = "elementHost1";
     84      this.elementHost.Text = "elementHost";
    8585      this.elementHost.Child = this.packingPlan3D;
    8686      //
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.cs

    r13532 r13558  
    3737    }
    3838
    39 
    40     protected override void DeregisterContentEvents() {
    41       base.DeregisterContentEvents();
    42     }
    43     protected override void RegisterContentEvents() {
    44       base.RegisterContentEvents();
    45     }
    46 
    4739    public new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> Content {
    4840      get { return (PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>)base.Content; }
     
    5547      binSelection.Items.Clear();
    5648      if (Content == null) {
    57          packingPlan3D.Clear();
     49        packingPlan3D.Packing = null;
    5850      } else {
    5951        int i = 0;
     
    6254
    6355        binSelection.SelectedIndex = 0;
    64         UpdateModel();
    65         packingPlan3D.Focus(); // for mouse wheel?
    66         // packingPlan3D.StartRendering();
     56        ShowSelectedPacking();
    6757      }
    6858    }
    6959
    70     private void UpdateModel() {
     60    private void ShowSelectedPacking() {
    7161      int currentBin = (binSelection != null) ? (int)(binSelection.SelectedIndex) : 0;
    72       packingPlan3D.ShowContainer(Content.BinPackings[currentBin]);
    73       // var bin = Content.BinPackings[currentBin].BinMeasures;
    74       // // packingPlan3D.InitializeContainer(bin.Width, bin.Height, bin.Depth);
    75       // foreach (var entry in Content.BinPackings[currentBin].ItemMeasures) {
    76       //   var position = Content.BinPackings[currentBin].ItemPositions[entry.Key];
    77       //    packingPlan3D.AddItemToContainer(
    78       //    position.Rotated ? entry.Value.Depth : entry.Value.Width,
    79       //    entry.Value.Height,
    80       //    position.Rotated ? entry.Value.Width : entry.Value.Depth,
    81       //    position.X, position.Y, position.Z, entry.Key, entry.Value.Material);
    82       // }
     62      packingPlan3D.Packing = Content.BinPackings[currentBin];
    8363    }
    8464
    8565    private void binSelection_SelectedIndexChanged(object sender, EventArgs e) {
    86       UpdateModel();
    87 
    8866      itemSelection.SelectedIndex = -1;
    8967      itemSelection.Items.Clear();
     68
     69      // add items of this container
    9070      int currentBin = (binSelection != null) ? (int)(binSelection.SelectedIndex) : 0;
    91       packingPlan3D.ShowContainer(Content.BinPackings[currentBin]);
     71      var packing = Content.BinPackings[currentBin];
     72      foreach (var item in packing.ItemMeasures) {
     73        itemSelection.Items.Add(item.Key);
     74      }
    9275
     76      ShowSelectedPacking();
    9377    }
    9478
    9579    private void itemSelection_SelectedIndexChanged(object sender, EventArgs e) {
    96       UpdateModel();
    97 
    9880      int selectedItem = -1;
    9981      if ((itemSelection != null && itemSelection.SelectedItem != null) && Int32.TryParse(itemSelection.SelectedItem.ToString(), out selectedItem)) {
     
    10284        packingPlan3D.ClearSelection();
    10385    }
    104 
    105     // private void Content_QualityChanged(object sender, EventArgs e) {
    106     //   if (InvokeRequired)
    107     //     Invoke(new EventHandler(Content_QualityChanged), sender, e);
    108     //   else {
    109     //     binSelection.Items.Clear();
    110     //     if (Content == null) {
    111     //       packingPlan3D.InitializeContainer(0, 0, 0);
    112     //     } else {
    113     //       int i = 0;
    114     //       foreach (var bp in Content.BinPackings)
    115     //         binSelection.Items.Add(i++ + " (" + Math.Round(bp.PackingDensity * 100, 2) + "%)");
    116     //       binSelection.SelectedIndex = 0;
    117     //       UpdateModel();
    118     //       // packingPlan3D.StartRendering();
    119     //     }
    120     //   }
    121     // }
    12286  }
    12387}
Note: See TracChangeset for help on using the changeset viewer.