RecalculateFreeSpace ( LinkedListNode <FreeSpaceBox> freeSpaceBoxNode, RectangleF boxPlaced ) { FreeSpaceBox freeSpaceBox = freeSpaceBoxNode.Value; float top, bottom, right, left; if (freeSpaceBox.orientation == FreeSpaceBox.Orientation.Horiz) { top = freeSpaceBox.boxRectangle.Top; left = boxPlaced.Right; right = freeSpaceBox.boxRectangle.Right; bottom = freeSpaceBox.boxRectangle.Bottom; } else { top = boxPlaced.Bottom; left = freeSpaceBox.boxRectangle.Left; right = freeSpaceBox.boxRectangle.Right; bottom = freeSpaceBox.boxRectangle.Bottom; } FreeSpaceBox newFreeSpaceBox = new FreeSpaceBox(left, top, right, bottom, freeSpaceBox.orientation); double newFreeSpaceBoxArea = newFreeSpaceBox.GetArea(); freeSpaceBoxList.AddLast(newFreeSpaceBox); freeSpaceBoxList.Remove(freeSpaceBoxNode); }
RecalculateFreeSpace ( LinkedListNode<FreeSpaceBox> freeSpaceBoxNode, RectangleF boxPlaced ) { FreeSpaceBox freeSpaceBox = freeSpaceBoxNode.Value; float top, bottom, right, left; if (freeSpaceBox.orientation == FreeSpaceBox.Orientation.Horiz) { top = freeSpaceBox.boxRectangle.Top; left = boxPlaced.Right; right = freeSpaceBox.boxRectangle.Right; bottom = freeSpaceBox.boxRectangle.Bottom; } else { top = boxPlaced.Bottom; left = freeSpaceBox.boxRectangle.Left; right = freeSpaceBox.boxRectangle.Right; bottom = freeSpaceBox.boxRectangle.Bottom; } FreeSpaceBox newFreeSpaceBox = new FreeSpaceBox(left, top, right, bottom, freeSpaceBox.orientation); double newFreeSpaceBoxArea = newFreeSpaceBox.GetArea(); freeSpaceBoxList.AddLast(newFreeSpaceBox); freeSpaceBoxList.Remove(freeSpaceBoxNode); }