ソースを参照

correct eds problem

gsp 4 年 前
コミット
e522b927b8

+ 17 - 12
DBManager/MeasureDB.cs

@@ -21,7 +21,7 @@ namespace DBManager
         public MeasureDB(MeasureFile mf)
         {
             Init(mf);
-            CreateDB();
+            CreateDBconn();
             CreateAnalysisPointsTable();
             CreateXrayDataTable();
             CreateAreaPositionTable();
@@ -34,16 +34,21 @@ namespace DBManager
         }
 
         //创建一个空的数据库
-        public void CreateDB()
+        public void CreateDBconn()
         {
-            string path = Path.GetDirectoryName(m_measureFile.FileName);
-            path = "D:\\HOZ\\test\\MeasureDB.db";
-
-            if (File.Exists(path))
-            {
-                File.Delete(path);
-            }
-
+            string path;//= Path.GetDirectoryName(m_measureFile.FilePath);
+
+            //获取测量文件所在路径
+            string savePath = m_measureFile.FilePath;
+            //数据库名称
+            string dbFileName = "MeasureDB.db";
+            path = savePath +"//"+ dbFileName;
+
+            //if (File.Exists(path))
+            //{
+            //    File.Delete(path);
+            //}
+            
             m_db = new SQLiteConnection("data source =" + path);
             m_db.Open();
         }
@@ -229,7 +234,7 @@ namespace DBManager
             command.ExecuteNonQuery();
         }
 
-        public bool InsetAPoint(int PointsId, string PointName, string EDSImagePath, int PointsNum, int AreasNum, int ImageID)
+        public bool InsertAnylysisField(int PointsId, string PointName, string EDSImagePath, int PointsNum, int AreasNum, int ImageID)
         {
             //开启一个事务
             using (SQLiteTransaction tr = m_db.BeginTransaction())
@@ -254,7 +259,7 @@ namespace DBManager
         }
 
         //插入一条点扫描Xray的信息
-        public bool InsertAPointXay(int PointsId, int XrayId, int X, int Y, long[] XrayData, Dictionary<string, double> listElement, int ImageID)
+        public bool InsertAPointXray(int PointsId, int XrayId, int X, int Y, long[] XrayData, Dictionary<string, double> listElement, int ImageID)
         {
             byte[] bArray = new byte[8000];
 

+ 72 - 75
ExtenderControl/Extender.cs

@@ -102,12 +102,18 @@ namespace Extender
         public short type;
     }
 
-    public struct PointXrayParam
+    public class PointXrayParam
     {
+      public  PointXrayParam()
+      {
+            
+         this.XrayData = new long[2000];
+         this.listElement=new  Dictionary<string, double> ();
+       }
       public  double dMilliSecondsTime;
-        public     int x;
-          public  int y;
-        public     long[] XrayData;
+        public     double x;
+          public  double y;
+        public long[] XrayData ;
           public   Dictionary<string, double> listElement;
 
     }
@@ -233,19 +239,16 @@ namespace Extender
                             PointXrayParam p = currentCommand.pointXrayPrm;
                            
                             log.Info("线程:开始采集单点xray");
-                            if (myExtender == null)
-                            {
-                                myExtender = new Extender();
-                                log.Info("renew the myExtender");
-                            }
-                            if (myExtender.XrayPointCollectiong(p.dMilliSecondsTime, p.x, p.y, out p.XrayData,out p.listElement))
+                            
+                            if (myExtender.XrayPointCollecting(p.dMilliSecondsTime, p.x, p.y, out p.XrayData,out p.listElement))
                             {
-                                log.Info("线程:采集单点xray成功");
+                                
                                 currentCommand.pointXrayPrm = p;
                                 currentCommand.returnType = true;
                             }
                             else
                             {
+                                log.Error("线程:采集单点xray失败");
                                 currentCommand.returnType = false;
                             }
                             endEvent.Set();
@@ -254,7 +257,7 @@ namespace Extender
                     case OxfordCommand.XrayAreaCollectiong:
                         {
                             AreaXrayParam p = currentCommand.areaXrayPrm;
-                            if (myExtender.XrayAreaCollectiong(p.dMilliSecondsTime, p.a_listChord,out p.XrayData, out p.a_listElement))
+                            if (myExtender.XrayAreaCollectiong( p.dMilliSecondsTime, p.a_listChord,out p.XrayData, out p.a_listElement))
                             {
                                 currentCommand.areaXrayPrm = p;
                                 currentCommand.returnType = true;
@@ -433,7 +436,6 @@ namespace Extender
 
         public bool SetImageAcquistionSetting(double a_dDwellTime, int a_nImageType, double a_dImageScanSize)
         {
-            log.Info("进入wrapper");
             return myExtender.SetImageAcquistionSetting(a_dDwellTime, a_nImageType, a_dImageScanSize);
         }
 
@@ -487,7 +489,7 @@ namespace Extender
             return myExtender.SetWorkingDistance(set);
         }
 
-        public bool XrayAreaCollectiong(double dMilliSecondsTime, List<Segment> a_listChord, out long[] XrayData, out Dictionary<string, double> a_listElement)
+        public bool XrayAreaCollectiong( double dMilliSecondsTime, List<Segment> a_listChord, out long[] XrayData, out Dictionary<string, double> a_listElement)
         {
             var p = new AreaXrayParam();
              p = currentCommand.areaXrayPrm;
@@ -517,10 +519,10 @@ namespace Extender
             }
         }
 
