Procházet zdrojové kódy

optimize the report bseimage display method.

gsp před 2 roky
rodič
revize
69fe0c696f

+ 2 - 2
Bin/x64/Debug/Config/ProData/HardwareConfig.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <XMLData PathName="HardwareConfig.xml" ID="1">
-  <Member RegName="SemControllerName" Value="FEI" ImageInputSources="BSE" />
-  <Member RegName="EDSName" Value="FEI" />
+  <Member RegName="SemControllerName" Value="OffLine" ImageInputSources="BSE" />
+  <Member RegName="EDSName" Value="OffLine" />
   <Member RegName="BrukerDllVersion" Version="Bruker.API.Esprit2.2.dll" />
   <Member RegName="FEIIP" Value="192.168.0.1" />
   <Member RegName="FEIPORT" Value="7520" />

+ 25 - 58
OTSIncAReportApp/1-UI/Control_Graph/OTSIncAReportGraphFuncation/OTSImageDisHelp.cs

@@ -126,8 +126,8 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         {
            
                var OTSPoint=new Point(currenFldPos.X - otsleftBottomPoint.X, currenFldPos.Y - otsleftBottomPoint.Y);
-            double screenHeight = wholeImageRec.Height + (0 - (int)(Convert.ToDouble(OTSPoint.Y) / pixelSize));//because the screen coordinate is downward rightward positive,so we need to translate the Y coordinate of the OTS system which is upward rightward positive.
-            screenHeight = screenHeight - singleImgRec.Height;
+            int screenHeight =(int) wholeImageRec.Height + (0 - (int)(Convert.ToDouble(OTSPoint.Y) / pixelSize));//because the screen coordinate is downward rightward positive,so we need to translate the Y coordinate of the OTS system which is upward rightward positive.
+            screenHeight = screenHeight -(int) singleImgRec.Height;
             var screenPoint = new Point((int)(Convert.ToDouble(OTSPoint.X)/pixelSize), (int)screenHeight);
 
             return screenPoint;
@@ -144,10 +144,10 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             i_wl_height = (int)ls_r.Height;
             //-----------------------------------------------------------------------------
 
-            int point_x_min = 10000000;
-            int point_x_max = -10000000;
-            int point_y_min = 10000000;
-            int point_y_max = -10000000;
+            double point_x_min = 10000000;
+            double point_x_max = -10000000;
+            double point_y_min = 10000000;
+            double point_y_max = -10000000;
 
             for (int i = 0; i < inPoints.Count(); i++)
             {
@@ -164,25 +164,24 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             }
 
             //然后分别用最大值+abs(最小值),就是x,和y轴的总长值
-            point_x_max = point_x_max - point_x_min;
-            point_y_max = point_y_max - point_y_min;
+            double x_max = point_x_max - point_x_min+ i_wl_width;
+            double y_max = point_y_max - point_y_min+ i_wl_height;
 
-            //该算法有个问题,就是不能直观的得到整个范围的大小,要除以倍数再补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;
+            double xPixel=0;
+            double yPixel=0;
+            if (i_wl_width != 0) xPixel = (x_max / i_wl_width) * in_width;
+            if (i_wl_height != 0) yPixel = (y_max / i_wl_height) * in_height; 
 
             Rectangle ret_rectangle = new Rectangle(0, 0, 0, 0);
-            //判断一下防止出错,只有在有数据的情况下,进行赋值才行
+           
             if (inPoints.Count > 0)
             {
-                ret_rectangle = new Rectangle(0, 0, point_x_max, point_y_max);
+                ret_rectangle = new Rectangle(0, 0, (int)(xPixel), (int)(yPixel));
             }
 
-            //这样返回是物理坐标的总大小,应该返回像素坐标大小才对
+        
             return ret_rectangle;
         }
         /// <summary>
@@ -191,58 +190,26 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
         /// <returns></returns>
         public RectangleF GetPhysicalFieldWidthAndHeight(List<Point> points,int imageWidth,int imageHeight)
         {
-            int width_max = -10000000;
-            int height_max = -10000000;
-
-            int width_max2 = -10000000;
-            int height_max2 = -10000000;
-
-            //先找出最大的值,
-            for (int i = 0; i < points.Count(); i++)
-            {
-                if (width_max < points[i].X)
-                    width_max = points[i].X;
-                if (height_max < points[i].Y)
-                    height_max = points[i].Y;
-            }
+   
 
-            //再找出第二大的值
-            for (int i = 0; i < points.Count(); i++)
-            {
-                if (width_max2 < points[i].X && width_max != points[i].X)
-                    width_max2 = points[i].X;
-                if (height_max2 < points[i].Y && height_max != points[i].Y)
-                    height_max2 = points[i].Y;
-            }
-
-            //需要针对第二大的值,获取时进行判断,感觉这里应该如果并未找到第二大的值的情况下,赋于0值,便于以后进行计算
-            if (width_max2 == -10000000)
-                width_max2 = width_max;
-            if (height_max2 == -10000000)
-                height_max2 = height_max;
+        
+            RectangleF ret_rect = new RectangleF(0, 0, 0, 0);
 
-            RectangleF ret_rect = new RectangleF(0, 0, width_max - width_max2, height_max - height_max2);
+     
 
-            //如果最后计算出的宽高有0则重新到测量数据中获取---------------------------------------
-            if (ret_rect.Width == 0 || ret_rect.Height == 0)
-            {
+            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)resultFile.ResultInfo["Sample"])["Members"]);
+            Dictionary<string, object> SEMDataMsr = (Dictionary<string, object>)sampleMembers["SEMDataMsr"];
 
-                //到参数中去取单个宽
-                double d_scanFieldSize_width = Convert.ToDouble(((Dictionary<string, object>)resultFile.ResultInfo["SEMStageData"])["scanFieldSize"]);
-                //然后再用单个宽去计算出高是多少
+            string scanfeldsize = SEMDataMsr["ScanFieldSize"].ToString();
+            double d_scanFieldSize_width = Convert.ToDouble(scanfeldsize);
+              
                 double d_scanFieldSize_height = 0;
                 if (d_scanFieldSize_width != 0)
                     d_scanFieldSize_height = (d_scanFieldSize_width / Convert.ToDouble(imageWidth)) * imageHeight;
 
                 ret_rect.Width = (int)d_scanFieldSize_width;
                 ret_rect.Height = (int)d_scanFieldSize_height;
-            }
-            ///-----------because all the  fields 's height/width=0.75 so here we make an enforce. gsp add at 2019/10/31
-            ///sometimes the gbfields are not conform to this for the cuting and merging operation.
-            //if (ret_rect.Height / ret_rect.Width != 0.75f)
-            //{
-            //    ret_rect = new Rectangle(ret_rect.X, ret_rect.Y, ret_rect.Width, (int)(ret_rect.Width * 0.75f));
-            //}
+           
             return ret_rect;
         }
 

+ 3 - 3
OTSIncAReportApp/2-CommonFunction/CommonClass/DisplayField.cs

@@ -281,13 +281,13 @@ namespace OTSIncAReportGraph
                         item.OnPaint(e);
                     }
                     //获取矩形的rectangle
-                    dp.Rect = dp.GetRectFromDSegment();
+                    //dp.Rect = dp.GetRectFromDSegment();
 
                     //通过line获取路径边缘
-                    dp.GPath = dp.GetRegionFromDSegments();
+                    //dp.GPath = dp.GetRegionFromDSegments();
 
                     //重新计算小矩形边框
-                    dp.SmallRect = dp.GetSmallRectangleFromRect();
+                    //dp.SmallRect = dp.GetSmallRectangleFromRect();
 
                 }
             }