Ver Fonte

optimize the operating speed of aliment image.

gsp há 4 anos atrás
pai
commit
708123761e

+ 2 - 0
Bin/x64/Debug/Resources/XMLData/AppResource_EN.xml

@@ -782,6 +782,8 @@
 	  <Control name="str8" text="Gray scale#" />
 	  <Control name="str9" text="Move SEM to current position" />
 	  <Control name="str10" text="Move SEM to particle view position" />
+          <Control name="partcletype9" text="NOT_IDENTIFIED" />
+	  <Control name="partcletype10" text="Analytical Particles" />
     </Controls>
  </Form>
  <!-- OTSIncAMeasureApp -->

+ 2 - 0
Bin/x64/Debug/Resources/XMLData/AppResource_ZH.xml

@@ -782,6 +782,8 @@
 	  <Control name="str8" text="灰度#" />
 	  <Control name="str9" text="移动SEM到当前位置" />
 	  <Control name="str10" text="移动SEM到颗粒视域位置" />
+          <Control name="partcletype9" text="未识别颗粒" />
+	  <Control name="partcletype10" text="分析颗粒" />
     </Controls>
  </Form>
   <!-- OTSIncAMeasureApp -->

+ 462 - 158
OTSIncAReportApp/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -1,4 +1,5 @@
-using OTSIncAReportApp.DataOperation.Model;
+using OTSIncAReportApp.DataOperation.DataAccess;
+using OTSIncAReportApp.DataOperation.Model;
 using OTSIncAReportApp.SysMgrTools;
 using OTSIncAReportGraph.Class;
 
@@ -9,6 +10,7 @@ using OTSPeriodicTable;
 using System;
 using System.Collections.Generic;
 using System.Data;
+using System.Diagnostics;
 using System.Drawing;
 using System.Drawing.Drawing2D;
 using System.IO;
@@ -21,6 +23,9 @@ namespace OTSIncAReportGraph.Controls
 {
     public partial class Control_DrawDistrbutionImageAndBSE : UserControl
     {
+
+        //防止segment过多的数量限制,先写300吧,过少也不好,过防止过多程序而卡死
+        private const int m_segment_overflownumber = 400;
         #region 变量定义
 
         //国际化
@@ -39,7 +44,7 @@ namespace OTSIncAReportGraph.Controls
         //这里要做成控件,不要是窗体
         public List<BaseObject> m_list_usebject = new List<BaseObject>();
         //记录原值,颗粒和线段
-        public List<BaseObject> m_old_list_baseobject = null;
+        public List<BaseObject> m_original_list_baseobject = null;
         //记录国标区域列表对象
         public List<DField> m_list_GBobject = null;
         //record the GBField
@@ -133,7 +138,7 @@ namespace OTSIncAReportGraph.Controls
      
 
         //底层封装类
-        OTSIncAReportFun m_OTSIncAReportFun = null;
+        OTSIncAReportFun m_ReportFun = null;
 
         //当前鼠标的位置
         Point m_mouse_now_point = new Point();
@@ -223,7 +228,7 @@ namespace OTSIncAReportGraph.Controls
             m_list_dfield = new List<DField>();
             m_old_list_dfield = new List<DField>();
             m_list_baseobject = new List<BaseObject>();
-            m_old_list_baseobject = new List<BaseObject>();
+            m_original_list_baseobject = new List<BaseObject>();
             m_list_historyapolygon = new List<HistoryApolygon>();
             m_frm_userprogress = new Frm_UserProgress();
 
@@ -235,7 +240,7 @@ namespace OTSIncAReportGraph.Controls
             resultFile = m_ReportApp.resultFilesList[m_ReportApp.WorkingResult];
 
             //初始化底层操作类
-            m_OTSIncAReportFun = new OTSIncAReportFun(this, resultFile);
+            m_ReportFun = new OTSIncAReportFun(resultFile);
             
             InitializeComponent();
             #region 国际化语言
@@ -247,6 +252,7 @@ namespace OTSIncAReportGraph.Controls
 
         private void Control_DrawDistrbutionImageAndBSE_Load(object sender, EventArgs e)
         {
+           //var table = lan.GetNameTable("OTSIncAReportFun");
             //显示进度条,计算进度条应该显示的位置和宽度
             Form ls_main_form = this.ParentForm.ParentForm;//取出父窗体
             m_frm_userprogress.Width = (int)(MyPrimaryScreen.DESKTOP.Width / MyPrimaryScreen.ScaleX * 0.9);
@@ -256,7 +262,7 @@ namespace OTSIncAReportGraph.Controls
 
 
             //执行获取颗粒分布图数据,总过程函数
-            m_OTSIncAReportFun.GetDistrbutionImageAndBSE_Total(m_ReportApp);
+           GetDistrbutionImageAndBSE_Total();
 
             //设置双缓冲
             SetDoubleBufferByIsDraw();
@@ -279,8 +285,9 @@ namespace OTSIncAReportGraph.Controls
             //记录原值,用于缩放计算操作 ,此处要用克隆 ,原particle颗粒的值,在底层调用时已经赋值过了
             foreach (DParticle ls_dp in m_list_baseobject)
             {
+                ls_dp.Operator = ParticleOperator.DISPLAY;
                 DParticle old_dp = ls_dp.Clone() as DParticle;
-                m_old_list_baseobject.Add(old_dp);
+                m_original_list_baseobject.Add(old_dp);
             }
 
             //加载时将背景rect设置与整个窗体一边大小
@@ -307,8 +314,377 @@ namespace OTSIncAReportGraph.Controls
             //加载完成,关闭进度条
             m_frm_userprogress.Close();
         }
+        /// <summary>
+        /// 获取组整个获取分布图和排序图图像数据的底层数据组建方式,的总过程
+        /// </summary>
+        public void GetDistrbutionImageAndBSE_Total()
+        {
+            string str27 = "begin to loading data....";
+            //str27 = table["str27"].ToString();
+            m_frm_userprogress.SetProgressValueAndText(1, str27);
+            //对底层加载速度进行计时
+            Stopwatch stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            string path = resultFile.FilePath;
+            FieldData fieldData = new FieldData(path);
+            List<Field> fieldlist = fieldData.GetFieldList();
+
+            //防止有时底层返回的Field的List是0,直接返回
+            if (fieldlist.Count == 0)
+            {
+                string str28 = "field number =0 !....";
+                //str28 = table["str28"].ToString();
+                m_frm_userprogress.SetProgressValueAndText(100, str28);
+                return;
+            }
+
+            //底层加载field对象结束
+            stopwatch.Stop();
+            TimeSpan timespan = stopwatch.Elapsed;
+
+            //重置计数器,对组建和计算图像进行计时
+            stopwatch.Reset();
+            stopwatch.Start();
+            string str29 = "begin to composit field picture....";
+            //str29 = table["str29"].ToString();
+            m_frm_userprogress.SetProgressValueAndText(15, str29);
+
+            //将field的list对象给全局变量中,供后面获取xray使用,不需要再次重新加载数据,以提升速度
+            m_ReportFun.m_list_OTSField = fieldlist;
+
+            //第一次循环,用来计算单个Field的像素分辨率,和将所有的物理位置存放到List当中
+            List<Point> list_point = new List<Point>();
+            int i_field_width = 0, i_field_height = 0;
+            //获取到该field的分辨率大小,循环中都是一样的
+
+            if (fieldlist.Count > 0)
+            {
+                Bitmap bitmp = DrawFunction.ReadImageFile(fieldlist[0].FieldImage);
+                i_field_width = bitmp.Width;
+                i_field_height = bitmp.Height;
+            }
+
+            for (int i = 0; i < fieldlist.Count(); i++)
+            {
+                //然后取出物理坐标,这个一会要与分辨率坐标进行变算一下
+                Point ls_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };
+                list_point.Add(ls_point);
+            }
+
+            //对单个视域的屏幕像素宽高,进行记录
+            m_OneField_Screen_BackRectf = new RectangleF(0, 0, i_field_width, i_field_height);
+
+            //获取单个OTS视域像素宽高,并进行记录
+            Rectangle OTS_FieldRect = m_ReportFun. GetOneFieldWidthAndHeight(list_point);
+            m_OneField_OTS_Rectf = OTS_FieldRect;
+
+            //计算出整个绘制图像总Rectagnle的大小
+            m_backrectf = m_ReportFun. ConvertAndGetMaxRect(list_point, i_field_width, i_field_height);
+            string str30 = "calculate ruler....";
+            //str30 = table["str30"].ToString();
+            //更新进度条提示
+            m_frm_userprogress.SetProgressValueAndText(18, str30);
+
+            #region //标尺相关------------------------------------------------------------------------------
+            //在此处通过上面的i_field_width,ifield_height和list_point,来计算出个像素与实际物理值的比例
+            Rectangle ls_jsblrect = m_ReportFun.GetOneFieldWidthAndHeight(list_point);
+            //然后用宽度来除以i_field_width 获取单个的像素比例
+            double d_onepixel_scale = Convert.ToDouble(ls_jsblrect.Width) / Convert.ToDouble(i_field_width);
+            //再用该比例对标尺进行相应的赋值
+            m_f_onepixel_size = (float)d_onepixel_scale;
+
+            //对整个物理像素的范围进行获取与设置
+            Rectangle ls_offsetandtopleftrect = m_ReportFun.GetWlRectTopLeftAndRect(list_point, ls_jsblrect.Width, ls_jsblrect.Height);
+            m_back_wl_rectf = new RectangleF(ls_offsetandtopleftrect.X, ls_offsetandtopleftrect.Y
+                , ls_offsetandtopleftrect.Width, ls_offsetandtopleftrect.Height);
+            #endregion //---------------------------------------------------------------------------------------
+
+            string str31 = "composit whole picture....";
+            //str31 = table["str31"].ToString();
+            //更新进度条提示
+            m_frm_userprogress.SetProgressValueAndText(20, str31);
+
+            //70的进度条给到下面的循环中,计算进度条各分类进度分配
+            float ls_int_progresscalc = 0;
+            if (fieldlist.Count > 0)
+                ls_int_progresscalc = (float)70 / (float)fieldlist.Count;
+
+            string str32 = "finished:";
+            //str32 = table["str32"].ToString();
+            string str33 = "total:";
+            //str33 = table["str33"].ToString();
+            string str34 = "field...";
+            //str34 = table["str34"].ToString();
+
+            //再通过Field取到对应的Particle,循环一次
+            for (int i = 0; i < fieldlist.Count(); i++)
+            {
+                //更新进度条提示
+                m_frm_userprogress.SetProgressValueAndText(20 + (int)(ls_int_progresscalc * (i + 1)), str32 + i.ToString() + str33 + m_ReportFun.m_list_OTSField.Count.ToString() + str34);
+
+                //先获取该Field中的所有Particle
+                List<Particle> list_particle = new List<Particle>();
+                list_particle = fieldlist[i].ParticleList;
+
+                //取出该Field的物理坐标,将其转换成对应的屏幕像素坐标,屏幕左上角为原点(0,0)的偏移值,用于后面计算各Segment的位置使用
+                //应该也就是这里根据OTS坐标转换到屏幕像素坐标,Y轴是反的,所以在这里对从OTS坐标转换成屏幕坐标的地方进行反转!
+                Point thisfield_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };
+                Point offset_point = m_ReportFun.GetFieldPhysicsConvertToScreen(list_point, i_field_width, i_field_height, thisfield_point);
+
+                //保存该Field最终在屏幕上显示的位置及大小
+                DField df = new DField();
+                df.FieldID = fieldlist[i].FieldID.ToString();
+                df.Show_Rect = new Rectangle(offset_point, new Size(i_field_width, i_field_height));
+                df.Current_Rect = new Rectangle(offset_point, new Size(i_field_width, i_field_height));
+                df.OTS_RECT = new RectangleF(thisfield_point.X, thisfield_point.Y, OTS_FieldRect.Width, OTS_FieldRect.Height);
+                m_list_dfield.Add(df);
+
+                //然后将取出的数据,转换成Bitmap对象
+                Bitmap ls_bt = DrawFunction.ReadImageFile(fieldlist[i].FieldImage);
+
+                //再循环计算所有的Particle对象
+                foreach (Particle particle in list_particle)
+                {
+
+                    //从Clr中获取所有的Segment的List对象
+                    List<Feature> list_feature = new List<Feature>();
+                    list_feature = particle.FeatureList;
+
+                    //创建颗粒分布图对应的类对象
+                    List<DSegment> list_dsegment = new List<DSegment>();
+
+                    //创建DParticle颗粒,保存与之对应的颗粒tagid和particleid,为了后面取xray数据及多选时获取多选cotsparticleclr列表
+                    DParticle dp = new DParticle();
+                    dp.CLRTagID = particle.ParticleId;
+                    dp.CLRFieldID = particle.FieldId;
+                    dp.STDTypeID = particle.TypeId;
+                    dp.TypeId = particle.TypeId;
+                    dp.TypeName = particle.TypeName;
+                    dp.XRayId = particle.XrayId;
+                    dp.SEMPosX = particle.SEMPosX;
+                    dp.SEMPosY = particle.SEMPosY;
+                    //获取该颗粒在STD标准库中已分析出化合物对应的颜色
+                    dp.Color = m_ReportFun.GetColorBySTDTypeIDForBSEAndSorImage(particle.TypeColor, particle.TypeId);
+
+                    //防止超大颗粒,会让程序死掉
+                    if (list_feature.Count < m_segment_overflownumber)
+                    {
+                        //再循环取出里面所有的segment
+                        foreach (Feature feature in list_feature)
+                        {
+                            #region 创建DSegment对象,并将STD分析出的化合物颜色保存到DSegment对象中
+                            //对Particle里的Segment进行偏移的计算等,创建了DSegment的大小
+                            DSegment ds = new DSegment();
+                            ds.Rect = new Rectangle(feature.Start + offset_point.X,
+                               //i_field_height - ls_cotssegmentclr.GetHeight() + offset_point.Y,//这是让单个Field的图像按Y轴反过来
+                               feature.Height + offset_point.Y,
+                                feature.Length,
+                                1);
+
+                            ds.Color = dp.Color;//将线的颜色对应到颗粒的颜色
+                            #endregion
+
+                            #region //这里是在Field中,抠取出原BSE图像到DSegment中--------------------------------
+                            //ls_bt.RotateFlip(RotateFlipType.Rotate180FlipX);//使用系统带的图像处理方法,进行Y轴的翻转,与上面记录位置对应
+                            //合成图像完成,开始抠取像素-----------------------------------------------------------------
+                            int f_length = feature.Length;
+                            List<Color> ls_list_colors = new List<Color>();
+                            for (int m = 0; m < f_length; m++)
+                            {
+                                //这里实现一下代码保护
+                                int lsjs_x = feature.Start + m;
+                                //int lsjs_y = i_field_height - ls_cotssegmentclr.GetHeight();//这个反转要与上面对应
+                                int lsjs_y = feature.Height;
+                                if (lsjs_x < 0)
+                                    lsjs_x = 0;
+                                if (lsjs_x >= i_field_width)
+                                    lsjs_x = i_field_width - 1;
+                                if (lsjs_y < 0)
+                                    lsjs_y = 0;
+                                if (lsjs_y >= i_field_height)
+                                    lsjs_y = i_field_height - 1;
+
+                                //按理说这里应该加上个横向抠取像素颜色,这里需要再处理一下
+                                ls_list_colors.Add(ls_bt.GetPixel(lsjs_x,
+                                   lsjs_y));
+                            }
+                            //保存原BSE图中的颜色列表
+                            ds.List_Colors = ls_list_colors;
+                            #endregion //------------------------------------------------------------------------------
+
+                            list_dsegment.Add(ds);
+                            //ls_bt.Dispose();
+                        }
+                    }
+                    //设置Particle在0.5F倍数以上时才进行显示
+                    dp.Zoom_DisPlayMultiplier = 0.5f;
+                    dp.Zoom_DisPlay = true;
+                    dp.Operator = ParticleOperator.DISPLAY;
+
+                    //将segment对应的设置到particle中
+                    dp.DSegments = list_dsegment;
+
+                    //并对DParticle相关信息进行计算
+                    dp.Rect = dp.GetRectFromDSegment();
+                    dp.GPath = dp.GetRegionFromDSegments();
+                    dp.SmallRect = dp.GetSmallRectangleFromRect();
+
+                    //将每个颗粒添加到颗粒分布图中的列表中
+                    m_list_baseobject.Add(dp);
+                    if (dp.XRayId > -1)
+                    {
+                        m_list_usebject.Add(dp);
+                    }
+
+                }
+            }
+
+            string str35 = "convert solution...";
+            //str35 = table["str35"].ToString();
+            //更新进度条相关显示
+            m_frm_userprogress.SetProgressValueAndText(90, str35);
+
+            //然后这里还需要计算出,各field的宽和高,帧图边框分别需要显示多少个框
+            if (i_field_width != 0 && i_field_height != 0)
+            {
+                m_i_grid_showlinesnumber_width = Convert.ToInt32(BackRectF.Width / i_field_width);
+                m_i_grid_showlinesnumber_height = Convert.ToInt32(BackRectF.Height / i_field_height);
+            }
+            string str36 = "other work...";
+            //str36 = table["str36"].ToString();
+            //结束组建计算图像计数
+            stopwatch.Stop();
+            TimeSpan timespan2 = stopwatch.Elapsed;
+
+            m_frm_userprogress.SetProgressValueAndText(95, str36);
+            string str37 = "minute: ";
+            //str37 = table["str37"].ToString();
+            string str38 = "second  total(";
+            //str38 = table["str38"].ToString();
+            string str39 = ")ms";
+            //str39 = table["str39"].ToString();
+            //相关计数
+            m_ReportFun.m_field_count = fieldlist.Count;
+            m_ReportFun.m_particle_count = m_list_baseobject.Count;
+            m_ReportFun.m_time_str = timespan.TotalMinutes.ToString("0.00") + str37 + timespan.TotalSeconds.ToString("0.00") + str38 + timespan.TotalMilliseconds.ToString() + str39;
+            m_ReportFun.m_time_str2 = timespan2.TotalMinutes.ToString("0.00") + str37 + timespan2.TotalSeconds.ToString("0.00") + str38 + timespan2.TotalMilliseconds.ToString() + str39;
+        }
+        /// <summary>
+        /// 根据颗粒排序图获取已经选择上的颗粒,返回被选择上的颗粒的列表
+        /// </summary>
+        /// <returns></returns>
+        public List<Particle> GetSelectedParticleList_ForDrawDistrbutionImageAndBSE()
+        {
+            List<Particle> ls_list_cotsparticleclr = new List<Particle>();
+
+            //防止为空校验判断
+            if (m_ReportFun.m_list_OTSField == null)
+                return ls_list_cotsparticleclr;
+
+            //先取出,所有被选择的dparticle列表的
+            List<DParticle> ls_list_dp = new List<DParticle>();
+            foreach (DParticle ls_dp in m_list_baseobject)
+            {
+                if (ls_dp.Operator == ParticleOperator.SELECTED)
+                {
+                    ls_list_dp.Add(ls_dp);
+                }
+            }
+
+            //并开始查找包含tagid和fieldid的cotsparticle的对象,保存到list当中
+            for (int i = 0; i < ls_list_dp.Count(); i++)
+            {
+                for (int j = 0; j < m_ReportFun.m_list_OTSField.Count(); j++)
+                {
+                    //先获取该field中的所有particle
+                    List<Particle> list_cotsparticleclr = new List<Particle>();
+                    list_cotsparticleclr = m_ReportFun.m_list_OTSField[j].ParticleList;
+
+                    for (int k = 0; k < list_cotsparticleclr.Count(); k++)
+                    {
+                        if (list_cotsparticleclr[k].ParticleId == ls_list_dp[i].CLRTagID
+                            && list_cotsparticleclr[k].FieldId == ls_list_dp[i].CLRFieldID)
+                        {
+                            ls_list_cotsparticleclr.Add(list_cotsparticleclr[k]);
+                        }
+                    }
+                }
+            }
+
+            return ls_list_cotsparticleclr;
+        }
+        /// <summary>
+        /// 分布图和BSE图中,从底层获取相关结果后,重新组织显示
+        /// </summary>
+        /// <param name="ls_cgriddataclr"></param>
+        public void DrawBSEDistributionImageByQuery(OTSIncAReportApp.OTSSampleReportInfo.OTSSampleMeaInfo sourceGridData)
+        {
+            var display = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 7);
+            string display_type = display.itemVal.ToString();
+            int disindex = display.comboDownList.IndexOf(display_type);
+            var list = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 10);
+            string size = list.itemVal.ToString();
+            int index = list.comboDownList.IndexOf(size);
+            string size_cal_method_type = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 13).itemVal.ToString();
+            string con = "";
+            switch (size_cal_method_type)
+            {
+                case "DMAX":
+                    con = "DMAX";
+                    break;
+                case "DMIN":
+                    con = "DMIN";
+                    break;
+                case "Area":
+                    con = "Area";
+                    break;
+                case "FERET":
+                    con = "DFERET";
+                    break;
+            }
+            string min = "0";
+            string max = "999";
+            if (index != 0)
+            {
+                max = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 12).itemVal.ToString();
+                min = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 11).itemVal.ToString();
+                if (max.ToLower() == "max")
+                {
+                    max = "999";
+                }
+            }
+
+            //string path = resultFile.FilePath;
+            //ParticleData particleData = new ParticleData(path);
+            //List<Particle> particles = particleData.GetParticleListByCon(con, max, min, disinde);
+
+            foreach (DParticle ls_dp in m_list_baseobject)
+            {
+                //int dis = 0;
+                //foreach (Particle particle in particles)
+                //{
+                //    //找到对应的颗粒,将分类设置进去
+                //    if (ls_dp.CLRTagID == particle.ParticleId && ls_dp.CLRFieldID == particle.FieldId)
+                //    {
+
+                //        ls_dp.ParticleFL = particle.TypeName;
+                //        ls_dp.Operator = ParticleOperator.DISPLAY;
+                //        dis = 1;
+                //        break;
+                //    }
 
+                //}
+                //if (dis == 0)
+                //{
+                //    ls_dp.Operator = ParticleOperator.NODISPLAY;
+                //}
 
+                ls_dp.Operator = ParticleOperator.DISPLAY;
+
+            }
+
+        }
         #endregion
 
         #region 设置双缓冲
