OTSProjMgrFile.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. #pragma once
  2. #include "otsdataconst.h"
  3. #include "SEMStageData.h"
  4. #include "OTSGeneralParameters.h"
  5. #include "OTSImageScanParam.h"
  6. #include "OTSImageProcessParam.h"
  7. #include "OTSXRayParam.h"
  8. #include "Stage.h"
  9. #include "HoleBSEImg.h"
  10. #include "OTSSample.h"
  11. #include "STDFileMgr.h"
  12. // project management file is the main file of measure program
  13. namespace OTSMODEL {
  14. using namespace OTSDATA;
  15. const CString UNTITLED_FILE_NAME = _T("Untitled");
  16. class __declspec(dllexport) COTSProjMgrFile : public xmls::ISlo
  17. {
  18. public:
  19. COTSProjMgrFile(); // constructor
  20. COTSProjMgrFile(const COTSProjMgrFile&); // copy constructor
  21. COTSProjMgrFile(COTSProjMgrFile*); // copy constructor
  22. COTSProjMgrFile& operator=(const COTSProjMgrFile&); // =operator
  23. virtual ~COTSProjMgrFile(); // destructor
  24. //void Serialize(CArchive& ar); // serialization
  25. void Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode);
  26. // file
  27. BOOL NewFile();
  28. BOOL Load();
  29. BOOL Save();
  30. BOOL SaveAs();
  31. BOOL IsValid();
  32. // SEM stage data
  33. CSEMStageDataPtr GetSEMStageData() { return m_pSEMStageData; }
  34. void SetSEMStageData(CSEMStageDataPtr a_pSEMStageData);
  35. // stage
  36. CStagePtr GetStage() { return m_pStage; }
  37. void SetStage(CStagePtr a_pStage);
  38. // samples list
  39. COTSSamplesList& GetSampleList() { return m_listSamples; }
  40. bool SetSampleList(COTSSamplesList& a_listSample, BOOL a_bClear = TRUE);
  41. COTSSamplePtr GetSampleByIndex(int a_nIndex);
  42. COTSSamplePtr GetSampleByName(CString a_strSampleName);
  43. COTSSamplePtr AddSample(CString a_strHoleName = _T(""));
  44. BOOL DeleteSampleFiles(CString a_nString);
  45. BOOL DeleteSampleByIndex(int a_nIndex);
  46. BOOL DeleteSampleByName(CString a_strSampleName);
  47. BOOL SameNameInList(CString a_strSampleName, int a_nExclude = -1);
  48. BOOL ResetSamplesListOrder(std::vector<CString> a_listSampleNames);
  49. BOOL InsrtSample(COTSSamplePtr a_pSample, int a_nIndex);
  50. BOOL ChangeSamplePosition(int a_nIndexFrom, int a_nIndexTo);
  51. BOOL MoveSamplePosition(COTSSamplePtr a_pTargetSample, COTSSamplePtr a_RefpSample, BOOL a_bBefore = TRUE);
  52. BOOL MoveSamplePosition(CString a_strTargetSampleName, CString a_strRefSampleName, BOOL a_bBefore = TRUE);
  53. // working sample
  54. COTSSamplePtr GetWorkingSample();
  55. int GetWorkingSampleIndex() { return m_nWorkingSampeIndex; }
  56. void SetWorkingSampleIndex(int a_nWorkingSampleIndex) { m_nWorkingSampeIndex = a_nWorkingSampleIndex; }
  57. BOOL SetWorkingSampleByIndex(int a_nIndex);
  58. BOOL SetWorkingSampleByName(CString a_pSampleName);
  59. BOOL DeleteWorkingSample();
  60. // Sample hole BSE image list
  61. CHoleBSEImgsList& GetHoleBESImgList() { return m_listHoleBSEImg; }
  62. void SetHoleBESImgList(CHoleBSEImgsList& a_listHoleBSEImg, BOOL a_bClear = TRUE);
  63. // get general parameter
  64. COTSGeneralParametersPtr GetGenParam() { return m_pGenParam; }
  65. // set general parameter
  66. void SetGenParam(COTSGeneralParametersPtr a_pGenParam);
  67. // get image scan parameter
  68. COTSImageScanParamPtr GetImageScanParam() { return m_pImageScanParam; }
  69. // set image scan parameter
  70. void SetImageScanParam(COTSImageScanParamPtr a_pImageScanParam);
  71. // get image process parameter
  72. COTSImageProcessParamPtr GetImageProcParam() { return m_pImageProcParam; }
  73. // set image process parameter
  74. void SetImageProcParam(COTSImageProcessParamPtr a_pImageProcParam);
  75. // get XRay parameter
  76. COTSXRayParamPtr GetXRayParam() { return m_pXRayParam; }
  77. // set XRay parameter
  78. void SetXRayParam(COTSXRayParamPtr a_pXRayParam);
  79. CSTDItemsList& GetSysSTDItem() { return m_listSysSTDItem; }
  80. bool SetSysSTDItem(CSTDItemsList& a_listSysSTDItem, BOOL a_bClear = TRUE);
  81. // get modify flag
  82. BOOL IsModified() { return m_bModify; }
  83. // set modify flag
  84. void SetModify(BOOL a_bModify = TRUE) { m_bModify = a_bModify; }
  85. // set path name
  86. CString GetPathName() { return m_strPathName; }
  87. void SetPathName(CString a_strPathName) { m_strPathName = a_strPathName; }
  88. // get file name
  89. CString GetFileName();
  90. // if the new sample name can be used.
  91. BOOL IsValidSampleName(CString a_sName);
  92. //get param file name
  93. BOOL GetParamFileList(int& a_nPos, std::vector<CString>& a_listSTDLibName);
  94. // change STD
  95. BOOL ChangeParamFromList(int a_nPos);
  96. // get STD file list
  97. BOOL GetSTDFileList(int& a_nPos, std::vector<CString>& a_listSTDLibName);
  98. // change STD
  99. BOOL ChangeSTDFromList(int a_nPos);
  100. // get measured sample list
  101. BOOL GetMsredSampleList(COTSSamplesList& a_listMsredSample);
  102. // calculate measurement area
  103. CDomainPtr CalculateMsrArea(CHolePtr a_pHole);
  104. CDomainPtr CalculateDefaultArea(CHolePtr a_pHole);
  105. // remove background
  106. static BOOL RemoveBackGround(CBSEImgPtr a_pImgIn, COTSImageProcessParamPtr a_pImgProcessParam, CBSEImgPtr a_pImgOut);
  107. // load System STD lib
  108. BOOL GetSystemSTDLib(OTS_SOFT_PACKAGE_ID a_nPacketId);
  109. protected:
  110. // cleanup
  111. void Cleanup();
  112. // initialization
  113. void Init();
  114. // duplication
  115. void Duplicate(const COTSProjMgrFile& a_oSource);
  116. // get new sample name
  117. CString GetNewSampleName();
  118. // select a suitable sample hole for a new sample
  119. CHolePtr SelectASmpleHole(CString a_strHoleName = _T(""));
  120. // calculate deflate value
  121. int CalculateDeflateValue(int a_nWitchOrHeight);
  122. // SEM stage data
  123. CSEMStageDataPtr m_pSEMStageData;
  124. // stage
  125. CStagePtr m_pStage;
  126. // sample list
  127. COTSSamplesList m_listSamples;
  128. // BSE images list of holes
  129. CHoleBSEImgsList m_listHoleBSEImg;
  130. // general parameter, this is the initialization parameter
  131. COTSGeneralParametersPtr m_pGenParam;
  132. // image scan parameter,this is the initialization parameter
  133. COTSImageScanParamPtr m_pImageScanParam;
  134. // image process parameter,this is the initialization parameter
  135. COTSImageProcessParamPtr m_pImageProcParam;
  136. // X-Ray parameter,this is the initialization parameter
  137. COTSXRayParamPtr m_pXRayParam;
  138. // Load system STD lib
  139. CSTDItemsList m_listSysSTDItem;
  140. // modify flag, this flag is not in the file, it is used when save, only the modified file need to be saved.
  141. BOOL m_bModify;
  142. // path name
  143. CString m_strPathName;
  144. // working sample index
  145. int m_nWorkingSampeIndex;
  146. };
  147. typedef std::shared_ptr<COTSProjMgrFile> __declspec(dllexport) COTSProjMgrFilePtr;
  148. }