Changeset 13578
- Timestamp:
- 01/28/16 19:35:42 (9 years ago)
- Location:
- branches/HeuristicLab.BinPacking
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/HeuristicLab.Problems.BinPacking.Views-3.3.csproj
r13576 r13578 155 155 <DependentUpon>Container3DView.xaml</DependentUpon> 156 156 </Compile> 157 <Compile Include="Container2DView.xaml.cs"> 158 <DependentUpon>Container2DView.xaml</DependentUpon> 159 </Compile> 160 <Compile Include="PackingPlan2DView.cs"> 161 <SubType>UserControl</SubType> 162 </Compile> 163 <Compile Include="PackingPlan2DView.Designer.cs"> 164 <DependentUpon>PackingPlan2DView.cs</DependentUpon> 165 </Compile> 157 166 <Compile Include="PackingPlan3DView.cs"> 158 167 <SubType>UserControl</SubType> … … 175 184 </ItemGroup> 176 185 <ItemGroup> 186 <EmbeddedResource Include="PackingPlan2DView.resx"> 187 <DependentUpon>PackingPlan2DView.cs</DependentUpon> 188 </EmbeddedResource> 177 189 <EmbeddedResource Include="PackingPlan3DView.resx"> 178 190 <DependentUpon>PackingPlan3DView.cs</DependentUpon> … … 181 193 <ItemGroup> 182 194 <Page Include="Container3DView.xaml"> 195 <Generator>MSBuild:Compile</Generator> 196 <SubType>Designer</SubType> 197 </Page> 198 <Page Include="Container2DView.xaml"> 183 199 <Generator>MSBuild:Compile</Generator> 184 200 <SubType>Designer</SubType> -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan2DView.Designer.cs
r13576 r13578 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.packingPlan2D = new PackingPlanVisualizations.PackingPlan2D();48 47 this.binSelection = new System.Windows.Forms.ListBox(); 48 this.elementHost = new System.Windows.Forms.Integration.ElementHost(); 49 this.container2DView = new HeuristicLab.Problems.BinPacking.Views.Container2DView(); 49 50 this.SuspendLayout(); 50 //51 // packingPlan2D52 //53 this.packingPlan2D.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)54 | System.Windows.Forms.AnchorStyles.Left)55 | System.Windows.Forms.AnchorStyles.Right)));56 this.packingPlan2D.Location = new System.Drawing.Point(67, 3);57 this.packingPlan2D.Name = "packingPlan2D";58 this.packingPlan2D.Size = new System.Drawing.Size(383, 340);59 this.packingPlan2D.TabIndex = 3;60 51 // 61 52 // binSelection … … 70 61 this.binSelection.SelectedIndexChanged += new System.EventHandler(this.binSelection_SelectedIndexChanged); 71 62 // 63 // elementHost 64 // 65 this.elementHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 66 | System.Windows.Forms.AnchorStyles.Left) 67 | System.Windows.Forms.AnchorStyles.Right))); 68 this.elementHost.Location = new System.Drawing.Point(67, 3); 69 this.elementHost.Name = "elementHost"; 70 this.elementHost.Size = new System.Drawing.Size(383, 329); 71 this.elementHost.TabIndex = 5; 72 this.elementHost.Text = "elementHost"; 73 this.elementHost.Child = this.container2DView; 74 // 72 75 // PackingPlan2DView 73 76 // 74 77 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 75 78 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 79 this.Controls.Add(this.elementHost); 76 80 this.Controls.Add(this.binSelection); 77 this.Controls.Add(this.packingPlan2D);78 81 this.Name = "PackingPlan2DView"; 79 82 this.Size = new System.Drawing.Size(453, 346); … … 83 86 84 87 #endregion 85 86 private PackingPlanVisualizations.PackingPlan2D packingPlan2D; 88 87 89 private System.Windows.Forms.ListBox binSelection; 90 private System.Windows.Forms.Integration.ElementHost elementHost; 91 private Container2DView container2DView; 88 92 } 89 93 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan2DView.cs
r13576 r13578 37 37 } 38 38 39 protected override void DeregisterContentEvents() {40 Content.QualityChanged -= new EventHandler(Content_QualityChanged);41 base.DeregisterContentEvents();42 }43 protected override void RegisterContentEvents() {44 base.RegisterContentEvents();45 Content.QualityChanged += new EventHandler(Content_QualityChanged);46 }47 48 49 39 public new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> Content { 50 40 get { return (PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>)base.Content; } 51 41 set { base.Content = value; } 52 42 } 53 54 43 55 44 protected override void OnContentChanged() { … … 65 54 } 66 55 67 68 56 private void ClearState() { 69 packingPlan2D.InitializeContainer(0, 0);57 container2DView.Packing = null; 70 58 } 71 59 72 private void UpdateState(PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> plan) { 60 private void UpdateState(PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> plan) { 73 61 int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0; 74 var bin = plan.BinPackings[currentBin].BinMeasures; 75 packingPlan2D.InitializeContainer(bin.Width, bin.Height); 76 foreach (var entry in plan.BinPackings[currentBin].ItemMeasures) { 77 var position = plan.BinPackings[currentBin].ItemPositions[entry.Key]; 78 packingPlan2D.AddItemToContainer( 79 position.Rotated ? entry.Value.Height : entry.Value.Width, 80 position.Rotated ? entry.Value.Width : entry.Value.Height, 81 position.X, position.Y, entry.Key.ToString()); 82 } 62 container2DView.Packing = plan.BinPackings[currentBin]; 83 63 } 84 64 85 65 private void binSelection_SelectedIndexChanged(object sender, EventArgs e) { 86 66 UpdateState(Content); 87 packingPlan2D.Refresh();88 67 } 89 90 91 92 private void Content_QualityChanged(object sender, EventArgs e) {93 if (InvokeRequired)94 Invoke(new EventHandler(Content_QualityChanged), sender, e);95 else {96 binSelection.Items.Clear();97 if (Content == null) {98 ClearState();99 } else {100 for (int i = 0; i < Content.NrOfBins; i++)101 binSelection.Items.Add(i);102 UpdateState(Content);103 }104 packingPlan2D.Refresh();105 }106 }107 68 } 108 69 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/BinPacking.cs
r13032 r13578 41 41 42 42 [Storable] 43 public ObservableDictionary<int, I> ItemMeasures { get; private set; } 43 public ObservableDictionary<int, I> ItemMeasures { get; private set; } // TODO: renamed to item 44 44 45 45 [Storable] … … 47 47 48 48 [Storable] 49 //public HashSet<D> ExtremePoints { get; protected set; }50 49 public SortedSet<D> ExtremePoints { get; protected set; } 51 50 … … 55 54 #endregion Properties 56 55 57 p ublicBinPacking(B binMeasures) : base() {56 protected BinPacking(B binMeasures) : base() { 58 57 ItemPositions = new ObservableDictionary<int, D>(); 59 58 ItemMeasures = new ObservableDictionary<int, I>(); 60 59 BinMeasures = (B)binMeasures.Clone(); 61 60 OccupationLayers = new Dictionary<int, List<int>>(); 62 InitializeOccupationLayers(); 61 InitializeOccupationLayers(); // TODO 63 62 } 64 63
Note: See TracChangeset
for help on using the changeset viewer.