@@ -373,7 +749,13 @@ namespace OTSIncAReportGraph.Controls
             {
                 DParticle dp = (DParticle)item;
                 if (dp.Operator != ParticleOperator.DELETED)
-                    item.OnPaint(e);
+                {
+                    if (dp.Operator == ParticleOperator.DISPLAY)
+                    {
+                        item.OnPaint(e);
+                    }                
+
+                }                  
             }
             #endregion
 
@@ -504,27 +886,37 @@ namespace OTSIncAReportGraph.Controls
 
             for (int i = 0; i < m_list_baseobject.Count(); i++)
             {
-                DParticle ls_dp = (DParticle)m_list_baseobject[i];
+                DParticle dp = (DParticle)m_list_baseobject[i];
+                
+                
+                    dp.Operator = ParticleOperator.DISPLAY;
+                    for (int y = 0; y < dp.DSegments.Count(); y++)
+                    {
+                        //这里重新设置每条线的高度,和x,y坐标
+                        DSegment ds = dp.DSegments[y];
+                        DSegment old_ds = ((DParticle)m_original_list_baseobject[i]).DSegments[y];
+                        ds.PenWidthAndHeight = ds.PenWidthAndHeight + old_ds.PenWidthAndHeight
+                            * in_f_zoom_increment;
+
+                        ds.Rect = new RectangleF(ds.Rect.X + old_ds.Rect.X * in_f_zoom_increment + f_czx, ds.Rect.Y + old_ds.Rect.Y * in_f_zoom_increment + f_czy,
+                           ds.Rect.Width + old_ds.Rect.Width * in_f_zoom_increment, ds.Rect.Height + old_ds.Rect.Height * in_f_zoom_increment);
+                    }
 
-                for (int y = 0; y < ls_dp.DSegments.Count(); y++)
+               
+                if (dp.Rect.Left < 0 || dp.Rect.Right > this.Width || dp.Rect.Top < 0 || dp.Rect.Bottom > this.Height)
                 {
-                    //这里重新设置每条线的高度,和x,y坐标
-                    DSegment ds = ls_dp.DSegments[y];
-                    DSegment old_ds = ((DParticle)m_old_list_baseobject[i]).DSegments[y];
-                    ds.PenWidthAndHeight = ds.PenWidthAndHeight + old_ds.PenWidthAndHeight
-                        * in_f_zoom_increment;
-
-                    ds.Rect = new RectangleF(ds.Rect.X + old_ds.Rect.X * in_f_zoom_increment + f_czx, ds.Rect.Y + old_ds.Rect.Y * in_f_zoom_increment + f_czy,
-                       ds.Rect.Width + old_ds.Rect.Width * in_f_zoom_increment, ds.Rect.Height + old_ds.Rect.Height * in_f_zoom_increment);
+                    dp.Operator = ParticleOperator.NODISPLAY;
                 }
+
+
                 //设置缩放到多少倍时进行显示
-                if (ls_dp.Zoom_DisPlayMultiplier <= m_f_zoom_record)
+                if (dp.Zoom_DisPlayMultiplier <= m_f_zoom_record)
                 {
-                    ls_dp.Zoom_DisPlay = true;
+                    dp.Zoom_DisPlay = true;
                 }
                 else
                 {
-                    ls_dp.Zoom_DisPlay = false;
+                    dp.Zoom_DisPlay = false;
                 }
             }
             if (m_list_dfield != null)
@@ -735,7 +1127,7 @@ namespace OTSIncAReportGraph.Controls
                 {
                     DParticle dp = (DParticle)item;
                     //明白了,选择第一个时,被第二个刷掉了
-                    if (true == WhetherInRange(dp, e.Location))
+                    if (true ==m_ReportFun. WhetherInRange(dp, e.Location))
                     {
                         dp.IsMouseMove = true;
                         //获取颗粒ID
@@ -748,6 +1140,7 @@ namespace OTSIncAReportGraph.Controls
                     }
                     else
                     {
+                      
                         dp.IsMouseMove = false;
 
                         //移动在颗粒外面时,要判断,Operator_ShowXray不为选下显示XRAY时,才对XRay进行隐藏
@@ -780,6 +1173,10 @@ namespace OTSIncAReportGraph.Controls
                         //重新计算小矩形边框
                         dp.SmallRect = dp.GetSmallRectangleFromRect();
                     }
+                    if (dp.Rect.Left < 0 || dp.Rect.Right > this.Width || dp.Rect.Top < 0 || dp.Rect.Bottom > this.Height)
+                    {
+                        dp.Operator = ParticleOperator.NODISPLAY;
+                    }
                 }
 
                 foreach (var item in m_list_dfield)
