Procházet zdrojové kódy

删除选择颗粒中间环节(报告)

cxs před 11 měsíci
rodič
revize
8b4562bf2d

+ 21 - 34
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -1139,8 +1139,6 @@ namespace OTSIncAReportGraph.Controls
                     }
 
                 }
-
-                SetParticlesSelected();
             }
 
 
@@ -1213,24 +1211,6 @@ namespace OTSIncAReportGraph.Controls
 
         }
 
-        void SetParticlesSelected()
-        {
-            List<DisplayParticle> selectedParts = new List<DisplayParticle>();
-            List<Particle> Particles = new List<Particle>();
-            foreach (var dp in m_list_allDPart)
-            {
-                if (dp.IsSelect)
-                {
-                    selectedParts.Add((DisplayParticle)dp);
-                    Particle particle = new Particle();
-                    particle.FieldId = ((OTSIncAReportGraph.DisplayParticle)dp).FieldId;
-                    particle.ParticleId = ((OTSIncAReportGraph.DisplayParticle)dp).ParticleId;
-                    Particles.Add(particle);
-                }
-            }
-            SendSelectParticleListToReportFrame(selectedParts);
-        }
-
         /// <summary>
         /// 显示x-ray能谱图
         /// </summary>
@@ -1361,18 +1341,6 @@ namespace OTSIncAReportGraph.Controls
 
             return ls_c;
         }
-        /// <summary>
-        /// 封装,将分布图中的颗粒list传送给报告项目框架中
-        /// </summary>
-        private void SendSelectParticleListToReportFrame(List<DisplayParticle> selectParts)
-        {
-            frmReportApp.selectedParticles.Clear();
-            foreach (var p in selectParts)
-            {
-                frmReportApp.selectedParticles.Add(p.guid, p);
-            }
-        }
-
         /// <summary>
         /// 设置当前对哪些颗粒进行设置为选择状态
         /// </summary>
@@ -2218,8 +2186,7 @@ namespace OTSIncAReportGraph.Controls
         {
             if (keyData == Keys.Escape)
             {
-                DeselectAllParticle();
-                frmReportApp.selectedParticles.Clear();
+                DeselectAllParticle();  
                 return false;
             }
             if (keyData == Keys.Delete)
@@ -2659,6 +2626,26 @@ namespace OTSIncAReportGraph.Controls
             return newPart;
         }
 
+        public void DisplayParticleByParticlelist(List<Particle> particle)
+        {
+
+            foreach (var p in m_list_allDPart)
+            {
+                var dp = p;
+                foreach (var p2 in particle)
+                {
+                    if (dp.objParticleData.FieldId == p2.FieldId)
+                    {
+                        if (dp.objParticleData.ParticleId == p2.ParticleId)
+                        {
 
+                            dp.IsSelect = true;
+                            break;
+                        }
+                    }
+                }
+            }
+            Invalidate();
+        }
     }
 }

+ 2 - 1
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ParticlesGridDevidePage.Designer.cs

@@ -416,7 +416,7 @@
             this.EXCELToolStripMenuItem,
             this.ToolStripMenuItemDelete_Particle});
             this.contextMenuStrip1.Name = "contextMenuStrip1";
-            this.contextMenuStrip1.Size = new System.Drawing.Size(211, 230);
+            this.contextMenuStrip1.Size = new System.Drawing.Size(211, 208);
             // 
             // ToolStripMenuItem1
             // 
@@ -522,6 +522,7 @@
             this.dgV_ParticlesDevidePage.TabIndex = 5;
             this.dgV_ParticlesDevidePage.SortCompare += new System.Windows.Forms.DataGridViewSortCompareEventHandler(this.dgV_ParticlesDevidePage_SortCompare);
             this.dgV_ParticlesDevidePage.MouseDown += new System.Windows.Forms.MouseEventHandler(this.dgV_ParticlesDevidePage_MouseDown);
+            this.dgV_ParticlesDevidePage.MouseUp += new System.Windows.Forms.MouseEventHandler(this.dgV_ParticlesDevidePage_MouseUp);
             // 
             // ParticlesGridDevidePage
             // 

+ 21 - 6
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ParticlesGridDevidePage.cs

@@ -64,6 +64,7 @@ namespace OTSIncAReportGrids
 
         //多个数据源,每个数据源拥有的列数,这里保存下来,供分组使用
         public List<int> m_list_oneresult_columncount;
+
         //国际化
         Language lan;
         Hashtable table;
