示例#1
0
        public PanelRectangle Position(Panel rootPanel, Position rootPanelHinge)
        {
            if (rootPanel == null)
            {
                throw new ArgumentNullException(nameof(rootPanel));
            }
            if (rootPanelHinge == null)
            {
                throw new ArgumentNullException(nameof(rootPanelHinge));
            }

            var rectangle = _rectangleFactory.Create(rootPanelHinge, rootPanel.Dimensions);

            return(new PanelRectangle(rootPanel, rectangle, Rotation.None));
        }
示例#2
0
        public PanelRectangle Position(PanelRectangle parent, Panel panel)
        {
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }
            if (panel == null)
            {
                throw new ArgumentNullException(nameof(panel));
            }
            var hingeToAttachTo  = _attachToHingeDeterminer.Determine(parent, panel);
            var rectangle        = _rectangleFactory.Create(hingeToAttachTo, panel.Dimensions);
            var rotation         = _rotationDeterminer.Determine(parent, panel);
            var rotatedRectangle = _rectangleRotator.Rotate(hingeToAttachTo, rectangle, rotation);
            var rotatedRectangleWithHingeOffset = _hingeOffsetApplier.Apply(rotatedRectangle, rotation, panel.HingeOffset);

            return(new PanelRectangle(panel, rotatedRectangleWithHingeOffset, rotation));
        }