Example #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (tbMeasure.Text.Length == 0)
            {
                return;
            }

            try
            {
                float length = float.Parse(tbMeasure.Text);
                if (length <= 0)
                {
                    return;
                }

                PointF a           = calibrationHelper.DistortionHelper.Undistort(line.A);
                PointF b           = calibrationHelper.DistortionHelper.Undistort(line.B);
                float  pixelLength = GeometryHelper.GetDistance(a, b);

                float ratio = length / pixelLength;

                calibrationHelper.SetCalibratorFromType(CalibratorType.Line);
                calibrationHelper.LengthUnit = (LengthUnit)cbUnit.SelectedIndex;
                calibrationHelper.CalibrationByLine_Initialize(ratio);
            }
            catch
            {
                // Failed : do nothing.
                log.Error(String.Format("Error while parsing measure. ({0}).", tbMeasure.Text));
            }
        }
Example #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                float length = (float)nudMeasure.Value;
                if (length <= 0)
                {
                    return;
                }

                calibrationHelper.SetCalibratorFromType(CalibratorType.Line);
                calibrationHelper.LengthUnit = (LengthUnit)cbUnit.SelectedIndex;
                calibrationHelper.CalibrationByLine_Initialize(line.Id, length, line.A, line.B, (CalibrationAxis)cbAxis.SelectedIndex);
            }
            catch
            {
                // Failed : do nothing.
                log.Error(String.Format("Error while parsing calibration measure."));
            }
        }