瀏覽代碼

处理二次分析点击停止再点击开始线程占用的bug

cxs 2 年之前
父節點
當前提交
dc8247b4cc

+ 2 - 2
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_XRayTable.cs

@@ -271,8 +271,6 @@ namespace OTSIncAReportGraph.Controls
 
             double ls_width = m_i_draw_end;//改成固定值,整个绘制浪线的总长
             double ls_cs = 2000;
-            m_f_zl = (float)(ls_width / ls_cs);
-
             //计算KML峰值判定的上标值与下标值
             GetKMLFPD_MAXANDMIN(m_analysis_xray);
 
@@ -281,6 +279,8 @@ namespace OTSIncAReportGraph.Controls
             {
                 TwoPoint tp = new TwoPoint();
                 tp.pf1.X = i * m_f_zl;
+            m_f_zl = (float)(ls_width / ls_cs);
+
                 tp.pf1.Y = old_value;
 
                 tp.pf2.X = i * m_f_zl + m_f_zl;

+ 27 - 5
OTSIncAReportApp/1-UI/frmReMeasure.cs

@@ -464,7 +464,7 @@ namespace OTSIncAReportApp
             string str_libraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)ReportFun.resultFile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
             DataTable userLibraryData = new DataTable();
             UserLibraryData userLibrary = new UserLibraryData(str_libraryName);
-            if (userLibrary != null)
+            if (userLibrary.GetSqlHelper() != null)
             {
                 userLibraryData = userLibrary.GetSubAttributeFromDatabase();
             }
@@ -841,15 +841,19 @@ namespace OTSIncAReportApp
                         int areaField = stats.At<int>(h, 4);
                         keyValuePairs.Add(h, areaField);
                     }
+
+                    DrawRectangeForParticles(nonenum, stats, mat_dst, Scalar.White);
+
+
                     int Key = 0;//新颗粒序列
                     if (CB_HAND.Checked)//手动处理
                     {
                         Mat srcWhite = new Mat(mat_dst.Height, mat_dst.Width, MatType.CV_8UC1, new Scalar(0));//黑色底图  
                         mat.CopyTo(srcWhite, mat_dst);
-
                         bgw_process.ReportProgress(0, OpenCvSharp.Extensions.BitmapConverter.ToBitmap(srcWhite));
                         SetProgressMessage(table["str18"].ToString(), richTextBox_process);
-                        GetKeyNo(labelMat, mat_dst.Width, mat_dst.Height, ref Key);
+                        if(!GetKeyNo(labelMat, mat_dst.Width, mat_dst.Height, ref Key))
+                            return false;
                     }
                     else//自动处理
                     {
@@ -925,6 +929,20 @@ namespace OTSIncAReportApp
             groupBox_param.Enabled = true;
         }
 
+        void DrawRectangeForParticles(int centroids,Mat stats,Mat mat_dst, Scalar Col)
+        {
+            for (int h = 1; h < centroids; h++)
+            {
+                //if (h > 10)
+                //{
+                //    break;
+                //}
+                if (stats.At<int>(h, 0) == 0) continue;        //box_site[0,...] 为背景图大小。
+                Cv2.Rectangle(mat_dst, new OpenCvSharp.Point(stats.At<int>(h, 0), stats.At<int>(h, 1)), new OpenCvSharp.Point(stats.At<int>(h, 0) + stats.At<int>(h, 2), stats.At<int>(h, 1) + stats.At<int>(h, 3)), Col, 1);
+            }
+            //Cv2.ImShow("biaoji", mat_dst);
+            //Cv2.WaitKey(1);
+        }
         private void pictureBox_part_MouseDown(object sender, MouseEventArgs e)
         {
             if (CB_HAND.Checked && pictureBox_part.Image != null)
@@ -970,21 +988,25 @@ namespace OTSIncAReportApp
         /// <param name="width"></param>
         /// <param name="height"></param>
         /// <param name="key"></param>
-        private void GetKeyNo(Mat labelMat, int width, int height, ref int key)
+        private bool GetKeyNo(Mat labelMat, int width, int height, ref int key)
         {
+            bool rs = false;
             handPoint = new Point(-1, -1);
             Color color = groupBox_img.BackColor;
             while (key == 0 && stopFlag == false)
             {
+                BTN_YES.Enabled = false;
                 groupBox_img.BackColor = Color.Red;
                 Thread.Sleep(1000);
                 if (handPoint.X >= 0 && handPoint.X < width && handPoint.Y >= 0 && handPoint.Y < height)
                 {
                     key = labelMat.Get<int>((int)handPoint.Y, (int)handPoint.X);
+                    rs = true;
                 }
             }
-
+            BTN_YES.Enabled = true;
             groupBox_img.BackColor = color;
+            return rs;
         }
 
         private void dgV_ParticlesDevidePage_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)