ソースを参照

add missing files

gsp 1 ヶ月 前
コミット
5387aaa12a

+ 439 - 0
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/SEMControlService.cs

@@ -0,0 +1,439 @@
+using System;
+using System.Collections.Generic;
+using OTSCLRINTERFACE;
+using System.Drawing;
+using OTSDataType;
+using OTSModelSharp;
+
+using OTSModelSharp.ServiceCenter;
+using OTSMeasureApp._4_OTSSamplespaceGraphicsPanel;
+
+namespace OTSMeasureApp
+{
+    public class SEMControlService 
+    {
+        #region 全部变量声明
+    
+    
+       
+
+        //电镜设置对象
+        ISemController cSemfun = null;
+        IScanController cScanfun = null;
+        //IEDSController cEDSfun = null;
+      
+ 
+
+        NLog.Logger log ;
+        #endregion
+
+        #region 构造方法
+    
+        public SEMControlService()
+        {
+            log = NLog.LogManager.GetCurrentClassLogger();
+       
+
+        }
+        /// <summary>
+        /// 初始化其他参数
+        /// </summary>
+        public bool InitAndConnection()
+        {
+            try
+            {
+                //控制类对象初始化
+                if (cSemfun == null)
+                {
+                    cSemfun = SemController.GetSEMController();
+                }
+                if (cScanfun == null)
+                {
+                    cScanfun = ScanController.GetScanController();
+                }
+              
+           
+                return cSemfun.Connect();
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex.ToString() );
+                return false;
+            }
+        }
+        #endregion
+
+
+
+    
+
+        #region 获取放大倍数
+        private double GetGMagnification()
+        {
+            try
+            {
+                double a_dMagnification = 0;
+
+                //获取放大倍数
+                bool result = cSemfun.GetMagnification(ref a_dMagnification);
+
+                if (result)
+                {
+
+                    //赋值 显示
+                    return a_dMagnification;
+                }
+                else
+                {
+
+                    //配置结果提示
+                    return 0;
+                }
+            }
+            catch (Exception)
+            {
+                return 0;
+            }
+        }
+        #endregion
+
+        #region 获取工作距离
+        private double GetSemWorkingDistance()
+        {
+            try
+            {
+                double a_WorkingDistance = 0;
+
+                //获取工作距离
+                bool result = cSemfun.GetWorkingDistance(ref a_WorkingDistance);
+
+                if (result)
+                {
+
+                    //赋值 显示
+                    return a_WorkingDistance;
+                }
+                else
+                {
+
+                    //配置结果提示
+                    return 0;
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex.ToString() );
+                return 0;
+            }
+        }
+        private double GetSemBrightness()
+        {
+            try
+            {
+                double brightness = 0;
+
+                //获取工作距离
+                bool result = cSemfun.GetSemBrightness(ref brightness);
+
+                if (result)
+                {
+
+                    //赋值 显示
+                    return brightness;
+                }
+                else
+                {
+
+                    //配置结果提示
+                    return 0;
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex.ToString());
+                return 0;
+            }
+        }
+        private double GetSemContrast()
+        {
+            try
+            {
+                double contrast = 0;
+
+                //获取工作距离
+                bool result = cSemfun.GetSemContrast(ref contrast);
+
+                if (result)
+                {
+
+                    //赋值 显示
+                    return contrast;
+                }
+                else
+                {
+
+                    //配置结果提示
+                    return 0;
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex.ToString());
+                return 0;
+            }
+        }
+        private double GetSemKv()
+        {
+            try
+            {
+                double kv = 0;
+
+                //获取工作距离
+                bool result = cSemfun.GetSemHighTension(ref kv);
+
+                if (result)
+                {
+
+                    //赋值 显示
+                    return kv;
+                }
+                else
+                {
+
+                    //配置结果提示
+                    return 0;
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex.ToString());
+                return 0;
+            }
+        }
+        #endregion
+
+        #region 设置放大倍数
+        public bool SetGMagnification(double a_dMagnification)
+        {
+            try
+            {
+
+                //获取放大倍数
+                bool result = cSemfun.SetMagnification(a_dMagnification);
+
+                return result;
+            }
+            catch (Exception ex)
+            {
+                log.Error( ex.ToString() );
+                return false;
+            }
+        }
+        #endregion
+
+        #region 设置工作距离
+        public bool SetSemWorkingDistance(double a_WorkingDistance)
+        {
+            try
+            {
+
+                bool result = cSemfun.SetWorkingDistance(a_WorkingDistance);
+
+                return result;
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex.ToString() );
+                return false;
+            }
+        }
+        #endregion
+        public bool SetSembrightness(double bri)
+        {
+            try
+            {
+
+                bool result = cSemfun.SetSemBrightness(bri);
+
+                return result;
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex.ToString());
+                return false;
+            }
+        }
+        public bool SetSemContrast(double contra)
+        {
+            try
+            {
+
+                bool result = cSemfun.SetSemContrast(contra);
+
+                return result;
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex.ToString());
+                return false;
+            }
+        }
+        public bool SetSemHT(double ht)
+        {
+            try
+            {
+
+                bool result = cSemfun.SetSemHighTension(ht);
+
+                return result;
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex.ToString());
+                return false;
+            }
+        }
+
+
+        #region 获取电镜参数 放大倍数与工作距离
+        public List<double> GetSEMMagAndWDParameter()
+        {
+            List<double> semParameter = new List<double>();
+            //放大倍数
+            double magnification = GetGMagnification();
+            //工作距离
+            double semWorkingDistance = GetSemWorkingDistance();
+
+            double bri = GetSemBrightness();
+            double contra=GetSemContrast();
+            double kv=GetSemKv();   
+            //添加 放大倍数、工作距离
+            semParameter.Add(magnification);
+            semParameter.Add(semWorkingDistance);
+            semParameter.Add(bri);
+            semParameter.Add(contra);
+            semParameter.Add(kv);
+            return semParameter;
+        }
+        #endregion
+
+  
+
+
+
+        #region 驱动SEM到当前位置
+        public bool SetSEMCurrentLocation( Point mousePoint, CVisualStage stage)
+        {
+            try
+            {
+             
+                if (!stage.IfMouseInStage(mousePoint))
+                {
+                    //获取在范围中的样品
+                    return false;
+                   
+                }
+              
+                //判断是否鼠标在样品台范围中
+                Point OTSLocation = new Point();
+              
+                //鼠标在样品台中移动获取坐标
+                OTSLocation = stage.GetMouseOTSLocation(mousePoint);
+
+
+
+                PointF SEMPoint=new PointF(0,0);
+                 stage.m_SEMStageData.ConvertOTSToSEMCoord(OTSLocation,ref SEMPoint);
+
+               
+                bool result = cSemfun.MoveSEMToPoint(SEMPoint.X, SEMPoint.Y);
+               
+                    return result;
+               
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex.ToString());
+                return false;
+            }
+        }
+        #endregion
+
+        #region 驱动SEM到中心位置
+        public bool DriveSEMToLocation(Point mousePoint,CVisualStage stage, List<CVisualFieldGDIObject> m_MeasureFieldGDIObjects)
+        {
+            try
+            {
+               
+               
+                if (!stage.IfMouseInStage(mousePoint))
+                {
+                    return false;
+                }
+              
+                //判断是否鼠标在样品台范围中
+                Point OTSLocation = new Point();
+             
+                //鼠标在样品台中移动获取坐标
+                OTSLocation = stage.GetMouseOTSLocation(mousePoint);
+                PointF SEMPoint = new PointF(0, 0);
+                    stage.m_SEMStageData.ConvertOTSToSEMCoord(OTSLocation,ref SEMPoint);
+                //循环single中所有对象 进行位置匹配
+                for (int i = 0; i < m_MeasureFieldGDIObjects.Count; i++)
+                {
+                    if (m_MeasureFieldGDIObjects[i].GetZoomedRegion.Contains(mousePoint))
+                    {
+                        //获取帧图左上坐标
+                        Point LT = new Point((int)m_MeasureFieldGDIObjects[i].GetZoomedRegionF().Left, (int)m_MeasureFieldGDIObjects[i].GetZoomedRegionF().Top);
+                        PointF lTLocation = stage.GetMouseOTSLocation(LT);
+                        //lTLocation =
+                            stage.m_SEMStageData.ConvertOTSToSEMCoord(lTLocation,ref lTLocation);
+                        //获取帧图右下坐标
+                        Point RB = new Point((int)m_MeasureFieldGDIObjects[i].GetZoomedRegionF().Right, (int)m_MeasureFieldGDIObjects[i].GetZoomedRegionF().Bottom);
+                        PointF rbLocation = stage.GetMouseOTSLocation(RB);
+                        stage.m_SEMStageData.ConvertOTSToSEMCoord(rbLocation, ref rbLocation);
+
+                        float  diffX = Math.Abs(rbLocation.X - lTLocation.X) / 2;
+                        float  diffY = Math.Abs(rbLocation.Y - lTLocation.Y) / 2;
+                        //移动至帧图中心位置 
+                        float  moveCenterX = lTLocation.X - diffX;
+                        float  moveCenterY = lTLocation.Y + diffY;
+                        bool result = cSemfun.MoveSEMToPoint(moveCenterX, moveCenterY);
+                        if (result)
+                        {
+                            return result;
+                        }
+                    }
+                }
+               
+                return false;
+        }
+            catch (Exception)
+            {
+                return false;
+            }
+        }
+        #endregion
+
+        #region 获取SEM位置
+        public bool GetSemLocation(ref List<double> SemLocation)
+        {
+            //获取SEM位置 a_dPositionX:X轴 a_dPositionY:Z轴 a_dPositionR:角度
+            double a_dPositionX = 0;
+            double a_dPositionY = 0;
+            double a_dPositionR = 0;
+            if (cSemfun != null)
+            {
+                if (cSemfun.GetSemPositionXY(ref a_dPositionX, ref a_dPositionY, ref a_dPositionR))
+                {
+                    SemLocation.Add(a_dPositionX);
+                    SemLocation.Add(a_dPositionY);
+                    SemLocation.Add(a_dPositionR);
+                    return true;
+                }
+            }
+            return false;
+        }
+        #endregion
+    }
+}

