| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 | //using OTSDataType;using OTSModelSharp.ServiceCenter;using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace OTSModelSharp.ServiceCenter{       using OTSCLRINTERFACE;   public class CClassifyEngine : IClassifyEngine    {        COTSClassifyEngineClr myEng;        bool ifWeightPercentageToAtomicPercentage=false;        public bool ClassifyIncA(COTSParticleClr particle, int steelTech)        {            bool r = myEng.ClassifyIncA(particle,steelTech);//the classify engine will             return true;        }           public IClassifyEngine GetSpectrumCompareEngine(string libName)        {            if (!libName.Contains(".db"))            {                libName = libName + ".db";            }            myEng = new COTSClassifyEngineClr(EngineType.SpectrumCompare, libName);            return this;        }        public IClassifyEngine GetIncClassifyEngine()        {            myEng = new COTSClassifyEngineClr(EngineType.InclutionEng, "");            return this;        }        public IClassifyEngine GetExpressionClassifyEngine(string libName)        {            if (!libName.Contains(".db"))            {                libName = libName + ".db";            }            myEng = new COTSClassifyEngineClr(EngineType.ExpressionClassifyEng, libName);            ifWeightPercentageToAtomicPercentage = FileHelper.GetIfTranslateWeightPercentageToAtomicPercentage();            return this;        }        public bool  IfNeedMaxEDS(COTSParticleClr particle,ref double maxeds)        {           return myEng.IfNeedMaxEDS(particle,ref maxeds);        }        public bool ClassifyBySpectrum(COTSParticleClr particle)        {          return  myEng.ClassifyBySpectrum(particle);        }        public bool ClassifyByExpressionTemporarySpectrum(COTSParticleClr particle)        {            return myEng.ClassifyByExpressionTemporarySpectrum(particle);        }        public bool ClassifyByExpression(COTSParticleClr particle)        {            if (ifWeightPercentageToAtomicPercentage==true)            {                double sumMolar=0;                foreach (var ele in particle.GetXray().GetElementQuantifyData())                {                    sumMolar += ele.GetMolarPercentage();                                }                foreach (var ele in particle.GetXray().GetElementQuantifyData())                {                    ele.SetPercentage(ele.GetMolarPercentage() / sumMolar);                }            }            return myEng.ClassifyByExpression(particle);        }    }}
 |