using OTSCLRINTERFACE; using OTSModelSharp.ServiceCenter; using System.Collections.Generic; using static OTSDataType.otsdataconst; namespace OTSCommon { public static class COffLineClassifyLogic { //we have a complicate online classify logic(considering the xray counts and using the spectrum compare and may do not quantify) //when we do classification offline we cann't use that mechanism so we use a surrogate mechanism which is simpler and general . private static CClassifyEngine m_classifyEngine = new CClassifyEngine(); public static bool ClassifyIncA(List parts, string stdname, int steelTech) { bool r = true; if (stdname != "NoSTDDB"&& stdname != "NoSTDDB.db") { foreach (var part in parts) { part.SetType((int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED); IClassifyEngine engine = m_classifyEngine.GetExpressionClassifyEngine(stdname); r = engine.ClassifyByExpression(part); if (part.GetType() == (int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED) { engine = m_classifyEngine.GetIncClassifyEngine(); r = engine.ClassifyIncA(part, steelTech); } } } else { foreach (var part in parts) { IClassifyEngine engine; engine = m_classifyEngine.GetIncClassifyEngine(); r = engine.ClassifyIncA(part, steelTech); } } return r; } public static bool ClassifyCleannessA(List parts, string stdname) { bool r = true; IClassifyEngine engine; engine = m_classifyEngine.GetExpressionClassifyEngine(stdname); if (stdname != "NoSTDDB") { foreach (var p in parts) { r = engine.ClassifyByExpression(p); } } return true; } } }