|
|
@@ -70,6 +70,16 @@ namespace OTSModelSharp
|
|
|
// project file version string
|
|
|
public const String PROJ_MGR_FILE_VERSION = "1.1.1";
|
|
|
|
|
|
+ public static NLog.Logger Nloger = NLog.LogManager.GetCurrentClassLogger();
|
|
|
+
|
|
|
+ // general parameter, this is the initialization parameter
|
|
|
+ COTSGeneralParameters m_pGenParam;
|
|
|
+
|
|
|
+ // image scan parameter,this is the initialization parameter
|
|
|
+ COTSImgScanPrm m_pImageScanParam;
|
|
|
+
|
|
|
+ // image process parameter,this is the initialization parameter
|
|
|
+ COTSImageProcessParam m_pImageProcParam;
|
|
|
|
|
|
public COTSProjMgrFile()
|
|
|
{
|
|
|
@@ -1372,8 +1382,19 @@ namespace OTSModelSharp
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // get general parameter
|
|
|
+ public COTSGeneralParameters GetGenParam() { return m_pGenParam; }
|
|
|
+
|
|
|
+ // general parameters
|
|
|
+ public void SetGenParam(COTSGeneralParameters a_pGenParam)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ m_pGenParam = new COTSGeneralParameters(a_pGenParam);
|
|
|
+ }
|
|
|
+
|
|
|
// get modify flag
|
|
|
- public bool IsModified() { return m_bModify; }
|
|
|
+ public bool IsModified() { return m_bModify; }
|
|
|
|
|
|
// file name
|
|
|
public String GetFileName()
|
|
|
@@ -1876,10 +1897,120 @@ namespace OTSModelSharp
|
|
|
//合并后新添加的需要的方法
|
|
|
|
|
|
public bool SetImageScanParam(COTSGeneralParameters ImageScan) { return false; }
|
|
|
+
|
|
|
+
|
|
|
+ // get image scan parameter
|
|
|
+ public COTSImgScanPrm GetImageScanParam() { return m_pImageScanParam; }
|
|
|
+
|
|
|
+ // get image process parameter
|
|
|
+ public COTSImageProcessParam GetImageProcParam() { return m_pImageProcParam; }
|
|
|
+
|
|
|
+ // image process parameters
|
|
|
+ public void SetImageProcParam(COTSImageProcessParam a_pImageProcParam)
|
|
|
+ {
|
|
|
+
|
|
|
+ m_pImageProcParam = new COTSImageProcessParam(a_pImageProcParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ // get std file list, a_nPos = -1, current do not use any STD lib, a_nPos = 0, current use STD lib.
|
|
|
+ public bool GetParamFileList(int a_nPos, List<String> a_listParamFileName)
|
|
|
+ {
|
|
|
+ // AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
|
|
+
|
|
|
+ // get folder name from general GetParamFileListparameter.
|
|
|
+
|
|
|
+
|
|
|
+ String a_strFolderName = m_pGenParam.GetMsrParamFileFolderName();
|
|
|
+ if (a_strFolderName == "")
|
|
|
+ {
|
|
|
+ Nloger.Error("GetSTDFileList: empty folder name.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // lib name list
|
|
|
+ a_listParamFileName.Clear();
|
|
|
+
|
|
|
+ // file list
|
|
|
+ List<String> listParamFile = new List<string>();
|
|
|
+ listParamFile.Clear();
|
|
|
+
|
|
|
+ // get file list
|
|
|
+ if (!COTSHelper::GetFileNameList(a_strFolderName, MESUREMENT_PARAM_FILE_EXT, listParamFile))
|
|
|
+ {
|
|
|
+ Nloger.Error("GetSTDFileList::There is no %s file in the folder %s", MESUREMENT_PARAM_FILE_EXT, a_strFolderName);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ a_nPos = -1;
|
|
|
+ // the first postion is default value
|
|
|
+ String sDefault;
|
|
|
+ sDefault = MultiLang::GetInstance().GetCStringByKey(IDS_DEFAULT);
|
|
|
+ a_listParamFileName.Add(sDefault);
|
|
|
+ // get the param
|
|
|
+ CMsrParamFileMgr pParamMrg = CMsrParamFileMgrPtr(new CMsrParamFileMrg());
|
|
|
+ // get current param
|
|
|
+ CMsrParamsPtr pCurrentParam = CMsrParamsPtr(new CMsrParams());
|
|
|
+ COTSSamplePtr pSample = GetWorkingSample();
|
|
|
+ if (pSample == null)
|
|
|
+ {
|
|
|
+ // LogTrace(__FILE__, __LINE__, _T("GetParamFileList: failed to get working sample."));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pCurrentParam = pSample->GetMsrParams();
|
|
|
+ if (pCurrentParam == null)
|
|
|
+ {
|
|
|
+ // LogTrace(__FILE__, __LINE__, _T("GetParamFileList: failed to get working sample's param."));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ if (
|
|
|
+ (*(pCurrentParam->GetImageProcessParam().get()) == *(m_pImageProcParam.get()))
|
|
|
+ && (*(pCurrentParam->GetImageScanParam().get()) == *(m_pImageScanParam.get()))
|
|
|
+ && (*(pCurrentParam->GetXRayParam().get()) == *(m_pXRayParam.get())))
|
|
|
+ {
|
|
|
+ a_nPos = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int index = -1;
|
|
|
+ for (auto sPathName : listParamFile)
|
|
|
+ {
|
|
|
+ // get file name
|
|
|
+ CString strFileName = COTSHelper::GetFileNameWithoutExtension(sPathName);
|
|
|
+ strFileName = COTSHelper::GetFileName(strFileName);
|
|
|
+
|
|
|
+ index++;
|
|
|
+ //compare which param is used in the list
|
|
|
+ CString sParamFileName = listParamFile[index];
|
|
|
+ if (sParamFileName.IsEmpty())
|
|
|
+ {
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("ChangeSTDFromList::wrong param file name."));
|
|
|
+ return FALSE;
|
|
|
+ }
|
|
|
+ //load STD
|
|
|
+ CString sPathName = a_strFolderName + sParamFileName;
|
|
|
+ if (!pParamMrg->Load(sPathName))
|
|
|
+ {
|
|
|
+ LogErrorTrace(__FILE__, __LINE__, _T("ChangeSTDFromList::can't load param."));
|
|
|
+ return FALSE;
|
|
|
+ }
|
|
|
+ CMsrParamsPtr pNewParam = pParamMrg->GetMsrParams();
|
|
|
+ if (*pNewParam.get() == *pCurrentParam.get())
|
|
|
+ {
|
|
|
+ a_nPos = (index + 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ a_listParamFileName.push_back(strFileName);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return TRUE;
|
|
|
+ }
|
|
|
|
|
|
- public COTSImgScanPrm GetImageScanParam() { return null; }
|
|
|
|
|
|
-
|
|
|
|
|
|
}
|
|
|
}
|