-        public bool XrayPointCollectiong(double dMilliSecondsTime, int x, int y, out long[] XrayData, out Dictionary<string, double> a_listElement)
+        public bool XrayPointCollecting(double dMilliSecondsTime, double x, double y, out long[] XrayData, out Dictionary<string, double> a_listElement)
         {
             var p = new PointXrayParam();
-            log.Info("进入 xrayPointCollecting");
+           
             p.dMilliSecondsTime = dMilliSecondsTime;
             p.x = x;
             p.y = y;
@@ -584,7 +586,7 @@ namespace Extender
     }
     public class Extender : IExtenderControl
     {
-       
+      
         
     //构造函数
     public Extender()
@@ -1256,8 +1258,8 @@ namespace Extender
         //a_dImageScanSize : 图像分辨率,图像的高
         public bool SetImageAcquistionSetting(double a_dDwellTime, int a_nImageType, double a_dImageScanSize)
         {
-            NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
-            log.Info("进入setImageAcquisition");
+           
+           
             IImageSettings imageSettings = imageAcquisitionSettings.ImageSettings;
             IImageCapabilities imageCapabilities = imageAcquisitionSettings.ImageCapabilities;
             IImageScanSettings scanSettings = imageAcquisitionSettings.ScanSettings;
@@ -1289,7 +1291,7 @@ namespace Extender
 
             var pixelSize = 1d / a_dImageScanSize;
 
-            log.Info("开始createFullFieldRegion");
+         
             scanSettings.AcquisitionRegion.CreateFullFieldRegion(pixelSize);
 
             return true;
@@ -1305,12 +1307,12 @@ namespace Extender
             {
                 int lastingTime = 0;
                 NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
-                log.Info("拍图开始");
+              
                 
                 //imageAcquisitionController.BeginMultipleAcquisition();
                 IEnumerable<IElectronImage> images = imageAcquisitionController.StartAcquisition(imageAcquisitionSettings);
                
-                log.Info("startAcquisition 完成");
+                log.Info("拍图开始 startAcquisition 完成");
                 images.ToList().ForEach(i =>
                 {
                     i.Label = string.Format(@"Code example image - {0:HH:mm:ss} - {1}", DateTime.Now, i.InputSource.ToString());
@@ -1348,7 +1350,7 @@ namespace Extender
 
                     Thread.Sleep(100);
                     lastingTime += 100;
-                    if (lastingTime > EDSColletionTimeOut*3)
+                    if (lastingTime > EDSColletionTimeOut*6)
                     {
                         return false;
                     }
@@ -1477,7 +1479,7 @@ namespace Extender
         private int XRayChannelLength = 2000;
         private long[] m_XrayData = null;
         private bool m_bXrayDone = false;
-        private int EDSColletionTimeOut=60000;
+        private int EDSColletionTimeOut=10000;
         /// <summary>
         /// List of EdSpectrum objects
         /// </summary>
@@ -1502,40 +1504,41 @@ namespace Extender
             //EdSpectrumAcquisitionController.ExperimentStarted -= this.OnEdSpectrumExperimentStarted;
         }
 
-        void SetXrayAcquisitionParam(double a_dMilliSecondsTime)
+        void SetXrayAcquisitionParam(ref double a_dMilliSecondsTime)
         {
             EdSpectrumSettings.EdSettings.AcquisitionMode = EdAcquireMode.LiveTime; // RealTime or LiveTime
 
-            if (a_dMilliSecondsTime < 200)
+            if (a_dMilliSecondsTime < 5000)
             {
-                a_dMilliSecondsTime = 200;
+                a_dMilliSecondsTime = 5000;
             }
 
             EdSpectrumSettings.EdSettings.AcquisitionTime = TimeSpan.FromMilliseconds(a_dMilliSecondsTime);
 
-            EdSpectrumSettings.EdSettings.ProcessTime = 1;
+            EdSpectrumSettings.EdSettings.ProcessTime = 4;
             EdSpectrumSettings.EdSettings.EnergyRange = 20;
             EdSpectrumSettings.EdSettings.NumberOfChannels = 4096;
 
             EdSpectrumSettings.ScanSettings.AcquisitionRegion.CreateFullFieldRegion(1.0 / 1024.0);
         }
 
-        void SetPointAcquistionRegion(int a_nX, int a_nY)
+        void SetPointAcquistionRegion(double a_nX, double a_nY)
         {
-            Chord chord = new Chord(a_nX, a_nY, 1);
-            List < Chord > chords = new List < Chord> ();
-            chords.Add(chord);
+            //Chord chord = new Chord(a_nX, a_nY, 1);
+            //List < Chord > chords = new List < Chord> ();
+            //chords.Add(chord);
 
-            ChordList chordsList = null;
-            if (m_nImageWidth != 0)
-            {
-                chordsList = new ChordList(chords, 1 / (double)m_nImageWidth);
-            }
-            else
-            {
-                chordsList = new ChordList(chords, 1 / 1024.0);
-            }
-            EdSpectrumSettings.ScanSettings.AcquisitionRegion.CreateChordListRegion(chordsList);
+            //ChordList chordsList = null;
+            //if (m_nImageWidth != 0)
+            //{
+            //    chordsList = new ChordList(chords, 1 / (double)m_nImageWidth);
+            //}
+            //else
+            //{
+            //    chordsList = new ChordList(chords, 1 / 1024.0);
+            //}
+            //EdSpectrumSettings.ScanSettings.AcquisitionRegion.CreateChordListRegion(chordsList);
+            EdSpectrumSettings.ScanSettings.AcquisitionRegion.CreatePointRegion(new System.Windows.Point(a_nX, a_nY));
         }
 
         void SetAreaAcquistionRegion(List<Chord> a_nChords)
@@ -1589,20 +1592,20 @@ namespace Extender
           
             IEdSpectrumAcquisitionController edSpectrumAcquisitionController = sender as IEdSpectrumAcquisitionController;
 
-            //if (edSpectrumAcquisitionController != null)
-            //{
-            //    // This only used for multiple acquisition:
-            //    //      If this is the last experiment, call EndMultipleAcquisition on the Acquisition 
-            //    //      controller, to re-enable external scan switching
-            //    edSpectrumAcquisitionController.EndMultipleAcquisition();                
-            //}
 
+           
+            NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
             IEdSpectrum edSpectrum = e.Value;
 
             if (!ReadXrayData(edSpectrum, out m_XrayData, XRayChannelLength))
             {
                 MessageBox.Show("Xray采集完成,获取图像像素失败!");
             }
+            long nXraycount = 0;
+            for (int i = 0; i < 2000; i++)
+            {
+                nXraycount += m_XrayData[i];
+            }
 
             //Quantify processing
             
@@ -1614,6 +1617,7 @@ namespace Extender
             IEnumerable < ISEMQuantResult > Results = quantStatus.Results;
 
             //Get element result for single point
+            //quantStatus.Results.
             var ie = Results.GetEnumerator();
 
             listElement = new Dictionary<string, double>();
@@ -1626,19 +1630,22 @@ namespace Extender
                 {
                     listElement.Add(ElementProperties.GetElementSymbol(result.AtomicNumber), result.WeightPercent );
                 }
+                
             }
 
             if (m_XrayData != null && m_XrayData.Length == XRayChannelLength)
             {
-                NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
+               
                 log.Info("xray 采集结束事件,采集成功 当前线程" + Thread.CurrentThread.ManagedThreadId.ToString());
+                log.Info("计数率为:" + nXraycount.ToString());
+                if (nXraycount < 5000)
+                {
+                    log.Warn("计数率低于5000!");
+                }
                 m_bXrayDone = true;
 
             }
-            else
-            {
-              
-            }
+           
 
         }
 
@@ -1702,7 +1709,7 @@ namespace Extender
 
         //点扫描
         //X-ray
-        public Boolean XrayPointCollectiong(double dMilliSecondsTime, int x, int y, out long[] XrayData, out Dictionary<string, double> a_listElement)
+        public Boolean XrayPointCollecting(double dMilliSecondsTime, double x, double y, out long[] XrayData, out Dictionary<string, double> a_listElement)
         {
            
             XrayParamInit();
@@ -1710,33 +1717,22 @@ namespace Extender
             XrayData = new long[XRayChannelLength];
             a_listElement = new Dictionary<string, double>();
            
-            SetXrayAcquisitionParam(dMilliSecondsTime);
+            SetXrayAcquisitionParam(ref dMilliSecondsTime);
           
             SetPointAcquistionRegion(x, y);
-           
+            NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
+            log.Info("开始XrayStartAcquisition:t="+dMilliSecondsTime.ToString()+"pos="+"("+x.ToString()+","+y.ToString()+")");
 
 
-            // IEdSpectrumSettings.EdCapabilities will validate settings and hardware availability.
             if (EdSpectrumAcquisitionController.IsEdHardwareReady(EdSpectrumSettings))
             {
 
-               
-
-                // This only used for multiple acquisition:
-                //      if this is the first acquisition, call BeginMultipleAcquisition 
-                //      on the IEdSpectrumAcquisitionController to suppress external scan switching
-               
-                //if (m_bXrayDone)
-                //{
-                //    EdSpectrumAcquisitionController.BeginMultipleAcquisition();
-                //}
-                
                 // Start spectrum acquisition
                 try
                 {
+                    m_bXrayDone = false;
                     int lastingTime = 0;
-                    NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
-                    log.Info("开始XrayStartAcquisition");
+                  
                     IEdSpectrum edSpectrum = EdSpectrumAcquisitionController.StartAcquisition(EdSpectrumSettings);
                     edSpectrum.Label = string.Format(@"Point({0},{1})",x,y);
                    
@@ -1754,9 +1750,10 @@ namespace Extender
 
                         Thread.Sleep(100);                       
                         lastingTime += 100;
-                        if (lastingTime > EDSColletionTimeOut)
+                        if (lastingTime > EDSColletionTimeOut*3)
                         {
                             //EdSpectrumAcquisitionController.EndMultipleAcquisition();
+                            log.Warn("XrayStartAcquisition 超时!");
                             return false;
                         }
                     }
@@ -1782,14 +1779,14 @@ namespace Extender
             return true;
         }
         //面扫描
-        public Boolean XrayAreaCollectiong(double dMilliSecondsTime, List<Segment> a_listChord, out long[] XrayData, out Dictionary<string, double> a_listElement)
+        public Boolean XrayAreaCollectiong( double dMilliSecondsTime, List<Segment> a_listChord, out long[] XrayData, out Dictionary<string, double> a_listElement)
         {
             XrayParamInit();
 
             XrayData = new long[XRayChannelLength];
             a_listElement = new Dictionary<string, double>();
 
-            SetXrayAcquisitionParam(dMilliSecondsTime);
+            SetXrayAcquisitionParam(ref dMilliSecondsTime);
             List<Chord> Chords = new List<Chord>();
 
             foreach (Segment seg in a_listChord)
@@ -1827,7 +1824,7 @@ namespace Extender
                         Thread.Sleep(100);
                         Application.DoEvents();
                         lastingTime += 100;
-                        if (lastingTime > EDSColletionTimeOut)
+                        if (lastingTime > EDSColletionTimeOut*3)
                         {
                             //EdSpectrumAcquisitionController.EndMultipleAcquisition();
                             return false;

+ 2 - 2
ExtenderControl/ExtenderInterface.cs

@@ -156,10 +156,10 @@ namespace Extender
 
         //X-ray
         //点采集
-        Boolean XrayPointCollectiong(double dMilliSecondsTime, int x, int y, out long[] XrayData, out Dictionary<string, double> a_listElement);
+        Boolean XrayPointCollecting(double dMilliSecondsTime, double x, double y, out long[] XrayData, out Dictionary<string, double> a_listElement);
         //Boolean XrayPointCollectiong1(double dMilliSecondsTime, int x, int y, out long[] XrayData, out Dictionary<string, double> a_listElement);
         //面采集
-        Boolean XrayAreaCollectiong(double dMilliSecondsTime, List<Segment> a_listChord, out long[] XrayData, out Dictionary<string, double> a_listElement);
+        Boolean XrayAreaCollectiong( double dMilliSecondsTime, List<Segment> a_listChord, out long[] XrayData, out Dictionary<string, double> a_listElement);
         void CloseExtender();
         void BeginMultipleAquisition();
         void EndMultipleAquisition();

+ 1 - 0
ExtenderControl/HOZExtender.csproj

@@ -56,6 +56,7 @@
     <Reference Include="System.Data" />
     <Reference Include="System.Net.Http" />
     <Reference Include="System.Xml" />
+    <Reference Include="WindowsBase" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Extender.cs" />

+ 2 - 1
HOZProject/App.config

@@ -56,7 +56,8 @@
       <add key="EDS_V" value="10000"/>
       <!--能谱电流设置值-->
       <add key="EDS_A" value="1.0"/>
-      
+      <!--能谱Xray Mode 0:point mode 1: line mode 2: area mode-->
+      <add key="EDS_XrayMode" value="1"/>
       <!--FIB的放大倍数-->
       <add key="FIB_Magnification" value="1500"/>
       <!--Z轴移动距离,单位:mm-->

+ 2 - 2
HOZProject/FormHOZMain.cs

@@ -591,14 +591,14 @@ namespace HOZProject
                     //获取测量文件所在路径
                     string savePath = m_MeasureFile.FilePath;
                     //数据库名称
-                    string dbFileName = "MeasureFile.db";
+                    string dbFileName = "MeasureDB.db";
                     //要复制的文件路径
                     string pLocalFilePath = Application.StartupPath + "\\" + dbFileName;
                     string pSaveFilePath = savePath + "\\" + dbFileName;//指定存储的路径
                     if (File.Exists(pLocalFilePath))//必须判断要复制的文件是否存在
                     {
                         //三个参数分别是源文件路径,存储路径,若存储路径有相同文件是否替换
-                        File.Copy(pLocalFilePath, pSaveFilePath, true);
+                        //File.Copy(pLocalFilePath, pSaveFilePath, true);
                     }
                     //将初始化中的参数,配置到测量参数中
                     m_MeasureFile.MParam = uControl_Init.GetMeasureParamInfo();

+ 74 - 10
HOZProject/UserControls/UControl_Init.Designer.cs

@@ -122,6 +122,10 @@
             this.tbScanSpeedFocus = new System.Windows.Forms.TextBox();
             this.tbScanSpeedHigh = new System.Windows.Forms.TextBox();
             this.label27 = new System.Windows.Forms.Label();
+            this.cboXrayMode = new System.Windows.Forms.ComboBox();
+            this.label28 = new System.Windows.Forms.Label();
+            this.label29 = new System.Windows.Forms.Label();
+            this.label30 = new System.Windows.Forms.Label();
             this.panel1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pbClose)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pbDelWLZ)).BeginInit();
@@ -154,7 +158,7 @@
             this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
             this.panel1.Location = new System.Drawing.Point(0, 0);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(770, 33);
+            this.panel1.Size = new System.Drawing.Size(767, 33);
             this.panel1.TabIndex = 3;
             // 
             // pbClose
@@ -164,7 +168,7 @@
             this.pbClose.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbClose.Cursor = System.Windows.Forms.Cursors.Hand;
             this.pbClose.Dock = System.Windows.Forms.DockStyle.Right;
-            this.pbClose.Location = new System.Drawing.Point(736, 0);
+            this.pbClose.Location = new System.Drawing.Point(733, 0);
             this.pbClose.Name = "pbClose";
             this.pbClose.Size = new System.Drawing.Size(32, 31);
             this.pbClose.TabIndex = 106;
@@ -619,7 +623,7 @@
             this.pbDelWLZ.BackgroundImage = global::HOZProject.Properties.Resources.exit_2_;
             this.pbDelWLZ.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbDelWLZ.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.pbDelWLZ.Location = new System.Drawing.Point(660, 210);
+            this.pbDelWLZ.Location = new System.Drawing.Point(657, 210);
             this.pbDelWLZ.Name = "pbDelWLZ";
             this.pbDelWLZ.Size = new System.Drawing.Size(25, 21);
             this.pbDelWLZ.TabIndex = 111;
@@ -632,7 +636,7 @@
             this.pbDelWQGD.BackgroundImage = global::HOZProject.Properties.Resources.exit_2_;
             this.pbDelWQGD.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbDelWQGD.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.pbDelWQGD.Location = new System.Drawing.Point(332, 235);
+            this.pbDelWQGD.Location = new System.Drawing.Point(329, 235);
             this.pbDelWQGD.Name = "pbDelWQGD";
             this.pbDelWQGD.Size = new System.Drawing.Size(25, 21);
             this.pbDelWQGD.TabIndex = 110;
@@ -645,7 +649,7 @@
             this.pbWQGFDel.BackgroundImage = global::HOZProject.Properties.Resources.exit_2_;
             this.pbWQGFDel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbWQGFDel.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.pbWQGFDel.Location = new System.Drawing.Point(660, 235);
+            this.pbWQGFDel.Location = new System.Drawing.Point(657, 235);
             this.pbWQGFDel.Name = "pbWQGFDel";
             this.pbWQGFDel.Size = new System.Drawing.Size(25, 21);
             this.pbWQGFDel.TabIndex = 109;
@@ -658,7 +662,7 @@
             this.pbDelWPZD.BackgroundImage = global::HOZProject.Properties.Resources.exit_2_;
             this.pbDelWPZD.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbDelWPZD.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.pbDelWPZD.Location = new System.Drawing.Point(332, 260);
+            this.pbDelWPZD.Location = new System.Drawing.Point(329, 260);
             this.pbDelWPZD.Name = "pbDelWPZD";
             this.pbDelWPZD.Size = new System.Drawing.Size(25, 21);
             this.pbDelWPZD.TabIndex = 108;
@@ -671,7 +675,7 @@
             this.pbDelWPZF.BackgroundImage = global::HOZProject.Properties.Resources.exit_2_;
             this.pbDelWPZF.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbDelWPZF.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.pbDelWPZF.Location = new System.Drawing.Point(660, 260);
+            this.pbDelWPZF.Location = new System.Drawing.Point(657, 260);
             this.pbDelWPZF.Name = "pbDelWPZF";
             this.pbDelWPZF.Size = new System.Drawing.Size(25, 21);
             this.pbDelWPZF.TabIndex = 107;
@@ -684,7 +688,7 @@
             this.pbDelWYP.BackgroundImage = global::HOZProject.Properties.Resources.exit_2_;
             this.pbDelWYP.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbDelWYP.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.pbDelWYP.Location = new System.Drawing.Point(332, 186);
+            this.pbDelWYP.Location = new System.Drawing.Point(329, 186);
             this.pbDelWYP.Name = "pbDelWYP";
             this.pbDelWYP.Size = new System.Drawing.Size(25, 21);
             this.pbDelWYP.TabIndex = 106;
@@ -697,7 +701,7 @@
             this.pbDelWCS.BackgroundImage = global::HOZProject.Properties.Resources.exit_2_;
             this.pbDelWCS.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.pbDelWCS.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.pbDelWCS.Location = new System.Drawing.Point(660, 185);
+            this.pbDelWCS.Location = new System.Drawing.Point(657, 185);
             this.pbDelWCS.Name = "pbDelWCS";
             this.pbDelWCS.Size = new System.Drawing.Size(25, 21);
             this.pbDelWCS.TabIndex = 105;
@@ -1057,6 +1061,7 @@
             // 
             this.txtEDSZ.Location = new System.Drawing.Point(174, 312);
             this.txtEDSZ.Name = "txtEDSZ";
+            this.txtEDSZ.ReadOnly = true;
             this.txtEDSZ.Size = new System.Drawing.Size(155, 27);
             this.txtEDSZ.TabIndex = 140;
             // 
@@ -1243,6 +1248,57 @@
             this.label27.TabIndex = 156;
             this.label27.Text = "厂商";
             // 
+            // cboXrayMode
+            // 
+            this.cboXrayMode.Font = new System.Drawing.Font("宋体", 10F);
+            this.cboXrayMode.ForeColor = System.Drawing.SystemColors.WindowText;
+            this.cboXrayMode.FormattingEnabled = true;
+            this.cboXrayMode.Items.AddRange(new object[] {
+            "0",
+            "1",
+            "2"});
+            this.cboXrayMode.Location = new System.Drawing.Point(502, 341);
+            this.cboXrayMode.Margin = new System.Windows.Forms.Padding(2);
+            this.cboXrayMode.Name = "cboXrayMode";
+            this.cboXrayMode.Size = new System.Drawing.Size(155, 25);
+            this.cboXrayMode.TabIndex = 148;
+            // 
+            // label28
+            // 
+            this.label28.AutoSize = true;
+            this.label28.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label28.ForeColor = System.Drawing.Color.Black;
+            this.label28.Location = new System.Drawing.Point(418, 341);
+            this.label28.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label28.Name = "label28";
+            this.label28.Size = new System.Drawing.Size(85, 20);
+            this.label28.TabIndex = 142;
+            this.label28.Text = "XrayMode";
+            // 
+            // label29
+            // 
+            this.label29.AutoSize = true;
+            this.label29.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label29.ForeColor = System.Drawing.Color.Black;
+            this.label29.Location = new System.Drawing.Point(662, 343);
+            this.label29.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label29.Name = "label29";
+            this.label29.Size = new System.Drawing.Size(103, 20);
+            this.label29.TabIndex = 142;
+            this.label29.Text = "0:Point 1:line";
+            // 
+            // label30
+            // 
+            this.label30.AutoSize = true;
+            this.label30.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label30.ForeColor = System.Drawing.Color.Black;
+            this.label30.Location = new System.Drawing.Point(662, 363);
+            this.label30.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label30.Name = "label30";
+            this.label30.Size = new System.Drawing.Size(53, 20);
+            this.label30.TabIndex = 142;
+            this.label30.Text = "2:area";
+            // 
             // UControl_Init
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 17F);
@@ -1257,9 +1313,13 @@
             this.Controls.Add(this.label25);
             this.Controls.Add(this.label26);
             this.Controls.Add(this.cbbEDSA);
+            this.Controls.Add(this.cboXrayMode);
             this.Controls.Add(this.cbbEDSV);
             this.Controls.Add(this.label22);
             this.Controls.Add(this.label23);
+            this.Controls.Add(this.label30);
+            this.Controls.Add(this.label29);
+            this.Controls.Add(this.label28);
             this.Controls.Add(this.label20);
             this.Controls.Add(this.label21);
             this.Controls.Add(this.label19);
@@ -1341,7 +1401,7 @@
             this.Font = new System.Drawing.Font("宋体", 10F);
             this.ForeColor = System.Drawing.SystemColors.WindowText;
             this.Name = "UControl_Init";
-            this.Size = new System.Drawing.Size(770, 493);
+            this.Size = new System.Drawing.Size(767, 493);
             this.Load += new System.EventHandler(this.UControl_Init_Load);
             this.panel1.ResumeLayout(false);
             this.panel1.PerformLayout();
@@ -1453,5 +1513,9 @@
         private System.Windows.Forms.TextBox tbScanSpeedFocus;
         private System.Windows.Forms.TextBox tbScanSpeedHigh;
         private System.Windows.Forms.Label label27;
+        private System.Windows.Forms.ComboBox cboXrayMode;
+        private System.Windows.Forms.Label label28;
+        private System.Windows.Forms.Label label29;
+        private System.Windows.Forms.Label label30;
     }
 }

