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.Shapes; namespace HeuristicLab.Problems.BinPacking.Views { [View("View for a rectangular shape.")] [Content(typeof(RectangularPackingShape), true)] public partial class RectangularPackingShapeView : NamedItemView { public RectangularPackingShapeView() { InitializeComponent(); } public new RectangularPackingShape Content { get { return (RectangularPackingShape)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(RectangularPackingShape shape) { packingPlan2D.InitializeContainer(shape.Width, shape.Height); } } }