Browse Source

修改添加处理调用接口问题

sunyi 5 years ago
parent
commit
e015dc579d

+ 2 - 39
OTS/OTSModelSharp/Measure/GetBSEPic/MsrThread.cs

@@ -261,43 +261,7 @@ namespace OTSModelSharp
             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)
         {
@@ -316,8 +280,7 @@ namespace OTSModelSharp
             //return engine;
             return "";
         }
-        string libname = "";
-        public string GetParticleEngine(string libname) { return ""; }
+       
 
         bool SetWorkingFolderStr()
         {

+ 1 - 1
OTS/OTSModelSharp/Measure/GetBSEPic/OTSFieldMgr.cs

@@ -2,7 +2,7 @@
 using OTSIncAMeasureApp.OTSMeasureControl;
 using OTSModelSharp.DTL;
 using OTSModelSharp.MeasureControl;
-using OTSModelSharp.OTSControl;
+//using OTSModelSharp.OTSControl;
 using System;
 using System.Collections.Generic;
 using System.Drawing;

+ 34 - 16
OTS/OTSModelSharp/Measure/GetBSEPic/SmplMeasure.cs

@@ -1740,7 +1740,7 @@ namespace OTSModelSharp
             // ok, return TRUE
             return true;
         }
-        bool GetXRayByFeatures(List<COTSParticle> a_listParticles, int a_nXRayAQTime, bool a_bElementInfo /*= FALSE*/)
+      public  bool GetXRayByFeatures(List<COTSParticle> a_listParticles, int a_nXRayAQTime, bool a_bElementInfo /*= FALSE*/)
         {
             // get EDS controller
             IEDSController pEDSController = GetEDSControl();
@@ -1798,7 +1798,7 @@ namespace OTSModelSharp
 
                 // get the features list of the particles
                 List<CPosXray> listPosXRay=new List<CPosXray>();
-                List<OTSIncAMeasureApp.OTSMeasureControl.BrukerSegment> listBrukerFeatures = new List<BrukerSegment>();//covert these particles into brukerfeatures.
+               List< List<OTSIncAMeasureApp.OTSMeasureControl.BrukerSegment>> listBrukerFeatures = new List<List<BrukerSegment>>();//covert these particles into brukerfeatures.
                 foreach (var pPart in listPosXRayTemp)
                 {
                     if (pPart.GetXrayInfo() == null)
@@ -1806,34 +1806,52 @@ namespace OTSModelSharp
                         continue;
                     }
                     var pFeature = pPart.GetFeature();
-                    List<`COTSSegments> listSegment = pFeature->GetSegmentsList();
+                    List<COTSSegment> listSegment = pFeature.GetSegmentsList();
 
-                    std::vector<BrukerSegment> listBrukSegment;
-                    for (auto Segment : listSegment)
+                    List<BrukerSegment> listBrukSegment = new List<BrukerSegment>();
+                    foreach (var Segment in listSegment)
                     {
                         BrukerSegment BrukSeg;
-                        BrukSeg.XCount = Segment->GetLength();
-                        BrukSeg.Y = Segment->GetHeight();
-                        BrukSeg.XStart = Segment->GetStart();
-                        listBrukSegment.push_back(BrukSeg);
+                        BrukSeg.XCount = Segment.GetLength();
+                        BrukSeg.Y = Segment.GetHeight();
+                        BrukSeg.XStart = Segment.GetStart();
+                        listBrukSegment.Add(BrukSeg);
                     }
 
-                    listBrukerFeatures.push_back(listBrukSegment);
-                    listPosXRay.push_back(pPart->GetXrayInfo());
+                    listBrukerFeatures.Add(listBrukSegment);
+                    listPosXRay.Add(pPart.GetXrayInfo());
                 }
 
-                if (listPosXRay.size() > 0)
+                if (listPosXRay.Count > 0)
                 {
-                    if (!pEDSController->GetXRayByFeatures(listPosXRay, listBrukerFeatures, a_nXRayAQTime))
+                    if (!pEDSController.GetXRayByFeatures(ref listPosXRay,ref  listBrukerFeatures, a_nXRayAQTime))
                     {
-                        LogErrorTrace(__FILE__, __LINE__, _T("GetXRayByFeatures: failed to get xray by features."));
-                        return FALSE;
+                        loger.Error("GetXRayByFeatures: failed to get xray by features.");
+                        return false;
                     }
                 }
             }
 
 
-            return TRUE;
+            return true;
+        }
+
+        // save a field
+      public  bool SaveSampleFile()
+        {
+
+
+            // save the file
+            String strPathName = m_pSmplMsrResultFileMgr.GetPathName();
+            if (!m_pSmplMsrResultFileMgr.Save(strPathName))
+            {
+                // failed to save the file
+                loger.Error("SaveAField: failed to save the file.");
+                return false;
+            }
+
+            // ok, return TRUE
+            return true;
         }
     }
 }

+ 7 - 4
OTS/OTSModelSharp/Measure/GetBSEPic/SmplMeasureInc.cs

@@ -13,6 +13,8 @@ namespace OTSModelSharp.MeasureControl
     {
         // system STD
         bool m_bSysSTD;
+
+        SmplMeasure smplMeasure = new SmplMeasure();
         public CSmplMeasureInc()
         {
 
@@ -212,7 +214,7 @@ namespace OTSModelSharp.MeasureControl
             }
             // get x-ray list (analysis) by particle features
             nXRayAQTime = (uint)pXRayParam.GetMidAnalyAQTime();
-            if (!GetXRayByFeatures(listQuantifyParticles, listAnalysisXRay, nXRayAQTime, true))
+            if (!GetXRayByFeatures(listQuantifyParticles, (int)nXRayAQTime, true))
             {
                 loger.Error("ImageProcess: call GetXRayByFeatures method.");
                 pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
@@ -244,7 +246,8 @@ namespace OTSModelSharp.MeasureControl
                     partsMax.Add(p.Key);
                 }
                 List<CPosXray> maxEDSXrays = new List<CPosXray>();
-                if (!m_HardwareMgr.GetEDSControl().GetXRayByFeatures(partsMax, maxEDSXrays, edsTime, true))
+              List< List<BrukerSegment>> brukerSegment = new List<List<BrukerSegment>>();
+                if (!m_HardwareMgr.GetEDSControl().GetXRayByFeatures(ref  maxEDSXrays,ref brukerSegment,Convert.ToInt32(edsTime)))
                 {
                     loger.Error("ImageProcess: call GetXRayByFeatures method for MaxEDS");
                     pStatus.SetStatus(OTS_MSR_SAMPLE_STATUS.FAILED);
@@ -275,7 +278,7 @@ namespace OTSModelSharp.MeasureControl
             nXRayAQTime = (uint)pXRayParam.GetFastXrayTime();
 
             // get x-ray list (analysis) by points
-            if (!m_HardwareMgr.GetEDSControl().GetXRayByPoints(listFastCompareXRay, nXRayAQTime, true))
+            if (!m_HardwareMgr.GetEDSControl().GetXRayByPoints(ref listFastCompareXRay, (int)nXRayAQTime))
             { // failed to call GetXRayByPoints method
 
 
@@ -361,7 +364,7 @@ namespace OTSModelSharp.MeasureControl
                 {
                     COTSFieldMgr f = fieldQueue.Dequeue();
                     double pixelSize = 0;
-                    this.m_HardwareMgr.GetEDSControl().GetPixelSize(ref pixelSize);
+                    smplMeasure.GetPixelSize(ref pixelSize);
                     try
                     {
                         f.CalIncAParticleImageProp(pixelSize);

+ 1 - 0
OTS/OTSModelSharp/Measure/GetBSEPic/SmplMsrResultFile.cs

@@ -164,6 +164,7 @@ namespace OTSModelSharp
             m_listFieldData.Clear();
             foreach(COTSFieldData pFieldData in a_listFieldData)
             {
+                COTSFieldData pFieldDataNew = pFieldData;
                 m_listFieldData.Add(pFieldData);
             }
         }

+ 14 - 0
OTS/OTSModelSharp/Measure/GetBSEPic/SmplMsrResultFileMgr.cs

@@ -921,6 +921,9 @@ namespace OTSModelSharp
             return true;
         }
 
+        // get particle STD data
+       
+
         public void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
         {
             xInt xnFileMark = new xInt();
@@ -1300,6 +1303,17 @@ namespace OTSModelSharp
                 }
 
                 List<CPosXray> listAnalysisXray = pPosAnalysisXrayFileMgr.GetPosXrayList();
+
+                foreach (var xray in listAnalysisXray)
+                {
+                    foreach (var p in listParticle)
+                    {
+                        if (p.GetAnalysisId() == xray.GetIndex())
+                        {
+                            p.SetXrayInfo(xray);
+                        }
+                    }
+                }
                 pFieldMgr.SetAnalysisPosXayList(listAnalysisXray,true);
 
                 SetAnalysisXrayToList(listAnalysisXray);

+ 60 - 20
OTS/OTSModelSharp/Measure/GetParam/COTSProjMgrFile.cs

@@ -1,6 +1,7 @@
 using OTSDataType;
 using OTSIncAMeasureApp.OTSMeasureControl;
 using OTSModelSharp.DTL;
+using OTSModelSharp.MeasureControl;
 using System;
 using System.Collections.Generic;
 using System.Drawing;
@@ -91,6 +92,8 @@ namespace OTSModelSharp
         // measure thread
         MsrThread m_pMsrThread;
 
+        IClassifyEngine m_engine;
+
         public COTSProjMgrFile()
         {
             Init();
@@ -578,6 +581,27 @@ namespace OTSModelSharp
 
         }
 
+        // file name
+       public String GetFileName()
+        {
+            // make a copy of file path name
+            String strPathName = m_strPathName;
+
+            // is this a new file?
+            strPathName.Trim();
+            if (strPathName.CompareTo(UNTITLED_FILE_NAME) == 0)
+            {
+                return strPathName;
+            }
+
+            // get file name
+            String strFileName = GetFileNameWithoutExtension(strPathName);
+            strFileName = GetFileName(strFileName);
+
+            // return file name
+            return strFileName;
+        }
+
         // SEM stage data
         public CSEMStageData GetSEMStageData() { return m_pSEMStageData; }
 
@@ -913,6 +937,7 @@ namespace OTSModelSharp
 
         public bool DeleteSampleByIndex(int a_nIndex)
         {
+            String strSamplePath = GetFolderName(m_strPathName);
             // check the index
             if (a_nIndex < 0 || a_nIndex >= (int)m_listSamples.Count)
             {
@@ -1413,26 +1438,7 @@ namespace OTSModelSharp
         // get modify flag
         public bool IsModified() { return m_bModify; }
 
-        // file name
-        public String GetFileName()
-        {
-            // make a copy of file path name
-            String strPathName = m_strPathName;
-
-            // is this a new file?
-            strPathName.Trim();
-            if (strPathName.CompareTo(UNTITLED_FILE_NAME) == 0)
-            {
-                return strPathName;
-            }
-
-            // get file name
-            String strFileName = GetFileNameWithoutExtension(strPathName);
-            strFileName = GetFileName(strFileName);
-
-            // return file name
-            return strFileName;
-        }
+        
 
         // get file name without extension
         public String GetFileNameWithoutExtension(String a_strPathName)
@@ -1842,7 +1848,41 @@ namespace OTSModelSharp
             return true;
         }
 
+       public bool ReClassify()
+        {
+            foreach (var spl in m_listSamples)
+            {
+                String strFilePath = GetFolderName(m_strPathName);
+                String strFieldFileSubFolder = strFilePath + "\\" + spl.GetName() + "\\" + SMPL_MSR_RESULT_FIELDS_FILE_SUBFOLDER + "\\";
+
+                String strIncAFilename = strFieldFileSubFolder + "\\" + SMPL_MSR_RESULT_INCLUSION_FILE;
+                CIncAFileMgr pIncAFileMgr = new CIncAFileMgr(strIncAFilename);
+
+
+                foreach (var fld in spl.GetFieldsData())
+                {
+                    foreach (var part in fld.GetParticleList())
+                    {
+                        string libname = spl.GetMsrParams().GetSTDName();
+                        IClassifyEngine engine = GetParticleEngine(libname);
+                       
+                        if (!engine.Classify(part, part.GetXrayInfo()))
+                        {
+                            // invalid x-ray pointer.
+                            Nloger.Error("ClassifyParticle: can't identify the particle as any particle.");
+                            /*return FALSE;*/
+                        }
+                    }
+                    pIncAFileMgr.SetParticleList(fld.GetParticleList(), true);
+                    pIncAFileMgr.UpdateIncAList();
+                }
+
+            }
+
+            return true;
+        }
 
+        public IClassifyEngine GetParticleEngine(string libname) { return m_engine; }
 
         public COTSGeneralParameters GetDefaultParameters() { return m_DefaultParameters; }
 

+ 1 - 0
OTS/OTSModelSharp/Measure/GetParam/MsrParamFileMgr.cs

@@ -226,6 +226,7 @@ namespace OTSModelSharp
             // initialization
             Init();
             // copy data over
+            m_poMsrParams = new CMsrParams(a_oSource.m_poMsrParams);
         }
     }
 }

+ 17 - 0
OTS/OTSModelSharp/Measure/GetParticle/IncAFileMgr.cs

@@ -188,6 +188,23 @@ namespace OTSModelSharp
             return m_pSmallPartInfoDB;
         }
 
+        public  bool UpdateIncAList()
+        {
+            var IncADataDB = GetIncADB();
+            IncADataDB.GetDatastore().CloseSynchronous();
+            IncADataDB.GetDatastore().BeginTransaction();
+            foreach (var pParticle in m_listParticle)
+            {
+                if (!IncADataDB.UpdataAIncA(pParticle))
+                {
+
+                    return false;
+                }
+            }
+            IncADataDB.GetDatastore().CommitTransaction();
+            return true;
+        }
+
         //Get DB
         public   CIncAFileMgr  GetIncADB()
         {

+ 1 - 1
OTS/OTSModelSharp/MeasureControl/IClassifyEngine.cs

@@ -15,7 +15,7 @@ namespace OTSModelSharp.MeasureControl
 
         bool Classify(COTSParticle particle, CPosXray xray);
 
-       
+        
 
     }
 }