+ 5 - 2
HOZProject/UserControls/UControl_Init.cs

@@ -385,6 +385,7 @@ namespace HOZProject
             cfm.EDSZ = Convert.ToSingle(txtEDSZ.Text)/1000;
             cfm.EDSV = Convert.ToSingle(cbbEDSV.Text);
             cfm.EDSA = Convert.ToSingle(cbbEDSA.Text)/1000000000;
+            cfm.EDSParam.XrayCollectMode = Convert.ToInt16(cboXrayMode.Text);
             //自动对焦模式
             //cfm.FocusMode = chkManul.Checked;
             cfm.PTTemp = txtWPTF.Text;//PT文件路径
@@ -627,7 +628,8 @@ namespace HOZProject
                 config.AppSettings.Settings["EDS_V"].Value = cbbEDSV.Text;
                 cfm.EDSA = Convert.ToSingle(cbbEDSA.Text) / 1000000000;
                 config.AppSettings.Settings["EDS_A"].Value = cbbEDSA.Text;
-
+                cfm.EDSParam.XrayCollectMode = Convert.ToInt16(cboXrayMode.Text);
+                config.AppSettings.Settings["EDS_XrayMode"].Value = cboXrayMode.Text;
                 //自动对焦模式
                 //cfm.FocusMode = chkManul.Checked;
                 cfm.PTTemp = txtWPTF.Text;
