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)); }
private static void DrawCircle( Graphics graphics, Pen pen, Point scaledcenter, uint scaledDiameter) { PointF pointF = ToolResultRender.Unscall(scaledcenter); float num = ToolResultRender.Unscall(scaledDiameter); graphics.TranslateTransform(pointF.X, pointF.Y); graphics.DrawEllipse(pen, (float)(-(double)num / 2.0), (float)(-(double)num / 2.0), num, num); graphics.ResetTransform(); }
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 void DrawArrow(Graphics graphics, Color color, WindowShape toolWindow) { PointF pointF = ToolResultRender.Unscall(toolWindow.Center); float angle = ToolResultRender.Unscall((float)toolWindow.Angle); using (Pen pen = new Pen(color, 3f)) { pen.EndCap = LineCap.ArrowAnchor; graphics.TranslateTransform(pointF.X, pointF.Y); graphics.RotateTransform(angle); graphics.DrawLine(pen, PointF.Empty, new PointF(15f, 0.0f)); graphics.DrawLine(pen, PointF.Empty, new PointF(0.0f, -15f)); graphics.ResetTransform(); } }
private static void DrawPositionAdjustedVector( Graphics graphics, Color color, MultiWindowShape toolWindows, PositionControl description1) { ToolResultRender.DrawPositionAdjustedVector(graphics, color, toolWindows.ToolWindow1, description1); PositionControl description = new PositionControl(); short num1 = (short)(toolWindows.ToolWindow1.Center.X - (int)description1.sPoint.nX); short num2 = (short)(toolWindows.ToolWindow1.Center.Y - (int)description1.sPoint.nY); description.sPoint.nX = (short)(toolWindows.ToolWindow2.Center.X + (int)num1); description.sPoint.nY = (short)(toolWindows.ToolWindow2.Center.Y + (int)num2); description.nAngle = description1.nAngle; ToolResultRender.DrawPositionAdjustedVector(graphics, color, toolWindows.ToolWindow2, description); }
private static void DrawRectangle( Graphics graphics, Pen pen, Point scaledCenter, Size scaledSize, float scaledAngle) { PointF pointF = ToolResultRender.Unscall(scaledCenter); SizeF sizeF = ToolResultRender.Unscall(scaledSize); float angle = ToolResultRender.Unscall(scaledAngle); graphics.TranslateTransform(pointF.X, pointF.Y); graphics.RotateTransform(angle); graphics.DrawRectangle(pen, (float)(-(double)sizeF.Width / 2.0), (float)(-(double)sizeF.Height / 2.0), sizeF.Width, sizeF.Height); graphics.ResetTransform(); }
private static void DrawPositionAdjustedVector( Graphics graphics, Color color, WindowShape toolWindow, PositionControl description) { WindowShape toolWindow1 = (WindowShape)null; RectangleWindow rectangleWindow = toolWindow as RectangleWindow; if (rectangleWindow != null) { toolWindow1 = (WindowShape) new RectangleWindow(description.sPoint.nX, description.sPoint.nY, (ushort)rectangleWindow.Size.Width, (ushort)rectangleWindow.Size.Height, (short)((int)description.nAngle + toolWindow.Angle)); } CircleWindow circleWindow = toolWindow as CircleWindow; if (circleWindow != null) { toolWindow1 = (WindowShape) new CircleWindow(description.sPoint.nX, description.sPoint.nY, (ushort)circleWindow.Diameter); } ToolResultRender.DrawVector(graphics, color, toolWindow1); }
private static void DrawVector(Graphics graphics, Color color, WindowShape toolWindow) { RectangleWindow rectangleWindow = toolWindow as RectangleWindow; using (Pen pen = new Pen(color, 2.5f)) { if (rectangleWindow != null) { ToolResultRender.DrawRectangle(graphics, pen, rectangleWindow.Center, rectangleWindow.Size, (float)rectangleWindow.Angle); } CircleWindow circleWindow = toolWindow as CircleWindow; if (circleWindow != null) { ToolResultRender.DrawCircle(graphics, pen, circleWindow.Center, circleWindow.Diameter); } } if (toolWindow == null) { return; } ToolResultRender.DrawArrow(graphics, color, toolWindow); }
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); }
private static void DrawVector(Graphics graphics, Color color, MultiWindowShape toolWindows) { ToolResultRender.DrawVector(graphics, color, toolWindows.ToolWindow1); ToolResultRender.DrawVector(graphics, color, toolWindows.ToolWindow2); }
public void DrawWindow(Graphics graphics, Color ok, Color ng, byte toolNo) { ProgramDescription activeProgram = this.DataRepository.GetActiveProgram(); ToolResultRender.DrawWindow(graphics, ok, ng, activeProgram.PositionAdjustSetting, activeProgram[toolNo], this.DataRepository.PositionAdjustResult, this.DataRepository[toolNo]); }