@@ -811,7 +1208,7 @@ namespace OTSIncAReportGraph.Controls
                 DParticle dp = (DParticle)item;
                 if (dp.Operator != ParticleOperator.NODISPLAY)
                 {
-                    if (true == WhetherInRange(dp, e.Location))
+                    if (true == m_ReportFun.WhetherInRange(dp, e.Location))
                     {
                         ////并保存到变量中,供移动电镜使用
        
@@ -882,7 +1279,7 @@ namespace OTSIncAReportGraph.Controls
                                 PointF[] lspointf = dp.GPath.PathPoints;
                                 for (int i = 0; i < lspointf.Count(); i++)
                                 {
-                                    if (true == WhetherInRange(dp, lspointf[i]))
+                                    if (true == m_ReportFun.WhetherInRange(dp, lspointf[i]))
                                     {
                                         //选择到了该路径,那么就选取该图像
                                         dp.Operator = ParticleOperator.SELECTED;
@@ -950,7 +1347,7 @@ namespace OTSIncAReportGraph.Controls
                         foreach (DParticle dp in m_list_baseobject)
                         {
                             PointF[] lspointf = dp.GPath.PathPoints;
-                            if (true == WhetherInRange(dp, new Point(e.X, e.Y)))
+                            if (true == m_ReportFun.WhetherInRange(dp, new Point(e.X, e.Y)))
                             {
                                 //选择到了该路径,那么就选取该图像b
                                 dp.Operator_ShowXRay = ParticleOperatorShowXray.SELECTANDDISPLAYXRAY;
@@ -987,7 +1384,7 @@ namespace OTSIncAReportGraph.Controls
                 //这个判断右键菜单加在这里,也不知道对不对
                 foreach (BaseObject item in m_list_baseobject)
                 {
-                    if (true == WhetherInRange((DParticle)item, e.Location))
+                    if (true == m_ReportFun.WhetherInRange((DParticle)item, e.Location))
                     {
                         DParticle dp = (DParticle)item;
                         CMenuStrip.Items[0].Enabled = true;
@@ -1088,7 +1485,7 @@ namespace OTSIncAReportGraph.Controls
             m_list_dfield = new List<DField>();
             m_old_list_dfield = new List<DField>();
             m_list_baseobject = new List<BaseObject>();
-            m_old_list_baseobject = new List<BaseObject>();
+            m_original_list_baseobject = new List<BaseObject>();
             m_list_historyapolygon = new List<HistoryApolygon>();
             m_frm_userprogress = new Frm_UserProgress();
 
@@ -1159,7 +1556,7 @@ namespace OTSIncAReportGraph.Controls
             List<Element> list_celementchemistryclr = new List<Element>();
 
             //获取Xray数据
-            m_OTSIncAReportFun.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(m_move_dparticle.CLRTagID, m_move_dparticle.CLRFieldID, out Search_xray, out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
+            m_ReportFun.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(m_move_dparticle.CLRTagID, m_move_dparticle.CLRFieldID, out Search_xray, out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
 
             //get CElementChemistryClr list
             List<ShowElementInfo> list_showelementinfo = new List<ShowElementInfo>();
@@ -1222,7 +1619,7 @@ namespace OTSIncAReportGraph.Controls
             uint u_color = 0;
             try
             {
-                u_color = DrawFuncation.GetPixel(hdc, int_x, int_y);
+                u_color = DrawFunction.GetPixel(hdc, int_x, int_y);
             }
             catch
             { }
@@ -1241,7 +1638,7 @@ namespace OTSIncAReportGraph.Controls
         private void SelectParticleListSendToReportFrame()
         {
             //先获取分布图中,有哪些颗粒已经被选择上了
-            m_ReportApp.SelectedParticles = m_OTSIncAReportFun.GetSelectedParticleList_ForDrawDistrbutionImageAndBSE();
+            m_ReportApp.SelectedParticles = GetSelectedParticleList_ForDrawDistrbutionImageAndBSE();
         }
 
         /// <summary>
@@ -1308,12 +1705,12 @@ namespace OTSIncAReportGraph.Controls
                 return;
             }
 
-            if (m_mythread.ThreadState == ThreadState.Running || m_mythread.ThreadState == ThreadState.WaitSleepJoin)
+            if (m_mythread.ThreadState == System.Threading.ThreadState.Running || m_mythread.ThreadState == System.Threading.ThreadState.WaitSleepJoin)
             {
                 return;
             }
 
-            if (m_mythread.ThreadState == ThreadState.Stopped)
+            if (m_mythread.ThreadState == System.Threading.ThreadState.Stopped)
             {
                 m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
             }
@@ -1351,22 +1748,22 @@ namespace OTSIncAReportGraph.Controls
                 Point sem_point = (Point)in_obj;
 
                 //第一步,连接电镜
-                m_OTSIncAReportFun.ConnectToSEM();
+                m_ReportFun.ConnectToSEM();
 
                 Thread.Sleep(500);
 
                 //第二步,移动到指定位置,先读取再设置
-                if (m_OTSIncAReportFun.m_SEMConnectionState == true)
+                if (m_ReportFun.m_SEMConnectionState == true)
                 {
 
-                    m_OTSIncAReportFun.MoveSemToPointXY(sem_point.X, sem_point.Y);
+                    m_ReportFun.MoveSemToPointXY(sem_point.X, sem_point.Y);
 
                 }
 
                 Thread.Sleep(1500);
 
                 //第三步,断开电镜连接
-                m_OTSIncAReportFun.DisConnectSEM();
+                m_ReportFun.DisConnectSEM();
 
                 //Thread.Sleep(1000);
 
@@ -1379,15 +1776,17 @@ namespace OTSIncAReportGraph.Controls
         /// 按框架传入的底层计算结果,重新对颗粒进行区分显示
         /// </summary>
         /// <param name="in_cgriddataclr"></param>
-        public void DrawDistrbutionImageAndBSE_ByQuery(OTSIncAReportApp.OTSSampleReportInfo.OTSSampleMeaInfo in_list_cgriddataclr)
+        public void DrawDistrbutionImageAndBSE_ByQuery(OTSIncAReportApp.OTSSampleReportInfo.OTSSampleMeaInfo in_list_griddata)
         {
-            m_OTSIncAReportFun.GetDrawDistrbutionImageAndBSE_ByQuery(in_list_cgriddataclr);
+            DrawBSEDistributionImageByQuery(in_list_griddata);
+            //FullGraphMatch();
+            //Invalidate();
         }
 
         /// <summary>
         /// 对分布图进行宽度匹配操作
         /// </summary>
-        public void WidthMate()
+        public void WidthMatch()
         {
             if (this.Width != m_backrectf.Width)
             {
@@ -1405,7 +1804,7 @@ namespace OTSIncAReportGraph.Controls
         /// <summary>
         /// 对分布图进行高度匹配操作
         /// </summary>
-        public void HeightMate()
+        public void HeightMatch()
         {
             if (this.Height != m_backrectf.Height)
             {
@@ -1424,10 +1823,15 @@ namespace OTSIncAReportGraph.Controls
         /// <summary>
         /// 对分布图进行全图匹配操作
         /// </summary>
-        public void FullGraphMate()
+        public void FullGraphMatch()
         {
-            //全图匹配,首先要判断出来是按宽度来计算缩放,还是按高度来计算缩放
-            double ls_thiswidth = this.Width;
+            for (int i = 0; i < m_list_baseobject.Count(); i++)
+            {
+                DParticle dp = (DParticle)m_list_baseobject[i];
+                dp.Operator = ParticleOperator.DISPLAY;
+            }
+                //全图匹配,首先要判断出来是按宽度来计算缩放,还是按高度来计算缩放
+                double ls_thiswidth = this.Width;
             double ls_thisheight = this.Height;
             double ls_imagewidth = m_backrectf.Width;
             double ls_imageheight = m_backrectf.Height;
@@ -1443,7 +1847,7 @@ namespace OTSIncAReportGraph.Controls
             if (ls_thiswidth == ls_imagewidth && ls_thisheight < ls_imageheight)
             {
                 //说明目前已经达到了宽度匹配,但是未能显示完全整图需要高度匹配
-                HeightMate();
+                HeightMatch();
                 return;
 
             }
@@ -1452,7 +1856,7 @@ namespace OTSIncAReportGraph.Controls
             if (ls_thisheight == ls_imageheight && ls_thiswidth < ls_imagewidth)
             {
                 //说明目前已经达到了高度匹配,但是未能显示完全的整图需要宽度匹配
-                WidthMate();
+                WidthMatch();
                 return;
             }
 
@@ -1470,12 +1874,12 @@ namespace OTSIncAReportGraph.Controls
             if ((1 - ls_d_cz_width) > (1 - ls_d_cz_height))
             {
                 //宽差大,就调用WidthMate
-                WidthMate();
+                WidthMatch();
             }
             else
             {
                 //高差大,则调用HightMate
-                HeightMate();
+                HeightMatch();
             }
         }
 
@@ -1526,114 +1930,10 @@ namespace OTSIncAReportGraph.Controls
             Invalidate();
         }
 
-        /// <summary>
-        /// 判断该点是否在多边形的范围内
-        /// </summary>
-        /// <param name="inPoints"></param>
-        /// <param name="WhetherPoint"></param>
-        /// <returns></returns>
-        private bool WhetherInRange(DParticle Part,/*PointF[] inPoints,*/ Point WhetherPoint)
-        {
-            var rect = Part.Rect;
-            if ((rect.Left < WhetherPoint.X && WhetherPoint.X < rect.Right) && (rect.Top < WhetherPoint.Y && WhetherPoint.Y < rect.Bottom))
-            {
-                var itm = (BaseObject)Part;
-                PointF[] inPoints = itm.GPath.PathPoints;
-                bool b_inrange = false;
-                GraphicsPath myGraphicsPath = new GraphicsPath();
-                Region myRegion = new Region();
-                myGraphicsPath.Reset();
-
-                myGraphicsPath.AddPolygon(inPoints);
-                myRegion.MakeEmpty();
-                myRegion.Union(myGraphicsPath);
-                //返回判断点是否在多边形里
-                b_inrange = myRegion.IsVisible(WhetherPoint);
-                return b_inrange;
-            }
-            else
-            {
-                return false;
-            
-            }
-            
-        }
-
-        /// <summary>
-        /// 判断该点是否在多边形的范围内的float版本重载
-        /// </summary>
-        /// <param name="inPoints"></param>
-        /// <param name="WhetherPoint"></param>
-        /// <returns></returns>
-        private bool WhetherInRange(DParticle Part,/* PointF[] inPoints, */PointF WhetherPoint)
-        {
-            var rect = Part.Rect;
-            if ((rect.Left < WhetherPoint.X && WhetherPoint.X < rect.Right) && (rect.Top < WhetherPoint.Y && WhetherPoint.Y < rect.Bottom))
-            {
-                var itm = (BaseObject)Part;
-                PointF[] inPoints = itm.GPath.PathPoints;
-                bool b_inrange = false;
-                GraphicsPath myGraphicsPath = new GraphicsPath();
-                Region myRegion = new Region();
-                myGraphicsPath.Reset();
+    
 
-                myGraphicsPath.AddPolygon(inPoints);
-                myRegion.MakeEmpty();
-                myRegion.Union(myGraphicsPath);
-                //返回判断点是否在多边形里
-                b_inrange = myRegion.IsVisible(WhetherPoint);
-                return b_inrange;
-            }
-            else 
-            {
-                return false;
-            }
-        }
 
-        /// <summary>
-        /// 重做删除
-        /// </summary>
-        public void ReDo()
-        {
-            //如果已经是最后一条了,那么不可以再进行重做操作
-            if (m_list_historyapolygon.Count() < 1)
-                return;
-            HistoryApolygon hap = m_list_historyapolygon[m_operator_currentid];
-            foreach (DParticle dp in m_list_baseobject)
-            {
-                if (hap.APolygonID == dp.ID)
-                {
-                    dp.Operator = hap.Operator;
-                }
-            }
-
-            if (m_operator_currentid < m_list_historyapolygon.Count - 1)
-                m_operator_currentid = m_operator_currentid + 1;
-        }
-
-        /// <summary>
-        /// 撤消删除
-        /// </summary>
-        public void UnDo()
-        {
-            //首先找到历史操作记录类最后一项,然后取出颗粒操作的id,及颗粒最后的操作类型,还原成oldoperator状态
-            if (m_list_historyapolygon.Count() < 1)
-                return;
-            HistoryApolygon hap = m_list_historyapolygon[m_operator_currentid];
-
-            foreach (DParticle dp in m_list_baseobject)
-            {
-                if (hap.APolygonID == dp.ID)
-                {
-                    dp.Operator = hap.OldOperator;
-                }
-            }
-
-            if (m_operator_currentid != 0)
-            {
-                m_operator_currentid = m_operator_currentid - 1;
-            }
-        }
+ 
 
         /// <summary>
         /// 是否显示边框格线,自动切换显示与不显示
@@ -1674,7 +1974,7 @@ namespace OTSIncAReportGraph.Controls
         //测试回头去掉
         public void test_selected()
         {
-            m_OTSIncAReportFun.GetSelectedParticleList_ForDrawDistrbutionImageAndBSE();
+            GetSelectedParticleList_ForDrawDistrbutionImageAndBSE();
         }
 
 
@@ -1705,7 +2005,7 @@ namespace OTSIncAReportGraph.Controls
         /// <summary>
         /// 对选择的多边形进行反选操作
         /// </summary>
-        public void ReverSeSelection()
+        public void ReverseSelection()
         {
             foreach (DParticle dp in m_list_baseobject)
             {
@@ -1793,6 +2093,7 @@ namespace OTSIncAReportGraph.Controls
                         ls_ds.ShowMode = SegmentShowMode.DRAWPOINT;
                     }
                 }
+                FullGraphMatch();
             }
             else if (a_type== "Original")
             {
@@ -1804,6 +2105,7 @@ namespace OTSIncAReportGraph.Controls
                         ls_ds.ShowMode = SegmentShowMode.DRAWPOINT;
                     }
                 }
+                FullGraphMatch();
             }
             else if(a_type== "原图颗粒分布")
             {
@@ -1815,6 +2117,7 @@ namespace OTSIncAReportGraph.Controls
                         ls_ds.ShowMode = SegmentShowMode.DRAWLINE;
                     }
                 }
+                FullGraphMatch();
             }
 
             else
@@ -1828,6 +2131,7 @@ namespace OTSIncAReportGraph.Controls
                         ls_ds.ShowMode = SegmentShowMode.DRAWLINE;
                     }
                 }
+                FullGraphMatch();
             }
             this.Invalidate();
         }
@@ -1944,11 +2248,11 @@ namespace OTSIncAReportGraph.Controls
                 "单个Field视域屏幕像素宽:" + m_OneField_Screen_BackRectf.Width.ToString() + " 高:" + m_OneField_Screen_BackRectf.Height.ToString() + Environment.NewLine +
                 "单个OTS视域屏幕像素宽:" + m_OneField_OTS_Rectf.Width.ToString() + " 高:" + m_OneField_OTS_Rectf.Height.ToString() + Environment.NewLine +
                 "屏幕像素backrectf  x:" + m_backrectf.X.ToString() + "  y:" + m_backrectf.Y.ToString() + "  width:" + m_backrectf.Width.ToString() + "  height:" + m_backrectf.Height.ToString() + Environment.NewLine +
-                "包含Field数量:" + m_OTSIncAReportFun.m_field_count.ToString() + " Particle数量:" + m_OTSIncAReportFun.m_particle_count.ToString() + Environment.NewLine +
+                "包含Field数量:" + m_ReportFun.m_field_count.ToString() + " Particle数量:" + m_ReportFun.m_particle_count.ToString() + Environment.NewLine +
                 "正常显示Paticle数量:" + GetParticleNumberByState(ParticleOperator.DISPLAY).ToString() + " 不显示Particel数量:" + GetParticleNumberByState(ParticleOperator.NODISPLAY).ToString() + Environment.NewLine +
                 //"删除Particle数量:" + GetParticleNumberByState("删除").ToString() + " 选中Particle数量:" + GetParticleNumberByState("选择").ToString() + Environment.NewLine +
-                "加载底层数据用时:" + m_OTSIncAReportFun.m_time_str + Environment.NewLine +
-                "组建并计算图像用时:" + m_OTSIncAReportFun.m_time_str2 + Environment.NewLine +
+                "加载底层数据用时:" + m_ReportFun.m_time_str + Environment.NewLine +
+                "组建并计算图像用时:" + m_ReportFun.m_time_str2 + Environment.NewLine +
                 "---------------------------END----------------------------------"
                 );
 #endif

Diff do ficheiro suprimidas por serem muito extensas
+ 643 - 167
OTSIncAReportApp/Control_Graph/Controls/Control_DrawDistrbutionSortImage.cs


+ 9 - 40
OTSIncAReportApp/Control_Graph/Controls/Control_DrawDistrbutionSortImage.designer.cs

@@ -29,7 +29,6 @@
         private void InitializeComponent()
         {
             this.components = new System.ComponentModel.Container();
-            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Control_DrawDistrbutionSortImage));
             this.CMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
             this.ToolStripMenuItem_id = new System.Windows.Forms.ToolStripMenuItem();
             this.ToolStripMenuItem_selected = new System.Windows.Forms.ToolStripMenuItem();
@@ -37,8 +36,6 @@
             this.另存选择颗粒ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.ToolStripMenuItem_movesempoint = new System.Windows.Forms.ToolStripMenuItem();
             this.ToolStripMenuItem_copyimage = new System.Windows.Forms.ToolStripMenuItem();
-            this.control_XRayTable1 = new OTSIncAReportGraph.Controls.Control_XRayTable();
-            this.control_Ruler1 = new OTSIncAReportGraph.Controls.Control_Ruler();
             this.ToolStripMenuItemShowSmallParticle = new System.Windows.Forms.ToolStripMenuItem();
             this.CMenuStrip.SuspendLayout();
             this.SuspendLayout();
@@ -55,12 +52,12 @@
             this.ToolStripMenuItem_copyimage,
             this.ToolStripMenuItemShowSmallParticle});
             this.CMenuStrip.Name = "contextMenuStrip1";
-            this.CMenuStrip.Size = new System.Drawing.Size(289, 247);
+            this.CMenuStrip.Size = new System.Drawing.Size(219, 214);
             // 
             // ToolStripMenuItem_id
             // 
             this.ToolStripMenuItem_id.Name = "ToolStripMenuItem_id";
-            this.ToolStripMenuItem_id.Size = new System.Drawing.Size(288, 30);
+            this.ToolStripMenuItem_id.Size = new System.Drawing.Size(218, 30);
             this.ToolStripMenuItem_id.Text = "ID";
             this.ToolStripMenuItem_id.Visible = false;
             this.ToolStripMenuItem_id.Click += new System.EventHandler(this.ToolStripMenuItem_id_Click);
@@ -69,7 +66,7 @@
             // 
             this.ToolStripMenuItem_selected.Image = global::OTSIncAReportApp.Properties.Resources.选择颗粒;
             this.ToolStripMenuItem_selected.Name = "ToolStripMenuItem_selected";
-            this.ToolStripMenuItem_selected.Size = new System.Drawing.Size(288, 30);
+            this.ToolStripMenuItem_selected.Size = new System.Drawing.Size(218, 30);
             this.ToolStripMenuItem_selected.Text = "选择颗粒";
             this.ToolStripMenuItem_selected.Click += new System.EventHandler(this.ToolStripMenuItem_selected_Click);
             // 
@@ -77,14 +74,14 @@
             // 
             this.ToolStripMenuItem_delete.Image = global::OTSIncAReportApp.Properties.Resources.删除颗粒;
             this.ToolStripMenuItem_delete.Name = "ToolStripMenuItem_delete";
-            this.ToolStripMenuItem_delete.Size = new System.Drawing.Size(288, 30);
+            this.ToolStripMenuItem_delete.Size = new System.Drawing.Size(218, 30);
             this.ToolStripMenuItem_delete.Text = "删除";
             this.ToolStripMenuItem_delete.Click += new System.EventHandler(this.ToolStripMenuItem_delete_Click);
             // 
             // 另存选择颗粒ToolStripMenuItem
             // 
             this.另存选择颗粒ToolStripMenuItem.Name = "另存选择颗粒ToolStripMenuItem";
-            this.另存选择颗粒ToolStripMenuItem.Size = new System.Drawing.Size(288, 30);
+            this.另存选择颗粒ToolStripMenuItem.Size = new System.Drawing.Size(218, 30);
             this.另存选择颗粒ToolStripMenuItem.Text = "另存选择颗粒";
             this.另存选择颗粒ToolStripMenuItem.Visible = false;
             // 
@@ -92,7 +89,7 @@
             // 
             this.ToolStripMenuItem_movesempoint.Image = global::OTSIncAReportApp.Properties.Resources.移动SEM到当前位置;
             this.ToolStripMenuItem_movesempoint.Name = "ToolStripMenuItem_movesempoint";
-            this.ToolStripMenuItem_movesempoint.Size = new System.Drawing.Size(288, 30);
+            this.ToolStripMenuItem_movesempoint.Size = new System.Drawing.Size(218, 30);
             this.ToolStripMenuItem_movesempoint.Text = "移动SEM至鼠标所在位置";
             this.ToolStripMenuItem_movesempoint.Click += new System.EventHandler(this.ToolStripMenuItem_movesempoint_Click);
             // 
@@ -100,41 +97,14 @@
             // 
             this.ToolStripMenuItem_copyimage.Image = global::OTSIncAReportApp.Properties.Resources.复制图像;
             this.ToolStripMenuItem_copyimage.Name = "ToolStripMenuItem_copyimage";
-            this.ToolStripMenuItem_copyimage.Size = new System.Drawing.Size(288, 30);
+            this.ToolStripMenuItem_copyimage.Size = new System.Drawing.Size(218, 30);
             this.ToolStripMenuItem_copyimage.Text = "复制图像";
             this.ToolStripMenuItem_copyimage.Click += new System.EventHandler(this.ToolStripMenuItem_copyimage_Click);
             // 
-            // control_XRayTable1
-            // 
-            this.control_XRayTable1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
-            this.control_XRayTable1.Dock = System.Windows.Forms.DockStyle.Bottom;
-            this.control_XRayTable1.GBInfoStr = "";
-            this.control_XRayTable1.GoodChineseName = "";
-            this.control_XRayTable1.GoodName = "";
-            this.control_XRayTable1.List_ShowElementInfo = ((System.Collections.Generic.List<OTSIncAReportGraph.Controls.ShowElementInfo>)(resources.GetObject("control_XRayTable1.List_ShowElementInfo")));
-            this.control_XRayTable1.Location = new System.Drawing.Point(0, 577);
-            this.control_XRayTable1.Name = "control_XRayTable1";
-            this.control_XRayTable1.ShowAnalysisXray = true;
-            this.control_XRayTable1.ShowSearchXray = false;
-            this.control_XRayTable1.Size = new System.Drawing.Size(1369, 200);
-            this.control_XRayTable1.STDName = "";
-            this.control_XRayTable1.TabIndex = 5;
-            // 
-            // control_Ruler1
-            // 
-            this.control_Ruler1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(200)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
-            this.control_Ruler1.Location = new System.Drawing.Point(3, 400);
-            this.control_Ruler1.Name = "control_Ruler1";
-            this.control_Ruler1.RulerWidth = 100;
-            this.control_Ruler1.ShowString = "100um";
-            this.control_Ruler1.Size = new System.Drawing.Size(120, 40);
-            this.control_Ruler1.TabIndex = 1;
-            this.control_Ruler1.Value = 0D;
-            // 
             // ToolStripMenuItemShowSmallParticle
             // 
             this.ToolStripMenuItemShowSmallParticle.Name = "ToolStripMenuItemShowSmallParticle";
-            this.ToolStripMenuItemShowSmallParticle.Size = new System.Drawing.Size(288, 30);
+            this.ToolStripMenuItemShowSmallParticle.Size = new System.Drawing.Size(218, 30);
             this.ToolStripMenuItemShowSmallParticle.Text = "显示过小颗粒";
             this.ToolStripMenuItemShowSmallParticle.Visible = false;
             this.ToolStripMenuItemShowSmallParticle.Click += new System.EventHandler(this.ToolStripMenuItemShowSmallParticle_Click);
@@ -142,9 +112,8 @@
             // Control_DrawDistrbutionSortImage
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+            this.AutoScroll = true;
             this.ContextMenuStrip = this.CMenuStrip;
-            this.Controls.Add(this.control_XRayTable1);
-            this.Controls.Add(this.control_Ruler1);
             this.Name = "Control_DrawDistrbutionSortImage";
             this.Size = new System.Drawing.Size(1369, 777);
             this.Load += new System.EventHandler(this.Control_DrawDistrbutionSortImage_Load);

+ 0 - 1
OTSIncAReportApp/Control_Graph/Controls/Control_DrawDistrbutionSortImage.resx

@@ -120,5 +120,4 @@
   <metadata name="CMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
- 
 </root>

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

@@ -626,7 +626,7 @@ namespace OTSIncAReportGraph.Controls
                 {
                     string str_element = "" + m_list_showelementinfo[i].ElementName + "(" + m_list_showelementinfo[i].Percentage.ToString("0.00") + ")";
                     SizeF out_testsizef = g.MeasureString(str_element, m_thisfont);
-                    g.DrawString(str_element, m_thisfont, new SolidBrush(DrawFuncation.GetColorByNumber(i + 1)), ls_pt);
+                    g.DrawString(str_element, m_thisfont, new SolidBrush(DrawFunction.GetColorByNumber(i + 1)), ls_pt);
                     ls_pt.X = ls_pt.X + out_testsizef.Width + 2;
                 }
             }

+ 155 - 932
OTSIncAReportApp/Control_Graph/OTSIncAReportGraphFuncation/OTSIncAReportFun.cs

@@ -12,6 +12,7 @@ using System.Data;
 using System.Diagnostics;
 
 using System.Drawing;
+using System.Drawing.Drawing2D;
 using System.Linq;
 
 
@@ -44,10 +45,9 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         private ResultFile resultFile = null;
 
         //新版排序图窗体对象
-        private Control_DrawDistrbutionSortImage m_Control_DrawdistrbutionsortImage = null;
+        //private Control_DrawDistrbutionSortImage m_Control_DrawdistrbutionsortImage = null;
 
