OTSClassifyEngineClr.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include "stdafx.h"
  2. #include <msclr\marshal_cppstd.h>
  3. #include "OTSParticleClr.h"
  4. #include "PosXrayClr.h"
  5. #include "OTSClassifyEngineClr.h"
  6. namespace OTSCLRINTERFACE {
  7. using namespace msclr::interop;
  8. using namespace OTSCLRINTERFACE;
  9. COTSClassifyEngineClr::COTSClassifyEngineClr(EngineType engineType, System::String^ libFileName)
  10. {
  11. std::string file = marshal_as <std::string>(libFileName);
  12. switch (engineType)
  13. {
  14. case EngineType::ParticleClassifyEng:
  15. engine = GetParticleEngine(file).get();
  16. break;
  17. case EngineType::InclutionEng:
  18. engine = GetInclutionEngine().get();
  19. break;
  20. case EngineType::CurveCompare:
  21. engine = GetCurveCompareEngine(file).get();
  22. break;
  23. default:
  24. break;
  25. }
  26. }
  27. bool COTSClassifyEngineClr::ReloadEngineDB()
  28. {
  29. return engine->Init();
  30. }
  31. bool COTSClassifyEngineClr::Classify(COTSParticleClr^ particle)
  32. {
  33. auto part = particle->GetOTSParticlePtr();
  34. auto xraydata = part->GetXrayInfo();
  35. return engine->Classify(part, xraydata);
  36. }
  37. bool COTSClassifyEngineClr::Classify(COTSParticleClr^ particle, int SteelTech)
  38. {
  39. auto part = particle->GetOTSParticlePtr();
  40. auto xraydata = part->GetXrayInfo();
  41. return engine->Classify(part, SteelTech, xraydata);
  42. }
  43. double COTSClassifyEngineClr::IfNeedMaxEDS(COTSParticleClr^ particle)
  44. {
  45. auto part = particle->GetOTSParticlePtr();
  46. auto xraydata = part->GetXrayInfo();
  47. double MaxEDSTime;
  48. engine->IfNeedMaxEDS(part, xraydata, MaxEDSTime);
  49. return MaxEDSTime;
  50. }
  51. }