浏览代码

add a new feature: refresh the line scan chart automatically

gsp 1 年之前
父节点
当前提交
f89f0e69eb

+ 1 - 1
Bin/x64/Debug/Config/ProData/HardwareConfig.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <XMLData PathName="HardwareConfig.xml" ID="1">
   <Member RegName="SemControllerName" Value="OffLine" ImageInputSources="SE" />
-  <Member RegName="EDSName" Value="OffLine" DelayQuantify="true" WeightPercentageToAtomicPercentage="false"/>
+  <Member RegName="EDSName" Value="OffLine" DelayQuantify="true" WeightPercentageToAtomicPercentage="false" />
   <Member RegName="BrukerDllVersion" Version="Bruker.API.Esprit64.dll" />
   <Member RegName="FEIIP" Value="192.168.0.1" />
   <Member RegName="FEIPORT" Value="7520" />

+ 1 - 1
Bin/x64/Debug/Config/ProData/lj2.psf

@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<XMLData FileMark="626" Name="LiJi2" Sizes="0,0.5,1,2,5,30,100" Version="1.1.1" />
+<XMLData FileMark="626" Name="LiJi2" Sizes="5,15,25,50,80,100" Version="1.1.1" />

+ 6 - 1
Bin/x64/Debug/Config/ReportTemplate/CleannessA_Template/ReportTemplateConfig.xml

@@ -79,7 +79,8 @@
       <MBIndex0>0</MBIndex0>
       <MBIndex1>2</MBIndex1>
     </list_lbv_syxt_mblb_index>
-    <str_cb_syxt_ljb> </str_cb_syxt_ljb>
+    <str_cb_syxt_ljb>
+    </str_cb_syxt_ljb>
   </M_SYXT>
   <M_KLLBXX>
     <b_ck_kllb_xsmk>True</b_ck_kllb_xsmk>
@@ -140,4 +141,8 @@
     </str_MainPriority>
     <str_SecondaryPriority>Nialloy,Fe-O,Fe-Cr,Fe-alloy</str_SecondaryPriority>
   </whole>
+  <M_DZ>
+    <Notes>
+    </Notes>
+  </M_DZ>
 </XmlConfig>

+ 1 - 1
Bin/x64/Debug/Config/SysData/OTSStage.stg

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<XMLData Modify="true" PathName=".\Config\SysData\OTSStage.stg" WorkingStageId="0">
+<XMLData Modify="true" PathName=".\Config\SysData\OTSStage.stg" WorkingStageId="4">
   <Collection RegName="Stagelist">
     <Member strName="圆形九圆孔50mm">
       <Member RegName="boundary" PolygonPoint="" rectDomian="0,0,50000,0" shape="0:ROUND" />

+ 14 - 1
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.Designer.cs

@@ -50,6 +50,8 @@
             this.ExportScanInfoMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.myChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
             this.panelXray = new System.Windows.Forms.Panel();
+            this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
+            this.timer1 = new System.Windows.Forms.Timer(this.components);
             ((System.ComponentModel.ISupportInitialize)(this.picBox)).BeginInit();
             this.contextMenuStrip1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.myChart)).BeginInit();
@@ -163,7 +165,7 @@
             this.MenuItemLineScan.Name = "MenuItemLineScan";
             this.MenuItemLineScan.Size = new System.Drawing.Size(242, 22);
             this.MenuItemLineScan.Text = "线扫描曲线";
-            this.MenuItemLineScan.Click += new System.EventHandler(this.ShowGrayLevelLine_Click);
+            this.MenuItemLineScan.Click += new System.EventHandler(this.ShowLineScanChart_Click);
             // 
             // PointScanElementMenuItem
             // 
@@ -219,6 +221,15 @@
             this.panelXray.Size = new System.Drawing.Size(781, 169);
             this.panelXray.TabIndex = 0;
             // 
+            // backgroundWorker1
+            // 
+            this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
+            // 
+            // timer1
+            // 
+            this.timer1.Interval = 3000;
+            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
+            // 
             // OTSMeasureStatusWindow
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -263,5 +274,7 @@
         private System.Windows.Forms.ToolStripMenuItem VisualAdjustingMenu;
         private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
         private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
+        private System.ComponentModel.BackgroundWorker backgroundWorker1;
+        private System.Windows.Forms.Timer timer1;
     }
 }

+ 102 - 55
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.cs

@@ -264,8 +264,48 @@ namespace OTSMeasureApp
             }
             //设置右键菜单中的项 是否可编辑
             SetContextMenuEnabled(true);
-            AcquireBSEImage();
+           bool rst= AcquireBSEImage();
 
+            //取图不成功就返回
+            if (rst)
+            {
+                bfResult = true;
+            }
+            if (!rst)
+            {
+                if (contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Enabled == true)
+                {
+                    contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Enabled = false;
+                }
+                //显示单点扫描元素信息菜单
+                contextMenuStrip1.Items[(int)MeasureStateMenuType.PointScanElementMenuItem].Enabled = false;
+                picBox.Hide();
+                return;
+            }
+            else
+            {
+                //显示单点扫描元素信息菜单
+                contextMenuStrip1.Items[(int)MeasureStateMenuType.PointScanElementMenuItem].Enabled = true;
+            }
+            m_IsShowImageType = ImageType.BSEImage;
+            m_imagetype = ImageType.BSEImage;
+            
+            ShowImage(m_iWidth, m_iHeight, originalBseData);
+
+            IsShowGrayLevelLine = false;
+            //获取默认Y轴
+
+
+            myChart.Visible = false;
+
+            //图像加载后的显示位置
+            m_CurrentMultiple = 0;
+
+
+            picBox.Height = this.RestoreBounds.Height;
+
+            picBox.Left = 0;
+            picBox.Top = 0;
 
 
             DelElementPointGDIObjects();