-        //新版分布图和BSE图整合对象
-        private Control_DrawDistrbutionImageAndBSE m_Control_DrawDistrbutionImageAndBSE = null;
+ 
 
         //全局对象,为了能够快速的获取到xray数据,而做为一个临时变量进行保存,使用前应该判断是否为空
         public List<Field> m_list_OTSField = null;
@@ -65,8 +65,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         //加载使用时间计算时间段2
         public string m_time_str2 = "";
 
-        //防止segment过多的数量限制,先写300吧,过少也不好,过防止过多程序而卡死
-        public int m_segment_overflownumber = 400;
+    
 
         //电镜设置对象
         public  ServiceInterface.SemController m_cfun = null;
@@ -78,8 +77,8 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         public int m_SEM_ID = 0;
 
         //国际化
-        Language lan = new Language();
-        Hashtable table;
+        //Language lan = new Language();
+        //Hashtable table;
         #endregion
 
         #region 构造函数
@@ -88,138 +87,20 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         /// </summary>
         /// <param name="in_Control_DrawDistrbutionImageAndBSE"></param>
         /// <param name="in_Cotsreportprojfilemgrclr"></param>
-        public OTSIncAReportFun(Control_DrawDistrbutionImageAndBSE in_Control_DrawDistrbutionImageAndBSE, ResultFile result)
+        public OTSIncAReportFun( ResultFile result)
         {
-            m_Control_DrawDistrbutionImageAndBSE = in_Control_DrawDistrbutionImageAndBSE;
+          
             resultFile = result;
             m_cfun =new ServiceInterface.SemController();
             log = NLog.LogManager.GetCurrentClassLogger();
-            table = lan.GetNameTable("OTSIncAReportFun");
+            //table = lan.GetNameTable("OTSIncAReportFun");
         }
 
-        /// <summary>
-        /// 构造函数,接收新版颗粒排序图的构造
-        /// </summary>
-        /// <param name="in_Control_DrawDistrbutionSortimage"></param>
-        /// <param name="in_Cotsreportprojfilemgrclr"></param>
-        public OTSIncAReportFun(Control_DrawDistrbutionSortImage in_Control_DrawDistrbutionSortimage, ResultFile result)
-        {
-            m_Control_DrawdistrbutionsortImage = in_Control_DrawDistrbutionSortimage;
-            resultFile = result;
-            m_cfun = new ServiceInterface.SemController();
-            log = NLog.LogManager.GetCurrentClassLogger();
-            table = lan.GetNameTable("OTSIncAReportFun");
-        }
+
 
         #endregion
 
         #region 封装自定义方法
-
-        /// <summary>
-        /// 根据颗粒排序图获取已经选择上的颗粒,返回被选择上的颗粒的列表
-        /// </summary>
-        /// <returns></returns>
-        public List<Particle> GetSelectedParticleList_ForDrawDistrbutionImageAndBSE()
-        {
-            List<Particle> ls_list_cotsparticleclr = new List<Particle>();
-
-            //防止为空校验判断
-            if (m_list_OTSField == null)
-                return ls_list_cotsparticleclr;
-
-            //先取出,所有被选择的dparticle列表的
-            List<DParticle> ls_list_dp = new List<DParticle>();
-            foreach (DParticle ls_dp in m_Control_DrawDistrbutionImageAndBSE.m_list_baseobject)
-            {
-                if (ls_dp.Operator == ParticleOperator.SELECTED)
-                {
-                    ls_list_dp.Add(ls_dp);
-                }
-            }
-
-            //并开始查找包含tagid和fieldid的cotsparticle的对象,保存到list当中
-            for (int i = 0; i < ls_list_dp.Count(); i++)
-            {
-                for (int j = 0; j < m_list_OTSField.Count(); j++)
-                {
-                    //先获取该field中的所有particle
-                    List<Particle> list_cotsparticleclr = new List<Particle>();
-                    list_cotsparticleclr = m_list_OTSField[j].ParticleList;
-
-                    for (int k = 0; k < list_cotsparticleclr.Count(); k++)
-                    {
-                        if (list_cotsparticleclr[k].ParticleId == ls_list_dp[i].CLRTagID
-                            && list_cotsparticleclr[k].FieldId == ls_list_dp[i].CLRFieldID)
-                        {
-                            ls_list_cotsparticleclr.Add(list_cotsparticleclr[k]);
-                        }
-                    }
-                }
-            }
-
-            return ls_list_cotsparticleclr;
-        }
-
-        /// <summary>
-        /// 计算像素总画面Image大小,及进行物理坐标与分辨率坐标的换算操作 传入物理坐标,及宽高,来
-        /// </summary>
-        /// <param name="in_list_point">传入的物理坐标数组</param>
-        /// <param name="width">单个field宽</param>
-        /// <param name="height">单个field高</param>
-        /// <returns></returns>
-        public Rectangle ConvertAndGetMaxRect(List<Point> in_list_point, int in_width, int in_height)
-        {
-            //首先要能确定下来,单个物理坐标的宽和高--------------------------------
-            int i_wl_width = 0;
-            int i_wl_height = 0;
-
-            Rectangle ls_r = GetOneFieldWidthAndHeight(in_list_point);
-            i_wl_width = ls_r.Width;
-            i_wl_height = ls_r.Height;
-            //-----------------------------------------------------------------------------
-
-            int point_x_min = 10000000;
-            int point_x_max = -10000000;
-            int point_y_min = 10000000;
-            int point_y_max = -10000000;
-
-            for (int i = 0; i < in_list_point.Count(); i++)
-            {
-                Point ls_point = in_list_point[i];
-                //取出正数最大x
-                if (ls_point.X > point_x_max)
-                    point_x_max = ls_point.X;
-                if (ls_point.Y > point_y_max)
-                    point_y_max = ls_point.Y;
-                if (ls_point.X < point_x_min)
-                    point_x_min = ls_point.X;
-                if (ls_point.Y < point_y_min)
-                    point_y_min = ls_point.Y;
-            }
-
-            //然后分别用最大值+abs(最小值),就是x,和y轴的总长值
-            point_x_max = point_x_max - point_x_min;
-            point_y_max = point_y_max - point_y_min;
-
-            //该算法有个问题,就是不能直观的得到整个范围的大小,要除以倍数再补1能补充缺少的一个field视域**********
-            point_x_max = ((point_x_max / i_wl_width) + 1) * i_wl_width;
-            point_y_max = ((point_y_max / i_wl_height) + 1) * i_wl_height;
-
-            //将物理宽高,变换成分辨率宽高
-            if (i_wl_width != 0) point_x_max = (point_x_max / i_wl_width) * in_width; else point_x_max = 0;
-            if (i_wl_height != 0) point_y_max = (point_y_max / i_wl_height) * in_height; else point_y_max = 0;
-
-            Rectangle ret_rectangle = new Rectangle(0, 0, 0, 0);
-            //判断一下防止出错,只有在有数据的情况下,进行赋值才行
-            if (in_list_point.Count > 0)
-            {
-                ret_rectangle = new Rectangle(0, 0, point_x_max, point_y_max);
-            }
-
-            //这样返回是物理坐标的总大小,应该返回像素坐标大小才对
-            return ret_rectangle;
-        }
-
         /// <summary>
         /// 通过传入的各field物理坐标列表,和单个field的屏幕分辨率,及单个的field的物理坐标,来获取当前field在整个image中的屏幕像素坐标偏移,并且是OTS向上为正做了Y轴相反运算
         /// </summary>
@@ -314,7 +195,98 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
 
             return list_point[index];
         }
+        /// <summary>
+        /// 根据type,从三种分类的分析库中提取当前分析物的颜色
+        /// </summary>
+        /// <param name="in_cotssampleclr"></param>
+        /// <param name="in_stdtypeid"></param>
+        /// <returns></returns>
+        public Color GetColorBySTDTypeIDForBSEAndSorImage(string in_cotssampleclr, int in_stdtypeid)
+        {
+            Color ret_c = new Color();
+
+
+            if (in_stdtypeid < 1000)
+            {
+                OTSSysSTDMgrClass osc = new OTSSysSTDMgrClass();
+                //小于1000,使用系统默认分类
+                ret_c = osc.GetColorByEnum(in_stdtypeid);
+            }
+            else if (in_stdtypeid >= 1000)
+            {
+                //大于等于1000,并且小于10000时,使用用户标准库来分析夹杂物名称
+                if (!in_cotssampleclr.Contains("#"))
+                {
+                    ret_c = DrawFunction.colorHx16toRGB("#" + in_cotssampleclr);//接收必须是#000000的格式
+                }
+                else
+                {
+                    ret_c = DrawFunction.colorHx16toRGB(in_cotssampleclr);//接收必须是#000000的格式
+                }
+            }
+            return ret_c;
+        }
+
 
+        /// <summary>
+        /// 计算像素总画面Image大小,及进行物理坐标与分辨率坐标的换算操作 传入物理坐标,及宽高,来
+        /// </summary>
+        /// <param name="in_list_point">传入的物理坐标数组</param>
+        /// <param name="width">单个field宽</param>
+        /// <param name="height">单个field高</param>
+        /// <returns></returns>
+        public Rectangle ConvertAndGetMaxRect(List<Point> in_list_point, int in_width, int in_height)
+        {
+            //首先要能确定下来,单个物理坐标的宽和高--------------------------------
+            int i_wl_width = 0;
+            int i_wl_height = 0;
+
+            Rectangle ls_r = GetOneFieldWidthAndHeight(in_list_point);
+            i_wl_width = ls_r.Width;
+            i_wl_height = ls_r.Height;
+            //-----------------------------------------------------------------------------
+
+            int point_x_min = 10000000;
+            int point_x_max = -10000000;
+            int point_y_min = 10000000;
+            int point_y_max = -10000000;
+
+            for (int i = 0; i < in_list_point.Count(); i++)
+            {
+                Point ls_point = in_list_point[i];
+                //取出正数最大x
+                if (ls_point.X > point_x_max)
+                    point_x_max = ls_point.X;
+                if (ls_point.Y > point_y_max)
+                    point_y_max = ls_point.Y;
+                if (ls_point.X < point_x_min)
+                    point_x_min = ls_point.X;
+                if (ls_point.Y < point_y_min)
+                    point_y_min = ls_point.Y;
+            }
+
+            //然后分别用最大值+abs(最小值),就是x,和y轴的总长值
+            point_x_max = point_x_max - point_x_min;
+            point_y_max = point_y_max - point_y_min;
+
+            //该算法有个问题,就是不能直观的得到整个范围的大小,要除以倍数再补1能补充缺少的一个field视域**********
+            point_x_max = ((point_x_max / i_wl_width) + 1) * i_wl_width;
+            point_y_max = ((point_y_max / i_wl_height) + 1) * i_wl_height;
+
+            //将物理宽高,变换成分辨率宽高
+            if (i_wl_width != 0) point_x_max = (point_x_max / i_wl_width) * in_width; else point_x_max = 0;
+            if (i_wl_height != 0) point_y_max = (point_y_max / i_wl_height) * in_height; else point_y_max = 0;
+
+            Rectangle ret_rectangle = new Rectangle(0, 0, 0, 0);
+            //判断一下防止出错,只有在有数据的情况下,进行赋值才行
+            if (in_list_point.Count > 0)
+            {
+                ret_rectangle = new Rectangle(0, 0, point_x_max, point_y_max);
+            }
+
+            //这样返回是物理坐标的总大小,应该返回像素坐标大小才对
+            return ret_rectangle;
+        }
         /// <summary>
         /// 计算单个field的物理大小 传入field的list,还有测量结果管理类对象,在无法计算出单file的物理大小的情况下,到这里取再计算得出
         /// </summary>
@@ -375,6 +347,9 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             }
             return ret_rect;
         }
+
+
+
         #endregion
 
         #region 电镜操作相关方法
