Example #1
0
        void ProcPhoto_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            Image im = LChartPhoto.getImage();

            im.PointerPressed -= ProcPhoto_PointerPressed;
            if (LChartPhoto.getPhoto() == null)
            {
                return;
            }
            Canvas dc = LChartPhoto.getDrawObjectCanvas();

            if (!dc.Children.Contains(selectLine))
            {
                dc.Children.Add(selectLine);
            }
            Point p  = e.GetCurrentPoint(im).Position;
            Point?ip = xt.PointToPix(LChartPhoto.getPhoto(), LChartPhoto.getDrawObjectCanvas(), p, false);

            if (ip == null)
            {
                return;
            }
            selectLine.X1                = selectLine.X2 = p.X;
            selectLine.Y1                = 0;
            selectLine.Y2                = LChartPhoto.getDrawObjectCanvas().ActualHeight;
            selectLine.Stroke            = new SolidColorBrush(Colors.Blue);
            selectLine.StrokeThickness   = 3;
            textBlockSelectPosition.Text = ip.Value.X.ToString();
            ToolTipService.SetToolTip(textBlockSelectPosition, "总宽像素:" + LChartPhoto.getPhoto().PixelWidth.ToString());
        }
Example #2
0
 public void setTarget(LChartPhoto pc)//
 {
     Target = pc;
     //si = img;
     Target.PointerPressed  += img_PointerPressed;
     Target.PointerReleased += img_PointerReleased;
 }
Example #3
0
 public void Test(WriteableBitmap b)
 {
     if (b == null)
     {
         return;
     }
     LChartPhoto.setPhoto(b);
     TestImage();
 }
Example #4
0
 public void Init(AbstractTestChart Chart, LChartPhoto tlc)
 {
     if (Chart.ChartName != "XMark Chart")
     {
         buttonCrop.IsEnabled = false;
     }
     lc = tlc;
     o  = Chart;
 }
Example #5
0
        void TestImage()
        {
            WriteableBitmap b = LChartPhoto.getPhoto();

            if (b == null)
            {
                SilverlightLFC.common.Environment.ShowMessage("没有要测试的照片"); return;
            }
            decimal d = 0m;

            try
            {
                d = xt.getAberration(b);
            }
            catch (Exception xe)        //未知的异常
            {
                if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛
                {
                    SilverlightLFC.common.Environment.ShowMessage(xe.Message);
                }
                else
                {
                    SilverlightLFC.common.Environment.ShowMessage("广角端畸变测试错误");
                }
            }
            try{
                double leftCirclePoint  = Convert.ToDouble(xt.ProcessInfor["AberrationLCP"]);
                double rightCirclePoint = Convert.ToDouble(xt.ProcessInfor["AberrationRCP"]);
                double lv = Convert.ToDouble(xt.ProcessInfor["AberrationLVP"]);
                double rv = Convert.ToDouble(xt.ProcessInfor["AberrationRVP"]);
                leftCirclePoint  = leftCirclePoint / b.PixelWidth;
                rightCirclePoint = rightCirclePoint / b.PixelWidth;
                lv = lv / b.PixelWidth;
                rv = rv / b.PixelWidth;

                dg.DrawLine(leftCirclePoint * LChartPhoto.Width, 0, leftCirclePoint * LChartPhoto.Width, LChartPhoto.Height, false, 3, new SolidColorBrush(Colors.Green));
                dg.DrawLine(rightCirclePoint * LChartPhoto.Width, 0, rightCirclePoint * LChartPhoto.Width, LChartPhoto.Height, false, 3, new SolidColorBrush(Colors.Green));
                dg.DrawLine(lv * LChartPhoto.Width, 0, lv * LChartPhoto.Width, LChartPhoto.Height, false, 3, new SolidColorBrush(Colors.Red));
                dg.DrawLine(rv * LChartPhoto.Width, 0, rv * LChartPhoto.Width, LChartPhoto.Height, false, 3, new SolidColorBrush(Colors.Red));

                textBlockAberration.Text   = d.ToString();
                textBlockStandardLong.Text = (rightCirclePoint - leftCirclePoint).ToString();
                textBlockTrueLong.Text     = (rv - lv).ToString();
            }
            catch (Exception xe)        //未知的异常
            {
                if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛
                {
                    SilverlightLFC.common.Environment.ShowMessage(xe.Message);
                }
                else
                {
                    SilverlightLFC.common.Environment.ShowMessage("广角端畸变测试错误");
                }
            }
        }