@@ -2494,10 +2495,6 @@ namespace OTSIncAReportGrids
                     ToolStripMenuItemDelete_Particle.Visible = false;
                 }
             }
-            if(SelectRows!=null)
-            {
-                SaveParticleslist_select();
-            }
         }
         /// <summary>
         /// 去除拼接颗粒组成颗粒
@@ -2557,8 +2554,8 @@ namespace OTSIncAReportGrids
             ParticleData fielddata = new ParticleData(result.FilePath);
             List<Particle> particles = fielddata.GetParticleAllList();
 
-            List<Particle> Particleslist_selecttodisplay = new List<Particle>();
-            for (int l = 0; l < 1; l++)
+            Particleslist_selecttodisplay.Clear();
+            for (int l = 0; l < dgV_ParticlesDevidePage.SelectedRows.Count; l++)
             {
                 //从事先加载的Bitmap对象的Tag中取出List<string>
                 DataGridViewRow dgvr = dgV_ParticlesDevidePage.SelectedRows[l];
@@ -2579,6 +2576,24 @@ namespace OTSIncAReportGrids
 
                 }
             }
+            if(m_ReportApp.im_Control_DrawDistrbutionImageAndBSE!=null)
+            {
+                m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.DisplayParticleByParticlelist(Particleslist_selecttodisplay);
+            }
+        }
+
+        public List<Particle> GetParticleslist_select()
+        {
+            return Particleslist_selecttodisplay;
+        }
+
+        private void dgV_ParticlesDevidePage_MouseUp(object sender, MouseEventArgs e)
+        {
+            var SelectRows = dgV_ParticlesDevidePage.SelectedRows;
+            if (SelectRows.Count != 0)
+            {
+                SaveParticleslist_select();
+            }
         }
     }
 }

+ 18 - 8
OTSIncAReportApp/1-UI/OTSDisplaySourceGridData/frmReportConditionChoose.cs

@@ -592,8 +592,10 @@ namespace OTSIncAReportApp
                             {
                                 m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.DrawDistrbutionImageAndBSE_ByQuery(m_conditionData);
                             }
-                            m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.SetSelectParticle(m_ReportApp.GetSelectedParticles());
-
+                            //if (m_ReportApp.im_ParticlesGridDevidePage != null)
+                            //{
+                            //    m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.DisplayParticleByParticlelist(m_ReportApp.im_ParticlesGridDevidePage.GetParticleslist_select());
+                            //}
                         }
                         else if (m_ReportApp.im_Control_DrawDistrbutionImageAndBSE == null)
                         {
@@ -605,7 +607,10 @@ namespace OTSIncAReportApp
                             m_ReportApp.m_SImageWindow.Controls.Add(m_ReportApp.im_Control_DrawDistrbutionImageAndBSE);
                             m_ReportApp.m_SImageWindow.Activate();
                             m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.DrawDistrbutionImageAndBSE_ByQuery(m_conditionData);
-                            m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.SetSelectParticle(m_ReportApp.GetSelectedParticles());
+                            //if (m_ReportApp.im_ParticlesGridDevidePage != null)
+                            //{
+                            //    m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.DisplayParticleByParticlelist(m_ReportApp.im_ParticlesGridDevidePage.GetParticleslist_select());
+                            //}
                             m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.FullGraphMatch();
                         }
 
@@ -632,13 +637,15 @@ namespace OTSIncAReportApp
                             m_ReportApp.m_SImageWindow.Controls.Add(m_ReportApp.im_Control_DrawDistrbutionSortImage);
                             m_ReportApp.m_SImageWindow.Activate();
                             m_ReportApp.im_Control_DrawDistrbutionSortImage.GetDistrbutionSortimage_ByQuery(m_CurrentConditions);
-                            m_ReportApp.im_Control_DrawDistrbutionSortImage.SetSelectParticle(m_ReportApp.GetSelectedParticles());
 
                             //判断当前点击测量结果中的数据源名,是否与已经加载的排序图显示的数据源名相同
                             if (m_fileName == m_ReportApp.im_Control_DrawDistrbutionSortImage.ShowSourceName)
                             {
-                                //相同,加载计算条件
-                                m_ReportApp.im_Control_DrawDistrbutionSortImage.SetSelectParticle(m_ReportApp.GetSelectedParticles());
+                                ////相同,加载计算条件
+                                //if (m_ReportApp.im_ParticlesGridDevidePage != null)
+                                //{
+                                //    m_ReportApp.im_Control_DrawDistrbutionSortImage.SetSelectParticle(m_ReportApp.im_ParticlesGridDevidePage.GetParticleslist_select());
+                                //}
 
                                 ConditionItem itm =m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.IMAGE_TYPE];
                                 //切换BSE和分类,两种影像的显示方式
