Changeset 9495 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans
- Timestamp:
- 05/15/13 22:23:36 (12 years ago)
- 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/PackingPlan2DView.cs
r9440 r9495 18 18 public PackingPlan2DView() { 19 19 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); 20 29 } 21 30 … … 46 55 private void Redraw(PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> plan) { 47 56 int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0; 48 var bin = plan. PackingBinMeasures;57 var bin = plan.GetPackingBinMeasuresForBinNr(currentBin); 49 58 packingPlan2D.InitializeContainer(bin.Width, bin.Height); 50 59 int i = 0; … … 65 74 } 66 75 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 } 67 94 } 68 95 } -
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.