public static void ShowResult(Graphics g, DataStruct.ProductIndex index, DataStruct.TestType ttype, DataStruct.TestResult result) { if (data.AllShapes == null) { return; } foreach (DataStruct.ShowShapes r in data.AllShapes) { if (data.GenShapeName(index, ttype) == r.shape.Name()) { if (result == DataStruct.TestResult.PASSED) { r.shape.Draw(g, DataStruct.myColor.PASS, DataStruct.myColor.PASS, r.solidFill, 1); } else if (result == DataStruct.TestResult.FAILED) { r.shape.Draw(g, DataStruct.myColor.FAIL, DataStruct.myColor.FAIL, r.solidFill, 1); } else if (result == DataStruct.TestResult.STDBY) { r.shape.Draw(g, DataStruct.myColor.STDBY, DataStruct.myColor.STDBY, r.solidFill, 1); } else { r.shape.Draw(g, DataStruct.myColor.STDBY2, DataStruct.myColor.STDBY2, r.solidFill, 1); } } } }
public static void Init2DShowResult(Graphics btnG, Graphics drawG, DataStruct.ProductIndex idx, DataStruct.TestResult tresult) { foreach (DataStruct.TestType t in Enum.GetValues(typeof(DataStruct.TestType))) { if (t.ToString().Contains("DRAW")) { ShowResult(drawG, idx, t, tresult); } else { ShowResult(btnG, idx, t, tresult); } } }
public static DataStruct.ShowShapes GetShape(DataStruct.ProductIndex index, DataStruct.TestType ttype) { if (data.AllShapes == null) { return(null); } foreach (DataStruct.ShowShapes r in data.AllShapes) { if (data.GenShapeName(index, ttype) == r.shape.Name()) { return(r); } } return(null); }
public static string GenShapeName(DataStruct.ProductIndex product, DataStruct.TestType ttype) { return(product.ToString() + ttype.ToString()); }
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(); } }
public static void CircleTest(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_CIRCLE]) { startDrawX += tresult.X; startDrawY += tresult.Y; //当前点 myPoint p = new myPoint("", startDrawX, startDrawY); //外圆 myCircle exCir = (myCircle)Result.GetShape(idx, DataStruct.TestType.DRAW_CIRCLE_EX).shape; //内圆 myCircle innerCir = (myCircle)Result.GetShape(idx, DataStruct.TestType.DRAW_CIRCLE_INNER).shape; //判断当前点是否在制定的内圆和外圆之间 bool cirRes = PointAlgorithm.IsPointInTwoCircle(p, exCir, innerCir); 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(); exCir.Dispose(); innerCir.Dispose(); } }