Prechádzať zdrojové kódy

Merge branch 'OTSRelease3_0' of http://36.129.163.148:30080/gogsadmin/OTS into OTSRelease3_0

zhangjiaxin 5 mesiacov pred
rodič
commit
902dfdfeb7

+ 120 - 113
OTSIncAMeasureApp/1-OTSMeasure/Measure/3-MeasureFlow/CSmplMeasure.cs

@@ -644,178 +644,185 @@ namespace OTSModelSharp
 
                 for (int i = 0; i < FldDatas.Count; ++i)
                 {// check and break if stop button is clicked
-
-                    var curFld = FldDatas[i];
-                    if (curFld.GetIsMeasureComplete())
+                    try
                     {
-                        continue;
-                    }
-                    if (IsPaused())
-                    {// measure stopped			
-                        pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.PAUSED);
-                        // record end time
-                        pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
-                        //must wait for the saving data thread  finished,or we'll get null pointer exception when we stop the measure process.			
-                        while (fieldQueue.Count() > 0)
+                        var curFld = FldDatas[i];
+                        if (curFld.GetIsMeasureComplete())
                         {
-                            Thread.Sleep(100);
+                            continue;
                         }
+                        if (IsPaused())
+                        {// measure stopped			
+                            pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.PAUSED);
+                            // record end time
+                            pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
+                            //must wait for the saving data thread  finished,or we'll get null pointer exception when we stop the measure process.			
+                            while (fieldQueue.Count() > 0)
+                            {
+                                Thread.Sleep(100);
+                            }
 
-                        SetSEMExteralOff();
-                        // update thread measure status class, let the main thread know that this sample measurement stopped
-                        ST_MSTMsg MsgSmpStop = new ST_MSTMsg(m_Sample);
+                            SetSEMExteralOff();
+                            // update thread measure status class, let the main thread know that this sample measurement stopped
+                            ST_MSTMsg MsgSmpStop = new ST_MSTMsg(m_Sample);
 
-                        MsgSmpStop.InitSamplePausedMsg();
+                            MsgSmpStop.InitSamplePausedMsg();
 
-                        m_pMsrThread.SendMessageToMeasureGUI(MsgSmpStop);
-                        while (IsPaused())
-                        {
-                            Thread.Sleep(300);
+                            m_pMsrThread.SendMessageToMeasureGUI(MsgSmpStop);
+                            while (IsPaused())
+                            {
+                                Thread.Sleep(300);
+
+                            }
 
                         }
+                        if (IsAborted())
+                        {// measure stopped			
+                            pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.STOPPED);
+                            // record end time
+                            pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
+                            //must wait for the saving data thread  finished,or we'll get null pointer exception when we stop the measure process.			
+                            while (fieldQueue.Count() > 0)
+                            {
+                                Thread.Sleep(100);
+                            }
+                            break;
+                        }
 
-                    }
-                    if (IsAborted())
-                    {// measure stopped			
-                        pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.STOPPED);
-                        // record end time
-                        pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
-                        //must wait for the saving data thread  finished,or we'll get null pointer exception when we stop the measure process.			
-                        while (fieldQueue.Count() > 0)
+                        // check if sample measurement completes
+                        COTSImgScanPrm pScanParam = m_Sample.GetMsrParams().GetImageScanParam();
+
+                        if (IsSampleOver(pScanParam))
                         {
-                            Thread.Sleep(100);
+                            pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.SUCCESSED);
+                            pStatus.ComputeTime(OTS_MSR_TIME_TYPE.COMPLT);
+                            break;
                         }
-                        break;
-                    }
 
-                    // check if sample measurement completes
-                    COTSImgScanPrm pScanParam = m_Sample.GetMsrParams().GetImageScanParam();
+                        // get a field center 
+                        System.Drawing.PointF poiFieldCentre = curFld.GetOTSPosition();
 
-                    if (IsSampleOver(pScanParam))
-                    {
-                        pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.SUCCESSED);
-                        pStatus.ComputeTime(OTS_MSR_TIME_TYPE.COMPLT);
-                        break;
-                    }
+                        // update thread measure status class, let the main thread know that starts a new field
 
-                    // get a field center 
-                    System.Drawing.PointF poiFieldCentre = curFld.GetOTSPosition();
 
-                    // update thread measure status class, let the main thread know that starts a new field
+                        ST_MSTMsg MsgFieldStart = new ST_MSTMsg(m_Sample, curFld);
 
+                        MsgFieldStart.InitFieldStartMsg();
 
-                    ST_MSTMsg MsgFieldStart = new ST_MSTMsg(m_Sample, curFld);
+                        m_pMsrThread.SendMessageToMeasureGUI(MsgFieldStart);
+                        int fldNo = curFld.GetId();
+                        log.Warn("Current field:" + fldNo.ToString());
 
-                    MsgFieldStart.InitFieldStartMsg();
 
-                    m_pMsrThread.SendMessageToMeasureGUI(MsgFieldStart);
-                    int fldNo = curFld.GetId();
-                    log.Warn("Current field:" + fldNo.ToString());
 
+                        // move SEM to the field center
+                        if (!MoveSEMToPoint(poiFieldCentre))
+                        {// failed to move SEM to the position
+                            log.Error("DoMeasure: failed to move SEM to the field centre point.");
+                            pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
+                            // record end time
+                            pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
+                            return;
+                        }
+                        log.Info("Begin to Acquire BSE image!");
+                        // take BSE image for the fields
+                        CBSEImgClr pBSEImg = AcquireABSEImage();
 
+                        // let the main thread to know that image process is completed
 
