public override bool Execute() { if (this.Vendor == MeasureVendor.ASV) { Inspection inspection = InspectionMgr.Instance.FindBy(this.InspectionKey); if (inspection == null) { return(false); } inspection.Execute(this.ImgData, this.ImgWidth, this.ImgHeight); if (!inspection.IsCurrResultOk) { return(false); } string[] res = inspection.CurrResultStr.Split(','); Logger.DEFAULT.Info(" 结果转换: " + inspection.CurrResultStr); double tmpRes = 0; if (!double.TryParse(res[0], out tmpRes)) { return(false); } this.PixResult = tmpRes; } return(true); }
public override bool Execute() { bool flag = false; if (this.FindBarCodeType == FindBarCodeType.ASV) { Inspection inspection = InspectionMgr.Instance.FindBy(this.InspectionKey); if (inspection == null) { return(false); } inspection.Execute(this.ImgData, this.ImgWidth, this.ImgHeight); if (!inspection.IsCurrResultOk) { return(false); } this.Text = inspection.CurrResultStr; if (this.Text.Length > this.MaxLength || this.Text.Length < this.MinLength) { return(false); } flag = true; } else if (this.FindBarCodeType == FindBarCodeType.AFM) { BarcodeHalcon barcode = new BarcodeHalcon(); flag = barcode.Execute(this.Bmp, out this.Text); } return(flag); }
public override bool Execute() { if (this.ImgData == null) { return(false); } if (this.IsUnStandard) { Inspection inspection = InspectionMgr.Instance.FindBy(InspectionKey); if (inspection == null) { return(false); } inspection.Execute(this.ImgData, this.ImgWidth, this.ImgHeight); if (!inspection.IsCurrResultOk) { return(false); } double x, y, x2, y2, angle; try { string[] ss = inspection.CurrResultStr.Split(','); x = double.Parse(ss[0]); y = double.Parse(ss[1]); if (this.UnStandardType == 0) { angle = double.Parse(ss[2]); Angle = angle; } else { x2 = double.Parse(ss[2]); y2 = double.Parse(ss[3]); MarkInImg2 = new PointD(x2, y2); } } catch { return(false); } MarkInImg = new PointD(x, y); } else { double score = 0, x = 0, y = 0; int rtn = ModelFindThm.Match(this.ImgData, this.ImgWidth, this.ImgHeight, this.ModelId, ref score, ref x, ref y); if (rtn != 0) { return(false); } this.Score = score; this.MarkInImg = new PointD(x, y); if (this.Score < this.AcceptScore) { return(false); } } return(true); }