| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 | using FEIApiControl;using OTSCLRINTERFACE;using OxfordExtenderWrapper;using OTSModelSharp.ServiceCenter;using System;using System.Collections.Generic;using System.Drawing;using System.Linq;using System.Runtime.Remoting.Channels.Ipc;using System.Runtime.Remoting.Channels;using OTSMeasureApp.ServiceCenter.OxfordExtender;namespace OTSMeasureApp.ServiceCenter{    class OxfordEDSController : IEDSController    {        ExtenderIpcUI iExtender;        private int AnalyExpCount = 100000;        private string strResolution = "";        public ExtenderIpcUI GetIExtender()        {            return iExtender;        }        public void SetIExtender(ExtenderIpcUI value)        {            iExtender = value;        }        public OxfordEDSController( int MaxCounts)        {            iExtender = ExtenderWrapperIpc.GetExtenderWrapper();                     SetAnalyExpCount(MaxCounts);        }               public bool GetXRayByFeatures(List<COTSParticleClr> a_listParticles, double a_nXRayAQTime, bool a_bElementInfo)        {            List<AreaXrayParam> areaPrms = new List<AreaXrayParam>();            foreach (var part in a_listParticles)            {                var p = new AreaXrayParam();                p.dMilliSecondsTime = a_nXRayAQTime;                var feas = part.GetFeature().GetSegmentsList();                foreach (var f in feas)                {                    p.a_listChord.Add(new Segment() { X = f.GetStart(), Y = f.GetHeight(), Length = f.GetLength() });                }                areaPrms.Add(p);            }            NLog.LogManager.GetCurrentClassLogger().Info("Begin to acquire feature xray data :" + areaPrms.Count);            iExtender.CollectXrayByFeatures(ref areaPrms, a_nXRayAQTime, a_bElementInfo);            NLog.LogManager.GetCurrentClassLogger().Info("End acquiring feature xray data :" + areaPrms.Count);            for (int i = 0; i < a_listParticles.Count; i++)            {                CPosXrayClr xray = a_listParticles[i].GetXray();                xray.SetXrayData(areaPrms[i].XrayData);                var listElement = areaPrms[i].listElement;                List<CElementChemistryClr> chelist = new List<CElementChemistryClr>();                foreach (var ele in listElement)                {                    var che = new CElementChemistryClr();                    che.SetName(ele.Key);                    che.SetPercentage(ele.Value);                    chelist.Add(che);                }                xray.SetElementQuantifyData(chelist);                a_listParticles[i].SetXray(xray);            }            return true;        }        public bool GetXRayByParts(List<COTSParticleClr> a_listParticles, uint a_nXRayAQTime, bool a_bElementInfo)        {            List<PointXrayParam> pointXrayPrms = new List<PointXrayParam>();            foreach (var part in a_listParticles)            {                var p = new PointXrayParam();                p.dMilliSecondsTime = a_nXRayAQTime;                var Pos = (Point)(part.GetXRayPos());                p.x = Pos.X;                p.y = Pos.Y;                pointXrayPrms.Add(p);            }            NLog.LogManager.GetCurrentClassLogger().Info("Begin to acquire point xray data :"+ pointXrayPrms.Count);            iExtender.CollectXrayByPoints(ref pointXrayPrms, a_nXRayAQTime, a_bElementInfo);            NLog.LogManager.GetCurrentClassLogger().Info("End acquiring point xray data :" + pointXrayPrms.Count);            for (int i = 0; i < a_listParticles.Count; i++)            {                CPosXrayClr xray = a_listParticles[i].GetXray();                xray.SetXrayData(pointXrayPrms[i].XrayData);                var listElement = pointXrayPrms[i].listElement;                List<CElementChemistryClr> chelist = new List<CElementChemistryClr>();                foreach (var ele in listElement)                {                    var che = new CElementChemistryClr();                    che.SetName(ele.Key);                    che.SetPercentage(ele.Value);                    chelist.Add(che);                }                xray.SetElementQuantifyData(chelist);                a_listParticles[i].SetXray(xray);            }            return true;        }        public bool CollectSpectrum(uint a_nXRayAQTime, ref uint[] a_XrayData)        {                            Dictionary<string, double> eleItems = new Dictionary<string, double>();            var p = new PointXrayParam();            p.x = 10;            p.y = 10;            p.dMilliSecondsTime = a_nXRayAQTime;            if (iExtender.XrayPointCollecting(ref p))            {                a_XrayData = p.XrayData;                return true;            }            else             {                a_XrayData = p.XrayData;                return false;            }                                             }        public bool Connect()        {            iExtender = ExtenderWrapperIpc.GetExtenderWrapper();            return true;        }           private bool SetAnalyExpCount(int MaxCounts)        {                            AnalyExpCount = MaxCounts;                      return true;        }        public EDSTYPE GetEDSType()        {            return EDSTYPE.OXFORD;        }             public void SetFilterKeyEleNames(List<string> KeyNameList)        {            throw new NotImplementedException();        }        public bool QuantifyXrayByParts(List<COTSParticleClr> a_listParticles)        {            return true;        }        void IEDSController.SetResolution(int resolutionWidth, int resolutionHeight)        {            return;        }        public bool QuantifyXrayByPart(COTSParticleClr part)        {            return true;        }        public int GetExpectCount()        {            return AnalyExpCount;        }        public bool GetIfDelayQuantify()        {            return false;        }    }}
 |