Changeset 9495 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.cs
- Timestamp:
- 05/15/13 22:23:36 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.cs
r9440 r9495 18 18 public PackingPlan3DView() { 19 19 InitializeComponent(); 20 this.nameTextBox.Text = " XX";20 this.nameTextBox.Text = "Packing Plan"; 21 21 } 22 22 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 } 23 32 24 33 public new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> Content { … … 34 43 packingPlan3D.InitializeContainer(0, 0, 0); 35 44 } else { 36 Content.Name = " XX";45 Content.Name = "Packing Plan"; 37 46 for (int i = 0; i < Content.NrOfBins; i++) 38 47 binSelection.Items.Add(i); … … 45 54 private void UpdateModel() { 46 55 int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0; 47 var bin = Content. PackingBinMeasures;56 var bin = Content.GetPackingBinMeasuresForBinNr(currentBin); 48 57 packingPlan3D.InitializeContainer(bin.Width, bin.Height, bin.Depth); 49 58 int i = 0; … … 58 67 i++; 59 68 } 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 } else68 packingPlan3D.SelectItem(selectedItem);69 }70 69 } 71 70 … … 80 79 itemSelection.Items.Add(i); 81 80 } 82 //itemSelection.Items.Add("enum");83 81 84 82 packingPlan3D.Invalidate(); … … 88 86 private void itemSelection_SelectedIndexChanged(object sender, EventArgs e) { 89 87 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 90 95 packingPlan3D.Invalidate(); 91 96 packingPlan3D.Update(); 92 97 } 93 98 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 } 94 116 } 95 117 }
Note: See TracChangeset
for help on using the changeset viewer.