@@ -921,6 +923,7 @@ namespace HOZProject
             txtEDSZ.Text = Convert.ToString(config.AppSettings.Settings["EDS_Z"].Value);
             cbbEDSV.Text = Convert.ToString(config.AppSettings.Settings["EDS_V"].Value);
             cbbEDSA.Text = Convert.ToString(config.AppSettings.Settings["EDS_A"].Value);
+            cboXrayMode.Text = Convert.ToString(config.AppSettings.Settings["EDS_XrayMode"].Value);
         }
 
         /// <summary>
@@ -1389,7 +1392,7 @@ namespace HOZProject
             FormHOZMainObject.m_MeasureFile.MParam.EDSZ = Convert.ToSingle(ConfigurationManager.AppSettings["EDS_Z"].ToString()) / 1000;
             FormHOZMainObject.m_MeasureFile.MParam.EDSV = Convert.ToSingle(ConfigurationManager.AppSettings["EDS_V"].ToString());
             FormHOZMainObject.m_MeasureFile.MParam.EDSA = Convert.ToSingle(ConfigurationManager.AppSettings["EDS_A"].ToString()) / 1000000000;
-
+            FormHOZMainObject.m_MeasureFile.MParam.EDSParam.XrayCollectMode =Convert.ToInt16( ConfigurationManager.AppSettings["EDS_XrayMode"].ToString());
             if (Directory.Exists(FormHOZMainObject.m_MeasureFile.FilePath))//如果已经存在硬盘上要重新保存文件
             {
                 FormHOZMainObject.m_MeasureFile.Save();

+ 2 - 1
MeasureData/EDSParam.cs

@@ -77,7 +77,7 @@ namespace MeasureData
             get { return this.m_nAreaTime; }
             set { this.m_nAreaTime = value; }
         }
