浏览代码

解决缺失文件问题

sunyi 5 年之前
父节点
当前提交
576b81307a

+ 16 - 0
OTS/OTSModelSharp/COTSEDSBrucker.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OTSModelSharp
+{
+   public  class COTSEDSBrucker
+    {
+        // constructor
+      public  COTSEDSBrucker()
+	{
+	}
+}
+}

+ 190 - 0
OTS/OTSModelSharp/COTSHardwareMgr.cs

@@ -0,0 +1,190 @@
+using OTSDataType;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+using static OTSModelSharp.COTSHardwareMgr;
+
+namespace OTSModelSharp
+{
+  public   class COTSHardwareMgr
+    {
+        OTSEDSBase m_EDSPtr;
+
+        String  szEdsName = "";
+
+        //XML文件名
+        public String szXMLFileName = "./Config/ProData/HardwareConfig.xml";
+
+        String szSemName = "";
+
+        string[] lpEdsName = { "OffLine", "Bruker", "Oxford" };
+
+        COTSScanBase m_SCanPtr;
+
+
+        public enum  EDSDevID
+        {
+            Invalid = -1,
+	        OFFLINE = 0,
+	        BRUKER = 1,
+	        OXFORD = 2,
+        }
+        
+        public  OTSEDSBase GetEDSControllerPtr()
+        {
+
+            if (null == m_EDSPtr)
+            {
+                int iDevID = -1;
+                if (szEdsName == "")
+                {
+                    if (!this.GetXMLVal(szXMLFileName, szSemName, szEdsName))
+                    {
+                        return null;
+                    }
+                }
+               
+
+                iDevID = this.GetEDSControllerID(szEdsName);
+                switch (iDevID)
+                {
+                    case (int)EDSDevID.BRUKER:
+                        {
+
+                            m_EDSPtr = new OTSEDSBase();
+                            
+
+                            break;
+                        }
+                    case (int)EDSDevID.OFFLINE:
+                        {
+
+                            m_EDSPtr = new OTSEDSBase();
+
+
+
+                            break;
+                        }
+                    case (int)EDSDevID.OXFORD:
+                        {
+
+                            m_EDSPtr = new OTSEDSBase();
+
+
+
+                            break;
+                        }
+                    default:
+
+                        break;
+                }
+            }
+
+
+            return m_EDSPtr;
+
+        }
+
+       public bool GetXMLVal(String szXmlFileName, String szSemName, String  szEdsName)
+	   {
+
+        XmlDocument doc = new XmlDocument();
+        doc.Load(szXmlFileName);//载入xml文件
+        xString szS = new xString();
+        xString szE = new xString();
+
+        Slo subClass = new Slo();
+        Slo subClass1 = new Slo();
+        subClass.Register("drive", szS);
+		subClass1.Register("drive",szE);
+		subClass.Register("SemControllerName", subClass);
+		
+		subClass.Register("EDSName",subClass1);
+
+
+		XmlNode rootNode;
+        rootNode = doc.FirstChild;
+     
+		subClass.Serialize(false, doc, rootNode);
+        szSemName = szS.value().ToString();
+        szEdsName = szE.value().ToString();
+		return true;
+
+       }
+
+        public XmlElement FirstChildElement(string value)	{
+        return this.FirstChildElement(value );
+    }
+
+        //return array Index when ControllerName match for name in array 
+       public int GetEDSControllerID(String  EDSControllerName)
+	   {
+		int iLen = lpEdsName.Length ;
+
+		int i = 0;
+		for (i = 0; i<iLen; i++)
+		{
+			if (0 == string.Compare(lpEdsName[i], EDSControllerName))
+			{
+				return i;
+			}
+        }
+      
+		return -1;
+
+	   }
+
+       public COTSScanBase GetScanControllerPtr()
+        {
+
+            if (null == m_SCanPtr)
+            {
+                int iDevID = -1;
+
+                if (szEdsName == "")
+                {
+                    if (!this.GetXMLVal(szXMLFileName, szSemName, szEdsName))
+                    {
+                        return null;
+                    }
+                }
+
+              
+                iDevID = this.GetEDSControllerID(szEdsName);
+
+                switch (iDevID)
+                {
+                    case (int)EDSDevID.BRUKER:
+                        {
+
+                            m_SCanPtr = new COTSScanBase();
+                            
+                            break;
+                        }
+                    case (int)EDSDevID.OFFLINE:
+                        {
+                            m_SCanPtr = new COTSScanBase();
+
+                            break;
+                        }
+                    case (int)EDSDevID.OXFORD:
+                        {
+                            m_SCanPtr = new COTSScanBase();
+
+                            break;
+                        }
+                    default:
+
+                        break;
+                }
+            }
+
+            return m_SCanPtr;
+        }
+
+
+    }
+}

