| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
-
- 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
- }
- }
|