Bläddra i källkod

Merge branch 'dev' of http://192.168.1.123:10080/gaoshipeng/OTS2_0 into dev

CXS 5 år sedan
förälder
incheckning
5a8cab76f0

+ 5 - 104
OTS/OTSModelSharp/Measure/GetBSEPic/OTSFieldMgr.cs

@@ -752,106 +752,7 @@ namespace OTSModelSharp
             m_smallParticlePercentage = percentageOfWhole;
         }
 
-        public  bool GetFeatureList1(List<COTSSegment> a_listSegments, List<COTSFeature> a_listFeatures)
-        {
-            List<COTSSegment> listSegmentNew = new List<COTSSegment>();
-            Dictionary<long, List<COTSSegment>> mapOneLineSegments = new Dictionary<long, List<COTSSegment>>();
-            foreach(var s in a_listSegments)    
-            {
-                mapOneLineSegments[s.GetHeight()].Add(s);//sorting all the segments base on the line number.
-            }
-            var first = mapOneLineSegments.First();
-            Dictionary<long, List<COTSSegment>> lineItr = first.Value;
-               // mapOneLineSegments.Keys();//find the highest line
-            while (lineItr != mapOneLineSegments.Last())
-            {
-                for (var s = lineItr.Value.First; s < lineItr.Value.Last;)//find  one segment of this line.
-                {
-                    COTSSegment bottomSeg = *s;
-                    listSegmentNew.Clear();
-                    listSegmentNew.Add(s);
-                    s = lineItr.Value.Last.erase(s);
-                    Dictionary<List<long>, List<COTSSegment>> tempItr = lineItr;
-                    tempItr++;
-                    for (; tempItr != mapOneLineSegments.Last(); tempItr++)//find all other lines of segments
-                    {
-                        if (tempItr.First - bottomSeg.GetHeight > 1)
-                        {
-                            break;
-                        }
-
-                        for (var nextLineSegment = tempItr.Values.Last; nextLineSegment < tempItr.Values.Last;)//find next line's all segments
-                        {
-                            if (((*nextLineSegment)->GetStart() - (bottomSeg.GetStart() + bottomSeg.GetLength())) > 1)
-                            {
-                                break;
-                            }
-
-                            if (bottomSeg.UpDownConection(**nextLineSegment))
-                            {
-                                listSegmentNew.Add(*nextLineSegment);
-                                bottomSeg = *nextLineSegment;
-                                nextLineSegment = tempItr.Values.erase(nextLineSegment);
-                                break;
-                            }
-
-                            if (tempItr.Values.size() > 0)
-                            {
-                                nextLineSegment++;
-                            }
-                            else
-                            {
-                                break;
-                            }
-                        }
-
-                    }
-                    COTSFeature pFeature = new COTSFeature();
-                    pFeature.SetSegmentsList(listSegmentNew);
-                    //check if this new feature is connected with other found feature.
-                    COTSSegment topSeg = listSegmentNew[0];//find the toppest segment of this new feature.
-                    COTSSegment bottomSegment = listSegmentNew[listSegmentNew.Count - 1];//find the lowest segment of this new feature.
-
-                    bool haveMerged = false;
-                    foreach(var f in a_listFeatures)
-    
-                {
-                        foreach (var seg in f.GetSegmentsList())
-                        {
-                            if (bottomSegment.UpDownConection(seg) || topSeg.UpDownConection(seg))
-                            {
-                                List<COTSSegment> segs = f.GetSegmentsList();
-                                foreach (var s in listSegmentNew)
-                                {
-                                    segs.Add(s);
-
-                                }
-
-                                f.SetSegmentsList(segs);
-                                haveMerged = true;
-                                break;
-                            }
-                        }
-                        if (haveMerged)
-                        {
-                            break;
-                        }
-
-                    }
-                    if (!haveMerged)
-                    {
-                        a_listFeatures.Add(pFeature);
-                    }
-
-                    if (lineItr.second.size() == 0)
-                    {
-                        break;
-                    }
-                }
-                lineItr++;
-            }
-            return true;
-        }
+       
 
        public bool GetIncAParticleList(List<COTSParticle> a_listParticleOut)
         {
@@ -1067,11 +968,11 @@ namespace OTSModelSharp
             //2. save the temp feature
             List<COTSFeature> listFeature = new List<COTSFeature>();
             listFeature.Clear();
-		if (!GetFeatureList1(listSegment, listFeature))
-		{
+		//if (!GetFeatureList(listSegment, listFeature))
+		//{
 
-                return false;
-		}
+  //              return false;
+		//}
 
 
 		if ((int) listFeature.Count == 0)

+ 129 - 1
OTS/OTSModelSharp/Measure/GetBSEPic/SmplMeasure.cs

@@ -37,7 +37,13 @@ namespace OTSModelSharp
         public int cy;
     }
 
