Przeglądaj źródła

fix the bug in sortImage.

gsp 2 lat temu
rodzic
commit
3df84569de

+ 25 - 25
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -210,7 +210,7 @@ namespace OTSIncAReportGraph.Controls
             get { return m_backRect; }
         }
 
-        public OTSImageDisHelp ReportFun { get => m_ReportFun; set => m_ReportFun = value; }
+        public OTSImageDisHelp ImageDisHelper { get => m_ReportFun; set => m_ReportFun = value; }
 
         //测试用隐藏颗粒的id号,回头去掉
         public int test_hide_particle_tagid = 1000;
@@ -249,7 +249,7 @@ namespace OTSIncAReportGraph.Controls
             resultFile = m_ReportApp.m_rstDataMgr.CurResultFile;
 
             //初始化底层操作类
-            ReportFun = new OTSImageDisHelp(resultFile);
+            ImageDisHelper = new OTSImageDisHelp(resultFile);
             InitializeComponent();
             #region 国际化语言
             Language lan = new Language(this);
@@ -330,18 +330,18 @@ namespace OTSIncAReportGraph.Controls
                 this.control_Ruler1.Visible = true;
                 this.control_Ruler1.SetValue(m_f_ruler_size, m_pixelSize);
             }
-            ReportFun.m_original_list_baseobject.Clear();
+            ImageDisHelper.m_original_list_baseobject.Clear();
             //记录原值,用于缩放计算操作 ,此处要用克隆 ,原particle颗粒的值,在底层调用时已经赋值过了
             foreach (DisplayParticle ls_dp in m_list_allDPart)
             {
                 ls_dp.SetPaintState(PaintState.PAINT);
                 DisplayParticle old_dp = ls_dp.Clone() as DisplayParticle;
-                ReportFun. m_original_list_baseobject.Add(old_dp);
+                ImageDisHelper. m_original_list_baseobject.Add(old_dp);
             }
 
             //加载时将背景rect设置与整个窗体一边大小
             m_old_backRect = m_backRect;
-            ReportFun.m_original_list_dfield.Clear();
+            ImageDisHelper.m_original_list_dfield.Clear();
             ////赋值给old保存原值
             for (int i = 0; i < m_list_allDfield.Count; i++)
             {
@@ -350,7 +350,7 @@ namespace OTSIncAReportGraph.Controls
                     m_list_allDfield[i].Show_Rect.Y,
                     m_list_allDfield[i].Show_Rect.Width,
                     m_list_allDfield[i].Show_Rect.Height);
-               ReportFun. m_original_list_dfield.Add(df);
+               ImageDisHelper. m_original_list_dfield.Add(df);
             }
 
 
@@ -414,12 +414,12 @@ namespace OTSIncAReportGraph.Controls
             }
 
             //计算出整个绘制图像总Rectagnle的大小
-            m_backRect = ReportFun. ConvertAndGetMaxRect(list_point, fieldwidth, fieldheight);
+            m_backRect = ImageDisHelper. ConvertAndGetMaxRect(list_point, fieldwidth, fieldheight);
            
             ProgressBarUpdate(18, "calculate ruler....");
 
             #region //标尺相关------------------------------------------------------------------------------
-            RectangleF ls_jsblrect = ReportFun.GetPhysicalFieldWidthAndHeight(list_point,fieldwidth,fieldheight);
+            RectangleF ls_jsblrect = ImageDisHelper.GetPhysicalFieldWidthAndHeight(list_point,fieldwidth,fieldheight);
             //然后用宽度来除以i_field_width 获取单个的像素比例
             double d_onepixel_scale = Convert.ToDouble(ls_jsblrect.Width) / Convert.ToDouble(fieldwidth);
             //再用该比例对标尺进行相应的赋值
@@ -436,7 +436,7 @@ namespace OTSIncAReportGraph.Controls
             string str33 = "total ";
             string str34 = "field...";
 
-            var otsLeftBottomPoint = ReportFun.GetOTSCoordLeftBottomPoint(list_point);
+            var otsLeftBottomPoint = ImageDisHelper.GetOTSCoordLeftBottomPoint(list_point);
 
             m_list_allDfield.Clear();
             m_list_allDPart.Clear();
@@ -445,7 +445,7 @@ namespace OTSIncAReportGraph.Controls
                 ProgressBarUpdate(20 + (int)(ls_int_progresscalc * (i + 1)), str32 + i.ToString() + str33 + resultFile.List_OTSField.Count.ToString() + str34);
                 //取出该Field的物理坐标,将其转换成对应的屏幕像素坐标,屏幕左上角为原点(0,0)的偏移值,用于后面计算各Segment的位置使用
                 Point thisfield_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };
