Changeset 13532 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans
- Timestamp:
- 01/17/16 18:21:19 (9 years ago)
- Location:
- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.Designer.cs
r13468 r13532 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.packingPlan3D = new PackingPlanVisualizations.PackingPlan3D();48 47 this.binSelection = new System.Windows.Forms.ListBox(); 49 48 this.itemSelection = new System.Windows.Forms.ListBox(); 49 this.elementHost = new System.Windows.Forms.Integration.ElementHost(); 50 this.packingPlan3D = new HeuristicLab.Problems.BinPacking.Views.Shapes.Container3DView(); 50 51 this.SuspendLayout(); 51 //52 // packingPlan3D53 //54 this.packingPlan3D.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)55 | System.Windows.Forms.AnchorStyles.Left)56 | System.Windows.Forms.AnchorStyles.Right)));57 this.packingPlan3D.Location = new System.Drawing.Point(119, 3);58 this.packingPlan3D.Name = "packingPlan3D";59 this.packingPlan3D.Size = new System.Drawing.Size(229, 293);60 this.packingPlan3D.TabIndex = 3;61 52 // 62 53 // binSelection … … 82 73 this.itemSelection.SelectedIndexChanged += new System.EventHandler(this.itemSelection_SelectedIndexChanged); 83 74 // 75 // elementHost 76 // 77 this.elementHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 78 | System.Windows.Forms.AnchorStyles.Left) 79 | System.Windows.Forms.AnchorStyles.Right))); 80 this.elementHost.Location = new System.Drawing.Point(119, 3); 81 this.elementHost.Name = "elementHost"; 82 this.elementHost.Size = new System.Drawing.Size(229, 290); 83 this.elementHost.TabIndex = 6; 84 this.elementHost.Text = "elementHost1"; 85 this.elementHost.Child = this.packingPlan3D; 86 // 84 87 // PackingPlan3DView 85 88 // 86 89 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 87 90 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 91 this.Controls.Add(this.elementHost); 88 92 this.Controls.Add(this.itemSelection); 89 93 this.Controls.Add(this.binSelection); 90 this.Controls.Add(this.packingPlan3D);91 94 this.Name = "PackingPlan3DView"; 92 95 this.Size = new System.Drawing.Size(351, 299); … … 97 100 #endregion 98 101 99 private PackingPlanVisualizations.PackingPlan3D packingPlan3D;100 102 private System.Windows.Forms.ListBox binSelection; 101 103 private System.Windows.Forms.ListBox itemSelection; 104 private System.Windows.Forms.Integration.ElementHost elementHost; 105 private Shapes.Container3DView packingPlan3D; 102 106 } 103 107 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlans/PackingPlan3DView.cs
r13465 r13532 39 39 40 40 protected override void DeregisterContentEvents() { 41 Content.QualityChanged -= new EventHandler(Content_QualityChanged);42 41 base.DeregisterContentEvents(); 43 42 } 44 43 protected override void RegisterContentEvents() { 45 44 base.RegisterContentEvents(); 46 Content.QualityChanged += new EventHandler(Content_QualityChanged);47 45 } 48 46 … … 56 54 base.OnContentChanged(); 57 55 binSelection.Items.Clear(); 58 if (Content == null) { 59 packingPlan3D.InitializeContainer(0, 0, 0);56 if (Content == null) { 57 packingPlan3D.Clear(); 60 58 } else { 61 59 int i = 0; … … 65 63 binSelection.SelectedIndex = 0; 66 64 UpdateModel(); 67 packingPlan3D.StartRendering(); 65 packingPlan3D.Focus(); // for mouse wheel? 66 // packingPlan3D.StartRendering(); 68 67 } 69 68 } … … 71 70 private void UpdateModel() { 72 71 int currentBin = (binSelection != null) ? (int)(binSelection.SelectedIndex) : 0; 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 } 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 // } 83 83 } 84 84 … … 89 89 itemSelection.Items.Clear(); 90 90 int currentBin = (binSelection != null) ? (int)(binSelection.SelectedIndex) : 0; 91 foreach (var entry in Content.BinPackings[currentBin].ItemMeasures) { 92 itemSelection.Items.Add(entry.Key); 93 } 91 packingPlan3D.ShowContainer(Content.BinPackings[currentBin]); 94 92 95 packingPlan3D.Invalidate();96 packingPlan3D.Update();97 93 } 98 94 … … 103 99 if ((itemSelection != null && itemSelection.SelectedItem != null) && Int32.TryParse(itemSelection.SelectedItem.ToString(), out selectedItem)) { 104 100 packingPlan3D.SelectItem(selectedItem); 105 } else 106 packingPlan3D.UnselectItem(); 107 108 packingPlan3D.Invalidate(); 109 packingPlan3D.Update(); 101 } else 102 packingPlan3D.ClearSelection(); 110 103 } 111 104 112 private void Content_QualityChanged(object sender, EventArgs e) {113 if (InvokeRequired)114 Invoke(new EventHandler(Content_QualityChanged), sender, e);115 else {116 binSelection.Items.Clear();117 if (Content == null) {118 packingPlan3D.InitializeContainer(0, 0, 0);119 } else {120 int i = 0;121 foreach (var bp in Content.BinPackings)122 binSelection.Items.Add(i++ + " (" + Math.Round(bp.PackingDensity * 100, 2) + "%)");123 binSelection.SelectedIndex = 0;124 UpdateModel();125 126 }127 }128 }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 // } 129 122 } 130 123 }
Note: See TracChangeset
for help on using the changeset viewer.