-
+    public enum  XRAY_TYPE
+    {
+        MIN = 0,
+		SEARCH = 0,
+		ANALYSIS = 1,
+		MAX = 1
+	}
     class SmplMeasure
     {
         protected static NLog.Logger loger = null;
@@ -92,6 +98,9 @@ namespace OTSModelSharp
         CFieldMgr FieldMgr = new CFieldMgr();
 
         COTSFieldMgr oTSFieldMgr = new COTSFieldMgr();
+
+        // X-Ray parameter,this is the initialization parameter
+        COTSXRayParam m_pXRayParam;
         public SmplMeasure()
         {
             if (loger == null)
@@ -310,6 +319,8 @@ namespace OTSModelSharp
             return true;
         }
 
+        // Sample hole BSE image list
+       public List<CHoleBSEImg> GetHoleBESImgList() { return m_listHoleBSEImg; }
         public void SetWorkingFolder(String a_strWorkingFolder)
         {
             // add "\\" at the string end if it is not "\\"
@@ -958,6 +969,44 @@ namespace OTSModelSharp
             m_pMsrThread.SendMessageToMeasureApp(MsgSmplEnd);
         }
 
+        // hardware control
+      public  COTSSemBase GetSEMControl()//Control中的方法
+      {
+            // SEM controller
+            COTSSemBase pSEMController = null;
+
+           
+            // get SEM controller
+            pSEMController = m_pMsrThread.GetSEMController();
+
+            // return SEM controller
+            return pSEMController;
+      }
+
+       public COTSScanBase GetScanControl()
+        {
+            // scan controller
+            COTSScanBase pScanController = null;
+
+            // get scan controller
+            pScanController = m_pMsrThread.GetScanController();
+
+            // return  scan controller
+            return pScanController;
+        }
+
+       public OTSEDSBase GetEDSControl()
+        {
+            // EDS controller
+            OTSEDSBase pEDSController = null;
+
+            // get EDS controller
+            pEDSController = m_pMsrThread.GetEDSController();
+
+            // return EDS controller
+            return pEDSController;
+        }
+
 
         // hole BSE images list
         void SetHoleBESImgList(CHoleBSEImgsList a_listHoleBSEImg, bool a_bClear/* = TRUE*/)
@@ -1606,5 +1655,84 @@ namespace OTSModelSharp
             }
             return true;
         }
