Przeglądaj źródła

write the field position into the xml measure result file

CXS 3 lat temu
rodzic
commit
572d4043db

+ 1 - 1
Bin/x64/Debug/Config/SysData/OTSProgMgrParam.pmf

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<XMLData RunMode="ProfessionalMode" SysType="CleanlinessA">
+<XMLData RunMode="ProfessionalMode" SysType="IncA">
   <Member RegName="GenParam" DefaultArea="100" DefaultSampleName="Sample" DefaultShape="0" MeasParamFileFolderName=".\Config\ProData\" MeasSwitch="true" PartSTDLibFolderName=".\Config\SysData\" PropertyDisplayMode="0" StdLibFileName="OTSCleanlinessSTD2" StdLibTypeIndex="0" SteelTechnology="0" UseSysSTD="true" />
   <Member RegName="ImageProcParam" m_autoBGRemoveType="0" m_BGRemoveType="0">
     <Member RegName="BGGray" end="255" start="150" />

+ 24 - 16
OTSIncAMeasureApp/0-OTSModel/Measure/GetBSEPic/CSmplMeasure.cs

@@ -245,7 +245,7 @@ namespace OTSModelSharp
 
             m_strWorkingFolder = a_strWorkingFolder + m_Sample.GetName() + "\\";
         }
-        bool CalculateUnMeasuredFieldsCenters(out List<System.Drawing.Point> a_listFieldCenter)
+        bool CalculateUnMeasuredFieldsCenters(out List<System.Drawing.Point> a_allpieldcenter,out List<System.Drawing.Point> a_listFieldCenter)
         {       
 
             // sample measure parameters
@@ -265,12 +265,15 @@ namespace OTSModelSharp
             {
                 log.Error("CalculateFieldsCenters: failed to init field centres list manager.");
                 a_listFieldCenter = new List<System.Drawing.Point>();
+                a_allpieldcenter = new List<Point>();
                 return false;
             }
 
             // get field centers list
             a_listFieldCenter = pFieldMgr.GetUnmeasuredFieldCentrePoints();// GetFieldCentrePoints();
 
+            a_allpieldcenter = pFieldMgr.GetFieldCentrePoints();
+
             // ok, return TRUE
             return true;
 
@@ -508,28 +511,32 @@ 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())
+                if (!m_pSampleRstFile.CreateResultFiles(alllistFieldCenter))
                 {// failed to call measure result file Save method
                     log.Error("DoMeasure: failed to call measure result file Save method.");
                     pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
                     pStatus.ComputeTime(OTS_MSR_TIME_TYPE.STOPPED);
                     return;
                 }
+
                 //------
-                // calculate field centers
-                List<System.Drawing.Point> umMeasuredlistFieldCenter;
-              
-                if (!CalculateUnMeasuredFieldsCenters(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();
@@ -691,7 +698,7 @@ namespace OTSModelSharp
               
            
                 SaveMergedParticles(mergedParticles);
-
+          
 
 
                 pStatus.ComputeTime(OTS_MSR_TIME_TYPE.COMPLT);
@@ -773,8 +780,9 @@ namespace OTSModelSharp
 
                 // calculate field centers
                 List<System.Drawing.Point> listFieldCenter=new List<System.Drawing.Point>();
-               // listFieldCenter.clear();
-                if (!CalculateUnMeasuredFieldsCenters(out listFieldCenter))
+                List<System.Drawing.Point> alllistFieldCenter = new List<System.Drawing.Point>();
+                // listFieldCenter.clear();
+                if (!CalculateUnMeasuredFieldsCenters(out alllistFieldCenter,out listFieldCenter))
                 {// failed to calculate field centers
                     log.Error("DoHolePreview: failed to calculate field centers.");
                     pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);

+ 24 - 10
OTSIncAMeasureApp/0-OTSModel/Measure/GetBSEPic/CSmplMsrResult.cs

@@ -71,7 +71,7 @@ namespace OTSModelSharp
         COTSSample m_pSample;
         // switch
         bool m_bSwitch;
-
+        List<Point> allfieldcenters;
 
 
         public CIncAFileMgr DBFileMgr { get => m_DBFileMgr; set => m_DBFileMgr = value; }
@@ -82,6 +82,7 @@ namespace OTSModelSharp
         {
             Init();
             m_pSample = new COTSSample();
+            allfieldcenters = new List<Point>();
         }
         protected void Duplicate(CSmplMsrResult a_oSource)
         {
@@ -238,7 +239,7 @@ namespace OTSModelSharp
             xInt xnFileMark = new xInt();
             xString xnVersion = new xString();
             xBool xbSwitch = new xBool();
-            Collection<COTSFieldData> xfields = new Collection<COTSFieldData>();
+            Collection<Slo> xfields = new Collection<Slo>();
             Slo slo = new Slo();
             slo.Register("FileMark", xnFileMark);
             slo.Register("Version", xnVersion);
@@ -255,10 +256,21 @@ namespace OTSModelSharp
                 xbSwitch.AssignValue(m_bSwitch);
 
 
-                /*for (auto pFildData :  m_pSample.GetFieldsData())
+                for(int i=0;i<allfieldcenters.Count;i++)
                 {
-                    xfields.addItem(pFildData.get());
-                }*/
+                    Slo flddata = new Slo();
+                    xInt id = new xInt();
+                    xInt fldx = new xInt();
+                    xInt fldy = new xInt();
+                    id.AssignValue( i);
+                    var p = allfieldcenters[i];
+                    fldx.AssignValue( p.X);
+                    fldy .AssignValue( p.Y);
+                    flddata.Register("ID", id);
+                    flddata.Register("FieldX", fldx);
+                    flddata.Register("FieldY", fldy);
+                    xfields.addItem(flddata);
+                }
                 slo.Serialize(true, classDoc, rootNode);
             }
             else
@@ -267,10 +279,10 @@ namespace OTSModelSharp
                 m_bSwitch = xbSwitch.value();
                 m_strFileVersion = xnVersion.value();
                 // m_pSample.GetFieldsData();
-                /*for (unsigned int i = 0;i < xfields.size(); i++)
-                {
-                     m_pSample.GetFieldsData().push_back(COTSFieldDataPtr(xfields.getItem(i)));
-                }*/
+                //for (unsigned int i = 0; i < xfields.size(); i++)
+                //{
+                //    m_pSample.GetFieldsData().push_back(COTSFieldDataPtr(xfields.getItem(i)));
+                //}
             }
         }
         private bool InitFolders()
@@ -762,7 +774,7 @@ namespace OTSModelSharp
 
 
         // Save 
-        public bool CreateResultFiles()
+        public bool CreateResultFiles(List<Point> listallfldcenter)
         {
             InitFolders();
 
@@ -776,6 +788,8 @@ namespace OTSModelSharp
             //xmlDoc.LoadXml(a_strPathname);
 
             XmlNode root = xmlDoc.SelectSingleNode("XMLData");
+
+            allfieldcenters = listallfldcenter;
             Serialize(true, xmlDoc, root);
 
             xmlDoc.Save(m_strRstFileName);