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; using HeuristicLab.Problems.BinPacking.PackingItem; namespace HeuristicLab.Problems.BinPacking.Views { [View("View for a cuboid packing item.")] [Content(typeof(CuboidPackingItem), true)] public partial class CuboidPackingItemView : NamedItemView { public CuboidPackingItemView() { InitializeComponent(); } public new CuboidPackingItem Content { get { return (CuboidPackingItem)base.Content; } set { base.Content = value; } } protected override void OnContentChanged() { base.OnContentChanged(); if (Content == null) { Redraw(); } else { Redraw(Content); packingPlan3D1.StartRendering(); } } private void Redraw() { packingPlan3D1.InitializeContainer(0,0,0); } private void Redraw(CuboidPackingItem item) { packingPlan3D1.InitializeContainer(item.TargetBin.Width, item.TargetBin.Height, item.TargetBin.Depth); packingPlan3D1.AddItemToContainer(item.Width, item.Height, item.Depth, 0, 0, 0, 0); } } }