public void Draw(Graphics g, double ratio) { if (isRect == 1) { Rectangle rectRatio = SizeableArea.rectRatio(ratio, rect); DrawRect(g, rectRatio, ratio); } else { Quadrilateral quadRatio = SizeableArea.quadRatio(ratio, quad); DrawQuad(g, quadRatio, ratio); } }
private Rectangle GetRect(PosSizableQuad p, double ratio) { if (isRect == 1) { Rectangle rectRatio = SizeableArea.rectRatio(ratio, rect); switch (p) { case PosSizableQuad.LeftUp: return(CreateRectSizableNode(rectRatio.X, rectRatio.Y)); case PosSizableQuad.LeftMiddle: return(CreateRectSizableNode(rectRatio.X, rectRatio.Y + rectRatio.Height / 2)); case PosSizableQuad.LeftDown: return(CreateRectSizableNode(rectRatio.X, rectRatio.Y + rectRatio.Height)); case PosSizableQuad.DownMiddle: return(CreateRectSizableNode(rectRatio.X + rectRatio.Width / 2, rectRatio.Y + rectRatio.Height)); case PosSizableQuad.RightDown: return(CreateRectSizableNode(rectRatio.X + rectRatio.Width, rectRatio.Y + rectRatio.Height)); case PosSizableQuad.RightMiddle: return(CreateRectSizableNode(rectRatio.X + rectRatio.Width, rectRatio.Y + rectRatio.Height / 2)); case PosSizableQuad.RightUp: return(CreateRectSizableNode(rectRatio.X + rectRatio.Width, rectRatio.Y)); case PosSizableQuad.UpMiddle: return(CreateRectSizableNode(rectRatio.X + rectRatio.Width / 2, rectRatio.Y)); default: return(new Rectangle()); } } else { Quadrilateral quadRatio = SizeableArea.quadRatio(ratio, quad); switch (p) { case PosSizableQuad.LeftUp: return(CreateRectSizableNode(quadRatio.LeftUp.X, quadRatio.LeftUp.Y)); case PosSizableQuad.LeftMiddle: return(CreateRectSizableNode((quadRatio.LeftUp.X + quadRatio.LeftDown.X) / 2, (quadRatio.LeftUp.Y + quadRatio.LeftDown.Y) / 2)); case PosSizableQuad.LeftDown: return(CreateRectSizableNode(quadRatio.LeftDown.X, quadRatio.LeftDown.Y)); case PosSizableQuad.DownMiddle: return(CreateRectSizableNode((quadRatio.LeftDown.X + quadRatio.RightDown.X) / 2, (quadRatio.LeftDown.Y + quadRatio.RightDown.Y) / 2)); case PosSizableQuad.RightDown: return(CreateRectSizableNode(quadRatio.RightDown.X, quadRatio.RightDown.Y)); case PosSizableQuad.RightMiddle: return(CreateRectSizableNode((quadRatio.RightDown.X + quadRatio.RightUp.X) / 2, (quadRatio.RightDown.Y + quadRatio.RightUp.Y) / 2)); case PosSizableQuad.RightUp: return(CreateRectSizableNode(quadRatio.RightUp.X, quadRatio.RightUp.Y)); case PosSizableQuad.UpMiddle: return(CreateRectSizableNode((quadRatio.RightUp.X + quadRatio.LeftUp.X) / 2, (quadRatio.RightUp.Y + quadRatio.LeftUp.Y) / 2)); default: return(new Rectangle()); } } }