Пример #1
0
        private void SortClick(object sender, EventArgs arguments)
        {
            Rectangle panelRectangle = new Rectangle(0, 0, panel.Width, panel.Height);
            int       unresolved;

            DateTime startTime = DateTime.Now;

            BinListSorterTree.Sort(ref binList, panelRectangle, out unresolved);

            DateTime endTime = DateTime.Now;
            long     time    = endTime.Subtract(startTime).Ticks / 10000;

            if (unresolved > 0)
            {
                Log.Instance.AddLine("Took " + time + "ms to sort " + binList.Count + " boxes, failing to place " + unresolved + " boxes");
            }
            else
            {
                Log.Instance.AddLine("Took " + time + "ms to sort " + binList.Count + " boxes, placed all boxes successfully");
            }

            int width;
            int height;

            this.binList.GetBoundingBin(out width, out height);

            int area = width * height;

            Log.Instance.AddLine("The newly sorted boxes are bounded within " + width + "px by " + height + "px (area: " + area + "px)");

            this.RefreshPanel();
        }
Пример #2
0
        private void SortClick(object sender, EventArgs arguments)
        {
            var panelRectangle = new Rectangle(0, 0, panel.Width, panel.Height);
            int unresolved;
            int width;
            int height;
            var startTime = DateTime.Now;

            BinListSorterTree.Sort(ref binList, panelRectangle, out unresolved);

            var endTime = DateTime.Now;

            this.LogCompletionTime(endTime, startTime, unresolved);

            this.binList.GetBoundingBin(out width, out height);
            var area = width * height;

            Log.Instance.AddLine("The newly sorted boxes are bounded within " + width + "px by " + height + "px (area: " + area + "px)");

            this.RefreshPanel();
        }