BshTransferAdjustDialog.cs 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. using Resources;
  2. using SmartCoalApplication.Adjust;
  3. using SmartCoalApplication.Base;
  4. using SmartCoalApplication.Base.CommTool;
  5. using SmartCoalApplication.Core;
  6. using SmartCoalApplication.Core.CustomControl;
  7. using SmartCoalApplication.Core.Param;
  8. using SmartCoalApplication.Data.Action;
  9. using SmartCoalApplication.ParameterSet;
  10. using SmartCoalApplication.Resources;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.ComponentModel;
  14. using System.Data;
  15. using System.Drawing;
  16. using System.Drawing.Imaging;
  17. using System.IO;
  18. using System.Linq;
  19. using System.Text;
  20. using System.Threading.Tasks;
  21. using System.Windows.Forms;
  22. using static SmartCoalApplication.ParameterSet.ImageMenu;
  23. namespace SmartCoalApplication.Processing
  24. {
  25. /// <summary>
  26. /// 图像处理窗口
  27. /// </summary>
  28. internal class BshTransferAdjustDialog : Form
  29. {
  30. /// <summary>
  31. /// 步长 初始值1,依次增加
  32. /// </summary>
  33. string stepLength = "00" + Program.instance.step_length;
  34. /// <summary>
  35. /// 主控件
  36. /// </summary>
  37. private AppWorkspace appWorkspace;
  38. /// <summary>
  39. /// 当前处理的程序
  40. /// </summary>
  41. private ParamObject action;
  42. /// <summary>
  43. /// 如果是脚本执行,将参数带入
  44. /// </summary>
  45. private Boolean initScriptValues = false;
  46. // <summary>
  47. /// 如果有参数保存,将参数带入
  48. /// </summary>
  49. private Boolean initPamasValues = false;
  50. /// <summary>
  51. /// 当前活动的图像
  52. /// </summary>
  53. private Bitmap bitmap;
  54. /// <summary>
  55. /// 调用调色板的控件
  56. /// </summary>
  57. private Panel panel2;
  58. /// <summary>
  59. /// 调用原图取色 显示色板的控件
  60. /// </summary>
  61. private Panel panel3;
  62. /// <summary>
  63. /// 是否使用原图取色
  64. /// </summary>
  65. private bool item3Checked;
  66. /// <summary>
  67. /// 调色板
  68. /// </summary>
  69. private PluginAssemblys.ColorsForm colorsFormGrid;
  70. /// <summary>
  71. /// 像素格式
  72. /// </summary>
  73. private PixelFormat pixelFormat;
  74. /// <summary>
  75. /// 图像面板
  76. /// </summary>
  77. private DocumentWorkspaceWindow documentWorkspace;
  78. /// <summary>
  79. /// 公共按钮
  80. /// </summary>
  81. private CommonControlButtons commonControlButtons;
  82. /// <summary>
  83. /// 是否点击过应用按钮
  84. /// 如果没有点过,直接点确定还需要走一遍方法,
  85. /// 如果已经点过,直接拿当前图片
  86. /// </summary>
  87. private bool applyButtonClick = false;
  88. private PdnMenuItem MenuItem;
  89. private bool reset = false;
  90. /// <summary>
  91. /// 选中参数的索引
  92. /// </summary>
  93. private string index = "1";
  94. [Browsable(false)]
  95. public AppWorkspace AppWorkspace
  96. {
  97. get
  98. {
  99. return this.appWorkspace;
  100. }
  101. set
  102. {
  103. this.appWorkspace = value;
  104. }
  105. }
  106. ActionType menuIdOverall;
  107. /// <summary>
  108. /// dialog
  109. /// </summary>
  110. /// <param name="appWorkspace"></param>
  111. /// <param name="menuId">对应菜单的id</param>
  112. public BshTransferAdjustDialog(AppWorkspace appWorkspace, ActionType menuId, string dialogText, PdnMenuItem menuItem)
  113. {
  114. menuIdOverall = menuId;
  115. this.MenuItem = menuItem;
  116. InitializeComponent();
  117. InitializeLanguageText();
  118. //
  119. // 设置Dialog属性
  120. //
  121. this.AppWorkspace = appWorkspace;
  122. this.StartPosition = FormStartPosition.CenterScreen;
  123. this.Icon = PdnInfo.AppIcon;
  124. this.bitmap = this.AppWorkspace.ActiveDocumentWorkspace.CompositionSurface.CreateAliasedBitmap();
  125. this.pixelFormat = this.AppWorkspace.ActiveDocumentWorkspace.CompositionSurface.PixelFormat;
  126. this.Text = dialogText;
  127. //
  128. //初始化色板
  129. //
  130. this.colorsFormGrid = new PluginAssemblys.ColorsForm();
  131. this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
  132. this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
  133. //
  134. //初始化图像控件
  135. //
  136. this.documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
  137. this.documentWorkspace.Dock = DockStyle.Fill;
  138. this.documentWorkspace.HookMouseEvents();
  139. this.documentWorkspace.Visible = false;
  140. this.groupBox1.Controls.Add(documentWorkspace);
  141. //
  142. //初始化操作按钮
  143. //
  144. this.commonControlButtons = new CommonControlButtons();
  145. this.commonControlButtons.Dock = DockStyle.Top;
  146. this.commonControlButtons.Height = 30;
  147. this.commonControlButtons.HideZoomToWindowAndActualSize();
  148. this.groupBox1.Controls.Add(commonControlButtons);
  149. switch (menuId)
  150. {
  151. //调节
  152. case ActionType.ActionRevertColor:
  153. action = new Data.Action.Action5010();
  154. break;
  155. case ActionType.ActionBgr2Gray:
  156. action = new Data.Action.Action5011();
  157. break;
  158. case ActionType.ActionWhiteBalance:
  159. action = new Data.Action.Action5012();
  160. //白平衡原图取点
  161. this.documentWorkspace.panel.MouseClick += PicturePreviewControl1_item3MouseDown;
  162. //picturePreviewControl1.item3MouseDown += PicturePreviewControl1_item3MouseDown;
  163. break;
  164. case ActionType.ActionColorBalance:
  165. action = new Data.Action.Action5013();
  166. break;
  167. case ActionType.ActionShadingCorrection:
  168. action = new Data.Action.Action5014();
  169. break;
  170. case ActionType.ActionHSB:
  171. action = new Data.Action.Action5015();
  172. break;
  173. case ActionType.ActionBCG:
  174. action = new Data.Action.Action5016();
  175. break;
  176. case ActionType.ActionImageRotate:
  177. action = new Data.Action.Action5017();
  178. break;
  179. //锐化
  180. case ActionType.ActionPortray:
  181. action = new Data.Action.Action5020();
  182. break;
  183. case ActionType.ActionEnhanceContour:
  184. action = new Data.Action.Action5021();
  185. break;
  186. case ActionType.ActionBlurMask:
  187. action = new Data.Action.Action5022();
  188. break;
  189. //平滑
  190. case ActionType.Sigma:
  191. action = new Data.Action.Action5030();
  192. break;
  193. case ActionType.GaussianFiltering:
  194. action = new Data.Action.Action5031();
  195. break;
  196. case ActionType.LowPassFiltering:
  197. action = new Data.Action.Action5032();
  198. break;
  199. case ActionType.MedianFiltering:
  200. action = new Data.Action.Action5033();
  201. break;
  202. case ActionType.GaussianBlur:
  203. action = new Data.Action.Action5034();
  204. break;
  205. case ActionType.BilateralFiltering:
  206. action = new Data.Action.Action5035();
  207. break;
  208. case ActionType.WaveletDenoising:
  209. action = new Data.Action.Action5036();
  210. break;
  211. default:
  212. action = new Data.Action.Action5010();
  213. break;
  214. }
  215. if (action.Lists == null || action.Lists.Count < 1)
  216. {
  217. Label label = new Label();
  218. label.Left = 7;
  219. label.Top = 31;
  220. label.Size = new Size(60, 12);
  221. label.TextAlign = ContentAlignment.TopLeft;
  222. label.Text = PdnResources.GetString("Menu.Noparams.text");
  223. groupBoxParam.Controls.Add(label);
  224. this.button5.Visible = false;
  225. GetParameters(Program.instance.imageMenuModel);
  226. }
  227. else
  228. {
  229. //如果是脚本执行,将参数带入(AppWorkspace.ScriptRunning && AppWorkspace.ScriptCurrentParam != null && AppWorkspace.ScriptCurrentParam.MenuId == action.MenuId);
  230. //if (AppWorkspace.ScriptRunning && AppWorkspace.ScriptCurrentParam != null && AppWorkspace.ScriptCurrentParam.MenuId == action.MenuId)
  231. //{
  232. // this.initScriptValues = true;
  233. // foreach (Args arg in action.Lists)
  234. // {
  235. // Args param1 = AppWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
  236. // if (param1.value != null)
  237. // arg.Value = param1.value;
  238. // }
  239. // AppWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
  240. //}
  241. //else
  242. //{
  243. // GetParameters(Startup.instance.imageMenuModel);
  244. // this.initScriptValues = false;
  245. //}
  246. GetParameters(Program.instance.imageMenuModel);
  247. int controlsTop = 0;
  248. //初始化手动控件
  249. for (int i = 0; i < action.Lists.Count; i++)
  250. {
  251. Args args = action.Lists[i];
  252. index = args.value.ToString();
  253. if (args is IntegerNumber || args is DecimalNumber || args is OddNumber)
  254. {
  255. NumberParamControl numberParam = new NumberParamControl();
  256. numberParam.Left = 78;
  257. numberParam.Top = 35 + controlsTop;
  258. //设置参数范围
  259. numberParam.paramIndex = 100 + i;
  260. if (args is DecimalNumber)
  261. {
  262. numberParam.DecimalPlaces = ((DecimalNumber)args).DecimalPlaces;
  263. numberParam.Minimum = (double)((DecimalNumber)args).Min;
  264. numberParam.Maximum = (double)((DecimalNumber)args).Max;
  265. }
  266. else if (args is OddNumber)
  267. {
  268. numberParam.Increment = 2;
  269. numberParam.Minimum = ((OddNumber)args).Min;
  270. numberParam.Maximum = ((OddNumber)args).Max;
  271. numberParam.IsOddNumber = true;
  272. }
  273. else
  274. {
  275. numberParam.DecimalPlaces = 0;
  276. numberParam.Minimum = ((IntegerNumber)args).Min;
  277. numberParam.Maximum = ((IntegerNumber)args).Max;
  278. }
  279. double fnum = 0;
  280. if (double.TryParse((initScriptValues || initPamasValues ? args.value : args.initialValue).ToString(), out fnum))
  281. {
  282. numberParam.Value = fnum;
  283. //args.Value = fnum;
  284. }
  285. groupBoxParam.Controls.Add(numberParam);
  286. groupBoxParam.Controls.SetChildIndex(numberParam, 100 + i);
  287. if (args is DecimalNumber)
  288. {
  289. numberParam.ValueChanged += new EventHandler(((DecimalNumber)args).numberParam_ValueChanged);
  290. }
  291. else if (args is OddNumber)
  292. {
  293. numberParam.ValueChanged += new EventHandler(((OddNumber)args).numberParam_ValueChanged);
  294. }
  295. else
  296. {
  297. numberParam.ValueChanged += new EventHandler(((IntegerNumber)args).numberParam_ValueChanged);
  298. }
  299. numberParam.ValueChanged += this.ParameterChangeEvent;
  300. Label label = new Label();
  301. label.Left = 19;
  302. label.Top = 40 + controlsTop;
  303. label.Size = new Size(65, 12);//55->65 调试值,提交备注:调试3-双边滤波-邻域直径。
  304. label.TextAlign = ContentAlignment.MiddleRight;
  305. label.Text = args.name + ":";
  306. groupBoxParam.Controls.Add(label);
  307. controlsTop += 45;
  308. }
  309. else if (args is ChoiseArray)
  310. {
  311. Label label = new Label();
  312. label.Left = 19;
  313. label.Top = 40 + controlsTop;
  314. label.Size = new Size(55, 12);
  315. label.TextAlign = ContentAlignment.MiddleRight;
  316. label.Text = args.name + ":";
  317. groupBoxParam.Controls.Add(label);
  318. //初始化选项列表
  319. for (int j = 0; j < args.choiseList.Count; j++)
  320. {
  321. BooleanObject argsChoise = args.choiseList[j] as BooleanObject;
  322. RadioButton radio = new RadioButton();
  323. if (argsChoise.key == args.value)
  324. {
  325. radio.Checked = true;
  326. }
  327. radio.AutoSize = true;
  328. radio.Location = new Point(88, 40 + controlsTop/*topMargin*/);
  329. radio.Text = argsChoise.name + "";
  330. radio.Tag = argsChoise.Key;
  331. radio.CheckedChanged += ((ChoiseArray)args).numberParam_ValueChanged;
  332. radio.CheckedChanged += Radio_CheckedChanged;
  333. groupBoxParam.Controls.Add(radio);
  334. if (argsChoise.Lists.Count > 0)
  335. {
  336. ColorNumber phaseColor = argsChoise.Lists[0] as ColorNumber;
  337. if (phaseColor.Key.Equals("phaseColor"))
  338. {
  339. Panel panel = new Panel();
  340. panel.BackColor = Color.FromArgb(int.Parse(phaseColor.Value.ToString()));
  341. panel.Size = new Size(53, 20);
  342. panel.Top = 37 + controlsTop;
  343. panel.Left = 178;
  344. groupBoxParam.Controls.Add(panel);
  345. panel.Click += new System.EventHandler(this.panel2_Click);
  346. panel.BackColorChanged += ((ColorNumber)phaseColor).numberParam_ValueChanged;
  347. panel.BackColorChanged += this.ParameterChangeEvent;
  348. this.panel2 = panel;
  349. }
  350. else if (phaseColor.Key.Equals("imageColor"))
  351. {
  352. Panel panel = new Panel();
  353. panel.BackColor = Color.FromArgb(int.Parse(phaseColor.Value.ToString()));
  354. panel.Size = new Size(53, 20);
  355. panel.Top = 37 + controlsTop;
  356. panel.Left = 178;
  357. groupBoxParam.Controls.Add(panel);
  358. panel.BackColorChanged += ((ColorNumber)phaseColor).numberParam_ValueChanged;
  359. panel.BackColorChanged += this.ParameterChangeEvent;
  360. this.panel3 = panel;
  361. }
  362. }
  363. controlsTop += 45;
  364. }
  365. }
  366. else if (args is ColorNumber)
  367. {
  368. Label label = new Label();
  369. label.Left = 19;
  370. label.Top = 40 + controlsTop;
  371. label.Size = new Size(65, 12);
  372. label.TextAlign = ContentAlignment.MiddleRight;
  373. label.Text = args.name + ":";
  374. //colorPanel.BackColorChanged += ((ColorNumber)arg).numberParam_ValueChanged;
  375. ////radio.CheckedChanged += ((ChoiseArray)args).numberParam_ValueChanged;
  376. groupBoxParam.Controls.Add(label);
  377. Panel panel = new Panel();
  378. panel.BackColor = Color.FromArgb(int.Parse(args.Value.ToString()));
  379. panel.Size = new Size(53, 20);
  380. panel.Top = 35 + controlsTop;
  381. panel.Left = 85;
  382. groupBoxParam.Controls.Add(panel);
  383. panel.Click += new System.EventHandler(this.panel2_Click);
  384. panel.BackColorChanged += ((ColorNumber)args).numberParam_ValueChanged;
  385. panel.BackColorChanged += this.ParameterChangeEvent;
  386. this.panel2 = panel;
  387. controlsTop += 45;
  388. }
  389. else if (args is StringArray)
  390. {
  391. Label label = new Label();
  392. label.Left = 19;
  393. label.Top = 40 + controlsTop;
  394. label.Size = new Size(55, 12);
  395. label.TextAlign = ContentAlignment.MiddleRight;
  396. label.Text = args.name + ":";
  397. groupBoxParam.Controls.Add(label);
  398. Panel panel = new Panel();
  399. panel.AutoSize = true;
  400. panel.Top = 40 + controlsTop;
  401. panel.Left = 78;
  402. int position = 1;
  403. int topMargin = 0;
  404. //循环字典,铺多个radio
  405. foreach (var item in (Dictionary<Enum, object>)((initScriptValues || initPamasValues ? args.value : args.initialValue)))
  406. {
  407. int xvalue = 0;
  408. if (position % 1 == 0) xvalue = 0;
  409. if (position % 2 == 0) xvalue = 1;
  410. if (position % 3 == 0) xvalue = 2;
  411. RadioButton radio = new RadioButton();
  412. if (position == 1)
  413. {
  414. radio.Checked = true;
  415. }
  416. radio.AutoSize = true;
  417. radio.Location = new Point(xvalue * 90, topMargin);
  418. radio.Text = item.Value.ToString();
  419. radio.Tag = item.Key;
  420. radio.CheckedChanged += ((StringArray)args).numberParam_ValueChanged;
  421. radio.CheckedChanged += this.ParameterChangeEvent;
  422. panel.Controls.Add(radio);
  423. if (position % 3 == 0) topMargin += 25;
  424. position++;
  425. }
  426. groupBoxParam.Controls.Add(panel);
  427. controlsTop += 45;
  428. }
  429. }
  430. }
  431. InitData();
  432. InitCommonButtonEvent();
  433. }
  434. private void startScriptAutomaticAction()
  435. {
  436. applyButtonImpl(null, null);
  437. sureButtonImpl(null, null);
  438. }
  439. private void ParameterChangeEvent(object sender, EventArgs e)
  440. {
  441. this.applyButtonClick = false;
  442. }
  443. private void InitCommonButtonEvent()
  444. {
  445. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  446. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  447. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  448. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  449. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  450. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  451. }
  452. private void zoomInButton_Click(object sender, EventArgs e)
  453. {
  454. this.documentWorkspace.ZoomIn();
  455. }
  456. private void zoomOutButton_Click(object sender, EventArgs e)
  457. {
  458. this.documentWorkspace.ZoomOut();
  459. }
  460. private void zoomToWindowButton_Click(object sender, EventArgs e)
  461. {
  462. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  463. }
  464. private void actualSizeButton_Click(object sender, EventArgs e)
  465. {
  466. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  467. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  468. }
  469. private void pointerButton_Click(object sender, EventArgs e)
  470. {
  471. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
  472. }
  473. private void mobileModeButton_Click(object sender, EventArgs e)
  474. {
  475. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  476. }
  477. private void Radio_CheckedChanged(object sender, EventArgs e)
  478. {
  479. if (((RadioButton)sender).Tag.Equals("3"))//原图取色
  480. {
  481. this.item3Checked = ((RadioButton)sender).Checked;
  482. //picturePreviewControl1.selectColorMode(this.item3Checked);
  483. }
  484. OpenCvSharp.Mat mat = action.PerformProcess(OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap));
  485. Document document = Document.FromMat(mat);
  486. this.documentWorkspace.Document = document;
  487. this.documentWorkspace.Refresh();
  488. //picturePreviewControl1.pictureBox1.Image = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);
  489. }
  490. /// <summary>
  491. /// 相颜色点击事件
  492. /// </summary>
  493. /// <param name="sender"></param>
  494. /// <param name="e"></param>
  495. private void panel2_Click(object sender, EventArgs e)
  496. {
  497. this.panel2 = ((Panel)sender);
  498. this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(panel2.BackColor);
  499. this.colorsFormGrid.ShowDialog();
  500. }
  501. /// <summary>
  502. /// Panel2的调色板颜色改变
  503. /// </summary>
  504. /// <param name="sender"></param>
  505. /// <param name="e"></param>
  506. private void gridColorChanged(object sender, EventArgs e)
  507. {
  508. Color color = this.colorsFormGrid.UserPrimaryColor.ToColor();
  509. //更改背景色,触发事件
  510. this.panel2.BackColor = color;
  511. ////改变配置文件里面的相颜色
  512. //this.binaryExtractionModel.PhaseColor = color.ToArgb();
  513. OpenCvSharp.Mat mat = new OpenCvSharp.Mat();
  514. if (menuIdOverall == ActionType.ActionImageRotate)
  515. {
  516. OpenCvSharp.Mat src = action.PerformProcess(OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap));
  517. //GeometryIntent.ImageRotate(src, mat, float.Parse(action.lists[0].value.ToString()), OpenCvSharp.InterpolationFlags.Linear);
  518. mat = GeometryIntent.MatRotate(src, float.Parse(action.lists[0].value.ToString()), new OpenCvSharp.Scalar(panel2.BackColor.B, panel2.BackColor.G, panel2.BackColor.R, 255));
  519. }
  520. else
  521. {
  522. mat = action.PerformProcess(OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap));
  523. }
  524. //mat = action.PerformProcess(OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap));
  525. //OpenCvSharp.Mat mat = action.PerformProcess(OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap));
  526. Document document = Document.FromMat(mat);
  527. this.documentWorkspace.Document = document;
  528. this.documentWorkspace.Refresh();
  529. //picturePreviewControl1.pictureBox1.Image = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);
  530. //关闭色板
  531. this.colorsFormGrid.Close();
  532. }
  533. /// <summary>
  534. /// 初始化数据
  535. /// </summary>
  536. public void InitData()
  537. {
  538. Document document = Document.FromImage(this.bitmap);
  539. this.documentWorkspace.Document = document;
  540. this.documentWorkspace.Visible = true;
  541. this.documentWorkspace.Refresh();
  542. //给picturebox赋值
  543. //picturePreviewControl1.pictureBox1.Image = this.bitmap;
  544. //初始化/重置参数
  545. resetNumber();
  546. //this.initScriptValues = false;//阻止第二次进入仍然被赋值参数
  547. }
  548. private void resetNumber()
  549. {
  550. if (action is Action5012)//白平衡
  551. {
  552. //GetParameters(Startup.instance.imageMenuModel);
  553. this.item3Checked = false;
  554. //重新初始化选项列表
  555. Args args = action.Lists[0];
  556. for (int j = 0; j < args.choiseList.Count; j++)
  557. {
  558. BooleanObject argsChoise = args.choiseList[j] as BooleanObject;
  559. if (argsChoise.Lists.Count > 0)
  560. {
  561. ColorNumber phaseColor = argsChoise.Lists[0] as ColorNumber;
  562. if (phaseColor.Key.Equals("phaseColor"))//色板取色
  563. {
  564. this.panel2.BackColor = Color.FromArgb(int.Parse((initScriptValues || initPamasValues ? phaseColor.value : phaseColor.initialValue).ToString()));
  565. }
  566. else if (phaseColor.Key.Equals("imageColor"))//原图取色
  567. {
  568. this.panel3.BackColor = Color.FromArgb(int.Parse((initScriptValues || initPamasValues ? phaseColor.value : phaseColor.initialValue).ToString()));
  569. }
  570. }
  571. }
  572. }
  573. if (action is Action5017)//图像偏移
  574. {
  575. //重新初始化选色面板
  576. for (int j = 0; j < action.Lists.Count; j++)
  577. {
  578. ColorNumber phaseColor = action.Lists[j] as ColorNumber;
  579. if (phaseColor is ColorNumber)
  580. {
  581. this.panel2.BackColor = Color.FromArgb(int.Parse((initScriptValues || initPamasValues ? phaseColor.value : phaseColor.initialValue).ToString()));
  582. break;
  583. }
  584. }
  585. }
  586. foreach (Control control in groupBoxParam.Controls)//遍历参数面板上的所有控件
  587. {
  588. if (control is NumberParamControl)
  589. {
  590. NumberParamControl numberParam = (NumberParamControl)control;
  591. if (numberParam.paramIndex >= 100)
  592. {
  593. //List<Args> list1s = action.Lists[0];
  594. Args args = /*list1s*/action.Lists[numberParam.paramIndex - 100];
  595. double fnum = 0;
  596. if (double.TryParse((initScriptValues || initPamasValues ? args.value : args.initialValue).ToString(), out fnum))
  597. {
  598. numberParam.Value = fnum;
  599. } else if (reset){
  600. numberParam.Value = (int)args.initialValue;
  601. }
  602. }
  603. }
  604. else if (control is RadioButton)
  605. {
  606. if (control.Tag.Equals(index))
  607. {
  608. ((RadioButton)control).Checked = true;
  609. }
  610. else
  611. {
  612. ((RadioButton)control).Checked = false;
  613. }
  614. }
  615. }
  616. }
  617. /// <summary>
  618. /// 原图取点的响应方法
  619. /// </summary>
  620. /// <param name="sender"></param>
  621. /// <param name="e"></param>
  622. private void PicturePreviewControl1_item3MouseDown(object sender, MouseEventArgs e)
  623. {
  624. if (this.item3Checked)
  625. {
  626. System.Drawing.Point point = this.documentWorkspace.GetScalePoint(new System.Drawing.Point(e.X, e.Y));
  627. int x = point.X;
  628. int y = point.Y;
  629. if (x >= 0 && y >= 0 && x < this.documentWorkspace.CompositionSurface.Width && y < this.documentWorkspace.CompositionSurface.Height)
  630. {
  631. OpenCvSharp.Mat srt = OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap);
  632. OpenCvSharp.Vec3b bgr = srt.At<OpenCvSharp.Vec3b>(y, x);
  633. Color color = Color.FromArgb(bgr[2], bgr[1], bgr[0]);
  634. //更改背景色,触发事件
  635. this.panel3.BackColor = color;
  636. OpenCvSharp.Mat mat = action.PerformProcess(srt);
  637. //mat.Set(e.Location.Y, e.Location.X, new OpenCvSharp.Vec3b(0, 0, 255));//测试取点的位置
  638. //picturePreviewControl1.pictureBox1.Image = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);
  639. Document document = Document.FromMat(mat);
  640. this.documentWorkspace.Document = document;
  641. this.documentWorkspace.Refresh();
  642. }
  643. }
  644. }
  645. private void BshTransferAdjustDialog_Load(object sender, EventArgs e)
  646. {
  647. System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
  648. //图像名称输入框
  649. informationControl.fileNameTextBox1.Text = this.Text + "-" + stepLength;
  650. //picturePreviewControl1.isShown = true;
  651. parametersSettingControl.applyButtonClick += new EventHandler(applyButtonImpl);//注册事件,在窗体中事件处理代码中预览图像处理效果
  652. parametersSettingControl.sureButtonClick += new EventHandler(sureButtonImpl);//注册事件,在窗体中事件处理代码中预览图像处理效果
  653. //if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
  654. //{
  655. // this.startScriptAutomaticAction();
  656. //}
  657. }
  658. //应用
  659. private void applyButtonImpl(object sender, EventArgs e)
  660. {
  661. PluginAssemblys.ProgressThreadProcClass procClass = new PluginAssemblys.ProgressThreadProcClass();
  662. int itemCount = 100;
  663. PluginAssemblys.ProgressThreadProcClass.IFileTransferProgressEvents progressEvents = new PluginAssemblys.ProgressThreadProcClass.IFileTransferProgressEvents();
  664. System.Threading.ThreadStart copyThreadProc =
  665. delegate ()
  666. {
  667. try
  668. {
  669. OpenCvSharp.Mat mat = new OpenCvSharp.Mat();
  670. mat = action.PerformProcess(OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap));
  671. //if (menuIdOverall == ActionType.ActionImageRotate)
  672. //{
  673. // OpenCvSharp.Mat src = action.PerformProcess(OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap));
  674. // //OpenCvSharp.Cv2.CvtColor(src, src, OpenCvSharp.ColorConversionCodes.BGRA2BGR);
  675. // mat = GeometryIntent.MatRotate(src, float.Parse(action.lists[0].value.ToString()), new OpenCvSharp.Scalar(panel2.BackColor.B, panel2.BackColor.G, panel2.BackColor.R, 255));
  676. //}
  677. //else
  678. //{
  679. // mat = action.PerformProcess(OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap));
  680. // //OpenCvSharp.Cv2.CvtColor(mat, mat, OpenCvSharp.ColorConversionCodes.BGRA2BGR);
  681. //}
  682. Document document = Document.FromMat(mat);
  683. this.documentWorkspace.Document = document;
  684. this.documentWorkspace.Refresh();
  685. this.applyButtonClick = true;
  686. }
  687. catch (Exception ex)
  688. {
  689. }
  690. finally
  691. {
  692. progressEvents.EndOperation(OperationResult.Finished);
  693. }
  694. };
  695. procClass.StartProgressAction(/*currentForm*/this, itemCount, copyThreadProc, progressEvents, null);
  696. }
  697. //确定
  698. internal void sureButtonImpl(object sender, EventArgs e)
  699. {
  700. PluginAssemblys.ProgressThreadProcClass procClass = new PluginAssemblys.ProgressThreadProcClass();
  701. int itemCount = 100;
  702. PluginAssemblys.ProgressThreadProcClass.IFileTransferProgressEvents progressEvents = new PluginAssemblys.ProgressThreadProcClass.IFileTransferProgressEvents();
  703. System.Threading.ThreadStart copyThreadProc =
  704. delegate ()
  705. {
  706. try
  707. {
  708. OpenCvSharp.Mat mat = new OpenCvSharp.Mat();
  709. if (!this.applyButtonClick)
  710. {
  711. if (menuIdOverall == ActionType.ActionImageRotate)
  712. {
  713. OpenCvSharp.Mat src = action.PerformProcess(OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap));
  714. mat = GeometryIntent.MatRotate(src, float.Parse(action.lists[0].value.ToString()), new OpenCvSharp.Scalar(panel2.BackColor.B, panel2.BackColor.G, panel2.BackColor.R, 255));
  715. }
  716. else
  717. {
  718. mat = action.PerformProcess(OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap));
  719. }
  720. if (this.pixelFormat == PixelFormat.Format8bppIndexed && mat.Type() != OpenCvSharp.MatType.CV_8UC1)
  721. {
  722. mat = mat.CvtColor(OpenCvSharp.ColorConversionCodes.BGR2GRAY);
  723. }
  724. }
  725. else
  726. {
  727. mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(this.documentWorkspace.CompositionSurface.CreateAliasedBitmap());
  728. }
  729. this.Invoke(new EventHandler(delegate
  730. {
  731. //生成新图-是
  732. if (informationControl.radioButton1.Checked)
  733. {
  734. this.OpenFileImpl(mat);
  735. }
  736. else
  737. {
  738. Document document = Document.FromImage(OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat));
  739. AppWorkspace.ActiveDocumentWorkspace.Document = document;
  740. }
  741. this.Close();
  742. }));
  743. }
  744. catch (Exception)
  745. {
  746. }
  747. finally
  748. {
  749. progressEvents.EndOperation(OperationResult.Finished);
  750. }
  751. };
  752. procClass.StartProgressAction(/*currentForm*/this, itemCount, copyThreadProc, progressEvents, null);
  753. }
  754. //生成新图
  755. private void OpenFileImpl(OpenCvSharp.Mat mat)
  756. {
  757. DocumentWorkspace dw = AppWorkspace.AddNewDocumentWorkspace();
  758. Document document = Document.FromImage(OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat));
  759. dw.Document = document;
  760. dw.fileText = informationControl.fileNameTextBox1.Text;
  761. //dw.xmlSaveModel = this.appWorkspace.ActiveDocumentWorkspace.xmlSaveModel;
  762. //dw.rules = this.appWorkspace.ActiveDocumentWorkspace.rules;
  763. AppWorkspace.ActiveDocumentWorkspace = dw;
  764. Program.instance.step_length += 1;
  765. }
  766. //参数-重设
  767. private void button5_Click(object sender, EventArgs e)
  768. {
  769. reset = true;
  770. GetParameters(Program.instance.imageMenuModel);
  771. //初始化/重置参数
  772. resetNumber();
  773. Document document = Document.FromImage(this.bitmap);
  774. this.documentWorkspace.Document = document;
  775. this.documentWorkspace.Refresh();
  776. reset = false;
  777. //picturePreviewControl1.pictureBox1.Image = this.bitmap;
  778. }
  779. /// <summary>
  780. /// Required designer variable.
  781. /// </summary>
  782. private System.ComponentModel.IContainer components = null;
  783. /// <summary>
  784. /// Clean up any resources being used.
  785. /// </summary>
  786. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  787. protected override void Dispose(bool disposing)
  788. {
  789. if (disposing && (components != null))
  790. {
  791. components.Dispose();
  792. }
  793. base.Dispose(disposing);
  794. }
  795. #region Windows Form Designer generated code
  796. private void InitializeLanguageText()
  797. {
  798. this.groupBoxParam.Text = PdnResources.GetString("Menu.params.text");
  799. this.button5.Text = PdnResources.GetString("Menu.rebuild.Text");
  800. this.groupBox1.Text = PdnResources.GetString("Menu.Preview.text");
  801. this.Text = PdnResources.GetString("Menu.geprocessiconditioningsaturationbrigh.Text");
  802. }
  803. /// <summary>
  804. /// Required method for Designer support - do not modify
  805. /// the contents of this method with the code editor.
  806. /// </summary>
  807. private void InitializeComponent()
  808. {
  809. this.parametersSettingControl = new SmartCoalApplication.Core.CustomControl.ParametersSettingAdjustControl();
  810. this.informationControl = new SmartCoalApplication.Core.CustomControl.InformationAdjustControl();
  811. this.groupBoxParam = new System.Windows.Forms.GroupBox();
  812. this.button5 = new System.Windows.Forms.Button();
  813. this.groupBox1 = new System.Windows.Forms.GroupBox();
  814. this.groupBoxParam.SuspendLayout();
  815. this.SuspendLayout();
  816. //
  817. // parametersSettingControl
  818. //
  819. this.parametersSettingControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  820. | System.Windows.Forms.AnchorStyles.Right)));
  821. this.parametersSettingControl.Location = new System.Drawing.Point(12, 12);
  822. this.parametersSettingControl.Name = "parametersSettingControl";
  823. this.parametersSettingControl.Size = new System.Drawing.Size(918, 58);
  824. this.parametersSettingControl.TabIndex = 9;
  825. //
  826. // informationControl
  827. //
  828. this.informationControl.Location = new System.Drawing.Point(12, 76);
  829. this.informationControl.Name = "informationControl";
  830. this.informationControl.Size = new System.Drawing.Size(373, 82);
  831. this.informationControl.TabIndex = 11;
  832. //
  833. // groupBoxParam
  834. //
  835. this.groupBoxParam.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  836. | System.Windows.Forms.AnchorStyles.Left)));
  837. this.groupBoxParam.Controls.Add(this.button5);
  838. this.groupBoxParam.Location = new System.Drawing.Point(12, 164);
  839. this.groupBoxParam.Name = "groupBoxParam";
  840. this.groupBoxParam.Size = new System.Drawing.Size(373, 353);
  841. this.groupBoxParam.TabIndex = 12;
  842. this.groupBoxParam.TabStop = false;
  843. //
  844. // button5
  845. //
  846. this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  847. this.button5.Location = new System.Drawing.Point(292, 324);
  848. this.button5.Name = "button5";
  849. this.button5.Size = new System.Drawing.Size(75, 23);
  850. this.button5.TabIndex = 1;
  851. this.button5.UseVisualStyleBackColor = true;
  852. this.button5.Click += new System.EventHandler(this.button5_Click);
  853. //
  854. // groupBox1
  855. //
  856. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  857. | System.Windows.Forms.AnchorStyles.Left)
  858. | System.Windows.Forms.AnchorStyles.Right)));
  859. this.groupBox1.Location = new System.Drawing.Point(392, 77);
  860. this.groupBox1.Name = "groupBox1";
  861. this.groupBox1.Size = new System.Drawing.Size(538, 440);
  862. this.groupBox1.TabIndex = 13;
  863. this.groupBox1.TabStop = false;
  864. //
  865. // BshTransferAdjustDialog
  866. //
  867. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  868. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  869. this.ClientSize = new System.Drawing.Size(942, 529);
  870. this.Controls.Add(this.groupBox1);
  871. this.Controls.Add(this.groupBoxParam);
  872. this.Controls.Add(this.informationControl);
  873. this.Controls.Add(this.parametersSettingControl);
  874. this.MinimizeBox = false;
  875. this.Name = "BshTransferAdjustDialog";
  876. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BshTransferAdjustDialog_FormClosing);
  877. this.Load += new System.EventHandler(this.BshTransferAdjustDialog_Load);
  878. this.groupBoxParam.ResumeLayout(false);
  879. this.ResumeLayout(false);
  880. }
  881. #endregion
  882. private ParametersSettingAdjustControl parametersSettingControl;
  883. private InformationAdjustControl informationControl;
  884. private System.Windows.Forms.GroupBox groupBoxParam;
  885. private System.Windows.Forms.Button button5;
  886. private System.Windows.Forms.GroupBox groupBox1;
  887. private void BshTransferAdjustDialog_FormClosing(object sender, FormClosingEventArgs e)
  888. {
  889. string newpic = 1 + "";
  890. //获取参数实体
  891. ImageMenu imageMenu;
  892. if (Program.instance.imageMenuModel != null)
  893. {
  894. imageMenu = Program.instance.imageMenuModel;
  895. }
  896. else
  897. {
  898. imageMenu = new ImageMenu();
  899. imageMenu.ListParam = new List<ImageParam>();
  900. }
  901. //数字控制是否生成新图
  902. if (informationControl.radioButton1.Checked)
  903. newpic = 1 + "";
  904. else
  905. newpic = 0 + "";
  906. List<ImageParam> list = imageMenu.ListParam.Where(x => x.menuId == (int)action.MenuId).ToList();
  907. if (list.Count == 0)
  908. {
  909. ImageParam param = new ImageParam();
  910. param.menuId = (int)action.MenuId;
  911. param.param_key = "param_newpic";
  912. param.param_type = -1;
  913. param.param_value = newpic;
  914. imageMenu.ListParam.Add(param);
  915. }
  916. //判断页面是否有参数
  917. if (action.lists.Count > 0)
  918. {
  919. for (int i = 0; i < action.lists.Count; i++)
  920. {
  921. if (list.Count > 0)//是否存过参数
  922. {
  923. for (int j = 0; j < imageMenu.ListParam.Count; j++)//给参数实体赋值
  924. {
  925. if (imageMenu.ListParam[j].menuId == (int)action.MenuId && imageMenu.ListParam[j].param_key == action.lists[i].key)
  926. {
  927. imageMenu.ListParam[j].param_type = (int)action.lists[i].Type;
  928. imageMenu.ListParam[j].param_value = action.lists[i].value.ToString();
  929. //imageMenu.ListParam[j].param_newpic = informationControl.radioButton1.Checked;
  930. }
  931. else if (imageMenu.ListParam[j].menuId == (int)action.MenuId && imageMenu.ListParam[j].param_key == "param_newpic")
  932. {
  933. //imageMenu.ListParam[j].param_type = (int)action.lists[i].Type;
  934. imageMenu.ListParam[j].param_value = newpic;
  935. //imageMenu.ListParam[j].param_newpic = informationControl.radioButton1.Checked;
  936. }
  937. }
  938. //判断是否是白平衡
  939. if (action.MenuId == ActionType.ActionWhiteBalance)
  940. {
  941. for (int j = 0; j < imageMenu.ListParam.Count; j++)//给参数实体赋值
  942. {
  943. if (int.Parse(action.Lists[0].value.ToString()) > 1)
  944. {
  945. if (imageMenu.ListParam[j].param_key == "phaseColor" || imageMenu.ListParam[j].param_key == "imageColor")
  946. {
  947. imageMenu.ListParam[j].menuId = (int)action.MenuId;
  948. imageMenu.ListParam[j].param_key = action.Lists[0].choiseList[int.Parse(action.Lists[0].value.ToString()) - 1].Lists[0].key;
  949. imageMenu.ListParam[j].param_value = action.Lists[0].choiseList[int.Parse(action.Lists[0].value.ToString()) - 1].Lists[0].value.ToString();
  950. }
  951. }
  952. }
  953. }
  954. }
  955. else //如果没保存过新增
  956. {
  957. ImageParam param = new ImageParam();
  958. param.menuId = (int)action.MenuId;
  959. param.param_key = action.lists[i].key;
  960. param.param_type = (int)action.lists[i].Type;
  961. param.param_value = action.lists[i].value.ToString();
  962. //判断是否是白平衡
  963. if (action.MenuId == ActionType.ActionWhiteBalance)
  964. {
  965. ImageParam param5012 = new ImageParam();
  966. try
  967. {
  968. param5012.menuId = (int)action.MenuId;
  969. param5012.param_key = action.Lists[0].choiseList[int.Parse(action.Lists[0].value.ToString()) - 1].Lists[0].key;
  970. param5012.param_value = action.Lists[0].choiseList[int.Parse(action.Lists[0].value.ToString()) - 1].Lists[0].value.ToString();
  971. }
  972. catch (Exception)
  973. {
  974. //ImageParam param5012 = new ImageParam();
  975. param5012.menuId = (int)action.MenuId;
  976. param5012.param_key = "objectSelect";
  977. param5012.param_value = "1";
  978. }
  979. imageMenu.ListParam.Add(param5012);
  980. }
  981. imageMenu.ListParam.Add(param);
  982. }
  983. }
  984. }
  985. else //没有参数,给是否生成新图赋值
  986. {
  987. if (list.Count > 0)
  988. {
  989. for (int j = 0; j < imageMenu.ListParam.Count; j++)
  990. {
  991. if (imageMenu.ListParam[j].menuId == (int)action.MenuId && imageMenu.ListParam[j].param_key == "param_newpic")
  992. {
  993. imageMenu.ListParam[j].param_value = newpic;
  994. }
  995. }
  996. }
  997. }
  998. Program.instance.imageMenuModel = imageMenu;
  999. //按路径和名称保存xml文件
  1000. string userInfoXml = XmlSerializeHelper.XmlSerialize<ImageMenu>(imageMenu);
  1001. //xml保存路径
  1002. string filePath = Application.StartupPath + "\\Config\\" + "Default\\ParameterSaving\\ParameterSaving.xml";
  1003. //保存xml
  1004. FileOperationHelper.WriteStringToFile(userInfoXml, filePath, FileMode.Create);
  1005. }
  1006. /// <summary>
  1007. /// 初始化时获取参数
  1008. /// </summary>
  1009. /// <param name="imageMenu">系统读取的参数配置</param>
  1010. public void GetParameters(ImageMenu imageMenu)
  1011. {
  1012. List<ImageParam> list = new List<ImageParam>();
  1013. if (imageMenu != null && imageMenu.ListParam.Count > 0)
  1014. list = imageMenu.ListParam.Where(x => x.menuId == (int)action.MenuId).ToList();
  1015. if (list.Count > 0)
  1016. {
  1017. initPamasValues = true;
  1018. for (int i = 0; i < action.Lists.Count; i++)
  1019. {
  1020. for (int j = 0; j < list.Count; j++)
  1021. {
  1022. if (list[j].param_key.Equals(action.Lists[i].key))
  1023. {
  1024. action.Lists[i].Type = (Dtryt)list[j].param_type;
  1025. action.Lists[i].value = list[j].param_value;
  1026. break;
  1027. }
  1028. }
  1029. //判断是否是白平衡
  1030. if (action.MenuId == ActionType.ActionWhiteBalance)
  1031. {
  1032. for (int j = 0; j < list.Count; j++)//给参数实体赋值
  1033. {
  1034. if (list[j].param_key == "phaseColor")
  1035. {
  1036. action.Lists[0].choiseList[1].Lists[0].key = "phaseColor";
  1037. action.Lists[0].choiseList[1].Lists[0].value = list[j].param_value;
  1038. }
  1039. if (list[j].param_key == "imageColor")
  1040. {
  1041. action.Lists[0].choiseList[2].Lists[0].key = "imageColor";
  1042. action.Lists[0].choiseList[2].Lists[0].value = list[j].param_value;
  1043. }
  1044. }
  1045. }
  1046. }
  1047. for (int j = 0; j < list.Count; j++)
  1048. {
  1049. if ("param_newpic".Equals(list[j].param_key))
  1050. {
  1051. if (list[j].param_value == "1")
  1052. {
  1053. informationControl.radioButton1.Checked = true;
  1054. informationControl.radioButton2.Checked = false;
  1055. }
  1056. else
  1057. {
  1058. informationControl.radioButton1.Checked = false;
  1059. informationControl.radioButton2.Checked = true;
  1060. }
  1061. }
  1062. }
  1063. }
  1064. }
  1065. }
  1066. }