|
|
@@ -6,6 +6,7 @@ using OTSIncAMeasureApp.OTSMeasureControl;
|
|
|
using static OTSDataType.otsdataconst;
|
|
|
using OTSIncAMeasureApp.OTSMesureControl;
|
|
|
using OTSModelSharp.MeasureControl;
|
|
|
+using System.Windows.Forms;
|
|
|
|
|
|
namespace OTSModelSharp
|
|
|
{
|
|
|
@@ -13,6 +14,8 @@ namespace OTSModelSharp
|
|
|
|
|
|
using COTSSampleList = List<COTSSample>;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
// enum and struct used for send message to App
|
|
|
public enum ENUM_MSG_TYPE
|
|
|
{
|
|
|
@@ -40,7 +43,33 @@ namespace OTSModelSharp
|
|
|
// MSR_START_TIME = 2,
|
|
|
// MSR_END_TIME = 3
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
+ public enum SAMPLE_FAULT_WARN_CODE
|
|
|
+ {
|
|
|
+ INVALID = -1,
|
|
|
+ MIN = 0,
|
|
|
+ SEM_DATA_ERROR = 0,
|
|
|
+ AREA_OUTSIDE_HOLE = 1,
|
|
|
+ RESOLUTION_LOW = 2,
|
|
|
+ FINISHED = 3,
|
|
|
+ NO_ERROR_WARNING = 4,
|
|
|
+ FILE_NOT_SAVED = 5,
|
|
|
+ MAX = 5
|
|
|
+ }
|
|
|
+
|
|
|
+ public enum SAMPLE_CHECK_RESULT_TYPE
|
|
|
+ {
|
|
|
+ INVALID = -1,
|
|
|
+ MIN = 0,
|
|
|
+ SWITCH_ON = 0,
|
|
|
+ FINISHED = 1,
|
|
|
+ SETTING_ERROR = 2,
|
|
|
+ SETTING_WARNING = 3,
|
|
|
+ MEASURABLE = 4,
|
|
|
+ NO_ERROR_WARNING = 5,
|
|
|
+ MAX = 5
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public struct ST_MSTMsg
|
|
|
{
|
|
|
@@ -103,7 +132,9 @@ namespace OTSModelSharp
|
|
|
|
|
|
public class MsrThread
|
|
|
{
|
|
|
- // const CString UNTITLED_FILE_NAME = _T("Untitled");
|
|
|
+ int m_hWnd;
|
|
|
+ COTSHardwareMgr m_pHardwareMgr;
|
|
|
+ // const CString UNTITLED_FILE_NAME = _T("Untitled");
|
|
|
private const string UNTITLED_FILE_NAME = "Untitled";
|
|
|
public delegate void ProgressEventHandler(ST_MSTMsg msg);
|
|
|
public event ProgressEventHandler ProgressEvent;
|
|
|
@@ -120,6 +151,10 @@ namespace OTSModelSharp
|
|
|
|
|
|
public COTSImgScanPrm ImageScanParam = new COTSImgScanPrm();
|
|
|
|
|
|
+ public int IDS_ERROR_WARNING = 12322;
|
|
|
+
|
|
|
+ public int IDS_SAMPLE_CHECK_RESULT = 12311;
|
|
|
+
|
|
|
// measure loop status
|
|
|
|
|
|
public MsrThread()
|
|
|
@@ -141,6 +176,24 @@ namespace OTSModelSharp
|
|
|
{
|
|
|
return m_pProjMgrFile;
|
|
|
}
|
|
|
+
|
|
|
+ public void SetProjMgrFile(COTSProjMgrFile a_pProjMgrFile)
|
|
|
+ {
|
|
|
+ m_pProjMgrFile = a_pProjMgrFile;
|
|
|
+ }
|
|
|
+
|
|
|
+ // measurable sample list
|
|
|
+ public List<COTSSample> GetMeasurableSamples() { return m_listMeasurableSamples; }
|
|
|
+
|
|
|
+ // measurable sample list
|
|
|
+ public void SetMeasurableSamples(List<COTSSample> a_listMeasurableSamples)
|
|
|
+ {
|
|
|
+ foreach (var pSample in a_listMeasurableSamples)
|
|
|
+ {
|
|
|
+
|
|
|
+ m_listMeasurableSamples.Add(pSample);
|
|
|
+ }
|
|
|
+ }
|
|
|
public IMeasureHardware GetMeasureHardWare()
|
|
|
{
|
|
|
return m_HardwareMgr;
|
|
|
@@ -162,6 +215,41 @@ namespace OTSModelSharp
|
|
|
}
|
|
|
|
|
|
public CMsrThreadStatus GetMsrThreadStatus() { return m_pThreadStatus; }
|
|
|
+
|
|
|
+ public void SetMsrThreadStatus(CMsrThreadStatus a_pThreadStatus)
|
|
|
+ {
|
|
|
+
|
|
|
+ m_pThreadStatus = a_pThreadStatus;
|
|
|
+ }
|
|
|
+
|
|
|
+ //MeasureAppFormName
|
|
|
+ public String GetMsrAppFormName() { return m_strMAppFormName; }
|
|
|
+
|
|
|
+ public void SetMsrAppFormName(String a_MAppFormName) { m_strMAppFormName = a_MAppFormName; }
|
|
|
+
|
|
|
+ int GetWnd() { return m_hWnd; }
|
|
|
+
|
|
|
+ void SetHWND(int a_hWnd) { m_hWnd = a_hWnd; }
|
|
|
+
|
|
|
+ public bool CheckProjFileSave()
|
|
|
+ {
|
|
|
+
|
|
|
+ // Save or Save As, if strPathName is not empty, it is exist in the computer, this is a save action
|
|
|
+ String strPathName = m_pProjMgrFile.GetPathName();
|
|
|
+
|
|
|
+ // is this a file no saved?
|
|
|
+ strPathName.Trim();
|
|
|
+ if (strPathName.CompareTo(UNTITLED_FILE_NAME) == 0 || strPathName=="")
|
|
|
+ {
|
|
|
+
|
|
|
+ // return save as result
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
bool Init(COTSProjMgrFile a_pProjMgrFile)
|
|
|
{
|
|
|
m_pProjMgrFile = a_pProjMgrFile;
|
|
|
@@ -180,6 +268,67 @@ namespace OTSModelSharp
|
|
|
m_HardwareMgr.DisconnectHardware();
|
|
|
ProgressEvent(MsrMsg);
|
|
|
}
|
|
|
+
|
|
|
+ public bool GetClassifyParticleId(bool usingSyslib, string libname, int steelTech, COTSParticle part, int a_nIncId)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (usingSyslib)
|
|
|
+ {
|
|
|
+ var IncAen = GetInclutionEngine();//OTSClassifyEngine::GetInclutionEngine();
|
|
|
+ //if (!IncAen.Classify(part, steelTech, part.GetXrayInfo()))
|
|
|
+ //{
|
|
|
+
|
|
|
+ // return false;
|
|
|
+ //}
|
|
|
+ if (part.GetType() == (int)OTS_PARTCLE_TYPE.NOT_IDENTIFIED)
|
|
|
+ {
|
|
|
+ var ExpEn = GetParticleEngine(libname);//OTSClassifyEngine::GetParticleEngine(libname);
|
|
|
+ //if (!ExpEn.Classify(part, part.GetXrayInfo()))
|
|
|
+ //{
|
|
|
+
|
|
|
+ // return false;
|
|
|
+ //}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var ExpEn = GetParticleEngine(libname);//OTSClassifyEngine::GetParticleEngine(libname);
|
|
|
+ //if (!ExpEn.Classify(part, part.GetXrayInfo()))
|
|
|
+ //{
|
|
|
+
|
|
|
+ // return false;
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
+ if (a_nIncId < 8)
|
|
|
+ {
|
|
|
+ a_nIncId = (int)OTS_PARTCLE_TYPE.NOT_IDENTIFIED;
|
|
|
+ }
|
|
|
+ a_nIncId = part.GetType();
|
|
|
+ // ok, return TRUE
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool Classify(COTSParticle particle, int SteelTech, CPosXray xray)
|
|
|
+ {
|
|
|
+ // throw std::logic_error("The method or operation is not implemented.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public string GetInclutionEngine()
|
|
|
+ {
|
|
|
+ //static CLEEngine engine;
|
|
|
+ //if (engine == null)
|
|
|
+ //{
|
|
|
+ // engine = new InclutionClassifyEngine();
|
|
|
+ // engine->Init();
|
|
|
+ //}
|
|
|
+ //return engine;
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ string libname = "";
|
|
|
+ public string GetParticleEngine(string libname) { return ""; }
|
|
|
+
|
|
|
bool SetWorkingFolderStr()
|
|
|
{
|
|
|
// get project file pathname
|
|
|
@@ -216,6 +365,19 @@ namespace OTSModelSharp
|
|
|
return m_pThreadStatus.GetStatus() == OTSIncAMeasureApp.OTSMesureControl.OTS_MSR_THREAD_STATUS.STOPPED;
|
|
|
}
|
|
|
|
|
|
+ // SEM data general
|
|
|
+ public CSEMDataGnr GetSEMDataGnr() { return m_pSEMDataGnr; }
|
|
|
+
|
|
|
+ // SEM data general
|
|
|
+ public void SetSEMDataGnr(CSEMDataGnr a_pSEMDataGnr)
|
|
|
+ {
|
|
|
+
|
|
|
+ m_pSEMDataGnr = a_pSEMDataGnr;
|
|
|
+ }
|
|
|
+
|
|
|
+ // working folder
|
|
|
+ public String GetWorkingFolder() { return m_strWorkingFolder; }
|
|
|
+
|
|
|
public bool IsMeasureRunning() { return m_pThreadStatus.GetStatus() == OTSIncAMeasureApp.OTSMesureControl.OTS_MSR_THREAD_STATUS.INPROCESS; }
|
|
|
public bool IsMeasureFailed() { return m_pThreadStatus.GetStatus() == OTSIncAMeasureApp.OTSMesureControl.OTS_MSR_THREAD_STATUS.FAILED; }
|
|
|
public bool IsMeasureCompleted() { return m_pThreadStatus.GetStatus() == OTSIncAMeasureApp.OTSMesureControl.OTS_MSR_THREAD_STATUS.COMPLETED; }
|
|
|
@@ -565,10 +727,15 @@ namespace OTSModelSharp
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
- public bool GetMeasureAppFormName(string name) { return false; }
|
|
|
+ // public bool GetMeasureAppFormName(string name) { return false; }
|
|
|
|
|
|
- // measure status
|
|
|
- public void SetMsrLoopStatus(otsdataconst.OTS_MSR_THREAD_STATUS a_nMsrLoopStatus)
|
|
|
+ public void GetMeasureAppFormName( String csFormName)
|
|
|
+ {
|
|
|
+ m_strMAppFormName = csFormName;
|
|
|
+ }
|
|
|
+
|
|
|
+ // measure status
|
|
|
+ public void SetMsrLoopStatus(otsdataconst.OTS_MSR_THREAD_STATUS a_nMsrLoopStatus)
|
|
|
{
|
|
|
if (a_nMsrLoopStatus >= otsdataconst.OTS_MSR_THREAD_STATUS.MIN && a_nMsrLoopStatus <= otsdataconst.OTS_MSR_THREAD_STATUS.MAX)
|
|
|
{
|
|
|
@@ -577,5 +744,376 @@ namespace OTSModelSharp
|
|
|
}
|
|
|
|
|
|
public void SetStatus(otsdataconst.OTS_MSR_THREAD_STATUS a_nStatus) { m_nStatus = a_nStatus; }
|
|
|
+
|
|
|
+ // x-ray controller
|
|
|
+ public OTSEDSBase GetEDSController()
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ // get SEM, scanner and x-ray controller via hardware manager
|
|
|
+ OTSEDSBase pEDSCtrlPtr = m_pHardwareMgr.GetEDSControllerPtr();
|
|
|
+
|
|
|
+
|
|
|
+ return pEDSCtrlPtr;
|
|
|
+ }
|
|
|
+
|
|
|
+ // BSE controller
|
|
|
+ public COTSScanBase GetScanController()
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ // get SEM, scanner and x-ray controller via hardware manager
|
|
|
+ COTSScanBase pScanCtrlPtr = m_pHardwareMgr.GetScanControllerPtr();
|
|
|
+
|
|
|
+
|
|
|
+ return pScanCtrlPtr;
|
|
|
+ }
|
|
|
+
|
|
|
+ //check measure param
|
|
|
+ //input: COTSProjMgrFilePtr a_pProjMgrFile : work file
|
|
|
+ // COTSSamplesList& a_listMeasuableSamples : out put -- measure samples list
|
|
|
+ // BOOL a_bCheckSetting : TRUE check settings
|
|
|
+ public bool CheckMeasureParam(COTSProjMgrFile a_pProjMgrFile, List<COTSSample> a_listMeasuableSamples, bool a_bCheckSetting /*=TRUE*/)
|
|
|
+ {
|
|
|
+ // use the dll resource
|
|
|
+ // AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
|
|
+
|
|
|
+
|
|
|
+ // go through the sample list to check setting parameters
|
|
|
+ int nSwitchSmplNo = 0;
|
|
|
+ int nCompletedSmplNo = 0;
|
|
|
+ int nErrorSmplNo = 0;
|
|
|
+ int nWarningSmplNo = 0;
|
|
|
+ List<String> listSamplMessages = new List<string>();
|
|
|
+ List<COTSSample> listSamples = a_pProjMgrFile.GetSampleList();
|
|
|
+ List<COTSSample> listMeasurableSamples = new List<COTSSample>();
|
|
|
+ List<COTSSample> listWithWarningMeasurableSamples = new List<COTSSample>();
|
|
|
+ foreach (var pSample in listSamples)
|
|
|
+ {
|
|
|
+ // is the sample switch on
|
|
|
+ if (pSample.GetSwitch())
|
|
|
+ {
|
|
|
+ ++nSwitchSmplNo;
|
|
|
+ String strSmplMessage;
|
|
|
+ strSmplMessage = pSample.GetName() + ":" + "\r\n";
|
|
|
+
|
|
|
+ // is this a measurement completed sample
|
|
|
+ if (IsMeasureCompletedSmpl(pSample))
|
|
|
+ { // measurement completed sample
|
|
|
+ ++nCompletedSmplNo;
|
|
|
+ string str2 = GetSampleErrorWarnString(SAMPLE_FAULT_WARN_CODE.FINISHED);
|
|
|
+ strSmplMessage += str2;
|
|
|
+ strSmplMessage += "\r\n";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // errors
|
|
|
+ List<SAMPLE_FAULT_WARN_CODE> a_listErrorCodes = new List<SAMPLE_FAULT_WARN_CODE>();
|
|
|
+ GetSampleErrorCodes(a_pProjMgrFile, pSample, a_listErrorCodes);
|
|
|
+ if (a_listErrorCodes!=null)
|
|
|
+ {
|
|
|
+ // has error, this is not a measurable sample
|
|
|
+ ++nErrorSmplNo;
|
|
|
+ foreach (var nErrorCode in a_listErrorCodes)
|
|
|
+ {
|
|
|
+ String strs = GetSampleErrorWarnString(nErrorCode);
|
|
|
+ strSmplMessage += strs;
|
|
|
+ strSmplMessage += "\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // no error, this is a measurable sample
|
|
|
+ listMeasurableSamples.Add(pSample);
|
|
|
+ }
|
|
|
+
|
|
|
+ // warnings
|
|
|
+ List<SAMPLE_FAULT_WARN_CODE> a_listWarningCodes = new List<SAMPLE_FAULT_WARN_CODE>();
|
|
|
+ GetSampleWarningCodes(a_pProjMgrFile, pSample, a_listWarningCodes);
|
|
|
+ if (a_listWarningCodes!=null)
|
|
|
+ {
|
|
|
+ ++nWarningSmplNo;
|
|
|
+ foreach (var nWarningCode in a_listWarningCodes)
|
|
|
+ {
|
|
|
+ String strt = GetSampleErrorWarnString(nWarningCode);
|
|
|
+ strSmplMessage += strt;
|
|
|
+ strSmplMessage += "\r\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ // has no error?
|
|
|
+ if (a_listErrorCodes==null)
|
|
|
+ {
|
|
|
+ // this is a measurable sample but with setting warnings
|
|
|
+ listWithWarningMeasurableSamples.Add(pSample);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // no error and warning
|
|
|
+ if (a_listErrorCodes==null && a_listWarningCodes==null)
|
|
|
+ {
|
|
|
+ String strd = GetSampleErrorWarnString(SAMPLE_FAULT_WARN_CODE.NO_ERROR_WARNING);
|
|
|
+ strSmplMessage += strd;
|
|
|
+ strSmplMessage += "\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // add
|
|
|
+ listSamplMessages.Add(strSmplMessage);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // dlg message string
|
|
|
+ String strDlgMessage = "";
|
|
|
+ String str = "";
|
|
|
+ String str1;
|
|
|
+ str1 = MultiLang.GetInstance().GetStringByKey(IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.SWITCH_ON,0);
|
|
|
+ string.Format(str1, nSwitchSmplNo);
|
|
|
+ strDlgMessage += str1;
|
|
|
+ strDlgMessage += "\r\n";
|
|
|
+
|
|
|
+ // add more string if there switch on sample
|
|
|
+ if (nSwitchSmplNo > 0)
|
|
|
+ {
|
|
|
+ // completed sample number (optional)
|
|
|
+ if (nCompletedSmplNo > 0)
|
|
|
+ {
|
|
|
+ str1 = MultiLang.GetInstance().GetStringByKey(IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.FINISHED,0);
|
|
|
+ string.Format(str1, nCompletedSmplNo);
|
|
|
+ strDlgMessage += str1;
|
|
|
+ strDlgMessage += "\r\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ // any unmeasured switch on samples?
|
|
|
+ if (nSwitchSmplNo > nCompletedSmplNo)
|
|
|
+ {
|
|
|
+ // with setting error sample number
|
|
|
+ str1 = MultiLang.GetInstance().GetStringByKey(IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.SETTING_ERROR,0);
|
|
|
+ string.Format(str1, nErrorSmplNo);
|
|
|
+ strDlgMessage += str1;
|
|
|
+ strDlgMessage += "\r\n";
|
|
|
+
|
|
|
+ // with setting warning sample number
|
|
|
+ str1 = MultiLang.GetInstance().GetStringByKey(IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.SETTING_WARNING,0);
|
|
|
+ string.Format(str1, nWarningSmplNo);
|
|
|
+ strDlgMessage += str1;
|
|
|
+ strDlgMessage += "\r\n";
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // measurable sample numbers (has %d there)
|
|
|
+ str = MultiLang.GetInstance().GetStringByKey(IDS_SAMPLE_CHECK_RESULT + (int)SAMPLE_CHECK_RESULT_TYPE.MEASURABLE,0);
|
|
|
+ strDlgMessage += str;
|
|
|
+ strDlgMessage += "\r\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ // add an empty line strDlgMessage
|
|
|
+ strDlgMessage += "\r\n";
|
|
|
+
|
|
|
+ // add sample messages
|
|
|
+ foreach (var strSmplMessage in listSamplMessages)
|
|
|
+ {
|
|
|
+ strDlgMessage += strSmplMessage;
|
|
|
+ strDlgMessage += "\r\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ // do we need to show dialog box?
|
|
|
+ if (nSwitchSmplNo == 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // measure button clicked?
|
|
|
+ if (a_bCheckSetting)
|
|
|
+ {
|
|
|
+ // there are measurable samples but no setting warnings samples
|
|
|
+ if ((int)listMeasurableSamples.Count > 0 && (int)listWithWarningMeasurableSamples.Count == 0)
|
|
|
+ {
|
|
|
+ // set output measurable samples list
|
|
|
+ foreach (var pSample in listMeasurableSamples)
|
|
|
+ {
|
|
|
+ a_listMeasuableSamples.Add(pSample);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //when there is sample setting error, and setting with no error and no warning samples, the dlg will not be show.??
|
|
|
+
|
|
|
+ //show the result dlg
|
|
|
+ DIALOG_CHECK_PARAM_RESULT dlg = new DIALOG_CHECK_PARAM_RESULT();
|
|
|
+ int nTatolMeasuableSmplNo = (int)listMeasurableSamples.Count;
|
|
|
+ int nWithWarningMeasuableSmplNo = (int)listWithWarningMeasurableSamples.Count;
|
|
|
+
|
|
|
+ // set the dlg parameters
|
|
|
+ dlg.SetCheckOnlyFlag(a_bCheckSetting);
|
|
|
+ dlg.SetMessageBase(strDlgMessage);
|
|
|
+ dlg.SetTatolMeasuableSmplNo(nTatolMeasuableSmplNo);
|
|
|
+ dlg.SetWithWarningMeasuableSmplNo(nWithWarningMeasuableSmplNo);
|
|
|
+
|
|
|
+ //show dlg
|
|
|
+
|
|
|
+ // if (dlg.ShowDialog != DialogResult.OK)
|
|
|
+ //{
|
|
|
+ // do something here
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ //if warnDo, back the listMeasuableSample
|
|
|
+ if (dlg.GetWarnDo())
|
|
|
+ {
|
|
|
+ foreach (var pSample in listMeasurableSamples)
|
|
|
+ {
|
|
|
+ a_listMeasuableSamples.Add(pSample);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else // back with no warn sample
|
|
|
+ {
|
|
|
+ foreach (var pSample in listMeasurableSamples)
|
|
|
+ {
|
|
|
+ // auto itr = std::find(listWithWarningMeasurableSamples.begin(), listWithWarningMeasurableSamples.end(), pSample);
|
|
|
+ //if (itr == listWithWarningMeasurableSamples.end())
|
|
|
+ //{
|
|
|
+ // a_listMeasuableSamples.Add(pSample);
|
|
|
+ //}
|
|
|
+ bool IsChanged = false;
|
|
|
+ for (int itr = 0; itr < listMeasurableSamples.Count; itr++)
|
|
|
+ {
|
|
|
+ if (listMeasurableSamples[itr].GetName() == str)
|
|
|
+ {
|
|
|
+ COTSSample oTSSample = listMeasurableSamples[itr];
|
|
|
+ listMeasurableSamples.RemoveAt(itr);
|
|
|
+ IsChanged = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!IsChanged)
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // }
|
|
|
+
|
|
|
+ m_listMeasurableSamples = a_listMeasuableSamples;//set the measureable samples to the member variable,so we can use it later. gsp.
|
|
|
+
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // get error codes list of a sample
|
|
|
+ public void GetSampleErrorCodes(COTSProjMgrFile a_pProjMgrFile, COTSSample a_pSample, List<SAMPLE_FAULT_WARN_CODE> a_listErrorCodes)
|
|
|
+ {
|
|
|
+
|
|
|
+ // check setting error
|
|
|
+ if ((a_pSample.GetSEMDataMsr()) == new CSEMDataMsr())
|
|
|
+ {
|
|
|
+ a_listErrorCodes.Add(SAMPLE_FAULT_WARN_CODE.SEM_DATA_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ // file has not been saved
|
|
|
+ String strPathName = a_pProjMgrFile.GetPathName();
|
|
|
+
|
|
|
+ // is this a file no saved?
|
|
|
+ strPathName.Trim();
|
|
|
+ if (strPathName.CompareTo(UNTITLED_FILE_NAME) == 0 || strPathName=="")
|
|
|
+ {
|
|
|
+
|
|
|
+ a_listErrorCodes.Add(SAMPLE_FAULT_WARN_CODE.FILE_NOT_SAVED);
|
|
|
+ }
|
|
|
+
|
|
|
+ // more error checking...
|
|
|
+ }
|
|
|
+
|
|
|
+ // check sample a measurement completed
|
|
|
+ public bool IsMeasureCompletedSmpl(COTSSample a_pSample)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (a_pSample.GetMsrStatus().GetStatus() != OTS_MSR_SAMPLE_STATUS.SUCCESSED)
|
|
|
+ {
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // error/waring string
|
|
|
+ public String GetSampleErrorWarnString(SAMPLE_FAULT_WARN_CODE a_nSampleFaultWarn)
|
|
|
+ {
|
|
|
+ // switch to dll resource
|
|
|
+ // AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
|
|
+
|
|
|
+ // check input
|
|
|
+ if (a_nSampleFaultWarn < SAMPLE_FAULT_WARN_CODE.MIN && a_nSampleFaultWarn > SAMPLE_FAULT_WARN_CODE.MAX)
|
|
|
+ {
|
|
|
+
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ // error/waring string
|
|
|
+ String strErrorWarn;
|
|
|
+ string error = "";
|
|
|
+ strErrorWarn = MultiLang.GetInstance().GetStringByKey(IDS_ERROR_WARNING + (int)a_nSampleFaultWarn,0);
|
|
|
+ //GetStringByKey(IDS_ERROR_WARNING + (int)a_nSampleFaultWarn);
|
|
|
+ return strErrorWarn;
|
|
|
+ }
|
|
|
+
|
|
|
+ // get warning codes list of a sample
|
|
|
+ public void GetSampleWarningCodes(COTSProjMgrFile a_pProjMgrFile, COTSSample a_pSample, List<SAMPLE_FAULT_WARN_CODE> a_listWarningCodes)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ // check if the file is valid
|
|
|
+ if (!a_pProjMgrFile.IsValid())
|
|
|
+ {
|
|
|
+ // invalid project file
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // check if the measure domain is cross the sample hole
|
|
|
+ // get the work stage
|
|
|
+ CStage pStage = a_pProjMgrFile.GetStage();
|
|
|
+
|
|
|
+ //get hole
|
|
|
+ String sHoleName = a_pSample.GetSampleHoleName();
|
|
|
+
|
|
|
+ //look for the hole Domain
|
|
|
+ CHole pSampleHole = pStage.GetHoleByName(sHoleName);
|
|
|
+ if (pSampleHole!=null)
|
|
|
+ {
|
|
|
+ // failed to get the sample hole
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //// get the measure domain 2019-05-05 注释测量区域是否超越样品
|
|
|
+ //CDomainPtr pDomain = a_pSample->GetMsrArea();
|
|
|
+ //if (!pSampleHole->DomainInDomain(*pDomain.get()))
|
|
|
+ //{
|
|
|
+ // //sample measure area has part outside the sample hole
|
|
|
+ // a_listWarningCodes.push_back(SAMPLE_FAULT_WARN_CODE::AREA_OUTSIDE_HOLE);
|
|
|
+ //}
|
|
|
+
|
|
|
+ // resolution
|
|
|
+ // can only check this if SEM measure data is set
|
|
|
+ if (!((a_pSample.GetSEMDataMsr()) ==new CSEMDataMsr()))
|
|
|
+ {
|
|
|
+ // compute pixel size
|
|
|
+ double dPixleSize = a_pSample.CalculatePixelSize();
|
|
|
+
|
|
|
+ // get min size
|
|
|
+ COTSImageProcessParam pImageProcParam = a_pSample.GetMsrParams().GetImageProcessParam();
|
|
|
+ double dMinSize = (double)pImageProcParam.GetIncArea().GetStart();
|
|
|
+
|
|
|
+ // if pixel size bigger than 1/2 of the min size, current magnification can't see clear of the object
|
|
|
+ if (dPixleSize >= dMinSize * 0.5)
|
|
|
+ {
|
|
|
+ // resolution low
|
|
|
+ a_listWarningCodes.Add(SAMPLE_FAULT_WARN_CODE.RESOLUTION_LOW);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|