@@ -663,7 +670,10 @@ namespace OTSIncAReportApp
                             m_ReportApp.m_SImageWindow.Controls.Add(m_ReportApp.im_Control_DrawDistrbutionSortImage);
                             m_ReportApp.m_SImageWindow.Activate();
                             m_ReportApp.im_Control_DrawDistrbutionSortImage.GetDistrbutionSortimage_ByQuery(m_CurrentConditions);
-                            m_ReportApp.im_Control_DrawDistrbutionSortImage.SetSelectParticle(m_ReportApp.GetSelectedParticles());
+                            //if (m_ReportApp.im_ParticlesGridDevidePage != null)
+                            //{
+                            //    m_ReportApp.im_Control_DrawDistrbutionSortImage.SetSelectParticle(m_ReportApp.im_ParticlesGridDevidePage.GetParticleslist_select());
+                            //}
                         }
                     }
 
@@ -684,7 +694,7 @@ namespace OTSIncAReportApp
                             m_ReportApp.m_TablesWindow.Activate();
                             break;
                         case CALCULATE_TABLE_TYPE.PARTICALE_GENE_INFO:
-                            if (m_ReportApp.im_ParticlesGridDevidePage != null && m_ReportApp.im_ParticlesGridDevidePage.FileName == m_fileName&&!m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.WhetherThereAreDeleteParticles()&& m_ReportApp.GetSelectedParticles().Count == 0)
+                            if (m_ReportApp.im_ParticlesGridDevidePage != null && m_ReportApp.im_ParticlesGridDevidePage.FileName == m_fileName&&!m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.WhetherThereAreDeleteParticles())
                             {
                                 m_ReportApp.m_TablesWindow.Controls.Clear();
                                 m_ReportApp.m_TablesWindow.Controls.Add(m_ReportApp.im_ParticlesGridDevidePage);

+ 20 - 45
OTSIncAReportApp/1-UI/frmReportApp.cs

@@ -57,15 +57,7 @@ namespace OTSIncAReportApp
         public OTSRibbonFun m_RibbonFun = null;                                             //报告菜单相关操作类
   
 
-        //测量结果ID
-
-
         //当前工作结果
-
-
-
-
-        public static Dictionary<Guid, DisplayParticle> selectedParticles = new Dictionary<Guid, DisplayParticle>();     //所有选择颗粒
         public static RectangleF selectedRegion = new RectangleF();
         public RptConfigFile m_RptConfigFile;
         public string MoreSource = "";
@@ -170,48 +162,34 @@ namespace OTSIncAReportApp
         /// 德标
         /// </summary>
         public OTSIncAReportGB.DINStandardABCDDS im_DINStandardABCDDS = null;
-
         public List<Particle> GetSelectedParticles()
         {
-            List<Particle> parts = new List<Particle>();
-            foreach (var p in selectedParticles.Values)
-            {
-                if (!p.IsDeleted)
-                {
-                    parts.Add(p.objParticleData);
-                }
-            }
-            return parts;
-        }
-        protected void DeleteSelectedParticles()
-        {
-            foreach (var p in selectedParticles.Values)
-            {
-                var dp = (p as DisplayParticle);
-                dp.IsSelect = false;
-            }
-        }
-        public void AddParticlesToSelectedParticles(List<Particle> value)
-        {
-            foreach (var p in im_Control_DrawDistrbutionImageAndBSE.m_list_allDPart)
+            List<Particle> Particles = new List<Particle>();
+            int tabIndex = (int)(m_conditionChoose.tabIndex);
+            switch (tabIndex)
             {
-                var dp = p;
-                foreach (var p2 in value)
-                {
-                    if (dp.objParticleData.FieldId == p2.FieldId)
+                case (int)DisplayPicutureType.AnalyzeImg:
+                    
+                    foreach (var dp in im_Control_DrawDistrbutionImageAndBSE.m_list_allDPart)
                     {
-                        if (dp.objParticleData.ParticleId == p2.ParticleId)
+                        if (dp.IsSelect)
                         {
-                            if (!selectedParticles.ContainsKey(dp.guid))
-                            {
-                                dp.IsSelect = true;
-                                selectedParticles.Add(dp.guid, dp);
-                                break;
-                            }
+                            Particle particle = new Particle();
+                            particle.FieldId = ((OTSIncAReportGraph.DisplayParticle)dp).FieldId;
+                            particle.ParticleId = ((OTSIncAReportGraph.DisplayParticle)dp).ParticleId;
+                            Particles.Add(particle);
                         }
                     }
-                }
+                    break;
+                case (int)DisplayPicutureType.AnalyzeDataTable:
+                    Particles = im_ParticlesGridDevidePage.GetParticleslist_select();
+                    break;
+                default:
+                    break;
             }
+
+
+            return Particles;
         }
         #endregion //--------------------------------------------------------------------------------------------
 
@@ -845,7 +823,6 @@ namespace OTSIncAReportApp
         private void rbCancel_Click(object sender, EventArgs e)
         {
             int tabIndex = (int)(m_conditionChoose.tabIndex);
-            DeleteSelectedParticles();
             switch (tabIndex)
             {
                 case (int)DisplayPicutureType.AnalyzeImg:
@@ -857,7 +834,6 @@ namespace OTSIncAReportApp
                         {
                             //分布图
                             im_Control_DrawDistrbutionImageAndBSE.DeselectAllParticle();
-                            selectedParticles.Clear();
                         }
                     }
                     else
@@ -865,7 +841,6 @@ namespace OTSIncAReportApp
                         if (im_Control_DrawDistrbutionSortImage != null)
                         {
                             im_Control_DrawDistrbutionSortImage.DeselectAllParticle();
-                            selectedParticles.Clear();
                         }
                     }
                     break;

+ 10 - 4
OTSIncAReportApp/1-UI/frmSampleImage.cs

@@ -72,13 +72,19 @@ namespace OTSIncAReportApp
             //判断分布图,排序图全局对象是否为空,不为空的话,加载选择列表,用此来代替刷新,对颗粒列表中的选择颗粒,显示选择到分布图与排序图中
             if (m_ReportApp.im_Control_DrawDistrbutionImageAndBSE != null)
             {
-                //分布图显示选择颗粒
-                m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.SetSelectParticle(m_ReportApp.GetSelectedParticles());
+                if (m_ReportApp.im_ParticlesGridDevidePage != null)
+                {
+                    //分布图显示选择颗粒
+                    m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.DisplayParticleByParticlelist(m_ReportApp.im_ParticlesGridDevidePage.GetParticleslist_select());
+                }
             }
             if (m_ReportApp.im_Control_DrawDistrbutionSortImage != null)
             {
-                //排序图显示选择颗粒
-                m_ReportApp.im_Control_DrawDistrbutionSortImage.SetSelectParticle(m_ReportApp.GetSelectedParticles());
+                if (m_ReportApp.im_ParticlesGridDevidePage != null)
+                {
+                    //排序图显示选择颗粒
+                    m_ReportApp.im_Control_DrawDistrbutionSortImage.SetSelectParticle(m_ReportApp.GetSelectedParticles());
+                }
             }
 
         }