@@ -592,391 +567,77 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         }
 
 
-        /// <summary>
-        /// 获取组整个获取分布图和排序图图像数据的底层数据组建方式,的总过程
-        /// </summary>
-        public void GetDistrbutionImageAndBSE_Total(OTSIncAReportApp.frmReportApp a_Report)
-        {
-            string str27 = "开始从底层加载数据....";
-            str27 = table["str27"].ToString();
-            m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(1, str27);
-            //对底层加载速度进行计时
-            Stopwatch stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            string path = resultFile.FilePath;
-            FieldData fieldData = new FieldData(path);
-            List<Field> fieldlist = fieldData.GetFieldList(a_Report);
-
-            //防止有时底层返回的Field的List是0,直接返回
-            if (fieldlist.Count == 0)
-            {
-                string str28 = "底层返回视域数据数量为0....";
-                str28 = table["str28"].ToString();
-                m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(100, str28);
-                return;
-            }
-
-            //底层加载field对象结束
-            stopwatch.Stop();
-            TimeSpan timespan = stopwatch.Elapsed;
-
-            //重置计数器,对组建和计算图像进行计时
-            stopwatch.Reset();
-            stopwatch.Start();
-            string str29 = "开始组建图像视域....";
-            str29 = table["str29"].ToString();
-            m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(15, str29);
 
-            //将field的list对象给全局变量中,供后面获取xray使用,不需要再次重新加载数据,以提升速度
-            m_list_OTSField = fieldlist;
 
-            //第一次循环,用来计算单个Field的像素分辨率,和将所有的物理位置存放到List当中
-            List<Point> list_point = new List<Point>();
-            int i_field_width = 0, i_field_height = 0;
-            //获取到该field的分辨率大小,循环中都是一样的
 
-            if (fieldlist.Count > 0)
-            {
-                Bitmap bitmp = DrawFuncation.ReadImageFile(fieldlist[0].FieldImage);
-                i_field_width = bitmp.Width;
-                i_field_height = bitmp.Height;
-            }
-
-            for (int i = 0; i < fieldlist.Count(); i++)
-            {
-                //然后取出物理坐标,这个一会要与分辨率坐标进行变算一下
-                Point ls_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };
-                list_point.Add(ls_point);
-            }
-
-            //对单个视域的屏幕像素宽高,进行记录
-            m_Control_DrawDistrbutionImageAndBSE.m_OneField_Screen_BackRectf = new RectangleF(0, 0, i_field_width, i_field_height);
-
-            //获取单个OTS视域像素宽高,并进行记录
-            Rectangle OTS_FieldRect = GetOneFieldWidthAndHeight(list_point);
-            m_Control_DrawDistrbutionImageAndBSE.m_OneField_OTS_Rectf = OTS_FieldRect;
-
-            //计算出整个绘制图像总Rectagnle的大小
-            m_Control_DrawDistrbutionImageAndBSE.m_backrectf = ConvertAndGetMaxRect(list_point, i_field_width, i_field_height);
-            string str30 = "计算标尺....";
-            str30 = table["str30"].ToString();
-            //更新进度条提示
-            m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(18, str30);
-
-            #region //标尺相关------------------------------------------------------------------------------
-            //在此处通过上面的i_field_width,ifield_height和list_point,来计算出个像素与实际物理值的比例
-            Rectangle ls_jsblrect = GetOneFieldWidthAndHeight(list_point);
-            //然后用宽度来除以i_field_width 获取单个的像素比例
-            double d_onepixel_scale = Convert.ToDouble(ls_jsblrect.Width) / Convert.ToDouble(i_field_width);
-            //再用该比例对标尺进行相应的赋值
-            m_Control_DrawDistrbutionImageAndBSE.m_f_onepixel_size = (float)d_onepixel_scale;
-
-            //对整个物理像素的范围进行获取与设置
-            Rectangle ls_offsetandtopleftrect = GetWlRectTopLeftAndRect(list_point, ls_jsblrect.Width, ls_jsblrect.Height);
-            m_Control_DrawDistrbutionImageAndBSE.m_back_wl_rectf = new RectangleF(ls_offsetandtopleftrect.X, ls_offsetandtopleftrect.Y
-                , ls_offsetandtopleftrect.Width, ls_offsetandtopleftrect.Height);
-            #endregion //---------------------------------------------------------------------------------------
-
-            string str31 = "组建整图数据....";
-            str31 = table["str31"].ToString();
-            //更新进度条提示
-            m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(20, str31);
-
-            //70的进度条给到下面的循环中,计算进度条各分类进度分配
-            float ls_int_progresscalc = 0;
-            if (fieldlist.Count > 0)
-                ls_int_progresscalc = (float)70 / (float)fieldlist.Count;
-
-            string str32 = "已完成第";
-            str32 = table["str32"].ToString();
-            string str33 = "个视域数据组建,共";
-            str33 = table["str33"].ToString();
-            string str34 = "个视域...";
-            str34 = table["str34"].ToString();
-
-            //再通过Field取到对应的Particle,循环一次
-            for (int i = 0; i < fieldlist.Count(); i++)
-            {
-                //更新进度条提示
-                m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(20 + (int)(ls_int_progresscalc * (i + 1)), str32 + i.ToString() + str33 + m_list_OTSField.Count.ToString() + str34);
-
-                //先获取该Field中的所有Particle
-                List<Particle> list_cotsparticleclr = new List<Particle>();
-                list_cotsparticleclr = fieldlist[i].ParticleList;
-
-                //取出该Field的物理坐标,将其转换成对应的屏幕像素坐标,屏幕左上角为原点(0,0)的偏移值,用于后面计算各Segment的位置使用
-                //应该也就是这里根据OTS坐标转换到屏幕像素坐标,Y轴是反的,所以在这里对从OTS坐标转换成屏幕坐标的地方进行反转!
-                Point thisfield_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };
-                Point offset_point = GetFieldPhysicsConvertToScreen(list_point, i_field_width, i_field_height, thisfield_point);
-
-                //保存该Field最终在屏幕上显示的位置及大小
-                DField df = new DField();
-                df.FieldID = fieldlist[i].FieldID.ToString();
-                df.Show_Rect = new Rectangle(offset_point, new Size(i_field_width, i_field_height));
-                df.Current_Rect = new Rectangle(offset_point, new Size(i_field_width, i_field_height));
-                df.OTS_RECT = new RectangleF(thisfield_point.X, thisfield_point.Y, OTS_FieldRect.Width, OTS_FieldRect.Height);
-                m_Control_DrawDistrbutionImageAndBSE.m_list_dfield.Add(df);
-
-                //然后将取出的数据,转换成Bitmap对象
-                Bitmap ls_bt = DrawFuncation.ReadImageFile(fieldlist[i].FieldImage);
-
-                //再循环计算所有的Particle对象
-                foreach (Particle ls_cotsparticleclr in list_cotsparticleclr)
-                {
-
-                    //从Clr中获取所有的Segment的List对象
-                    List<Feature> list_cotssegmentclr = new List<Feature>();
-                    list_cotssegmentclr = ls_cotsparticleclr.FeatureList;
-
-                    //创建颗粒分布图对应的类对象
-                    List<DSegment> list_dsegment = new List<DSegment>();
-
-                    //创建DParticle颗粒,保存与之对应的颗粒tagid和particleid,为了后面取xray数据及多选时获取多选cotsparticleclr列表
-                    DParticle ls_dp = new DParticle();
-                    ls_dp.CLRTagID = ls_cotsparticleclr.ParticleId;
-                    ls_dp.CLRFieldID = ls_cotsparticleclr.FieldId;
-                    ls_dp.STDTypeID = ls_cotsparticleclr.TypeId;
-                    ls_dp.TypeId = ls_cotsparticleclr.TypeId;
-                    ls_dp.TypeName = ls_cotsparticleclr.TypeName;
-                    ls_dp.XRayId = ls_cotsparticleclr.XrayId;
-                    ls_dp.SEMPosX = ls_cotsparticleclr.SEMPosX;
-                    ls_dp.SEMPosY = ls_cotsparticleclr.SEMPosY;
-                    //获取该颗粒在STD标准库中已分析出化合物对应的颜色
-                    ls_dp.Color = GetColorBySTDTypeIDForBSEAndSorImage(ls_cotsparticleclr.TypeColor, ls_cotsparticleclr.TypeId);
-
-                    //防止超大颗粒,会让程序死掉
-                    if (list_cotssegmentclr.Count < m_segment_overflownumber)
-                    {
-                        //再循环取出里面所有的segment
-                        foreach (Feature ls_cotssegmentclr in list_cotssegmentclr)
-                        {
-                            #region 创建DSegment对象,并将STD分析出的化合物颜色保存到DSegment对象中
-                            //对Particle里的Segment进行偏移的计算等,创建了DSegment的大小
-                            DSegment ds = new DSegment();
-                            ds.Rect = new Rectangle(ls_cotssegmentclr.Start + offset_point.X,
-                               //i_field_height - ls_cotssegmentclr.GetHeight() + offset_point.Y,//这是让单个Field的图像按Y轴反过来
-                               ls_cotssegmentclr.Height + offset_point.Y,
-                                ls_cotssegmentclr.Length,
-                                1);
-
-                            ds.Color = ls_dp.Color;//将线的颜色对应到颗粒的颜色
-                            #endregion
-
-                            #region //这里是在Field中,抠取出原BSE图像到DSegment中--------------------------------
-                            //ls_bt.RotateFlip(RotateFlipType.Rotate180FlipX);//使用系统带的图像处理方法,进行Y轴的翻转,与上面记录位置对应
-                            //合成图像完成,开始抠取像素-----------------------------------------------------------------
-                            int i_ls_length = ls_cotssegmentclr.Length;
-                            List<Color> ls_list_colors = new List<Color>();
-                            for (int m = 0; m < i_ls_length; m++)
-                            {
-                                //这里实现一下代码保护
-                                int lsjs_x = ls_cotssegmentclr.Start + m;
-                                //int lsjs_y = i_field_height - ls_cotssegmentclr.GetHeight();//这个反转要与上面对应
-                                int lsjs_y = ls_cotssegmentclr.Height;
-                                if (lsjs_x < 0)
-                                    lsjs_x = 0;
-                                if (lsjs_x >= i_field_width)
-                                    lsjs_x = i_field_width - 1;
-                                if (lsjs_y < 0)
-                                    lsjs_y = 0;
-                                if (lsjs_y >= i_field_height)
-                                    lsjs_y = i_field_height - 1;
-
-                                //按理说这里应该加上个横向抠取像素颜色,这里需要再处理一下
-                                ls_list_colors.Add(ls_bt.GetPixel(lsjs_x,
-                                   lsjs_y));
-                            }
-                            //保存原BSE图中的颜色列表
-                            ds.List_Colors = ls_list_colors;
-                            #endregion //------------------------------------------------------------------------------
-
-                            list_dsegment.Add(ds);
-                            //ls_bt.Dispose();
-                        }
-                    }
-                    //设置Particle在0.5F倍数以上时才进行显示
-                    ls_dp.Zoom_DisPlayMultiplier = 0.5f;
-                    ls_dp.Zoom_DisPlay = true;
-
-                    //将segment对应的设置到particle中
-                    ls_dp.DSegments = list_dsegment;
-
-                    //并对DParticle相关信息进行计算
-                    ls_dp.Rect = ls_dp.GetRectFromDSegment();
-                    ls_dp.GPath = ls_dp.GetRegionFromDSegments();
-                    ls_dp.SmallRect = ls_dp.GetSmallRectangleFromRect();
-
-                    //将每个颗粒添加到颗粒分布图中的列表中
-                    m_Control_DrawDistrbutionImageAndBSE.m_list_baseobject.Add(ls_dp);
-                    if (ls_dp.XRayId > -1)
-                    {
-                        m_Control_DrawDistrbutionImageAndBSE.m_list_usebject.Add(ls_dp);
-                    }
-
-                }
-            }
-
-            string str35 = "转换分辨率...";
-            str35 = table["str35"].ToString();
-            //更新进度条相关显示
-            m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(90, str35);
-
-            //然后这里还需要计算出,各field的宽和高,帧图边框分别需要显示多少个框
-            if (i_field_width != 0 && i_field_height != 0)
-            {
-                m_Control_DrawDistrbutionImageAndBSE.m_i_grid_showlinesnumber_width = Convert.ToInt32(m_Control_DrawDistrbutionImageAndBSE.BackRectF.Width / i_field_width);
-                m_Control_DrawDistrbutionImageAndBSE.m_i_grid_showlinesnumber_height = Convert.ToInt32(m_Control_DrawDistrbutionImageAndBSE.BackRectF.Height / i_field_height);
-            }
-            string str36 = "完成其它工作...";
-            str36 = table["str36"].ToString();
-            //结束组建计算图像计数
-            stopwatch.Stop();
-            TimeSpan timespan2 = stopwatch.Elapsed;
-
-            m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(95, str36);
-            string str37 = "分钟 ";
-            str37 = table["str37"].ToString();
-            string str38 = "秒  共(";
-            str38 = table["str38"].ToString();
-            string str39 = ")毫秒";
-            str39 = table["str39"].ToString();
-            //相关计数
-            m_field_count = fieldlist.Count;
-            m_particle_count = m_Control_DrawDistrbutionImageAndBSE.m_list_baseobject.Count;
-            m_time_str = timespan.TotalMinutes.ToString("0.00") + str37 + timespan.TotalSeconds.ToString("0.00") + str38 + timespan.TotalMilliseconds.ToString() + str39;
-            m_time_str2 = timespan2.TotalMinutes.ToString("0.00") + str37 + timespan2.TotalSeconds.ToString("0.00") + str38 + timespan2.TotalMilliseconds.ToString() + str39;
-        }
-        //读取进度条,虚拟读取,直接通过所有时域
-        void setPr(float ls_int_progresscalc, string str32, string str33, string str34)
-        {
-            for (int i = 0; i < m_list_OTSField.Count; i++)
-            {
-                m_Control_DrawDistrbutionImageAndBSE.m_frm_userprogress.SetProgressValueAndText(20 + (int)(ls_int_progresscalc * (i + 1)), str32 + i.ToString() + str33 + m_list_OTSField.Count.ToString() + str34);
-            }
-        }
 
+        #endregion
         /// <summary>
-        /// 分布图和BSE图中,从底层获取相关结果后,重新组织显示
+        /// 判断该点是否在多边形的范围内
         /// </summary>
-        /// <param name="ls_cgriddataclr"></param>
-        public void GetDrawDistrbutionImageAndBSE_ByQuery(OTSIncAReportApp.OTSSampleReportInfo.OTSSampleMeaInfo sourceGridData)
+        /// <param name="inPoints"></param>
+        /// <param name="WhetherPoint"></param>
+        /// <returns></returns>
+        public bool WhetherInRange(DParticle Part,/*PointF[] inPoints,*/ Point WhetherPoint)
         {
-            var display = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 7);
-            string display_type = display.itemVal.ToString();
-            int disinde = display.comboDownList.IndexOf(display_type);
-            var list = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 10);
-            string size = list.itemVal.ToString();
-            int inde = list.comboDownList.IndexOf(size);
-            string size_cal_method_type = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 13).itemVal.ToString();
-            string con = "";
-            switch (size_cal_method_type)
-            {
-                case "DMAX":
-                    con = "DMAX";
-                    break;
-                case "DMIN":
-                    con = "DMIN";
-                    break;
-                case "Area":
-                    con = "Area";
-                    break;
-                case "FERET":
-                    con = "DFERET";
-                    break;
-            }
-            string min = "0";
-            string max = "999";
-            if (inde != 0)
-            {
-                max = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 12).itemVal.ToString(); ;
-                min = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 11).itemVal.ToString(); ;
-                if (max.ToLower() == "max")
-                {
-                    max = "999";
-                }
+            var rect = Part.Rect;
+            if ((rect.Left < WhetherPoint.X && WhetherPoint.X < rect.Right) && (rect.Top < WhetherPoint.Y && WhetherPoint.Y < rect.Bottom))
+            {
+                var itm = (BaseObject)Part;
+                PointF[] inPoints = itm.GPath.PathPoints;
+                bool b_inrange = false;
+                GraphicsPath myGraphicsPath = new GraphicsPath();
+                Region myRegion = new Region();
+                myGraphicsPath.Reset();
+
+                myGraphicsPath.AddPolygon(inPoints);
+                myRegion.MakeEmpty();
+                myRegion.Union(myGraphicsPath);
+                //返回判断点是否在多边形里
+                b_inrange = myRegion.IsVisible(WhetherPoint);
+                return b_inrange;
             }
-
-            string path = resultFile.FilePath;
-            ParticleData particleData = new ParticleData(path);
-            List<Particle> particles = particleData.GetParticleListByCon(con, max, min, disinde);
-
-            foreach (DParticle ls_dp in m_Control_DrawDistrbutionImageAndBSE.m_list_baseobject)
+            else
             {
-                int dis = 0;
-                foreach (Particle particle in particles)
-                {
-                    //找到对应的颗粒,将分类设置进去
-                    if (ls_dp.CLRTagID == particle.ParticleId && ls_dp.CLRFieldID == particle.FieldId)
-                    {
-                        //这里居然添加进来了7个,原来是这里,在底层直接取出了6个相同的颗粒到一起。
-                        ls_dp.ParticleFL = particle.TypeName;
-                        ls_dp.Operator = ParticleOperator.DISPLAY;
-                        dis = 1;
-                        break;
-                    }
+                return false;
 
-                }
-                if (dis == 0)
-                {
-                    ls_dp.Operator = ParticleOperator.NODISPLAY;
-                }
             }
 
         }
-        #endregion
 
-        #region //--------------------------------------颗粒排序图相关部份---------------------------------------------------------------------
         /// <summary>
-        /// 根据颗粒排序图获取已经选择上的颗粒,返回被选择上的颗粒的列表
+        /// 判断该点是否在多边形的范围内的float版本重载
         /// </summary>
+        /// <param name="inPoints"></param>
+        /// <param name="WhetherPoint"></param>
         /// <returns></returns>
-        public List<Particle> GetSelectedParticleList_ForDrawDistrbutionSortImage()
+        public  bool WhetherInRange(DParticle Part,/* PointF[] inPoints, */PointF WhetherPoint)
         {
-            List<Particle> ls_list_cotsparticleclr = new List<Particle>();
-
-            //防止为空校验判断
-            if (m_list_OTSField == null)
-            {
-                return ls_list_cotsparticleclr;
+            var rect = Part.Rect;
+            if ((rect.Left < WhetherPoint.X && WhetherPoint.X < rect.Right) && (rect.Top < WhetherPoint.Y && WhetherPoint.Y < rect.Bottom))
+            {
+                var itm = (BaseObject)Part;
+                PointF[] inPoints = itm.GPath.PathPoints;
+                bool b_inrange = false;
+                GraphicsPath myGraphicsPath = new GraphicsPath();
+                Region myRegion = new Region();
+                myGraphicsPath.Reset();
+
+                myGraphicsPath.AddPolygon(inPoints);
+                myRegion.MakeEmpty();
+                myRegion.Union(myGraphicsPath);
+                //返回判断点是否在多边形里
+                b_inrange = myRegion.IsVisible(WhetherPoint);
+                return b_inrange;
             }
-
-            //先取出,所有被选择的dparticle列表的
-            List<DParticle> ls_list_dp = new List<DParticle>();
-            foreach (SortParticleDistribution spd in m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution)
+            else
             {
-                foreach (DParticle ls_dp in spd.List_DParticle)
-                {
-                    if (ls_dp.Operator == ParticleOperator.SELECTED)
-                    {
-                        ls_list_dp.Add(ls_dp);
-                    }
-                }
+                return false;
             }
+        }
 
-            //并开始查找包含tagid和fieldid的cotsparticle的对象,保存到list当中
-            for (int i = 0; i < ls_list_dp.Count(); i++)
-            {
-                for (int j = 0; j < m_list_OTSField.Count(); j++)
-                {
-                    //先获取该field中的所有particle
-                    List<Particle> list_cotsparticleclr = new List<Particle>();
-                    list_cotsparticleclr = m_list_OTSField[j].ParticleList;
-
-                    for (int k = 0; k < list_cotsparticleclr.Count(); k++)
-                    {
-                        if (list_cotsparticleclr[k].ParticleId == ls_list_dp[i].CLRTagID
-                            && list_cotsparticleclr[k].FieldId == ls_list_dp[i].CLRFieldID)
-                        {
-                            //将cotsparticleclr保存到list当中
-                            ls_list_cotsparticleclr.Add(list_cotsparticleclr[k]);
-                        }
-                    }
-                }
-            }
+        #region //--------------------------------------颗粒排序图相关部份---------------------------------------------------------------------
 
-            return ls_list_cotsparticleclr;
-        }
 
         /// <summary>
         /// 根据传入的fieldid和tagid返回该颗粒的OTS坐标