+
+        // get x-ray acquire time
+       public bool GetXRayAcquireTime(XRAY_TYPE a_nXrayType, OTS_THREE_TIES_OPTIONS a_nXraySpeed, uint a_nXRayAQTime)
+        {
+            
+
+            // get project manager file
+            COTSProjMgrFile pOTSProjMgrFile = m_pMsrThread.GetProjMgrFile();
+           
+
+            // x-ray parameters
+            COTSXRayParam pXRayParam = pOTSProjMgrFile.GetXRayParam();
+           
+
+            a_nXRayAQTime = (uint)pXRayParam.GetMidAnalyAQTime();
+
+            // ok, return TRUE
+            return true;
+        }
+
+        // get x-rays
+       public bool GetXRayByPoints(List<CPosXray> a_listPosXRay, uint a_nXRayAQTime, bool a_bElementInfo /*= FALSE*/)
+        {
+            // get EDS controller
+            OTSEDSBase pEDSController = GetEDSControl();
+           
+
+            // init EDS controller
+            if (!pEDSController.Init())
+            {
+                loger.Error("GetXRayByFeatures: failed to inti EDS (%s).", pEDSController.GetName());
+                return false;
+            }
+            // set get quantify info flag, firstly only get x-ray data
+
+            if (!a_bElementInfo)
+            {
+                pEDSController.SetQuantification(false);
+            }
+            else
+            {
+                pEDSController.SetQuantification(true);
+            }
+
+            pEDSController.SetQuantification(true);
+            //if (!pEDSController->GetXRayByPoints(a_listPosXRay, a_nXRayAQTime))
+            //{
+            //	// failed to call EDS controller GetXRayByPoints method
+            //	LogErrorTrace(__FILE__, __LINE__, _T("GetXRayByPoints: failed to get EDS controller."));
+            //	return FALSE;
+            //}
+
+            List<CPosXray> listXRayPointsTemp = new List<CPosXray>();
+            CPosXray pXRayPointTemp = new CPosXray();
+            listXRayPointsTemp.Add(pXRayPointTemp);
+
+
+            pEDSController.SetQuantification(true);
+            for (int i = 0; i < (int)a_listPosXRay.Count; i++)
+            {
+                listXRayPointsTemp[0] = a_listPosXRay[i];
+
+
+                if (!pEDSController.GetXRayByPoints(listXRayPointsTemp, a_nXRayAQTime))
+                {
+                    loger.Error("GetXRayByPoints: failed to get element.");
+                    //return FALSE;
+                }
+
+                a_listPosXRay[i] = listXRayPointsTemp[0];
+            }
+
+
+
+            // ok, return TRUE
+            return true;
+        }
+
+
     }
 }

+ 7 - 3
OTS/OTSModelSharp/Measure/GetBSEPic/SmplMsrResultFile.cs

@@ -280,7 +280,8 @@ namespace OTSModelSharp
        //public bool GetSTDMapedParticleList(Dictionary<string, List<COTSParticle>> mapSameSTDPartList)
        // {
        //     //把颗粒根据类型分组,类型 ID做key,颗粒列表做value
-       //     Dictionary <string, List<COTSParticle>> partListIter;
+
+       //     Dictionary < string, List<COTSParticle>> partListIter;
        //     var listParticle = GetAllParticles();
        //     //get the same type particle together
        //     foreach (var pParticle in listParticle)
@@ -290,17 +291,20 @@ namespace OTSModelSharp
        //         //只有"NOT_IDENTIFIED"以上的颗粒类型需要考虑
        //         if (nType >= (int)OTS_PARTCLE_TYPE.NOT_IDENTIFIED_SIC)
        //         {
+
        //             partListIter = mapSameSTDPartList;                       
        //             if (partListIter == mapSameSTDPartList)
        //             {
        //                 List<COTSParticle> listParticles = new List<COTSParticle>();
        //                 listParticles.Add(pParticle);
-       //                 mapSameSTDPartList.Add(new KeyValuePair<string, List<COTSParticle>>(sType, listParticles));
+       //                 mapSameSTDPartList.Insert(new KeyValuePair<string, List<COTSParticle>>(sType, listParticles));
+                           
        //             }
        //             else
        //             {
-       //                 partListIter.Values.Append<pParticle>;
+       //                 partListIter.Values.Add(pParticle);
        //             }
+
        //         }
 
        //     }

+ 13 - 0
OTS/OTSModelSharp/Measure/GetParam/COTSProjMgrFile.cs

@@ -88,6 +88,9 @@ namespace OTSModelSharp
 
         int IDS_DEFAULT = 12330;
 
+        // measure thread
+        MsrThread m_pMsrThread;
+
         public COTSProjMgrFile()
         {
             Init();
@@ -111,6 +114,13 @@ namespace OTSModelSharp
 
         }
 
+        // check if measurement is aborted
+       public bool IsAborted()
+        {
+           
+            return m_pMsrThread.IsMeasureStopped();
+        }
+
         public void OTSProjMgrFile(COTSProjMgrFile a_oSource)
         {
             // can't copy itself
@@ -2017,5 +2027,8 @@ namespace OTSModelSharp
             }
             return true;
         }
+
+        // get XRay parameter
+        public COTSXRayParam GetXRayParam() { return m_pXRayParam; }
     }
 }