OTSScanSim.cpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #include "stdafx.h"
  2. #include "OTSScanSim.h"
  3. #include "otsdataconst.h"
  4. namespace OTSController {
  5. COTSScanSim::COTSScanSim()
  6. {
  7. }
  8. COTSScanSim::~COTSScanSim()
  9. {
  10. }
  11. /// instance termination
  12. /*void COTSScanSim::FinishedInstance()
  13. {
  14. }*/
  15. // initialization
  16. BOOL COTSScanSim::Init()
  17. {
  18. // ok, return TRUE
  19. return TRUE;
  20. }
  21. // get the size of matrix.
  22. CSize COTSScanSim::GetMatrixSize(int /*a_nMatrixIndex*/)
  23. {
  24. return CSize(0);
  25. }
  26. // acquire BSE image
  27. CBSEImgPtr COTSScanSim::AcquireBSEImage(int /*a_nMatrixIndex*/, int /*nReads*/, int /*nDwell*/)
  28. {
  29. // BSE image
  30. CBSEImgPtr poBSEImgPtr = nullptr;
  31. // load simulation image
  32. poBSEImgPtr = AcquireBSEImageFromBitmapFile();
  33. // check simulation image
  34. ASSERT(poBSEImgPtr);
  35. if (!poBSEImgPtr)
  36. {
  37. // failed to load simulation image
  38. LogErrorTrace(__FILE__, __LINE__, _T("COTSScanSim::AcquireBSEImage: failed to load simulation image"));
  39. }
  40. Sleep(1000);//simulate the real sem time delay.
  41. // return simulation image, nullptr if load simulation image failed
  42. return poBSEImgPtr;
  43. }
  44. // move beam to point
  45. BOOL COTSScanSim::MoveBeamTo(CPoint& a_beamPos)
  46. {
  47. return FALSE;
  48. }
  49. // start scan table
  50. BOOL COTSScanSim::StartScanTable(int /*a_nMatrixIndex*/, unsigned int /*nP*/, int* /*px*/, int* /*py*/)
  51. {
  52. return TRUE;
  53. }
  54. // set image size
  55. BOOL COTSScanSim::SetImageSize(long a_nImageSizeX,long nHeight)
  56. {
  57. return TRUE;
  58. }
  59. // set dwell time
  60. BOOL COTSScanSim::SetDwellTime(long a_nDwellTime)
  61. {
  62. return TRUE;
  63. }
  64. // get dwell time by index
  65. long COTSScanSim::GetDwellTimeByIndex(const long a_nIndex)
  66. {
  67. // check index
  68. if (a_nIndex < DWELLTIME_BRUKER_ID_MIN || a_nIndex > DWELLTIME_BRUKER_ID_MAX)
  69. {
  70. // invalid index
  71. ASSERT(FALSE);
  72. LogInfoTrace(__FILE__, __LINE__, _T("COTSScanSim::GetDwellTimeByIndex: invalid index"));
  73. return -1;
  74. }
  75. // get dwell time by index
  76. long nDwellTime = DWELLTIME_BRUKER_VALUES[a_nIndex];
  77. return nDwellTime;
  78. }
  79. // set dwell time by index
  80. BOOL COTSScanSim::SetDwellTimeByIndex(const long a_nIndex)
  81. {
  82. // check index
  83. if (a_nIndex < DWELLTIME_BRUKER_ID_MIN || a_nIndex > DWELLTIME_BRUKER_ID_MIN)
  84. {
  85. // invalid index
  86. ASSERT(FALSE);
  87. LogInfoTrace(__FILE__, __LINE__, _T("COTSScanSim::SetDwellTimeByIndex: invalid index"));
  88. return FALSE;
  89. }
  90. // get dwell time
  91. long nDwellTime = DWELLTIME_BRUKER_VALUES[a_nIndex];
  92. if (!SetDwellTime(nDwellTime))
  93. {
  94. // failed to call SetDwellTime method
  95. LogErrorTrace(__FILE__, __LINE__, _T("COTSScanSim::SetDwellTimeByIndex: failed to call SetDwellTime method."));
  96. return FALSE;
  97. }
  98. // ok, return TRUE
  99. return TRUE;
  100. }
  101. // scan field size
  102. BOOL COTSScanSim::SetScanFieldSize(const int a_nWidth, const int a_nHeight)
  103. {
  104. m_nScanFieldSizeX = a_nWidth;
  105. m_nScanFieldSizeY = a_nHeight;
  106. return TRUE;
  107. }
  108. // set the SEM position
  109. BOOL COTSScanSim::SetEMPosition(const int a_nPosX, const int a_nPosY)
  110. {
  111. m_nCurrentBSEPositionX = a_nPosX;
  112. m_nCurrentBSEPositionY = a_nPosY;
  113. return TRUE;
  114. }
  115. }