Browse Source

optimize the measure flow.

gsp 3 years ago
parent
commit
8dd6d78d86

+ 2 - 4
OTSCPP/OTSData/OTSFieldData.cpp

@@ -124,8 +124,7 @@ namespace OTSDATA {
 		// copy the list
 		for (auto pParticle : a_listParticles)
 		{
-			//COTSParticlePtr pParticleNew = COTSParticlePtr(new COTSParticle(*pParticle.get()));	
-			//COTSParticlePtr pParticleNew = COTSParticlePtr(pParticle.get());
+	
 			m_listParticles.push_back(pParticle);
 		}
 	}
@@ -140,8 +139,7 @@ namespace OTSDATA {
 		// copy the list
 		for (auto pParticle : a_listParticles)
 		{
-			//COTSParticlePtr pParticleNew = COTSParticlePtr(new COTSParticle(*pParticle.get()));
-			//COTSParticlePtr pParticleNew = COTSParticlePtr(pParticle.get());
+		
 			m_listBigParticles.push_back(pParticle);
 		}
 	}

+ 18 - 5
OTSCPP/OTSImagePro/FieldMgr.cpp

@@ -663,11 +663,24 @@ namespace OTSIMGPROC {
 	BOOL CFieldMgr::IsInMeasuredFieldList(CPoint a_poiField, std::vector<CPoint> m_listHaveMeasuredFieldCentrePoints)
 	{
 		// has to not be in the measured field centre points list
-		auto itr = std::find(m_listHaveMeasuredFieldCentrePoints.begin(), m_listHaveMeasuredFieldCentrePoints.end(), a_poiField);
-		if (itr != m_listHaveMeasuredFieldCentrePoints.end())
-		{
-			// in the measured field centre points list, this is a measured field, return TRUE
-			return TRUE;
+		//auto itr = std::find(m_listHaveMeasuredFieldCentrePoints.begin(), m_listHaveMeasuredFieldCentrePoints.end(), a_poiField);
+		//if (itr != m_listHaveMeasuredFieldCentrePoints.end())
+		//{
+		//	// in the measured field centre points list, this is a measured field, return TRUE
+		//	return TRUE;
+		//}
+
+		for (CPoint pnt : m_listHaveMeasuredFieldCentrePoints)
+		{
+			double scanHeight = (double)m_ScanFieldSize * ((double)m_ResolutionSize.cy / (double)m_ResolutionSize.cx);
+			CPoint leftTop = CPoint(pnt.x - m_ScanFieldSize / 2, pnt.y + scanHeight / 2);
+			CPoint rightBottom = CPoint(pnt.x + m_ScanFieldSize / 2, pnt.y - scanHeight / 2);
+			
+			COTSRect rec = COTSRect(leftTop, rightBottom);
+			if (rec.PointInRect(a_poiField))
+			{
+				return true;
+			}
 		}
 
 		// ok, return FALSE

+ 1 - 1
OTSIncAMeasureApp/0-OTSModel/Measure/1-OTSInclution/SmplMeasureInclution.cs

@@ -31,7 +31,7 @@ namespace OTSModelSharp
 
       
 
-        public override void  ClassifyFieldParticles()
+        public override void  ClassifyFieldParticles(COTSFieldData curFldData)
         {
 
             try

+ 1 - 1
OTSIncAMeasureApp/0-OTSModel/Measure/2-OTSCleanliness/SmplMeasureCleanliness.cs

@@ -30,7 +30,7 @@ namespace OTSModelSharp
 
        
 
-        public override void ClassifyFieldParticles()
+        public override void ClassifyFieldParticles(COTSFieldData curFldData)
         {
            
             try

+ 4 - 4
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CMeasure.cs

@@ -161,11 +161,11 @@ namespace OTSModelSharp
            MsrMsg.STMThreadStu.iMsrStatu = m_ThreadStatus.GetStatus();
 
 
-            //MsrMsg.STMThreadStu.csMsrEndTime = timeEnd.ToShortDateString();
+        
             MsrMsg.STMThreadStu.csMsrEndTime = timeEnd.ToString("yyyy-MM-dd HH:mm:ss");
             ProgressEvent(MsrMsg);
-            //disconnect the semcontroller when we exit this task.
-            //m_SemController.DisConnect();
+         
+         
         }
         void ThreadOverWithoutDisConnect()
         {
@@ -179,7 +179,7 @@ namespace OTSModelSharp
 
             MsrMsg.STMThreadStu.iMsrStatu = m_ThreadStatus.GetStatus();
 
-            //MsrMsg.STMThreadStu.csMsrEndTime = timeEnd.ToShortDateString();
+          
             MsrMsg.STMThreadStu.csMsrEndTime = timeEnd.ToString("yyyy-MM-dd HH:mm:ss");
             ProgressEvent(MsrMsg);
         

+ 60 - 53
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMeasure.cs

@@ -40,7 +40,7 @@ namespace OTSModelSharp
         protected EDSController m_EDSHardwareMgr;
       
         protected Queue<COTSFieldData> fieldQueue=new Queue<COTSFieldData>();
-        protected COTSFieldData curFldData;
+        //protected COTSFieldData curFldData;
         protected IClassifyEngine m_classifyEngine;
         public CSmplMeasure()
         {
@@ -310,7 +310,7 @@ namespace OTSModelSharp
 
             m_strWorkingFolder = a_strWorkingFolder + m_Sample.GetName() + "\\";
         }
-        bool CalculateUnMeasuredFieldsCenters(out List<System.Drawing.Point> a_allpieldcenter,out List<System.Drawing.Point> a_listFieldCenter)
+        bool CalculateUnMeasuredFieldsCenters(out List<System.Drawing.Point> a_allpieldcenter,out List<System.Drawing.Point> a_listUnMsrFieldCenter)
         {       
 
             // sample measure parameters
@@ -329,13 +329,13 @@ namespace OTSModelSharp
             if (!pFieldMgr.Init(m_Sample.GetMsrArea(), poImageScanParam, poSEMDataMsr, listCompletedCenter))
             {
                 log.Error("CalculateFieldsCenters: failed to init field centres list manager.");
-                a_listFieldCenter = new List<System.Drawing.Point>();
+                a_listUnMsrFieldCenter = new List<System.Drawing.Point>();
                 a_allpieldcenter = new List<Point>();
                 return false;
             }
 
             // get field centers list
-            a_listFieldCenter = pFieldMgr.GetUnmeasuredFieldCentrePoints();// GetFieldCentrePoints();
+            a_listUnMsrFieldCenter = pFieldMgr.GetUnmeasuredFieldCentrePoints();// GetFieldCentrePoints();
 
             a_allpieldcenter = pFieldMgr.GetFieldCentrePoints();
 
@@ -512,7 +512,7 @@ namespace OTSModelSharp
         }
 
     
-        public virtual void ClassifyFieldParticles()
+        public virtual void ClassifyFieldParticles(COTSFieldData curFldData)
         {
             return;
         }
@@ -544,7 +544,7 @@ namespace OTSModelSharp
 
             public void Dispose()
             {
-                if (semState == null)
+                if (semState != null)
                 {
                     sm.MoveSEMToPoint(semState.Pos);
                     sm.m_SemHardwareMgr.SetMagnification(semState.Magnification);
@@ -619,19 +619,8 @@ namespace OTSModelSharp
               
 
                 m_pSampleRstFile.SetSEMStage(pStage);
-         
-                // calculate field centers
-                //List<System.Drawing.Point> umMeasuredlistFieldCenter;
-                //List<System.Drawing.Point> alllistFieldCenter;
-
-                //if (!CalculateUnMeasuredFieldsCenters(out alllistFieldCenter,out umMeasuredlistFieldCenter))
-                //{// failed to calculate field centers
-                //    log.Error("DoMeasure: failed to calculate field centers.");
-                //    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
-                //    // record end time
-                //    pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
-                //    return;
-                //}
+
+              
                 //-----save the static measure result file data into xml file and the dynamic data of every field will be saved into sqlite database
                 log.Info("Create result file!");
                 if (!m_pSampleRstFile.CreateResultFiles())
@@ -643,13 +632,35 @@ namespace OTSModelSharp
                 }
 
                 //------
+                List<System.Drawing.Point> umMeasuredlistFieldCenter;
+                List<System.Drawing.Point> allFieldCenter;
+
+                if (!CalculateUnMeasuredFieldsCenters(out allFieldCenter, out umMeasuredlistFieldCenter))
+                {// failed to calculate field centers
+                    log.Error("DoMeasure: failed to calculate field centers.");
+                    pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
+                    // record end time
+                    pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
+                    return;
+                }
+              
 
 
-                //int nNewFieldId = 0;
-                //int numOfAllFields = pStatus.GetCompletedFields() + umMeasuredlistFieldCenter.Count;//
-                //int completedFields = pStatus.GetCompletedFields();
-                //log.Info("Unmeasured fields:" + umMeasuredlistFieldCenter.Count);
                 var FldDatas = m_Sample.GetFieldsData();
+                if (FldDatas.Count < allFieldCenter.Count)
+                {
+                    // calculate field centers
+                    foreach (Point fldcenter in umMeasuredlistFieldCenter)
+                    {
+                        m_Sample.AddFieldData(fldcenter);
+                    }
+
+                    FldDatas = m_Sample.GetFieldsData();
+                }
+                
+
+
+
                 for (int i = 0; i < FldDatas.Count; ++i)
                 {// check and break if stop button is clicked
                    
@@ -673,7 +684,7 @@ namespace OTSModelSharp
 
                     // check if sample measurement completes
                     COTSImgScanPrm pScanParam = m_Sample.GetMsrParams().GetImageScanParam();
-                    //int nTotalFieldSize = (int)umMeasuredlistFieldCenter.Count;
+                 
 
 
 
@@ -748,25 +759,21 @@ namespace OTSModelSharp
                     {
 
                         // add the field into the field
-                        //m_pSampleRstFile.AddAField(curFldData);
+                   
                         curFld.SetIsMeasureComplete(true);
                        
                     }
 
 
-                 
-
-
-                    //++nNewFieldId;
 
                     double measuredArea = 0; // this area should be the field area
-                    var a_pBSEImg = curFldData.GetBSEImage();
+                    var a_pBSEImg = curFld.GetBSEImage();
 
-                    double dPixelSize = curFldData.GetPixelSize();
+                    double dPixelSize = curFld.GetPixelSize();
 
 
                         measuredArea = a_pBSEImg.GetHeight() * a_pBSEImg.GetWidth()* dPixelSize * dPixelSize + 0.5; //Get measured area
-                    if (!CumulateFieldData(curFldData.GetListAnalysisParticles(), measuredArea))
+                    if (!CumulateFieldData(curFld.GetListAnalysisParticles(), measuredArea))
                     { // failed to call SaveFieldFile method
                         log.Error("ImageProcess: call CumulateFieldData method.");
                         pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
@@ -783,7 +790,7 @@ namespace OTSModelSharp
                     MsgFieldEnd.STMSampleRetData.iRetDataType = MSAMPLE_RET.FIELD_DATA;
                     MsgFieldEnd.STMSampleRetData.SFieldData.iCompleteFieldCount = pStatus.GetCompletedFields();
                     MsgFieldEnd.STMSampleRetData.SFieldData.iMeasureFieldCount = m_Sample.GetFieldsData().Count;
-                    MsgFieldEnd.STMSampleRetData.SFieldData.iSParticleCount = (int)curFldData.GetListAnalysisParticles().Count;
+                    MsgFieldEnd.STMSampleRetData.SFieldData.iSParticleCount = (int)curFld.GetListAnalysisParticles().Count;
                     MsgFieldEnd.STMSampleRetData.SFieldData.FieldPos.X = Convert.ToInt32(poiFieldCentre.X);
                     MsgFieldEnd.STMSampleRetData.SFieldData.FieldPos.Y = Convert.ToInt32(poiFieldCentre.Y);
 
@@ -857,14 +864,14 @@ namespace OTSModelSharp
             //first step:remove background of the bse image and compound all the finded particles.
 
             log.Info("Begin to process image and get all particles!");
-            GetOriginalParticles();
+            GetOriginalParticles(ref curFldData);
 
             // second step :filter the finded particles.
             log.Info("Begin to filter particles!");
 
-            FilterParticles(curFldData);
+            FilterParticles(ref curFldData);
 
-            CalculateParticleAbsolutPos();
+            CalculateParticleAbsolutPos(ref curFldData);
 
             log.Info("Begin to Calculate the image property of every particle!");
             var analysisparts = curFldData.GetListAnalysisParticles();
@@ -886,19 +893,19 @@ namespace OTSModelSharp
 
 
             log.Info("Begin to classify particles! particle num:" + curFldData.GetListAnalysisParticles().Count);
-            ClassifyFieldParticles();
+            ClassifyFieldParticles(curFldData);
 
 
 
             // save field files
             m_Sample.GetMsrStatus().SetStatus(OTS_MSR_SAMPLE_STATUS.SUCCESSED);
 
-            StartSaveFileThread(curFldData);
+            StartSaveFileThread(ref curFldData);
 
             return true;
 
         }
-        public void GetOriginalParticles()
+        public void GetOriginalParticles(ref COTSFieldData curFldData)
         {
             // measure status
             CMsrSampleStatus pStatus = m_Sample.GetMsrStatus();
@@ -931,10 +938,10 @@ namespace OTSModelSharp
             }
             return;
         }
-        public void FilterParticles(COTSFieldData fld)
+        public void FilterParticles(ref COTSFieldData curFldData)
         {
 
-            if (fld.NoAnalysisParticle())
+            if (curFldData.NoAnalysisParticle())
             {
                 log.Warn("There's no analysis particles!");
                 return;
@@ -978,8 +985,8 @@ namespace OTSModelSharp
 
             double quantifyThreshold = m_Sample.GetMsrParams().GetXRayParam().GetFeatureModeMinSize();
 
-            var smallparts = fld.ListSmallParticles;
-            var bigparts = fld.ListBigParticles;
+            var smallparts = curFldData.ListSmallParticles;
+            var bigparts = curFldData.ListBigParticles;
 
 
             foreach (var part in listXray1)
@@ -996,15 +1003,15 @@ namespace OTSModelSharp
             }
 
 
-            fld.ListSmallParticles = smallparts;
-            fld.ListBigParticles = bigparts;
+            curFldData.ListSmallParticles = smallparts;
+            curFldData.ListBigParticles = bigparts;
             //fld.SmallParticlePercentage=percentage;
             log.Info("SmallQuantifyParts (<" + quantifyThreshold.ToString("f2") + "): " + smallparts.Count);
             log.Info("BigQuantifyParts (>=" + quantifyThreshold.ToString("f2") + "): " + bigparts.Count);
 
             return;
         }
-        public void CollectParticlesXrayData(COTSFieldData fld)
+        public void CollectParticlesXrayData(COTSFieldData curFldData)
         {
             // get x-ray parameters
             COTSXRayParam pXRayParam = m_Sample.GetMsrParams().GetXRayParam();
@@ -1014,14 +1021,14 @@ namespace OTSModelSharp
             List<COTSParticleClr> smallparts = new List<COTSParticleClr>();
             List<COTSParticleClr> bigparts = new List<COTSParticleClr>();
 
-            foreach (var p in fld.ListSmallParticles)
+            foreach (var p in curFldData.ListSmallParticles)
             {
                 if (p.IsXrayParticle())
                 {
                     smallparts.Add(p);
                 }
             }
-            foreach (var p in fld.ListBigParticles)
+            foreach (var p in curFldData.ListBigParticles)
             {
                 if (p.IsXrayParticle())
                 {
@@ -1402,14 +1409,14 @@ namespace OTSModelSharp
 
 
 
-            var cmds = pDBFileMgr.GetSavingIncADataToDBCmds(curFldData.GetListAnalysisParticles(), fldData.GetOTSPosition());
+            var cmds = pDBFileMgr.GetSavingIncADataToDBCmds(fldData.GetListAnalysisParticles(), fldData.GetOTSPosition());
 
             pDBFileMgr.ExecuteNonQueryBatch(ref cmds);
 
 
             CPosXrayDBMgr PosXrayDBMgr = pDBFileMgr.GetPosXrayDBMgr();
             var listAnalysisPosXray = new List<CPosXrayClr>();
-            foreach (var p in curFldData.GetListXrayParticles())
+            foreach (var p in fldData.GetListXrayParticles())
             {
                 listAnalysisPosXray.Add(p.GetXray());
             }
@@ -1449,7 +1456,7 @@ namespace OTSModelSharp
         }
 
 
-        protected void StartSaveFileThread(COTSFieldData a_pFieldMgr)
+        protected void StartSaveFileThread(ref COTSFieldData a_pFieldMgr)
         {
 
 
@@ -1468,7 +1475,7 @@ namespace OTSModelSharp
                 }
             }
         }
-        public void ParticleSpecialTreatment(COTSFieldData fld)
+        public void ParticleSpecialTreatment(ref COTSFieldData fld)
         {
             //we adopt such a strategy here:if some particles satisfy the predefined condition then we go through the second collecting with max EDS time,so that we got a more acurate result.
             Dictionary<COTSParticleClr, int> mapPartXray = new Dictionary<COTSParticleClr, int>();   //std.map<COTSParticlePtr, int> mapPartXray = new std.map<COTSParticlePtr, int>();
@@ -1502,7 +1509,7 @@ namespace OTSModelSharp
 
             }
         }
-        public void CalculateParticleAbsolutPos()
+        public void CalculateParticleAbsolutPos(ref COTSFieldData curFldData)
         {
             double dPixelSize = m_Sample.CalculatePixelSize();
             CSEMStageData pCSEMStageData = m_pMsrThread.GetProjResultData().GetSEMStageData();

+ 5 - 2
OTSIncAMeasureApp/0-OTSModel/Measure/3-MeasureFlow/CSmplMsrResult.cs

@@ -756,8 +756,11 @@ namespace OTSModelSharp
 
             
             Serialize(true, xmlDoc, root);
-
-            xmlDoc.Save(m_strRstFileName);
+            if (!File.Exists(m_strRstFileName))
+            {
+                xmlDoc.Save(m_strRstFileName);
+            }
+          
 
            
          

+ 12 - 11
OTSIncAMeasureApp/0-OTSModel/Measure/4-ReMeasure/SmplMeasureReMeasure.cs

@@ -22,7 +22,7 @@ namespace OTSMeasureApp._0_OTSModel.Measure._4_ReMeasure
         SemController sem = SemController.GetSEMController();
         ScanController scan = ScanController.GetScanController();
         EDSController eds = EDSController.GetEDSController();
-
+        COTSFieldData curFldData;
         public byte[] SetReFldInfo(string sampleName, CBSEImgClr a_pBSEImg)
         {
             OTSIncAMeasureAppForm aMeasureAppForm = (OTSIncAMeasureAppForm)Application.OpenForms["OTSIncAMeasureAppForm"];
@@ -31,21 +31,22 @@ namespace OTSMeasureApp._0_OTSModel.Measure._4_ReMeasure
             curFldData = new COTSFieldData(center, sampleClr.CalculatePixelSize());
             curFldData.SetId(0);
             curFldData.SetBSEImage(a_pBSEImg);
-            SetSample(sampleClr);
+            m_Sample = sampleClr;
+            m_pSampleRstFile.SetSample(sampleClr);
             return a_pBSEImg.GetImageDataPtr();
         }
 
-        public bool FindNewPartInfo(Particle particle)
-        {
-            GetOriginalParticles();
+        //public bool FindNewPartInfo(Particle particle)
+        //{
+        //    GetOriginalParticles();
 
-            foreach (COTSParticleClr item in curFldData.GetAllParticles())
-            {
+        //    foreach (COTSParticleClr item in curFldData.GetAllParticles())
+        //    {
 
-            }
+        //    }
 
-            return true;
-        }
+        //    return true;
+        //}
 
         public bool ReMeasure(string samplePath, int width, int height, Dictionary<int, List<Particle>> keyValues, int IMGSCANSPEED_INDEX, int XRAYSCANMODE_INDEX, int NUD_SCANTIME_COUNT)
         {
@@ -77,7 +78,7 @@ namespace OTSMeasureApp._0_OTSModel.Measure._4_ReMeasure
                 sQLiteHelper.BeginTransaction();
                 log.Info("Begin to process field count : " + keyValues.Count);
 
-                GetOriginalParticles();
+                GetOriginalParticles(ref curFldData);
 
 
                 //按帧图分析

+ 1 - 0
OTSIncAMeasureApp/0-OTSModel/Measure/DBDataTransition/IncADataDB.cs

@@ -155,6 +155,7 @@ namespace OTSModelSharp
                     ps.Add(p);
                     allFlds.Add(fld);
                     mapFld[curFldId] = fld;
+                    fld.SetIsMeasureComplete(true);
                 }
                 else
                 {

+ 20 - 19
OTSIncAMeasureApp/0-OTSModel/Measure/ParamData/COTSMsrPrjResultData.cs

@@ -368,9 +368,10 @@ namespace OTSModelSharp
                             }
                            
                         }
-                        completedflds.Add(fld.GetOTSPosition());
+                       
                         msrFldsArea += aFieldArea;
                     }
+                    completedflds.Add(fld.GetOTSPosition());
 
 
                 }
@@ -545,24 +546,24 @@ namespace OTSModelSharp
         public List<COTSSample> GetSampleList() { return m_listSamples; }
 
         // samples list
-        public bool SetSampleList(List<COTSSample> a_listSample, bool a_bClear/* = TRUE*/)
-        {
-            // clear samples list if necessary 
-            if (a_bClear)
-            {
-                m_listSamples.Clear();
-            }
-
-            // go through the sample list of the source
-            foreach (var pSample in a_listSample)
-            {
-
-                // add the new sample into sample list
-                m_listSamples.Add(pSample);
-            }
-
-            return true;
-        }
+        //public bool SetSampleList(List<COTSSample> a_listSample, bool a_bClear/* = TRUE*/)
+        //{
+        //    // clear samples list if necessary 
+        //    if (a_bClear)
+        //    {
+        //        m_listSamples.Clear();
+        //    }
+
+        //    // go through the sample list of the source
+        //    foreach (var pSample in a_listSample)
+        //    {
+
+        //        // add the new sample into sample list
+        //        m_listSamples.Add(pSample);
+        //    }
+
+        //    return true;
+        //}
 
         public COTSSample GetSampleByIndex(int a_nIndex)
         {

+ 2 - 6
OTSIncAMeasureApp/0-OTSModel/OTSDataType/CMsrSampleStatus.cs

@@ -109,7 +109,7 @@ namespace OTSDataType
                 m_timeStart == a_oSource.m_timeStart &&
                 m_timeUsed == a_oSource.m_timeUsed &&
                 m_timeStart == a_oSource.m_timeStart;
-                //m_nCompletedFields == a_oSource.m_nCompletedFields;
+              
         }
 
         // status
@@ -161,11 +161,7 @@ namespace OTSDataType
             return m_listCpltedCenter.Count;
         }
 
-        //public void SetCompletedFields(int a_nCompletedFields)
-        //{
-        //    m_nCompletedFields = a_nCompletedFields;
-        //}
-
+ 
         // completed fieldCenter
 
         public List<System.Drawing.Point> GetCompletedFieldsCenter()

+ 4 - 0
OTSIncAMeasureApp/0-OTSModel/OTSDataType/COTSSample.cs

@@ -447,6 +447,10 @@ namespace OTSDataType
             m_listFieldData.Add(newfld);
 
         }
+        public void ClearFields()
+        {
+            m_listFieldData.Clear();
+        }
         public int GetIdForANewField()
         {
             List<COTSFieldData> listFieldData = GetFieldsData();

+ 4 - 0
OTSIncAMeasureApp/0-OTSModel/OTSDataType/CSampleParam.cs

@@ -29,6 +29,10 @@ namespace OTSDataType
 
         public CSpecialGrayRangeParam GetSpecialGrayRangeParam()
         {
+            if (m_specialGrayRangeParam == null)
+            {
+                m_specialGrayRangeParam = new CSpecialGrayRangeParam();
+            }
            
             return m_specialGrayRangeParam;
         }

+ 11 - 10
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -280,7 +280,7 @@ namespace OTSMeasureApp
             }
         }
 
