|
|
@@ -0,0 +1,113 @@
|
|
|
+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<COTSParticleClr> parts, string stdname, int steelTech, int type)
|
|
|
+ {
|
|
|
+ bool r = true;
|
|
|
+ if (type == -1)
|
|
|
+ {
|
|
|
+ if (stdname != "NoSTDDB" && stdname != "NoSTDDB.db")
|
|
|
+ {
|
|
|
+ foreach (var part in parts)
|
|
|
+ {
|
|
|
+ part.SetBasicClassifyId((int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED);
|
|
|
+ IClassifyEngine engine = m_classifyEngine.GetExpressionClassifyEngine(stdname);
|
|
|
+ r = engine.ClassifyByExpression(part);
|
|
|
+
|
|
|
+
|
|
|
+ if (part.GetBasicClassifyId() == (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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (type == 0)
|
|
|
+ {
|
|
|
+ foreach (var part in parts)
|
|
|
+ {
|
|
|
+ IClassifyEngine engine;
|
|
|
+ engine = m_classifyEngine.GetIncClassifyEngine();
|
|
|
+ r = engine.ClassifyIncA(part, steelTech);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (type == 1 || type == 2 || type == 3 )
|
|
|
+ {
|
|
|
+ if (stdname != "NoSTDDB" && stdname != "NoSTDDB.db")
|
|
|
+ {
|
|
|
+ foreach (var part in parts)
|
|
|
+ {
|
|
|
+ part.SetBasicClassifyId((int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED);
|
|
|
+ IClassifyEngine engine = m_classifyEngine.GetExpressionClassifyEngine(stdname);
|
|
|
+ r = engine.ClassifyByExpression(part);
|
|
|
+
|
|
|
+
|
|
|
+ if (part.GetBasicClassifyId() == (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<COTSParticleClr> 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;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|