Example #6
0
        private void buttonClose_Click(object sender, RoutedEventArgs e)
        {
            LChartPhoto.Clear();
            dg = null;
            Panel p = this.Parent as Panel;

            if (p != null)
            {
                p.Children.Remove(this);
            }
        }
Example #7
0
        public Aberration()
        {
            InitializeComponent();
            am = new ActionMove(this, Title);
            //am1 = new ActionMove(PhotoClip, image);
            photoTestToolbar1.setTarget(LChartPhoto);
            photoTestToolbar1.autoTest    = TestImage;
            photoTestToolbar1.addPhoto    = AddPhoto;
            photoTestToolbar1.removePhoto = RemovePhoto;

            dg = new DrawGraphic(LChartPhoto.getDrawObjectCanvas());
        }
Example #8
0
        private void currentBright_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            LChartPhoto     im = sender as LChartPhoto;
            WriteableBitmap b  = im.getPhoto();

            if (b != null)
            {
                Point?p = xt.PointToPix(b, im, e.GetCurrentPoint(im.getImage()).Position, false);
                if (p == null)
                {
                    return;
                }
                DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest();
                Color c = pt.GetPixel(b, Convert.ToInt32(p.Value.X), Convert.ToInt32(p.Value.Y));
                float ph, ps, pb;
                pt.RGB2HSB(Convert.ToInt32(c.R), Convert.ToInt32(c.G), Convert.ToInt32(c.B), out ph, out ps, out pb);
                textBoxCurrentBright.Text = pb.ToString();
            }
        }
Example #9
0
        private void HB_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            LChartPhoto im = sender as LChartPhoto;

            selectedImage = im;

            HB.Active();
            VB.DeActive();
            photoTestToolbar1.setTarget(HB);
            WriteableBitmap b = im.getPhoto();

            if (b != null)
            {
                DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest();
                Point?p = xt.PointToPix(b, im, e.GetCurrentPoint(im).Position, false);
                if (p == null)
                {
                    return;
                }
                dg.DrawBrightLines(pt.getImageGrayHLine(b, Convert.ToInt32(p.Value.Y)));
            }
        }
Example #10
0
 public void setTarget(LChartPhoto l)
 {
     lc = l;
     lynxUpDownXPix.IntValue = l.getPhoto().PixelWidth;
     lynxUpDownYPix.IntValue = l.getPhoto().PixelHeight;
 }
Example #11
0
 public void RemovePhoto(WriteableBitmap photo)
 {
     LChartPhoto.Clear();
 }
Example #12
0
 public void AddPhoto(WriteableBitmap photo)
 {
     LChartPhoto.setPhoto(photo);
 }
Example #13
0
        private void buttonVLSelect_Click(object sender, RoutedEventArgs e)
        {
            Image im = LChartPhoto.getImage();

            im.PointerPressed += ProcPhoto_PointerPressed;
        }
Example #14
0
 public void setTarget(LChartPhoto l)
 {
     lc = l;
 }
Example #15
0
 public void setTarget(LChartPhoto pc)
 {
     p = pc;
 }
Example #16
0
 public void setTarget(LChartPhoto p)
 {
     pc = p;
 }
 public RemoveTestPhoto removePhoto; //给测试组删除照片
 public void setTarget(LChartPhoto ChartStructure)
 {
     lcp = ChartStructure;
 }
 public void setTarget(LChartPhoto pc)//设置提取信息的目标
 {
     Target = pc;
 }