@@ -999,450 +660,12 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         }
 
 
-        /// <summary>
-        /// 排序图获取底层数据,组建整张排序图的总方法过程
-        /// </summary>
-        public void GetDistrbutionSortImage_Total(OTSIncAReportApp.frmReportApp a_ReportApp)
-        {
-            string str48 = "开始从底层加载数据....";
-            str48 = table["str48"].ToString();
-            m_Control_DrawdistrbutionsortImage.m_frm_userprogress.SetProgressValueAndText(1, str48);
-
-            string path = resultFile.FilePath;
-            FieldData fieldData = new FieldData(path);
-            List<Field> fieldlist = fieldData.GetFieldList(a_ReportApp);
-            //将field的list对象给全局变量中,供后面获取xray使用
-            m_list_OTSField = fieldlist;
-            string str49 = "开始组建图像资源....";
-            str49 = table["str49"].ToString();
-            m_Control_DrawdistrbutionsortImage.m_frm_userprogress.SetProgressValueAndText(15, str49);
-
-            //第一次,用来计算,总大小等,获取Field的坐标,id,同时获取对应的ImgClr里的宽高,图像大小
-            List<Point> list_point = new List<Point>();
-            int i_field_width = 0, i_field_height = 0;
-            //获取到该field的分辨率大小,循环中都是一样的
-            if (fieldlist.Count > 0)
-            {
-                Bitmap bitmp = DrawFuncation.ReadImageFile(fieldlist[0].FieldImage);
-                i_field_width = bitmp.Width;
-                i_field_height = bitmp.Height;
-            }
-            for (int i = 0; i < fieldlist.Count(); i++)
-            {
-                //然后取出物理坐标,这个一会要与分辨率坐标进行变算一下
-                Point ls_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };
-                list_point.Add(ls_point);
-            }
-
-            //对单个Field视域的屏幕像素宽高,进行记录
-            m_Control_DrawdistrbutionsortImage.m_OneField_Screen_BackRectf = new RectangleF(0, 0, i_field_width, i_field_height);
-
-            //获取单个OTS视域像素宽高,并进行记录
-            Rectangle OTS_FieldRect = GetOneFieldWidthAndHeight(list_point);
-            m_Control_DrawdistrbutionsortImage.m_OneField_OTS_Rectf = OTS_FieldRect;
-            string str50 = "计算标尺....";
-            str50 = table["str50"].ToString();
-            m_Control_DrawdistrbutionsortImage.m_frm_userprogress.SetProgressValueAndText(18, str50);
-
-            #region //标尺相关------------------------------------------------------------------------------
-            //在此处通过上面的i_field_width,ifield_height和list_point,来计算出个像素与实际物理值的比例
-            Rectangle ls_jsblrect = GetOneFieldWidthAndHeight(list_point);
-            //然后用宽度来除以i_field_width 获取单个的像素比例
-            double d_onepixel_scale = Convert.ToDouble(ls_jsblrect.Width) / Convert.ToDouble(i_field_width);
-            //再用该比例对标尺进行相应的赋值
-            m_Control_DrawdistrbutionsortImage.m_f_onepixel_size = (float)d_onepixel_scale;
-            #endregion //---------------------------------------------------------------------------------------
-            string str51 = "组建整图数据....";
-            str51 = table["str51"].ToString();
-            m_Control_DrawdistrbutionsortImage.m_frm_userprogress.SetProgressValueAndText(20, str51);
-
-            //70的进度条给到下面的循环中
-            float ls_int_progresscalc = 0;
-            if (fieldlist.Count > 0)
-                ls_int_progresscalc = (float)80 / (float)fieldlist.Count;
-
-            string str52 = "已完成第";
-            str52 = table["str52"].ToString();
-            string str53 = "个数据,共";
-            str53 = table["str53"].ToString();
-            string str54 = "个数据...";
-            str54 = table["str54"].ToString();
-            //第二次,再通过Field取到对应的Particle,循环一次
-            for (int i = 0; i < fieldlist.Count(); i++)
-            {
-                m_Control_DrawdistrbutionsortImage.m_frm_userprogress.SetProgressValueAndText(20 + (int)(ls_int_progresscalc * (i + 1)), str52 + i.ToString() + str53 + m_list_OTSField.Count.ToString() + str54);
-
-                //先获取该field中的所有particle
-                List<Particle> list_cotsparticleclr = new List<Particle>();
-                list_cotsparticleclr = fieldlist[i].ParticleList;
-
-                //取出该Field中,从物理坐标转换到像素坐标后.不知道该算法是否可靠,先进行测试判断
-                Point offset_point = GetFieldPhysicsConvertToScreen(list_point, i_field_width, i_field_height, new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY });
-
-                //然后将取出的数据,转换成Bitmap对象
-                Bitmap ls_bt = DrawFuncation.ReadImageFile(fieldlist[i].FieldImage);
-                //再循环取出所有的particle
-                foreach (Particle ls_cotsparticleclr in list_cotsparticleclr)
-                {
-                    List<Feature> list_cotssegmentclr = new List<Feature>();
-                    list_cotssegmentclr = ls_cotsparticleclr.FeatureList;
-                    //创建颗粒分布图对应的类对象
-                    List<DSegment> list_dsegment = new List<DSegment>();
-
-                    //定义particle颗粒,并获取该颗粒与标准库中对应的颜色
-                    DParticle ls_dp = new DParticle();
-                    //ls_dp.Color = DrawFuncation.colorHx16toRGB(GetSTDItemClrByTypeIndex_ForDistrbutionSortImage(ls_cotsparticleclr.GetType()).GetColor());
-                    ls_dp.CLRFieldID = ls_cotsparticleclr.FieldId;  //为我封装的颗粒保存上,底层对应的FieldID
-                    ls_dp.CLRTagID = ls_cotsparticleclr.ParticleId;      //为我封装的颗粒对象保存上,底层对应的TagID
-                    ls_dp.STDTypeID = ls_cotsparticleclr.TypeId;     //为我封装的颗粒对象保存上,类型
-                    ls_dp.TypeId = ls_cotsparticleclr.TypeId;
-                    ls_dp.TypeName = ls_cotsparticleclr.TypeName;
-                    ls_dp.XRayId = ls_cotsparticleclr.XrayId;
-                    ls_dp.SEMPosX = ls_cotsparticleclr.SEMPosX;
-                    ls_dp.SEMPosY = ls_cotsparticleclr.SEMPosY;
-
-                    ls_dp.Color = GetColorBySTDTypeIDForBSEAndSorImage(ls_cotsparticleclr.TypeColor, ls_cotsparticleclr.TypeId);
-
-                    //防止segment过多造成程序卡死
-                    if (list_cotssegmentclr.Count < m_segment_overflownumber)
-                        //再循环取出里面所有的segment
-                        foreach (Feature ls_cotssegmentclr in list_cotssegmentclr)
-                        {
-                            //这里的坐标未转换
-                            DSegment ds = new DSegment();
-                            ds.Rect = new Rectangle(ls_cotssegmentclr.Start + offset_point.X,
-                                //i_field_height - ls_cotssegmentclr.GetHeight() + offset_point.Y,
-                                ls_cotssegmentclr.Height + offset_point.Y,
-                                ls_cotssegmentclr.Length,
-                                1);
-                            //图像上下反了,翻转一下,上下翻转
-                            //ls_bt.RotateFlip(RotateFlipType.Rotate180FlipX);//使用系统带的图像处理方法,进行x轴的翻转
-                            //合成图像完成,开始抠取像素---------------------为显示BSE原图而用--------------------------------------------
-                            int i_ls_length = ls_cotssegmentclr.Length;
-                            List<Color> ls_list_colors = new List<Color>();
-                            for (int m = 0; m < i_ls_length; m++)
-                            {
-                                //这里实现一下代码保护
-                                int lsjs_x = ls_cotssegmentclr.Start + m;
-                                //int lsjs_y = i_field_height - ls_cotssegmentclr.GetHeight();
-                                int lsjs_y = ls_cotssegmentclr.Height;
-                                if (lsjs_x < 0)
-                                    lsjs_x = 0;
-                                if (lsjs_x >= i_field_width)
-                                    lsjs_x = i_field_width - 1;
-                                if (lsjs_y < 0)
-                                    lsjs_y = 0;
-                                if (lsjs_y >= i_field_height)
-                                    lsjs_y = i_field_height - 1;
-
-                                //按理说这里应该加上个横向抠取像素颜色,这里需要再处理一下
-                                ls_list_colors.Add(ls_bt.GetPixel(lsjs_x,
-                                   lsjs_y));
-                            }
-
-                            //---------------------------------------------存入标准库相关的信息------------------------------------------------
-                            ds.Color = ls_dp.Color;//将线的颜色对应到颗粒的颜色
-                                                   //------------------------------------------------------------------------------------------------------
-                            ds.List_Colors = ls_list_colors;
-                            list_dsegment.Add(ds);
-
-                            //ls_bt.Dispose();
-                        }
-
-                    ls_dp.Zoom_DisPlayMultiplier = 0.5f;
-                    ls_dp.Zoom_DisPlay = true;
-
-                    ls_dp.DSegments = list_dsegment;   //将segment对应的设置到particle中
-
-                    //并对DParticle相关信息进行计算
-                    ls_dp.Rect = ls_dp.GetRectFromDSegment();
-                    ls_dp.GPath = ls_dp.GetRegionFromDSegments();
-                    ls_dp.SmallRect = ls_dp.GetSmallRectangleFromRect();
-
-                    //将每个颗粒添加到颗粒分布图中的列表中
-                    m_Control_DrawdistrbutionsortImage.m_list_baseobject.Add(ls_dp);
-                }
-            }
-
-            //--------------然后开始操作分布图定义的结构,接接所有的field,组成一个完整的image的rect大小,定义
-
-        }
-
-
-        /// <summary>
-        /// 根据type,从三种分类的分析库中提取当前分析物的颜色
-        /// </summary>
-        /// <param name="in_cotssampleclr"></param>
-        /// <param name="in_stdtypeid"></param>
-        /// <returns></returns>
-        public Color GetColorBySTDTypeIDForBSEAndSorImage(string in_cotssampleclr, int in_stdtypeid)
-        {
-            Color ret_c = new Color();
-
-
-            if (in_stdtypeid < 1000)
-            {
-                OTSSysSTDMgrClass osc = new OTSSysSTDMgrClass();
-                //小于1000,使用系统默认分类
-                ret_c = osc.GetColorByEnum(in_stdtypeid);
-            }
-            else if (in_stdtypeid >= 1000)
-            {
-                //大于等于1000,并且小于10000时,使用用户标准库来分析夹杂物名称
-                if (!in_cotssampleclr.Contains("#"))
-                {
-                    ret_c = DrawFuncation.colorHx16toRGB("#" + in_cotssampleclr);//接收必须是#000000的格式
-                }
-                else
-                {
-                    ret_c = DrawFuncation.colorHx16toRGB(in_cotssampleclr);//接收必须是#000000的格式
-                }
-            }
-            return ret_c;
-        }
-
-        /// <summary>
-        /// 颗粒排序图中的颗粒,重新组织显示颗粒排序规则
-        /// </summary>
-        public void GetDistrbutionSortimage_ByQuery(OTSIncAReportApp.OTSSampleReportInfo.OTSSampleMeaInfo sourceGridData)
-        {
-            List<string> FLNameList = new List<string>();
-            //List<int> FLID = new List<int>() { -1,0, 1, 2, 4, 6, 7, 8, 9 };
-            List<int> FLID = new List<int>() { 0, 1, 2, 4, 6, 9, 10};
-            List<string> NameList = new List<string>();
-            int fltype = 0;
-            //先清除list
-            m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution.Clear();
-            m_Control_DrawdistrbutionsortImage.m_old_list_sortparticledistribution.Clear();
-            m_Control_DrawdistrbutionsortImage.m_f_zoom_record = 1;
-
-
-            //------------------------------------分解结果内容部份------------------------------------
-            string display_type = "";
-            string con = "";
-            var list = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 4);
-            string sort_type = list.itemVal.ToString();
-            int _type = list.comboDownList.IndexOf(sort_type);
-            switch (_type)
-            {
-                case 0:
-                    fltype = 0;
-                    break;
-                case 1:
-                    fltype = 1;
-                    break;
-                case 2:
-                    fltype = 2;
-                    display_type = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 13).itemVal.ToString();
-                    switch (display_type)
-                    {
-                        case "DMAX":
-                            con = "DMAX";
-                            break;
-                        case "DMIN":
-                            con = "DMIN";
-                            break;
-                        case "Area":
-                            con = "Area";
-                            break;
-                        case "FERET":
-                            con = "DFERET";
-                            break;
-                    }
-                    break;
-
-            }
-            string path = resultFile.FilePath;
-            ParticleData particleData = new ParticleData(path);
-            List<Particle> particles = particleData.GetParticleListByCon("", "", "", 0);
-
-            foreach (DParticle ls_dp in m_Control_DrawdistrbutionsortImage.m_list_baseobject)
-            {
-                int dis = 0;
-                foreach (Particle particle in particles)
-                {
-                    //找到对应的颗粒,将分类设置进去
-                    if (ls_dp.CLRTagID == particle.ParticleId && ls_dp.CLRFieldID == particle.FieldId)
-                    {
-                        if (!FLNameList.Contains(particle.TypeName) && particle.TypeName != "")
-                        {
-                            FLNameList.Add(particle.TypeName);
-                        }
-                        if (fltype == 0)
-                        {
-                            ls_dp.ParticleFL = particle.TypeId.ToString();
-                        }
-                        if (fltype == 1)
-                        {
-                            ls_dp.ParticleFL = particle.TypeName.ToString();
-                        }
-                        if (fltype == 2)
-                        {
-                            if (con == "DMAX")
-                                ls_dp.ParticleFL = particle.DMAX.ToString();
-                            if (con == "DMIN")
-                                ls_dp.ParticleFL = particle.DMIN.ToString();
-                            if (con == "Area")
-                                ls_dp.ParticleFL = particle.Area.ToString();
-                            if (con == "DFERET")
-                                ls_dp.ParticleFL = particle.FERET.ToString();
-                        }
-                        ls_dp.Operator = ParticleOperator.DISPLAY;
-                        dis = 1;
-                        break;
-                    }
-
-                }
-                if (dis == 0)
-                {
-                    ls_dp.Operator = ParticleOperator.NODISPLAY;
-                }
-            }
-            if (fltype == 0)
-            {
-                //NameList = new List<string>() { table["partcletype0"].ToString(), table["partcletype1"].ToString(), table["partcletype2"].ToString(), table["partcletype4"].ToString(), table["partcletype6"].ToString(), table["partcletype7"].ToString(), table["partcletype8"].ToString(), table["partcletype9"].ToString(), table["partcletype10"].ToString() };
-                NameList = new List<string>() {table["partcletype9"].ToString(), table["partcletype10"].ToString() };
-            }
-            if (fltype == 1)
-            {
-                NameList = FLNameList;
-            }
-            if (fltype == 2)
-            {
-                //获取粒级表
-                string flpath = m_Control_DrawdistrbutionsortImage.m_ReportApp.m_RptConfigFile.FileFolderSize + m_Control_DrawdistrbutionsortImage.m_ReportApp.m_RptConfigFile.PartSizeFile;
-                DataSet ds = XMLoperate.GetXml(flpath);
-                string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
-                List<string> sizeList = new List<string>();
-
-                for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
-                {
-                    if (sizestr.Split(',')[i].Length > 0)
-                    {
-                        double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
-                        double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
-                        sizeList.Add(d1.ToString() + "~" + d2.ToString());
-                    }
-                }
-                double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
-                sizeList.Add(d.ToString() + "~MAX");
-                NameList = sizeList;
-            }
-            //为颗粒排序图,创建分栏grid
-            foreach (string name in NameList)
-            {
-                SortParticleDistribution sortparticledistribution = new SortParticleDistribution();
-                sortparticledistribution.RectF = new RectangleF(m_Control_DrawdistrbutionsortImage.ClientRectangle.X, m_Control_DrawdistrbutionsortImage.ClientRectangle.Y,
-                    800, m_Control_DrawdistrbutionsortImage.ClientRectangle.Height);
-                sortparticledistribution.ShowStr = name;//设置分类grid
-                m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution.Add(sortparticledistribution);
-            }
-
-            //然后再重新将list_baseobject中的颗粒,分别添加到对应的sortgrid中
-            foreach (DParticle ls_dp in m_Control_DrawdistrbutionsortImage.m_list_baseobject)
-            {
-
-                var sort = m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution;
-                for (int i = 0; i < sort.Count; i++)
-                {
-                    if (fltype == 0)
-                    {
-
-                        if (ls_dp.STDTypeID == FLID[i])
-                        {
-                            //将对应的颗粒添加到分栏grid中
-                            DParticle sort_dp = ls_dp.Clone() as DParticle;
-                            sort_dp.Rect = sort_dp.GetRectFromDSegment();
-                            sort[i].List_DParticle.Add(sort_dp);
-                            break;
-                        }
-                        else if (ls_dp.STDTypeID > 10000)
-                        {
-                            //将对应的颗粒添加到分栏grid中
-                            DParticle sort_dp = ls_dp.Clone() as DParticle;
-                            sort_dp.Rect = sort_dp.GetRectFromDSegment();
-                            sort[sort.Count - 1].List_DParticle.Add(sort_dp);
-                            break;
-                        }
-                    }
-                    else if (fltype == 1)
-                    {
-                        if (ls_dp.TypeName == NameList[i])
-                        {
-                            //将对应的颗粒添加到分栏grid中
-                            DParticle sort_dp = ls_dp.Clone() as DParticle;
-                            sort_dp.Rect = sort_dp.GetRectFromDSegment();
-                            sort[i].List_DParticle.Add(sort_dp);
-                            break;
-                        }
-
-                    }
-                    else if (fltype == 2)
-                    {
-                        double min = Convert.ToDouble(NameList[i].Split('~')[0]);
-                        double max = 0;
-                        if (NameList[i].Split('~')[1].ToLower() != "max")
-                        { max = Convert.ToDouble(NameList[i].Split('~')[1]); }
-                        else
-                        {
-                            max = 999;
-                        }
-                        double size = Convert.ToDouble(ls_dp.ParticleFL);
-                        if (size <= max && size >= min)
-                        {
-                            //将对应的颗粒添加到分栏grid中
-                            DParticle sort_dp = ls_dp.Clone() as DParticle;
-                            sort_dp.Rect = sort_dp.GetRectFromDSegment();
-                            sort[i].List_DParticle.Add(sort_dp);
-                            break;
-                        }
-
-                    }
-                }
-
-            }
-
-            //循环分栏grid,对各分栏grid进行摆放
-            for (int i = 0; i < m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution.Count(); i++)
-            {
-                //计算y轴,的增量
-                float ls_height = 0;
-                if (i == 0)
-                {
-                    ls_height = 0;
-                }
-                else
-                {
-                    ls_height = m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution[i - 1].RectF.Y +
-                        m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution[i - 1].RectF.Height - 10;
-                }
-
-                m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution[i].RectF = new RectangleF(
-                    m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution[i].RectF.X,
-                    m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution[i].RectF.Y + ls_height,
-                    m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution[i].RectF.Width,
-                    m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution[i].GetSortGridHeight() + 50);//为每栏的高度增加了50补充,防止图像溢出
-            }
-
-            //然后再重新对分栏grid中的颗粒,重新进行摆放
-            foreach (SortParticleDistribution ls_spd in m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution)
-            {
-                ls_spd.SortDParticle(m_Control_DrawdistrbutionsortImage.FZOOMRecord);
-            }
+       
 
-            //最后,将分栏grid,分别存放到old的分栏grid中
-            foreach (SortParticleDistribution ls_sortparticledistribution in m_Control_DrawdistrbutionsortImage.m_list_sortparticledistribution)
-            {
-                SortParticleDistribution old_sortparticledistribution = ls_sortparticledistribution.Clone() as SortParticleDistribution;
-                m_Control_DrawdistrbutionsortImage.m_old_list_sortparticledistribution.Add(old_sortparticledistribution);
 
-                foreach (DParticle ls_dp in old_sortparticledistribution.List_DParticle)
-                {
-                    ls_dp.Rect = ls_dp.GetRectFromDSegment();
-                }
-            }
+       
 
-        }
+       
 
         #endregion
 

+ 2 - 2
OTSIncAReportApp/Control_Grids/CompositionDistributionGrid.cs

@@ -132,7 +132,7 @@ namespace OTSIncAReportGrids
                         {
                             color = "#" + dt.Rows[i]["TypeColor"].ToString();
                         }