+ 417 - 0
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/SlopFocus.Designer.cs

@@ -0,0 +1,417 @@
+
+namespace OTSMeasureApp 
+{
+    partial class SlopFocus
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.cB_enable = new System.Windows.Forms.CheckBox();
+            this.label2 = new System.Windows.Forms.Label();
+            this.tB_FirstPointX = new System.Windows.Forms.TextBox();
+            this.label3 = new System.Windows.Forms.Label();
+            this.tB_FirstPointY = new System.Windows.Forms.TextBox();
+            this.bn_FirstPoint = new System.Windows.Forms.Button();
+            this.bn_SecondPoint = new System.Windows.Forms.Button();
+            this.tB_SecondPointY = new System.Windows.Forms.TextBox();
+            this.label4 = new System.Windows.Forms.Label();
+            this.tB_SecondPointX = new System.Windows.Forms.TextBox();
+            this.label5 = new System.Windows.Forms.Label();
+            this.bn_ThirdPoint = new System.Windows.Forms.Button();
+            this.tB_ThirdPointY = new System.Windows.Forms.TextBox();
+            this.label7 = new System.Windows.Forms.Label();
+            this.tB_ThirdPointX = new System.Windows.Forms.TextBox();
+            this.label9 = new System.Windows.Forms.Label();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.tB_FirstPointD = new System.Windows.Forms.TextBox();
+            this.label8 = new System.Windows.Forms.Label();
+            this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.tB_SecondPointD = new System.Windows.Forms.TextBox();
+            this.label6 = new System.Windows.Forms.Label();
+            this.groupBox3 = new System.Windows.Forms.GroupBox();
+            this.tB_ThirdPointD = new System.Windows.Forms.TextBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.bn_OK = new System.Windows.Forms.Button();
+            this.bn_Cancel = new System.Windows.Forms.Button();
+            this.groupBox1.SuspendLayout();
+            this.groupBox2.SuspendLayout();
+            this.groupBox3.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // cB_enable
+            // 
+            this.cB_enable.AutoSize = true;
+            this.cB_enable.Location = new System.Drawing.Point(11, 12);
+            this.cB_enable.Margin = new System.Windows.Forms.Padding(2);
+            this.cB_enable.Name = "cB_enable";
+            this.cB_enable.Size = new System.Drawing.Size(126, 16);
+            this.cB_enable.TabIndex = 0;
+            this.cB_enable.Text = "Whether to enable";
+            this.cB_enable.UseVisualStyleBackColor = true;
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(24, 32);
+            this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(17, 12);
+            this.label2.TabIndex = 2;
+            this.label2.Text = "X:";
+            // 
+            // tB_FirstPointX
+            // 
+            this.tB_FirstPointX.Location = new System.Drawing.Point(51, 30);
+            this.tB_FirstPointX.Margin = new System.Windows.Forms.Padding(2);
+            this.tB_FirstPointX.Name = "tB_FirstPointX";
+            this.tB_FirstPointX.ReadOnly = true;
+            this.tB_FirstPointX.Size = new System.Drawing.Size(76, 21);
+            this.tB_FirstPointX.TabIndex = 3;
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(147, 32);
+            this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(17, 12);
+            this.label3.TabIndex = 4;
+            this.label3.Text = "Y:";
+            // 
+            // tB_FirstPointY
+            // 
+            this.tB_FirstPointY.Location = new System.Drawing.Point(174, 30);
+            this.tB_FirstPointY.Margin = new System.Windows.Forms.Padding(2);
+            this.tB_FirstPointY.Name = "tB_FirstPointY";
+            this.tB_FirstPointY.ReadOnly = true;
+            this.tB_FirstPointY.Size = new System.Drawing.Size(76, 21);
+            this.tB_FirstPointY.TabIndex = 5;
+            // 
+            // bn_FirstPoint
+            // 
+            this.bn_FirstPoint.Location = new System.Drawing.Point(485, 30);
+            this.bn_FirstPoint.Margin = new System.Windows.Forms.Padding(2);
+            this.bn_FirstPoint.Name = "bn_FirstPoint";
+            this.bn_FirstPoint.Size = new System.Drawing.Size(72, 20);
+            this.bn_FirstPoint.TabIndex = 6;
+            this.bn_FirstPoint.Text = "obtain";
+            this.bn_FirstPoint.UseVisualStyleBackColor = true;
+            this.bn_FirstPoint.Click += new System.EventHandler(this.bn_FirstPoint_Click);
+            // 
+            // bn_SecondPoint
+            // 
+            this.bn_SecondPoint.Location = new System.Drawing.Point(485, 28);
+            this.bn_SecondPoint.Margin = new System.Windows.Forms.Padding(2);
+            this.bn_SecondPoint.Name = "bn_SecondPoint";
+            this.bn_SecondPoint.Size = new System.Drawing.Size(72, 20);
+            this.bn_SecondPoint.TabIndex = 12;
+            this.bn_SecondPoint.Text = "obtain";
+            this.bn_SecondPoint.UseVisualStyleBackColor = true;
+            this.bn_SecondPoint.Click += new System.EventHandler(this.bn_SecondPoint_Click);
+            // 
+            // tB_SecondPointY
+            // 
+            this.tB_SecondPointY.Location = new System.Drawing.Point(174, 30);
+            this.tB_SecondPointY.Margin = new System.Windows.Forms.Padding(2);
+            this.tB_SecondPointY.Name = "tB_SecondPointY";
+            this.tB_SecondPointY.ReadOnly = true;
+            this.tB_SecondPointY.Size = new System.Drawing.Size(76, 21);
+            this.tB_SecondPointY.TabIndex = 11;
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Location = new System.Drawing.Point(147, 34);
+            this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(17, 12);
+            this.label4.TabIndex = 10;
+            this.label4.Text = "Y:";
+            // 
+            // tB_SecondPointX
+            // 
+            this.tB_SecondPointX.Location = new System.Drawing.Point(51, 30);
+            this.tB_SecondPointX.Margin = new System.Windows.Forms.Padding(2);
+            this.tB_SecondPointX.Name = "tB_SecondPointX";
+            this.tB_SecondPointX.ReadOnly = true;
+            this.tB_SecondPointX.Size = new System.Drawing.Size(76, 21);
+            this.tB_SecondPointX.TabIndex = 9;
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Location = new System.Drawing.Point(24, 34);
+            this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(17, 12);
+            this.label5.TabIndex = 8;
+            this.label5.Text = "X:";
+            // 
+            // bn_ThirdPoint
+            // 
+            this.bn_ThirdPoint.Location = new System.Drawing.Point(485, 30);
+            this.bn_ThirdPoint.Margin = new System.Windows.Forms.Padding(2);
+            this.bn_ThirdPoint.Name = "bn_ThirdPoint";
+            this.bn_ThirdPoint.Size = new System.Drawing.Size(72, 20);
+            this.bn_ThirdPoint.TabIndex = 18;
+            this.bn_ThirdPoint.Text = "obtain";
+            this.bn_ThirdPoint.UseVisualStyleBackColor = true;
+            this.bn_ThirdPoint.Click += new System.EventHandler(this.bn_ThirdPoint_Click);
+            // 
+            // tB_ThirdPointY
+            // 
+            this.tB_ThirdPointY.Location = new System.Drawing.Point(174, 30);
+            this.tB_ThirdPointY.Margin = new System.Windows.Forms.Padding(2);
+            this.tB_ThirdPointY.Name = "tB_ThirdPointY";
+            this.tB_ThirdPointY.ReadOnly = true;
+            this.tB_ThirdPointY.Size = new System.Drawing.Size(76, 21);
+            this.tB_ThirdPointY.TabIndex = 17;
+            // 
+            // label7
+            // 
+            this.label7.AutoSize = true;
+            this.label7.Location = new System.Drawing.Point(147, 32);
+            this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(17, 12);
+            this.label7.TabIndex = 16;
+            this.label7.Text = "Y:";
+            // 
+            // tB_ThirdPointX
+            // 
+            this.tB_ThirdPointX.Location = new System.Drawing.Point(51, 30);
+            this.tB_ThirdPointX.Margin = new System.Windows.Forms.Padding(2);
+            this.tB_ThirdPointX.Name = "tB_ThirdPointX";
+            this.tB_ThirdPointX.ReadOnly = true;
+            this.tB_ThirdPointX.Size = new System.Drawing.Size(76, 21);
+            this.tB_ThirdPointX.TabIndex = 15;
+            // 
+            // label9
+            // 
+            this.label9.AutoSize = true;
+            this.label9.Location = new System.Drawing.Point(24, 32);
+            this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label9.Name = "label9";
+            this.label9.Size = new System.Drawing.Size(17, 12);
+            this.label9.TabIndex = 13;
+            this.label9.Text = "X:";
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.tB_FirstPointD);
+            this.groupBox1.Controls.Add(this.label8);
+            this.groupBox1.Controls.Add(this.bn_FirstPoint);
+            this.groupBox1.Controls.Add(this.label2);
+            this.groupBox1.Controls.Add(this.tB_FirstPointX);
+            this.groupBox1.Controls.Add(this.label3);
+            this.groupBox1.Controls.Add(this.tB_FirstPointY);
+            this.groupBox1.Location = new System.Drawing.Point(11, 47);
+            this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
+            this.groupBox1.Size = new System.Drawing.Size(562, 71);
+            this.groupBox1.TabIndex = 19;
+            this.groupBox1.TabStop = false;
+            this.groupBox1.Text = "FirstPoint";
+            // 
+            // tB_FirstPointD
+            // 
+            this.tB_FirstPointD.Location = new System.Drawing.Point(378, 30);
+            this.tB_FirstPointD.Margin = new System.Windows.Forms.Padding(2);
+            this.tB_FirstPointD.Name = "tB_FirstPointD";
+            this.tB_FirstPointD.ReadOnly = true;
+            this.tB_FirstPointD.Size = new System.Drawing.Size(83, 21);
+            this.tB_FirstPointD.TabIndex = 8;
+            // 
+            // label8
+            // 
+            this.label8.AutoSize = true;
+            this.label8.Location = new System.Drawing.Point(301, 32);
+            this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label8.Name = "label8";
+            this.label8.Size = new System.Drawing.Size(59, 12);
+            this.label8.TabIndex = 7;
+            this.label8.Text = "Distance:";
+            // 
+            // groupBox2
+            // 
+            this.groupBox2.Controls.Add(this.tB_SecondPointD);
+            this.groupBox2.Controls.Add(this.label6);
+            this.groupBox2.Controls.Add(this.tB_SecondPointY);
+            this.groupBox2.Controls.Add(this.label5);
+            this.groupBox2.Controls.Add(this.tB_SecondPointX);
+            this.groupBox2.Controls.Add(this.label4);
+            this.groupBox2.Controls.Add(this.bn_SecondPoint);
+            this.groupBox2.Location = new System.Drawing.Point(11, 145);
+            this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox2.Name = "groupBox2";
+            this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
+            this.groupBox2.Size = new System.Drawing.Size(562, 76);
+            this.groupBox2.TabIndex = 7;
+            this.groupBox2.TabStop = false;
+            this.groupBox2.Text = "SecondPoint";
+            // 
+            // tB_SecondPointD
+            // 
+            this.tB_SecondPointD.Location = new System.Drawing.Point(378, 30);
+            this.tB_SecondPointD.Margin = new System.Windows.Forms.Padding(2);
+            this.tB_SecondPointD.Name = "tB_SecondPointD";
+            this.tB_SecondPointD.ReadOnly = true;
+            this.tB_SecondPointD.Size = new System.Drawing.Size(76, 21);
+            this.tB_SecondPointD.TabIndex = 23;
+            // 
+            // label6
+            // 
+            this.label6.AutoSize = true;
+            this.label6.Location = new System.Drawing.Point(301, 34);
+            this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(59, 12);
+            this.label6.TabIndex = 22;
+            this.label6.Text = "Distance:";
+            // 
+            // groupBox3
+            // 
+            this.groupBox3.Controls.Add(this.tB_ThirdPointD);
+            this.groupBox3.Controls.Add(this.label1);
+            this.groupBox3.Controls.Add(this.bn_ThirdPoint);
+            this.groupBox3.Controls.Add(this.label9);
+            this.groupBox3.Controls.Add(this.tB_ThirdPointX);
+            this.groupBox3.Controls.Add(this.tB_ThirdPointY);
+            this.groupBox3.Controls.Add(this.label7);
+            this.groupBox3.Location = new System.Drawing.Point(11, 250);
+            this.groupBox3.Margin = new System.Windows.Forms.Padding(2);
+            this.groupBox3.Name = "groupBox3";
+            this.groupBox3.Padding = new System.Windows.Forms.Padding(2);
+            this.groupBox3.Size = new System.Drawing.Size(562, 74);
+            this.groupBox3.TabIndex = 13;
+            this.groupBox3.TabStop = false;
+            this.groupBox3.Text = "ThirdPoint";
+            // 
+            // tB_ThirdPointD
+            // 
+            this.tB_ThirdPointD.Location = new System.Drawing.Point(378, 30);
+            this.tB_ThirdPointD.Margin = new System.Windows.Forms.Padding(2);
+            this.tB_ThirdPointD.Name = "tB_ThirdPointD";
+            this.tB_ThirdPointD.ReadOnly = true;
+            this.tB_ThirdPointD.Size = new System.Drawing.Size(76, 21);
+            this.tB_ThirdPointD.TabIndex = 22;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(301, 32);
+            this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(65, 12);
+            this.label1.TabIndex = 21;
+            this.label1.Text = "DiStance:";
+            // 
+            // bn_OK
+            // 
+            this.bn_OK.Location = new System.Drawing.Point(399, 340);
+            this.bn_OK.Margin = new System.Windows.Forms.Padding(2);
+            this.bn_OK.Name = "bn_OK";
+            this.bn_OK.Size = new System.Drawing.Size(73, 26);
+            this.bn_OK.TabIndex = 20;
+            this.bn_OK.Text = "OK";
+            this.bn_OK.UseVisualStyleBackColor = true;
+            this.bn_OK.Click += new System.EventHandler(this.bn_OK_Click);
+            // 
+            // bn_Cancel
+            // 
+            this.bn_Cancel.Location = new System.Drawing.Point(496, 340);
+            this.bn_Cancel.Margin = new System.Windows.Forms.Padding(2);
+            this.bn_Cancel.Name = "bn_Cancel";
+            this.bn_Cancel.Size = new System.Drawing.Size(68, 26);
+            this.bn_Cancel.TabIndex = 21;
+            this.bn_Cancel.Text = "Cancel";
+            this.bn_Cancel.UseVisualStyleBackColor = true;
+            this.bn_Cancel.Click += new System.EventHandler(this.bn_Cancel_Click);
+            // 
+            // SlopFocus
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(580, 391);
+            this.Controls.Add(this.bn_Cancel);
+            this.Controls.Add(this.bn_OK);
+            this.Controls.Add(this.groupBox3);
+            this.Controls.Add(this.groupBox2);
+            this.Controls.Add(this.groupBox1);
+            this.Controls.Add(this.cB_enable);
+            this.Margin = new System.Windows.Forms.Padding(2);
+            this.MaximizeBox = false;
+            this.MaximumSize = new System.Drawing.Size(596, 430);
+            this.MinimumSize = new System.Drawing.Size(596, 430);
+            this.Name = "SlopFocus";
+            this.ShowIcon = false;
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "SlopFocus";
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SlopFocus_FormClosing);
+            this.Load += new System.EventHandler(this.SlopFocus_Load);
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox1.PerformLayout();
+            this.groupBox2.ResumeLayout(false);
+            this.groupBox2.PerformLayout();
+            this.groupBox3.ResumeLayout(false);
+            this.groupBox3.PerformLayout();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.CheckBox cB_enable;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.TextBox tB_FirstPointX;
+        private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.TextBox tB_FirstPointY;
+        private System.Windows.Forms.Button bn_FirstPoint;
+        private System.Windows.Forms.Button bn_SecondPoint;
+        private System.Windows.Forms.TextBox tB_SecondPointY;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.TextBox tB_SecondPointX;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.Button bn_ThirdPoint;
+        private System.Windows.Forms.TextBox tB_ThirdPointY;
+        private System.Windows.Forms.Label label7;
+        private System.Windows.Forms.TextBox tB_ThirdPointX;
+        private System.Windows.Forms.Label label9;
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.GroupBox groupBox2;
+        private System.Windows.Forms.GroupBox groupBox3;
+        private System.Windows.Forms.Button bn_OK;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.Label label6;
+        private System.Windows.Forms.TextBox tB_FirstPointD;
+        private System.Windows.Forms.Label label8;
+        private System.Windows.Forms.TextBox tB_SecondPointD;
+        private System.Windows.Forms.TextBox tB_ThirdPointD;
+        private System.Windows.Forms.Button bn_Cancel;
+    }
+}

+ 161 - 0
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/SlopFocus.cs

@@ -0,0 +1,161 @@
+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
+{
+    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();
+        }
+    }
+}

+ 120 - 0
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/SlopFocus.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>