-        public void Rev_MeasureApp_OpenExistSampleFile_Event(CStage SStage, CSEMStageData SEMStageData, List<SampleMeasurePara> SMeasrueAreaList, string sWorkSampleName)
+        public void OpenExistSampleFile_Event(CStage SStage, CSEMStageData SEMStageData, List<SampleMeasurePara> SMeasrueAreaList, string sWorkSampleName)
         {
             GetSampleStageData(SStage, SEMStageData);
           var  SStageData = m_OTSSampleStageData;
@@ -3725,7 +3725,7 @@ namespace OTSMeasureApp
                     
                 }
 
-                //m_SEMDATAFieldManage.CloseSEM();
+               
             }
            
             #endregion
@@ -3829,7 +3829,7 @@ namespace OTSMeasureApp
                 pSEMDataMsr.SetMagnification(dMagnification);
              
             }
-            ////初始化
+            ////计算所有的帧图位置  calculate all the field position point in OTS coordination.
             if (!pFieldMgr.Init(pMsrArea, pImgScanParam, pSEMDataMsr, listPoint))
             {
                 return false;
@@ -3846,13 +3846,14 @@ namespace OTSMeasureApp
                 return false;
             }
             iSzie = oValue.Size;
-           
-           WSample.GetSEMDataMsr().SetTotalFields(iFieldCount);
-            foreach (Point fldcenter in pFields)
-            {
-                WSample.AddFieldData(fldcenter);
-            }
-            
+            //although we can initialize the fielddata infomation of one sample here ,but we shouldn't do it here,because this is in the module of HMI interface(view),we must abey the rules of MVC.
+            //WSample.GetSEMDataMsr().SetTotalFields(iFieldCount);
+            //WSample.ClearFields();
+            //foreach (Point fldcenter in pFields)
+            //{
+            //    WSample.AddFieldData(fldcenter);
+            //}
+
             return true;
         }
         #endregion