-                        gridView.Rows[add_rowindex].Cells[k].Style.BackColor = DrawFuncation.colorHx16toRGB(color);
+                        gridView.Rows[add_rowindex].Cells[k].Style.BackColor = DrawFunction.colorHx16toRGB(color);
                     }
                     else if (gridView.Columns[k].Name.ToLower() == "av" || gridView.Columns[k].Name.ToLower() == "max")
                     {
@@ -168,7 +168,7 @@ namespace OTSIncAReportGrids
                     if (gridView.Columns[k].Name == "TypeColor" && dt.Rows[i]["TypeColor"].ToString() != "")
                     {
                         string color = "#000000";
-                        gridView.Rows[add_rowindex].Cells[k].Style.BackColor = DrawFuncation.colorHx16toRGB(color);
+                        gridView.Rows[add_rowindex].Cells[k].Style.BackColor = DrawFunction.colorHx16toRGB(color);
                     }
                     else if (gridView.Columns[k].Name.ToLower() == "av" || gridView.Columns[k].Name.ToLower() == "max")
                     {

+ 4 - 4
OTSIncAReportApp/Control_Grids/ElementCompositionAvgGrid.cs

@@ -105,7 +105,7 @@ namespace OTSIncAReportGrids
 
                             double ar = Convert.ToDouble(dr["pc"]);
                             double p = Math.Round(ar / total, 2);
-                            Gview_gz.Rows[add_rowindex].Cells[j].Value = DrawFuncation.GetProcessBitmap((float)p, Color.Azure);
+                            Gview_gz.Rows[add_rowindex].Cells[j].Value = DrawFunction.GetProcessBitmap((float)p, Color.Azure);
                             Gview_gz.Rows[add_rowindex].Cells[j].Tag = p;
                             break;
                         }
@@ -113,7 +113,7 @@ namespace OTSIncAReportGrids
                     }
                     if (col == dtp.Rows.Count)
                     {
-                        Gview_gz.Rows[add_rowindex].Cells[j].Value = DrawFuncation.GetProcessBitmap(0, Color.Azure);
+                        Gview_gz.Rows[add_rowindex].Cells[j].Value = DrawFunction.GetProcessBitmap(0, Color.Azure);
                         Gview_gz.Rows[add_rowindex].Cells[j].Tag = 0;
                     }
                 }
@@ -153,7 +153,7 @@ namespace OTSIncAReportGrids
 
                             double ar = Convert.ToDouble(dr["pc"]);
                             double p = Math.Round(ar / total, 2);
-                            Gview_gz.Rows[add_rowindex].Cells[j].Value = DrawFuncation.GetProcessBitmap((float)p, Color.Azure);
+                            Gview_gz.Rows[add_rowindex].Cells[j].Value = DrawFunction.GetProcessBitmap((float)p, Color.Azure);
                             Gview_gz.Rows[add_rowindex].Cells[j].Tag = p;
                             break;
                         }
@@ -161,7 +161,7 @@ namespace OTSIncAReportGrids
                     }
                     if (col == dtp.Rows.Count)
                     {
-                        Gview_gz.Rows[add_rowindex].Cells[j].Value = DrawFuncation.GetProcessBitmap(0, Color.Azure);
+                        Gview_gz.Rows[add_rowindex].Cells[j].Value = DrawFunction.GetProcessBitmap(0, Color.Azure);
                         Gview_gz.Rows[add_rowindex].Cells[j].Tag = 0;
                     }
                 }

+ 2 - 2
OTSIncAReportApp/Control_Grids/ParticlesGridDevidePage.cs