+ 2 - 2
OTSIncAReportApp/1-UI/frmTables.cs

@@ -47,7 +47,7 @@ namespace OTSIncAReportApp
             {
                 if (m_ReportApp.im_Control_DrawDistrbutionImageAndBSE != null)
                 {
-                    if (m_ReportApp.m_TablesWindow.Controls.Count == 0 || m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.WhetherThereAreDeleteParticles() || m_ReportApp.GetSelectedParticles().Count != 0)
+                    if (m_ReportApp.m_TablesWindow.Controls.Count == 0 || m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.WhetherThereAreDeleteParticles())
                     {
                         m_ReportApp.m_conditionChoose.tabIndex = DisplayPicutureType.AnalyzeDataTable;
                         m_ReportApp.m_conditionChoose.ShowsTheDefaultPic();
@@ -56,7 +56,7 @@ namespace OTSIncAReportApp
 
                 else
                 {
-                    if (m_ReportApp.m_TablesWindow.Controls.Count == 0 || m_ReportApp.GetSelectedParticles().Count != 0)
+                    if (m_ReportApp.m_TablesWindow.Controls.Count == 0)
                     {
                         m_ReportApp.m_conditionChoose.tabIndex = DisplayPicutureType.AnalyzeDataTable;
                         m_ReportApp.m_conditionChoose.ShowsTheDefaultPic();