Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.Views/3.3/Shapes/RectangularPackingItemView.cs @ 10879

Last change on this file since 10879 was 9440, checked in by jhelm, 12 years ago

#1966: Implemented new encoding (MultiComponentVector/MCV); Implemented move-operators for MCV and GV encodings; Implemented new decoding-methods for PS, GV and MCV encodings (ExtremePoint-based packing);

File size: 1.2 KB
Line 
1using System;
2using System.Windows.Forms;
3using HeuristicLab.Core.Views;
4using HeuristicLab.MainForm;
5using HeuristicLab.Encodings.PackingEncoding.PackingPlan;
6using HeuristicLab.Problems.BinPacking.Interfaces;
7using HeuristicLab.Problems.BinPacking.PackingItem;
8
9namespace HeuristicLab.Problems.BinPacking.Views {
10  [View("View for a rectangular packing item.")]
11  [Content(typeof(RectangularPackingItem), true)]
12  public partial class RectangularPackingItemView : NamedItemView {
13    public RectangularPackingItemView() {
14      InitializeComponent();
15    }
16
17
18    public new RectangularPackingItem Content {
19      get { return (RectangularPackingItem)base.Content; }
20      set { base.Content = value; }
21    }
22
23
24    protected override void OnContentChanged() {
25      base.OnContentChanged();
26      if (Content == null) {
27        Redraw();
28      } else {
29        Redraw(Content);
30      }
31    }
32
33
34    private void Redraw() {
35      packingPlan2D.InitializeContainer(0,0);
36    }
37
38    private void Redraw(RectangularPackingItem item) {
39      packingPlan2D.InitializeContainer(item.TargetBin.Width, item.TargetBin.Height);
40      packingPlan2D.AddItemToContainer(item.Width, item.Height, 0, 0, "0");
41    }
42
43  }
44}
Note: See TracBrowser for help on using the repository browser.