public static void TriTest(DataStruct.MouseTestResultData tresult, Dictionary <data.TestItem, bool> enTestItem, ref int startDrawX, ref int startDrawY, Graphics g, DataStruct.ProductIndex idx) { if (tresult == null || enTestItem == null || g == null) { return; } if (enTestItem[data.TestItem.EN_TRIANGLE]) { startDrawX += tresult.X; startDrawY += tresult.Y; myPoint p = new myPoint("", startDrawX, startDrawY); myTriangle exTri = (myTriangle)Result.GetShape(idx, DataStruct.TestType.DRAW_TRIANGLE_EX).shape; myTriangle innerTri = (myTriangle)Result.GetShape(idx, DataStruct.TestType.DRAW_TRIANGLE_INNER).shape; bool cirRes = PointAlgorithm.IsPointInTwoTriangle(p.GetPoint(), exTri, innerTri); if (cirRes) { p.Draw(g, DataStruct.myColor.PASS, DataStruct.myColor.PASS, true, 1); } else { p.Draw(g, DataStruct.myColor.FAIL, DataStruct.myColor.FAIL, true, 1); } p.Dispose(); exTri.Dispose(); innerTri.Dispose(); } }
/// <summary> /// 生成箭头三角形,或1个,或2个箭头 /// </summary> /// <param name="_ori"></param> /// <param name="_arrowW"></param> /// <param name="_arrowH"></param> /// <returns></returns> private myTriangle[] GenTriangle(ARROW_ORI _ori, int _arrowW, int _arrowH) { myTriangle[] tris = null; string tname = string.Format("ori{0},sx{1},sy{2},w{3},h{4}", ori.ToString(), rect.X, rect.Y, _arrowW, _arrowH); if (_ori == ARROW_ORI.END_ARROW_TOP) { PointF A = new PointF(rect.X - _arrowW, rect.Y); PointF B = new PointF(rect.X + rect.Width + _arrowW, rect.Y); PointF C = new PointF(A.X + (B.X - A.X) / 2, A.Y - _arrowH); tri1 = new myTriangle(tname, A, B, C); tris = new myTriangle[1] { tri1 }; } else if (_ori == ARROW_ORI.END_ARROW_BOM) { PointF A = new PointF(rect.X - _arrowW, rect.Y + rect.Height); PointF B = new PointF(rect.X + rect.Width + _arrowW, A.Y); PointF C = new PointF(A.X + (B.X - A.X) / 2, A.Y + _arrowH); tri1 = new myTriangle(tname, A, B, C); tris = new myTriangle[1] { tri1 }; } else if (_ori == ARROW_ORI.END_ARROW_BOTH_TB) { PointF A = new PointF(rect.X - _arrowW, rect.Y); PointF B = new PointF(rect.X + rect.Width + _arrowW, rect.Y); PointF C = new PointF(A.X + (B.X - A.X) / 2, A.Y - _arrowH); tri1 = new myTriangle(tname, A, B, C); PointF A2 = new PointF(rect.X - _arrowW, rect.Y + rect.Height); PointF B2 = new PointF(rect.X + rect.Width + _arrowW, A2.Y); PointF C2 = new PointF(A2.X + (B2.X - A2.X) / 2, A2.Y + _arrowH); tri2 = new myTriangle(tname, A2, B2, C2); tris = new myTriangle[2] { tri1, tri2 }; } else if (_ori == ARROW_ORI.END_ARROW_LEFT) { PointF A = new PointF(rect.X, rect.Y - _arrowW); PointF B = new PointF(A.X, rect.Y + rect.Height + _arrowW); PointF C = new PointF(A.X - arrowH, A.Y + (B.Y - A.Y) / 2); tri1 = new myTriangle(tname, A, B, C); tris = new myTriangle[1] { tri1 }; } else if (_ori == ARROW_ORI.END_ARROW_RIGHT) { PointF A = new PointF(rect.X + rect.Width, rect.Y - _arrowW); PointF B = new PointF(A.X, rect.Y + rect.Height + _arrowW); PointF C = new PointF(A.X + _arrowH, A.Y + (B.Y - A.Y) / 2); tri1 = new myTriangle(tname, A, B, C); tris = new myTriangle[1] { tri1 }; } else if (_ori == ARROW_ORI.END_ARROW_BOTH_LR) { PointF A = new PointF(rect.X, rect.Y - _arrowW); PointF B = new PointF(A.X, rect.Y + rect.Height + _arrowW); PointF C = new PointF(A.X - arrowH, A.Y + (B.Y - A.Y) / 2); tri1 = new myTriangle(tname, A, B, C); PointF A2 = new PointF(rect.X + rect.Width, rect.Y - _arrowW); PointF B2 = new PointF(A2.X, rect.Y + rect.Height + _arrowW); PointF C2 = new PointF(A2.X + _arrowH, A2.Y + (B2.Y - A2.Y) / 2); tri2 = new myTriangle(tname, A2, B2, C2); tris = new myTriangle[2] { tri1, tri2 }; } else { } return(tris); }