-
+        public int XrayCollectMode;//Xray collecting type,0=point mode,1=line mode,2=area mode.
         #endregion
 
         public EDSParam()
@@ -95,6 +95,7 @@ namespace MeasureData
             this.AreaMode = true;
             this.PointTime = 100;
             this.AreaTime = 200;
+            XrayCollectMode = 0;
         }
 
         //XML文件保存测量参数

+ 4 - 3
MeasureData/MeasureParam.cs

@@ -214,7 +214,7 @@ namespace MeasureData
 
         //EDS参数
         private EDSParam EdsParam;
-        public EDSParam EDSP
+        public EDSParam EDSParam
         {
             get { return this.EdsParam; }
             set { this.EdsParam = value; }
@@ -775,6 +775,7 @@ namespace MeasureData
         //add by zjx 2020-12-20 样品类型的能谱电流值 end
         #endregion
 
+       
 
 
         //构造函数
@@ -804,7 +805,7 @@ namespace MeasureData
             this.EDSZ = 0.005f;
             this.EDSV = 10000;
             this.EDSA = 0.0000000005f;
-            this.EDSP = new EDSParam();
+            this.EDSParam = new EDSParam();
             //FIB自动亮度对比度
             this.FIBDo = false;
             this.FIBAutoBC = false;
@@ -917,7 +918,7 @@ namespace MeasureData
             sFile.Register("FIBFocus_Param", this.FIBFocus);
             sFile.Register("StigX_Param", this.AutoStigX);
             sFile.Register("StigY_Param", this.AutoStigY);
-            sFile.Register("EDS_Param", this.EDSP);
+            sFile.Register("EDS_Param", this.EDSParam);
 
             //FIB亮度对比
             xBool isFIBDo = new xBool();

ファイルの差分が大きいため隠しています
+ 307 - 506
MeasureThread/Measure.cs


+ 6 - 6
OxfordTest/Form1.cs

@@ -283,7 +283,7 @@ namespace OxfordTest
             
             long[] XrayData = new long[2000];
             Dictionary<string, double> listElement = new Dictionary<string, double>();
-            iExtender.XrayPointCollectiong(200,44, 55, out XrayData, out listElement);
+            iExtender.XrayPointCollecting(200,44, 55, out XrayData, out listElement);
 
             ShowData(XrayData, listElement);
             li++;
@@ -408,7 +408,7 @@ namespace OxfordTest
         private void btnCreateDB_Click(object sender, EventArgs e)
         {
             MeasureFile msf = new MeasureFile();
-            msf.FileName = @"E:\HOZ\Test\asd.msf";
+            //msf.FileName = @"E:\HOZ\Test\asd.msf";
             MeasureDB db = new MeasureDB(msf);
         }
 
@@ -508,7 +508,7 @@ namespace OxfordTest
                 XrayData = new long[2000];
                 listElement = new Dictionary<string, double>();
 
-                iExtender.XrayPointCollectiong(msf.MParam.EDSP.DwellTime, listPoints[i].X, listPoints[i].Y, out XrayData, out listElement);
+                iExtender.XrayPointCollecting(msf.MParam.EDSParam.DwellTime, listPoints[i].X, listPoints[i].Y, out XrayData, out listElement);
 
                 //m_MeasDB.InsertAPointXay(analysispoints_id, xraydata_id, listPoints[i].X, listPoints[i].Y, XrayData, listElement);
                 xraydata_id++;
@@ -521,7 +521,7 @@ namespace OxfordTest
                 XrayData = new long[2000];
                 listElement = new Dictionary<string, double>();
 
-                iExtender.XrayAreaCollectiong(msf.MParam.EDSP.AreaTime, listSeg, out XrayData, out listElement);
+                iExtender.XrayAreaCollectiong(msf.MParam.EDSParam.AreaTime, listSeg, out XrayData, out listElement);
 
                 //写入数据库
 
@@ -545,8 +545,8 @@ namespace OxfordTest
             //向数据库插入分析点数据
             msf = new MeasureFile();
             msf.FileName = @"E:\HOZ\Test\asd.msf";
-            msf.MParam.EDSP.DwellTime = 200;
-            msf.MParam.EDSP.AreaTime = 200;
+            msf.MParam.EDSParam.DwellTime = 200;
+            msf.MParam.EDSParam.AreaTime = 200;
             m_MeasDB = new MeasureDB(msf);
             pname.Add("aaaa");
             pname.Add("bbbb");

+ 3 - 2
SmartSEMControl/SmartSEMControl.csproj

@@ -35,9 +35,10 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="Interop.APILib">
-      <HintPath>..\..\Git\SmartSEMControl\obj\Debug\Interop.APILib.dll</HintPath>
+    <Reference Include="Interop.APILib, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
       <EmbedInteropTypes>True</EmbedInteropTypes>
+      <HintPath>..\bin\Debug\Interop.APILib.dll</HintPath>
     </Reference>
     <Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません