using System; using System.Windows.Forms; using HeuristicLab.Core.Views; using HeuristicLab.MainForm; using HeuristicLab.Encodings.PackingEncoding.PackingPlan; using HeuristicLab.Problems.BinPacking.Interfaces; using HeuristicLab.Problems.BinPacking.PackingItem; namespace HeuristicLab.Problems.BinPacking.Views { [View("View for a rectangular packing item.")] [Content(typeof(RectangularPackingItem), true)] public partial class RectangularPackingItemView : NamedItemView { public RectangularPackingItemView() { InitializeComponent(); } public new RectangularPackingItem Content { get { return (RectangularPackingItem)base.Content; } set { base.Content = value; } } protected override void OnContentChanged() { base.OnContentChanged(); if (Content == null) { Redraw(); } else { Redraw(Content); } } private void Redraw() { packingPlan2D.InitializeContainer(0,0); } private void Redraw(RectangularPackingItem item) { packingPlan2D.InitializeContainer(item.TargetBin.Width, item.TargetBin.Height); packingPlan2D.AddItemToContainer(item.Width, item.Height, 0, 0, "0"); } } }