@@ -222,7 +222,7 @@ namespace OTSIncAReportGrids
         {
 
             //然后将取出的数据,转换成Bitmap对象
-            Bitmap ls_bt = DrawFuncation.ReadImageFile(fieldImage);
+            Bitmap ls_bt = DrawFunction.ReadImageFile(fieldImage);
 
             //为了能把整个颗粒显示完整
             offset_rect.X = offset_rect.X - 5;
@@ -345,7 +345,7 @@ namespace OTSIncAReportGrids
                 string filePath = path + "\\FIELD_FILES\\";
                 string imagePath = filePath + "Field" + item["fieldid"].ToString() + ".bmp";
                 //然后将取出的数据,转换成Bitmap对象
-                Bitmap ls_bt = DrawFuncation.ReadImageFile(imagePath);
+                Bitmap ls_bt = DrawFunction.ReadImageFile(imagePath);
                 int x = Convert.ToInt32(Convert.ToDouble(item["FieldPosX"]) * xs - MIN_X);
                 int y = System.Math.Abs(Convert.ToInt32(Convert.ToDouble(item["FieldPosY"]) * xs - MAX_Y));
                 try

+ 2 - 2
OTSIncAReportApp/Control_Grids/ParticlesSizeGrid.cs

@@ -119,7 +119,7 @@ namespace OTSIncAReportGrids
                 {
                     color = "#" + dt.Rows[i]["TypeColor"].ToString();
                 }
-                gridView.Rows[add_rowindex].Cells[2].Style.BackColor = DrawFuncation.colorHx16toRGB(color);
+                gridView.Rows[add_rowindex].Cells[2].Style.BackColor = DrawFunction.colorHx16toRGB(color);
                 gridView.Rows[add_rowindex].Cells[3].Value = dt.Rows[i]["TypeId"];
                 gridView.Rows[add_rowindex].Cells[4].Value = Math.Round(Convert.ToDouble(dt.Rows[i]["max"]), 2);
                 gridView.Rows[add_rowindex].Cells[4].Style.BackColor = Color.Azure;
@@ -145,7 +145,7 @@ namespace OTSIncAReportGrids
                 gridView.Rows[add_rowindex].Cells[1].Value = name;
                 gridView.Rows[add_rowindex].Cells[1].Style.BackColor = Color.Azure;
                 string color = "#000000";
-                gridView.Rows[add_rowindex].Cells[2].Style.BackColor = DrawFuncation.colorHx16toRGB(color);
+                gridView.Rows[add_rowindex].Cells[2].Style.BackColor = DrawFunction.colorHx16toRGB(color);
                 gridView.Rows[add_rowindex].Cells[3].Value = dt.Rows[i]["TypeId"];
                 gridView.Rows[add_rowindex].Cells[4].Value = Math.Round(Convert.ToDouble(dt.Rows[i]["max"]), 2);
                 gridView.Rows[add_rowindex].Cells[4].Style.BackColor = Color.Azure;

+ 1 - 1
OTSIncAReportApp/DataOperation/DataAccess/FieldData.cs

@@ -24,7 +24,7 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
         /// </summary>
         /// <param name="model">Feature</param>
         /// <returns></returns>
-        public List<Model.Field> GetFieldList(frmReportApp a_ReportApp)
+        public List<Model.Field> GetFieldList()
         {
             //获取field信息
             string sql = "select fieldid,fieldposx,fieldposy from field ";//select fieldid,fieldposx,fieldposy from field

+ 0 - 625
OTSIncAReportApp/FunctionClass/Common/DrawFuncation.cs

@@ -1,625 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Imaging;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-using OTSIncAReportGraph.Class;
-using System.Runtime.InteropServices;
-using System.IO;
-using OpenCvSharp;
-
-namespace OTSIncAReportGraph.Class
-{
-    /// <summary>
-    /// 相关图表绘制函数统一封装类
-    /// </summary>
-    static class DrawFuncation
-    {
-        [DllImport("gdi32.dll")]
-        public static extern System.UInt32 GetPixel(IntPtr hdc, int xPos, int yPos);
-
-        /// <summary>    
-        /// 将一个byte的数组转换为8bit灰度位图    
-        /// </summary>    
-        /// <param name="data">数组</param>    
-        /// <param name="width">图像宽度</param>    
-        /// <param name="height">图像高度</param>    
-        /// <returns>位图</returns>    
-        public static Bitmap ToGrayBitmap(byte[] data, int width, int height)
-        {
-            //// 申请目标位图的变量,并将其内存区域锁定    
-            Bitmap bmp = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
-            //// BitmapData这部分内容  需要 using System.Drawing.Imaging;  
-            BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, width, height),
-            ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
-
-            //// 获取图像参数    
-            // 扫描线的宽度   
-            //int stride = bmpData.Stride;
-            // 显示宽度与扫描线宽度的间隙  
-            int offset = width - width;
-            // 获取bmpData的内存起始位置
-            IntPtr iptr = bmpData.Scan0;
-            // 用stride宽度,表示这是内存区域的大小
-            int scanBytes = width * height;
-
-            //// 下面把原始的显示大小字节数组转换为内存中实际存放的字节数组    
-            int posScan = 0, posReal = 0;// 分别设置两个位置指针,指向源数组和目标数组    
-            byte[] pixelValues = new byte[scanBytes];  //为目标数组分配内存    
-
-            for (int x = 0; x < height; x++)
-            {
-                //// 下面的循环节是模拟行扫描    
-                for (int y = 0; y < width; y++)
-                {
-                    pixelValues[posScan++] = data[posReal++];
-                }
-                posScan += offset;  //行扫描结束,要将目标位置指针移过那段“间隙”    
-            }
-            //// 用Marshal的Copy方法,将刚才得到的内存字节数组复制到BitmapData中    
-            System.Runtime.InteropServices.Marshal.Copy(pixelValues, 0, iptr, scanBytes);
-            bmp.UnlockBits(bmpData);  // 解锁内存区域    
-
-            //// 下面的代码是为了修改生成位图的索引表,从伪彩修改为灰度    
-            ColorPalette tempPalette;
-            using (Bitmap tempBmp = new Bitmap(1, 1, PixelFormat.Format8bppIndexed))
-            {
-                tempPalette = tempBmp.Palette;
-            }
-            for (int i = 0; i < 256; i++)
-            {
-                tempPalette.Entries[i] = Color.FromArgb(i, i, i);
-            }
-            bmp.Palette = tempPalette;
-
-            //// 算法到此结束,返回结果    
-            return bmp;
-        }
-
-        /// <summary>
-        /// *有BUG*将图片缩放到目标宽高,该方法有问题,不应该继续使用,图像申缩存在不规则问题
-        /// </summary>
-        /// <param name="sourceImage"></param>
-        /// <param name="targetWidth"></param>
-        /// <param name="targetHeight"></param>
-        /// <returns></returns>
-        public static Image pictureProcess(Image sourceImage, int targetWidth, int targetHeight)
-        {
-            int width;//图片最终的宽  
-            int height;//图片最终的高  
-            try
-            {
-                System.Drawing.Imaging.ImageFormat format = sourceImage.RawFormat;
-                Bitmap targetPicture = new Bitmap(targetWidth, targetHeight);
-                Graphics g = Graphics.FromImage(targetPicture);
-                g.Clear(Color.White);
-
-                //计算缩放图片的大小  
-                if (sourceImage.Width > targetWidth && sourceImage.Height <= targetHeight)
-                {
-                    width = targetWidth;
-                    height = (width * sourceImage.Height) / sourceImage.Width;
-                }
-                else if (sourceImage.Width <= targetWidth && sourceImage.Height > targetHeight)
-                {
-                    height = targetHeight;
-                    width = (height * sourceImage.Width) / sourceImage.Height;
-                }
-                else if (sourceImage.Width <= targetWidth && sourceImage.Height <= targetHeight)
-                {
-                    width = sourceImage.Width;
-                    height = sourceImage.Height;
-                }
-                else
-                {
-                    width = targetWidth;
-                    height = (width * sourceImage.Height) / sourceImage.Width;
-                    if (height > targetHeight)
-                    {
-                        height = targetHeight;
-                        width = (height * sourceImage.Width) / sourceImage.Height;
-                    }
-                }
-                g.DrawImage(sourceImage, (targetWidth - width) / 2, (targetHeight - height) / 2, width, height);
-                g.Dispose();
-                return targetPicture;
-            }
-            catch (Exception ex)
-            {
-                string str = ex.ToString();
-            }
-            return null;
-        }
-
-        /// <summary>
-        /// 根据传入的宽和高,取得当前对应显示的4:3的标准分辨率
-        /// </summary>
-        /// <returns></returns>
-        public static Rectangle Get43ScaleResolving(int in_width, int in_height)
-        {
-            Rectangle rect_resolving = new Rectangle();
-            int width_min = 0;
-            int height_min = 0;
-            int width_max = 0;
-            int height_max = 0;
-
-            width_min = 1600;
-            height_min = 1200;
-            width_max = 2048;
-            height_max = 1536;
-            if ((in_width >= width_min && in_width < width_max) || (in_height >= height_min && in_height < height_max))
-                rect_resolving = new Rectangle(0, 0, width_min, height_min);
-
-            width_min = 1400;
-            height_min = 1050;
-            width_max = 1600;
-            height_max = 1200;
-            if ((in_width >= width_min && in_width < width_max) || (in_height >= height_min && in_height < height_max))
-                rect_resolving = new Rectangle(0, 0, width_min, height_min);
-
-            width_min = 1280;
-            height_min = 1024;
-            width_max = 1400;
-            height_max = 1050;
-            if ((in_width >= width_min && in_width < width_max) || (in_height >= height_min && in_height < height_max))
-                rect_resolving = new Rectangle(0, 0, width_min, height_min);
-
-            width_min = 1024;
-            height_min = 768;
-            width_max = 1280;
-            height_max = 1024;
-            if ((in_width >= width_min && in_width < width_max) || (in_height >= height_min && in_height < height_max))
-                rect_resolving = new Rectangle(0, 0, width_min, height_min);
-
-            width_min = 800;
-            height_min = 600;
-            width_max = 1024;
-            height_max = 768;
-            if ((in_width >= width_min && in_width < width_max) || (in_height >= height_min && in_height < height_max))
-                rect_resolving = new Rectangle(0, 0, width_min, height_min);
-
-            width_min = 640;
-            height_min = 480;
-            width_max = 800;
-            height_max = 600;
-            if ((in_width >= width_min && in_width < width_max) || (in_height >= height_min && in_height < height_max))
-                rect_resolving = new Rectangle(0, 0, width_min, height_min);
-
-            width_min = 320;
-            height_min = 240;
-            width_max = 640;
-            height_max = 480;
-            if ((in_width >= width_min && in_width < width_max) || (in_height >= height_min && in_height < height_max))
-                rect_resolving = new Rectangle(0, 0, width_min, height_min);
-
-            width_min = 0;
-            height_min = 0;
-            width_max = 320;
-            height_max = 240;
-            if ((in_width >= width_min && in_width < width_max) || (in_height >= height_min && in_height < height_max))
-                rect_resolving = new Rectangle(0, 0, width_min, height_min);
-
-            return rect_resolving;
-        }
-
-        /// <summary>  
-        /// [该方法效果正确,但速度上慢,淘汰掉],上下翻转  
-        /// </summary>  
-        /// <param name="mybm">原始图片</param>  
-        /// <param name="width">原始图片的长度</param>  
-        /// <param name="height">原始图片的高度</param>  
-        public static Bitmap RevPicUD(Bitmap mybm, int width, int height)
-        {
-            Bitmap bm = new Bitmap(width, height);
-            int x, y, z;
-            Color pixel;
-            for (x = 0; x < width; x++)
-            {
-                for (y = height - 1, z = 0; y >= 0; y--)
-                {
-                    pixel = mybm.GetPixel(x, y);//获取当前像素的值  
-                    bm.SetPixel(x, z++, Color.FromArgb(pixel.R, pixel.G, pixel.B));//绘图  
-                }
-            }
-            return bm;
-        }
-
-
-        /// <summary>
-        /// 实现计算的方法,就是输出个数字,然后向上寻找倍数,然后返回来根
-        /// </summary>
-        /// <param name="in_number"></param>
-        /// <returns></returns>
-        public static int GetSquareRoot(int in_number)
-        {
-            int i_increase = 1;
-
-            while (true)
-            {
-                //防止死循环
-                if (i_increase > 10000)
-                    return i_increase;
-
-                int ls_i = i_increase * i_increase;
-                if (in_number > ls_i)
-                {
-                    //如果当前的数值已经大于平方数的话,那就继续下一次的平方
-                    i_increase++;
-                    continue;
-                }
-                else
-                {
-                    //如果已经小于平方数的话,那就说明已经找到了平方根,返回
-                    return i_increase;
-                }
-            }
-        }
-
-
-        /// <summary>
-        /// 根据传入的数字返回对应的颜色,范围1-17种颜色,挑出来比较谈的颜色为对比效果好看而挑选
-        /// </summary>
-        /// <param name="number"></param>
-        /// <returns></returns>
-        public static Color GetColorByNumber(int number)
-        {
-            Color ret_color = new Color();
-            switch (number)
-            {
-                case 1:
-                    ret_color = Color.Blue;
-                    break;
-                case 2:
-                    ret_color = Color.Brown;
-                    break;
-                case 3:
-                    ret_color = Color.LimeGreen;
-                    break;
-                case 13:
-                    ret_color = Color.Cyan;
-                    break;
-                case 4:
-                    ret_color = Color.DarkBlue;
-                    break;
-                case 5:
-                    ret_color = Color.Red;
-                    break;
-                case 6:
-                    ret_color = Color.SaddleBrown;
-                    break;
-                case 7:
-                    ret_color = Color.DimGray;
-                    break;
-                case 8:
-                    ret_color = Color.Navy;
-                    break;
-                case 9:
-                    ret_color = Color.Peru;
-                    break;
-                case 10:
-                    ret_color = Color.Red;
-                    break;
-                case 11:
-                    ret_color = Color.SeaGreen;
-                    break;
-                case 12:
-                    ret_color = Color.MintCream;
-                    break;
-                case 14:
-                    ret_color = Color.PaleTurquoise;
-                    break;
-                case 15:
-                    ret_color = Color.SeaShell;
-                    break;
-                case 16:
-                    ret_color = Color.Snow;
-                    break;
-                case 17:
-                    ret_color = Color.WhiteSmoke;
-                    break;
-
-                default:
-                    ret_color = Color.White;
-                    break;
-            }
-
-            return ret_color;
-        }
-
-        /// <summary>
-        /// 获取一个自绘模仿进度条的bitemap对象,传入进度的值,0-100之间
-        /// </summary>
-        /// <param name="process_value"></param>
-        /// <returns></returns>
-        public static Bitmap GetProcessBitmap(int process_value)
-        {
-            Bitmap bmp = new Bitmap(104, 30); //这里给104是为了左边和右边空出2个像素,剩余的100就是百分比的值
-            Graphics g = Graphics.FromImage(bmp);
-            g.Clear(Color.White); //背景填白色
-                                  //g.FillRectangle(Brushes.Red, 2, 2, this.Press, 26);  //普通效果
-                                  //填充渐变效果
-            SolidBrush drawBrush = new SolidBrush(Color.Black);
-            g.FillRectangle(new System.Drawing.Drawing2D.LinearGradientBrush(new System.Drawing.Point(30, 2), new System.Drawing.Point(30, 30), Color.Red, Color.Gray), 2, 2, process_value, 26);
-            g.DrawString(process_value.ToString(), new Font("宋体", 9), drawBrush, 50, 8);
-            return bmp;
-        }
-
-
-
-        /// <summary>
-        /// 获取一个自绘模仿进度条的bitemap对象,传入进度的值,0-100之间[重载可以自定设置背景色]
-        /// </summary>
-        /// <param name="process_value"></param>
-        /// <param name="back_color"></param>
-        /// <returns></returns>
-        public static Bitmap GetProcessBitmap(float process_value, Color back_color)
-        {
-            if (process_value < 0)
-                process_value = 0;
-            if (process_value > 100)
-                process_value = 100;
-            Bitmap bmp = new Bitmap(104, 30); //这里给104是为了左边和右边空出2个像素,剩余的100就是百分比的值
-            Graphics g = Graphics.FromImage(bmp);
-            g.Clear(back_color); //背景填白色
-                                 //g.FillRectangle(Brushes.Red, 2, 2, this.Press, 26);  //普通效果
-                                 //填充渐变效果
-            SolidBrush drawBrush = new SolidBrush(Color.Black);
-            g.FillRectangle(new System.Drawing.Drawing2D.LinearGradientBrush(new System.Drawing.Point(30, 2), new System.Drawing.Point(30, 30), Color.Red, Color.Gray), 2, 2, process_value, 26);
-            g.DrawString(process_value.ToString(), new Font("宋体", 9), drawBrush, 50, 8);
-            return bmp;
-        }
-
-
-        /// <summary>
-        /// [颜色:16进制转成RGB]
-        /// </summary>
-        /// <param name="strColor">设置16进制颜色 [返回RGB]</param>
-        /// <returns></returns>
-        public static System.Drawing.Color colorHx16toRGB(string strHxColor)
-        {
-            try
-            {
-                if (strHxColor.Length == 0)
-                {//如果为空
-                    return System.Drawing.Color.FromArgb(0, 0, 0);//设为黑色
-                }
-                else
-                {//转换颜色
-                    if (strHxColor.IndexOf('#') > -1)
-                    {
-                        //如果颜色格式是 #0000FF 格式的
-                        return System.Drawing.Color.FromArgb(System.Int32.Parse(strHxColor.Substring(1, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(3, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(5, 2), System.Globalization.NumberStyles.AllowHexSpecifier));
-                    }
-                    else
-                    {
-                        //如果颜色格式是 0000FF 格式的
-                        return System.Drawing.Color.FromArgb(System.Int32.Parse(strHxColor.Substring(0, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(2, 2), System.Globalization.NumberStyles.AllowHexSpecifier), System.Int32.Parse(strHxColor.Substring(4, 2), System.Globalization.NumberStyles.AllowHexSpecifier));
-                    }
-                }
-            }
-            catch
-            {//设为黑色
-                return System.Drawing.Color.FromArgb(0, 0, 0);
-            }
-        }
-
-
-        /// <summary>
-        /// 通过FileStream 来打开文件,这样就可以实现不锁定Image文件,到时可以让多用户同时访问Image文件
-        /// </summary>
-        /// <param name="path"></param>
-        /// <returns></returns>
-        public static Bitmap ReadImageFile(string path)
-        {
-            if (!File.Exists(path))
-            {
-                return null;//文件不存在
-            }
-            FileStream fs = File.OpenRead(path); //OpenRead
-            int filelength = 0;
-            filelength = (int)fs.Length; //获得文件长度 
-            Byte[] image = new Byte[filelength]; //建立一个字节数组 
-            fs.Read(image, 0, filelength); //按字节流读取 
-            System.Drawing.Image result = System.Drawing.Image.FromStream(fs);
-            fs.Close();
-            Bitmap bit = new Bitmap(result);
-            return bit;
-        }
-        //图片转成二进制        
-        public static byte[] GetPictureData(string imagepath)
-        {
-            /**/
-            ////根据图片文件的路径使用文件流打开,并保存为byte[]             
-            FileStream FileStream = new FileStream(imagepath, FileMode.Open);
-            byte[] byData = new byte[FileStream.Length];
-            FileStream.Read(byData, 0, byData.Length);
-            FileStream.Close();
-            return byData;
-        }
-
-
-        /// <summary>
-        /// 将image转成bytes
-        /// </summary>
-        /// <param name="in_img"></param>
-        /// <returns></returns>
-        public static byte[] ImageConvertToBytes(System.Drawing.Image in_img)
-        {
-            MemoryStream ms = new MemoryStream();
-            in_img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
-            return ms.ToArray();
-        }
-
-
-        /// <summary> 
-        /// Resize图片
-        /// </summary>
-        /// <param name="bmp">原始Bitmap</param>
-        /// <param name="newW">新的宽度</param>
-        /// <param name="newH">新的高度</param>
-        /// <returns>处理以后的图片</returns>
-        public static Bitmap KiResizeImage(Bitmap bmp, int newW, int newH)
-        {
-            try
-            {
-                Bitmap b = new Bitmap(newW, newH);
-                Graphics g = Graphics.FromImage(b);
-
-                // 插值算法的质量
-                g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
-
-                g.DrawImage(bmp, new Rectangle(0, 0, newW, newH), new Rectangle(0, 0, bmp.Width, bmp.Height), GraphicsUnit.Pixel);
-                g.Dispose();
-
-                return b;
-            }
-            catch
-            {
-                return null;
-            }
-        }
-
-        public static Bitmap GetReZoomBitmap(Bitmap in_bp)
-        {
-            Mat src = OpenCvSharp.Extensions.BitmapConverter.ToMat(in_bp);
-            Mat dst = new Mat();
-
-            Cv2.AdaptiveThreshold(src, dst, 255, AdaptiveThresholdTypes.MeanC, ThresholdTypes.Binary, 27, 25);
-
-            //绝对缩放,
-            Mat dst2 = new Mat();
-            int col = dst.Width;//获取原图像的大小
-            int rows = dst.Height;
-            Cv2.Resize(dst, dst2, new OpenCvSharp.Size(4 * col, 4 * rows), 0, 0, InterpolationFlags.Cubic);
-
-            return OpenCvSharp.Extensions.BitmapConverter.ToBitmap(dst2);
-        }
-
-
-    }
-
-
-    /// <summary>
-    /// 获取当前桌面显示器相关信息,暂未考虑多显示器
-    /// </summary>
-    static public class MyPrimaryScreen
-    {
-
-        #region Win32 API  
-        [DllImport("user32.dll")]
-        static extern IntPtr GetDC(IntPtr ptr);
-        [DllImport("gdi32.dll")]
-        static extern int GetDeviceCaps(
-        IntPtr hdc, // handle to DC  
-                        int nIndex // index of capability  
-                        );
-        [DllImport("user32.dll", EntryPoint = "ReleaseDC")]
-        static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDc);
-        #endregion
-
-        #region DeviceCaps常量  
-        const int HORZRES = 8;
-        const int VERTRES = 10;
-        const int LOGPIXELSX = 88;
-        const int LOGPIXELSY = 90;
-        const int DESKTOPVERTRES = 117;
-        const int DESKTOPHORZRES = 118;
-        #endregion
-
-        #region 属性  
-        /// <summary>  
-        /// 获取屏幕分辨率当前物理大小  
-        /// </summary>  
-        public static System.Drawing.Size WorkingArea
-        {
-            get
-            {
-                IntPtr hdc = GetDC(IntPtr.Zero);
-                System.Drawing.Size size = new System.Drawing.Size();
-                size.Width = GetDeviceCaps(hdc, HORZRES);
-                size.Height = GetDeviceCaps(hdc, VERTRES);
-                ReleaseDC(IntPtr.Zero, hdc);
-                return size;
-            }
-        }
-
-        /// <summary>  
-        /// 当前系统DPI_X 大小 一般为96  
-        /// </summary>  
-        public static int DpiX
-        {
-            get
-            {
-                IntPtr hdc = GetDC(IntPtr.Zero);
-                int DpiX = GetDeviceCaps(hdc, LOGPIXELSX);
-                ReleaseDC(IntPtr.Zero, hdc);
-                return DpiX;
-            }
-        }
-
-        /// <summary>  
-        /// 当前系统DPI_Y 大小 一般为96  
-        /// </summary>  
-        public static int DpiY
-        {
-            get
-            {
-                IntPtr hdc = GetDC(IntPtr.Zero);
-                int DpiX = GetDeviceCaps(hdc, LOGPIXELSY);
-                ReleaseDC(IntPtr.Zero, hdc);
-                return DpiX;
-            }
-        }
-
-        /// <summary>  
-        /// 获取真实设置的桌面分辨率大小  
-        /// </summary>  
-        public static System.Drawing.Size DESKTOP
-        {
-            get
-            {
-                IntPtr hdc = GetDC(IntPtr.Zero);
-                System.Drawing.Size size = new System.Drawing.Size();
-                size.Width = GetDeviceCaps(hdc, DESKTOPHORZRES);
-                size.Height = GetDeviceCaps(hdc, DESKTOPVERTRES);
-                ReleaseDC(IntPtr.Zero, hdc);
-                return size;
-            }
-        }
-
-        /// <summary>  
-        /// 获取宽度缩放百分比  
-        /// </summary>  
-        public static float ScaleX
-        {
-            get
-            {
-                IntPtr hdc = GetDC(IntPtr.Zero);
-                int t = GetDeviceCaps(hdc, DESKTOPHORZRES);
-                int d = GetDeviceCaps(hdc, HORZRES);
-                float ScaleX = (float)GetDeviceCaps(hdc, DESKTOPHORZRES) / (float)GetDeviceCaps(hdc, HORZRES);
-                ReleaseDC(IntPtr.Zero, hdc);
-                return ScaleX;
-            }
-        }
-
-        /// <summary>  
-        /// 获取高度缩放百分比  
-        /// </summary>  
-        public static float ScaleY
-        {
-            get
-            {
-                IntPtr hdc = GetDC(IntPtr.Zero);
-                float ScaleY = (float)(float)GetDeviceCaps(hdc, DESKTOPVERTRES) / (float)GetDeviceCaps(hdc, VERTRES);
-                ReleaseDC(IntPtr.Zero, hdc);
-                return ScaleY;
-            }
-        }
-        #endregion
-
-    }
-}

+ 3 - 11
OTSIncAReportApp/FunctionClass/Common/MyDraw.cs

@@ -528,22 +528,14 @@ namespace OTSIncAReportGraph
         /// <summary>
         /// 是否被拖动标识
         /// </summary>
-        //public  bool IsDragging
-        //{
-        //    get { return m_IsDragging; }
-        //    set { m_IsDragging = value; }
-        //}
+
 
         public override bool IsDragging { get => m_IsDragging; set => m_IsDragging=value; }
 
         /// <summary>
         /// 被拖动到的位置坐标
         /// </summary>
-        //public PointF DraggingPoint
-        //{
-        //    get { return m_dragingpoint; }
-        //    set { m_dragingpoint = value; }
-        //}
+ 
 
         public override PointF DraggingPoint { get => m_dragingpoint; set => m_dragingpoint=value; }
 
@@ -1069,7 +1061,7 @@ namespace OTSIncAReportGraph
                     {
                         item.OnPaint(e);
                     }
-                }
+                 }
                 else
                 {
                     g.DrawString("+", new Font("黑体", 6), new SolidBrush(Color.DarkSlateBlue), new PointF(m_small_rect.X, m_small_rect.Y));

+ 1 - 4
OTSIncAReportApp/FunctionClass/OTSDataMgrFunction/DataMgrFun.cs

@@ -969,10 +969,7 @@ namespace OTSIncAReportApp.OTSDataMgrFunction
             if (m_ReportApp.SourceGridData.SampleDataList.Count > 0)
             {
                 OTSSampleMeaInfo a = m_ReportApp.SourceGridData;
-                //if (a.TSampleParam.sSampleTitleName == null)
-                //{
-                //    a.TSampleParam.sSampleTitleName = m_ReportApp.SourceGridDataListLog[a.TabIndex].TSampleParam.sSampleTitleName;
-                //}
+        
                 //new
                 if (a.TSampleParam.List_ShowGrid_Items == null)
                 {

+ 1 - 1
OTSIncAReportApp/OTSIncAReportApp.csproj

@@ -271,7 +271,7 @@
       <DependentUpon>myColorComboBox.cs</DependentUpon>
     </Compile>
     <Compile Include="FunctionClass\Common\XmlConfigUtil.cs" />
-    <Compile Include="FunctionClass\Common\DrawFuncation.cs" />
+    <Compile Include="FunctionClass\Common\DrawFunction.cs" />
     <Compile Include="FunctionClass\Common\MyDraw.cs" />
     <Compile Include="Control_Grids\ParticlesGridDevidePage.cs">
       <SubType>UserControl</SubType>

+ 2 - 2
OTSIncAReportApp/OTSTemplateDesigner/Export_NPOI_Excel.cs

@@ -121,7 +121,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
         /// <param name="row"></param>
         private void AddPictureInExcel(Bitmap in_bp, int cell, int row)
         {
-            byte[] bytes = DrawFuncation.ImageConvertToBytes(in_bp);
+            byte[] bytes = DrawFunction.ImageConvertToBytes(in_bp);
 
             //第二步,将图片添加到workbook中,指定图片的格式,返回图片所在workbook->paicture数组中的索引的地址,从1开始
             int pictureIdx = workbook.AddPicture(bytes, NPOI.SS.UserModel.PictureType.JPEG);
@@ -150,7 +150,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             g.Clear(Color.FromArgb(230, 230, 230));
             g.DrawImage(in_bp, new Rectangle(17, 0, 30, 17), new Rectangle(0, 0, in_bp.Width, in_bp.Height), GraphicsUnit.Pixel);
 
-            byte[] bytes = DrawFuncation.ImageConvertToBytes(ls_bp);
+            byte[] bytes = DrawFunction.ImageConvertToBytes(ls_bp);
 
             //第二步,将图片添加到workbook中,指定图片的格式,返回图片所在workbook->paicture数组中的索引的地址,从1开始
             int pictureIdx = workbook.AddPicture(bytes, NPOI.SS.UserModel.PictureType.JPEG);

+ 2 - 2
OTSIncAReportApp/OTSTemplateDesigner/Export_ReportTemplate.cs

@@ -245,11 +245,11 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                     System.Drawing.Bitmap bp_xraybp = ExportXRayBitmap(str_fieldid,
                         str_particleid, Convert.ToInt32(str_typeid), str_typename, fielddata);
                     Bitmap ls_xraybpnew = new Bitmap(1, 1);
-                    ls_xraybpnew = OTSIncAReportGraph.Class.DrawFuncation.KiResizeImage(bp_xraybp, 700, 115);//能谱图处理
+                    ls_xraybpnew = OTSIncAReportGraph.Class.DrawFunction.KiResizeImage(bp_xraybp, 700, 115);//能谱图处理
 
                     //获取该颗粒的二次放大处理图像
                     Bitmap ls_processbitmap = new Bitmap(1, 1);
-                    ls_processbitmap = OTSIncAReportGraph.Class.DrawFuncation.GetReZoomBitmap(bp_particle);// (Bitmap)bp_particle.Clone();//待完善
+                    ls_processbitmap = OTSIncAReportGraph.Class.DrawFunction.GetReZoomBitmap(bp_particle);// (Bitmap)bp_particle.Clone();//待完善
 
                     //再将图像转成二进制流-------------------------------------------------------------------
                     //原图

+ 3 - 3
OTSIncAReportApp/frmReportApp.cs

@@ -423,7 +423,7 @@ namespace OTSIncAReportApp
                         if (im_Control_DrawDistrbutionImageAndBSE != null)
                         {
                             //分布图
-                            im_Control_DrawDistrbutionImageAndBSE.FullGraphMate();
+                            im_Control_DrawDistrbutionImageAndBSE.FullGraphMatch();
                             im_Control_DrawDistrbutionImageAndBSE.Invalidate();
                         }
                     }
@@ -463,7 +463,7 @@ namespace OTSIncAReportApp
                         if (im_Control_DrawDistrbutionImageAndBSE != null)
                         {
                             //分布图
-                            im_Control_DrawDistrbutionImageAndBSE.WidthMate();
+                            im_Control_DrawDistrbutionImageAndBSE.WidthMatch();
                             im_Control_DrawDistrbutionImageAndBSE.Invalidate();
                         }
                     }
@@ -647,7 +647,7 @@ namespace OTSIncAReportApp
                         if (im_Control_DrawDistrbutionImageAndBSE != null)
                         {
                             //分布图
-                            im_Control_DrawDistrbutionImageAndBSE.ReverSeSelection();
+                            im_Control_DrawDistrbutionImageAndBSE.ReverseSelection();
                         }
                     }
                     else

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff