//private void buttonOpen_Click(object sender, RoutedEventArgs e) //{ // OpenFileDialog of = new OpenFileDialog(); // of.ShowDialog(); // if (of.File == null) { return; } // if (!of.File.Exists) // { // return; // } // Stream s = of.File.OpenRead(); // BitmapImage bi = new BitmapImage(); // bi.SetSource(s); // //ProcPhoto=new WriteableBitmap(bi); // //SourcePhoto = new WriteableBitmap(bi); // ChartPhoto.setPhoto(new WriteableBitmap(bi)); //} //private void CorrectRotate_Click(object sender, RoutedEventArgs e) //{ // ChartPhoto.setPhoto( t.mp.CorrectRotatePhoto); //} //private void CorrectScale_Click(object sender, RoutedEventArgs e) //{ // ChartPhoto.setPhoto (t.mp.CorrectScalePhoto); //} //private void select_Click(object sender, RoutedEventArgs e) //{ // ChartPhoto.setPhoto (t.mp.SelectedPhoto); //} //private void buttonEdit_Click(object sender, RoutedEventArgs e) //{ // //ImageEdit ie = new ImageEdit(ChartPhoto.getChart()); // //CameraTestDesktop.getDesktopPanel().Children.Add(ie); //} //public string getName() //{ // throw new NotImplementedException(); //} //public string getMemo() //{ // throw new NotImplementedException(); //} //public string getDimension() //{ // throw new NotImplementedException(); //} //public double getValue() //{ // throw new NotImplementedException(); //} //public double getScore() //{ // throw new NotImplementedException(); //} //public string getReport() //{ // throw new NotImplementedException(); //} //public List<IParameter> getSubParameter() //{ // throw new NotImplementedException(); //} //public double getProcess() //{ // throw new NotImplementedException(); //} //public ParameterState getState() //{ // throw new NotImplementedException(); //} //private void buttonTest_Click(object sender, RoutedEventArgs e) //{ // autoTest(); //} //private void buttonCopy_Click(object sender, RoutedEventArgs e) //{ // CameraTestDesktop d = CameraTestDesktop.getDesktop(); // d.addClip(ChartPhoto.getPhoto()); //} //private void buttonPaste_Click(object sender, RoutedEventArgs e) //{ // CameraTestDesktop d = CameraTestDesktop.getDesktop(); // ChartPhoto.setPhoto (d.getClip()); //} void CloseWindow() { testHelper.Clear(); //SourcePhoto = null; //image.Source = null; ChartPhoto.setPhoto(null); Panel p = this.Parent as Panel; if (p != null) { p.Children.Remove(this); } CameraTestDesktop cd = CameraTestDesktop.getDesktop(); if (cd.TaskList.Children.Contains(ci)) { cd.TaskList.Children.Remove(ci); } }
void RL_PointerMoved(object sender, PointerRoutedEventArgs e) { if (RL == null) { RL = new Line(); RL.Stroke = new SolidColorBrush(Colors.Green); RL.StrokeThickness = 2; } Canvas c = ChartPhoto.getDrawObjectCanvas(); if (!c.Children.Contains(RL)) { c.Children.Add(RL); RL.Stroke = new SolidColorBrush(Colors.Green); RL.StrokeThickness = 2; } RL.Y1 = 0; RL.Y2 = c.Height; RL.X1 = RL.X2 = e.GetPosition(c).X; }
void c_PointerPressed(object sender, PointerRoutedEventArgs e) { Canvas c = sender as Canvas; try { canvasLatitude.Children.Clear(); double h = e.GetCurrentPoint(ChartPhoto.getDrawObjectCanvas()).Position.Y / ChartPhoto.getImage().Height *ChartPhoto.getPhoto().PixelHeight; textBlockHeight.Text = Convert.ToInt32(h).ToString(); textBlockInteractively.Text = (testHelper.CurrentChart as KDGrayChart).getLatitude(Convert.ToInt32(h), lynxUpDown1.IntValue).ToString(); List <double> dl = (testHelper.CurrentChart as KDGrayChart).getHLine(Convert.ToInt32(h)); DrawGraphic dg = new DrawGraphic(canvasLatitude); dg.DrawBrightHistogram(dl); buttonInteractiveTest.Foreground = new SolidColorBrush(Colors.Blue); if (c.Children.Contains(tl)) { c.Children.Remove(tl); } } catch (Exception xe) { if (xe is LFCException)//已经是系统约定的错误类型,直接往上抛 { SilverlightLFC.common.Environment.ShowMessage(xe.Message); } else { SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片"); } } finally { c.PointerPressed -= (c_PointerPressed); c.PointerMoved -= (c_PointerMoved); } }
//ISO12233ExChart t=new ISO12233ExChart(); //public void autoTest() //{ // //mark = new MarkProcess(ProcPhoto); // if (ChartPhoto.getChart() == null) { return; } // processbar.Value = 0; // //ResultPanel.Children.Clear(); // Button li; // t.setChart(ChartPhoto.getChart()); // //t.PhotoTestProc += new PhotoTestProcessHandler(t_PhotoTestProc); // t.CorrectISO12233Chart(); // t.BeginAnalyse(); // //t.sendProcEvent(true, ""); // //processbar.Value = 30; // sw.Stop(); // sw.Start(); // long r = t.getLPResoveLines(); // //li = new Button(); // //li.Name = "ResolvingPower"; // buttonRayleiResolution.Content = "分辨率(中央):" + r.ToString() + " LW/PH"; // buttonRayleiResolution.SetValue(ToolTipService.ToolTipProperty, "利用瑞利判据,直观判断相机分辨率,数据表示在一张照片里面可以分辨的垂直线条的数量"); // //li.Click += new RoutedEventHandler(RayleiResolution_Click); // //ResultPanel.Children.Add(li); // //t.sendProcEvent(true, ""); // //processbar.Value = 50; // r = t.getHEdgeResoveLines(); // //li = new Button(); // //li.Name = "HResolvingPower"; // buttonHMTF.Content = "分辨率(水平线):" + r.ToString() + " LW/PH"; // buttonHMTF.SetValue(ToolTipService.ToolTipProperty, "利用水平线条测试分辨率,接近相机的中心分辨率,数据表示在一张照片里面可以分辨的垂直线条的数量"); // //li.Click += new RoutedEventHandler(HMTF_Click); // //ResultPanel.Children.Add(li); // //t.sendProcEvent(true, ""); // //processbar.Value = 60; // r = t.getVEdgeResoveLines(); // //li = new Button(); // //li.Name = "VResolvingPower"; // buttonVMTF.Content = "分辨率(垂直线):" + r.ToString() + " LW/PH"; // buttonVMTF.SetValue(ToolTipService.ToolTipProperty, "利用垂直线条测试分辨率,接近相机的边沿分辨率,数据表示在一张照片里面可以分辨的垂直线条的数量"); // //li.Click += new RoutedEventHandler(VMTF_Click); // //ResultPanel.Children.Add(li); // //t.sendProcEvent(true, ""); // //processbar.Value = 70; // //li = new Button(); // decimal d = t.getHDispersiveness(); // //li.Name = "HDispersiveness"; // buttonHDispersiveness.Content = "色散(水平线):" + d.ToString() + " pxl"; // buttonHDispersiveness.SetValue(ToolTipService.ToolTipProperty, "利用水平线条测试,接近中央色散程度,数据表示红绿蓝三原色在边界分离的程度,无色散时为0"); // //li.Click += new RoutedEventHandler(VDispersiveness_Click); // //ResultPanel.Children.Add(li); // //t.sendProcEvent(true, ""); // //processbar.Value = 85; // //li = new Button(); // d = t.getVDispersiveness(); // //li.Name = "VDispersiveness"; // buttonVDispersiveness.Content = "色散(垂直线):" + d.ToString() + " pxl"; // buttonVDispersiveness.SetValue(ToolTipService.ToolTipProperty, "利用垂直线条测试,接近边沿色散程度,数据表示红绿蓝三原色在边界分离的程度,无色散时为0"); // //li.Click += new RoutedEventHandler(HDispersiveness_Click); // //ResultPanel.Children.Add(li); // //t.sendProcEvent(true, ""); // //processbar.Value = 100; // sw.Stop(); // ResultPanel.SetValue(ToolTipService.ToolTipProperty, "测试共花费" + sw.Interval.Milliseconds.ToString() + "ms"); // IsTested = true; // TestProject.TestHtml.Add(WriteHTML()); //} //double PrcoStep = 100 / 6d; //void t_PhotoTestProc(object sender, PhotoTestProcessEventArgs e) //{ // processbar.Value = processbar.Value + PrcoStep; // if (processbar.Value >= 99.5) // { // testHelper.CurrentChart.PhotoTestProc -= new PhotoTestProcessHandler(t_PhotoTestProc); // } //} void RayleiResolution_Click(object sender, RoutedEventArgs e) { if (!CameraTestDesktop.CanAccess(Version.Professional)) { return; } RayleiResolution pc = new RayleiResolution(); CameraTestDesktop.getDesktopPanel().Children.Add(pc); if (ChartPhoto.IsSelect) { pc.IsLeft = true; pc.Test(ChartPhoto.getSelectArea()); } else { if (testHelper.CurrentChart == null) { SilverlightLFC.common.Environment.ShowMessage("没有选择测试照片做进一步测试"); return; } if (testHelper.CurrentChart.ProcessInfor.ContainsKey("RayleiResolutionIsLeft")) { if (Convert.ToBoolean(testHelper.CurrentChart.ProcessInfor["RayleiResolutionIsLeft"])) { pc.IsLeft = true; pc.Test(testHelper.CurrentChart.mp.SelectedArea["RayleiResolutionLArea"]); } else { pc.IsLeft = false; pc.Test(testHelper.CurrentChart.mp.SelectedArea["RayleiResolutionRArea"]); } } } }
void c_PointerPressed(object sender, PointerRoutedEventArgs e) { Canvas c = sender as Canvas; try { (testHelper.CurrentChart as ITEGrayscaleChart).ConstGradeL = lynxUpDownConstL.DoubleValue; double h = e.GetCurrentPoint(ChartPhoto.getDrawObjectCanvas()).Position.Y / ChartPhoto.getImage().Height *ChartPhoto.getPhoto().PixelHeight; textBlockHeight.Text = Convert.ToInt32(h).ToString(); int v = (testHelper.CurrentChart as ITEGrayscaleChart).getGrayGrade(Convert.ToInt32(h), lynxUpDownH.IntValue, lynxUpDownW.IntValue); textBlockLatitude.Text = v.ToString(); ToolTipService.SetToolTip(textBlockLatitude, "交互测试结果:" + v.ToString()); ShowLatitude(Convert.ToInt32(h)); //List<double> dl = (testHelper.CurrentChart as ITEGrayscaleChart).getHLineAveL(Convert.ToInt32(h),lynxUpDownH.IntValue,lynxUpDownW.IntValue); //canvasLatitude.Children.Clear(); //dg.DrawBrightHistogram(dl); buttonInteractiveTest.Foreground = new SolidColorBrush(Colors.Blue); if (c.Children.Contains(tl)) { c.Children.Remove(tl); } if (v == 11) { ChartTestHelper.setGBSign(true, gridGB); } else { ChartTestHelper.setGBSign(false, gridGB); } } catch (Exception xe) { if (xe is LFCException)//已经是系统约定的错误类型,直接往上抛 { SilverlightLFC.common.Environment.ShowMessage(xe.Message); } else { SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片"); } } finally { c.PointerPressed -= c_PointerPressed; c.PointerMoved -= c_PointerMoved; } }
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 TestGB() { double x = (testHelper.CurrentChart as GrayChart).ptp.getGBBrightChangedValue(ChartPhoto.getPhoto(), lynxUpDownAreaNum.IntValue); textBlockGBValue.Text = x.ToString(); if (checkBoxFocus.IsChecked.Value) { if (x > 0.7) { ChartTestHelper.setGBSign(true, gridGB); } else { ChartTestHelper.setGBSign(false, gridGB); } } else { if (x > 0.5) { ChartTestHelper.setGBSign(true, gridGB); } else { ChartTestHelper.setGBSign(false, gridGB); } } }
void c_PointerPressed(object sender, PointerRoutedEventArgs e) { Canvas c = ChartPhoto.getDrawObjectCanvas(); buttonInterActiveTest.Foreground = new SolidColorBrush(Colors.Blue); c.PointerMoved -= new PointerEventHandler(c_PointerMoved); c.PointerPressed -= new PointerEventHandler(c_PointerPressed); if (!testHelper.TestChartNull()) { return; } ; int ph = Convert.ToInt32(e.GetPosition(ChartPhoto).Y / ChartPhoto.Height * ChartPhoto.getPhoto().PixelHeight); int n = (testHelper.CurrentChart as AberrationChart).getCenterBlackLineNum(); textBlackLength.Text = (testHelper.CurrentChart as AberrationChart).getLineLength(ph, 0, n).ToString(); }