| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 | using FEIApiControl;using OTSCLRINTERFACE;using OTSModelSharp.ServiceCenter;using System;using System.Collections.Generic;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;namespace OTSMeasureApp.ServiceCenter{    class FEIScanController : IScanController    {        int imageWidth = 0;        int imageHeight = 0;        double dwelltime = 0;       private APIClass ApiClass = null;       public FEIScanController()        {            ApiClass = FEISemController.GetApiClassInstance();        }        public CBSEImgClr AcquireBSEImage()        {            Rectangle r = new Rectangle();            CBSEImgClr bse = new CBSEImgClr(r);            bse.InitImageData(imageWidth, imageHeight);            byte[] imgData = new byte[imageWidth * imageHeight];            if (!ApiClass.RunAcquireImage(imageWidth, imageHeight, dwelltime, "", ref imgData))            {                return null;            }            bse.SetImageData(imgData, imageWidth, imageHeight);            return bse;        }        public bool Init()        {            string FEIIP = FileHelper.GetXMLInformations("FEIIP");            string FEIPORT = FileHelper.GetXMLInformations("FEIPORT");            if (FEIIP == "" || FEIPORT == "")            {                NLog.LogManager.GetCurrentClassLogger().Error("FEI电镜端口配置为空!");                return false;            }            if (ApiClass.isConnect())            {                return true;            }            return ApiClass.Connect(FEIIP, FEIPORT);        }        public bool SetDwellTime(double val)        {            dwelltime = val;            return true;        }        public bool SetImageSize(int nWidth, int nHeight)        {            imageWidth = nWidth;            imageHeight = nHeight;            return   ApiClass.SetResolution(imageWidth, imageHeight); ;        }    }}
 |