private static CircleWindow PositionAdjustCircle(
            PositionAdjustToolSettingBase posSetting,
            PositionAdjustToolResultBase posResult,
            CircleWindow circle)
        {
            PositionControl positionAdjusted = ToolResultRender.GetPositionAdjusted(posSetting, posResult, (WindowShape)circle);

            return(new CircleWindow(positionAdjusted.sPoint.nX, positionAdjusted.sPoint.nY, (ushort)circle.Diameter));
        }
        private static RectangleWindow PositionAdjustRectangle(
            PositionAdjustToolSettingBase posSetting,
            PositionAdjustToolResultBase posResult,
            RectangleWindow rect)
        {
            PositionControl positionAdjusted = ToolResultRender.GetPositionAdjusted(posSetting, posResult, (WindowShape)rect);

            return(new RectangleWindow(positionAdjusted.sPoint.nX, positionAdjusted.sPoint.nY, (ushort)rect.Size.Width, (ushort)rect.Size.Height, positionAdjusted.nAngle));
        }
 public override bool IsDrawInSettingPosition(
     PositionAdjustToolSettingBase posSetting,
     PositionAdjustToolResultBase posResult)
 {
     if (posSetting == null || posResult == null)
     {
         return(true);
     }
     return(!posResult.Ok);
 }
        internal static void DrawWindow(
            Graphics graphics,
            Color ok,
            Color ng,
            ToolSettingBase positionAdjustSetting,
            ToolSettingBase targetToolSetting,
            ToolResultBase positionAdjustResult,
            ToolResultBase targetToolResult)
        {
            Color color = targetToolResult.Ok ? ok : ng;
            PositionAdjustToolResultBase  posResult  = positionAdjustResult as PositionAdjustToolResultBase;
            PositionAdjustToolSettingBase posSetting = positionAdjustSetting as PositionAdjustToolSettingBase;

            if (targetToolResult is PositionAdjustIncludeToolResult)
            {
                PositionAdjustIncludeToolResult includeToolResult = targetToolResult as PositionAdjustIncludeToolResult;
                if (includeToolResult.DrawInSettingPosition)
                {
                    if (targetToolSetting.MultiToolWindow.Enabled)
                    {
                        ToolResultRender.DrawVector(graphics, color, targetToolSetting.MultiToolWindow);
                    }
                    else
                    {
                        ToolResultRender.DrawVector(graphics, color, targetToolSetting.ToolWindow);
                    }
                }
                else if (targetToolSetting.MultiToolWindow.Enabled)
                {
                    ToolResultRender.DrawPositionAdjustedVector(graphics, color, targetToolSetting.MultiToolWindow, includeToolResult.Description);
                }
                else
                {
                    ToolResultRender.DrawPositionAdjustedVector(graphics, color, targetToolSetting.ToolWindow, includeToolResult.Description);
                }
            }
            else
            {
                PositionAdjustExcludeToolResult excludeToolResult = targetToolResult as PositionAdjustExcludeToolResult;
                if (excludeToolResult != null && (posSetting == null || posResult == null || excludeToolResult.IsDrawInSettingPosition(posSetting, posResult)))
                {
                    ToolResultRender.DrawVector(graphics, color, targetToolSetting.ToolWindow);
                }
                else
                {
                    ToolResultRender.DrawPositionUnadjustedVector(graphics, color, posSetting, posResult, targetToolSetting.ToolWindow);
                }
            }
        }
        private static PositionControl GetPositionAdjusted(
            PositionAdjustToolSettingBase posSetting,
            PositionAdjustToolResultBase posResult,
            WindowShape shape)
        {
            PositionControl positionControl = new PositionControl();
            int             num1            = shape.Center.X - posSetting.ToolWindow.Center.X;
            int             num2            = shape.Center.Y - posSetting.ToolWindow.Center.Y;
            int             num3            = (int)posResult.Description.nAngle - posSetting.ToolWindow.Angle;
            double          num4            = Math.Cos(Math.PI / 180.0 * (double)num3 / 10.0);
            double          num5            = Math.Sin(Math.PI / 180.0 * (double)num3 / 10.0);

            positionControl.sPoint.nX = (short)(num4 * (double)num1 - num5 * (double)num2 + (double)posResult.Description.sPoint.nX);
            positionControl.sPoint.nY = (short)(num5 * (double)num1 + num4 * (double)num2 + (double)posResult.Description.sPoint.nY);
            positionControl.nAngle    = (short)(shape.Angle + num3);
            return(positionControl);
        }
        private static void DrawPositionUnadjustedVector(
            Graphics graphics,
            Color color,
            PositionAdjustToolSettingBase posSetting,
            PositionAdjustToolResultBase posResult,
            WindowShape toolWindow)
        {
            WindowShape     toolWindow1 = (WindowShape)null;
            RectangleWindow rect        = toolWindow as RectangleWindow;

            if (rect != null)
            {
                toolWindow1 = (WindowShape)ToolResultRender.PositionAdjustRectangle(posSetting, posResult, rect);
            }
            CircleWindow circle = toolWindow as CircleWindow;

            if (circle != null)
            {
                toolWindow1 = (WindowShape)ToolResultRender.PositionAdjustCircle(posSetting, posResult, circle);
            }
            ToolResultRender.DrawVector(graphics, color, toolWindow1);
        }
 public override bool IsDrawInSettingPosition(
     PositionAdjustToolSettingBase posSetting,
     PositionAdjustToolResultBase posResult)
 {
     return(true);
 }
 public abstract bool IsDrawInSettingPosition(
     PositionAdjustToolSettingBase posSetting,
     PositionAdjustToolResultBase posResult);