123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- using OTSCLRINTERFACE;
- using OTSDataType;
- using OTSMeasureApp._0_OTSModel.OTSDataType;
- using OTSModelSharp.ServiceCenter;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace OTSMeasureApp._5_OTSMeasureStatuImageFun
- {
- public partial class SlopFocus : Form
- {
- ISemController cfun;
- CSlopFocusParam slopFocusParam;
- bool m_result=false;
- OTSSamplespaceWindow oTSSamplespaceWindow;
- public bool result {get => m_result; set => m_result = value; }
- //国际化
- OTSCommon.Language lan;
- Hashtable table;
- public SlopFocus(OTSSamplespaceWindow a_oTSSamplespaceWindow)
- {
- InitializeComponent();
- oTSSamplespaceWindow = a_oTSSamplespaceWindow;
- //国际化
- lan = new OTSCommon.Language(this);
- table = lan.GetNameTable(this.Name);
- }
- public CSlopFocusParam GetCSlopFocusParam()
- {
- return slopFocusParam;
- }
- private void bn_OK_Click(object sender, EventArgs e)
- {
- double iPX1, iPY1, iPX2, iPY2, iPX3,iPY3;
- iPX1 = iPY1 = iPX2 = iPY2 = iPX3=iPY3 = 0;
- double dPW1, dPW2, dPW3;
- dPW1 = dPW2 = dPW3 = 0;
- if(!double.TryParse(tB_FirstPointX.Text,out iPX1)|| !double.TryParse(tB_FirstPointY.Text, out iPY1) || !double.TryParse(tB_SecondPointX.Text, out iPX2) || !double.TryParse(tB_SecondPointY.Text, out iPY2) || !double.TryParse(tB_ThirdPointX.Text, out iPX3) || !double.TryParse(tB_ThirdPointY.Text, out iPY3) || !double.TryParse(tB_FirstPointD.Text, out dPW1) || !double.TryParse(tB_SecondPointD.Text, out dPW2) || !double.TryParse(tB_ThirdPointD.Text, out dPW3))
- {
- MessageBox.Show("Please check Params!");
- return;
- }
- if((tB_FirstPointX.Text== tB_SecondPointX.Text&& tB_FirstPointY.Text== tB_SecondPointY.Text)||(tB_FirstPointX.Text== tB_ThirdPointX.Text&& tB_FirstPointY.Text== tB_ThirdPointY.Text)||(tB_SecondPointX.Text== tB_ThirdPointX.Text&& tB_SecondPointY.Text== tB_ThirdPointY.Text))
- {
- MessageBox.Show("Please select different points!");
- return;
- }
- if(slopFocusParam==null)
- {
- slopFocusParam = new CSlopFocusParam();
- }
- slopFocusParam.IsUsingSlopParam = cB_enable.Checked;
- slopFocusParam.FirstPoint = new Point((int)iPX1, (int)iPY1);
- slopFocusParam.FirstWD = dPW1;
- slopFocusParam.SecondPoint = new Point((int)iPX2, (int)iPY2);
- slopFocusParam.SecondWD = dPW2;
- slopFocusParam.ThirdPoint = new Point((int)iPX3, (int)iPY3);
- slopFocusParam.ThirdWD = dPW3;
- oTSSamplespaceWindow.setSlopFocusParam(this);
- this.Hide();
- }
- private void SlopFocus_Load(object sender, EventArgs e)
- {
- if(cfun==null)
- {
- cfun = SemController.GetSEMController();
- }
- }
- private void bn_FirstPoint_Click(object sender, EventArgs e)
- {
- //double a, b, c;
- //a = b = 20;
- //c = 20;
- //cfun.SetSemPositionXY(a, b, c);
- //cfun.SetSemWorkingDistance(c);
- double Px = 0;
- double Py = 0;
- double Pr = 0;
- if(cfun.GetSemPositionXY(ref Px,ref Py,ref Pr))
- {
- tB_FirstPointX.Text = Px.ToString();
- tB_FirstPointY.Text = Py.ToString();
- }
- double WD = 0;
- if(cfun.GetWorkingDistance(ref WD))
- {
- tB_FirstPointD.Text = WD.ToString();
- }
- }
- private void bn_SecondPoint_Click(object sender, EventArgs e)
- {
- //double a, b, c;
- //a = b = 10;
- //c = 10;
- //cfun.SetSemPositionXY(a, b, c);
- //cfun.SetSemWorkingDistance(c);
- double Px = 0;
- double Py = 0;
- double Pr = 0;
- if (cfun.GetSemPositionXY(ref Px, ref Py, ref Pr))
- {
- tB_SecondPointX.Text = Px.ToString();
- tB_SecondPointY.Text = Py.ToString();
- }
- double WD = 0;
- if (cfun.GetWorkingDistance(ref WD))
- {
- tB_SecondPointD.Text = WD.ToString();
- }
- }
- private void bn_ThirdPoint_Click(object sender, EventArgs e)
- {
- //double a, b, c;
- //a = b = 30;
- //c = 30;
- //cfun.SetSemPositionXY(a, b, c);
- //cfun.SetSemWorkingDistance(c);
- double Px = 0;
- double Py = 0;
- double Pr = 0;
- if (cfun.GetSemPositionXY(ref Px, ref Py, ref Pr))
- {
- tB_ThirdPointX.Text = Px.ToString();
- tB_ThirdPointY.Text = Py.ToString();
- }
- double WD = 0;
- if (cfun.GetWorkingDistance(ref WD))
- {
- tB_ThirdPointD.Text = WD.ToString();
- }
- }
- private void bn_Cancel_Click(object sender, EventArgs e)
- {
- m_result = false;
- this.Hide();
- }
- private void SlopFocus_FormClosing(object sender, FormClosingEventArgs e)
- {
- e.Cancel = true;
- this.Hide();
- }
- }
- }
|