private void TeachDisplayMouseUpEvent(object _CaliperTool) { if (CurrentAlgoType != eAlgoType.C_NEEDLE_FIND && CurrentAlgoType != eAlgoType.C_LINE_FIND) { return; } if (CurrentTeachStep != eTeachStep.ALGO_SET) { return; } if (CurrentAlgoType == eAlgoType.C_NEEDLE_FIND) { CogFindCircleTool _CircleCaliperTool = _CaliperTool as CogFindCircleTool; double _CenterX = 0, _CenterY = 0, _Radius = 0, _AngleStart = 0, _AngleSpan = 0; _CircleCaliperTool.RunParams.ExpectedCircularArc.GetCenterRadiusAngleStartAngleSpan(out _CenterX, out _CenterY, out _Radius, out _AngleStart, out _AngleSpan); int _CaliperNumber = 0; double _CaliperSearchLength = 0, _CaliperProjectionLength = 0; eSearchDirection _CaliperSearchDir = eSearchDirection.IN_WARD; ePolarity _CaliperPolarity = ePolarity.DARK_TO_LIGHT; _CaliperNumber = _CircleCaliperTool.RunParams.NumCalipers; _CaliperSearchLength = _CircleCaliperTool.RunParams.CaliperSearchLength; _CaliperProjectionLength = _CircleCaliperTool.RunParams.CaliperProjectionLength; _CaliperSearchDir = (eSearchDirection)_CircleCaliperTool.RunParams.CaliperSearchDirection; _CaliperPolarity = (ePolarity)_CircleCaliperTool.RunParams.CaliperRunParams.Edge0Polarity; ucCogNeedleFindWnd.SetCaliper(_CaliperNumber, _CaliperSearchLength, _CaliperProjectionLength, _CaliperSearchDir, _CaliperPolarity); ucCogNeedleFindWnd.SetCircularArc(_CenterX, _CenterY, _Radius, _AngleStart, _AngleSpan); } else if (CurrentAlgoType == eAlgoType.C_LINE_FIND) { CogFindLineTool _FindLineTool = _CaliperTool as CogFindLineTool; double _StartX = 0, _StartY = 0, _EndX = 0, _EndY = 0; _FindLineTool.RunParams.ExpectedLineSegment.GetStartEnd(out _StartX, out _StartY, out _EndX, out _EndY); int _CaliperNumber = 0; double _CaliperSearchLength = 0, _CaliperProjectionLength = 0, _CaliperDirection; _CaliperNumber = _FindLineTool.RunParams.NumCalipers; _CaliperSearchLength = _FindLineTool.RunParams.CaliperSearchLength; _CaliperProjectionLength = _FindLineTool.RunParams.CaliperProjectionLength; _CaliperDirection = _FindLineTool.RunParams.CaliperSearchDirection; ucCogLineFindWnd.SetCaliper(_CaliperNumber, _CaliperSearchLength, _CaliperProjectionLength, _CaliperDirection); ucCogLineFindWnd.SetCaliperLine(_StartX, _StartY, _EndX, _EndY); } }
public void SetCaliper(int _CaliperNumber, double _SearchLength, double _ProjectionLength, eSearchDirection _eSearchDir, ePolarity _ePolarity) { numUpDownCaliperNumber.Value = Convert.ToDecimal(_CaliperNumber / 2); numUpDownSearchLength.Value = Convert.ToDecimal(_SearchLength); numUpDownProjectionLength.Value = Convert.ToDecimal(_ProjectionLength); SetSearchDirection(Convert.ToInt32(_eSearchDir)); SetPolarity(Convert.ToInt32(_ePolarity)); }