PV6093Dialog.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. using PaintDotNet.Base.CommTool;
  2. using PaintDotNet.Base.DedicatedAnalysis.Porosity;
  3. using PaintDotNet.Base.DedicatedAnalysis.Porosity.Model;
  4. using PaintDotNet.Base.DedicatedAnalysis.Porosity.Standard.TypesOfAssessment;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.IO;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows.Forms;
  15. namespace PaintDotNet.DedicatedAnalysis.Porosity.PV6093
  16. {
  17. internal class PV6093Dialog :PorosityStandardDialog
  18. {
  19. protected PorosityConfig porosityConfig;
  20. private GroupBox groupBox2;
  21. private CheckBox checkBox4;
  22. private CheckBox checkBox3;
  23. private CheckBox checkBox2;
  24. private CheckBox checkBox1;
  25. private DataGridView dataGridView1;
  26. private ComboBox comboBox1;
  27. private Label label1;
  28. private ComboBox comboBox3;
  29. private Label label7;
  30. private Button button_pickColor;
  31. private DataGridViewTextBoxColumn Column11;
  32. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
  33. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
  34. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
  35. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
  36. private DataGridViewTextBoxColumn theMostWidespread;
  37. private DataGridViewTextBoxColumn largestDiameter;
  38. private DataGridViewTextBoxColumn minimumDiameter;
  39. private DataGridViewTextBoxColumn level;
  40. private GroupBox groupBox1;
  41. public PV6093Dialog()
  42. {
  43. InitializeComponent();
  44. }
  45. public PV6093Dialog(AppWorkspace appWorkspace, string dialogText, PdnMenuItem menuItem) : base(appWorkspace, dialogText, menuItem)
  46. {
  47. InitializeComponent();
  48. InitializeLanguageText();
  49. getData();
  50. }
  51. private void InitializeLanguageText()
  52. {
  53. this.groupBox1.Text = PdnResources.GetString("Menu.paramssettings.text");
  54. this.button_pickColor.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.moreoptions.text");
  55. this.comboBox1.Items.AddRange(new object[] {
  56. PdnResources.GetString("Menu.Maximumcaliperdiameter.text"),
  57. PdnResources.GetString("Menu.Diameterofequalareacircle.text")});
  58. this.label1.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Diametertype.text");
  59. this.label7.Text = PdnResources.GetString("Menu.Typeofstress.text");
  60. this.groupBox2.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.thelesettings.text");
  61. this.Column11.HeaderText = PdnResources.GetString("Menu.view.text");
  62. this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.holearea.text");
  63. this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.viewarea.text");
  64. this.dataGridViewTextBoxColumn3.HeaderText = PdnResources.GetString("Menu.Porosity.text");
  65. this.dataGridViewTextBoxColumn4.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Numberofholes.text");
  66. this.theMostWidespread.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Maxarea.text");
  67. this.largestDiameter.HeaderText = PdnResources.GetString("Menu.Themaxdiameter.text");
  68. this.minimumDiameter.HeaderText = PdnResources.GetString("Menu.minimumdiameter.text");
  69. this.level.HeaderText = PdnResources.GetString("Menu.levdel.Text");
  70. this.checkBox4.Text = PdnResources.GetString("Menu.Rough.text") + "Rz";
  71. this.checkBox3.Text = PdnResources.GetString("Menu.minimumdiameter.text") + "U";
  72. this.checkBox2.Text = PdnResources.GetString("Menu.minimumdistance.text") + "A";
  73. this.checkBox1.Text = PdnResources.GetString("Menu.diameter.text") + "φ";
  74. this.Text = "PV6093_2012(" + PdnResources.GetString("Menu.Porosity.text") + ")";
  75. }
  76. private void InitializeComponent()
  77. {
  78. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  79. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
  80. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
  81. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
  82. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
  83. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
  84. this.groupBox1 = new System.Windows.Forms.GroupBox();
  85. this.button_pickColor = new System.Windows.Forms.Button();
  86. this.comboBox1 = new System.Windows.Forms.ComboBox();
  87. this.label1 = new System.Windows.Forms.Label();
  88. this.comboBox3 = new System.Windows.Forms.ComboBox();
  89. this.label7 = new System.Windows.Forms.Label();
  90. this.groupBox2 = new System.Windows.Forms.GroupBox();
  91. this.dataGridView1 = new System.Windows.Forms.DataGridView();
  92. this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  93. this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  94. this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  95. this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  96. this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  97. this.theMostWidespread = new System.Windows.Forms.DataGridViewTextBoxColumn();
  98. this.largestDiameter = new System.Windows.Forms.DataGridViewTextBoxColumn();
  99. this.minimumDiameter = new System.Windows.Forms.DataGridViewTextBoxColumn();
  100. this.level = new System.Windows.Forms.DataGridViewTextBoxColumn();
  101. this.checkBox4 = new System.Windows.Forms.CheckBox();
  102. this.checkBox3 = new System.Windows.Forms.CheckBox();
  103. this.checkBox2 = new System.Windows.Forms.CheckBox();
  104. this.checkBox1 = new System.Windows.Forms.CheckBox();
  105. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).BeginInit();
  106. this.groupBox1.SuspendLayout();
  107. this.groupBox2.SuspendLayout();
  108. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
  109. this.SuspendLayout();
  110. //
  111. // groupBox1
  112. //
  113. this.groupBox1.Controls.Add(this.button_pickColor);
  114. this.groupBox1.Controls.Add(this.comboBox1);
  115. this.groupBox1.Controls.Add(this.label1);
  116. this.groupBox1.Controls.Add(this.comboBox3);
  117. this.groupBox1.Controls.Add(this.label7);
  118. this.groupBox1.Location = new System.Drawing.Point(178, 357);
  119. this.groupBox1.Name = "groupBox1";
  120. this.groupBox1.Size = new System.Drawing.Size(356, 59);
  121. this.groupBox1.TabIndex = 35;
  122. this.groupBox1.TabStop = false;
  123. //
  124. // button_pickColor
  125. //
  126. this.button_pickColor.Location = new System.Drawing.Point(273, 20);
  127. this.button_pickColor.Name = "button_pickColor";
  128. this.button_pickColor.Size = new System.Drawing.Size(75, 23);
  129. this.button_pickColor.TabIndex = 37;
  130. this.button_pickColor.UseVisualStyleBackColor = true;
  131. this.button_pickColor.Click += new System.EventHandler(this.button_pickColor_Click);
  132. //
  133. // comboBox1
  134. //
  135. this.comboBox1.FormattingEnabled = true;
  136. this.comboBox1.Location = new System.Drawing.Point(172, 22);
  137. this.comboBox1.Name = "comboBox1";
  138. this.comboBox1.Size = new System.Drawing.Size(95, 20);
  139. this.comboBox1.TabIndex = 17;
  140. this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
  141. //
  142. // label1
  143. //
  144. this.label1.AutoSize = true;
  145. this.label1.Location = new System.Drawing.Point(113, 25);
  146. this.label1.Name = "label1";
  147. this.label1.Size = new System.Drawing.Size(0, 12);
  148. this.label1.TabIndex = 16;
  149. //
  150. // comboBox3
  151. //
  152. this.comboBox3.FormattingEnabled = true;
  153. this.comboBox3.Items.AddRange(new object[] {
  154. "D",
  155. "S",
  156. "F",
  157. "G"});
  158. this.comboBox3.Location = new System.Drawing.Point(64, 22);
  159. this.comboBox3.Name = "comboBox3";
  160. this.comboBox3.Size = new System.Drawing.Size(43, 20);
  161. this.comboBox3.TabIndex = 15;
  162. this.comboBox3.SelectedIndexChanged += new System.EventHandler(this.comboBox3_SelectedIndexChanged);
  163. //
  164. // label7
  165. //
  166. this.label7.AutoSize = true;
  167. this.label7.Location = new System.Drawing.Point(6, 25);
  168. this.label7.Name = "label7";
  169. this.label7.Size = new System.Drawing.Size(0, 12);
  170. this.label7.TabIndex = 14;
  171. //
  172. // groupBox2
  173. //
  174. this.groupBox2.Controls.Add(this.dataGridView1);
  175. this.groupBox2.Controls.Add(this.checkBox4);
  176. this.groupBox2.Controls.Add(this.checkBox3);
  177. this.groupBox2.Controls.Add(this.checkBox2);
  178. this.groupBox2.Controls.Add(this.checkBox1);
  179. this.groupBox2.Location = new System.Drawing.Point(178, 422);
  180. this.groupBox2.Name = "groupBox2";
  181. this.groupBox2.Size = new System.Drawing.Size(356, 133);
  182. this.groupBox2.TabIndex = 36;
  183. this.groupBox2.TabStop = false;
  184. //
  185. // dataGridView1
  186. //
  187. this.dataGridView1.AllowUserToAddRows = false;
  188. this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  189. | System.Windows.Forms.AnchorStyles.Left)));
  190. this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  191. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  192. dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
  193. dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  194. dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
  195. dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  196. dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  197. dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  198. this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
  199. this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  200. this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  201. this.Column11,
  202. this.dataGridViewTextBoxColumn1,
  203. this.dataGridViewTextBoxColumn2,
  204. this.dataGridViewTextBoxColumn3,
  205. this.dataGridViewTextBoxColumn4,
  206. this.theMostWidespread,
  207. this.largestDiameter,
  208. this.minimumDiameter,
  209. this.level});
  210. this.dataGridView1.Location = new System.Drawing.Point(0, 42);
  211. this.dataGridView1.MultiSelect = false;
  212. this.dataGridView1.Name = "dataGridView1";
  213. this.dataGridView1.ReadOnly = true;
  214. this.dataGridView1.RowHeadersVisible = false;
  215. this.dataGridView1.RowTemplate.Height = 23;
  216. this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  217. this.dataGridView1.Size = new System.Drawing.Size(356, 80);
  218. this.dataGridView1.TabIndex = 11;
  219. //
  220. // Column11
  221. //
  222. dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  223. this.Column11.DefaultCellStyle = dataGridViewCellStyle2;
  224. this.Column11.Name = "Column11";
  225. this.Column11.ReadOnly = true;
  226. this.Column11.Width = 80;
  227. //
  228. // dataGridViewTextBoxColumn1
  229. //
  230. dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  231. this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle3;
  232. this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
  233. this.dataGridViewTextBoxColumn1.ReadOnly = true;
  234. //
  235. // dataGridViewTextBoxColumn2
  236. //
  237. dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  238. this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle4;
  239. this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
  240. this.dataGridViewTextBoxColumn2.ReadOnly = true;
  241. //
  242. // dataGridViewTextBoxColumn3
  243. //
  244. dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  245. this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle5;
  246. this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
  247. this.dataGridViewTextBoxColumn3.ReadOnly = true;
  248. //
  249. // dataGridViewTextBoxColumn4
  250. //
  251. dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  252. this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle6;
  253. this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
  254. this.dataGridViewTextBoxColumn4.ReadOnly = true;
  255. //
  256. // theMostWidespread
  257. //
  258. this.theMostWidespread.Name = "theMostWidespread";
  259. this.theMostWidespread.ReadOnly = true;
  260. //
  261. // largestDiameter
  262. //
  263. this.largestDiameter.Name = "largestDiameter";
  264. this.largestDiameter.ReadOnly = true;
  265. //
  266. // minimumDiameter
  267. //
  268. this.minimumDiameter.Name = "minimumDiameter";
  269. this.minimumDiameter.ReadOnly = true;
  270. //
  271. // level
  272. //
  273. this.level.Name = "level";
  274. this.level.ReadOnly = true;
  275. //
  276. // checkBox4
  277. //
  278. this.checkBox4.AutoSize = true;
  279. this.checkBox4.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
  280. this.checkBox4.Location = new System.Drawing.Point(242, 20);
  281. this.checkBox4.Name = "checkBox4";
  282. this.checkBox4.Size = new System.Drawing.Size(15, 14);
  283. this.checkBox4.TabIndex = 10;
  284. this.checkBox4.UseVisualStyleBackColor = true;
  285. this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
  286. //
  287. // checkBox3
  288. //
  289. this.checkBox3.AutoSize = true;
  290. this.checkBox3.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
  291. this.checkBox3.Location = new System.Drawing.Point(74, 20);
  292. this.checkBox3.Name = "checkBox3";
  293. this.checkBox3.Size = new System.Drawing.Size(15, 14);
  294. this.checkBox3.TabIndex = 9;
  295. this.checkBox3.UseVisualStyleBackColor = true;
  296. this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
  297. //
  298. // checkBox2
  299. //
  300. this.checkBox2.AutoSize = true;
  301. this.checkBox2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
  302. this.checkBox2.Location = new System.Drawing.Point(158, 20);
  303. this.checkBox2.Name = "checkBox2";
  304. this.checkBox2.Size = new System.Drawing.Size(15, 14);
  305. this.checkBox2.TabIndex = 8;
  306. this.checkBox2.UseVisualStyleBackColor = true;
  307. this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
  308. //
  309. // checkBox1
  310. //
  311. this.checkBox1.AutoSize = true;
  312. this.checkBox1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
  313. this.checkBox1.Location = new System.Drawing.Point(8, 20);
  314. this.checkBox1.Name = "checkBox1";
  315. this.checkBox1.Size = new System.Drawing.Size(15, 14);
  316. this.checkBox1.TabIndex = 7;
  317. this.checkBox1.UseVisualStyleBackColor = true;
  318. this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
  319. //
  320. // PV6093Dialog
  321. //
  322. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  323. this.ClientSize = new System.Drawing.Size(1177, 761);
  324. this.Controls.Add(this.groupBox2);
  325. this.Controls.Add(this.groupBox1);
  326. this.Name = "PV6093Dialog";
  327. this.Controls.SetChildIndex(this.groupBox1, 0);
  328. this.Controls.SetChildIndex(this.groupBox2, 0);
  329. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).EndInit();
  330. this.groupBox1.ResumeLayout(false);
  331. this.groupBox1.PerformLayout();
  332. this.groupBox2.ResumeLayout(false);
  333. this.groupBox2.PerformLayout();
  334. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  335. this.ResumeLayout(false);
  336. }
  337. #region [页面事件]
  338. /// <summary>
  339. /// 初始化赋值
  340. /// </summary>
  341. /// <param name="sender"></param>
  342. /// <param name="e"></param>
  343. private void getData()
  344. {
  345. string filePath = Application.StartupPath + "\\PorosityConfig\\6093Config.xml";
  346. try
  347. {
  348. porosityConfig = XmlSerializeHelper.DESerializer<PorosityConfig>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  349. }
  350. catch (Exception ex)
  351. {
  352. porosityConfig = new PorosityConfig();
  353. porosityConfig.diameterType = 1;
  354. porosityConfig.distanceFactor = 1;
  355. porosityConfig.maxDiameter = 1;
  356. porosityConfig.maxPorosityNum = 1;
  357. porosityConfig.maxPorosityPercent = 1;
  358. porosityConfig.minDiameter = 1;
  359. porosityConfig.roughSurface = 1;
  360. porosityConfig.stressType = "D";
  361. porosityConfig.diameter = false;
  362. porosityConfig.minDistanceA = false;
  363. porosityConfig.minDiameterU = false;
  364. porosityConfig.surfaceRz = false;
  365. if (!Directory.Exists(filePath))
  366. {
  367. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityConfig>(porosityConfig);
  368. Directory.CreateDirectory(Application.StartupPath + "\\PorosityConfig\\");
  369. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
  370. }
  371. }
  372. this.comboBox3.SelectedItem = this.porosityConfig.stressType;
  373. this.comboBox1.SelectedItem = this.porosityConfig.diameterType == 1 ? PdnResources.GetString("Menu.Maximumcaliperdiameter.text") : PdnResources.GetString("Menu.Diameterofequalareacircle.text");
  374. this.checkBox1.Checked = this.porosityConfig.diameter;
  375. this.checkBox3.Checked = this.porosityConfig.minDistanceA;
  376. this.checkBox2.Checked = this.porosityConfig.minDiameterU;
  377. this.checkBox4.Checked = this.porosityConfig.surfaceRz;
  378. }
  379. /// <summary>
  380. /// 更多选线展示弹窗
  381. /// </summary>
  382. /// <param name="sender"></param>
  383. /// <param name="e"></param>
  384. private void button_pickColor_Click(object sender, EventArgs e)
  385. {
  386. new PorosityMoreChoose(porosityConfig,this,null,null).ShowDialog();
  387. }
  388. #endregion
  389. #region 需继承方法
  390. protected override void SubclassInitialize()
  391. {
  392. InitializeComponent();
  393. }
  394. protected override MethodOfAssessment getMethodOfAssessment()
  395. {
  396. return new MethodOfPV6093(this.imgPxPerUnit);
  397. }
  398. protected override void initColorSetting()
  399. {
  400. }
  401. protected override void initDisplaySetting()
  402. {
  403. }
  404. protected override void getArgsValue()
  405. {
  406. var key = this.argsKey;
  407. var value = this.argsValue;
  408. switch (key)
  409. {
  410. case "parameter1":
  411. this.comboBox3.SelectedIndex = (int)value;
  412. this.porosityConfig.stressType = this.comboBox3.SelectedItem.ToString();
  413. break;
  414. case "parameter2":
  415. this.comboBox1.SelectedIndex = (int)value;
  416. this.porosityConfig.diameterType = this.comboBox1.SelectedItem == null ? 1 : this.comboBox1.SelectedItem.ToString() == PdnResources.GetString("Menu.Maximumcaliperdiameter.text") ? 1 : 2;
  417. break;
  418. case "parameter3":
  419. this.porosityConfig.maxPorosityPercent = Convert.ToDouble(value);
  420. break;
  421. case "parameter4":
  422. this.porosityConfig.roughSurface = Convert.ToDouble(value);
  423. break;
  424. case "parameter5":
  425. this.porosityConfig.maxDiameter = Convert.ToDouble(value);
  426. break;
  427. case "parameter6":
  428. this.porosityConfig.distanceFactor = Convert.ToDouble(value);
  429. break;
  430. case "parameter7":
  431. this.porosityConfig.maxPorosityNum = Convert.ToDouble(value);
  432. break;
  433. case "parameter8":
  434. this.porosityConfig.minDiameter = Convert.ToDouble(value);
  435. break;
  436. case "parameter9":
  437. this.checkBox1.Checked = Convert.ToBoolean(value);
  438. this.porosityConfig.diameter = this.checkBox1.Checked;
  439. break;
  440. case "parameter10":
  441. this.checkBox3.Checked = Convert.ToBoolean(value);
  442. this.porosityConfig.minDiameterU = this.checkBox3.Checked;
  443. break;
  444. case "parameter11":
  445. this.checkBox2.Checked = Convert.ToBoolean(value);
  446. this.porosityConfig.minDistanceA = this.checkBox2.Checked;
  447. break;
  448. case "parameter12":
  449. this.checkBox4.Checked = Convert.ToBoolean(value);
  450. this.porosityConfig.surfaceRz = this.checkBox4.Checked;
  451. break;
  452. }
  453. }
  454. protected override void setArgsValue()
  455. {
  456. var key = this.argsKey;
  457. object value = null;
  458. switch (key)
  459. {
  460. case "parameter1":
  461. value = this.comboBox3.SelectedIndex;
  462. break;
  463. case "parameter2":
  464. value = this.comboBox1.SelectedIndex;
  465. break;
  466. case "parameter3":
  467. value = this.porosityConfig.maxPorosityPercent;
  468. break;
  469. case "parameter4":
  470. value = this.porosityConfig.roughSurface;
  471. break;
  472. case "parameter5":
  473. value = this.porosityConfig.maxDiameter;
  474. break;
  475. case "parameter6":
  476. value = this.porosityConfig.distanceFactor;
  477. break;
  478. case "parameter7":
  479. value = this.porosityConfig.maxPorosityNum;
  480. break;
  481. case "parameter8":
  482. value = this.porosityConfig.minDiameter;
  483. break;
  484. case "parameter9":
  485. value = this.checkBox1.Checked;
  486. break;
  487. case "parameter10":
  488. value = this.checkBox3.Checked;
  489. break;
  490. case "parameter11":
  491. value = this.checkBox2.Checked;
  492. break;
  493. case "parameter12":
  494. value = this.checkBox4.Checked;
  495. break;
  496. }
  497. this.argsValue = value;
  498. }
  499. protected override void save_normal_data()
  500. {
  501. this.porosityConfig.diameterType = this.comboBox1.SelectedItem == null ? 1 : this.comboBox1.SelectedItem.ToString() == PdnResources.GetString("Menu.Maximumcaliperdiameter.text") ? 1 : 2;
  502. this.porosityConfig.stressType = this.comboBox3.SelectedItem.ToString();
  503. this.porosityConfig.diameter = this.checkBox1.Checked;
  504. this.porosityConfig.minDistanceA = this.checkBox3.Checked;
  505. this.porosityConfig.minDiameterU = this.checkBox2.Checked;
  506. this.porosityConfig.surfaceRz = this.checkBox4.Checked;
  507. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityConfig>(this.porosityConfig);
  508. FileOperationHelper.WriteStringToFile(porosityInfoXml, Application.StartupPath + "\\PorosityConfig\\6093Config.xml", FileMode.Create);
  509. }
  510. /// <summary>
  511. /// 列表赋值
  512. /// </summary>
  513. protected override void list_add_data()
  514. {
  515. if (this.tempAnalysisResult == null) {
  516. return;
  517. }
  518. dataGridView1.Rows.Clear();
  519. var dataList = this.tempAnalysisResult.resultBody;
  520. int num = 2;
  521. if (this.domainUpDown_resultPrecision.SelectedIndex != -1)
  522. {
  523. num = Convert.ToInt32(this.domainUpDown_resultPrecision.Items[this.domainUpDown_resultPrecision.SelectedIndex]);
  524. }
  525. foreach (var item in dataList)
  526. {
  527. dataGridView1.Rows.Add(item.Key.name,Convert.ToDouble(Math.Round(Convert.ToDecimal(item.Value[0]),2)), Convert.ToDouble(Math.Round(Convert.ToDecimal(item.Value[1]), num)), Convert.ToDouble(Math.Round(Convert.ToDecimal(item.Value[2]), num)), Convert.ToDouble(Math.Round(Convert.ToDecimal(item.Value[3]), num)), Convert.ToDouble(Math.Round(Convert.ToDecimal(item.Value[4]), num)), Convert.ToDouble(Math.Round(Convert.ToDecimal(item.Value[5]), num)), Convert.ToDouble(Math.Round(Convert.ToDecimal(item.Value[6]), num)), item.Value[7]);
  528. if (this.porosityConfig.maxPorosityPercent <= Convert.ToDouble(Math.Round(Convert.ToDecimal(item.Value[2]), num)))
  529. {
  530. dataGridView1[3, dataGridView1.Rows.Count - 1].Style.Font = new Font(DataGridView.DefaultFont, FontStyle.Bold);
  531. }
  532. else
  533. {
  534. dataGridView1[3, dataGridView1.Rows.Count - 1].Style.Font = DataGridView.DefaultFont;
  535. }
  536. if (this.porosityConfig.stressType == "F")
  537. {
  538. if (this.porosityConfig.maxPorosityNum <= Convert.ToDouble(Math.Round(Convert.ToDecimal(item.Value[3]), num)))
  539. {
  540. dataGridView1[4, dataGridView1.Rows.Count - 1].Style.Font = new Font(DataGridView.DefaultFont, FontStyle.Bold);
  541. }
  542. else
  543. {
  544. dataGridView1[4, dataGridView1.Rows.Count - 1].Style.Font = DataGridView.DefaultFont;
  545. }
  546. }
  547. else
  548. {
  549. dataGridView1[4, dataGridView1.Rows.Count - 1].Style.Font = DataGridView.DefaultFont;
  550. }
  551. if (this.porosityConfig.maxDiameter <= Convert.ToDouble(Math.Round(Convert.ToDecimal(item.Value[5]), num)))
  552. {
  553. dataGridView1[6, dataGridView1.Rows.Count - 1].Style.Font = new Font(DataGridView.DefaultFont, FontStyle.Bold);
  554. }
  555. else
  556. {
  557. dataGridView1[6, dataGridView1.Rows.Count - 1].Style.Font = DataGridView.DefaultFont;
  558. }
  559. }
  560. for (int i = 0; i < this.dataGridView1.Rows.Count; i++) {
  561. try
  562. {
  563. int thisNum = Convert.ToInt32(this.dataGridView1[0, i].Value.ToString().Replace("view", ""));
  564. dataGridView1.Rows[i].DefaultCellStyle.BackColor = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[thisNum - 1].Color;
  565. }
  566. catch (Exception ex)
  567. {
  568. }
  569. }
  570. this.dataGridView1.ClearSelection();
  571. }
  572. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  573. {
  574. this.porosityConfig.diameter = this.checkBox1.Checked;
  575. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityConfig>(this.porosityConfig);
  576. FileOperationHelper.WriteStringToFile(porosityInfoXml, Application.StartupPath + "\\PorosityConfig\\6093Config.xml", FileMode.Create);
  577. clearAllView();
  578. if (this.bcBinaryChecked()) {
  579. recalculate();
  580. list_add_data();
  581. }
  582. }
  583. private void checkBox3_CheckedChanged(object sender, EventArgs e)
  584. {
  585. this.porosityConfig.minDiameterU = this.checkBox3.Checked;
  586. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityConfig>(this.porosityConfig);
  587. FileOperationHelper.WriteStringToFile(porosityInfoXml, Application.StartupPath + "\\PorosityConfig\\6093Config.xml", FileMode.Create);
  588. clearAllView();
  589. if (this.bcBinaryChecked())
  590. {
  591. recalculate();
  592. list_add_data();
  593. }
  594. }
  595. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  596. {
  597. this.porosityConfig.minDistanceA = this.checkBox2.Checked;
  598. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityConfig>(this.porosityConfig);
  599. FileOperationHelper.WriteStringToFile(porosityInfoXml, Application.StartupPath + "\\PorosityConfig\\6093Config.xml", FileMode.Create);
  600. clearAllView();
  601. if (this.bcBinaryChecked())
  602. {
  603. recalculate();
  604. list_add_data();
  605. }
  606. }
  607. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  608. {
  609. this.porosityConfig.surfaceRz = this.checkBox4.Checked;
  610. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityConfig>(this.porosityConfig);
  611. FileOperationHelper.WriteStringToFile(porosityInfoXml, Application.StartupPath + "\\PorosityConfig\\6093Config.xml", FileMode.Create);
  612. clearAllView();
  613. if (this.bcBinaryChecked())
  614. {
  615. recalculate();
  616. list_add_data();
  617. }
  618. }
  619. protected override void clearAllView()
  620. {
  621. dataGridView1.Rows.Clear();
  622. }
  623. protected override void clearOneView()
  624. {
  625. if (dataGridView1.Rows.Count > 0)
  626. {
  627. dataGridView1.Rows.RemoveAt(this.delIndex);
  628. }
  629. }
  630. protected override void changeOneViewColor()
  631. {
  632. if (dataGridView1.Rows.Count > 0)
  633. {
  634. dataGridView1.Rows[this.delIndex].DefaultCellStyle.BackColor = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[this.delIndex].Color;
  635. }
  636. }
  637. protected override void getEveryImgData()
  638. {
  639. if (this.everyImgData.ContainsKey(this.ImgName)) {
  640. PorosityConfig config = this.everyImgData[this.ImgName];
  641. this.comboBox3.SelectedItem = config.stressType;
  642. this.comboBox1.SelectedItem = config.diameterType == 1 ? PdnResources.GetString("Menu.Maximumcaliperdiameter.text") : PdnResources.GetString("Menu.Diameterofequalareacircle.text");
  643. this.checkBox1.Checked = config.diameter;
  644. this.checkBox3.Checked = config.minDistanceA;
  645. this.checkBox2.Checked = config.minDiameterU;
  646. this.checkBox4.Checked = config.surfaceRz;
  647. }
  648. }
  649. protected override void saveEveryImgData()
  650. {
  651. if (this.everyImgData.ContainsKey(this.ImgName))
  652. {
  653. PorosityConfig config = this.everyImgData[this.ImgName];
  654. config.diameterType = this.comboBox1.SelectedItem == null ? 1 : this.comboBox1.SelectedItem.ToString() == PdnResources.GetString("Menu.Maximumcaliperdiameter.text") ? 1 : 2;
  655. config.stressType = this.comboBox3.SelectedItem.ToString();
  656. config.diameter = this.checkBox1.Checked;
  657. config.minDistanceA = this.checkBox3.Checked;
  658. config.minDiameterU = this.checkBox2.Checked;
  659. config.surfaceRz = this.checkBox4.Checked;
  660. this.everyImgData[this.ImgName] = config;
  661. }
  662. else {
  663. PorosityConfig config = new PorosityConfig();
  664. config.diameterType = this.comboBox1.SelectedItem == null ? 1 : this.comboBox1.SelectedItem.ToString() == PdnResources.GetString("Menu.Maximumcaliperdiameter.text") ? 1 : 2;
  665. config.stressType = this.comboBox3.SelectedItem.ToString();
  666. config.diameter = this.checkBox1.Checked;
  667. config.minDistanceA = this.checkBox3.Checked;
  668. config.minDiameterU = this.checkBox2.Checked;
  669. config.surfaceRz = this.checkBox4.Checked;
  670. this.everyImgData.Add(this.ImgName, config);
  671. }
  672. }
  673. #endregion 需继承方法
  674. private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
  675. {
  676. this.porosityConfig.stressType = this.comboBox3.SelectedItem.ToString();
  677. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityConfig>(this.porosityConfig);
  678. FileOperationHelper.WriteStringToFile(porosityInfoXml, Application.StartupPath + "\\PorosityConfig\\6093Config.xml", FileMode.Create);
  679. clearAllView();
  680. recalculate();
  681. list_add_data();
  682. }
  683. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  684. {
  685. this.porosityConfig.diameterType = this.comboBox1.SelectedItem.ToString() == PdnResources.GetString("Menu.Maximumcaliperdiameter.text") ? 1 : 2;
  686. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityConfig>(this.porosityConfig);
  687. FileOperationHelper.WriteStringToFile(porosityInfoXml, Application.StartupPath + "\\PorosityConfig\\6093Config.xml", FileMode.Create);
  688. clearAllView();
  689. recalculate();
  690. list_add_data();
  691. }
  692. public void getChange(PorosityConfig porosityConfig)
  693. {
  694. this.porosityConfig = porosityConfig;
  695. clearAllView();
  696. recalculate();
  697. list_add_data();
  698. }
  699. }
  700. }