+ 4 - 3
OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

@@ -594,7 +594,7 @@ namespace OTSMeasureApp
                 return false;
             }
          
-            m_SamplepaceWindow.Rev_MeasureApp_OpenExistSampleFile_Event(m_ProjData.GetStage(), m_ProjData.GetSEMStageData(), SampleMeasureAreaList, sWSampleName);
+            m_SamplepaceWindow.OpenExistSampleFile_Event(m_ProjData.GetStage(), m_ProjData.GetSEMStageData(), SampleMeasureAreaList, sWSampleName);
             return true;
         }
         public bool OpenExistSampleMeasureArea(ref List<SampleMeasurePara> SampleMeasureAreaList)
@@ -1231,9 +1231,10 @@ namespace OTSMeasureApp
             
             if (ProjDataMgr.Load())
             {
-                m_ProjParam.SetResultData(ProjDataMgr);
-                m_ProjParam.InitResultData();
                 m_ProjData = ProjDataMgr;
+                m_ProjParam.SetResultData(m_ProjData);
+                m_ProjParam.InitResultData();
+               
                 bOpenFlag = true;
             }
             

+ 5 - 5
OTSIncAMeasureApp/ServiceCenter/IpcSEMController.cs

@@ -49,11 +49,11 @@ namespace OTSMeasureApp.ServiceCenter
             return true;
         }
 
-        public bool FindNewPartInfo(Particle particle)
-        {
-            measureReMeasure.FindNewPartInfo(particle);
-            return true;
-        }
+        //public bool FindNewPartInfo(Particle particle)
+        //{
+        //    measureReMeasure.FindNewPartInfo(particle);
+        //    return true;
+        //}
 
         public bool ReMeasure(string samplePath, int width, int height, Dictionary<int, List<Particle>> keyValues, int IMGSCANSPEED_INDEX, int XRAYSCANMODE_INDEX, int NUD_SCANTIME_COUNT)
         {