public DistanceBetweenPointsResult GetDistanceBetweenPoints(Point point1, Point point2) { double distInPixel2; double distInWorld2; double angle2; var errorCode = InteropApi.GetDistanceBetweenPoints( point1, point2, out distInPixel2, out distInWorld2, out angle2); if (errorCode != 0) { throw new MilInteropException("GetDistanceBetweenPoints", errorCode); } return(new DistanceBetweenPointsResult() { DistanceInPixel = distInPixel2, DistanceInWorld = distInWorld2, Angle = angle2, Point1 = point1, Point2 = point2, }); }
public DefectResultCollection SearchDefects(HImage imageInfo, HImage mask) { var drs = new DefectResultCollection(); InspectInfo inspectInfo; int errorCode = 0; errorCode = InteropApi.InspectCalculate(imageInfo.ToImageInfo(), mask.ToImageInfo(), out inspectInfo); if (errorCode != 0) { throw new MilInteropException("InteropApi.InspectCalculate", errorCode); } for (int i = 0; i < inspectInfo.DefectsCount; i++) { DefectInfo defectInfo; errorCode = InteropApi.GetInspectDefect(i, out defectInfo); if (errorCode != 0) { throw new MilInteropException("InteropApi.GetInspectDefect", errorCode); } var defectResult = new DefectResult(); defectResult.InjectFrom(defectInfo); drs.Add(defectResult); } return(drs); }
public DistanceBetweenLinesResult GetDistanceBetweenLines(Line line1, Line line2) { double distInPixel; double distInWorld; double angle; Point footPoint1; Point footPoint2; var errorCode = InteropApi.GetDistanceBetweenLines( line1, line2, out distInPixel, out distInWorld, out angle, out footPoint1, out footPoint2); if (errorCode != 0) { throw new MilInteropException("GetDistanceBetweenLines", errorCode); } return(new DistanceBetweenLinesResult() { DistanceInPixel = distInPixel, DistanceInWorld = distInWorld, Angle = angle, FootPoint1 = footPoint1, FootPoint2 = footPoint2, }); }
public void TestExceptionMessageWithStackTrace() { ExceptionThrower et = new ExceptionThrower(); var api = new InteropApi { CopyExceptionDetailsToThreadErrorMessage = true }; api.HandleException(et.GetFabricException()); var errorMessage = GetLastErrorMessageOnThread(); Assert.IsTrue(errorMessage.Contains(TestExceptionMessage), "Should contain expected error message."); Assert.IsTrue(errorMessage.Contains("at System.Fabric.Test.Interop.InteropApiTest.ExceptionThrower.ThrowFabricException"), "Should contain excpected stackTrace."); }
public void TestExceptionWithLongMessageAndStackTrace() { ExceptionThrower et = new ExceptionThrower { HasLongMessage = true }; var api = new InteropApi { CopyExceptionDetailsToThreadErrorMessage = true }; api.HandleException(et.GetFabricException()); var errorMessage = GetLastErrorMessageOnThread(); Assert.IsTrue(errorMessage.Contains("testExceptionMessagezzzzz"), "Should contain expected error message."); Assert.IsTrue((errorMessage.Length <= MessageMaxLength), "Message should be less than " + MessageMaxLength + " in length."); Assert.IsTrue(errorMessage.Contains("at System.Fabric.Test.Interop.InteropApiTest.ExceptionThrower.ThrowFabricException"), "Should contain excpected stackTrace."); }
public InspectionResult Inspect(InspectionSchema inspectionSchema) { var inspectionResult = new InspectionResult(); Debug.WriteLine("MilGeneralInspector.Inspect in"); int errorCode; InteropApi.CleanDefinitions(); Debug.WriteLine("InteropApi.Calculate begin"); errorCode = InteropApi.Calculate(_imageInfo); Debug.WriteLine("InteropApi.Calculate end"); if (errorCode != 0) { Debug.WriteLine("InteropApi.Calculate error"); throw new MilInteropException("Calculate", errorCode); } Debug.WriteLine("MilGeneralInspector.Inspect out"); return(inspectionResult); }
public void Init(int width, int height) { InteropApi.InitApp(8192, 12500); }
public void Init() { InteropApi.InitApp(8192, 12500); }
public void Dispose() { InteropApi.FreeApp(); }