-                Point offset_point = ReportFun.ConvertOTSCoordinateToScreenCoord(otsLeftBottomPoint, m_pixelSize, thisfield_point, m_backRect, new RectangleF(0,0,fieldwidth,fieldheight));//the ots coordinate is always the up right positive.
+                Point offset_point = ImageDisHelper.ConvertOTSCoordinateToScreenCoord(otsLeftBottomPoint, m_pixelSize, thisfield_point, m_backRect, new RectangleF(0,0,fieldwidth,fieldheight));//the ots coordinate is always the up right positive.
                 DisplayField df = new DisplayField(fieldlist[i],fieldwidth,fieldheight, offset_point);
                 m_list_allDfield.Add(df);
                 m_list_allDPart.AddRange(df.List_DParticle);
@@ -463,8 +463,8 @@ namespace OTSIncAReportGraph.Controls
             ProgressBarUpdate(95, "other work...");
          
             //相关计数
-            ReportFun.m_field_count = fieldlist.Count;
-            ReportFun.m_particle_count = m_list_allDPart.Count;
+            ImageDisHelper.m_field_count = fieldlist.Count;
+            ImageDisHelper.m_particle_count = m_list_allDPart.Count;
         }
 
     
@@ -782,7 +782,7 @@ namespace OTSIncAReportGraph.Controls
                     {
                         //这里重新设置每条线的高度,和x,y坐标
                         DisplaySegment ds = dp.DSegments[y];
-                    DisplaySegment old_ds = ((DisplayParticle)ReportFun.m_original_list_baseobject[i]).DSegments[y];
+                    DisplaySegment old_ds = ((DisplayParticle)ImageDisHelper.m_original_list_baseobject[i]).DSegments[y];
                     ds.PenWidthAndHeight = ds.PenWidthAndHeight + old_ds.PenWidthAndHeight
                         * zoom;
 
@@ -902,7 +902,7 @@ namespace OTSIncAReportGraph.Controls
                     foreach (BaseObject item in m_list_allDPart)
                     {
                         var dp = (DisplayParticle)item;
-                        if (ReportFun.WhetherInRange(dp, e.Location))
+                        if (ImageDisHelper.WhetherInRange(dp, e.Location))
                         {
                             dp.IsSelect = !dp.IsSelect;
                             ifClickOnParticle = true;
@@ -1059,7 +1059,7 @@ namespace OTSIncAReportGraph.Controls
                         DisplayParticle dp = (DisplayParticle)item;
                         if (dp.GetPaintState() == PaintState.PAINT)
                         {
-                            if (ReportFun.WhetherInRange(dp, e.Location))
+                            if (ImageDisHelper.WhetherInRange(dp, e.Location))
                             {
                                 dp.IsMouseOver = true;
 
@@ -1205,7 +1205,7 @@ namespace OTSIncAReportGraph.Controls
                             {
                                 PointF[] lspointf = ls_gpath.PathPoints;
                                
-                                    if (true == ReportFun.WhetherInRange(m_SelectTool.Rect, lspointf,new Point((int)dp.Rect.X,(int)dp.Rect.Y)))
+                                    if (true == ImageDisHelper.WhetherInRange(m_SelectTool.Rect, lspointf,new Point((int)dp.Rect.X,(int)dp.Rect.Y)))
                                     {
                                     
                                     dp.IsSelect =!dp.IsSelect ;// set the particle to the opsite selected state
@@ -1326,7 +1326,7 @@ namespace OTSIncAReportGraph.Controls
                
                 foreach (BaseObject item in m_list_allDPart)
                 {
-                    if (true == ReportFun.WhetherInRange((DisplayParticle)item, e.Location))
+                    if (true == ImageDisHelper.WhetherInRange((DisplayParticle)item, e.Location))
                     {
                         ifClickOnParticle = true;
                         CMenuStrip.Items[(int)RightButtonMenu.Include].Visible = false;
@@ -1459,7 +1459,7 @@ namespace OTSIncAReportGraph.Controls
             List<Element> list_celementchemistryclr = new List<Element>();
 
             //获取Xray数据
-            ReportFun.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(m_mouseOver_dparticle.ParticleId, m_mouseOver_dparticle.FieldId, out Search_xray, out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
+            ImageDisHelper.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(m_mouseOver_dparticle.ParticleId, m_mouseOver_dparticle.FieldId, out Search_xray, out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
 
             //get CElementChemistryClr list
             List<ShowElementInfo> list_showelementinfo = new List<ShowElementInfo>();
@@ -1692,10 +1692,10 @@ namespace OTSIncAReportGraph.Controls
 
 
                 //第二步,移动到指定位置,先读取再设置
-                if (ReportFun.ConnectToIpcSvr())
+                if (ImageDisHelper.ConnectToIpcSvr())
                 {
 
-                    ReportFun.MoveSemToPointXY(sem_point.X, sem_point.Y);
+                    ImageDisHelper.MoveSemToPointXY(sem_point.X, sem_point.Y);
 
                 }
 
@@ -2160,11 +2160,11 @@ namespace OTSIncAReportGraph.Controls
                 //"单个Field视域屏幕像素宽:" + m_OneField_Screen_BackRectf.Width.ToString() + " 高:" + m_OneField_Screen_BackRectf.Height.ToString() + Environment.NewLine +
                 //"单个OTS视域屏幕像素宽:" + m_OneField_OTS_Rect.Width.ToString() + " 高:" + m_OneField_OTS_Rect.Height.ToString() + Environment.NewLine +
                 "屏幕像素backrectf  x:" + m_backRect.X.ToString() + "  y:" + m_backRect.Y.ToString() + "  width:" + m_backRect.Width.ToString() + "  height:" + m_backRect.Height.ToString() + Environment.NewLine +
-                "包含Field数量:" + ReportFun.m_field_count.ToString() + " Particle数量:" + ReportFun.m_particle_count.ToString() + Environment.NewLine +
+                "包含Field数量:" + ImageDisHelper.m_field_count.ToString() + " Particle数量:" + ImageDisHelper.m_particle_count.ToString() + Environment.NewLine +
                 "正常显示Paticle数量:" + GetParticleNumberByState(PaintState.PAINT).ToString() + " 不显示Particel数量:" + GetParticleNumberByState(PaintState.NOPAINT).ToString() + Environment.NewLine +
                 //"删除Particle数量:" + GetParticleNumberByState("删除").ToString() + " 选中Particle数量:" + GetParticleNumberByState("选择").ToString() + Environment.NewLine +
-                "加载底层数据用时:" + ReportFun.m_time_str + Environment.NewLine +
-                "组建并计算图像用时:" + ReportFun.m_time_str2 + Environment.NewLine +
+                "加载底层数据用时:" + ImageDisHelper.m_time_str + Environment.NewLine +
+                "组建并计算图像用时:" + ImageDisHelper.m_time_str2 + Environment.NewLine +
                 "---------------------------END----------------------------------"
                 );
 #endif
@@ -2327,7 +2327,7 @@ namespace OTSIncAReportGraph.Controls
                         {
                             DisplayParticle dp = (DisplayParticle)item;
 
-                            if (ReportFun.WhetherInRange(dp, m_mouse_now_point))
+                            if (ImageDisHelper.WhetherInRange(dp, m_mouse_now_point))
                             {
                                 arguments += " " + ResultDbPath + " " + dp.FieldId + " " + dp.ParticleId + " " + dp.XRayId;
                                 break;
@@ -2350,7 +2350,7 @@ namespace OTSIncAReportGraph.Controls
                 {
                     DisplayParticle dp = (DisplayParticle)item;
 
-                    if (ReportFun.WhetherInRange(dp, m_mouse_now_point))
+                    if (ImageDisHelper.WhetherInRange(dp, m_mouse_now_point))
                     {
                         arguments += " " + ResultDbPath + " " + dp.FieldId + " " + dp.ParticleId + " " + dp.XRayId;
                         break;

+ 12 - 12
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionSortImage.cs

@@ -67,7 +67,7 @@ namespace OTSIncAReportGraph.Controls
  
 
         //底层封装类
-        OTSImageDisHelp m_ReportFun = null;
+        OTSImageDisHelp m_imgDisHelper = null;
 
         //鼠标移动经过的颗粒对象,临时存放,用来记录是否要显示xray与隐藏xray
         DisplayParticle m_mouseOver_dparticle = null;
@@ -137,11 +137,11 @@ namespace OTSIncAReportGraph.Controls
             resultFile = m_ReportApp.m_rstDataMgr.CurResultFile;
 
             //初始化数据操作类
-            m_ReportFun = m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.ReportFun;
+            m_imgDisHelper = m_ReportApp.im_Control_DrawDistrbutionImageAndBSE.ImageDisHelper;
             m_list_baseobject = new List<BaseObject>();
-            for (int i=0;i< m_ReportFun.m_original_list_baseobject.Count;i++)
+            for (int i=0;i< m_imgDisHelper.m_original_list_baseobject.Count;i++)
             {
-                m_list_baseobject.Add(m_ReportFun.m_original_list_baseobject[i]);
+                m_list_baseobject.Add(m_imgDisHelper.m_original_list_baseobject[i]);
             }
             InitializeComponent();
             #region 国际化语言
@@ -583,7 +583,7 @@ namespace OTSIncAReportGraph.Controls
                                     PointF[] lspointf = ls_gpath.PathPoints;
                                     for (int i = 0; i < lspointf.Count(); i++)
                                     {
-                                        if (true == m_ReportFun.WhetherInRange(m_SelectTool.Rect,lspointf, new Point((int)dp.Rect.X,(int)dp.Rect.Y)))
+                                        if (true == m_imgDisHelper.WhetherInRange(m_SelectTool.Rect,lspointf, new Point((int)dp.Rect.X,(int)dp.Rect.Y)))
                                         {
                                             //选择到了该路径,那么就选取该图像
                                             dp.IsSelect = true;
@@ -630,7 +630,7 @@ namespace OTSIncAReportGraph.Controls
                             {
                                 dp.GPath = dp.GetRegionFromDSegments();
                                 PointF[] lspointf = dp.GPath.PathPoints;
-                                if (true ==m_ReportFun. WhetherInRange(dp, new Point(e.X, e.Y)))
+                                if (true ==m_imgDisHelper. WhetherInRange(dp, new Point(e.X, e.Y)))
                                 {
                                     //选择到了该路径,那么就选取该图像b
                                     dp.Operator_ShowXRay = ParticleShowXray.SELECTANDDISPLAYXRAY;
@@ -671,7 +671,7 @@ namespace OTSIncAReportGraph.Controls
                 {
                     foreach (BaseObject item in ls_sortparticledistribution.List_DParticle)
                     {
-                        if (true == m_ReportFun.WhetherInRange((DisplayParticle)item, e.Location))
+                        if (true == m_imgDisHelper.WhetherInRange((DisplayParticle)item, e.Location))
                         {
 
                             DisplayParticle dp = (DisplayParticle)item;
@@ -784,7 +784,7 @@ namespace OTSIncAReportGraph.Controls
                     
                         if (dp.GetPaintState() == PaintState.PAINT)
                         {
-                            if (true == m_ReportFun.WhetherInRange(dp, e.Location))
+                            if (true == m_imgDisHelper.WhetherInRange(dp, e.Location))
                             {
 
                                 dp.IsMouseOver = true;
@@ -864,7 +864,7 @@ namespace OTSIncAReportGraph.Controls
                 foreach (BaseObject item in ls_sortparticledistribution.List_DParticle)
                 {
                     DisplayParticle dp = (DisplayParticle)item;
-                    if (true == m_ReportFun.WhetherInRange(dp, e.Location))
+                    if (true == m_imgDisHelper.WhetherInRange(dp, e.Location))
                     {
                         if (dp.GetPaintState() == PaintState.PAINT)
                         {
@@ -940,9 +940,9 @@ namespace OTSIncAReportGraph.Controls
 
 
                 //第二步,移动到指定位置,先读取再设置
-                if (m_ReportFun.ConnectToIpcSvr())
+                if (m_imgDisHelper.ConnectToIpcSvr())
                 {
-                    m_ReportFun.MoveSemToPointXY(sem_point.X, sem_point.Y);
+                    m_imgDisHelper.MoveSemToPointXY(sem_point.X, sem_point.Y);
                 }
 
                 Thread.Sleep(1500);
@@ -989,7 +989,7 @@ namespace OTSIncAReportGraph.Controls
             List<Element> list_celementchemistryclr = new List<Element>();
 
             //获取Xray数据
-            m_ReportFun.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(m_mouseOver_dparticle.ParticleId, m_mouseOver_dparticle.FieldId, out Search_xray, out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
+            m_imgDisHelper.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(m_mouseOver_dparticle.ParticleId, m_mouseOver_dparticle.FieldId, out Search_xray, out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
 
             //get CElementChemistryClr list
             List<ShowElementInfo> list_showelementinfo = new List<ShowElementInfo>();

+ 3 - 1
OTSIncAReportApp/2-CommonFunction/CommonClass/DisplayParticle.cs

@@ -284,7 +284,9 @@ namespace OTSIncAReportGraph
         /// <returns></returns>
         public override object Clone()
         {
-            return new DisplayParticle(this.m_listdsegment, this);
+            var dp= new DisplayParticle(this.m_listdsegment, this);
+            dp.m_image = this.m_image;
+            return dp;
         }
         public PointF GetCenterPoint()
         {