COffLineClassifyLogic.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using OTSCLRINTERFACE;
  2. using OTSModelSharp.ServiceCenter;
  3. using System.Collections.Generic;
  4. using static OTSDataType.otsdataconst;
  5. namespace OTSCommon
  6. {
  7. public static class COffLineClassifyLogic
  8. {
  9. //we have a complicate online classify logic(considering the xray counts and using the spectrum compare and may do not quantify)
  10. //when we do classification offline we cann't use that mechanism so we use a surrogate mechanism which is simpler and general .
  11. private static CClassifyEngine m_classifyEngine = new CClassifyEngine();
  12. public static bool ClassifyIncA(List<COTSParticleClr> parts, string stdname, int steelTech)
  13. {
  14. bool r = true;
  15. if (stdname != "NoSTDDB"&& stdname != "NoSTDDB.db")
  16. {
  17. foreach (var part in parts)
  18. {
  19. part.SetType((int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED);
  20. IClassifyEngine engine = m_classifyEngine.GetExpressionClassifyEngine(stdname);
  21. r = engine.ClassifyByExpression(part);
  22. if (part.GetType() == (int)OTS_PARTICLE_TYPE.NOT_IDENTIFIED)
  23. {
  24. engine = m_classifyEngine.GetIncClassifyEngine();
  25. r = engine.ClassifyIncA(part, steelTech);
  26. }
  27. }
  28. }
  29. else
  30. {
  31. foreach (var part in parts)
  32. {
  33. IClassifyEngine engine;
  34. engine = m_classifyEngine.GetIncClassifyEngine();
  35. r = engine.ClassifyIncA(part, steelTech);
  36. }
  37. }
  38. return r;
  39. }
  40. public static bool ClassifyCleannessA(List<COTSParticleClr> parts, string stdname)
  41. {
  42. bool r = true;
  43. IClassifyEngine engine;
  44. engine = m_classifyEngine.GetExpressionClassifyEngine(stdname);
  45. if (stdname != "NoSTDDB")
  46. {
  47. foreach (var p in parts)
  48. {
  49. r = engine.ClassifyByExpression(p);
  50. }
  51. }
  52. return true;
  53. }
  54. }
  55. }