|
|
@@ -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
|
|
|
|