GetArea() 공개 메소드

Gets the area of a FreeSpaceBox
public GetArea ( ) : double
리턴 double
예제 #1
0
        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);
    }