+ 12 - 0
OTS/OTSModelSharp/COTSScanBase.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OTSModelSharp
+{
+   public  class COTSScanBase
+    {
+    }
+}

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

@@ -752,106 +752,106 @@ 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();
-        //    KeyValuePair<long, List<COTSSegment>> lineItr = first.Value;
-        //        mapOneLineSegments.Keys();//find the highest line
-        //    while (lineItr != mapOneLineSegments.Last())
-        //    {
-        //        for (var s = lineItr.Values.First; s < lineItr.second.end();)//find  one segment of this line.
-        //        {
-        //            COTSSegment bottomSeg = *s;
-        //            listSegmentNew.Clear();
-        //            listSegmentNew.Add(s);
-        //            s = lineItr.second.erase(s);
-        //            Dictionary<List<long>, List<COTSSegment>> tempItr = lineItr;
-        //            tempItr++;
-        //            for (; tempItr != mapOneLineSegments.end(); tempItr++)//find all other lines of segments
-        //            {
-        //                if (tempItr.first - bottomSeg.GetHeight() > 1)
-        //                {
-        //                    break;
-        //                }
-
-        //                for (var nextLineSegment = tempItr.second.begin(); nextLineSegment < tempItr.second.end();)//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.second.erase(nextLineSegment);
-        //                        break;
-        //                    }
+        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;
+                        }
 
-        //                    if (tempItr.second.size() > 0)
-        //                    {
-        //                        nextLineSegment++;
-        //                    }
-        //                    else
-        //                    {
-        //                        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)
+                    }
+                    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;
-        //                }
+                {
+                        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 (!haveMerged)
+                    {
+                        a_listFeatures.Add(pFeature);
+                    }
 
-        //            if (lineItr.second.size() == 0)
-        //            {
-        //                break;
-        //            }
-        //        }
-        //        lineItr++;
-        //    }
-        //    return true;
-        //}
+                    if (lineItr.second.size() == 0)
+                    {
+                        break;
+                    }
+                }
+                lineItr++;
+            }
+            return true;
+        }
 
        public bool GetIncAParticleList(List<COTSParticle> a_listParticleOut)
         {

+ 16 - 0
OTS/OTSModelSharp/OTSEDSBase.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OTSModelSharp
+{
+   public class OTSEDSBase
+    {
+        const String SIMULATION_SPECTRUM_FILENAME = "SimSpectrum.txt";
+       // EDSController eDSController = new EDSController();
+
+        
+    }
+}

+ 35 - 0
OTS/OTSModelSharp/SEMCommonConst.cs

@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OTSModelSharp
+{
+   public   class SEMCommonConst
+    {
+        public enum SCANNER_ID
+        {
+                INVALID = 0,
+				OFFLINE = 1,
+				MIN = 1,
+				GENESIS = 2,
+				USEDMIN = 2,
+				BRUKER = 3,
+				OXFORD = 4,
+				IXRF = 5,
+				MAX = 5
+	    };
+        public  String GetName( int a_nId)
+	    {
+		if (a_nId<(int)SCANNER_ID.MIN || a_nId>(int) SCANNER_ID.MAX)
+        {
+            return "Invalid Scan";
+        }
+
+		    return "";// SCANER_CONTROLLER_NAMES[a_nId - (int)SCANNER_ID::MIN];
+	    }
+
+        class EDSController { }
+    }
+}