@@ -276,7 +316,7 @@ namespace OTSMeasureApp
         /// <summary>
         /// 获取BSE图方法
         /// </summary>
-        private void AcquireBSEImage()
+        private bool AcquireBSEImage()
         {
 
             //获取电镜中图像大小
@@ -314,27 +354,16 @@ namespace OTSMeasureApp
 
 
             bool rst = GetScanImage(m_iWidth, m_iHeight, nDwellTime, ref originalBseData);
-            //取图不成功就返回
-            if (rst)
-            {
-                bfResult = true;
-            }
-            if (!rst)
-            {
-                if (contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Enabled == true)
-                {
-                    contextMenuStrip1.Items[(int)MeasureStateMenuType.ChangeDiffImageShow].Enabled = false;
-                }
-                //显示单点扫描元素信息菜单
-                contextMenuStrip1.Items[(int)MeasureStateMenuType.PointScanElementMenuItem].Enabled = false;
-                picBox.Hide();
-                return;
-            }
-            else
-            {
-                //显示单点扫描元素信息菜单
-                contextMenuStrip1.Items[(int)MeasureStateMenuType.PointScanElementMenuItem].Enabled = true;
-            }
+
+
+            return rst;
+          
+           
+
+        }
+        private void UpdateImageAndLineScanChart()
+        {
+            ShowImage(m_iWidth, m_iHeight, originalBseData);
             //获取灰度图数据
             dGrayLevelData = new double[(int)GrayLevel.Max];
             dGrayLevelData = GetGaryData(originalBseData, dGrayLevelData);
@@ -345,26 +374,19 @@ namespace OTSMeasureApp
             {
                 dGrayLevelMax = Math.Max(dGrayLevelMax, dGrayLevelData[i]);
             }
-            SetClickMenuBSEImg();
-            //更新当前的图
-            //UpdateImageOrChart(m_imagetype);
-
-            ShowImage(m_iWidth, m_iHeight, originalBseData);
-
-            IsShowGrayLevelLine = false;
-            //获取默认Y轴
-
-
-            myChart.Visible = false;
-
-            //图像加载后的显示位置
-            m_CurrentMultiple = 0;
-
-
-            picBox.Height = this.RestoreBounds.Height;
-
-            picBox.Left = 0;
-            picBox.Top = 0;
+            int[] XData = new int[(int)GrayLevel.Max];
+            for (int i = 0; i < (int)GrayLevel.Max; i++)
+            {
+                XData[i] = i + 1;
+            }
+            int[] YData = new int[dGrayLevelData.Length];
+            for (int i = 0; i < dGrayLevelData.Length; i++)
+            {
+                YData[i] = (int)dGrayLevelData[i];
+            }
+            chartData(XData, YData);
+            picBox.Refresh();
+          
 
         }
         public double[] GetGaryData(byte[] Imagedata, double[] GrayLevelData)
@@ -423,17 +445,7 @@ namespace OTSMeasureApp
         }
         #endregion
 
-        #region 设置点击BSE菜单
-        public void SetClickMenuBSEImg()
-        {
-            //用于线扫描曲线
-            m_IsShowImageType = ImageType.BSEImage;
-            m_imagetype = ImageType.BSEImage;
-            picBox.Show();
-
-
-        }
-        #endregion
+       
 
 
         //显示去背景图 = AUTO
@@ -614,7 +626,7 @@ namespace OTSMeasureApp
         #endregion
         //显示线扫描曲线
         #region  显示线扫描曲线
-        private void ShowGrayLevelLine_Click(object sender, EventArgs e)
+        private void ShowLineScanChart_Click(object sender, EventArgs e)
         {
             if (MenuItemLineScan.Checked)
             {
@@ -629,6 +641,14 @@ namespace OTSMeasureApp
             panelXray.Visible = false;
 
             picBox.Refresh();
+            if (IsShowGrayLevelLine)
+            {
+                timer1.Enabled = true;
+            }
+            else 
+            {
+                timer1.Enabled = false;
+            }
 
         }
 
@@ -1930,6 +1950,33 @@ namespace OTSMeasureApp
             m_CurrentMultiple = 0;
             panelXray.Visible = false;
         }
+
+        private void timer1_Tick(object sender, EventArgs e)
+        {
+            log.Info("begin to acquire image");
+            bool rst = AcquireBSEImage();
+            if (rst)
+            {
+                backgroundWorker1.RunWorkerAsync();
+            }
+           
+        }
+
+        private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
+        {
+            
+          
+           
+
+            //更新当前的图
+           
+                log.Info("begin to show image");
+                UpdateImageAndLineScanChart();
+
+           
+        }
+
+      
     }
 }
 

+ 6 - 0
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.resx

@@ -120,4 +120,10 @@
   <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
+  <metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>182, 17</value>
+  </metadata>
+  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>356, 17</value>
+  </metadata>
 </root>

+ 5 - 5
OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

@@ -759,11 +759,11 @@ namespace OTSMeasureApp
         {
            
             //判断样品台是否有样品,如果有样品则不能设置默认参数
-            if (m_ProjParam.GetSampleCount() > 0)
-            {
-                MessageBox.Show("Cann't setup preference parameter,for you have added some samples!");
-                return;
-            }
+            //if (m_ProjParam.GetSampleCount() > 0)
+            //{
+            //    MessageBox.Show("Cann't setup preference parameter,for you have added some samples!");
+            //    return;
+            //}
             ProgMgrInfoForm ProgMgrForm = new ProgMgrInfoForm();