public override AuxiliaryLineParameter GetNewAuxiliaryLineParameterBaseHeight(int changeSizeWidth, int changeSizeHeight) { AuxiliaryLineParameter newParameter = AC.CloneParameter(); // 左下点の操作なら右側と上側は変わらない int changeWidth = changeSizeWidth; int changeHeight = changeSizeHeight; int newLeft = AC.AuxiliaryLeft - CalcWidthChangeSize(changeSizeWidth, changeSizeHeight); int newBottom = AC.AuxiliaryBottom + changeSizeHeight; int minLeft = GetMinLeft(); int maxBottom = GetMaxBottom(); if (newBottom > maxBottom) { changeHeight = maxBottom - AC.AuxiliaryBottom; newLeft = AC.AuxiliaryLeft - CalcWidthChangeSize(changeWidth, changeHeight); newBottom = maxBottom; } if (newLeft < minLeft) { newLeft = minLeft; newBottom = AC.AuxiliaryBottom + CalcHeightChangeSize(AC.AuxiliaryLeft - newLeft, changeHeight); } newParameter.ReplacePoint(new Point(newLeft, AC.AuxiliaryTop), new Point(newLeft, newBottom), new Point(AC.AuxiliaryRight, AC.AuxiliaryTop), new Point(AC.AuxiliaryRight, newBottom)); return(newParameter); }
public override AuxiliaryLineParameter GetNewAuxiliaryLineParameterBaseHeight(int changeSizeWidth, int changeSizeHeight) { AuxiliaryLineParameter newParameter = AC.CloneParameter(); // 右上点の操作なら左側や下側は変わらない int changeWidth = changeSizeWidth; int changeHeight = changeSizeHeight; int newTop = AC.AuxiliaryTop - changeSizeHeight; int newRight = AC.AuxiliaryRight + CalcWidthChangeSize(changeSizeWidth, changeSizeHeight); int maxRight = GetMaxRight(); int minTop = GetMinTop(); if (newTop < minTop) { changeHeight = AC.AuxiliaryTop - minTop; newRight = AC.AuxiliaryRight + CalcWidthChangeSize(changeWidth, changeHeight); newTop = minTop; } if (newRight > maxRight) { newRight = maxRight; newTop = AC.AuxiliaryTop - CalcHeightChangeSize(newRight - AC.AuxiliaryRight, changeHeight); } newParameter.ReplacePoint(new Point(AC.AuxiliaryLeft, newTop), new Point(AC.AuxiliaryLeft, AC.AuxiliaryBottom), new Point(newRight, newTop), new Point(newRight, AC.AuxiliaryBottom)); return(newParameter); }
public override AuxiliaryLineParameter GetNewAuxiliaryLineParameterBaseHeight(int changeSizeWidth, int changeSizeHeight) { AuxiliaryLineParameter newParameter = AC.CloneParameter(); // 右下点の操作なら左側や上側は変わらない int changeWidth = changeSizeWidth; int changeHeight = changeSizeHeight; int newRight = AC.AuxiliaryRight + CalcWidthChangeSize(changeSizeWidth, changeSizeHeight); int newBottom = AC.AuxiliaryBottom + changeSizeHeight; int maxRight = GetMaxRight(); int maxBottom = GetMaxBottom(); if (newBottom > maxBottom) { changeHeight = maxBottom - AC.AuxiliaryBottom; newRight = AC.AuxiliaryRight + CalcWidthChangeSize(changeWidth, changeHeight); newBottom = maxBottom; } if (newRight > maxRight) { newRight = maxRight; newBottom = AC.AuxiliaryBottom + CalcHeightChangeSize(maxRight - AC.AuxiliaryRight, changeHeight); } SetNewParameter(newParameter, newRight - AC.AuxiliaryRight, newBottom - AC.AuxiliaryBottom); return(newParameter); }
public override AuxiliaryLineParameter ExecuteCore(object operation = null) { Point leftTop = AC.AuxiliaryLeftTop; Point leftBottom = AC.AuxiliaryLeftBottom; Point rightTop = AC.AuxiliaryRightTop; Point rightBottom = AC.AuxiliaryRightBottom; int centerX = Common.CalcCenterX(leftTop, rightBottom); int centerY = Common.CalcCenterY(leftBottom, rightTop); Point newLeftTop = CalcRotatePoint(leftTop, centerX, centerY, Degree); Point newLeftBottom = CalcRotatePoint(leftBottom, centerX, centerY, Degree); Point newRightTop = CalcRotatePoint(rightTop, centerX, centerY, Degree); Point newRightBottom = CalcRotatePoint(rightBottom, centerX, centerY, Degree); // degreeの通りに回転したら画像からはみ出る場合に回転しない if (IsOutOfRangeDisplayImage(newLeftTop) || IsOutOfRangeDisplayImage(newLeftBottom) || IsOutOfRangeDisplayImage(newRightTop) || IsOutOfRangeDisplayImage(newRightBottom)) { return(AC.CloneParameter()); } AuxiliaryLineParameter newParameter = AC.CloneParameter(); newParameter.ReplaceParameter(newLeftTop, newLeftBottom, newRightTop, newRightBottom, newParameter.Degree + Degree); return(newParameter); }
private AuxiliaryLineParameter MoveByMouse(Point moveFinishPoint) { AuxiliaryLineParameter newParameter = AC.CloneParameter(); int moveDistanceX = (int)(moveFinishPoint.X - MoveStartPoint.X); int moveDistanceY = (int)(moveFinishPoint.Y - MoveStartPoint.Y); newParameter.Move(moveDistanceX, moveDistanceY); return(newParameter); }
public override AuxiliaryLineParameter ExecuteCore(object o) { if (o is Keys.EnableKeys) { return(MoveByKey((Keys.EnableKeys)o)); } else if (o is System.Windows.Point) { return(MoveByMouse(Common.ToDrawingPoint((System.Windows.Point)o))); } else if (o is System.Drawing.Point) { return(MoveByMouse((System.Drawing.Point)o)); } return(AC.CloneParameter()); }
private AuxiliaryLineParameter MoveByKey(Keys.EnableKeys key) { AuxiliaryLineParameter newParameter = AC.CloneParameter(); // TODO: カーソルキーでの移動距離を可変にする if (key == Keys.EnableKeys.Up) { newParameter.MoveHeight(-1); } else if (key == Keys.EnableKeys.Down) { newParameter.MoveHeight(1); } else if (key == Keys.EnableKeys.Right) { newParameter.MoveWidth(1); } else if (key == Keys.EnableKeys.Left) { newParameter.MoveWidth(-1); } return(newParameter); }
public override AuxiliaryLineParameter ExecuteCore(object operation) { return(AC.CloneParameter()); }
public AuxiliaryLineParameter Execute(object operation) { BeforeParameter = AC.CloneParameter(); AfterParameter = ExecuteCore(operation); return(AfterParameter); }