#pragma once #include "otsdataconst.h" #include "SEMStageData.h" #include "OTSGeneralParameters.h" #include "OTSImageScanParam.h" #include "OTSImageProcessParam.h" #include "OTSXRayParam.h" #include "Stage.h" #include "HoleBSEImg.h" #include "OTSSample.h" #include "STDFileMgr.h" // project management file is the main file of measure program namespace OTSMODEL { using namespace OTSDATA; const CString UNTITLED_FILE_NAME = _T("Untitled"); class __declspec(dllexport) COTSProjMgrFile : public xmls::ISlo { public: COTSProjMgrFile(); // constructor COTSProjMgrFile(const COTSProjMgrFile&); // copy constructor COTSProjMgrFile(COTSProjMgrFile*); // copy constructor COTSProjMgrFile& operator=(const COTSProjMgrFile&); // =operator virtual ~COTSProjMgrFile(); // destructor //void Serialize(CArchive& ar); // serialization void Serialize(bool isStoring, tinyxml2::XMLDocument * classDoc, tinyxml2::XMLElement * rootNode); // file BOOL NewFile(); BOOL Load(); BOOL Save(); BOOL SaveAs(); BOOL IsValid(); // SEM stage data CSEMStageDataPtr GetSEMStageData() { return m_pSEMStageData; } void SetSEMStageData(CSEMStageDataPtr a_pSEMStageData); // stage CStagePtr GetStage() { return m_pStage; } void SetStage(CStagePtr a_pStage); // samples list COTSSamplesList& GetSampleList() { return m_listSamples; } bool SetSampleList(COTSSamplesList& a_listSample, BOOL a_bClear = TRUE); COTSSamplePtr GetSampleByIndex(int a_nIndex); COTSSamplePtr GetSampleByName(CString a_strSampleName); COTSSamplePtr AddSample(CString a_strHoleName = _T("")); BOOL DeleteSampleFiles(CString a_nString); BOOL DeleteSampleByIndex(int a_nIndex); BOOL DeleteSampleByName(CString a_strSampleName); BOOL SameNameInList(CString a_strSampleName, int a_nExclude = -1); BOOL ResetSamplesListOrder(std::vector a_listSampleNames); BOOL InsrtSample(COTSSamplePtr a_pSample, int a_nIndex); BOOL ChangeSamplePosition(int a_nIndexFrom, int a_nIndexTo); BOOL MoveSamplePosition(COTSSamplePtr a_pTargetSample, COTSSamplePtr a_RefpSample, BOOL a_bBefore = TRUE); BOOL MoveSamplePosition(CString a_strTargetSampleName, CString a_strRefSampleName, BOOL a_bBefore = TRUE); // working sample COTSSamplePtr GetWorkingSample(); int GetWorkingSampleIndex() { return m_nWorkingSampeIndex; } void SetWorkingSampleIndex(int a_nWorkingSampleIndex) { m_nWorkingSampeIndex = a_nWorkingSampleIndex; } BOOL SetWorkingSampleByIndex(int a_nIndex); BOOL SetWorkingSampleByName(CString a_pSampleName); BOOL DeleteWorkingSample(); // Sample hole BSE image list CHoleBSEImgsList& GetHoleBESImgList() { return m_listHoleBSEImg; } void SetHoleBESImgList(CHoleBSEImgsList& a_listHoleBSEImg, BOOL a_bClear = TRUE); // get general parameter COTSGeneralParametersPtr GetGenParam() { return m_pGenParam; } // set general parameter void SetGenParam(COTSGeneralParametersPtr a_pGenParam); // get image scan parameter COTSImageScanParamPtr GetImageScanParam() { return m_pImageScanParam; } // set image scan parameter void SetImageScanParam(COTSImageScanParamPtr a_pImageScanParam); // get image process parameter COTSImageProcessParamPtr GetImageProcParam() { return m_pImageProcParam; } // set image process parameter void SetImageProcParam(COTSImageProcessParamPtr a_pImageProcParam); // get XRay parameter COTSXRayParamPtr GetXRayParam() { return m_pXRayParam; } // set XRay parameter void SetXRayParam(COTSXRayParamPtr a_pXRayParam); CSTDItemsList& GetSysSTDItem() { return m_listSysSTDItem; } bool SetSysSTDItem(CSTDItemsList& a_listSysSTDItem, BOOL a_bClear = TRUE); // get modify flag BOOL IsModified() { return m_bModify; } // set modify flag void SetModify(BOOL a_bModify = TRUE) { m_bModify = a_bModify; } // set path name CString GetPathName() { return m_strPathName; } void SetPathName(CString a_strPathName) { m_strPathName = a_strPathName; } // get file name CString GetFileName(); // if the new sample name can be used. BOOL IsValidSampleName(CString a_sName); //get param file name BOOL GetParamFileList(int& a_nPos, std::vector& a_listSTDLibName); // change STD BOOL ChangeParamFromList(int a_nPos); // get STD file list BOOL GetSTDFileList(int& a_nPos, std::vector& a_listSTDLibName); // change STD BOOL ChangeSTDFromList(int a_nPos); // get measured sample list BOOL GetMsredSampleList(COTSSamplesList& a_listMsredSample); // calculate measurement area CDomainPtr CalculateMsrArea(CHolePtr a_pHole); CDomainPtr CalculateDefaultArea(CHolePtr a_pHole); // remove background static BOOL RemoveBackGround(CBSEImgPtr a_pImgIn, COTSImageProcessParamPtr a_pImgProcessParam, CBSEImgPtr a_pImgOut); // load System STD lib BOOL GetSystemSTDLib(OTS_SOFT_PACKAGE_ID a_nPacketId); protected: // cleanup void Cleanup(); // initialization void Init(); // duplication void Duplicate(const COTSProjMgrFile& a_oSource); // get new sample name CString GetNewSampleName(); // select a suitable sample hole for a new sample CHolePtr SelectASmpleHole(CString a_strHoleName = _T("")); // calculate deflate value int CalculateDeflateValue(int a_nWitchOrHeight); // SEM stage data CSEMStageDataPtr m_pSEMStageData; // stage CStagePtr m_pStage; // sample list COTSSamplesList m_listSamples; // BSE images list of holes CHoleBSEImgsList m_listHoleBSEImg; // general parameter, this is the initialization parameter COTSGeneralParametersPtr m_pGenParam; // image scan parameter,this is the initialization parameter COTSImageScanParamPtr m_pImageScanParam; // image process parameter,this is the initialization parameter COTSImageProcessParamPtr m_pImageProcParam; // X-Ray parameter,this is the initialization parameter COTSXRayParamPtr m_pXRayParam; // Load system STD lib CSTDItemsList m_listSysSTDItem; // modify flag, this flag is not in the file, it is used when save, only the modified file need to be saved. BOOL m_bModify; // path name CString m_strPathName; // working sample index int m_nWorkingSampeIndex; }; typedef std::shared_ptr __declspec(dllexport) COTSProjMgrFilePtr; }