瀏覽代碼

add missing files

GSP 1 月之前
父節點
當前提交
3f26ed2f32
共有 1 個文件被更改,包括 128 次插入0 次删除
  1. 128 0
      OTSIncAReportApp/1-UI/Control_Grids/OTSIncAReportGridsFuncation/SEMAndEDSOperate.cs

+ 128 - 0
OTSIncAReportApp/1-UI/Control_Grids/OTSIncAReportGridsFuncation/SEMAndEDSOperate.cs

@@ -0,0 +1,128 @@
+
+using OTSCLRINTERFACE;
+using OTSCommon.DBOperate.Model;
+
+using OTSIncAReportApp.SysMgrTools;
+using OTSModelSharp.ServiceCenter;
+using ServiceInterface;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+
+namespace OTSIncAReportGrids.OTSIncAReportGridsFuncation
+{
+    public class SEMAndEDSOperate
+    {
+        #region 定义变量
+        //为了加快颗粒列表抠图的速度,这里保存一个全局变量
+        public List<Field> m_list_COTSFieldMgrClr = null;
+        //是否已经连接到了电镜
+        public bool m_SEMConnectionState = false;
+        //连接到电镜的ID号
+        public int m_SEM_ID = 0;
+        public HardwareController m_cfun = null;
+        #endregion
+
+        #region 构造函数
+
+        /// <summary>
+        /// 需传入,主窗体对象,与要获取数据窗体的对象
+        /// </summary>
+        /// <param name="in_frmReportApp"></param>
+        /// <param name="form"></param>
+        public SEMAndEDSOperate()
+        {
+            m_cfun = HardwareController.GetSemController();//  It's better to reinitialize, but it's not good to uninitialize
+        }
+        #endregion
+
+        #region 自定义方法封装
+
+        #endregion
+
+        #region 连接电镜相关
+        /// <summary>
+        /// 连接电镜,颗粒列表使用
+        /// </summary>
+        public bool Connection_ForParticlesGrid()
+        {           
+            if (!m_SEMConnectionState)
+            {
+
+                m_SEMConnectionState = m_cfun.Connect();
+                
+            }
+
+            return m_SEMConnectionState;
+        }
+
+        /// <summary>
+        /// 移动电镜到指定的X,Y坐标上,R坐标使用原先的值进行移动
+        /// </summary>
+        /// <param name="PositionX"></param>
+        /// <param name="PositionY"></param>
+        public bool MoveSemToPointXY_ForParticlesGrid(double in_PositionX, double in_PositionY)
+        {
+            bool isSuccess = false;
+            //首先获取电镜当前的位置,并记录原R值
+            double ls_PositionX = 0;
+            double ls_PositionY = 0;
+            double ls_PositionR = 0;
+
+            if (m_SEMConnectionState)
+            {
+                isSuccess = m_cfun.GetSemPositionXY(ref ls_PositionX, ref ls_PositionY, ref ls_PositionR);
+            }
+           
+
+            if (m_SEMConnectionState)
+            {
+                isSuccess = m_cfun.MoveSEMToPoint(new Point((int)in_PositionX, (int)in_PositionY), ls_PositionR);
+            }
+
+            return isSuccess;
+        }
+
+        /// <summary>
+        /// 设置放大倍数
+        /// </summary>
+        /// <param name="a_dMagnification"></param>
+        /// <returns></returns>
+        public bool SetMagnification(double a_dMagnification)
+        {
+            bool isSuccess = false;
+            if (m_SEMConnectionState)
+            {
+                isSuccess = m_cfun.SetMagnification(a_dMagnification);
+            }
+
+            return isSuccess;
+        }
+
+        public bool AcquireBSEImage(string sampleName, int width, int height, DwellTimeLevel dwellTime, ref byte[] ImageByte)
+        {
+            bool isSuccess = false;
+            if (m_SEMConnectionState)
+            {
+                isSuccess = m_cfun.AcquireBSEImage(sampleName, width, height, dwellTime, ref ImageByte);
+            }
+
+            return isSuccess;
+        }
+
+        public bool AcquisitionSpectrum(string samplePath, int xrayMode, double new_PixelSize, ref Particle particle, uint a_nXRayAQTime)
+        {
+            bool isSuccess = false;
+            if (m_SEMConnectionState)
+            {
+                isSuccess = m_cfun.AcquisitionSpectrum(samplePath, xrayMode, new_PixelSize, ref particle, a_nXRayAQTime);
+            }
+
+            return isSuccess;
+        }
+
+        #endregion
+    }
+}