-                    // move SEM to the field center
-                    if (!MoveSEMToPoint(poiFieldCentre))
-                    {// failed to move SEM to the position
-                        log.Error("DoMeasure: failed to move SEM to the field centre point.");
-                        pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
-                        // record end time
-                        pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
-                        return;
-                    }
-                    log.Info("Begin to Acquire BSE image!");
-                    // take BSE image for the fields
-                    CBSEImgClr pBSEImg = AcquireABSEImage();
+                        if (pBSEImg == null)
+                        {
+                            log.Error("ImageProcess: can't get BSE image.");
+                            pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
+                            return;
+                        }
+                        curFld.SetBSEImage(pBSEImg);
 
-                    // let the main thread to know that image process is completed
 
-                    if (pBSEImg == null)
-                    {
-                        log.Error("ImageProcess: can't get BSE image.");
-                        pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
-                        return;
-                    }
-                    curFld.SetBSEImage(pBSEImg);
+                        //BSEData
+                        ST_MSTMsg MsgFieldBSE = new ST_MSTMsg(m_Sample, curFld);
+                        MsgFieldBSE.InitFieldBSEImageMsg();
 
+                        m_pMsrThread.SendMessageToMeasureGUI(MsgFieldBSE);
 
-                    //BSEData
-                    ST_MSTMsg MsgFieldBSE = new ST_MSTMsg(m_Sample, curFld);
-                    MsgFieldBSE.InitFieldBSEImageMsg();
 
-                    m_pMsrThread.SendMessageToMeasureGUI(MsgFieldBSE);
+                        log.Info("Acquire BSE image success! Processing image...");
+
+                        // image process
+
+                        FieldImageProcess(curFld);
 
+                        MsgFieldBSE.InitFieldBSEAnalysisPartsDataMsg();
 
-                    log.Info("Acquire BSE image success! Processing image...");
+                        m_pMsrThread.SendMessageToMeasureGUI(MsgFieldBSE);
 
-                    // image process
+                        if (m_ifAquireClearParticleImage)
+                        {
+                            var listAnalysisParts = curFld.GetListAnalysisParticles();
+                            foreach (var p in listAnalysisParts)
+                            {
+                                Rectangle r = (Rectangle)p.GetParticleRect();
+                                var img = m_ScanHardwareMgr.AcquireRectangleBSEImage(r);
+                                if (img != null)
+                                {
+                                    curFld.particleImages.Add(img);
+                                }
+                            }
 
-                    FieldImageProcess(curFld);
+                        }
 
-                    MsgFieldBSE.InitFieldBSEAnalysisPartsDataMsg();
 
-                    m_pMsrThread.SendMessageToMeasureGUI(MsgFieldBSE);
+                        COTSXRayParam pXRayParam = m_Sample.GetMsrParams().GetXRayParam();
 
-                    if (m_ifAquireClearParticleImage)
-                    {
-                        var listAnalysisParts = curFld.GetListAnalysisParticles();
-                        foreach (var p in listAnalysisParts)
+                        if (pXRayParam.GetUsingXray() == true)
                         {
-                            Rectangle r = (Rectangle)p.GetParticleRect();
-                            var img = m_ScanHardwareMgr.AcquireRectangleBSEImage(r);
-                            if (img != null)
+                            foreach (var p in curFld.GetListAnalysisParticles())
+                            {
+                                p.SetIsXrayParticle(true);
+                            }
+                            try
+                            {
+                                CollectParticlesXrayData(curFld);
+                            }
+                            catch (Exception e)
                             {
-                                curFld.particleImages.Add(img);
+                                log.Error(e.Message);
                             }
+
+
+
                         }
 
-                    }
+                        m_Sample.GetMsrStatus().SetStatus(OTS_MSR_SAMPLE_STATUS.SUCCESSED);
 
 
-                    COTSXRayParam pXRayParam = m_Sample.GetMsrParams().GetXRayParam();
+                        curFld.SetIsMeasureComplete(true);
 
-                    if (pXRayParam.GetUsingXray() == true)
-                    {
-                        foreach (var p in curFld.GetListAnalysisParticles())
-                        {
-                            p.SetIsXrayParticle(true);
-                        }
+                        log.Info("Begin to classify particles! particle num:" + curFld.GetListAnalysisParticles().Count);
                         try
                         {
-                            CollectParticlesXrayData(curFld);
+                            ClassifyFieldParticles(curFld);
                         }
                         catch (Exception e)
                         {
                             log.Error(e.Message);
-                        }
-
 
+                        }
 
-                    }
-
-                    m_Sample.GetMsrStatus().SetStatus(OTS_MSR_SAMPLE_STATUS.SUCCESSED);
 
+                        MsgFieldBSE.InitFieldSTDColoredPartsDataMsg();
 
-                    curFld.SetIsMeasureComplete(true);
+                        m_pMsrThread.SendMessageToMeasureGUI(MsgFieldBSE);
+                        //start db save
+                        StartSaveFileThread(ref curFld);
 
-                    log.Info("Begin to classify particles! particle num:" + curFld.GetListAnalysisParticles().Count);
-                    try
-                    {
-                        ClassifyFieldParticles(curFld);
+                        SendFieldParticlesInfoToGUI(curFld, m_Sample.GetMsrStatus());
                     }
                     catch (Exception e)
                     {
                         log.Error(e.Message);
 
                     }
-
-
-                    MsgFieldBSE.InitFieldSTDColoredPartsDataMsg();
-
-                    m_pMsrThread.SendMessageToMeasureGUI(MsgFieldBSE);
-                    //start db save
-                    StartSaveFileThread(ref curFld);
-
-                    SendFieldParticlesInfoToGUI(curFld, m_Sample.GetMsrStatus());
                 }