MethodCutOffDialog.cs 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  1. using OpenCvSharp;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Windows.Forms;
  8. namespace PaintDotNet.DedicatedAnalysis.GrainSizeStandard.GBT32461
  9. {
  10. internal class MethodCutOffDialog : GrainSizeStandardDialog
  11. {
  12. /// <summary>
  13. /// 测定结果暂存
  14. /// </summary>
  15. private List<DataTable> dataTable1s = new List<DataTable>();
  16. /// <summary>
  17. /// 储存点击保存结果后的所有原图与分析图
  18. /// </summary>
  19. private Dictionary<string, List<Bitmap>> bitCeDingDic = new Dictionary<string, List<Bitmap>>();
  20. #region 组件
  21. private RadioButton radioButton_DarkGray;
  22. private GroupBox groupBox10;
  23. private Button button10;
  24. private Button button7_0;
  25. private GroupBox groupBox11;
  26. private CheckBox checkBox5_0;
  27. private CheckBox checkBox4;
  28. private CheckBox checkBox3_0;
  29. private DataGridViewTextBoxColumn ColumnTotal1;
  30. private DataGridViewTextBoxColumn ColumnTotal2;
  31. private DataGridViewTextBoxColumn ColumnTotal3;
  32. private Button button1;
  33. private Button button4;
  34. private DataGridView dataGridView1;
  35. private GroupBox groupBox5;
  36. private DataGridViewTextBoxColumn Column11;
  37. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
  38. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
  39. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
  40. private Button button8;
  41. private Button button6_0;
  42. #endregion 组件
  43. /// <summary>
  44. /// 声明构造函数
  45. /// </summary>
  46. /// <param name="appWorkspace"></param>
  47. /// <param name="dialogText"></param>
  48. public MethodCutOffDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem) : base(appWorkspace, menuItem, null, 0)
  49. {
  50. }
  51. #region 初始化组件
  52. private void InitializeLanguageText()
  53. {
  54. this.radioButton_DarkGray.Text = PdnResources.GetString("Menu.Darkgray.text");
  55. this.groupBox10.Text = PdnResources.GetString("Menu.sectionoperation.text");
  56. this.button8.Text = PdnResources.GetString("Menu.1.5/2section.text");
  57. this.button6_0.Text = PdnResources.GetString("Menu.0.5section.text");
  58. this.button10.Text = PdnResources.GetString("Menu.Setting.Text");
  59. this.button7_0.Text = PdnResources.GetString("Menu.1section.text");
  60. this.groupBox11.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
  61. this.checkBox5_0.Text = PdnResources.GetString("Menu.displaysections.text");
  62. this.checkBox4.Text = PdnResources.GetString("Menu.displaygrid.text");
  63. this.checkBox3_0.Text = PdnResources.GetString("Menu.displaygrainboundaries.text");
  64. this.button1.Text = PdnResources.GetString("Menu.Savemeasurementresults.text");
  65. this.button4.Text = PdnResources.GetString("Menu.Deletemeasurementresult.text");
  66. this.Column11.HeaderText = PdnResources.GetString("Menu.Tools.GridLine.Text");
  67. this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Lengthofdetectionline.text");
  68. this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Nnlines.text");
  69. this.dataGridViewTextBoxColumn4.HeaderText = PdnResources.GetString("Menu.Thenumberofsections.text");
  70. this.groupBox5.Text = PdnResources.GetString("Menu.measurementresults.text");
  71. this.Text = "GBT32461(" + PdnResources.GetString("Menu.Interceptmethod.text") + ")";
  72. this.ColumnTotal1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  73. this.ColumnTotal2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  74. this.ColumnTotal3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  75. this.dataGridView_Total.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  76. this.ColumnTotal1,
  77. this.ColumnTotal2,
  78. this.ColumnTotal3});
  79. //
  80. // ColumnTotal1
  81. //
  82. this.ColumnTotal1.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Gridsize.text") + "(μm)";
  83. this.ColumnTotal1.Name = "ColumnTotal1";
  84. this.ColumnTotal1.ReadOnly = true;
  85. //
  86. // ColumnTotal2
  87. //
  88. this.ColumnTotal2.HeaderText = PdnResources.GetString("Menu.Numberofgrains.text");
  89. this.ColumnTotal2.Name = "ColumnTotal2";
  90. this.ColumnTotal2.ReadOnly = true;
  91. //
  92. // ColumnTotal3
  93. //
  94. this.ColumnTotal3.HeaderText = PdnResources.GetString("Menu.Averagegrainsizegrade.text");
  95. this.ColumnTotal3.Name = "ColumnTotal3";
  96. this.ColumnTotal3.ReadOnly = true;
  97. }
  98. private void InitializeComponent()
  99. {
  100. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  101. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
  102. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
  103. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
  104. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
  105. this.radioButton_DarkGray = new System.Windows.Forms.RadioButton();
  106. this.groupBox10 = new System.Windows.Forms.GroupBox();
  107. this.button8 = new System.Windows.Forms.Button();
  108. this.button6_0 = new System.Windows.Forms.Button();
  109. this.button10 = new System.Windows.Forms.Button();
  110. this.button7_0 = new System.Windows.Forms.Button();
  111. this.groupBox11 = new System.Windows.Forms.GroupBox();
  112. this.checkBox5_0 = new System.Windows.Forms.CheckBox();
  113. this.checkBox4 = new System.Windows.Forms.CheckBox();
  114. this.checkBox3_0 = new System.Windows.Forms.CheckBox();
  115. this.button1 = new System.Windows.Forms.Button();
  116. this.button4 = new System.Windows.Forms.Button();
  117. this.dataGridView1 = new System.Windows.Forms.DataGridView();
  118. this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  119. this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  120. this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  121. this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  122. this.groupBox5 = new System.Windows.Forms.GroupBox();
  123. this.groupBox_analysisResult1.SuspendLayout();
  124. this.groupBox10.SuspendLayout();
  125. this.groupBox11.SuspendLayout();
  126. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
  127. this.groupBox5.SuspendLayout();
  128. this.SuspendLayout();
  129. //
  130. // groupBox_img
  131. //
  132. this.groupBox_img.Size = new System.Drawing.Size(158, 428);
  133. //
  134. // groupBox_review
  135. //
  136. this.groupBox_review.Size = new System.Drawing.Size(575, 428);
  137. //
  138. // groupBox_report
  139. //
  140. this.groupBox_report.Location = new System.Drawing.Point(974, 506);
  141. //
  142. // groupBox6groupBox_analysisResult2
  143. //
  144. this.groupBox6groupBox_analysisResult2.Location = new System.Drawing.Point(242, 506);
  145. //
  146. // groupBox_analysisResult1
  147. //
  148. this.groupBox_analysisResult1.Location = new System.Drawing.Point(12, 506);
  149. //
  150. // radioButton_DarkGray
  151. //
  152. this.radioButton_DarkGray.AutoSize = true;
  153. this.radioButton_DarkGray.Location = new System.Drawing.Point(178, 20);
  154. this.radioButton_DarkGray.Name = "radioButton_DarkGray";
  155. this.radioButton_DarkGray.Size = new System.Drawing.Size(59, 16);
  156. this.radioButton_DarkGray.TabIndex = 38;
  157. this.radioButton_DarkGray.TabStop = true;
  158. this.radioButton_DarkGray.UseVisualStyleBackColor = true;
  159. //
  160. // groupBox10
  161. //
  162. this.groupBox10.Controls.Add(this.button8);
  163. this.groupBox10.Controls.Add(this.button6_0);
  164. this.groupBox10.Controls.Add(this.button10);
  165. this.groupBox10.Controls.Add(this.button7_0);
  166. this.groupBox10.Location = new System.Drawing.Point(179, 375);
  167. this.groupBox10.Name = "groupBox10";
  168. this.groupBox10.Size = new System.Drawing.Size(208, 89);
  169. this.groupBox10.TabIndex = 38;
  170. this.groupBox10.TabStop = false;
  171. //
  172. // button8
  173. //
  174. this.button8.BackColor = System.Drawing.SystemColors.Control;
  175. this.button8.Location = new System.Drawing.Point(107, 50);
  176. this.button8.Name = "button8";
  177. this.button8.Size = new System.Drawing.Size(95, 26);
  178. this.button8.TabIndex = 13;
  179. this.button8.UseVisualStyleBackColor = false;
  180. this.button8.Click += new System.EventHandler(this.button8_Click);
  181. //
  182. // button6_0
  183. //
  184. this.button6_0.BackColor = System.Drawing.SystemColors.Control;
  185. this.button6_0.Location = new System.Drawing.Point(6, 51);
  186. this.button6_0.Name = "button6_0";
  187. this.button6_0.Size = new System.Drawing.Size(95, 26);
  188. this.button6_0.TabIndex = 12;
  189. this.button6_0.UseVisualStyleBackColor = false;
  190. this.button6_0.Click += new System.EventHandler(this.button6_0_Click);
  191. //
  192. // button10
  193. //
  194. this.button10.BackColor = System.Drawing.SystemColors.Control;
  195. this.button10.Location = new System.Drawing.Point(107, 20);
  196. this.button10.Name = "button10";
  197. this.button10.Size = new System.Drawing.Size(95, 26);
  198. this.button10.TabIndex = 11;
  199. this.button10.UseVisualStyleBackColor = false;
  200. this.button10.Click += new System.EventHandler(this.button10_Click);
  201. //
  202. // button7_0
  203. //
  204. this.button7_0.BackColor = System.Drawing.SystemColors.Control;
  205. this.button7_0.Location = new System.Drawing.Point(6, 20);
  206. this.button7_0.Name = "button7_0";
  207. this.button7_0.Size = new System.Drawing.Size(95, 26);
  208. this.button7_0.TabIndex = 8;
  209. this.button7_0.UseVisualStyleBackColor = false;
  210. this.button7_0.Click += new System.EventHandler(this.button7_0_Click);
  211. //
  212. // groupBox11
  213. //
  214. this.groupBox11.Controls.Add(this.checkBox5_0);
  215. this.groupBox11.Controls.Add(this.checkBox4);
  216. this.groupBox11.Controls.Add(this.checkBox3_0);
  217. this.groupBox11.Location = new System.Drawing.Point(393, 375);
  218. this.groupBox11.Name = "groupBox11";
  219. this.groupBox11.Size = new System.Drawing.Size(142, 89);
  220. this.groupBox11.TabIndex = 39;
  221. this.groupBox11.TabStop = false;
  222. //
  223. // checkBox5_0
  224. //
  225. this.checkBox5_0.AutoSize = true;
  226. this.checkBox5_0.Checked = true;
  227. this.checkBox5_0.CheckState = System.Windows.Forms.CheckState.Checked;
  228. this.checkBox5_0.Location = new System.Drawing.Point(15, 59);
  229. this.checkBox5_0.Name = "checkBox5_0";
  230. this.checkBox5_0.Size = new System.Drawing.Size(15, 14);
  231. this.checkBox5_0.TabIndex = 2;
  232. this.checkBox5_0.UseVisualStyleBackColor = true;
  233. this.checkBox5_0.CheckedChanged += new System.EventHandler(this.checkBox5_0_CheckedChanged);
  234. //
  235. // checkBox4
  236. //
  237. this.checkBox4.AutoSize = true;
  238. this.checkBox4.Checked = true;
  239. this.checkBox4.CheckState = System.Windows.Forms.CheckState.Checked;
  240. this.checkBox4.Location = new System.Drawing.Point(15, 37);
  241. this.checkBox4.Name = "checkBox4";
  242. this.checkBox4.Size = new System.Drawing.Size(15, 14);
  243. this.checkBox4.TabIndex = 1;
  244. this.checkBox4.UseVisualStyleBackColor = true;
  245. this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
  246. //
  247. // checkBox3_0
  248. //
  249. this.checkBox3_0.AutoSize = true;
  250. this.checkBox3_0.Checked = true;
  251. this.checkBox3_0.CheckState = System.Windows.Forms.CheckState.Checked;
  252. this.checkBox3_0.Location = new System.Drawing.Point(15, 15);
  253. this.checkBox3_0.Name = "checkBox3_0";
  254. this.checkBox3_0.Size = new System.Drawing.Size(15, 14);
  255. this.checkBox3_0.TabIndex = 0;
  256. this.checkBox3_0.UseVisualStyleBackColor = true;
  257. this.checkBox3_0.CheckedChanged += new System.EventHandler(this.checkBox3_0_CheckedChanged);
  258. //
  259. // button1
  260. //
  261. this.button1.BackColor = System.Drawing.SystemColors.Control;
  262. this.button1.Location = new System.Drawing.Point(139, 11);
  263. this.button1.Name = "button1";
  264. this.button1.Size = new System.Drawing.Size(101, 23);
  265. this.button1.TabIndex = 5;
  266. this.button1.UseVisualStyleBackColor = false;
  267. this.button1.Click += new System.EventHandler(this.button1_Click);
  268. //
  269. // button4
  270. //
  271. this.button4.BackColor = System.Drawing.SystemColors.Control;
  272. this.button4.Location = new System.Drawing.Point(246, 11);
  273. this.button4.Name = "button4";
  274. this.button4.Size = new System.Drawing.Size(101, 23);
  275. this.button4.TabIndex = 4;
  276. this.button4.UseVisualStyleBackColor = false;
  277. this.button4.Click += new System.EventHandler(this.button4_Click);
  278. //
  279. // dataGridView1
  280. //
  281. this.dataGridView1.AllowUserToAddRows = false;
  282. this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  283. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  284. dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
  285. dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  286. dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
  287. dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  288. dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  289. dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  290. this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
  291. this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  292. this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  293. this.Column11,
  294. this.dataGridViewTextBoxColumn1,
  295. this.dataGridViewTextBoxColumn2,
  296. this.dataGridViewTextBoxColumn4});
  297. this.dataGridView1.Location = new System.Drawing.Point(6, 36);
  298. this.dataGridView1.MultiSelect = false;
  299. this.dataGridView1.Name = "dataGridView1";
  300. this.dataGridView1.ReadOnly = true;
  301. this.dataGridView1.RowHeadersVisible = false;
  302. this.dataGridView1.RowTemplate.Height = 23;
  303. this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  304. this.dataGridView1.Size = new System.Drawing.Size(341, 103);
  305. this.dataGridView1.TabIndex = 29;
  306. //
  307. // Column11
  308. //
  309. dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  310. this.Column11.DefaultCellStyle = dataGridViewCellStyle2;
  311. this.Column11.Name = "Column11";
  312. this.Column11.ReadOnly = true;
  313. this.Column11.Width = 66;
  314. //
  315. // dataGridViewTextBoxColumn1
  316. //
  317. dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  318. this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle3;
  319. this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
  320. this.dataGridViewTextBoxColumn1.ReadOnly = true;
  321. //
  322. // dataGridViewTextBoxColumn2
  323. //
  324. dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  325. this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle4;
  326. this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
  327. this.dataGridViewTextBoxColumn2.ReadOnly = true;
  328. //
  329. // dataGridViewTextBoxColumn4
  330. //
  331. dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  332. this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle5;
  333. this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
  334. this.dataGridViewTextBoxColumn4.ReadOnly = true;
  335. this.dataGridViewTextBoxColumn4.Width = 72;
  336. //
  337. // groupBox5
  338. //
  339. this.groupBox5.Controls.Add(this.dataGridView1);
  340. this.groupBox5.Controls.Add(this.button4);
  341. this.groupBox5.Controls.Add(this.button1);
  342. this.groupBox5.Location = new System.Drawing.Point(179, 472);
  343. this.groupBox5.Name = "groupBox5";
  344. this.groupBox5.Size = new System.Drawing.Size(355, 145);
  345. this.groupBox5.TabIndex = 40;
  346. this.groupBox5.TabStop = false;
  347. //
  348. // MethodCutOffDialog
  349. //
  350. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  351. this.ClientSize = new System.Drawing.Size(1127, 980);
  352. this.Controls.Add(this.groupBox5);
  353. this.Controls.Add(this.groupBox10);
  354. this.Controls.Add(this.groupBox11);
  355. this.Name = "MethodCutOffDialog";
  356. this.Load += new System.EventHandler(this.MethodCutOffDialog_Load);
  357. this.Controls.SetChildIndex(this.groupBox11, 0);
  358. this.Controls.SetChildIndex(this.groupBox10, 0);
  359. this.Controls.SetChildIndex(this.groupBox5, 0);
  360. this.Controls.SetChildIndex(this.groupBox6groupBox_analysisResult2, 0);
  361. this.Controls.SetChildIndex(this.groupBox_img, 0);
  362. this.Controls.SetChildIndex(this.groupBox_review, 0);
  363. this.Controls.SetChildIndex(this.groupBox_analysisResult1, 0);
  364. this.Controls.SetChildIndex(this.groupBox_report, 0);
  365. this.groupBox_analysisResult1.ResumeLayout(false);
  366. this.groupBox10.ResumeLayout(false);
  367. this.groupBox11.ResumeLayout(false);
  368. this.groupBox11.PerformLayout();
  369. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  370. this.groupBox5.ResumeLayout(false);
  371. this.ResumeLayout(false);
  372. }
  373. #endregion 初始化组件
  374. #region 需继承方法
  375. protected override void refreshWhileImgChanged()
  376. {
  377. object ShowGrainBoundry;
  378. if (GetParamValue1(ParamKey_displaygrainboundaries, out ShowGrainBoundry))//显示晶界
  379. this.checkBox3_0.Checked = (bool)ShowGrainBoundry;
  380. if (GetParamValue1(ParamKey_displaygrid, out ShowGrainBoundry))//显示网格
  381. this.checkBox4.Checked = (bool)ShowGrainBoundry;
  382. if (GetParamValue1(ParamKey_displaysections, out ShowGrainBoundry))//显示截点
  383. this.checkBox5_0.Checked = (bool)ShowGrainBoundry;
  384. if (this.dataGridView1.Rows.Count > 0)
  385. {
  386. foreach (DataGridViewRow gridViewRow in this.dataGridView1.Rows)
  387. {
  388. foreach (var dataTable in this.dataTable1s)
  389. {
  390. if (dataTable.TableName.Equals(gridViewRow.Tag))
  391. {
  392. this.dataTable1s.Remove(dataTable);
  393. break;
  394. }
  395. }
  396. if (bitCeDingDic.ContainsKey((string)gridViewRow.Tag))
  397. bitCeDingDic.Remove((string)gridViewRow.Tag);
  398. }
  399. this.dataGridView1.Rows.Clear();
  400. }
  401. }
  402. /// <summary>
  403. /// 保存结果
  404. /// </summary>
  405. protected override void buildListBox_analysisResult(string imagesKey, int analysisPicture, bool saveAll = false)
  406. {
  407. if (this.matOrg == null)
  408. {
  409. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  410. return;
  411. }
  412. if (this.dataGridView1.Rows.Count == 0)
  413. {
  414. MessageBox.Show(PdnResources.GetString("Menu.Nomeasurementresult.text"));
  415. return;
  416. }
  417. //if (this.comboBox1.SelectedItem == null || PdnResources.GetString("Menu.Pleaseselecttheauxiliarylineused.text").Equals(this.comboBox1.SelectedItem))
  418. //{
  419. // MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectauxiliaryline.text") + "!");
  420. // return;
  421. //}
  422. double value4Total = 0;
  423. foreach (DataGridViewRow Row in this.dataGridView1.Rows)
  424. {
  425. value4Total += double.Parse(Row.Cells[3].Value.ToString());//交点个数
  426. }
  427. if (value4Total == 0)//###20791
  428. {
  429. MessageBox.Show("请添加截点后保存结果"/*PdnResources.GetString("Menu.Nomeasurementresult.text")*/);
  430. return;
  431. }
  432. string imgName = getCurrentWorkspace().GetFriendlyName();
  433. string tag = getCurrentWorkTag();
  434. DataTable dataTable = new DataTable();
  435. bool replace = false;
  436. int add = 0;
  437. foreach (ListViewItem item in this.listView2.Items)
  438. {
  439. if (item.Tag.Equals(tag))
  440. {
  441. add++;
  442. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theresuethertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  443. if (dr == DialogResult.OK)
  444. {
  445. replace = true;
  446. }
  447. break;
  448. }
  449. }
  450. if (replace || this.listView2.Items.Count == 0 || add == 0)
  451. {
  452. if (!replace)
  453. {
  454. ListViewItem listViewItem = new ListViewItem();
  455. listViewItem.SubItems[0].Text = imgName;
  456. listViewItem.Tag = "" + tag;
  457. if (this.listView2.Items.Count == 0)
  458. this.listView2.Items.Add(listViewItem);
  459. else
  460. this.listView2.Items.Insert(0, listViewItem);
  461. }
  462. this.dataGridView2.Rows.Clear();
  463. DataGridViewRow dgvr = new DataGridViewRow();
  464. dgvr.Tag = tag;
  465. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  466. {
  467. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  468. }
  469. dgvr.Cells[0].Value = imgName;
  470. DataGridViewRow firRow = this.dataGridView1.Rows[0];
  471. object value1 = firRow.Cells[0].Value;//网格
  472. object value2 = firRow.Cells[1].Value;//网格长度
  473. object value3 = firRow.Cells[2].Value;//网格条数
  474. double value2Total = 0;
  475. foreach (DataGridViewRow Row in this.dataGridView1.Rows)
  476. {
  477. value2Total += (double.Parse(Row.Cells[1].Value.ToString()) * double.Parse(Row.Cells[2].Value.ToString()));//网格总长度
  478. }
  479. //double value4Total = 0;
  480. //foreach (DataGridViewRow Row in this.dataGridView1.Rows)
  481. //{
  482. // value4Total += double.Parse(Row.Cells[3].Value.ToString());//交点个数
  483. //}
  484. //if (value4Total == 0)//###20791
  485. //{
  486. // MessageBox.Show(PdnResources.GetString("Menu.Nomeasurementresult.text"));
  487. // return;
  488. //}
  489. ////double value4Per = value4Total / this.dataGridView1.Rows.Count;
  490. dgvr.Cells[1].Value = value1;
  491. dgvr.Cells[2].Value = value2Total;
  492. dgvr.Cells[3].Value = value4Total;
  493. //dgvr.Cells[4].Value = value4Per;//级别
  494. decimal M = 1;// this.getGainMultiple();
  495. double small_l = value2Total / (value4Total * (double)M);
  496. //毫米转微米
  497. decimal A = Convert.ToDecimal(small_l * 1);
  498. //dgvr.Cells[4].Value = small_l;// Math.Round(A, Convert.ToInt32(this.numericUpDown1_0.Value));
  499. double[] lengths = {453, 320 , 269, 226, 190, 177, 160, 135, 113, 106,
  500. 95.0, 89.0, 80.0, 67.3, 62.0, 56.6, 53.2, 47.6, 44.3, 40.0, 35.4, 33.6, 31.0,
  501. 28.3, 26.6 , 23.8, 22.2, 20.0, 17.7, 16.8, 14.1, 13.3, 11.9,
  502. 10.0, 8.86, 8.41, 7.98, 7.07, 6.20, 5.95, 5.32, 5.00, 4.43, 4.20, 3.54, 2.97
  503. , 2.66, 2.50, 2.22};
  504. // 差值
  505. decimal differenceNew;
  506. decimal differenceOld = Math.Abs(Convert.ToDecimal(Math.Max((double)A - 1.22, (double)A - 454)));
  507. int first = 0;
  508. if ((double)A < lengths[lengths.Length - 1])
  509. first = lengths.Length - 1;
  510. else
  511. for (int firstI = 0; firstI < lengths.Length; firstI++)
  512. {
  513. double item = lengths[firstI];
  514. differenceNew = Math.Abs(A - Convert.ToDecimal(item));
  515. if (differenceNew < differenceOld)
  516. {
  517. differenceOld = Math.Abs(A - Convert.ToDecimal(item));
  518. first = firstI;
  519. }
  520. }
  521. string[] valueG = {"00A", "0" , "0.5", "1.0", "1.5", "1.5"/**/, "2.0", "2.5", "3.0", "3.0",
  522. "3.5", "3.5", "4.0", "4.5", "4.5", "5.0", "5.0", "5.5", "5.5", "6.0", "6.0", "6.5", "6.5",
  523. "7.0", "7.0" , "7.5", "7.5", "8.0", "8.0", "8.5", "9.0", "9.0", "9.5",
  524. "10.0", "10.0", "10.5", "10.5", "11.0", "11.0", "11.5", "11.5", "12.0", "12.0", "12.5", "13.0", "13.5"
  525. , "13.5", "14.0", "14.0"};
  526. dgvr.Cells[4].Value = valueG[first];
  527. this.dataGridView2.Rows.Add(dgvr);
  528. dataTable.TableName = tag;
  529. foreach (System.Data.DataTable dataTable1 in dataTables)
  530. {
  531. if (dataTable1.TableName.Equals(dataTable.TableName))
  532. {
  533. dataTables.Remove(dataTable1);
  534. break;
  535. }
  536. }
  537. for (int i = 0; i < this.dataGridView2.Columns.Count; i++)
  538. {
  539. dataTable.Columns.Add("" + i);
  540. }
  541. DataRow dataRow = dataTable.NewRow();
  542. dataRow["0"] = imgName;
  543. dataRow["1"] = dgvr.Cells[1].Value;// "网格1";
  544. dataRow["2"] = dgvr.Cells[2].Value;
  545. dataRow["3"] = dgvr.Cells[3].Value;
  546. dataRow["4"] = dgvr.Cells[4].Value;
  547. //dataRow["5"] = dgvr.Cells[5].Value;
  548. //dataRow["6"] = dgvr.Cells[6].Value;
  549. dataTable.Rows.Add(dataRow);
  550. this.dataTables.Add(dataTable);
  551. if (this.allShow)
  552. AllShow();
  553. this.RefreshDataGridView4();
  554. //保存处理后的图片
  555. double pantographRatio = this.appWorkspace.DocumentWorkspaces[this.selectPicture].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  556. List<Bitmap> tempBit = new List<Bitmap>();
  557. //Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  558. //tempBit.Add(originalBit);
  559. //Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  560. //Graphics graphics = Graphics.FromImage(newBit);
  561. //Draw(graphics);
  562. //tempBit.Add(newBit);
  563. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitCeDingDic)
  564. {
  565. kv.Value[0].Tag = pantographRatio;
  566. kv.Value[1].Tag = pantographRatio;
  567. tempBit.Add(kv.Value[0]);
  568. tempBit.Add(kv.Value[1]);
  569. }
  570. if (bitDic.ContainsKey(tag))
  571. bitDic[tag] = tempBit;
  572. else
  573. bitDic.Add(tag, tempBit);
  574. //中间数据-拼接中间数据
  575. List<List<string>> dataList = new List<List<string>>();
  576. List<string> columnName = new List<string>();
  577. columnName.Add(PdnResources.GetString("Menu.Tools.GridLine.Text"));
  578. columnName.Add(PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Lengthofdetectionline.text"));
  579. columnName.Add(PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Nnlines.text"));
  580. columnName.Add(PdnResources.GetString("Menu.Thenumberofsections.text"));
  581. dataList.Add(columnName);
  582. foreach (DataGridViewRow Row in this.dataGridView1.Rows)
  583. {
  584. List<string> strList = new List<string>();
  585. strList.Add(Row.Cells[0].Value.ToString());
  586. strList.Add(Row.Cells[1].Value.ToString());
  587. strList.Add(Row.Cells[2].Value.ToString());
  588. strList.Add(Row.Cells[3].Value.ToString());
  589. dataList.Add(strList);
  590. }
  591. bool isExist = false;//是否已存在进行替换
  592. int modelIndex = -1;//要替换的下标
  593. for (int j = 0; j < tempDataModel.Count; j++)
  594. {
  595. if (tempDataModel[j].tagName.Equals(tag))
  596. {
  597. isExist = true;
  598. modelIndex = j;
  599. break;
  600. }
  601. }
  602. if (isExist && modelIndex > -1)
  603. tempDataModel[modelIndex].dataList = dataList;
  604. else
  605. {
  606. Base.Functionodel.ExportProjectModel newModel = new Base.Functionodel.ExportProjectModel();
  607. newModel.tagName = tag;
  608. newModel.picName = imgName;
  609. newModel.dataList = dataList;
  610. tempDataModel.Add(newModel);
  611. }
  612. }
  613. }
  614. /// <summary>
  615. /// 是否显示晶界
  616. /// </summary>
  617. /// <returns></returns>
  618. protected override Boolean ShowGrainBoundryChecked()
  619. {
  620. return checkBox3_0.Checked;
  621. }
  622. //是否绘制辅助线
  623. protected override bool showGridChecked()
  624. {
  625. return checkBox4.Checked;
  626. }
  627. //是否绘制截点
  628. protected override bool drawGuidePoints()
  629. {
  630. return (matOrg != null && this.checkBox5_0.Checked);
  631. }
  632. //是否显示截点
  633. protected override Boolean drawDisplaySections()//##1
  634. {
  635. return this.checkBox5_0.Checked;
  636. }
  637. //辅助线类型
  638. protected override string[] getTypeNames()
  639. {
  640. return new string[] {
  641. PdnResources.GetString("Menu.Verticalauxiliaryline.text"),
  642. PdnResources.GetString("Menu.Horizontalauxiliaryline.text")};
  643. }
  644. protected override string getModelName()
  645. {
  646. return "GrainGBT32461CutOffMethodModel.xml";
  647. }
  648. protected override string getTemplateName()
  649. {
  650. return "Template.Manager.item3.GrainSizeCutOff_GBT32461";
  651. }
  652. protected override string getProjectEngineeringName()
  653. {
  654. return "Menu.DedicatedAnalysis.NonferrousMetal.AluminiumAlloy.Text";
  655. }
  656. protected override void SubclassInitialize()
  657. {
  658. InitializeComponent();
  659. InitializeLanguageText();
  660. }
  661. #endregion
  662. private DataGridViewTextBoxColumn Column1;
  663. private DataGridViewTextBoxColumn Column2;
  664. private DataGridViewTextBoxColumn Column3;
  665. private DataGridViewTextBoxColumn Column4;
  666. private DataGridViewTextBoxColumn Column5;
  667. private void MethodCutOffDialog_Load(object sender, EventArgs e)
  668. {
  669. this.button_ApplyToAll.Visible = false;
  670. this.button_SaveAll.Visible = false;
  671. this.btn_Grainboundarytoreproduce.Location = new System.Drawing.Point(912, 20);
  672. this.btn_saveresult.Location = new System.Drawing.Point(993, 20);
  673. object ShowGrainBoundry;
  674. if (GetParamValue1(ParamKey_displaygrainboundaries, out ShowGrainBoundry))//显示晶界
  675. this.checkBox3_0.Checked = (bool)ShowGrainBoundry;
  676. if (GetParamValue1(ParamKey_displaygrid, out ShowGrainBoundry))//显示网格
  677. this.checkBox4.Checked = (bool)ShowGrainBoundry;
  678. if (GetParamValue1(ParamKey_displaysections, out ShowGrainBoundry))//显示截点
  679. this.checkBox5_0.Checked = (bool)ShowGrainBoundry;
  680. this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  681. this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  682. this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  683. this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  684. this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  685. this.Column1.Name = "Column1";
  686. this.Column1.ReadOnly = true;
  687. //
  688. // Column2
  689. //
  690. this.Column2.Name = "Column2";
  691. this.Column2.ReadOnly = true;
  692. //
  693. // Column3
  694. //
  695. this.Column3.Name = "Column3";
  696. this.Column3.ReadOnly = true;
  697. //
  698. // Column4
  699. //
  700. this.Column4.Name = "Column4";
  701. this.Column4.ReadOnly = true;
  702. //
  703. // Column5
  704. //
  705. this.Column5.Name = "Column5";
  706. this.Column5.ReadOnly = true;
  707. this.Column5.HeaderText = PdnResources.GetString("Menu.Averagegrainsizegrade.text");
  708. this.Column4.HeaderText = PdnResources.GetString("Menu.Numberofgrains.text");
  709. this.Column3.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Gridsize.text") + "(μm)";
  710. this.Column2.HeaderText = PdnResources.GetString("Menu.Tools.GridLine.Text");
  711. this.Column1.HeaderText = PdnResources.GetString("Menu.picture.Text");
  712. this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  713. this.Column1,
  714. this.Column2,
  715. this.Column3,
  716. this.Column4,
  717. this.Column5});
  718. this.groupBox_img.Size = new System.Drawing.Size(158, 672);
  719. this.groupBox_review.Size = new System.Drawing.Size(575, 672);
  720. this.groupBox_analysisResult1.Location = new System.Drawing.Point(12, 750);
  721. this.groupBox6groupBox_analysisResult2.Location = new System.Drawing.Point(242, 750);
  722. this.groupBox_report.Location = new System.Drawing.Point(974, 750);
  723. DetailListStringIndex.Add(0);
  724. DetailListStringIndex.Add(1);
  725. DetailListStringIndex.Add(3);
  726. //DetailListStringIndex.Add(4);
  727. DetailListNotDoubleIndex.Add(0);
  728. DetailListNotDoubleIndex.Add(1);
  729. DetailListNotDoubleIndex.Add(3);
  730. IndexChangedFromIndex.Clear();
  731. IndexChangedToIndex.Clear();
  732. IndexChangedFromIndex.Add(2);
  733. IndexChangedFromIndex.Add(3);
  734. IndexChangedToIndex.Add(0, new int[] { 2, 0 });//平均
  735. IndexChangedToIndex.Add(1, new int[] { 2/*1*/, 1 });//平均<-求和
  736. IndexChangedToIndex.Add(2, new int[] { 3, -1 });//级别
  737. }
  738. /// <summary>
  739. /// 计算汇总列表的平均晶粒度级别
  740. /// </summary>
  741. /// <returns></returns>
  742. protected override string getGradeTotalCal(DataGridViewRow dgvr, int digits)
  743. {
  744. double value2Total = double.Parse(dgvr.Cells[0].Value.ToString());
  745. double value4Total = double.Parse(dgvr.Cells[1].Value.ToString());
  746. decimal M = 1;// this.getGainMultiple();
  747. double small_l = value2Total / (value4Total * (double)M);
  748. //毫米转微米
  749. decimal A = Convert.ToDecimal(small_l * 1);
  750. double[] lengths = {453, 320 , 269, 226, 190, 177, 160, 135, 113, 106,
  751. 95.0, 89.0, 80.0, 67.3, 62.0, 56.6, 53.2, 47.6, 44.3, 40.0, 35.4, 33.6, 31.0,
  752. 28.3, 26.6 , 23.8, 22.2, 20.0, 17.7, 16.8, 14.1, 13.3, 11.9,
  753. 10.0, 8.86, 8.41, 7.98, 7.07, 6.20, 5.95, 5.32, 5.00, 4.43, 4.20, 3.54, 2.97
  754. , 2.66, 2.50, 2.22};
  755. // 差值
  756. decimal differenceNew;
  757. decimal differenceOld = Math.Abs(Convert.ToDecimal(Math.Max((double)A - 1.22, (double)A - 454)));
  758. int first = 0;
  759. if ((double)A < lengths[lengths.Length - 1])
  760. first = lengths.Length - 1;
  761. else
  762. for (int firstI = 0; firstI < lengths.Length; firstI++)
  763. {
  764. double item = lengths[firstI];
  765. differenceNew = Math.Abs(A - Convert.ToDecimal(item));
  766. if (differenceNew < differenceOld)
  767. {
  768. differenceOld = Math.Abs(A - Convert.ToDecimal(item));
  769. first = firstI;
  770. }
  771. }
  772. string[] valueG = {"00A", "0" , "0.5", "1.0", "1.5", "1.5", "2.0", "2.5", "3.0", "3.0",
  773. "3.5", "3.5", "4.0", "4.5", "4.5", "5.0", "5.0", "5.5", "5.5", "6.0", "6.0", "6.5", "6.5",
  774. "7.0", "7.0" , "7.5", "7.5", "8.0", "8.0", "8.5", "9.0", "9.0", "9.5",
  775. "10.0", "10.0", "10.5", "10.5", "11.0", "11.0", "11.5", "11.5", "12.0", "12.0", "12.5", "13.0", "13.5"
  776. , "13.5", "14.0", "14.0"};
  777. return valueG[first];
  778. }
  779. /// <summary>
  780. /// 是否显示网格
  781. /// </summary>
  782. /// <param name="sender"></param>
  783. /// <param name="e"></param>
  784. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  785. {
  786. this.documentWorkspace.Refresh();
  787. }
  788. /// <summary>
  789. /// 是否显示截点
  790. /// </summary>
  791. /// <param name="sender"></param>
  792. /// <param name="e"></param>
  793. private void checkBox5_0_CheckedChanged(object sender, EventArgs e)
  794. {
  795. if (!this.checkBox4.Checked)
  796. MessageBox.Show(PdnResources.GetString("Menu.Nogrid.text")+"!");
  797. this.documentWorkspace.Refresh();
  798. }
  799. /// <summary>
  800. /// 是否显示晶界
  801. /// </summary>
  802. /// <param name="sender"></param>
  803. /// <param name="e"></param>
  804. private void checkBox3_0_CheckedChanged(object sender, EventArgs e)
  805. {
  806. if (!showOrimat() && getGrainBoundryChecked() && checkBox3_0.Checked)
  807. {
  808. this.documentWorkspace.PhaseModels[1].choise = true;
  809. }
  810. else
  811. {
  812. this.documentWorkspace.PhaseModels[1].choise = false;
  813. }
  814. this.documentWorkspace.Refresh();
  815. }
  816. /// <summary>
  817. /// 设置截点样式
  818. /// </summary>
  819. /// <param name="sender"></param>
  820. /// <param name="e"></param>
  821. private void button10_Click(object sender, EventArgs e)
  822. {//###
  823. GrainSizeStandard.IntegrationClass.GrainSurveyPointStyleSettingDialog grainSurveyPointStyleSettingDialog = new GrainSizeStandard.IntegrationClass.GrainSurveyPointStyleSettingDialog();//###
  824. grainSurveyPointStyleSettingDialog.StartPosition = FormStartPosition.CenterScreen;
  825. grainSurveyPointStyleSettingDialog.ShowDialog(this);
  826. }
  827. /// <summary>
  828. /// 鼠标按下
  829. /// </summary>
  830. /// <param name="drawArea"></param>
  831. /// <param name="e"></param>
  832. protected override void OnMouseDown(object sender, MouseEventArgs e)
  833. {
  834. if (this.documentWorkspace.CompositionSurface == null)
  835. return;
  836. // 换算后的点
  837. PointF point1 = documentWorkspace.GetScalePoint(e.Location);
  838. if (point1.X <= this.documentWorkspace.CompositionSurface.Width
  839. && point1.X >= 0
  840. && point1.Y >= 0
  841. && point1.Y <= this.documentWorkspace.CompositionSurface.Height)
  842. {
  843. RectangleF rectangleF;
  844. // 复合辅助线
  845. int add = GSSClass.GuideClass.getAddOfRStyle(point1, this.comboBox1.SelectedItem, out rectangleF);
  846. if (add == 0 && GSSClass.styleClass.PointKb > 0)
  847. rectangleF = GSSClass.GuideClass.guideModel.RectangleFLine;
  848. //手动添加截点
  849. if (this.documentWorkspace.ActiveTool == Annotation.Enum.DrawToolType.InclusionNoEffect && GSSClass.styleClass.OnMouseDownNext(point1, sender, e))
  850. GSSClass.styleClass.OnMouseDownFirst(point1, rectangleF, GSSClass.standardModel.linePointList, sender, e);
  851. }
  852. if (GSSClass.styleClass.PointKb == 0)
  853. {
  854. //辅助线缩放
  855. GSSClass.GuideClass.OnMouseDown(point1, sender, e);
  856. //辅助线移动
  857. base.OnMouseDown(sender, e);//##
  858. }
  859. ////手动删除截点或取消添加截点
  860. //GSSClass.styleClass.OnMouseDownNext(point1, sender, e);
  861. }
  862. private int dataTable1sTagInc = 0;
  863. /// <summary>
  864. /// 保存测定结果
  865. /// </summary>
  866. /// <param name="sender"></param>
  867. /// <param name="e"></param>
  868. private void button1_Click(object sender, EventArgs e)
  869. {
  870. if (this.matOrg == null)
  871. {
  872. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  873. return;
  874. }
  875. if (this.comboBox1.SelectedItem == null || PdnResources.GetString("Menu.Pleaseselecttheauxiliarylineused.text").Equals(this.comboBox1.SelectedItem))
  876. {
  877. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectauxiliaryline.text") + "!");
  878. return;
  879. }
  880. DataTable dataTable = new DataTable();
  881. //this.dataGridView111114.Rows.Clear();
  882. DataGridViewRow dgvr = new DataGridViewRow();
  883. dataTable1sTagInc++;
  884. dgvr.Tag = dataTable1sTagInc + "";
  885. foreach (DataGridViewColumn c in this.dataGridView1.Columns)
  886. {
  887. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  888. }
  889. dgvr.Cells[0].Value = this.comboBox1.SelectedItem;
  890. dgvr.Cells[1].Value = GSSClass.GuideClass.LineLength;
  891. dgvr.Cells[2].Value = GSSClass.GuideClass.LineDec;
  892. double countPoints = GSSClass.styleClass.styleModel.getCountPoints();
  893. dgvr.Cells[3].Value = countPoints;
  894. this.dataGridView1.Rows.Add(dgvr);
  895. dataTable.TableName = (string)dgvr.Tag;
  896. for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
  897. {
  898. dataTable.Columns.Add("" + i);
  899. }
  900. DataRow dataRow = dataTable.NewRow();
  901. dataRow["0"] = dgvr.Cells[0].Value;
  902. dataRow["1"] = dgvr.Cells[1].Value;
  903. dataRow["2"] = dgvr.Cells[2].Value;
  904. dataRow["3"] = countPoints;// Convert.ToDecimal(this.p1RectangleFs.Count) + Convert.ToDecimal(this.p2RectangleFs.Count) / 2;
  905. dataTable.Rows.Add(dataRow);
  906. this.dataTable1s.Add(dataTable);
  907. //保存处理后的图片
  908. List<Bitmap> tempBit = new List<Bitmap>();
  909. Bitmap originalBit = this.bitmap;// this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  910. tempBit.Add(originalBit);
  911. Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  912. Graphics graphics = Graphics.FromImage(newBit);
  913. if (this.documentWorkspace.PhaseModels[0].choise && this.documentWorkspace.PhaseModels[0].mat != null)
  914. {
  915. Mat targetMat = this.documentWorkspace.PhaseModels[0].mat;
  916. graphics.DrawImage(OpenCvSharp.Extensions.BitmapConverter.ToBitmap(targetMat), 0, 0, targetMat.Width, targetMat.Height);
  917. }
  918. if (this.documentWorkspace.PhaseModels[1].choise && this.documentWorkspace.PhaseModels[1].mat != null)
  919. {
  920. Mat targetMat = this.documentWorkspace.PhaseModels[1].mat;
  921. graphics.DrawImage(OpenCvSharp.Extensions.BitmapConverter.ToBitmap(targetMat), 0, 0, targetMat.Width, targetMat.Height);
  922. }
  923. graphics.SmoothingMode = SmoothingMode.AntiAlias;
  924. drawSubclass/*Draw*/(graphics);
  925. tempBit.Add(newBit);
  926. if (bitCeDingDic.ContainsKey((string)dgvr.Tag))
  927. bitCeDingDic[(string)dgvr.Tag] = tempBit;
  928. else
  929. bitCeDingDic.Add((string)dgvr.Tag, tempBit);
  930. }
  931. /// <summary>
  932. /// 删除测定结果
  933. /// </summary>
  934. /// <param name="sender"></param>
  935. /// <param name="e"></param>
  936. private void button4_Click(object sender, EventArgs e)
  937. {
  938. if (this.dataGridView1.Rows.Count > 0)
  939. {
  940. if (this.dataGridView1.SelectedRows.Count > 0)
  941. {
  942. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretcteddata.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  943. if (dr == DialogResult.OK)
  944. {
  945. DataGridViewRow gridViewRow = this.dataGridView1.SelectedRows[0];
  946. int selectIndex = gridViewRow.Index;
  947. foreach (var dataTable in this.dataTable1s)
  948. {
  949. if (dataTable.TableName.Equals(gridViewRow.Tag))
  950. {
  951. this.dataTable1s.Remove(dataTable);
  952. break;
  953. }
  954. }
  955. if (bitCeDingDic.ContainsKey((string)gridViewRow.Tag))
  956. bitCeDingDic.Remove((string)gridViewRow.Tag);
  957. this.dataGridView1.Rows.RemoveAt(selectIndex);
  958. //RefreshDataGridView1();
  959. }
  960. }
  961. else
  962. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectthedatatobedeleted.text")+"!");
  963. }
  964. else
  965. MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
  966. }
  967. private void AllShow()
  968. {
  969. this.dataGridView2.Rows.Clear();
  970. for (int i = 0; i < this.dataTables.Count; i++)
  971. {
  972. DataGridViewRow dgvr = new DataGridViewRow();
  973. dgvr.Tag = this.dataTables[i].TableName;
  974. foreach (DataGridViewColumn Column in this.dataGridView2.Columns)
  975. {
  976. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  977. }
  978. for (int c = 0; c < this.dataTables[i].Columns.Count; c++)
  979. {
  980. //if (c > 2 && c < 4)
  981. // dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.dataTables[i].Rows[0][c]), Convert.ToInt32(this.numericUpDown1_0.Value)).ToString();
  982. //else
  983. dgvr.Cells[c].Value = this.dataTables[i].Rows[0][c].ToString();
  984. }
  985. this.dataGridView2.Rows.Add(dgvr);
  986. }
  987. }
  988. /// <summary>
  989. /// 0.5截点添加
  990. /// </summary>
  991. /// <param name="sender"></param>
  992. /// <param name="e"></param>
  993. private void button6_0_Click(object sender, EventArgs e)
  994. {
  995. if (this.matOrg != null)
  996. GSSClass.styleClass.PointKb = 1;
  997. else
  998. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  999. }
  1000. /// <summary>
  1001. /// 1截点添加
  1002. /// </summary>
  1003. /// <param name="sender"></param>
  1004. /// <param name="e"></param>
  1005. private void button7_0_Click(object sender, EventArgs e)
  1006. {
  1007. if (this.matOrg != null)
  1008. GSSClass.styleClass.PointKb = 2;
  1009. else
  1010. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  1011. }
  1012. /// <summary>
  1013. /// 1.5截点添加
  1014. /// </summary>
  1015. /// <param name="sender"></param>
  1016. /// <param name="e"></param>
  1017. private void button8_Click(object sender, EventArgs e)
  1018. {
  1019. if (this.matOrg != null)
  1020. GSSClass.styleClass.PointKb = 3;
  1021. else
  1022. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  1023. }
  1024. }
  1025. }