Browse Source

分布图速度优化-2

cxs 1 year ago
parent
commit
64450ff75f

+ 8 - 49
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -205,7 +205,6 @@ namespace OTSIncAReportGraph.Controls
         ResultFile resultFile = null;
         //private Cursor cursor1;
 
-        System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
         #endregion
 
         #region 构造函数及窗体加载
@@ -214,7 +213,6 @@ namespace OTSIncAReportGraph.Controls
         {
             log = NLog.LogManager.GetCurrentClassLogger();
             m_list_allDfield = new List<DisplayField>();
-            //m_list_allDPart = new List<DisplayParticle>();
 
             m_frm_userprogress = new Frm_UserProgress();
 
@@ -310,7 +308,6 @@ namespace OTSIncAReportGraph.Controls
 
 
             m_list_allDfield.Clear();
-            //m_list_allDPart.Clear();
             var fieldSize = imageDisHelper.GetFieldImageSize();
             for (int i = 0; i < fieldlist.Count(); i++)
             {
@@ -326,7 +323,6 @@ namespace OTSIncAReportGraph.Controls
                     df = new DisplayField(fieldlist[i], (int)fieldSize.Width, (int)fieldSize.Height, resultFile.GetPixelSize(), offset_point);
                     df.ContentColor = Color.Black;
                     m_list_allDfield.Add(df);
-                    //m_list_allDPart.AddRange(df.List_DParticle);
                 }
                 catch (Exception ex)
                 {
@@ -758,23 +754,14 @@ namespace OTSIncAReportGraph.Controls
 
 
             }
-
-
-
             if (currentZoom > m_f_zoom_max) currentZoom = m_f_zoom_max;
             if (currentZoom < m_f_zoom_mix) currentZoom = m_f_zoom_mix;
-
-
-
             ImageZoom(currentZoom, new PointF(e.X, e.Y));
-
-
             Invalidate();
         }
 
         protected override void OnMouseDown(MouseEventArgs e)
         {
-            sw.Start();
             if (e.Button == MouseButtons.Left)
             {
                 this.Cursor = Cursors.Hand;
@@ -841,34 +828,12 @@ namespace OTSIncAReportGraph.Controls
 
                 }
             }
-            else
-            {
-                m_currentMouseDownPoint = e.Location;
-                //bool ifClickOnParticle = false;
-                foreach (DisplayField a_field in m_list_allDfield)
-                {
-                    if (imageDisHelper.WhetherInRange(a_field, e.Location))
-                    {
 
-                        foreach (DisplayParticle item in a_field.List_DParticle)
-                        {
-                            var dp = item;
-                            if (imageDisHelper.WhetherInRange(dp, e.Location))
-                            {
-                                dp.IsSelect = true;
-                                break;
-                            }
-                        }
-                    }
-
-                }
-            }
             Invalidate();
         }
 
         protected override void OnMouseMove(MouseEventArgs e)
         {
-
             //当前鼠标的位置,用来绘制鼠标线用
             m_mouse_now_point = e.Location;
             if (m_ParticleSegmentation.IsParticleSegmentation)
@@ -879,6 +844,7 @@ namespace OTSIncAReportGraph.Controls
                 }
             }
 
+            
             if (m_SelectTool.IsSelecting)
             {
                 if (e.Button == MouseButtons.Left)
@@ -1186,8 +1152,8 @@ namespace OTSIncAReportGraph.Controls
 
             if (e.Button == MouseButtons.Right)
             {
-
-
+                m_currentMouseDownPoint = e.Location;
+                
                 bool ifClickOnParticle = false;
 
                 
@@ -1195,22 +1161,21 @@ namespace OTSIncAReportGraph.Controls
                 {
                     if (imageDisHelper.WhetherInRange(a_field, e.Location))
                     {
-                        sw.Stop();
-                        TimeSpan ts2 = sw.Elapsed;
-                        MessageBox.Show("Stopwatch总共花费:"+ts2.TotalMilliseconds+"ms.");
                         foreach (DisplayParticle item in a_field.List_DParticle)
                         {
                             if (true == imageDisHelper.WhetherInRange(item, e.Location))
                             {
                                 ifClickOnParticle = true;
+                                CMenuStrip.Visible = false;
 
-                                CMenuStrip.Items[(int)RightButtonMenu.CopyImage].Visible = false;
-                                CMenuStrip.Items[(int)RightButtonMenu.OriginalSplicing].Visible = false;
+                                //CMenuStrip.Items[(int)RightButtonMenu.CopyImage].Visible = false;
+                                //CMenuStrip.Items[(int)RightButtonMenu.OriginalSplicing].Visible = false;
                                 contextMenuStrip_Particle.Visible = true;
                                 contextMenuStrip_Particle.Show(this, e.Location);
                                 ToolStripMenuItem_movesempoint.Tag = item;
 
                                 DisplayParticle dp = (DisplayParticle)item;
+                                dp.IsSelect = true;
                                 m_ParticleSegmentation.ParticleData = dp.objParticleData;
                             }
                         }
@@ -1268,19 +1233,13 @@ namespace OTSIncAReportGraph.Controls
         /// <param name="in_dparticle"></param>
         private void ShowParticleInfo(DisplayParticle in_dparticle)
         {
-
-
             if (delaytimer.Enabled == false)
             {
-
                 m_mouseOver_dparticle = in_dparticle;//将显示xray的dparticle记录给全局变量
                 delaytimer.Tick += Delaytimer_Tick;
-                delaytimer.Interval = 500;
+                delaytimer.Interval = 100;
                 delaytimer.Start();
-
             }
-
-
         }
 
         private void Delaytimer_Tick(object sender, EventArgs e)