Control_DrawDistrbutionImageAndBSE.cs 93 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268
  1. using OTSIncAReportApp.DataOperation.DataAccess;
  2. using OTSIncAReportApp.DataOperation.Model;
  3. using OTSIncAReportApp.SysMgrTools;
  4. using OTSIncAReportGraph.Class;
  5. using OTSIncAReportGraph.OTSIncAReportGraphFuncation;
  6. using OTSIncAReportMailInterface;
  7. using OTSPeriodicTable;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Data;
  11. using System.Diagnostics;
  12. using System.Drawing;
  13. using System.Drawing.Drawing2D;
  14. using System.IO;
  15. using System.Linq;
  16. using System.Threading;
  17. using System.Windows.Forms;
  18. using System.Xml;
  19. namespace OTSIncAReportGraph.Controls
  20. {
  21. public partial class Control_DrawDistrbutionImageAndBSE : UserControl
  22. {
  23. //防止segment过多的数量限制,先写300吧,过少也不好,过防止过多程序而卡死
  24. private const int m_segment_overflownumber = 400;
  25. //缩放的增大缩小的增量
  26. private const float m_f_zoom_increment = 0.05f;
  27. //最大缩放倍数
  28. private const float m_f_zoom_max = 4f;
  29. //最小缩放倍数
  30. private const float m_f_zoom_mix = 0.05f;
  31. //标尺原先大小的记录,参与计算
  32. private const float m_f_old_ruler_size = 100;
  33. #region 变量定义
  34. //缩放的基数,临时变量
  35. private float m_f_widthandheight_js = 0;
  36. //与原先缩放的记录数
  37. private float m_f_zoom_record = 1;
  38. //标尺的大小记录
  39. public float m_f_ruler_size = 100;
  40. //每像素代表的尺寸大小,还不知道在哪里进行计算
  41. public float m_f_onepixel_size = 4.5f;
  42. //国际化
  43. Language lan;
  44. //国际化存储信息
  45. System.Collections.Hashtable table;
  46. //包含particle的field的列表对象
  47. public List<DField> m_list_dfield = null;
  48. //记录field列表的原值
  49. public List<DField> m_old_list_dfield = null;
  50. //这里要做成控件,不要是窗体
  51. public List<BaseObject> m_list_baseobject = null;
  52. //这里要做成控件,不要是窗体
  53. public List<BaseObject> m_list_usebject = new List<BaseObject>();
  54. //记录原值,颗粒和线段
  55. public List<BaseObject> m_original_list_baseobject = null;
  56. //记录国标区域列表对象
  57. public List<DField> m_list_GBobject = null;
  58. //record the GBField
  59. public List<DField> m_list_GBfield = null;
  60. //记录操作记录类
  61. public List<HistoryApolygon> m_list_historyapolygon = null;
  62. //操作历史类,当前操作到的id
  63. private int m_operator_currentid = 0;
  64. //总背景矩形
  65. public RectangleF m_backrectf = new RectangleF();
  66. //记录原值,总背景矩形
  67. public RectangleF m_old_backrectf = new RectangleF();
  68. //单一Field视域,屏幕像素的宽高
  69. public RectangleF m_OneField_Screen_BackRectf = new RectangleF();
  70. //单一Field视域,OTS物理像素的宽高
  71. public RectangleF m_OneField_OTS_Rectf = new RectangleF();
  72. //记录总物理矩形总大小
  73. public RectangleF m_back_wl_rectf = new RectangleF();
  74. //是否显示网格线
  75. private bool m_is_showgrid = false;
  76. //绘制的网格中,需要几条线,宽
  77. public double m_i_grid_showlinesnumber_width = 0;
  78. //绘制的网格中,需要几条线,高
  79. public double m_i_grid_showlinesnumber_height = 0;
  80. //是否使用矩形进行多选操作
  81. private bool m_is_multiselect_rectangle = false;
  82. //是否使用圆形进行多选操作
  83. private bool m_is_multiselect_ellipse = false;
  84. //是否可以进行绘制,提供给矩形多选与圆形多选使用的临时变量
  85. private bool m_is_multiselect_onpaint = false;
  86. //进行选择的矩形范围
  87. private RectangleF m_multiselect_rect = new RectangleF();
  88. //在进行拖选前鼠标记录的点
  89. private PointF m_beforemultiselect_point = new PointF();
  90. //是否拖动
  91. private bool m_isDrag = false;
  92. //拖动前的坐标记录
  93. private PointF m_beforedrag_pointf = new PointF();
  94. //提供鼠标在右下角显示的文本,左侧
  95. private string m_str_mouseshow_left = "";
  96. //提供鼠标在右下角显示的文本,右侧
  97. private string m_str_mouseshow_right = "";
  98. //整个背景矩形的背景色
  99. private Color m_backrangecolor = Color.White;
  100. //底层封装类
  101. OTSIncAReportFun m_ReportFun = null;
  102. //当前鼠标的位置
  103. Point m_mouse_now_point = new Point();
  104. //记录当前鼠标位置对应SEM电镜的位置
  105. Point m_sem_mouse_now_point = new Point();
  106. //鼠标移动经过的颗粒对象,临时存放,用来记录是否要显示xray与隐藏xray
  107. DParticle m_move_dparticle = null;
  108. //保存数据源名称
  109. private string m_showsourcename = "";
  110. //保存当前数据源的ID
  111. private int m_datasourceid = 0;
  112. //移动SEM到指定位置发生线程
  113. private Thread m_mythread;
  114. //记录线程是否已经运行完成的状态
  115. private bool m_mythread_state = false;
  116. private Color m_ColorNotContent = Color.SkyBlue;
  117. //读取背景原图的名称和图片
  118. private List<Image> originalImages = new List<Image>();
  119. private List<string> originalImageNames = new List<string>();
  120. //背景使用原图
  121. private bool OriginalBackground = false;
  122. static System.Windows.Forms.Timer delaytimer = new System.Windows.Forms.Timer();
  123. /// <summary>
  124. /// 当前正在显示的数据源名称,用来与框架调用条件判断使用
  125. /// </summary>
  126. public string ShowSourceName
  127. {
  128. set { m_showsourcename = value; }
  129. get { return m_showsourcename; }
  130. }
  131. /// <summary>
  132. /// 当前正在显示的数据源的ID
  133. /// </summary>
  134. public int DataSourceID
  135. {
  136. set { m_datasourceid = value; }
  137. get { return m_datasourceid; }
  138. }
  139. /// <summary>
  140. /// 背景矩形属性
  141. /// </summary>
  142. public RectangleF BackRectF
  143. {
  144. set { m_backrectf = value; }
  145. get { return m_backrectf; }
  146. }
  147. //测试用隐藏颗粒的id号,回头去掉
  148. public int test_hide_particle_tagid = 1000;
  149. //进度条窗体
  150. public Frm_UserProgress m_frm_userprogress;
  151. /// <summary>
  152. /// 是否显示过小颗粒
  153. /// </summary>
  154. public bool bShowSmallParticle = false;
  155. public List<Particle> SelectedParticles { set; get; }
  156. OTSIncAReportApp.frmReportApp m_ReportApp;
  157. ResultFile resultFile = null;
  158. #endregion
  159. #region 构造函数及窗体加载
  160. /// <summary>
  161. /// 分布图构造函数
  162. /// </summary>
  163. /// <param name="in_sec">传入,委托类对象</param>
  164. /// <param name="in_Cotsreportprojfilemgrclr">传入,项目管理类对象</param>
  165. public Control_DrawDistrbutionImageAndBSE(OTSIncAReportApp.frmReportApp ReportApp)
  166. {
  167. m_list_dfield = new List<DField>();
  168. m_old_list_dfield = new List<DField>();
  169. m_list_baseobject = new List<BaseObject>();
  170. m_original_list_baseobject = new List<BaseObject>();
  171. m_list_historyapolygon = new List<HistoryApolygon>();
  172. m_frm_userprogress = new Frm_UserProgress();
  173. m_mythread_state = false;
  174. m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
  175. m_ReportApp = ReportApp;
  176. resultFile = m_ReportApp.resultFilesList[m_ReportApp.WorkingResult];
  177. //初始化底层操作类
  178. m_ReportFun = new OTSIncAReportFun(resultFile);
  179. InitializeComponent();
  180. #region 国际化语言
  181. Language lan = new Language(this);
  182. table = lan.GetNameTable(this.Name);
  183. #endregion
  184. }
  185. private void Control_DrawDistrbutionImageAndBSE_Load(object sender, EventArgs e)
  186. {
  187. //var table = lan.GetNameTable("OTSIncAReportFun");
  188. //显示进度条,计算进度条应该显示的位置和宽度
  189. Form ls_main_form = this.ParentForm.ParentForm;//取出父窗体
  190. m_frm_userprogress.Width = (int)(MyPrimaryScreen.DESKTOP.Width / MyPrimaryScreen.ScaleX * 0.9);
  191. m_frm_userprogress.Location = new Point(ls_main_form.Location.X + 80, ls_main_form.Location.Y + (int)(MyPrimaryScreen.DESKTOP.Height / MyPrimaryScreen.ScaleX) / 2);
  192. m_frm_userprogress.Show();
  193. m_frm_userprogress.SetProgressValueAndText(0, table["str1"].ToString());
  194. //执行获取颗粒分布图数据,总过程函数
  195. GetDistrbutionImageAndBSE_Total();
  196. //设置双缓冲
  197. SetDoubleBufferByIsDraw();
  198. //设置标尺
  199. //根据f_onepixel_size计算出要显示出100um的实际宽度
  200. double d_onefixel_width = 100 / m_f_onepixel_size;
  201. if (d_onefixel_width == 0)
  202. {
  203. this.control_Ruler1.Visible = false;
  204. }
  205. else
  206. {
  207. //将标尺定位到合理的位置上
  208. this.control_Ruler1.Location = new Point(10, MyPrimaryScreen.WorkingArea.Height - 300);
  209. this.control_Ruler1.Visible = true;
  210. this.control_Ruler1.SetValue(m_f_ruler_size, m_f_onepixel_size);
  211. }
  212. //记录原值,用于缩放计算操作 ,此处要用克隆 ,原particle颗粒的值,在底层调用时已经赋值过了
  213. foreach (DParticle ls_dp in m_list_baseobject)
  214. {
  215. ls_dp.Operator = ParticleOperator.DISPLAY;
  216. DParticle old_dp = ls_dp.Clone() as DParticle;
  217. m_original_list_baseobject.Add(old_dp);
  218. }
  219. //加载时将背景rect设置与整个窗体一边大小
  220. m_old_backrectf = m_backrectf;
  221. //赋值给old保存原值
  222. for (int i = 0; i < m_list_dfield.Count; i++)
  223. {
  224. DField df = new DField();
  225. df.Show_Rect = new RectangleF(m_list_dfield[i].Show_Rect.X,
  226. m_list_dfield[i].Show_Rect.Y,
  227. m_list_dfield[i].Show_Rect.Width,
  228. m_list_dfield[i].Show_Rect.Height);
  229. m_old_list_dfield.Add(df);
  230. }
  231. ResetPicturePosition();
  232. //进入时首先对XRayTable进行隐藏
  233. control_XRayTable1.Visible = false;
  234. m_frm_userprogress.SetProgressValueAndText(100, table["str2"].ToString());
  235. //加载完成,关闭进度条
  236. m_frm_userprogress.Close();
  237. }
  238. /// <summary>
  239. /// 获取组整个获取分布图和排序图图像数据的底层数据组建方式,的总过程
  240. /// </summary>
  241. public void GetDistrbutionImageAndBSE_Total()
  242. {
  243. string str27 = "begin to loading data....";
  244. //str27 = table["str27"].ToString();
  245. m_frm_userprogress.SetProgressValueAndText(1, str27);
  246. //对底层加载速度进行计时
  247. Stopwatch stopwatch = new Stopwatch();
  248. stopwatch.Start();
  249. string path = resultFile.FilePath;
  250. FieldData fieldData = new FieldData(path);
  251. List<Field> fieldlist = fieldData.GetFieldList();
  252. //防止有时底层返回的Field的List是0,直接返回
  253. if (fieldlist.Count == 0)
  254. {
  255. string str28 = "field number =0 !....";
  256. //str28 = table["str28"].ToString();
  257. m_frm_userprogress.SetProgressValueAndText(100, str28);
  258. return;
  259. }
  260. //底层加载field对象结束
  261. stopwatch.Stop();
  262. TimeSpan timespan = stopwatch.Elapsed;
  263. //重置计数器,对组建和计算图像进行计时
  264. stopwatch.Reset();
  265. stopwatch.Start();
  266. string str29 = "begin to composit field picture....";
  267. //str29 = table["str29"].ToString();
  268. m_frm_userprogress.SetProgressValueAndText(15, str29);
  269. //将field的list对象给全局变量中,供后面获取xray使用,不需要再次重新加载数据,以提升速度
  270. m_ReportFun.m_list_OTSField = fieldlist;
  271. //第一次循环,用来计算单个Field的像素分辨率,和将所有的物理位置存放到List当中
  272. List<Point> list_point = new List<Point>();
  273. int i_field_width = 0, i_field_height = 0;
  274. //获取到该field的分辨率大小,循环中都是一样的
  275. if (fieldlist.Count > 0)
  276. {
  277. Bitmap bitmp = DrawFunction.ReadImageFile(fieldlist[0].FieldImage);
  278. i_field_width = bitmp.Width;
  279. i_field_height = bitmp.Height;
  280. }
  281. for (int i = 0; i < fieldlist.Count(); i++)
  282. {
  283. //然后取出物理坐标,这个一会要与分辨率坐标进行变算一下
  284. Point ls_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };
  285. list_point.Add(ls_point);
  286. }
  287. //对单个视域的屏幕像素宽高,进行记录
  288. m_OneField_Screen_BackRectf = new RectangleF(0, 0, i_field_width, i_field_height);
  289. //获取单个OTS视域像素宽高,并进行记录
  290. Rectangle OTS_FieldRect = m_ReportFun. GetOneFieldWidthAndHeight(list_point);
  291. m_OneField_OTS_Rectf = OTS_FieldRect;
  292. //计算出整个绘制图像总Rectagnle的大小
  293. m_backrectf = m_ReportFun. ConvertAndGetMaxRect(list_point, i_field_width, i_field_height);
  294. string str30 = "calculate ruler....";
  295. //str30 = table["str30"].ToString();
  296. //更新进度条提示
  297. m_frm_userprogress.SetProgressValueAndText(18, str30);
  298. #region //标尺相关------------------------------------------------------------------------------
  299. //在此处通过上面的i_field_width,ifield_height和list_point,来计算出个像素与实际物理值的比例
  300. Rectangle ls_jsblrect = m_ReportFun.GetOneFieldWidthAndHeight(list_point);
  301. //然后用宽度来除以i_field_width 获取单个的像素比例
  302. double d_onepixel_scale = Convert.ToDouble(ls_jsblrect.Width) / Convert.ToDouble(i_field_width);
  303. //再用该比例对标尺进行相应的赋值
  304. m_f_onepixel_size = (float)d_onepixel_scale;
  305. //对整个物理像素的范围进行获取与设置
  306. Rectangle ls_offsetandtopleftrect = m_ReportFun.GetWlRectTopLeftAndRect(list_point, ls_jsblrect.Width, ls_jsblrect.Height);
  307. m_back_wl_rectf = new RectangleF(ls_offsetandtopleftrect.X, ls_offsetandtopleftrect.Y
  308. , ls_offsetandtopleftrect.Width, ls_offsetandtopleftrect.Height);
  309. #endregion //---------------------------------------------------------------------------------------
  310. string str31 = "composit whole picture....";
  311. //str31 = table["str31"].ToString();
  312. //更新进度条提示
  313. m_frm_userprogress.SetProgressValueAndText(20, str31);
  314. //70的进度条给到下面的循环中,计算进度条各分类进度分配
  315. float ls_int_progresscalc = 0;
  316. if (fieldlist.Count > 0)
  317. ls_int_progresscalc = (float)70 / (float)fieldlist.Count;
  318. string str32 = "finished:";
  319. //str32 = table["str32"].ToString();
  320. string str33 = "total:";
  321. //str33 = table["str33"].ToString();
  322. string str34 = "field...";
  323. //str34 = table["str34"].ToString();
  324. //再通过Field取到对应的Particle,循环一次
  325. for (int i = 0; i < fieldlist.Count(); i++)
  326. {
  327. //更新进度条提示
  328. m_frm_userprogress.SetProgressValueAndText(20 + (int)(ls_int_progresscalc * (i + 1)), str32 + i.ToString() + str33 + m_ReportFun.m_list_OTSField.Count.ToString() + str34);
  329. //先获取该Field中的所有Particle
  330. List<Particle> list_particle = new List<Particle>();
  331. list_particle = fieldlist[i].ParticleList;
  332. //取出该Field的物理坐标,将其转换成对应的屏幕像素坐标,屏幕左上角为原点(0,0)的偏移值,用于后面计算各Segment的位置使用
  333. //应该也就是这里根据OTS坐标转换到屏幕像素坐标,Y轴是反的,所以在这里对从OTS坐标转换成屏幕坐标的地方进行反转!
  334. Point thisfield_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };
  335. Point offset_point = m_ReportFun.GetFieldPhysicsConvertToScreen(list_point, i_field_width, i_field_height, thisfield_point);
  336. //保存该Field最终在屏幕上显示的位置及大小
  337. DField df = new DField();
  338. df.FieldID = fieldlist[i].FieldID.ToString();
  339. df.Show_Rect = new Rectangle(offset_point, new Size(i_field_width, i_field_height));
  340. df.Current_Rect = new Rectangle(offset_point, new Size(i_field_width, i_field_height));
  341. df.OTS_RECT = new RectangleF(thisfield_point.X, thisfield_point.Y, OTS_FieldRect.Width, OTS_FieldRect.Height);
  342. m_list_dfield.Add(df);
  343. //然后将取出的数据,转换成Bitmap对象
  344. Bitmap ls_bt = DrawFunction.ReadImageFile(fieldlist[i].FieldImage);
  345. //再循环计算所有的Particle对象
  346. foreach (Particle particle in list_particle)
  347. {
  348. //从Clr中获取所有的Segment的List对象
  349. List<Feature> list_feature = new List<Feature>();
  350. list_feature = particle.FeatureList;
  351. //创建颗粒分布图对应的类对象
  352. List<DSegment> list_dsegment = new List<DSegment>();
  353. //创建DParticle颗粒,保存与之对应的颗粒tagid和particleid,为了后面取xray数据及多选时获取多选cotsparticleclr列表
  354. DParticle dp = new DParticle();
  355. dp.CLRTagID = particle.ParticleId;
  356. dp.CLRFieldID = particle.FieldId;
  357. dp.STDTypeID = particle.TypeId;
  358. dp.TypeId = particle.TypeId;
  359. dp.TypeName = particle.TypeName;
  360. dp.XRayId = particle.XrayId;
  361. dp.SEMPosX = particle.SEMPosX;
  362. dp.SEMPosY = particle.SEMPosY;
  363. //获取该颗粒在STD标准库中已分析出化合物对应的颜色
  364. dp.Color = m_ReportFun.GetColorBySTDTypeIDForBSEAndSorImage(particle.TypeColor, particle.TypeId);
  365. //防止超大颗粒,会让程序死掉
  366. if (list_feature.Count < m_segment_overflownumber)
  367. {
  368. //再循环取出里面所有的segment
  369. foreach (Feature feature in list_feature)
  370. {
  371. #region 创建DSegment对象,并将STD分析出的化合物颜色保存到DSegment对象中
  372. //对Particle里的Segment进行偏移的计算等,创建了DSegment的大小
  373. DSegment ds = new DSegment();
  374. ds.Rect = new Rectangle(feature.Start + offset_point.X,
  375. //i_field_height - ls_cotssegmentclr.GetHeight() + offset_point.Y,//这是让单个Field的图像按Y轴反过来
  376. feature.Height + offset_point.Y,
  377. feature.Length,
  378. 1);
  379. ds.Color = dp.Color;//将线的颜色对应到颗粒的颜色
  380. #endregion
  381. #region //这里是在Field中,抠取出原BSE图像到DSegment中--------------------------------
  382. //ls_bt.RotateFlip(RotateFlipType.Rotate180FlipX);//使用系统带的图像处理方法,进行Y轴的翻转,与上面记录位置对应
  383. //合成图像完成,开始抠取像素-----------------------------------------------------------------
  384. int f_length = feature.Length;
  385. List<Color> ls_list_colors = new List<Color>();
  386. for (int m = 0; m < f_length; m++)
  387. {
  388. //这里实现一下代码保护
  389. int lsjs_x = feature.Start + m;
  390. //int lsjs_y = i_field_height - ls_cotssegmentclr.GetHeight();//这个反转要与上面对应
  391. int lsjs_y = feature.Height;
  392. if (lsjs_x < 0)
  393. lsjs_x = 0;
  394. if (lsjs_x >= i_field_width)
  395. lsjs_x = i_field_width - 1;
  396. if (lsjs_y < 0)
  397. lsjs_y = 0;
  398. if (lsjs_y >= i_field_height)
  399. lsjs_y = i_field_height - 1;
  400. //按理说这里应该加上个横向抠取像素颜色,这里需要再处理一下
  401. ls_list_colors.Add(ls_bt.GetPixel(lsjs_x,
  402. lsjs_y));
  403. }
  404. //保存原BSE图中的颜色列表
  405. ds.List_Colors = ls_list_colors;
  406. #endregion //------------------------------------------------------------------------------
  407. list_dsegment.Add(ds);
  408. //ls_bt.Dispose();
  409. }
  410. }
  411. //设置Particle在0.5F倍数以上时才进行显示
  412. dp.Zoom_DisPlayMultiplier = 0.5f;
  413. dp.Zoom_DisPlay = true;
  414. dp.Operator = ParticleOperator.DISPLAY;
  415. //将segment对应的设置到particle中
  416. dp.DSegments = list_dsegment;
  417. //并对DParticle相关信息进行计算
  418. dp.Rect = dp.GetRectFromDSegment();
  419. dp.GPath = dp.GetRegionFromDSegments();
  420. dp.SmallRect = dp.GetSmallRectangleFromRect();
  421. //将每个颗粒添加到颗粒分布图中的列表中
  422. m_list_baseobject.Add(dp);
  423. if (dp.XRayId > -1)
  424. {
  425. m_list_usebject.Add(dp);
  426. }
  427. }
  428. }
  429. string str35 = "convert solution...";
  430. //str35 = table["str35"].ToString();
  431. //更新进度条相关显示
  432. m_frm_userprogress.SetProgressValueAndText(90, str35);
  433. //然后这里还需要计算出,各field的宽和高,帧图边框分别需要显示多少个框
  434. if (i_field_width != 0 && i_field_height != 0)
  435. {
  436. m_i_grid_showlinesnumber_width = Convert.ToInt32(BackRectF.Width / i_field_width);
  437. m_i_grid_showlinesnumber_height = Convert.ToInt32(BackRectF.Height / i_field_height);
  438. }
  439. string str36 = "other work...";
  440. //str36 = table["str36"].ToString();
  441. //结束组建计算图像计数
  442. stopwatch.Stop();
  443. TimeSpan timespan2 = stopwatch.Elapsed;
  444. m_frm_userprogress.SetProgressValueAndText(95, str36);
  445. string str37 = "minute: ";
  446. //str37 = table["str37"].ToString();
  447. string str38 = "second total(";
  448. //str38 = table["str38"].ToString();
  449. string str39 = ")ms";
  450. //str39 = table["str39"].ToString();
  451. //相关计数
  452. m_ReportFun.m_field_count = fieldlist.Count;
  453. m_ReportFun.m_particle_count = m_list_baseobject.Count;
  454. m_ReportFun.m_time_str = timespan.TotalMinutes.ToString("0.00") + str37 + timespan.TotalSeconds.ToString("0.00") + str38 + timespan.TotalMilliseconds.ToString() + str39;
  455. m_ReportFun.m_time_str2 = timespan2.TotalMinutes.ToString("0.00") + str37 + timespan2.TotalSeconds.ToString("0.00") + str38 + timespan2.TotalMilliseconds.ToString() + str39;
  456. }
  457. /// <summary>
  458. /// 根据颗粒排序图获取已经选择上的颗粒,返回被选择上的颗粒的列表
  459. /// </summary>
  460. /// <returns></returns>
  461. public List<Particle> GetSelectedParticleList_ForDrawDistrbutionImageAndBSE()
  462. {
  463. List<Particle> ls_list_cotsparticleclr = new List<Particle>();
  464. //防止为空校验判断
  465. if (m_ReportFun.m_list_OTSField == null)
  466. return ls_list_cotsparticleclr;
  467. //先取出,所有被选择的dparticle列表的
  468. List<DParticle> ls_list_dp = new List<DParticle>();
  469. foreach (DParticle ls_dp in m_list_baseobject)
  470. {
  471. if (ls_dp.Operator == ParticleOperator.SELECTED)
  472. {
  473. ls_list_dp.Add(ls_dp);
  474. }
  475. }
  476. //并开始查找包含tagid和fieldid的cotsparticle的对象,保存到list当中
  477. for (int i = 0; i < ls_list_dp.Count(); i++)
  478. {
  479. for (int j = 0; j < m_ReportFun.m_list_OTSField.Count(); j++)
  480. {
  481. //先获取该field中的所有particle
  482. List<Particle> list_cotsparticleclr = new List<Particle>();
  483. list_cotsparticleclr = m_ReportFun.m_list_OTSField[j].ParticleList;
  484. for (int k = 0; k < list_cotsparticleclr.Count(); k++)
  485. {
  486. if (list_cotsparticleclr[k].ParticleId == ls_list_dp[i].CLRTagID
  487. && list_cotsparticleclr[k].FieldId == ls_list_dp[i].CLRFieldID)
  488. {
  489. ls_list_cotsparticleclr.Add(list_cotsparticleclr[k]);
  490. }
  491. }
  492. }
  493. }
  494. return ls_list_cotsparticleclr;
  495. }
  496. /// <summary>
  497. /// 分布图和BSE图中,从底层获取相关结果后,重新组织显示
  498. /// </summary>
  499. /// <param name="ls_cgriddataclr"></param>
  500. public void DrawBSEDistributionImageByQuery(OTSIncAReportApp.OTSSampleReportInfo.OTSSampleMeaInfo sourceGridData)
  501. {
  502. var display = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 7);
  503. string display_type = display.itemVal.ToString();
  504. int disindex = display.comboDownList.IndexOf(display_type);
  505. var list = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 10);
  506. string size = list.itemVal.ToString();
  507. int index = list.comboDownList.IndexOf(size);
  508. string size_cal_method_type = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 13).itemVal.ToString();
  509. string con = "";
  510. switch (size_cal_method_type)
  511. {
  512. case "DMAX":
  513. con = "DMAX";
  514. break;
  515. case "DMIN":
  516. con = "DMIN";
  517. break;
  518. case "Area":
  519. con = "Area";
  520. break;
  521. case "FERET":
  522. con = "DFERET";
  523. break;
  524. }
  525. string min = "0";
  526. string max = "999";
  527. if (index != 0)
  528. {
  529. max = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 12).itemVal.ToString();
  530. min = sourceGridData.SampleDataList.Find(s => Convert.ToInt32(s.iItemId) == 11).itemVal.ToString();
  531. if (max.ToLower() == "max")
  532. {
  533. max = "999";
  534. }
  535. }
  536. //string path = resultFile.FilePath;
  537. //ParticleData particleData = new ParticleData(path);
  538. //List<Particle> particles = particleData.GetParticleListByCon(con, max, min, disinde);
  539. foreach (DParticle ls_dp in m_list_baseobject)
  540. {
  541. //int dis = 0;
  542. //foreach (Particle particle in particles)
  543. //{
  544. // //找到对应的颗粒,将分类设置进去
  545. // if (ls_dp.CLRTagID == particle.ParticleId && ls_dp.CLRFieldID == particle.FieldId)
  546. // {
  547. // ls_dp.ParticleFL = particle.TypeName;
  548. // ls_dp.Operator = ParticleOperator.DISPLAY;
  549. // dis = 1;
  550. // break;
  551. // }
  552. //}
  553. //if (dis == 0)
  554. //{
  555. // ls_dp.Operator = ParticleOperator.NODISPLAY;
  556. //}
  557. ls_dp.Operator = ParticleOperator.DISPLAY;
  558. }
  559. }
  560. #endregion
  561. #region 设置双缓冲
  562. /// <summary>
  563. /// 设置双缓冲
  564. /// </summary>
  565. public void SetDoubleBufferByIsDraw()
  566. {
  567. SetStyle(ControlStyles.UserPaint, true); //没什么效果,开与关
  568. SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景,关了闪
  569. this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); // 双缓冲,关了闪
  570. //上面是必须有的
  571. SetStyle(ControlStyles.UserMouse, true); //执行自己的鼠标行为,这个打开后,在win7下鼠标操作明显改善
  572. }
  573. #endregion
  574. #region 绘制函数
  575. protected override void OnPaint(PaintEventArgs e)//处理重绘情况
  576. {
  577. if (OriginalBackground)
  578. {
  579. GetPic(e);
  580. }
  581. else
  582. {
  583. #region //填充个背景色矩形-----------------------------------------------
  584. SolidBrush b = new SolidBrush(m_backrangecolor);
  585. e.Graphics.FillRectangle(b, m_backrectf);
  586. #endregion
  587. }
  588. #region //计算并进行绘制部份------------------------------------
  589. //绘制完缩放的图形后,将基数变回,否则会一直刷新无限变大变小
  590. if (m_f_widthandheight_js != 0)
  591. {
  592. //缩放完成,重新计算颗粒的矩形,和边缘路径,这里应该写成,判断 如果有进行了缩放的操作后,再进行重新的计算
  593. foreach (BaseObject item in m_list_baseobject)
  594. {
  595. DParticle dp = (DParticle)item;
  596. //获取矩形的rectangle
  597. dp.Rect = dp.GetRectFromDSegment();
  598. //通过line获取路径边缘
  599. dp.GPath = dp.GetRegionFromDSegments();
  600. //重新计算小矩形边框
  601. dp.SmallRect = dp.GetSmallRectangleFromRect();
  602. }
  603. m_f_widthandheight_js = 0;
  604. }
  605. //开始向下传递并进行绘制
  606. foreach (BaseObject item in m_list_baseobject)
  607. {
  608. DParticle dp = (DParticle)item;
  609. if (dp.Operator != ParticleOperator.DELETED)
  610. {
  611. if (dp.Operator == ParticleOperator.DISPLAY)
  612. {
  613. item.OnPaint(e);
  614. }
  615. }
  616. }
  617. #endregion
  618. #region //判断是否使用了矩形或圆形工具进行多选,是的话,那么这里就开始绘制------------------------
  619. if (true == m_is_multiselect_onpaint)
  620. {
  621. if (true == m_is_multiselect_rectangle && m_multiselect_rect.Width > 0 && m_multiselect_rect.Height > 0)
  622. {
  623. Graphics g = e.Graphics;
  624. //绘制矩形
  625. g.DrawRectangle(new Pen(Color.Blue), m_multiselect_rect.X, m_multiselect_rect.Y, m_multiselect_rect.Width, m_multiselect_rect.Height);
  626. //半透明画刷
  627. SolidBrush brush = new SolidBrush(Color.FromArgb(50, m_ColorNotContent));
  628. //填充选择矩形
  629. g.FillRectangle(brush, m_multiselect_rect.X, m_multiselect_rect.Y, m_multiselect_rect.Width, m_multiselect_rect.Height);
  630. }
  631. if (true == m_is_multiselect_ellipse && m_multiselect_rect.Width > 0 && m_multiselect_rect.Height > 0)
  632. {
  633. Graphics g = e.Graphics;
  634. //绘制圆形
  635. g.DrawEllipse(new Pen(Color.Blue), m_multiselect_rect.X, m_multiselect_rect.Y, m_multiselect_rect.Width, m_multiselect_rect.Height);
  636. //半透明画刷
  637. SolidBrush brush = new SolidBrush(Color.FromArgb(50, m_ColorNotContent));
  638. //填充选择圆形
  639. g.FillEllipse(brush, m_multiselect_rect.X, m_multiselect_rect.Y, m_multiselect_rect.Width, m_multiselect_rect.Height);
  640. }
  641. }
  642. #endregion
  643. #region 绘制网格线,帧图边框部份
  644. if (true == m_is_showgrid)
  645. {
  646. RectangleF ls_rect_gridline = Rectangle.Round(new RectangleF(m_backrectf.X,
  647. m_backrectf.Y,
  648. m_backrectf.Width,
  649. m_backrectf.Height));
  650. //共绘制外边框,和里面横竖,各4个线
  651. ControlPaint.DrawBorder(e.Graphics,
  652. Rectangle.Ceiling(ls_rect_gridline),
  653. Color.BurlyWood,
  654. 1,
  655. ButtonBorderStyle.Solid,
  656. Color.BurlyWood,
  657. 1,
  658. ButtonBorderStyle.Solid,
  659. Color.BurlyWood,
  660. 1,
  661. ButtonBorderStyle.Solid,
  662. Color.BurlyWood,
  663. 1,
  664. ButtonBorderStyle.Solid);
  665. //然后再把rectangle,横竖分成4块,画上4条横竖线
  666. //画横线
  667. for (int i = 1; i < m_i_grid_showlinesnumber_height; i++)
  668. {
  669. double y_zl = ls_rect_gridline.Height / m_i_grid_showlinesnumber_height;
  670. e.Graphics.DrawLine(new Pen(Color.BurlyWood),
  671. ls_rect_gridline.X,
  672. Convert.ToInt64(ls_rect_gridline.Y + y_zl * i),
  673. ls_rect_gridline.X + ls_rect_gridline.Width,
  674. Convert.ToInt64(ls_rect_gridline.Y + y_zl * i));
  675. }
  676. //画竖线
  677. for (int i = 1; i < m_i_grid_showlinesnumber_width; i++)
  678. {
  679. double x_zl = ls_rect_gridline.Width / m_i_grid_showlinesnumber_width;
  680. e.Graphics.DrawLine(new Pen(Color.BurlyWood),
  681. Convert.ToInt64(ls_rect_gridline.X + x_zl * i),
  682. ls_rect_gridline.Y,
  683. Convert.ToInt64(ls_rect_gridline.X + x_zl * i),
  684. ls_rect_gridline.Y + ls_rect_gridline.Height);
  685. }
  686. }
  687. #endregion
  688. #region 绘制鼠标跟踪线部份
  689. //XX虚线-----------------------------------------------
  690. Pen xxpen = new Pen(Color.GreenYellow, 1);
  691. xxpen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
  692. xxpen.DashPattern = new float[] { 5, 5 };
  693. //竖线
  694. e.Graphics.DrawLine(xxpen, 0, m_mouse_now_point.Y, m_mouse_now_point.X - 10, m_mouse_now_point.Y);
  695. e.Graphics.DrawLine(xxpen, m_mouse_now_point.X + 10, m_mouse_now_point.Y, this.Width, m_mouse_now_point.Y);
  696. //横线
  697. e.Graphics.DrawLine(xxpen, m_mouse_now_point.X, 0, m_mouse_now_point.X, m_mouse_now_point.Y - 10);
  698. e.Graphics.DrawLine(xxpen, m_mouse_now_point.X, m_mouse_now_point.Y + 10, m_mouse_now_point.X, this.Height);
  699. ////--------------------------------------------------------------------------------
  700. #endregion
  701. }
  702. #endregion
  703. #region 鼠标操作事件
  704. /// <summary>
  705. /// 按指定的增量刻度对整个图像进行缩放,x,y为手动缩放时当前鼠标所在的位置,如果在其它地方调用则传入0在计算过程中,不会影响
  706. /// </summary>
  707. /// <param name="in_f_zoom_increment"></param>
  708. private void ImageZoomByIncrement(float in_f_zoom_increment, float in_mouse_x, float in_mouse_y)
  709. {
  710. //先计算鼠标的位置与背景rect的位置的差值
  711. //用于存储锚点缩放记录原backrectf值的,一用来于计算差值
  712. float ls_oldwidth = m_backrectf.Width;
  713. float ls_oldheight = m_backrectf.Height;
  714. //看来只有带有浮点数,损失造成的误差才会最小
  715. m_backrectf.Width = (float)(m_backrectf.Width + Convert.ToDouble(m_old_backrectf.Width * in_f_zoom_increment));
  716. m_backrectf.Height = (float)(m_backrectf.Height + Convert.ToDouble(m_old_backrectf.Height * in_f_zoom_increment));
  717. //锚点缩放补差值计算,得出差值
  718. float f_czx = (in_mouse_x - m_backrectf.X) * ((ls_oldwidth - m_backrectf.Width) / ls_oldwidth);
  719. float f_czy = (in_mouse_y - m_backrectf.Y) * ((ls_oldheight - m_backrectf.Height) / ls_oldheight);
  720. //对背景矩形与所有的segment进行修补差值
  721. m_backrectf.X = m_backrectf.X + f_czx;
  722. m_backrectf.Y = m_backrectf.Y + f_czy;
  723. for (int i = 0; i < m_list_baseobject.Count(); i++)
  724. {
  725. DParticle dp = (DParticle)m_list_baseobject[i];
  726. dp.Operator = ParticleOperator.DISPLAY;
  727. for (int y = 0; y < dp.DSegments.Count(); y++)
  728. {
  729. //这里重新设置每条线的高度,和x,y坐标
  730. DSegment ds = dp.DSegments[y];
  731. DSegment old_ds = ((DParticle)m_original_list_baseobject[i]).DSegments[y];
  732. ds.PenWidthAndHeight = ds.PenWidthAndHeight + old_ds.PenWidthAndHeight
  733. * in_f_zoom_increment;
  734. 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,
  735. ds.Rect.Width + old_ds.Rect.Width * in_f_zoom_increment, ds.Rect.Height + old_ds.Rect.Height * in_f_zoom_increment);
  736. }
  737. if (dp.Rect.Left < -120 || dp.Rect.Right > this.Width+120 || dp.Rect.Top < -120 || dp.Rect.Bottom > this.Height+120)
  738. {
  739. dp.Operator = ParticleOperator.NODISPLAY;
  740. }
  741. //设置缩放到多少倍时进行显示
  742. if (dp.Zoom_DisPlayMultiplier <= m_f_zoom_record)
  743. {
  744. dp.Zoom_DisPlay = true;
  745. }
  746. else
  747. {
  748. dp.Zoom_DisPlay = false;
  749. }
  750. }
  751. if (m_list_dfield != null)
  752. {
  753. if (m_list_dfield.Count > 0)
  754. {
  755. for (int i = 0; i < m_list_dfield.Count; i++)
  756. {
  757. DField gbField = m_list_dfield[i];
  758. gbField.Current_Rect = new RectangleF(gbField.Current_Rect.X + gbField.Show_Rect.X * in_f_zoom_increment + f_czx,
  759. gbField.Current_Rect.Y + gbField.Show_Rect.Y * in_f_zoom_increment + f_czy,
  760. gbField.Current_Rect.Width + gbField.Show_Rect.Width * in_f_zoom_increment,
  761. gbField.Current_Rect.Height + gbField.Show_Rect.Height * in_f_zoom_increment);
  762. }
  763. }
  764. }
  765. if (m_list_GBobject != null)
  766. {
  767. if (m_list_GBobject.Count > 0)
  768. {
  769. foreach (var gbItem in m_list_GBobject)
  770. {
  771. PointF gbRectPoint = new PointF(gbItem.Current_Rect.X + gbItem.Show_Rect.X * in_f_zoom_increment + f_czx, gbItem.Current_Rect.Y + gbItem.Show_Rect.Y * in_f_zoom_increment + f_czy);
  772. SizeF gbSizeF = new SizeF(gbItem.Current_Rect.Width + gbItem.Show_Rect.Width * in_f_zoom_increment, gbItem.Current_Rect.Height + gbItem.Show_Rect.Height * in_f_zoom_increment);
  773. RectangleF gbRectF = new RectangleF(gbRectPoint, gbSizeF);
  774. gbItem.Current_Rect = gbRectF;
  775. }
  776. }
  777. }
  778. #region 计算标尺尺寸部份-----放大------
  779. //计算标尺实际占用像素的宽度
  780. m_f_ruler_size = m_f_ruler_size + Convert.ToInt32(m_f_old_ruler_size * in_f_zoom_increment);
  781. control_Ruler1.SetValue(m_f_ruler_size, m_f_onepixel_size);
  782. #endregion
  783. }
  784. protected override void OnMouseWheel(MouseEventArgs e)
  785. {
  786. if (e.Delta > 0)
  787. {
  788. if (m_f_zoom_record < m_f_zoom_max)
  789. {
  790. //图形缩放计算部份-------放大------------//是放大 一个刻度
  791. m_f_widthandheight_js = m_f_zoom_increment;
  792. }
  793. else return;
  794. }
  795. else
  796. {
  797. if (m_f_zoom_record > m_f_zoom_mix)
  798. {
  799. //图形缩放计算部份------缩小--------------//是缩小 一个刻度
  800. m_f_widthandheight_js = -m_f_zoom_increment;
  801. }
  802. else return;
  803. }
  804. //这里对缩放的总记录进行校验
  805. if (m_f_zoom_record > m_f_zoom_max)
  806. {
  807. m_f_zoom_record = m_f_zoom_max;
  808. }
  809. if (m_f_zoom_record < m_f_zoom_mix)
  810. {
  811. m_f_zoom_record = m_f_zoom_mix;
  812. }
  813. //如果在最小最大范围内,要对小位进行校验,如果小数位数大于2了,说明有可能是因为进行了全图匹配等操作出现的,
  814. //缩放时这里再重新校正为小数2位,并且与缩放刻度成完整的倍数无小数
  815. if (GetDecimalDigits(m_f_zoom_record) > 2)
  816. {
  817. //进入到这里,就应该已经说明是刚刚做了全图或宽度匹配的操作,
  818. //应该找出与下一个发生的刻度增长工作,找到与下一个刻度的差值
  819. //1,截取小数,后6位
  820. int i_length_f_zoom_record = GetDecimalDigits(m_f_zoom_record);
  821. float ls_cz_f = float.Parse("0.0" + m_f_zoom_record.ToString().Substring(m_f_zoom_record.ToString().IndexOf('.') + 2, i_length_f_zoom_record - 1));
  822. //2,判断是缩还是放
  823. if (m_f_widthandheight_js > 0)
  824. {
  825. //增长,这里还有问题
  826. m_f_widthandheight_js = m_f_widthandheight_js - ls_cz_f;//补充一个刻度,先不补,看看上面的算法是否不需要这个
  827. }
  828. else
  829. {
  830. //减小
  831. m_f_widthandheight_js = m_f_widthandheight_js - ls_cz_f;
  832. }
  833. //防止操作值过大,超过一刻度,容易出错---------将差值的刻度控制在0.05内--------------------------------------
  834. if (m_f_widthandheight_js > 0)
  835. {
  836. if (m_f_widthandheight_js > m_f_zoom_increment)
  837. m_f_widthandheight_js = m_f_widthandheight_js - m_f_zoom_increment;
  838. if (m_f_widthandheight_js > m_f_zoom_increment)
  839. m_f_widthandheight_js = m_f_widthandheight_js - m_f_zoom_increment;
  840. }
  841. else
  842. {
  843. if (m_f_widthandheight_js < -m_f_zoom_increment)
  844. m_f_widthandheight_js = m_f_widthandheight_js + m_f_zoom_increment;
  845. if (m_f_widthandheight_js < -m_f_zoom_increment)
  846. m_f_widthandheight_js = m_f_widthandheight_js + m_f_zoom_increment;
  847. }
  848. //补差的目的就是为了后面取0.00取整时,将小数损失降低到最低----------------------------
  849. }
  850. m_f_zoom_record = m_f_zoom_record + m_f_widthandheight_js;
  851. m_f_zoom_record = float.Parse(m_f_zoom_record.ToString("#0.00")); //四舍五入,保留2位小数,如果不这样,float会不附合规则
  852. //传入增减缩放的刻度,进行缩放
  853. ImageZoomByIncrement(m_f_widthandheight_js, e.X, e.Y);
  854. Invalidate();
  855. }
  856. protected override void OnMouseDown(MouseEventArgs e)
  857. {
  858. if (e.Button == MouseButtons.Left)
  859. {
  860. this.Cursor = Cursors.Hand;
  861. //是否可以按矩形进行选取,如果选择了矩形或圆形多选后
  862. if (true == m_is_multiselect_rectangle || true == m_is_multiselect_ellipse)
  863. {
  864. m_multiselect_rect.Width = 0;
  865. m_multiselect_rect.Height = 0;
  866. m_is_multiselect_onpaint = true;
  867. m_beforemultiselect_point = e.Location;
  868. }
  869. //在进行多选时,不让其拖动
  870. if (false == m_is_multiselect_onpaint)
  871. {
  872. //Drag_MouseDownFucntion(list_baseobject, e);
  873. foreach (BaseObject item in m_list_baseobject)
  874. {
  875. item.IsDragging = true;
  876. item.DraggingPoint = e.Location;
  877. m_isDrag = true;
  878. m_beforedrag_pointf = e.Location;
  879. }
  880. foreach (DField item in m_list_dfield)
  881. {
  882. item.IsDragging = true;
  883. item.DraggingPoint = e.Location;
  884. }
  885. if (m_list_GBobject != null)
  886. {
  887. if (m_list_GBobject.Count > 0)
  888. {
  889. foreach (BaseObject item in m_list_GBobject)
  890. {
  891. item.IsDragging = true;
  892. item.DraggingPoint = e.Location;
  893. }
  894. }
  895. }
  896. }
  897. }
  898. Invalidate();
  899. }
  900. protected override void OnMouseMove(MouseEventArgs e)
  901. {
  902. //当前鼠标的位置,用来绘制鼠标线用
  903. m_mouse_now_point = e.Location;
  904. //如果是进行多选的话
  905. if (true == m_is_multiselect_onpaint)
  906. {
  907. if (e.Location.X > m_beforemultiselect_point.X && e.Location.Y > m_beforemultiselect_point.Y)
  908. {
  909. //右下拖动
  910. m_multiselect_rect = new RectangleF(m_beforemultiselect_point, new SizeF(e.Location.X - m_beforemultiselect_point.X, e.Location.Y - m_beforemultiselect_point.Y));
  911. }
  912. if (e.Location.X < m_beforemultiselect_point.X && e.Location.Y < m_beforemultiselect_point.Y)
  913. {
  914. //左上拖动
  915. PointF lspointf = new PointF(e.Location.X, e.Location.Y);
  916. m_multiselect_rect = new RectangleF(lspointf, new SizeF(m_beforemultiselect_point.X - e.Location.X, m_beforemultiselect_point.Y - e.Location.Y));
  917. }
  918. if (e.Location.X > m_beforemultiselect_point.X && e.Location.Y < m_beforemultiselect_point.Y)
  919. {
  920. //右上,这种画法,需要将左下,右上两点转换成左上,右下
  921. PointF left_pointf = new PointF(m_beforemultiselect_point.X, e.Location.Y);
  922. PointF right_pointf = new PointF(e.Location.X, m_beforemultiselect_point.Y);
  923. m_multiselect_rect = new RectangleF(left_pointf, new SizeF(right_pointf.X - left_pointf.X, right_pointf.Y - left_pointf.Y));
  924. }
  925. if (e.Location.X < m_beforemultiselect_point.X && e.Location.Y > m_beforemultiselect_point.Y)
  926. {
  927. //左下,这种画法,需要将左下,右上两点转换成左上,右下
  928. PointF left_pointf = new PointF(e.Location.X, m_beforemultiselect_point.Y);
  929. PointF right_pointf = new PointF(m_beforemultiselect_point.X, e.Location.Y);
  930. m_multiselect_rect = new RectangleF(left_pointf, new SizeF(right_pointf.X - left_pointf.X, right_pointf.Y - left_pointf.Y));
  931. }
  932. }
  933. //在进行多选时,不让其拖动
  934. if (false == m_is_multiselect_onpaint)
  935. {
  936. foreach (BaseObject item in m_list_baseobject)
  937. {
  938. DParticle dp = (DParticle)item;
  939. //明白了,选择第一个时,被第二个刷掉了
  940. if (true ==m_ReportFun. WhetherInRange(dp, e.Location))
  941. {
  942. dp.IsMouseMove = true;
  943. //获取颗粒ID
  944. int FieldID = dp.CLRFieldID;
  945. int TagID = dp.CLRTagID;
  946. //显示x-ray能谱图
  947. if (control_XRayTable1.Visible == false)
  948. ShowXRay(dp);
  949. }
  950. else
  951. {
  952. dp.IsMouseMove = false;
  953. //移动在颗粒外面时,要判断,Operator_ShowXray不为选下显示XRAY时,才对XRay进行隐藏
  954. if (dp.Operator_ShowXRay != ParticleOperatorShowXray.SELECTANDDISPLAYXRAY)
  955. {
  956. //隐藏x-ray能谱图
  957. HideXRay(dp);
  958. }
  959. }
  960. if (true == item.IsDragging)
  961. {
  962. //再将里面的线也进行计算坐标
  963. foreach (DSegment ds in dp.DSegments)
  964. {
  965. ds.Rect = new RectangleF(
  966. ds.Rect.X + e.X - item.DraggingPoint.X, //获取到原先点与移动点的增减量,+原先的x坐标,就是新的坐标
  967. ds.Rect.Y + e.Y - item.DraggingPoint.Y,
  968. ds.Rect.Width,
  969. ds.Rect.Height);
  970. ds.DraggingPoint = e.Location;
  971. }
  972. item.DraggingPoint = e.Location;
  973. //获取矩形的rectangle
  974. dp.Rect = dp.GetRectFromDSegment();
  975. //通过line获取路径边缘
  976. dp.GPath = dp.GetRegionFromDSegments();
  977. //重新计算小矩形边框
  978. dp.SmallRect = dp.GetSmallRectangleFromRect();
  979. if (dp.Rect.Left < -120 || dp.Rect.Right > this.Width + 120 || dp.Rect.Top < -120 || dp.Rect.Bottom > this.Height + 120)
  980. {
  981. dp.Operator = ParticleOperator.NODISPLAY;
  982. }
  983. }
  984. }
  985. foreach (var item in m_list_dfield)
  986. {
  987. if (true == item.IsDragging)
  988. {
  989. item.Current_Rect = new RectangleF(
  990. item.Current_Rect.Left + Convert.ToSingle((e.X - item.DraggingPoint.X)),
  991. item.Current_Rect.Top + Convert.ToSingle((e.Y - item.DraggingPoint.Y)),
  992. item.Current_Rect.Width,
  993. item.Current_Rect.Height);
  994. item.DraggingPoint = e.Location;
  995. }
  996. }
  997. //如果在拖动中
  998. if (true == m_isDrag)
  999. {
  1000. //同样重新计算backrectf的坐标
  1001. m_backrectf = new RectangleF(m_backrectf.Location.X + e.X - m_beforedrag_pointf.X,
  1002. m_backrectf.Location.Y + e.Y - m_beforedrag_pointf.Y, m_backrectf.Width, m_backrectf.Height);
  1003. m_beforedrag_pointf = e.Location;
  1004. }
  1005. }
  1006. #region 向报告程序右下角,传送鼠标颗粒等相关信息
  1007. m_str_mouseshow_left = "无";
  1008. foreach (BaseObject item in m_list_baseobject)
  1009. {
  1010. DParticle dp = (DParticle)item;
  1011. if (dp.Operator != ParticleOperator.NODISPLAY)
  1012. {
  1013. if (true == m_ReportFun.WhetherInRange(dp, e.Location))
  1014. {
  1015. ////并保存到变量中,供移动电镜使用
  1016. m_sem_mouse_now_point = new Point(dp.SEMPosX, dp.SEMPosY);
  1017. m_str_mouseshow_left = "颗粒SEM位置:" + dp.SEMPosX.ToString() + ":" + dp.SEMPosY.ToString();
  1018. }
  1019. }
  1020. }
  1021. //获取颜色方法1,使用API来获取当前鼠标指向位置的颜色值-----------------------------------------------------
  1022. Color ls_c = GetColorByMousePoint(e.X, e.Y);
  1023. m_str_mouseshow_right = "灰度#" + ls_c.R.ToString();
  1024. m_ReportApp.mouseMatter.Text = m_str_mouseshow_right ;
  1025. m_ReportApp.RSGrayVal.Text = m_str_mouseshow_left;
  1026. #endregion
  1027. Invalidate();
  1028. }
  1029. /// <summary>
  1030. /// 获取鼠标所在位置的信息,显示在框架的右下角
  1031. /// </summary>
  1032. /// <param name="mouseshow_left"></param>
  1033. /// <param name="mouseshow_rightb"></param>
  1034. public void GetMouseLowerRightCornerText(out string mouseshow_left, out string mouseshow_rightb)
  1035. {
  1036. mouseshow_left = m_str_mouseshow_left;
  1037. mouseshow_rightb = m_str_mouseshow_right;
  1038. }
  1039. /// <summary>
  1040. /// 鼠标抬起事件
  1041. /// </summary>
  1042. /// <param name="e"></param>
  1043. protected override void OnMouseUp(MouseEventArgs e)
  1044. {
  1045. if (e.Button == MouseButtons.Left)
  1046. {
  1047. this.Cursor = Cursors.Default;
  1048. //还原多选变量
  1049. if (true == m_is_multiselect_onpaint)
  1050. {
  1051. //首先清除掉所有已经选择的项
  1052. foreach (DParticle dp in m_list_baseobject)
  1053. {
  1054. if (dp.Operator == ParticleOperator.SELECTED)
  1055. {
  1056. dp.Operator = ParticleOperator.DISPLAY;
  1057. }
  1058. }
  1059. //然后在这里判断都有哪些颗粒所有的point点,是否在选取的图形graphicsPath闭合路径中
  1060. //首先先将选取的图形填充成graphicsPath
  1061. if (m_multiselect_rect.Width > 0 && m_multiselect_rect.Height > 0)
  1062. {
  1063. GraphicsPath ls_gpath = new GraphicsPath();
  1064. ls_gpath.AddRectangle(m_multiselect_rect);
  1065. foreach (DParticle dp in m_list_baseobject)
  1066. {
  1067. if (dp.Operator != ParticleOperator.NODISPLAY && dp.Operator != ParticleOperator.DELETED)//不显示的和删除状态的不让进行选择
  1068. {
  1069. PointF[] lspointf = dp.GPath.PathPoints;
  1070. for (int i = 0; i < lspointf.Count(); i++)
  1071. {
  1072. if (true == m_ReportFun.WhetherInRange(dp, lspointf[i]))
  1073. {
  1074. //选择到了该路径,那么就选取该图像
  1075. dp.Operator = ParticleOperator.SELECTED;
  1076. }
  1077. }
  1078. }
  1079. }
  1080. }
  1081. //这里恢复默认值
  1082. m_multiselect_rect.Width = 0;
  1083. m_multiselect_rect.Height = 0;
  1084. m_is_multiselect_onpaint = false;
  1085. m_is_multiselect_ellipse = false;
  1086. m_is_multiselect_rectangle = false;
  1087. //将多选选择上的颗粒发送给报告框架
  1088. SelectParticleListSendToReportFrame();
  1089. }
  1090. //不在多选的状态时,可以进行拖动操作
  1091. if (false == m_is_multiselect_onpaint)
  1092. {
  1093. // Drag_MouseUpFucntion(list_baseobject, e);
  1094. foreach (BaseObject item in m_list_baseobject)
  1095. {
  1096. if (true == item.IsDragging)
  1097. {
  1098. item.IsSelect = false;
  1099. item.IsDragging = false;
  1100. item.DraggingPoint = Point.Empty;
  1101. m_isDrag = false;
  1102. }
  1103. }
  1104. if (m_list_GBobject != null)
  1105. {
  1106. if (m_list_GBobject.Count > 0)
  1107. {
  1108. foreach (DField item in m_list_GBobject)
  1109. {
  1110. if (true == item.IsDragging)
  1111. {
  1112. item.IsSelect = false;
  1113. item.IsDragging = false;
  1114. item.DraggingPoint = Point.Empty;
  1115. m_isDrag = false;
  1116. }
  1117. }
  1118. }
  1119. }
  1120. foreach (DField item in m_list_dfield)
  1121. {
  1122. if (true == item.IsDragging)
  1123. {
  1124. item.IsDragging = false;
  1125. item.DraggingPoint = Point.Empty;
  1126. m_isDrag = false;
  1127. }
  1128. }
  1129. //在颗粒上点击,则对该颗粒附加显示x-ray的状态,同时将其它颗粒上显示x-ray的状态全部去掉。
  1130. if (false == m_isDrag)
  1131. {
  1132. foreach (DParticle dp in m_list_baseobject)
  1133. {
  1134. PointF[] lspointf = dp.GPath.PathPoints;
  1135. if (true == m_ReportFun.WhetherInRange(dp, new Point(e.X, e.Y)))
  1136. {
  1137. //选择到了该路径,那么就选取该图像b
  1138. dp.Operator_ShowXRay = ParticleOperatorShowXray.SELECTANDDISPLAYXRAY;
  1139. }
  1140. else
  1141. {
  1142. dp.Operator_ShowXRay = ParticleOperatorShowXray.NODISPLAY;
  1143. }
  1144. }
  1145. }
  1146. }
  1147. }
  1148. //右键菜单控件
  1149. CMenuStrip.Items[0].Tag = "";
  1150. CMenuStrip.Items[0].Enabled = false;
  1151. CMenuStrip.Items[1].Tag = "";
  1152. CMenuStrip.Items[1].Enabled = false;
  1153. CMenuStrip.Items[2].Tag = "";
  1154. CMenuStrip.Items[2].Enabled = false;
  1155. CMenuStrip.Items[3].Tag = "";
  1156. CMenuStrip.Items[3].Enabled = false;
  1157. CMenuStrip.Items[4].Tag = "";
  1158. CMenuStrip.Items[4].Enabled = false;
  1159. if (e.Button == MouseButtons.Right)
  1160. {
  1161. //线程未执行完成,则不让再进行选择,右键移动到SEM位置的菜单选项
  1162. if (m_mythread_state == false)
  1163. CMenuStrip.Items[4].Enabled = true;
  1164. else
  1165. CMenuStrip.Items[4].Enabled = false;
  1166. //这个判断右键菜单加在这里,也不知道对不对
  1167. foreach (BaseObject item in m_list_baseobject)
  1168. {
  1169. if (true == m_ReportFun.WhetherInRange((DParticle)item, e.Location))
  1170. {
  1171. DParticle dp = (DParticle)item;
  1172. CMenuStrip.Items[0].Enabled = true;
  1173. CMenuStrip.Items[0].Tag = dp;
  1174. CMenuStrip.Items[1].Enabled = true;
  1175. if (dp.Operator == ParticleOperator.SELECTED)
  1176. {
  1177. CMenuStrip.Items[1].Text = table["str5"].ToString();
  1178. }
  1179. else
  1180. {
  1181. CMenuStrip.Items[1].Text = table["str6"].ToString();
  1182. }
  1183. CMenuStrip.Items[2].Enabled = true;
  1184. CMenuStrip.Items[3].Enabled = true;
  1185. m_sem_mouse_now_point = new Point(dp.SEMPosX, dp.SEMPosY);
  1186. //获取颜色方法1,使用API来获取当前鼠标指向位置的颜色值-----------------------------------------------------
  1187. Color ls_c = GetColorByMousePoint(e.X, e.Y);
  1188. m_str_mouseshow_right = "灰度#" + ls_c.R.ToString();
  1189. m_str_mouseshow_left = "颗粒SEM位置:" + dp.SEMPosX.ToString() + ":" + dp.SEMPosY.ToString();
  1190. m_ReportApp.mouseMatter.Text = m_str_mouseshow_right;
  1191. m_ReportApp.RSGrayVal.Text = m_str_mouseshow_left;
  1192. }
  1193. }
  1194. //判断菜单的状态,来判断当前鼠标是否在颗粒中,对菜单选项进行设置
  1195. if (CMenuStrip.Items[1].Enabled == true)
  1196. {
  1197. CMenuStrip.Items[4].Visible = false;//暂时隐藏
  1198. CMenuStrip.Items[4].Text = table["str8"].ToString();
  1199. }
  1200. else
  1201. {
  1202. CMenuStrip.Items[4].Visible = true;//去除隐藏
  1203. CMenuStrip.Items[4].Text = table["str8"].ToString();
  1204. }
  1205. }
  1206. Invalidate();
  1207. }
  1208. #endregion
  1209. #region 鼠标右键菜单
  1210. private void ToolStripMenuItem_id_Click(object sender, EventArgs e)
  1211. {
  1212. //ID
  1213. DParticle dp = (DParticle)CMenuStrip.Items[0].Tag;
  1214. MessageBox.Show(dp.ID.ToString());
  1215. }
  1216. //是否显示过小颗菜单
  1217. private void ToolStripMenuItem_ShowSmallParticle_Click(object sender, EventArgs e)
  1218. {
  1219. if (bShowSmallParticle == false)
  1220. {
  1221. bShowSmallParticle = true;
  1222. CMenuStrip.Items[7].Text = table["str8"].ToString();
  1223. }
  1224. else
  1225. {
  1226. bShowSmallParticle = false;
  1227. CMenuStrip.Items[7].Text = table["str9"].ToString();
  1228. }
  1229. //缩放的基数,临时变量
  1230. m_f_widthandheight_js = 0;
  1231. //与原先缩放的记录数
  1232. m_f_zoom_record = 1;
  1233. //最大缩放倍数
  1234. //每像素代表的尺寸大小,还不知道在哪里进行计算
  1235. m_f_onepixel_size = 4.5f;
  1236. //提供鼠标在右下角显示的文本,左侧
  1237. m_str_mouseshow_left = "";
  1238. //提供鼠标在右下角显示的文本,右侧
  1239. m_str_mouseshow_right = "";
  1240. //整个背景矩形的背景色
  1241. m_backrangecolor = Color.White;
  1242. m_list_dfield = new List<DField>();
  1243. m_old_list_dfield = new List<DField>();
  1244. m_list_baseobject = new List<BaseObject>();
  1245. m_original_list_baseobject = new List<BaseObject>();
  1246. m_list_historyapolygon = new List<HistoryApolygon>();
  1247. m_frm_userprogress = new Frm_UserProgress();
  1248. m_mythread_state = false;
  1249. m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
  1250. Control_DrawDistrbutionImageAndBSE_Load(null, null);
  1251. }
  1252. private void ToolStripMenuItem_selected_Click(object sender, EventArgs e)
  1253. {
  1254. //选择
  1255. DParticle dp = (DParticle)CMenuStrip.Items[0].Tag;
  1256. if (ParticleOperator.SELECTED == dp.Operator)
  1257. {
  1258. dp.Operator = ParticleOperator.DISPLAY;
  1259. CMenuStrip.Items[1].Text = table["str6"].ToString();
  1260. control_XRayTable1.Visible = false;
  1261. }
  1262. else
  1263. {
  1264. dp.Operator = ParticleOperator.SELECTED;
  1265. CMenuStrip.Items[1].Text = table["str5"].ToString();
  1266. }
  1267. //发送选择的颗粒到报告框架中
  1268. SelectParticleListSendToReportFrame();
  1269. }
  1270. /// <summary>
  1271. /// 显示x-ray能谱图
  1272. /// </summary>
  1273. /// <param name="in_dparticle"></param>
  1274. private void ShowXRay(DParticle in_dparticle)
  1275. {
  1276. if (delaytimer.Enabled == false)
  1277. {
  1278. m_move_dparticle = in_dparticle;//将显示xray的dparticle记录给全局变量
  1279. delaytimer.Tick += Delaytimer_Tick;
  1280. delaytimer.Interval = 100;
  1281. delaytimer.Start();
  1282. }
  1283. }
  1284. private void Delaytimer_Tick(object sender, EventArgs e)
  1285. {
  1286. delaytimer.Enabled = false;
  1287. if (m_move_dparticle.IsMouseMove == false)
  1288. {
  1289. return;
  1290. }
  1291. //显示xray相关信息
  1292. uint[] Search_xray = new uint[2000];
  1293. uint[] Analysis_xray = new uint[2000];
  1294. //
  1295. int i_xray_id = 0;
  1296. List<Element> list_celementchemistryclr = new List<Element>();
  1297. //获取Xray数据
  1298. 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);
  1299. //get CElementChemistryClr list
  1300. List<ShowElementInfo> list_showelementinfo = new List<ShowElementInfo>();
  1301. for (int i = 0; i < list_celementchemistryclr.Count; i++)
  1302. {
  1303. ShowElementInfo ls_sei = new ShowElementInfo();
  1304. ls_sei.ElementName = list_celementchemistryclr[i].Name;
  1305. ls_sei.Percentage = list_celementchemistryclr[i].Percentage;
  1306. ls_sei.dKF = Convert.ToDouble(CListPeriodic.GetPeriodicByYsm(CListPeriodic.GetListPeriodic(), ls_sei.ElementName).SX1);
  1307. list_showelementinfo.Add(ls_sei);
  1308. }
  1309. //获取使用标准库的名称
  1310. //string str_stdname = "";
  1311. string str_IncALibName = "";
  1312. str_IncALibName = m_move_dparticle.TypeName;
  1313. //获取数据后,需要对xraytable设置
  1314. control_XRayTable1.Visible = false;
  1315. control_XRayTable1.SetXRayShowLineValue(Search_xray, Analysis_xray, list_showelementinfo);
  1316. //颗粒国标信息
  1317. control_XRayTable1.GBInfoStr = "";
  1318. control_XRayTable1.GoodName = str_IncALibName;//杂夹物
  1319. //control_XRayTable1.STDName = str_stdname;//标准库
  1320. control_XRayTable1.List_ShowElementInfo = list_showelementinfo;
  1321. control_XRayTable1.Visible = true;
  1322. this.Refresh();
  1323. }
  1324. /// <summary>
  1325. /// 隐藏x-ray能谱图
  1326. /// </summary>
  1327. private void HideXRay(DParticle in_dparticle)
  1328. {
  1329. if (m_move_dparticle == null)
  1330. return;
  1331. else if (m_move_dparticle.ID == in_dparticle.ID)
  1332. {
  1333. //如果是刚才移动过的颗粒的话,那么这里再对xray进行隐藏
  1334. control_XRayTable1.Visible = false;
  1335. }
  1336. }
  1337. /// <summary>
  1338. /// 根据传入的鼠标位置,来获取当前鼠标位置上的灰度值
  1339. /// </summary>
  1340. /// <param name="int_x"></param>
  1341. /// <param name="int_y"></param>
  1342. /// <returns></returns>
  1343. private Color GetColorByMousePoint(int int_x, int int_y)
  1344. {
  1345. Graphics g = Graphics.FromHwnd(this.Handle);
  1346. IntPtr hdc = g.GetHdc();
  1347. uint u_color = 0;
  1348. try
  1349. {
  1350. u_color = DrawFunction.GetPixel(hdc, int_x, int_y);
  1351. }
  1352. catch
  1353. { }
  1354. Color ls_c = Color.FromArgb
  1355. (
  1356. (int)(u_color << 24 >> 24),
  1357. (int)(u_color << 16 >> 24),
  1358. (int)(u_color << 8 >> 24)
  1359. );
  1360. return ls_c;
  1361. }
  1362. /// <summary>
  1363. /// 封装,将分布图中的颗粒list传送给报告项目框架中
  1364. /// </summary>
  1365. private void SelectParticleListSendToReportFrame()
  1366. {
  1367. //先获取分布图中,有哪些颗粒已经被选择上了
  1368. m_ReportApp.SelectedParticles = GetSelectedParticleList_ForDrawDistrbutionImageAndBSE();
  1369. }
  1370. /// <summary>
  1371. /// 设置当前对哪些颗粒进行设置为选择状态
  1372. /// </summary>
  1373. /// <param name="in_list_cotsparticleclr"></param>
  1374. public void SetSelectParticle(List<Particle> particles)
  1375. {
  1376. if (particles == null)
  1377. {
  1378. return;
  1379. }
  1380. if (particles.Count == 0)
  1381. {
  1382. return;
  1383. }
  1384. foreach (DParticle ls_dp in m_list_baseobject)
  1385. {
  1386. //只有显示状态,才可以切换到选择状态,考虑可能会出现如果在条件选择成不显示状态下,如果被选择了,是不是就强制切换成了选择状态
  1387. if (ls_dp.Operator == ParticleOperator.DISPLAY)
  1388. {
  1389. for (int i = 0; i < particles.Count; i++)
  1390. {
  1391. if (particles[i].ParticleId == ls_dp.CLRTagID
  1392. && particles[i].FieldId == ls_dp.CLRFieldID)
  1393. {
  1394. ls_dp.Operator = ParticleOperator.SELECTED;
  1395. }
  1396. }
  1397. }
  1398. }
  1399. }
  1400. private void ToolStripMenuItem_delete_Click(object sender, EventArgs e)
  1401. {
  1402. //删除颗粒
  1403. DParticle dp = (DParticle)CMenuStrip.Items[0].Tag;
  1404. //同样,要在历史操作记录类中,添加记录,好可以进行撤消操作
  1405. HistoryApolygon hApolygon = new HistoryApolygon();
  1406. hApolygon.APolygonID = dp.ID;
  1407. hApolygon.Operator = ParticleOperator.DELETED;
  1408. hApolygon.OldOperator = dp.Operator;
  1409. hApolygon.ID = m_list_historyapolygon.Count;
  1410. m_list_historyapolygon.Add(hApolygon);
  1411. m_operator_currentid = hApolygon.ID;//当前操作到的历史操作记录
  1412. //设置颗粒的状态为已经被删除
  1413. dp.Operator = ParticleOperator.DELETED;
  1414. }
  1415. //复制图像
  1416. private void toolStripMenuItem_copyimage_Click(object sender, EventArgs e)
  1417. {
  1418. CopyImage();
  1419. }
  1420. private void ToolStripMenuItem_movesempoint_Click(object sender, EventArgs e)
  1421. {
  1422. //移动SEM到指定位置
  1423. if (m_mythread == null)
  1424. {
  1425. return;
  1426. }
  1427. if (m_mythread.ThreadState == System.Threading.ThreadState.Running || m_mythread.ThreadState == System.Threading.ThreadState.WaitSleepJoin)
  1428. {
  1429. return;
  1430. }
  1431. if (m_mythread.ThreadState == System.Threading.ThreadState.Stopped)
  1432. {
  1433. m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
  1434. }
  1435. //改为线程调用,先判断线程状态
  1436. m_mythread.Start(new Point(m_sem_mouse_now_point.X, m_sem_mouse_now_point.Y));
  1437. }
  1438. #endregion
  1439. #region 自定义功能函数
  1440. /// <summary>
  1441. /// 复制图像
  1442. /// </summary>
  1443. private void CopyImage()
  1444. {
  1445. int height, width;
  1446. width = this.Width;
  1447. height = this.Height;
  1448. Bitmap image = new Bitmap(width, height);
  1449. this.DrawToBitmap(image, new Rectangle(0, 0, width, height));
  1450. Clipboard.SetImage(image);
  1451. }
  1452. /// <summary>
  1453. /// 移动SEM到指定位置线程函数
  1454. /// </summary>
  1455. private void Thread_GO(object in_obj)
  1456. {
  1457. if (m_mythread_state == false)
  1458. {
  1459. m_mythread_state = true;
  1460. Point sem_point = (Point)in_obj;
  1461. //第一步,连接电镜
  1462. m_ReportFun.ConnectToSEM();
  1463. Thread.Sleep(500);
  1464. //第二步,移动到指定位置,先读取再设置
  1465. if (m_ReportFun.m_SEMConnectionState == true)
  1466. {
  1467. m_ReportFun.MoveSemToPointXY(sem_point.X, sem_point.Y);
  1468. }
  1469. Thread.Sleep(1500);
  1470. //第三步,断开电镜连接
  1471. m_ReportFun.DisConnectSEM();
  1472. //Thread.Sleep(1000);
  1473. m_mythread_state = false;
  1474. }
  1475. }
  1476. /// <summary>
  1477. /// 按框架传入的底层计算结果,重新对颗粒进行区分显示
  1478. /// </summary>
  1479. /// <param name="in_cgriddataclr"></param>
  1480. public void DrawDistrbutionImageAndBSE_ByQuery(OTSIncAReportApp.OTSSampleReportInfo.OTSSampleMeaInfo in_list_griddata)
  1481. {
  1482. DrawBSEDistributionImageByQuery(in_list_griddata);
  1483. //FullGraphMatch();
  1484. //Invalidate();
  1485. }
  1486. /// <summary>
  1487. /// 对分布图进行宽度匹配操作
  1488. /// </summary>
  1489. public void WidthMatch()
  1490. {
  1491. if (this.Width != m_backrectf.Width)
  1492. {
  1493. float f_cz = 0;//进行调整的差值
  1494. f_cz = -((m_backrectf.Width - this.Width) / m_old_backrectf.Width);
  1495. m_f_zoom_record = m_f_zoom_record + f_cz;//更新上缩放值,与下面处理缩放对应上
  1496. ImageZoomByIncrement(f_cz, 0, 0);
  1497. }
  1498. MoveImageToPoint(new PointF(0, 0));
  1499. }
  1500. /// <summary>
  1501. /// 对分布图进行高度匹配操作
  1502. /// </summary>
  1503. public void HeightMatch()
  1504. {
  1505. if (this.Height != m_backrectf.Height)
  1506. {
  1507. float f_cz = 0;//进行调整的差值
  1508. f_cz = -((m_backrectf.Height - this.Height) / m_old_backrectf.Height);
  1509. m_f_zoom_record = m_f_zoom_record + f_cz;//更新上缩放值,与下面处理缩放对应上
  1510. ImageZoomByIncrement(f_cz, 0, 0);
  1511. }
  1512. //移动到,this.width - backrectf.width /2
  1513. int ls_x = (int)(this.Width - m_backrectf.Width) / 2;
  1514. MoveImageToPoint(new PointF(ls_x, 0));
  1515. }
  1516. /// <summary>
  1517. /// 对分布图进行全图匹配操作
  1518. /// </summary>
  1519. public void FullGraphMatch()
  1520. {
  1521. for (int i = 0; i < m_list_baseobject.Count(); i++)
  1522. {
  1523. DParticle dp = (DParticle)m_list_baseobject[i];
  1524. dp.Operator = ParticleOperator.DISPLAY;
  1525. }
  1526. //全图匹配,首先要判断出来是按宽度来计算缩放,还是按高度来计算缩放
  1527. double ls_thiswidth = this.Width;
  1528. double ls_thisheight = this.Height;
  1529. double ls_imagewidth = m_backrectf.Width;
  1530. double ls_imageheight = m_backrectf.Height;
  1531. //如果宽已相等rect在thisheight范围内,是宽度匹配已经达到目的,或是高已相等rect在thiswidth范围内,是高度匹配已经达到目的
  1532. if ((ls_thiswidth == ls_imagewidth && ls_thisheight > ls_imagewidth) || (ls_thisheight == ls_imageheight && ls_thiswidth > ls_imagewidth))
  1533. {
  1534. //已经达到目的不操作,返回
  1535. return;
  1536. }
  1537. //判断当前是否宽度匹配未达到全图匹配效果
  1538. if (ls_thiswidth == ls_imagewidth && ls_thisheight < ls_imageheight)
  1539. {
  1540. //说明目前已经达到了宽度匹配,但是未能显示完全整图需要高度匹配
  1541. HeightMatch();
  1542. return;
  1543. }
  1544. //判断当前是否高度匹配未达到全图匹配效果
  1545. if (ls_thisheight == ls_imageheight && ls_thiswidth < ls_imagewidth)
  1546. {
  1547. //说明目前已经达到了高度匹配,但是未能显示完全的整图需要宽度匹配
  1548. WidthMatch();
  1549. return;
  1550. }
  1551. //然后还剩的匹配情况有,宽高都小于this,宽度都大于this,宽大于this高小于this,宽小于this高大于this
  1552. //计算差值
  1553. double ls_d_cz_width = 0;
  1554. double ls_d_cz_height = 0;
  1555. ls_d_cz_width = Math.Abs(ls_thiswidth / ls_imagewidth);
  1556. ls_d_cz_height = Math.Abs(ls_thisheight / ls_imageheight);
  1557. //应该是看谁差的倍数大就按谁的进行调整,而不只能看高宽的差值
  1558. if ((1 - ls_d_cz_width) > (1 - ls_d_cz_height))
  1559. {
  1560. //宽差大,就调用WidthMate
  1561. WidthMatch();
  1562. }
  1563. else
  1564. {
  1565. //高差大,则调用HightMate
  1566. HeightMatch();
  1567. }
  1568. }
  1569. /// <summary>
  1570. /// 将整个图像的位置移动到指定的位置上
  1571. /// </summary>
  1572. private void MoveImageToPoint(PointF in_pointf)
  1573. {
  1574. //先计算,当前所在的位置,和需要移动的位置之间的差
  1575. //想复杂了,其实就是当前backrectf的x,y与in_pointf的差就完了呗
  1576. PointF offex_p = new PointF(m_backrectf.X - in_pointf.X, m_backrectf.Y - in_pointf.Y);
  1577. for (int i = 0; i < m_list_baseobject.Count; i++)
  1578. {
  1579. DParticle dp = (DParticle)m_list_baseobject[i];
  1580. for (int k = 0; k < dp.DSegments.Count; k++)
  1581. {
  1582. dp.DSegments[k].Rect = new RectangleF(
  1583. dp.DSegments[k].Rect.X - offex_p.X,
  1584. dp.DSegments[k].Rect.Y - offex_p.Y,
  1585. dp.DSegments[k].Rect.Width,
  1586. dp.DSegments[k].Rect.Height);
  1587. }
  1588. //获取矩形的rectangle
  1589. dp.Rect = dp.GetRectFromDSegment();
  1590. //通过line获取路径边缘
  1591. dp.GPath = dp.GetRegionFromDSegments();
  1592. //重新计算小矩形边框
  1593. dp.SmallRect = dp.GetSmallRectangleFromRect();
  1594. }
  1595. //同样重新计算backrectf的坐标
  1596. m_backrectf = new RectangleF(m_backrectf.X - offex_p.X, m_backrectf.Y - offex_p.Y,
  1597. m_backrectf.Width, m_backrectf.Height);
  1598. for (int i =0;i< m_list_dfield.Count;i++)
  1599. {
  1600. RectangleF dField = m_list_dfield[i].Current_Rect;
  1601. dField.X = dField.X-offex_p.X;
  1602. dField.Y = dField.Y - offex_p.Y;
  1603. m_list_dfield[i].Current_Rect = dField;
  1604. }
  1605. Invalidate();
  1606. }
  1607. /// <summary>
  1608. /// 是否显示边框格线,自动切换显示与不显示
  1609. /// </summary>
  1610. /// <param name="b_show"></param>
  1611. public void ShowGridLine()
  1612. {
  1613. m_is_showgrid = !m_is_showgrid;
  1614. }
  1615. /// <summary>
  1616. /// 是否显示标尺控件
  1617. /// </summary>
  1618. /// <param name="b_show"></param>
  1619. public void ShowRulerControl()
  1620. {
  1621. control_Ruler1.Visible = !control_Ruler1.Visible;
  1622. }
  1623. /// <summary>
  1624. /// 是否显示边框格线,带参重载
  1625. /// </summary>
  1626. /// <param name="b_show"></param>
  1627. public void ShowGridLine(bool b_show)
  1628. {
  1629. m_is_showgrid = b_show;
  1630. }
  1631. /// <summary>
  1632. /// 是否显示标尺控件,带参重载
  1633. /// </summary>
  1634. /// <param name="b_show"></param>
  1635. public void ShowRulerControl(bool b_show)
  1636. {
  1637. control_Ruler1.Visible = b_show;
  1638. }
  1639. //测试回头去掉
  1640. public void test_selected()
  1641. {
  1642. GetSelectedParticleList_ForDrawDistrbutionImageAndBSE();
  1643. }
  1644. /// <summary>
  1645. /// 是否进行矩形多选操作
  1646. /// </summary>
  1647. public void MultiSelect_Rectangle()
  1648. {
  1649. if (m_is_multiselect_ellipse == true)
  1650. {
  1651. m_is_multiselect_ellipse = false;
  1652. }
  1653. m_is_multiselect_rectangle = true;
  1654. }
  1655. /// <summary>
  1656. /// 是否进行圆形多选操作
  1657. /// </summary>
  1658. public void MultiSelect_Ellipse()
  1659. {
  1660. if (m_is_multiselect_rectangle == true)
  1661. {
  1662. m_is_multiselect_rectangle = false;
  1663. }
  1664. m_is_multiselect_ellipse = true;
  1665. }
  1666. /// <summary>
  1667. /// 对选择的多边形进行反选操作
  1668. /// </summary>
  1669. public void ReverseSelection()
  1670. {
  1671. foreach (DParticle dp in m_list_baseobject)
  1672. {
  1673. if (ParticleOperator.DISPLAY == dp.Operator)
  1674. {
  1675. dp.Operator = ParticleOperator.SELECTED;
  1676. }
  1677. else if (ParticleOperator.SELECTED == dp.Operator)
  1678. {
  1679. dp.Operator = ParticleOperator.DISPLAY;
  1680. }
  1681. }
  1682. //将排列图选择的颗粒传送给报告框架中
  1683. SelectParticleListSendToReportFrame();
  1684. this.Invalidate();
  1685. }
  1686. /// <summary>
  1687. /// 取消所有的颗粒的选择状态
  1688. /// </summary>
  1689. public void DeselectAllParticle()
  1690. {
  1691. foreach (DParticle dp in m_list_baseobject)
  1692. {
  1693. if (ParticleOperator.SELECTED == dp.Operator)
  1694. {
  1695. dp.Operator = ParticleOperator.DISPLAY;
  1696. }
  1697. }
  1698. //将排列图选择的颗粒传送给报告框架中
  1699. SelectParticleListSendToReportFrame();
  1700. this.Invalidate();
  1701. }
  1702. /// <summary>
  1703. /// 禁止多选工具的使用
  1704. /// </summary>
  1705. public void MultiSelect_Ban()
  1706. {
  1707. m_is_multiselect_ellipse = false;
  1708. m_is_multiselect_rectangle = false;
  1709. }
  1710. /// <summary>
  1711. /// 获取小数的位数
  1712. /// </summary>
  1713. /// <param name="in_f_value"></param>
  1714. /// <returns></returns>
  1715. public int GetDecimalDigits(float in_f_value)
  1716. {
  1717. var s = in_f_value.ToString();
  1718. return s.Length - s.IndexOf('.') - 1;
  1719. }
  1720. /// <summary>
  1721. /// 将整个图像拷贝到内存中
  1722. /// </summary>
  1723. public void CopyToBitmap()
  1724. {
  1725. Bitmap bp = new Bitmap(this.Size.Width, this.Size.Height);
  1726. this.DrawToBitmap(bp, new Rectangle(0, 0, this.Size.Width, this.Size.Height));
  1727. Clipboard.SetImage(bp);
  1728. }
  1729. /// <summary>
  1730. /// 设置显示BSE原图,还是显示分布图带有标准库的
  1731. /// </summary>
  1732. /// <param name="a_type">false为显示原bse图像,true为显示带有标准库代表色的图像</param>
  1733. public void ShowMode(string a_type)
  1734. {
  1735. if (a_type == "BSE")
  1736. {
  1737. OriginalBackground = false;
  1738. //bse图时,显示背景图为白色
  1739. m_backrangecolor = Color.White;
  1740. foreach (DParticle ls_dp in m_list_baseobject)
  1741. {
  1742. foreach (DSegment ls_ds in ls_dp.DSegments)
  1743. {
  1744. ls_ds.ShowMode = SegmentShowMode.DRAWPOINT;
  1745. }
  1746. }
  1747. FullGraphMatch();
  1748. }
  1749. else if (a_type== "Original")
  1750. {
  1751. OriginalBackground = true;
  1752. foreach (DParticle ls_dp in m_list_baseobject)
  1753. {
  1754. foreach (DSegment ls_ds in ls_dp.DSegments)
  1755. {
  1756. ls_ds.ShowMode = SegmentShowMode.DRAWPOINT;
  1757. }
  1758. }
  1759. FullGraphMatch();
  1760. }
  1761. else if(a_type== "原图颗粒分布")
  1762. {
  1763. OriginalBackground = true;
  1764. foreach (DParticle ls_dp in m_list_baseobject)
  1765. {
  1766. foreach (DSegment ls_ds in ls_dp.DSegments)
  1767. {
  1768. ls_ds.ShowMode = SegmentShowMode.DRAWLINE;
  1769. }
  1770. }
  1771. FullGraphMatch();
  1772. }
  1773. else
  1774. {
  1775. OriginalBackground = false;
  1776. m_backrangecolor = Color.Gainsboro;
  1777. foreach (DParticle ls_dp in m_list_baseobject)
  1778. {
  1779. foreach (DSegment ls_ds in ls_dp.DSegments)
  1780. {
  1781. ls_ds.ShowMode = SegmentShowMode.DRAWLINE;
  1782. }
  1783. }
  1784. FullGraphMatch();
  1785. }
  1786. this.Invalidate();
  1787. }
  1788. /// <summary>
  1789. /// 根据传入的颗粒状态,来获取所有该颗粒状态下的数据,用来测试统计使用
  1790. /// </summary>
  1791. /// <param name="str_particlestate"></param>
  1792. /// <returns></returns>
  1793. public int GetParticleNumberByState(ParticleOperator in_ParticleState)
  1794. {
  1795. int icount = 0;
  1796. foreach (DParticle ls_dp in m_list_baseobject)
  1797. {
  1798. if (ls_dp.Operator == in_ParticleState)
  1799. {
  1800. icount++;
  1801. }
  1802. }
  1803. return icount;
  1804. }
  1805. /// <summary>
  1806. /// 获取所有原图
  1807. /// </summary>
  1808. /// <param name="args"></param>
  1809. /// <returns></returns>
  1810. private void GetPic(PaintEventArgs args)
  1811. {
  1812. //将原图读取到内存中
  1813. if (originalImages.Count == 0)
  1814. {
  1815. string path = resultFile.FilePath;
  1816. System.IO.DirectoryInfo theFolder = new System.IO.DirectoryInfo(path + "\\FIELD_FILES");
  1817. foreach (System.IO.FileInfo nextifile in theFolder.GetFiles())
  1818. {
  1819. if (nextifile.Name.Contains(".bmp") == true || nextifile.Name.Contains(".BMP") == true)
  1820. {
  1821. Image image = Image.FromFile(path + "\\FIELD_FILES\\" + nextifile.Name);
  1822. originalImageNames.Add(nextifile.Name);
  1823. originalImages.Add(image);
  1824. }
  1825. }
  1826. }
  1827. //绘制原图的大小和位置
  1828. if (m_list_dfield.Count > 0)
  1829. {
  1830. if (originalImageNames.Count > 0)
  1831. {
  1832. for (int i = 0; i < originalImageNames.Count; i++)
  1833. {
  1834. Size size = new Size();
  1835. string ImageName = originalImageNames[i].ToString();
  1836. Image Image = originalImages[i];
  1837. string result = System.Text.RegularExpressions.Regex.Replace(ImageName, @"[^0-9]+", "");
  1838. size.Height = (int)m_list_dfield[Convert.ToInt32(result)].Current_Rect.Height;
  1839. size.Width = (int)m_list_dfield[Convert.ToInt32(result)].Current_Rect.Width;
  1840. Bitmap bitmap = new Bitmap(Image, size);
  1841. PointF pointF = new PointF();
  1842. pointF.X = m_list_dfield[Convert.ToInt32(result)].Current_Rect.X;
  1843. pointF.Y = m_list_dfield[Convert.ToInt32(result)].Current_Rect.Y;
  1844. args.Graphics.DrawImage(bitmap, pointF);
  1845. }
  1846. }
  1847. }
  1848. }
  1849. private void ResetPicturePosition()
  1850. {
  1851. DirectoryInfo info = new DirectoryInfo(resultFile.FilePath + "\\FIELD_FILES");
  1852. int count = info.GetFiles("*.bmp").Length;
  1853. //m_list_dfield.Clear();
  1854. //for (int i=0;i< count;i++)
  1855. //{
  1856. // m_list_dfield[i].Current_Rect.X
  1857. //}
  1858. }
  1859. #endregion
  1860. #region Debug下执行的辅助测试代码
  1861. private void Control_DrawDistrbutionImageAndBSE_MouseDoubleClick(object sender, MouseEventArgs e)
  1862. {
  1863. #if DEBUG
  1864. Screen[] screens = Screen.AllScreens;
  1865. string ls_str = "";
  1866. for (int i = 0; i < screens.Count(); i++)
  1867. {
  1868. ls_str = ls_str + "显示器" + (i + 1).ToString() + " 名称:" + screens[i].DeviceName + Environment.NewLine +
  1869. "显示器" + (i + 1).ToString() + " 是否主要显示器:" + screens[i].Primary + Environment.NewLine +
  1870. "显示器" + (i + 1).ToString() + " WorkingArea:" + screens[i].WorkingArea + Environment.NewLine +
  1871. "显示器" + (i + 1).ToString() + " Bounds:" + screens[i].Bounds + Environment.NewLine +
  1872. "显示器" + (i + 1).ToString() + " 色深:" + screens[i].BitsPerPixel + Environment.NewLine;
  1873. }
  1874. MessageBox.Show("------------------该段代码主要用来测试程序---------------------" + Environment.NewLine +
  1875. //"当前窗体X:" + this.ParentForm.Location.X.ToString() + " Y:" + this.ParentForm.Location.Y.ToString() + Environment.NewLine +
  1876. "显示器数量" + Screen.AllScreens.Count().ToString() + Environment.NewLine +
  1877. ls_str +
  1878. "DESKTOP.Width:" + MyPrimaryScreen.DESKTOP.Width + " DESKTOP.Height:" + MyPrimaryScreen.DESKTOP.Height + Environment.NewLine +
  1879. "DpiX:" + MyPrimaryScreen.DpiX + " DpiY:" + MyPrimaryScreen.DpiY + Environment.NewLine +
  1880. "ScaleX:" + MyPrimaryScreen.ScaleX + " ScaleY:" + MyPrimaryScreen.ScaleY + Environment.NewLine +
  1881. "WorkingArea.Width:" + MyPrimaryScreen.WorkingArea.Width + " WorkingArea.Height:" + MyPrimaryScreen.WorkingArea.Height + Environment.NewLine +
  1882. "this.Width:" + this.Width + " this.Height:" + this.Height + Environment.NewLine +
  1883. "单像素比:" + m_f_onepixel_size.ToString() + Environment.NewLine +
  1884. "缩放倍数:" + m_f_zoom_record.ToString() + Environment.NewLine +
  1885. "屏幕像素backrectf x:" + m_backrectf.X.ToString() + " y:" + m_backrectf.Y.ToString() + " width:" + m_backrectf.Width.ToString() + " height:" + m_backrectf.Height.ToString() + Environment.NewLine +
  1886. "屏幕像素oldbackrectf x:" + m_old_backrectf.X.ToString() + " y:" + m_old_backrectf.Y.ToString() + " width:" + m_old_backrectf.Width.ToString() + " height:" + m_old_backrectf.Height.ToString() + Environment.NewLine +
  1887. "物理像素back_wl_rectf x:" + m_back_wl_rectf.X.ToString() + " y:" + m_back_wl_rectf.Y.ToString() + " width:" + m_back_wl_rectf.Width.ToString() + " height:" + m_back_wl_rectf.Height.ToString() + Environment.NewLine +
  1888. "单个Field视域屏幕像素宽:" + m_OneField_Screen_BackRectf.Width.ToString() + " 高:" + m_OneField_Screen_BackRectf.Height.ToString() + Environment.NewLine +
  1889. "单个OTS视域屏幕像素宽:" + m_OneField_OTS_Rectf.Width.ToString() + " 高:" + m_OneField_OTS_Rectf.Height.ToString() + Environment.NewLine +
  1890. "屏幕像素backrectf x:" + m_backrectf.X.ToString() + " y:" + m_backrectf.Y.ToString() + " width:" + m_backrectf.Width.ToString() + " height:" + m_backrectf.Height.ToString() + Environment.NewLine +
  1891. "包含Field数量:" + m_ReportFun.m_field_count.ToString() + " Particle数量:" + m_ReportFun.m_particle_count.ToString() + Environment.NewLine +
  1892. "正常显示Paticle数量:" + GetParticleNumberByState(ParticleOperator.DISPLAY).ToString() + " 不显示Particel数量:" + GetParticleNumberByState(ParticleOperator.NODISPLAY).ToString() + Environment.NewLine +
  1893. //"删除Particle数量:" + GetParticleNumberByState("删除").ToString() + " 选中Particle数量:" + GetParticleNumberByState("选择").ToString() + Environment.NewLine +
  1894. "加载底层数据用时:" + m_ReportFun.m_time_str + Environment.NewLine +
  1895. "组建并计算图像用时:" + m_ReportFun.m_time_str2 + Environment.NewLine +
  1896. "---------------------------END----------------------------------"
  1897. );
  1898. #endif
  1899. }
  1900. #endregion
  1901. }
  1902. }