123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- using OTSCLRINTERFACE;
- using OTSDataType;
- using OTSMeasureApp._0_OTSModel.OTSDataType;
- using System;
- 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
- {
- COTSControlFunExport cfun;
- CSlopFocusParam slopFocusParam = new CSlopFocusParam();
- public SlopFocus()
- {
- InitializeComponent();
- }
- public CSlopFocusParam GetCSlopFocusParam()
- {
- return slopFocusParam;
- }
- private void bn_OK_Click(object sender, EventArgs e)
- {
- int iPX1, iPY1, iPX2, iPY2, iPX3,iPY3;
- iPX1 = iPY1 = iPX2 = iPY2 = iPX3=iPY3 = 0;
- double dPW1, dPW2, dPW3;
- dPW1 = dPW2 = dPW3 = 0;
- if(!int.TryParse(tB_FirstPointX.Text,out iPX1)|| !int.TryParse(tB_FirstPointY.Text, out iPY1) || !int.TryParse(tB_SecondPointX.Text, out iPX2) || !int.TryParse(tB_SecondPointY.Text, out iPY2) || !int.TryParse(tB_ThirdPointX.Text, out iPX3) || !int.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;
- }
- slopFocusParam.IsUsingSlopParam = cB_enable.Checked;
- slopFocusParam.FirstPoint = new Point(iPX1, iPY1);
- slopFocusParam.FirstWD = dPW1;
- slopFocusParam.SecondPoint = new Point(iPX2, iPY2);
- slopFocusParam.SecondWD = dPW2;
- slopFocusParam.ThirdPoint = new Point(iPX3, iPY3);
- slopFocusParam.ThirdWD = dPW3;
- this.DialogResult = DialogResult.OK;
- }
- private void SlopFocus_Load(object sender, EventArgs e)
- {
- if(cfun==null)
- {
- cfun = COTSControlFunExport.GetControllerInstance();
- }
- }
- 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.GetSemWorkingDistance(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.GetSemWorkingDistance(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.GetSemWorkingDistance(ref WD))
- {
- tB_ThirdPointD.Text = WD.ToString();
- }
- }
- private void bn_Cancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- }
- }
|