Beispiel #1
0
        private void buttonJBCurve_Click(object sender, RoutedEventArgs e)
        {
            if (IsShowCurve)
            {
                lChartPhoto.ClearDrawObject();
            }
            else
            {
                List <WriteableBitmap> bl = (testHelper.CurrentChart as GrayChart).ptp.getGBBrightChangedTestArea(ChartPhoto.getPhoto(), lynxUpDownAreaNum.IntValue);
                List <double>          l  = (testHelper.CurrentChart as GrayChart).ptp.getGBBrightChanged(bl);

                Canvas c = lChartPhoto.getDrawObjectCanvas();
                c.Children.Clear();
                DrawGraphic dg = new DrawGraphic(c);
                dg.ForeColor = Colors.Blue;
                dg.DrawLines(l, 0, 100);
            }
            IsShowCurve = !IsShowCurve;
        }
        void image_MouseLeftButtonDown(object sender, PointerRoutedEventArgs e)
        {
            try
            {
                if (SelectLine == null)
                {
                    SelectLine = new Line();
                    SelectLine.StrokeThickness = 3;
                    SelectLine.Stroke          = new SolidColorBrush(Colors.Green);
                    if (!lChartPhoto1.getDrawObjectCanvas().Children.Contains(SelectLine))
                    {
                        lChartPhoto1.getDrawObjectCanvas().Children.Add(SelectLine);
                    }
                }
                if (IsV)
                {
                    SelectLine.X1 = 0;
                    SelectLine.X2 = lChartPhoto1.Width;
                    SelectLine.Y1 = e.GetCurrentPoint(lChartPhoto1).Position.Y;
                    SelectLine.Y2 = e.GetCurrentPoint(lChartPhoto1).Position.Y;
                }
                else
                {
                    SelectLine.X1 = e.GetCurrentPoint(lChartPhoto1).Position.X;
                    SelectLine.X2 = e.GetCurrentPoint(lChartPhoto1).Position.X;
                    SelectLine.Y1 = 0;
                    SelectLine.Y2 = lChartPhoto1.Height;
                }
                DrawGraphic dg = new DrawGraphic();
                Point?      p  = ptp.PointToPix((lChartPhoto1.Photo), (lChartPhoto1.getImage()), e.GetCurrentPoint(lChartPhoto1.getImage()).Position, true);
                if (p == null)
                {
                    return;
                }
                double pp;
                if (IsV)
                {
                    pp = p.Value.Y / (lChartPhoto1.Photo).PixelHeight;
                }
                else
                {
                    pp = p.Value.X / (lChartPhoto1.Photo).PixelWidth;
                }

                //int s = ptp.getEdgeResoveLines(cb, !IsV, cb.PixelHeight);
                this.textBlockResovLines.Text = ptp.getEdgeResoveEffect(lChartPhoto1.getPhoto(), !IsV, pp).ToString();
                DrawGraphic sdg = new DrawGraphic(SFRCanvas);
                sdg.ForeColor = Colors.Green;
                DrawGraphic edg = new DrawGraphic(EdgeBrightCanvas);
                edg.ForeColor = Colors.Green;
                DrawGraphic ldg = new DrawGraphic(LSFCanvas);
                ldg.ForeColor = Colors.Green;
                List <double> al = new List <double>();
                List <double> EdgeBrightList;
                List <double> LSF;

                ptp.setEdgeResoveStopFrequency(lynxUpDown1.IntValue);
                if (IsV)
                {
                    EdgeBrightList = SilverlightLFC.common.Environment.getDoubleList <int>(ptp.getImageGrayHLine(lChartPhoto1.getPhoto(), Convert.ToInt32((lChartPhoto1.getPhoto()).PixelHeight * pp)));
                    LSF            = SilverlightLFC.common.Environment.getDoubleList <decimal>(ptp.getDdx(EdgeBrightList));
                    al             = ptp.getCurveMTF(lChartPhoto1.Photo, false, pp);
                }
                else
                {
                    EdgeBrightList = SilverlightLFC.common.Environment.getDoubleList <int>(ptp.getImageGrayVLine(lChartPhoto1.getPhoto(), Convert.ToInt32((lChartPhoto1.getPhoto()).PixelWidth * pp)));
                    LSF            = SilverlightLFC.common.Environment.getDoubleList <decimal>(ptp.getDdx(EdgeBrightList));

                    al = ptp.getCurveMTF(lChartPhoto1.Photo, true, pp);
                }
                edg.DrawLines(EdgeBrightList);
                ldg.DrawLines(LSF);


                sdg.DrawLines(al);
            }
            catch (Exception xe)        //未知的异常
            {
                if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛
                {
                    SilverlightLFC.common.Environment.ShowMessage(xe.Message);
                }
                else
                {
                    SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片");
                }
            }
        }