PolyphaseCounterAnalysisDialog.cs 78 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719
  1. using OpenCvSharp;
  2. using OpenCvSharp.Extensions;
  3. using PaintDotNet.Base.Functionodel;
  4. using PaintDotNet.CustomControl;
  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. using PaintDotNet.DbOpreate.DbBll;
  16. using PaintDotNet.DbOpreate.DbModel;
  17. using PaintDotNet.Base.CommTool;
  18. using PaintDotNet.Instrument;
  19. using Metis.ParameterSet;
  20. using PaintDotNet.Data.Param;
  21. using PaintDotNet.Base;
  22. namespace PaintDotNet.GeneralAnalysis
  23. {
  24. /// <summary>
  25. /// 多相统计分析
  26. /// </summary>
  27. internal class PolyphaseCounterAnalysisDialog : PdnBaseForm
  28. {
  29. #region 控件
  30. private System.Windows.Forms.GroupBox groupBox4;
  31. private System.Windows.Forms.ListView listView1;
  32. private System.Windows.Forms.GroupBox groupBox1;
  33. private System.Windows.Forms.Button button2;
  34. private System.Windows.Forms.CheckBox checkBox1;
  35. private System.Windows.Forms.Button button1;
  36. private System.Windows.Forms.GroupBox groupBox2;
  37. private System.Windows.Forms.GroupBox groupBox_review;
  38. private System.Windows.Forms.GroupBox groupBox5;
  39. private System.Windows.Forms.GroupBox groupBox6;
  40. private System.Windows.Forms.GroupBox groupBox7;
  41. private System.Windows.Forms.Label label1;
  42. private System.Windows.Forms.Button button4;
  43. private System.Windows.Forms.Button button3;
  44. private System.Windows.Forms.DataGridView dataGridView1;
  45. private System.Windows.Forms.ImageList imageList1;
  46. private GroupBox groupBox3;
  47. private Label label5;
  48. private Label label4;
  49. private Label label3;
  50. private Label label2;
  51. private DataGridView dataGridView_results;
  52. private Label lbl_areaRate;
  53. private Label lbl_countPer;
  54. private Label lbl_areaContent;
  55. private Label lbl_count;
  56. private Button button_remove;
  57. private Button button_all;
  58. private IContainer components;
  59. private List<CounterResult> finalResults = new List<CounterResult>();
  60. private List<CounterResult> counterResults = new List<CounterResult>();
  61. private Button btn_close;
  62. #endregion
  63. /// <summary>
  64. /// 主空间
  65. /// </summary>
  66. private AppWorkspace appWorkspace;
  67. /// <summary>
  68. /// 图像面板
  69. /// </summary>
  70. private DocumentWorkspaceWindow documentWorkspace;
  71. /// <summary>
  72. /// 选中图片的mat
  73. /// </summary>
  74. private Mat imageMat;
  75. /// <summary>
  76. /// 当前选择的图片index
  77. /// </summary>
  78. int selectIndex = 0;
  79. private NumericUpDown numericUpDown1;
  80. private int decnum = 2;
  81. private CommonControlButtons commonControlButtons;
  82. private DataGridViewTextBoxColumn Column1;
  83. private DataGridViewTextBoxColumn Column2;
  84. private DataGridViewTextBoxColumn Column3;
  85. private DataGridViewTextBoxColumn Column4;
  86. private DataGridViewTextBoxColumn Column6;
  87. private List<Bitmap> bitList = new List<Bitmap>();
  88. private Button button9;
  89. private CheckedListBox listBox_analysisResult;
  90. private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
  91. private DataGridViewTextBoxColumn Column5;
  92. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
  93. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
  94. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
  95. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
  96. private DataGridViewTextBoxColumn Column7;
  97. private int is_all = 0;
  98. private int imgIndex = -1;
  99. private GeneralAnalysisModel generalAnalysisModel = new GeneralAnalysisModel();
  100. private bool isExportResults = false;
  101. private bool isExportReports = false;
  102. private bool isExportProjects = false;
  103. private int menuId;
  104. private string menuName;
  105. /// <summary>
  106. /// 是否脚本运行
  107. /// </summary>
  108. private Boolean initScriptValues = false;
  109. public PolyphaseCounterAnalysisDialog()
  110. {
  111. InitializeComponent();
  112. }
  113. public PolyphaseCounterAnalysisDialog(AppWorkspace appWorkspace,PdnMenuItem menuItem)
  114. {
  115. InitializeComponent();
  116. InitializeLanguageText();
  117. this.appWorkspace = appWorkspace;
  118. this.menuId = menuItem.MenuId;
  119. this.menuName = menuItem.Text;
  120. this.documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
  121. this.documentWorkspace.Dock = DockStyle.Fill;
  122. this.documentWorkspace.HookMouseEvents();
  123. this.documentWorkspace.AuxiliaryLineEnabled = false;
  124. this.documentWorkspace.Visible = false;
  125. this.groupBox_review.Controls.Add(documentWorkspace);
  126. this.commonControlButtons = new CommonControlButtons();
  127. this.commonControlButtons.Dock = DockStyle.Top;
  128. this.commonControlButtons.Height = 30;
  129. this.commonControlButtons.HideZoomToWindowAndActualSize();
  130. this.groupBox_review.Controls.Add(commonControlButtons);
  131. InitCommonButtonEvent();
  132. InitPicList();
  133. //CalcProcess();
  134. //this.listView1.SelectedIndexChanged += new EventHandler(this.ListViewSelectedIndexChanged);
  135. SetAnalyzeModelFromXml("Template.Manager.item2.PolyphaseCounterAnalysis");
  136. SetStyle(ControlStyles.UserPaint, true);
  137. SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
  138. SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
  139. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.saveLastData);
  140. this.Shown += showImg;
  141. }
  142. /// <summary>
  143. /// 执行脚本自动化的步骤
  144. /// </summary>
  145. private void startScriptAutomaticAction()
  146. {
  147. saveAll();
  148. if (isExportResults)//导出结果
  149. this.button4.PerformClick();
  150. if (isExportReports)//生成报告
  151. this.button3.PerformClick();
  152. if (isExportProjects)//导出项目
  153. this.button9.PerformClick();
  154. this.appWorkspace.ScriptAutomatic = false;
  155. this.Close();
  156. }
  157. /// <summary>
  158. /// 获取上次操作参数
  159. /// </summary>
  160. private void getLastData()
  161. {
  162. string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
  163. if (!System.IO.File.Exists(filePath))
  164. {
  165. generalAnalysisModel = new GeneralAnalysisModel();
  166. generalAnalysisModel.PolyphaseMutiAreaContentModels = new GeneralAnalysisModel.PolyphaseMutiAreaContentModel();
  167. generalAnalysisModel.PolyphaseCounterAnalysisModels = new GeneralAnalysisModel.PolyphaseCounterAnalysisModel();
  168. generalAnalysisModel.TwoPhaseScaleModels = new GeneralAnalysisModel.TwoPhaseScaleModel();
  169. generalAnalysisModel.PolyphaseContentModels = new GeneralAnalysisModel.PolyphaseContentModel();
  170. generalAnalysisModel.PolyphaseDistanceModels = new GeneralAnalysisModel.PolyphaseDistanceModel();
  171. generalAnalysisModel.DebrisSelectionModels = new GeneralAnalysisModel.DebrisSelectionModel();
  172. generalAnalysisModel.CountNumberAnalysisModels = new GeneralAnalysisModel.CountNumberAnalysisModel();
  173. generalAnalysisModel.PolyphaseMutiAreaContentModels.hasUsed = false;
  174. generalAnalysisModel.PolyphaseCounterAnalysisModels.hasUsed = false;
  175. generalAnalysisModel.TwoPhaseScaleModels.hasUsed = false;
  176. generalAnalysisModel.PolyphaseContentModels.hasUsed = false;
  177. generalAnalysisModel.PolyphaseDistanceModels.hasUsed = false;
  178. generalAnalysisModel.DebrisSelectionModels.hasUsed = false;
  179. generalAnalysisModel.CountNumberAnalysisModels.hasUsed = false;
  180. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
  181. Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
  182. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
  183. }
  184. else
  185. {
  186. generalAnalysisModel = XmlSerializeHelper.DESerializer<GeneralAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  187. if (generalAnalysisModel.PolyphaseCounterAnalysisModels == null) {
  188. generalAnalysisModel.PolyphaseCounterAnalysisModels = new GeneralAnalysisModel.PolyphaseCounterAnalysisModel();
  189. }
  190. if (generalAnalysisModel.PolyphaseCounterAnalysisModels.hasUsed)
  191. {
  192. numericUpDown1.Value = generalAnalysisModel.PolyphaseCounterAnalysisModels.parameter1;
  193. checkBox1.Checked = generalAnalysisModel.PolyphaseCounterAnalysisModels.parameter2;
  194. }
  195. }
  196. }
  197. /// <summary>
  198. /// 保存上次操作参数
  199. /// </summary>
  200. private void saveLastData(object sender, EventArgs e)
  201. {
  202. #region [开启脚本录制]
  203. if (appWorkspace.startScriptRecording)
  204. {
  205. getScriptRecording();
  206. }
  207. #endregion
  208. if (generalAnalysisModel.PolyphaseCounterAnalysisModels == null)
  209. {
  210. generalAnalysisModel.PolyphaseCounterAnalysisModels = new GeneralAnalysisModel.PolyphaseCounterAnalysisModel();
  211. }
  212. generalAnalysisModel.PolyphaseCounterAnalysisModels.hasUsed = true;
  213. generalAnalysisModel.PolyphaseCounterAnalysisModels.parameter1 = (int)numericUpDown1.Value;
  214. generalAnalysisModel.PolyphaseCounterAnalysisModels.parameter2 = checkBox1.Checked;
  215. string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
  216. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
  217. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create);
  218. }
  219. #region 公共按钮
  220. private void InitCommonButtonEvent()
  221. {
  222. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  223. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  224. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  225. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  226. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  227. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  228. }
  229. private void zoomInButton_Click(object sender, EventArgs e)
  230. {
  231. if (this.imageMat != null)
  232. this.documentWorkspace.ZoomIn();
  233. }
  234. private void zoomOutButton_Click(object sender, EventArgs e)
  235. {
  236. if (this.imageMat != null)
  237. this.documentWorkspace.ZoomOut();
  238. }
  239. private void zoomToWindowButton_Click(object sender, EventArgs e)
  240. {
  241. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  242. }
  243. private void actualSizeButton_Click(object sender, EventArgs e)
  244. {
  245. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  246. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  247. }
  248. private void pointerButton_Click(object sender, EventArgs e)
  249. {
  250. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
  251. }
  252. private void mobileModeButton_Click(object sender, EventArgs e)
  253. {
  254. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  255. }
  256. #endregion
  257. /// <summary>
  258. /// 初始化图片列表数据
  259. /// </summary>
  260. //public void InitPicList()
  261. //{
  262. // //初始化图片列表
  263. // for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  264. // {
  265. // this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  266. // this.listView1.Items.Add("", i);
  267. // this.listView1.Items[i].ImageIndex = i;
  268. // this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  269. // this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  270. // }
  271. //}
  272. public void InitPicList()
  273. {
  274. //初始化图片列表
  275. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  276. {
  277. this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.Thumbnail);
  278. this.listView1.Items.Add("", i);
  279. this.listView1.Items[i].ImageIndex = i;
  280. String imageName = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  281. if (listView1.Items.Find(imageName, false).Count() > 0)
  282. {
  283. if (imageName.Split('.').Count() > 1)
  284. {
  285. imageName = imageName.Split('.')[0] + "(" + listView1.Items.Find(imageName, false).Count() + ")." + imageName.Split('.')[1];
  286. }
  287. }
  288. this.listView1.Items[i].Text = imageName;
  289. this.listView1.Items[i].Name = imageName;
  290. if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
  291. {
  292. this.imgIndex = i;
  293. }
  294. }
  295. }
  296. private void PolyphaseCounterAnalysisDialog_Load(object sender, EventArgs e)
  297. {
  298. }
  299. private void InitializeLanguageText()
  300. {
  301. this.btn_close.Text = PdnResources.GetString("Menu.File.Close.Text");
  302. this.groupBox4.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  303. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  304. this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
  305. this.checkBox1.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  306. this.button1.Text = PdnResources.GetString("Menu.Setting.Text");
  307. this.groupBox2.Text = PdnResources.GetString("Menu.Resultspreview.text");
  308. this.Column1.HeaderText = PdnResources.GetString("Menu.Phasename.text");
  309. this.Column2.HeaderText = PdnResources.GetString("Menu.Number.text");
  310. this.Column3.HeaderText = PdnResources.GetString("Menu.Percentage.text");
  311. this.Column4.HeaderText = PdnResources.GetString("Menu.Areapercent.text");
  312. this.Column6.HeaderText = PdnResources.GetString("Menu.Areacontent.text");
  313. this.groupBox_review.Text = PdnResources.GetString("Menu.Preview.text");
  314. this.groupBox5.Text = PdnResources.GetString("Menu.Analysisresult.text");
  315. this.button_remove.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  316. this.button_all.Text = PdnResources.GetString("Menu.Showall.text");
  317. this.Column5.HeaderText = PdnResources.GetString("Menu.picture.Text");
  318. this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.Phasename.text");
  319. this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.Number.text");
  320. this.dataGridViewTextBoxColumn3.HeaderText = PdnResources.GetString("Menu.Percentage.text");
  321. this.dataGridViewTextBoxColumn4.HeaderText = PdnResources.GetString("Menu.Areapercent.text");
  322. this.Column7.HeaderText = PdnResources.GetString("Menu.Areacontent.text");
  323. this.button9.Text = PdnResources.GetString("Menu.Tools.OpenProject.Text");
  324. this.label1.Text = PdnResources.GetString("Menu.Decimal.text");
  325. this.label4.Text = PdnResources.GetString("Menu.Percentage.text") + ":";
  326. this.button4.Text = PdnResources.GetString("Menu.Exportresults.text");
  327. this.button3.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  328. this.groupBox3.Text = PdnResources.GetString("Menu.Averageresult.text");
  329. this.label5.Text = PdnResources.GetString("Menu.Areapercent.text") + ":";
  330. this.label3.Text = PdnResources.GetString("Menu.Areacontent.text") + ":";
  331. this.label2.Text = PdnResources.GetString("Menu.Number.text") + ":";
  332. this.Text = PdnResources.GetString("Menu.Generalanalysis.Multiphasestatistics.Multiphnalysis.text");
  333. }
  334. private void InitializeComponent()
  335. {
  336. this.components = new System.ComponentModel.Container();
  337. this.groupBox4 = new System.Windows.Forms.GroupBox();
  338. this.listView1 = new System.Windows.Forms.ListView();
  339. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  340. this.groupBox1 = new System.Windows.Forms.GroupBox();
  341. this.btn_close = new System.Windows.Forms.Button();
  342. this.button2 = new System.Windows.Forms.Button();
  343. this.checkBox1 = new System.Windows.Forms.CheckBox();
  344. this.button1 = new System.Windows.Forms.Button();
  345. this.groupBox2 = new System.Windows.Forms.GroupBox();
  346. this.dataGridView1 = new System.Windows.Forms.DataGridView();
  347. this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  348. this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  349. this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  350. this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  351. this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  352. this.groupBox_review = new System.Windows.Forms.GroupBox();
  353. this.groupBox5 = new System.Windows.Forms.GroupBox();
  354. this.listBox_analysisResult = new System.Windows.Forms.CheckedListBox();
  355. this.button_remove = new System.Windows.Forms.Button();
  356. this.button_all = new System.Windows.Forms.Button();
  357. this.groupBox6 = new System.Windows.Forms.GroupBox();
  358. this.dataGridView_results = new System.Windows.Forms.DataGridView();
  359. this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  360. this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  361. this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  362. this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  363. this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  364. this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  365. this.groupBox7 = new System.Windows.Forms.GroupBox();
  366. this.button9 = new System.Windows.Forms.Button();
  367. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  368. this.label1 = new System.Windows.Forms.Label();
  369. this.button4 = new System.Windows.Forms.Button();
  370. this.button3 = new System.Windows.Forms.Button();
  371. this.groupBox3 = new System.Windows.Forms.GroupBox();
  372. this.lbl_areaRate = new System.Windows.Forms.Label();
  373. this.lbl_countPer = new System.Windows.Forms.Label();
  374. this.lbl_areaContent = new System.Windows.Forms.Label();
  375. this.lbl_count = new System.Windows.Forms.Label();
  376. this.label5 = new System.Windows.Forms.Label();
  377. this.label4 = new System.Windows.Forms.Label();
  378. this.label3 = new System.Windows.Forms.Label();
  379. this.label2 = new System.Windows.Forms.Label();
  380. this.groupBox4.SuspendLayout();
  381. this.groupBox1.SuspendLayout();
  382. this.groupBox2.SuspendLayout();
  383. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
  384. this.groupBox5.SuspendLayout();
  385. this.groupBox6.SuspendLayout();
  386. ((System.ComponentModel.ISupportInitialize)(this.dataGridView_results)).BeginInit();
  387. this.groupBox7.SuspendLayout();
  388. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  389. this.groupBox3.SuspendLayout();
  390. this.SuspendLayout();
  391. //
  392. // groupBox4
  393. //
  394. this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  395. | System.Windows.Forms.AnchorStyles.Left)));
  396. this.groupBox4.Controls.Add(this.listView1);
  397. this.groupBox4.Location = new System.Drawing.Point(13, 72);
  398. this.groupBox4.Margin = new System.Windows.Forms.Padding(4);
  399. this.groupBox4.Name = "groupBox4";
  400. this.groupBox4.Padding = new System.Windows.Forms.Padding(4);
  401. this.groupBox4.Size = new System.Drawing.Size(158, 483);
  402. this.groupBox4.TabIndex = 9;
  403. this.groupBox4.TabStop = false;
  404. this.groupBox4.Text = "图像索引";
  405. //
  406. // listView1
  407. //
  408. this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  409. | System.Windows.Forms.AnchorStyles.Left)
  410. | System.Windows.Forms.AnchorStyles.Right)));
  411. this.listView1.HideSelection = false;
  412. this.listView1.LargeImageList = this.imageList1;
  413. this.listView1.Location = new System.Drawing.Point(8, 26);
  414. this.listView1.Margin = new System.Windows.Forms.Padding(4);
  415. this.listView1.MultiSelect = false;
  416. this.listView1.Name = "listView1";
  417. this.listView1.Size = new System.Drawing.Size(140, 449);
  418. this.listView1.TabIndex = 0;
  419. this.listView1.UseCompatibleStateImageBehavior = false;
  420. this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
  421. //
  422. // imageList1
  423. //
  424. this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  425. this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
  426. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  427. //
  428. // groupBox1
  429. //
  430. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  431. | System.Windows.Forms.AnchorStyles.Right)));
  432. this.groupBox1.Controls.Add(this.btn_close);
  433. this.groupBox1.Controls.Add(this.button2);
  434. this.groupBox1.Controls.Add(this.checkBox1);
  435. this.groupBox1.Controls.Add(this.button1);
  436. this.groupBox1.Location = new System.Drawing.Point(20, 12);
  437. this.groupBox1.Name = "groupBox1";
  438. this.groupBox1.Size = new System.Drawing.Size(1145, 53);
  439. this.groupBox1.TabIndex = 10;
  440. this.groupBox1.TabStop = false;
  441. //
  442. // btn_close
  443. //
  444. this.btn_close.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  445. this.btn_close.Location = new System.Drawing.Point(953, 21);
  446. this.btn_close.Name = "btn_close";
  447. this.btn_close.Size = new System.Drawing.Size(75, 23);
  448. this.btn_close.TabIndex = 3;
  449. this.btn_close.Text = "关闭";
  450. this.btn_close.UseVisualStyleBackColor = true;
  451. this.btn_close.Click += new System.EventHandler(this.btn_close_Click);
  452. //
  453. // button2
  454. //
  455. this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  456. this.button2.Location = new System.Drawing.Point(1053, 21);
  457. this.button2.Name = "button2";
  458. this.button2.Size = new System.Drawing.Size(75, 23);
  459. this.button2.TabIndex = 2;
  460. this.button2.Text = "保存结果";
  461. this.button2.UseVisualStyleBackColor = true;
  462. this.button2.Click += new System.EventHandler(this.button2_Click);
  463. //
  464. // checkBox1
  465. //
  466. this.checkBox1.AutoSize = true;
  467. this.checkBox1.Location = new System.Drawing.Point(98, 24);
  468. this.checkBox1.Name = "checkBox1";
  469. this.checkBox1.Size = new System.Drawing.Size(132, 16);
  470. this.checkBox1.TabIndex = 1;
  471. this.checkBox1.Text = "生成报告时打开设置";
  472. this.checkBox1.UseVisualStyleBackColor = true;
  473. //
  474. // button1
  475. //
  476. this.button1.Location = new System.Drawing.Point(6, 24);
  477. this.button1.Name = "button1";
  478. this.button1.Size = new System.Drawing.Size(75, 23);
  479. this.button1.TabIndex = 0;
  480. this.button1.Text = "设置";
  481. this.button1.UseVisualStyleBackColor = true;
  482. this.button1.Click += new System.EventHandler(this.button1_Click);
  483. //
  484. // groupBox2
  485. //
  486. this.groupBox2.Controls.Add(this.dataGridView1);
  487. this.groupBox2.Location = new System.Drawing.Point(178, 72);
  488. this.groupBox2.Name = "groupBox2";
  489. this.groupBox2.Size = new System.Drawing.Size(406, 347);
  490. this.groupBox2.TabIndex = 11;
  491. this.groupBox2.TabStop = false;
  492. this.groupBox2.Text = "结果预览";
  493. //
  494. // dataGridView1
  495. //
  496. this.dataGridView1.AllowUserToAddRows = false;
  497. this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
  498. this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  499. this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  500. this.Column1,
  501. this.Column2,
  502. this.Column3,
  503. this.Column4,
  504. this.Column6});
  505. this.dataGridView1.Location = new System.Drawing.Point(6, 26);
  506. this.dataGridView1.Name = "dataGridView1";
  507. this.dataGridView1.RowHeadersVisible = false;
  508. this.dataGridView1.RowHeadersWidth = 51;
  509. this.dataGridView1.RowTemplate.Height = 27;
  510. this.dataGridView1.Size = new System.Drawing.Size(394, 444);
  511. this.dataGridView1.TabIndex = 0;
  512. this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
  513. //
  514. // Column1
  515. //
  516. this.Column1.MinimumWidth = 6;
  517. this.Column1.Name = "Column1";
  518. this.Column1.Width = 70;
  519. //
  520. // Column2
  521. //
  522. this.Column2.MinimumWidth = 6;
  523. this.Column2.Name = "Column2";
  524. this.Column2.Width = 55;
  525. //
  526. // Column3
  527. //
  528. this.Column3.MinimumWidth = 6;
  529. this.Column3.Name = "Column3";
  530. this.Column3.Width = 90;
  531. //
  532. // Column4
  533. //
  534. this.Column4.MinimumWidth = 6;
  535. this.Column4.Name = "Column4";
  536. this.Column4.Width = 90;
  537. //
  538. // Column6
  539. //
  540. this.Column6.MinimumWidth = 6;
  541. this.Column6.Name = "Column6";
  542. this.Column6.Width = 125;
  543. //
  544. // groupBox_review
  545. //
  546. this.groupBox_review.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  547. | System.Windows.Forms.AnchorStyles.Left)
  548. | System.Windows.Forms.AnchorStyles.Right)));
  549. this.groupBox_review.Location = new System.Drawing.Point(590, 72);
  550. this.groupBox_review.Name = "groupBox_review";
  551. this.groupBox_review.Size = new System.Drawing.Size(575, 483);
  552. this.groupBox_review.TabIndex = 12;
  553. this.groupBox_review.TabStop = false;
  554. this.groupBox_review.Text = "预览";
  555. //
  556. // groupBox5
  557. //
  558. this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  559. this.groupBox5.Controls.Add(this.listBox_analysisResult);
  560. this.groupBox5.Controls.Add(this.button_remove);
  561. this.groupBox5.Controls.Add(this.button_all);
  562. this.groupBox5.Location = new System.Drawing.Point(12, 562);
  563. this.groupBox5.Name = "groupBox5";
  564. this.groupBox5.Size = new System.Drawing.Size(224, 165);
  565. this.groupBox5.TabIndex = 13;
  566. this.groupBox5.TabStop = false;
  567. this.groupBox5.Text = "分析结果";
  568. //
  569. // listBox_analysisResult
  570. //
  571. this.listBox_analysisResult.CheckOnClick = true;
  572. this.listBox_analysisResult.FormattingEnabled = true;
  573. this.listBox_analysisResult.HorizontalScrollbar = true;
  574. this.listBox_analysisResult.Location = new System.Drawing.Point(11, 57);
  575. this.listBox_analysisResult.Name = "listBox_analysisResult";
  576. this.listBox_analysisResult.Size = new System.Drawing.Size(202, 100);
  577. this.listBox_analysisResult.TabIndex = 11;
  578. this.listBox_analysisResult.SelectedIndexChanged += new System.EventHandler(this.listBox_analysisResult_SelectedIndexChanged);
  579. //
  580. // button_remove
  581. //
  582. this.button_remove.Location = new System.Drawing.Point(130, 24);
  583. this.button_remove.Name = "button_remove";
  584. this.button_remove.Size = new System.Drawing.Size(75, 23);
  585. this.button_remove.TabIndex = 8;
  586. this.button_remove.Text = "删除";
  587. this.button_remove.UseVisualStyleBackColor = true;
  588. this.button_remove.Click += new System.EventHandler(this.button_remove_Click);
  589. //
  590. // button_all
  591. //
  592. this.button_all.Location = new System.Drawing.Point(14, 24);
  593. this.button_all.Name = "button_all";
  594. this.button_all.Size = new System.Drawing.Size(75, 23);
  595. this.button_all.TabIndex = 1;
  596. this.button_all.Text = "全部显示";
  597. this.button_all.UseVisualStyleBackColor = true;
  598. this.button_all.Click += new System.EventHandler(this.button_all_Click);
  599. //
  600. // groupBox6
  601. //
  602. this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  603. | System.Windows.Forms.AnchorStyles.Right)));
  604. this.groupBox6.Controls.Add(this.dataGridView_results);
  605. this.groupBox6.Location = new System.Drawing.Point(257, 562);
  606. this.groupBox6.Name = "groupBox6";
  607. this.groupBox6.Size = new System.Drawing.Size(769, 165);
  608. this.groupBox6.TabIndex = 14;
  609. this.groupBox6.TabStop = false;
  610. //
  611. // dataGridView_results
  612. //
  613. this.dataGridView_results.AllowUserToAddRows = false;
  614. this.dataGridView_results.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  615. | System.Windows.Forms.AnchorStyles.Right)));
  616. this.dataGridView_results.BorderStyle = System.Windows.Forms.BorderStyle.None;
  617. this.dataGridView_results.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  618. this.dataGridView_results.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  619. this.Column5,
  620. this.dataGridViewTextBoxColumn1,
  621. this.dataGridViewTextBoxColumn2,
  622. this.dataGridViewTextBoxColumn3,
  623. this.dataGridViewTextBoxColumn4,
  624. this.Column7});
  625. this.dataGridView_results.Location = new System.Drawing.Point(16, 20);
  626. this.dataGridView_results.Name = "dataGridView_results";
  627. this.dataGridView_results.RowHeadersVisible = false;
  628. this.dataGridView_results.RowHeadersWidth = 51;
  629. this.dataGridView_results.RowTemplate.Height = 27;
  630. this.dataGridView_results.Size = new System.Drawing.Size(733, 139);
  631. this.dataGridView_results.TabIndex = 1;
  632. //
  633. // Column5
  634. //
  635. this.Column5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
  636. this.Column5.HeaderText = "Column5";
  637. this.Column5.MinimumWidth = 6;
  638. this.Column5.Name = "Column5";
  639. //
  640. // dataGridViewTextBoxColumn1
  641. //
  642. this.dataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
  643. this.dataGridViewTextBoxColumn1.HeaderText = "dataGridViewTextBoxColumn1";
  644. this.dataGridViewTextBoxColumn1.MinimumWidth = 6;
  645. this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
  646. //
  647. // dataGridViewTextBoxColumn2
  648. //
  649. this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
  650. this.dataGridViewTextBoxColumn2.HeaderText = "dataGridViewTextBoxColumn2";
  651. this.dataGridViewTextBoxColumn2.MinimumWidth = 6;
  652. this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
  653. //
  654. // dataGridViewTextBoxColumn3
  655. //
  656. this.dataGridViewTextBoxColumn3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
  657. this.dataGridViewTextBoxColumn3.HeaderText = "dataGridViewTextBoxColumn3";
  658. this.dataGridViewTextBoxColumn3.MinimumWidth = 6;
  659. this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
  660. //
  661. // dataGridViewTextBoxColumn4
  662. //
  663. this.dataGridViewTextBoxColumn4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
  664. this.dataGridViewTextBoxColumn4.HeaderText = "dataGridViewTextBoxColumn4";
  665. this.dataGridViewTextBoxColumn4.MinimumWidth = 6;
  666. this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
  667. //
  668. // Column7
  669. //
  670. this.Column7.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
  671. this.Column7.HeaderText = "Column7";
  672. this.Column7.Name = "Column7";
  673. //
  674. // groupBox7
  675. //
  676. this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  677. this.groupBox7.Controls.Add(this.button9);
  678. this.groupBox7.Controls.Add(this.numericUpDown1);
  679. this.groupBox7.Controls.Add(this.label1);
  680. this.groupBox7.Controls.Add(this.button4);
  681. this.groupBox7.Controls.Add(this.button3);
  682. this.groupBox7.Location = new System.Drawing.Point(1032, 562);
  683. this.groupBox7.Name = "groupBox7";
  684. this.groupBox7.Size = new System.Drawing.Size(133, 165);
  685. this.groupBox7.TabIndex = 15;
  686. this.groupBox7.TabStop = false;
  687. //
  688. // button9
  689. //
  690. this.button9.Location = new System.Drawing.Point(29, 94);
  691. this.button9.Name = "button9";
  692. this.button9.Size = new System.Drawing.Size(77, 23);
  693. this.button9.TabIndex = 8;
  694. this.button9.Text = "项目工程";
  695. this.button9.UseVisualStyleBackColor = true;
  696. this.button9.Click += new System.EventHandler(this.button9_Click);
  697. //
  698. // numericUpDown1
  699. //
  700. this.numericUpDown1.Location = new System.Drawing.Point(52, 131);
  701. this.numericUpDown1.Maximum = new decimal(new int[] {
  702. 10,
  703. 0,
  704. 0,
  705. 0});
  706. this.numericUpDown1.Name = "numericUpDown1";
  707. this.numericUpDown1.Size = new System.Drawing.Size(54, 21);
  708. this.numericUpDown1.TabIndex = 4;
  709. this.numericUpDown1.Value = new decimal(new int[] {
  710. 2,
  711. 0,
  712. 0,
  713. 0});
  714. this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
  715. //
  716. // label1
  717. //
  718. this.label1.AutoSize = true;
  719. this.label1.Location = new System.Drawing.Point(17, 133);
  720. this.label1.Name = "label1";
  721. this.label1.Size = new System.Drawing.Size(41, 12);
  722. this.label1.TabIndex = 3;
  723. this.label1.Text = "小数:";
  724. //
  725. // button4
  726. //
  727. this.button4.Location = new System.Drawing.Point(29, 57);
  728. this.button4.Name = "button4";
  729. this.button4.Size = new System.Drawing.Size(75, 23);
  730. this.button4.TabIndex = 1;
  731. this.button4.Text = "导出结果";
  732. this.button4.UseVisualStyleBackColor = true;
  733. this.button4.Click += new System.EventHandler(this.button4_Click);
  734. //
  735. // button3
  736. //
  737. this.button3.Location = new System.Drawing.Point(29, 20);
  738. this.button3.Name = "button3";
  739. this.button3.Size = new System.Drawing.Size(75, 23);
  740. this.button3.TabIndex = 0;
  741. this.button3.Text = "生成报告";
  742. this.button3.UseVisualStyleBackColor = true;
  743. this.button3.Click += new System.EventHandler(this.button3_Click);
  744. //
  745. // groupBox3
  746. //
  747. this.groupBox3.Controls.Add(this.lbl_areaRate);
  748. this.groupBox3.Controls.Add(this.lbl_countPer);
  749. this.groupBox3.Controls.Add(this.lbl_areaContent);
  750. this.groupBox3.Controls.Add(this.lbl_count);
  751. this.groupBox3.Controls.Add(this.label5);
  752. this.groupBox3.Controls.Add(this.label4);
  753. this.groupBox3.Controls.Add(this.label3);
  754. this.groupBox3.Controls.Add(this.label2);
  755. this.groupBox3.Location = new System.Drawing.Point(184, 439);
  756. this.groupBox3.Name = "groupBox3";
  757. this.groupBox3.Size = new System.Drawing.Size(394, 116);
  758. this.groupBox3.TabIndex = 16;
  759. this.groupBox3.TabStop = false;
  760. this.groupBox3.Text = "平均结果";
  761. //
  762. // lbl_areaRate
  763. //
  764. this.lbl_areaRate.AutoSize = true;
  765. this.lbl_areaRate.Location = new System.Drawing.Point(256, 61);
  766. this.lbl_areaRate.Name = "lbl_areaRate";
  767. this.lbl_areaRate.Size = new System.Drawing.Size(0, 12);
  768. this.lbl_areaRate.TabIndex = 7;
  769. //
  770. // lbl_countPer
  771. //
  772. this.lbl_countPer.AutoSize = true;
  773. this.lbl_countPer.Location = new System.Drawing.Point(256, 20);
  774. this.lbl_countPer.Name = "lbl_countPer";
  775. this.lbl_countPer.Size = new System.Drawing.Size(0, 12);
  776. this.lbl_countPer.TabIndex = 6;
  777. //
  778. // lbl_areaContent
  779. //
  780. this.lbl_areaContent.AutoSize = true;
  781. this.lbl_areaContent.Location = new System.Drawing.Point(81, 61);
  782. this.lbl_areaContent.Name = "lbl_areaContent";
  783. this.lbl_areaContent.Size = new System.Drawing.Size(0, 12);
  784. this.lbl_areaContent.TabIndex = 5;
  785. //
  786. // lbl_count
  787. //
  788. this.lbl_count.AutoSize = true;
  789. this.lbl_count.Location = new System.Drawing.Point(63, 21);
  790. this.lbl_count.Name = "lbl_count";
  791. this.lbl_count.Size = new System.Drawing.Size(0, 12);
  792. this.lbl_count.TabIndex = 4;
  793. //
  794. // label5
  795. //
  796. this.label5.AutoSize = true;
  797. this.label5.Location = new System.Drawing.Point(179, 61);
  798. this.label5.Name = "label5";
  799. this.label5.Size = new System.Drawing.Size(77, 12);
  800. this.label5.TabIndex = 3;
  801. this.label5.Text = "面积百分比:";
  802. //
  803. // label4
  804. //
  805. this.label4.AutoSize = true;
  806. this.label4.Location = new System.Drawing.Point(179, 20);
  807. this.label4.Name = "label4";
  808. this.label4.Size = new System.Drawing.Size(77, 12);
  809. this.label4.TabIndex = 2;
  810. this.label4.Text = "个数百分比:";
  811. //
  812. // label3
  813. //
  814. this.label3.AutoSize = true;
  815. this.label3.Location = new System.Drawing.Point(16, 61);
  816. this.label3.Name = "label3";
  817. this.label3.Size = new System.Drawing.Size(65, 12);
  818. this.label3.TabIndex = 1;
  819. this.label3.Text = "面积含量:";
  820. //
  821. // label2
  822. //
  823. this.label2.AutoSize = true;
  824. this.label2.Location = new System.Drawing.Point(16, 21);
  825. this.label2.Name = "label2";
  826. this.label2.Size = new System.Drawing.Size(41, 12);
  827. this.label2.TabIndex = 0;
  828. this.label2.Text = "个数:";
  829. //
  830. // PolyphaseCounterAnalysisDialog
  831. //
  832. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  833. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  834. this.ClientSize = new System.Drawing.Size(1177, 744);
  835. this.Controls.Add(this.groupBox3);
  836. this.Controls.Add(this.groupBox7);
  837. this.Controls.Add(this.groupBox6);
  838. this.Controls.Add(this.groupBox5);
  839. this.Controls.Add(this.groupBox_review);
  840. this.Controls.Add(this.groupBox2);
  841. this.Controls.Add(this.groupBox1);
  842. this.Controls.Add(this.groupBox4);
  843. this.Name = "PolyphaseCounterAnalysisDialog";
  844. this.Text = "多相统计分析";
  845. this.Controls.SetChildIndex(this.groupBox4, 0);
  846. this.Controls.SetChildIndex(this.groupBox1, 0);
  847. this.Controls.SetChildIndex(this.groupBox2, 0);
  848. this.Controls.SetChildIndex(this.groupBox_review, 0);
  849. this.Controls.SetChildIndex(this.groupBox5, 0);
  850. this.Controls.SetChildIndex(this.groupBox6, 0);
  851. this.Controls.SetChildIndex(this.groupBox7, 0);
  852. this.Controls.SetChildIndex(this.groupBox3, 0);
  853. this.groupBox4.ResumeLayout(false);
  854. this.groupBox1.ResumeLayout(false);
  855. this.groupBox1.PerformLayout();
  856. this.groupBox2.ResumeLayout(false);
  857. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  858. this.groupBox5.ResumeLayout(false);
  859. this.groupBox6.ResumeLayout(false);
  860. ((System.ComponentModel.ISupportInitialize)(this.dataGridView_results)).EndInit();
  861. this.groupBox7.ResumeLayout(false);
  862. this.groupBox7.PerformLayout();
  863. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  864. this.groupBox3.ResumeLayout(false);
  865. this.groupBox3.PerformLayout();
  866. this.ResumeLayout(false);
  867. }
  868. private void showImg(object sender, EventArgs e)
  869. {
  870. listView1.Focus();
  871. if (this.imgIndex != -1)
  872. {
  873. //滚动到指定的行位置
  874. this.listView1.EnsureVisible(this.imgIndex);
  875. this.listView1.Items[imgIndex].Focused = true;
  876. this.listView1.Items[imgIndex].Selected = true;
  877. //如果是脚本执行,将参数带入
  878. if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
  879. {
  880. this.initScriptValues = true;//ScriptAutomatic
  881. //Boolean initScriptValues = true;
  882. ////在这里反射出对应功能的参数类
  883. string className = InvariantData.path_Action + ".Action" + menuId;
  884. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  885. foreach (Args arg in param.Lists)
  886. {
  887. Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
  888. if (param1.value != null)
  889. arg.Value = param1.value;
  890. getValue(arg.key, arg.Value);
  891. }
  892. appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
  893. }
  894. else
  895. {//读取上次关闭窗口时保存的参数
  896. getLastData();
  897. }
  898. if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
  899. this.startScriptAutomaticAction();
  900. }
  901. }
  902. private void listView1_SelectedIndexChanged(object sender, EventArgs e)
  903. {
  904. if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
  905. {
  906. this.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
  907. Document document = Document.FromImageMat(imageMat.Clone());
  908. this.documentWorkspace.Document = document;
  909. this.documentWorkspace.Visible = true;
  910. this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList;
  911. this.documentWorkspace.phaseModels = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].phaseModels;
  912. this.dataGridView1.Rows.Clear();
  913. lbl_count.Text = "0";
  914. lbl_countPer.Text = "0";
  915. lbl_areaContent.Text = "0";
  916. lbl_areaRate.Text = "0";
  917. this.applyButtonImpl(sender, e);
  918. }
  919. }
  920. private void show_avg()
  921. {
  922. if (listView1.FocusedItem != null)
  923. {
  924. var results = counterResults.Where(p => p.GraphName.Equals(listView1.FocusedItem.Text));
  925. if (results.Count() > 0)
  926. {
  927. lbl_count.Text = AnalysisTools.GetDecNum(results.Average(item => item.Count), decnum);
  928. lbl_countPer.Text = AnalysisTools.GetDecNum(results.Average(item => item.CountPercent), decnum);
  929. lbl_areaContent.Text = AnalysisTools.GetDecNum(results.Average(item => item.AreaContent), decnum);
  930. lbl_areaRate.Text = AnalysisTools.GetDecNum(results.Average(item => item.AreaPercent), decnum);
  931. }
  932. }
  933. }
  934. /// <summary>
  935. /// 参数改变时,重新处理图像
  936. /// </summary>
  937. /// <param name="sender"></param>
  938. /// <param name="e"></param>
  939. private void applyButtonImpl(object sender, EventArgs e)
  940. {
  941. if (this.documentWorkspace.phaseModels.Count==0)
  942. {
  943. MessageBox.Show(PdnResources.GetString("Menu.Thereisnophasetoanalyze.text")+"!");
  944. return;
  945. }
  946. if (this.listView1.FocusedItem != null)
  947. {
  948. dataGridView1.Rows.Clear();
  949. counterResults.Clear();
  950. selectIndex = this.listView1.FocusedItem.Index;
  951. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces[selectIndex].phaseModels.Count; i++)
  952. {
  953. PhaseModel pModel = this.appWorkspace.DocumentWorkspaces[selectIndex].phaseModels[i];
  954. if (pModel.mat == null)
  955. {
  956. continue;
  957. }
  958. Color pColor = new Color();
  959. pColor = Color.FromArgb(pModel.color);
  960. Mat[] contours = null;
  961. Mat hierarchy = new Mat();
  962. Mat mat = Mat.FromImageData(pModel.mat.ToBytes(), ImreadModes.Grayscale);
  963. Cv2.FindContours(mat, out contours, hierarchy, RetrievalModes.External, ContourApproximationModes.ApproxNone);
  964. CounterResult result = new CounterResult();
  965. result.GraphName = listView1.FocusedItem.Text;
  966. result.PolyphaseName = pModel.name;
  967. result.Count = contours.Count();
  968. //如果存在视场
  969. if (this.appWorkspace.DocumentWorkspaces[selectIndex].GraphicsList.IsExsitView())
  970. {
  971. //相面积
  972. long phaseArea = AnalysisTools.GetPointsFromMat(pModel.mat);
  973. //总面积
  974. long fullArea = AnalysisTools.GetPointsFromMat(this.imageMat.Clone());
  975. //获取合并视场
  976. Bitmap frontTarget = this.documentWorkspace.GetFullSizeWithRegion(this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap()/* //待测试 this.bitmap*/);
  977. //获取视图中相的点合计
  978. //long fullArea = AnalysisTools.GetPointsFromMat(BitmapConverter.ToMat(frontTarget));
  979. long fullViewArea = AnalysisTools.GetPointsFromMat(PaintDotNet.Camera.Tools.ToMat(frontTarget));
  980. result.Area = phaseArea;
  981. if (fullArea > 0)
  982. {
  983. result.AreaContent = (double)phaseArea / fullViewArea * 100;
  984. //result.AreaPercent = (double)phaseArea / fullArea * 100;
  985. }
  986. else
  987. {
  988. result.AreaContent = 0;
  989. //result.AreaPercent = 0;
  990. }
  991. }
  992. else
  993. {
  994. ///处理百分比
  995. long phaseArea = AnalysisTools.GetPointsFromMat(pModel.mat);
  996. long fullArea = AnalysisTools.GetPointsFromMat(this.imageMat/*.Clone()*/);
  997. result.Area = phaseArea;
  998. if (fullArea > 0)
  999. {
  1000. result.AreaContent = (double)phaseArea / fullArea * 100;
  1001. }else
  1002. {
  1003. result.AreaContent = 0;
  1004. }
  1005. }
  1006. counterResults.Add(result);
  1007. }
  1008. int iCount = counterResults.Sum(u => u.Count);
  1009. double amountArea = counterResults.Sum(u => u.Area);
  1010. for (int j = 0; j < counterResults.Count; j++)
  1011. {
  1012. if (iCount > 0)
  1013. {
  1014. counterResults[j].CountPercent = (double)counterResults[j].Count / iCount * 100;
  1015. }else
  1016. {
  1017. counterResults[j].CountPercent = 0;
  1018. }
  1019. if (counterResults[j].AreaPercent == 0)
  1020. {
  1021. if (amountArea > 0)
  1022. {
  1023. counterResults[j].AreaPercent = (double)counterResults[j].Area / amountArea * 100;
  1024. }else
  1025. {
  1026. counterResults[j].AreaPercent = 0;
  1027. }
  1028. }
  1029. dataGridView1.Rows.Add(counterResults[j].PolyphaseName, counterResults[j].Count, AnalysisTools.GetDecNum(counterResults[j].CountPercent,decnum), AnalysisTools.GetDecNum(counterResults[j].AreaPercent,decnum), AnalysisTools.GetDecNum(counterResults[j].AreaContent,decnum));
  1030. }
  1031. show_avg();
  1032. }
  1033. }
  1034. private void Draw(Graphics graphics)
  1035. {
  1036. if (this.documentWorkspace.phaseModels.Count > 0)
  1037. {
  1038. foreach (PhaseModel model in this.documentWorkspace.phaseModels)
  1039. {
  1040. if (model.choise && model.mat != null)
  1041. {
  1042. Bitmap map = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(model.mat);
  1043. graphics.DrawImage(map, 0, 0, map.Width, map.Height);
  1044. }
  1045. }
  1046. if (this.documentWorkspace.GraphicsList != null)
  1047. {
  1048. this.documentWorkspace.GraphicsList.Draw(graphics);
  1049. }
  1050. }
  1051. }
  1052. private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
  1053. {
  1054. }
  1055. private void button2_Click(object sender, EventArgs e)
  1056. {
  1057. if (listView1.SelectedItems.Count == 0)
  1058. {
  1059. MessageBox.Show(PdnResources.GetString("Menu.seselecttheimagethatyouwanttoan.Text")+"!");
  1060. return;
  1061. }
  1062. if (this.documentWorkspace.phaseModels.Count == 0) {
  1063. return;
  1064. }
  1065. String tag = listView1.FocusedItem.Text;
  1066. List<Bitmap> tempBit = new List<Bitmap>();
  1067. if (listView1.FocusedItem != null)
  1068. {
  1069. if (finalResults.FindAll(item => item.GraphName.Equals(listView1.FocusedItem.Text)).Count == 0)
  1070. {
  1071. listBox_analysisResult.Items.Add(this.listView1.FocusedItem.Text);
  1072. listBox_analysisResult.SetItemChecked(listBox_analysisResult.Items.Count - 1, true);
  1073. for (int i = 0; i < counterResults.Count; i++)
  1074. {
  1075. CounterResult aResult = counterResults[i];
  1076. finalResults.Add(aResult);
  1077. dataGridView_results.Rows.Add(aResult.GraphName, aResult.PolyphaseName, aResult.Count, AnalysisTools.GetDecNum(aResult.CountPercent, decnum), AnalysisTools.GetDecNum(aResult.AreaPercent, decnum), AnalysisTools.GetDecNum(aResult.AreaContent, decnum));
  1078. }
  1079. }
  1080. else
  1081. {
  1082. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theresuethertoreplace.text")+"?", PdnResources.GetString("Form.OkButton.Text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  1083. if (dr != DialogResult.OK)
  1084. {
  1085. return;
  1086. }
  1087. finalResults.RemoveAll(item => item.GraphName.Equals(listView1.FocusedItem.Text));
  1088. finalResults.AddRange(counterResults);
  1089. List<string> list = new List<string>();
  1090. foreach (var s in this.listBox_analysisResult.Items)
  1091. {
  1092. list.Add(s.ToString());
  1093. }
  1094. this.listBox_analysisResult.Items.Clear();
  1095. foreach (var s in list)
  1096. {
  1097. this.listBox_analysisResult.Items.Add(s);
  1098. }
  1099. var thisindex = this.listBox_analysisResult.Items.IndexOf(listView1.FocusedItem.Text);
  1100. this.dataGridView_results.Rows.Clear();
  1101. listBox_analysisResult.SetItemChecked(thisindex, true);
  1102. for (int i = 0; i < counterResults.Count; i++)
  1103. {
  1104. CounterResult result = counterResults[i];
  1105. dataGridView_results.Rows.Add(result.GraphName, result.PolyphaseName, result.Count, AnalysisTools.GetDecNum(result.CountPercent, decnum), AnalysisTools.GetDecNum(result.AreaPercent, decnum), AnalysisTools.GetDecNum(result.AreaContent, decnum));
  1106. }
  1107. }
  1108. for (int i = 0; i < this.documentWorkspace.phaseModels.Count; i++)
  1109. {
  1110. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  1111. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1112. originalBit.Tag = pantographRatio;
  1113. tempBit.Add(originalBit);
  1114. Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  1115. Graphics graphics = Graphics.FromImage(newBit);
  1116. Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.phaseModels[i].mat);
  1117. graphics.DrawImage(processedBit, new PointF(0, 0));
  1118. newBit.Tag = pantographRatio;
  1119. tempBit.Add(newBit);
  1120. }
  1121. if (bitDic.ContainsKey(tag))
  1122. {
  1123. bitDic[tag].Clear();
  1124. bitDic[tag] = tempBit;
  1125. }
  1126. else
  1127. {
  1128. bitDic.Add(tag, tempBit);
  1129. }
  1130. }
  1131. }
  1132. private void button_all_Click(object sender, EventArgs e)
  1133. {
  1134. dataGridView_results.Rows.Clear();
  1135. if (this.is_all % 2 == 0)
  1136. {
  1137. for (int i = 0; i < listBox_analysisResult.Items.Count; i++)
  1138. {
  1139. listBox_analysisResult.SetItemChecked(i, false);
  1140. }
  1141. }
  1142. else
  1143. {
  1144. for (int i = 0; i < listBox_analysisResult.Items.Count; i++)
  1145. {
  1146. listBox_analysisResult.SetItemChecked(i, true);
  1147. }
  1148. for (int i = 0; i < finalResults.Count; i++)
  1149. {
  1150. CounterResult aResult = finalResults[i];
  1151. dataGridView_results.Rows.Add(aResult.GraphName, aResult.PolyphaseName, aResult.Count, AnalysisTools.GetDecNum(aResult.CountPercent, decnum), AnalysisTools.GetDecNum(aResult.AreaPercent, decnum), AnalysisTools.GetDecNum(aResult.AreaContent, decnum));
  1152. }
  1153. }
  1154. this.is_all += 1;
  1155. }
  1156. private void button_remove_Click(object sender, EventArgs e)
  1157. {
  1158. var removeList = new List<string>();
  1159. if (listBox_analysisResult.CheckedItems != null && listBox_analysisResult.CheckedItems.Count > 0)
  1160. {
  1161. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.ertodeletetheselectedanalysisres.Text")+"?", PdnResources.GetString("Menu.Edit.Delete.Text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1162. if (dr == DialogResult.OK)
  1163. {
  1164. dataGridView_results.Rows.Clear();
  1165. foreach (var s in listBox_analysisResult.CheckedItems)
  1166. {
  1167. if (finalResults.FindAll(item => item.GraphName.Equals(s.ToString())).Count > 0)
  1168. {
  1169. finalResults.RemoveAll(item => item.GraphName.Equals(s.ToString()));
  1170. removeList.Add(s.ToString());
  1171. }
  1172. else
  1173. {
  1174. MessageBox.Show(PdnResources.GetString("Menu.Resultsdeleted.Text"));
  1175. }
  1176. }
  1177. for (int i = 0; i < finalResults.Count; i++)
  1178. {
  1179. CounterResult aResult = finalResults[i];
  1180. dataGridView_results.Rows.Add(aResult.GraphName, aResult.PolyphaseName, aResult.Count, AnalysisTools.GetDecNum(aResult.CountPercent, decnum), AnalysisTools.GetDecNum(aResult.AreaPercent, decnum), AnalysisTools.GetDecNum(aResult.AreaContent, decnum));
  1181. }
  1182. foreach (var m in removeList)
  1183. {
  1184. listBox_analysisResult.Items.Remove(m);
  1185. }
  1186. }
  1187. }
  1188. else
  1189. {
  1190. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagetodelete.Text")+"!");
  1191. }
  1192. }
  1193. private void btn_close_Click(object sender, EventArgs e)
  1194. {
  1195. this.Close();
  1196. }
  1197. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  1198. {
  1199. decnum = (int)numericUpDown1.Value;
  1200. refesh_grids();
  1201. }
  1202. private void refesh_grids()
  1203. {
  1204. dataGridView1.Rows.Clear();
  1205. for (int i=0;i<this.counterResults.Count; i++)
  1206. {
  1207. CounterResult result = counterResults[i];
  1208. dataGridView1.Rows.Add(result.PolyphaseName, result.Count, AnalysisTools.GetDecNum(result.CountPercent,decnum), AnalysisTools.GetDecNum(result.AreaPercent,decnum), AnalysisTools.GetDecNum(result.AreaContent,decnum));
  1209. }
  1210. show_avg();
  1211. dataGridView_results.Rows.Clear();
  1212. for (int j=0;j<this.finalResults.Count;j++)
  1213. {
  1214. CounterResult result = finalResults[j];
  1215. dataGridView_results.Rows.Add(result.GraphName, result.PolyphaseName, result.Count, AnalysisTools.GetDecNum(result.CountPercent, decnum), AnalysisTools.GetDecNum(result.AreaPercent, decnum), AnalysisTools.GetDecNum(result.AreaContent, decnum));
  1216. }
  1217. }
  1218. private void listBox_analysisResult_SelectedIndexChanged(object sender, EventArgs e)
  1219. {
  1220. dataGridView_results.Rows.Clear();
  1221. if (listBox_analysisResult.CheckedItems != null && listBox_analysisResult.CheckedItems.Count > 0)
  1222. {
  1223. foreach (var s in listBox_analysisResult.CheckedItems)
  1224. {
  1225. List<CounterResult> findResults = finalResults.FindAll(item => item.GraphName.Equals(s.ToString()));
  1226. for (int i = 0; i < findResults.Count; i++)
  1227. {
  1228. CounterResult result = findResults[i];
  1229. dataGridView_results.Rows.Add(result.GraphName, result.PolyphaseName, result.Count, AnalysisTools.GetDecNum(result.CountPercent, decnum), AnalysisTools.GetDecNum(result.AreaPercent, decnum), AnalysisTools.GetDecNum(result.AreaContent, decnum));
  1230. }
  1231. }
  1232. }
  1233. }
  1234. private void button1_Click(object sender, EventArgs e)
  1235. {
  1236. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item2.PolyphaseCounterAnalysis");
  1237. if (recombinationRateSetDialog.hasModule)
  1238. {
  1239. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  1240. recombinationRateSetDialog.ShowDialog();
  1241. }
  1242. else
  1243. {
  1244. recombinationRateSetDialog = null;
  1245. }
  1246. }
  1247. private void button4_Click(object sender, EventArgs e)
  1248. {
  1249. if (this.dataGridView_results.Rows.Count > 0)
  1250. {
  1251. SaveFileDialog exe = new SaveFileDialog();
  1252. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  1253. exe.FilterIndex = 0;
  1254. exe.RestoreDirectory = true;
  1255. exe.Title = "Export Excel File";
  1256. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  1257. exe.FileName = PdnResources.GetString("Menu.GeneralAnalysis.MultiphaseStatistics.Text")+ PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddhhmmss");
  1258. DialogResult dr = exe.ShowDialog();
  1259. if (dr == DialogResult.OK)
  1260. {
  1261. DataTable dtb = new DataTable();
  1262. foreach (DataGridViewColumn c in this.dataGridView_results.Columns)
  1263. {
  1264. dtb.Columns.Add(c.HeaderText);
  1265. }
  1266. for (int r = 0; r < this.dataGridView_results.Rows.Count; r++)
  1267. {
  1268. DataRow dataRow = dtb.NewRow();
  1269. for (int c = 0; c < this.dataGridView_results.Rows[r].Cells.Count; c++)
  1270. {
  1271. dataRow[this.dataGridView_results.Columns[c].HeaderText] = this.dataGridView_results.Rows[r].Cells[c].Value;
  1272. }
  1273. dtb.Rows.Add(dataRow);
  1274. }
  1275. List<DataTable> list = new List<DataTable>();
  1276. list.Add(dtb);
  1277. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
  1278. }
  1279. }
  1280. else
  1281. {
  1282. MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
  1283. }
  1284. }
  1285. private void button3_Click(object sender, EventArgs e)
  1286. {
  1287. if (checkBox1.Checked)
  1288. {
  1289. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item2.PolyphaseCounterAnalysis");
  1290. if (recombinationRateSetDialog.hasModule)
  1291. {
  1292. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  1293. recombinationRateSetDialog.ShowDialog();
  1294. }
  1295. else
  1296. {
  1297. recombinationRateSetDialog = null;
  1298. }
  1299. }
  1300. bitList.Clear();
  1301. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  1302. {
  1303. //获取word书签与excel单元格的关系,以字典方式存储
  1304. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  1305. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  1306. if (mic_module_infos != null && mic_module_infos.Count > 0)
  1307. {
  1308. foreach (mic_module_infos info in mic_module_infos)
  1309. {
  1310. tagInfos.Add(info.tag_name, info.cell_position);
  1311. }
  1312. }
  1313. List<List<string>> analysisContent = new List<List<string>>();
  1314. List<string> nameList = new List<string>();
  1315. for (int i = 0; i < this.dataGridView_results.Rows.Count; i++)
  1316. {
  1317. List<string> content1 = new List<string>();
  1318. if (i == 0)
  1319. {
  1320. content1.Add(this.dataGridView_results.Columns[0].HeaderText);
  1321. content1.Add(this.dataGridView_results.Columns[1].HeaderText);
  1322. content1.Add(this.dataGridView_results.Columns[2].HeaderText);
  1323. content1.Add(this.dataGridView_results.Columns[3].HeaderText);
  1324. content1.Add(this.dataGridView_results.Columns[4].HeaderText);
  1325. content1.Add(this.dataGridView_results.Columns[5].HeaderText);
  1326. analysisContent.Add(content1);
  1327. }
  1328. content1 = new List<string>();
  1329. content1.Add(this.dataGridView_results.Rows[i].Cells[0].Value.ToString());
  1330. content1.Add(this.dataGridView_results.Rows[i].Cells[1].Value.ToString());
  1331. content1.Add(this.dataGridView_results.Rows[i].Cells[2].Value.ToString());
  1332. content1.Add(this.dataGridView_results.Rows[i].Cells[3].Value.ToString());
  1333. content1.Add(this.dataGridView_results.Rows[i].Cells[4].Value.ToString());
  1334. content1.Add(this.dataGridView_results.Rows[i].Cells[5].Value.ToString());
  1335. analysisContent.Add(content1);
  1336. string tag = this.dataGridView_results.Rows[i].Cells[0].Value.ToString();
  1337. if (nameList.IndexOf(tag) == -1)
  1338. {
  1339. nameList.Add(tag);
  1340. }
  1341. }
  1342. foreach (var s in nameList)
  1343. {
  1344. if (bitDic.ContainsKey(s))
  1345. {
  1346. foreach (var m in bitDic[s])
  1347. {
  1348. bitList.Add(bitDic[s][bitDic[s].IndexOf(m)]);
  1349. }
  1350. }
  1351. }
  1352. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  1353. }
  1354. else
  1355. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  1356. }
  1357. private void button9_Click(object sender, EventArgs e)
  1358. {
  1359. if (this.dataGridView_results.Rows.Count == 0)
  1360. {
  1361. MessageBox.Show(PdnResources.GetString("Menu.Noresults.text"));
  1362. return;
  1363. }
  1364. if (this.analyzeSettingModel == null)
  1365. {
  1366. MessageBox.Show(PdnResources.GetString("Menu.Pleasesetiirst.Text"));
  1367. return;
  1368. }
  1369. //获取项目工程内的文件夹路径
  1370. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.GeneralAnalysis.MultiphaseStatistics.Text", this.analyzeSettingModel.savePath);
  1371. if (item != null)
  1372. {
  1373. //向文件夹内保存图片和报告
  1374. if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  1375. {
  1376. //获取word书签与excel单元格的关系,以字典方式存储
  1377. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  1378. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  1379. if (mic_module_infos != null && mic_module_infos.Count > 0)
  1380. {
  1381. foreach (mic_module_infos info in mic_module_infos)
  1382. {
  1383. tagInfos.Add(info.tag_name, info.cell_position);
  1384. }
  1385. }
  1386. List<List<string>> analysisContent = new List<List<string>>();
  1387. List<List<string>> inclusionList = new List<List<string>>();
  1388. List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
  1389. List<Bitmap> bitImgList = new List<Bitmap>();
  1390. List<string> titleContent = new List<string>();
  1391. List<string> nameList = new List<string>();
  1392. for (int i = 0; i < this.dataGridView_results.Rows.Count; i++)
  1393. {
  1394. List<string> content1 = new List<string>();
  1395. if (i == 0)
  1396. {
  1397. content1.Add(this.dataGridView_results.Columns[0].HeaderText);
  1398. content1.Add(this.dataGridView_results.Columns[1].HeaderText);
  1399. content1.Add(this.dataGridView_results.Columns[2].HeaderText);
  1400. content1.Add(this.dataGridView_results.Columns[3].HeaderText);
  1401. content1.Add(this.dataGridView_results.Columns[4].HeaderText);
  1402. analysisContent.Add(content1);
  1403. titleContent.AddRange(content1);
  1404. }
  1405. content1 = new List<string>();
  1406. content1.Add(this.dataGridView_results.Rows[i].Cells[0].Value.ToString());
  1407. content1.Add(this.dataGridView_results.Rows[i].Cells[1].Value.ToString());
  1408. content1.Add(this.dataGridView_results.Rows[i].Cells[2].Value.ToString());
  1409. content1.Add(this.dataGridView_results.Rows[i].Cells[3].Value.ToString());
  1410. content1.Add(this.dataGridView_results.Rows[i].Cells[4].Value.ToString());
  1411. analysisContent.Add(content1);
  1412. string tag = this.dataGridView_results.Rows[i].Cells[0].Value.ToString();
  1413. if (nameList.IndexOf(tag) == -1)
  1414. {
  1415. nameList.Add(tag);
  1416. }
  1417. var export = exportModel.Where(m => m.picName == tag).FirstOrDefault();
  1418. if (export == null)
  1419. {
  1420. ExportProjectModel exportProjectModel = new ExportProjectModel();
  1421. exportProjectModel.dataList = new List<List<string>>();
  1422. exportProjectModel.dataList.Add(titleContent);
  1423. exportProjectModel.dataList.Add(content1);
  1424. exportProjectModel.picName = tag;
  1425. exportProjectModel.tagName = PdnResources.GetString("Menu.GeneralAnalysis.MultiphaseStatistics.Text");
  1426. exportModel.Add(exportProjectModel);
  1427. }
  1428. else
  1429. {
  1430. exportModel[exportModel.IndexOf(export)].dataList.Add(content1);
  1431. }
  1432. }
  1433. foreach (var s in nameList)
  1434. {
  1435. if (bitDic.ContainsKey(s))
  1436. {
  1437. foreach (var m in bitDic[s])
  1438. {
  1439. bitImgList.Add(bitDic[s][bitDic[s].IndexOf(m)]);
  1440. }
  1441. }
  1442. }
  1443. try
  1444. {
  1445. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitImgList, tagInfos, item.path, item.code);
  1446. }
  1447. catch (Exception ex)
  1448. {
  1449. MessageBox.Show(ex.Message);
  1450. }
  1451. }
  1452. else
  1453. {
  1454. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  1455. return;
  1456. }
  1457. //保存项目信息到数据库
  1458. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  1459. }
  1460. }
  1461. private void getValue(string key, Object value)
  1462. {
  1463. switch (key)
  1464. {
  1465. case "OpenWhileExportReport":
  1466. checkBox1.Checked = Convert.ToBoolean(value);
  1467. break;
  1468. case "CalculatorDecimalDigits":
  1469. numericUpDown1.Value = Convert.ToDecimal(value);
  1470. break;
  1471. case "ExportResults":
  1472. isExportResults = Convert.ToBoolean(value);
  1473. break;
  1474. case "ExportReports":
  1475. isExportReports = Convert.ToBoolean(value);
  1476. break;
  1477. case "ExportProjects":
  1478. isExportProjects = Convert.ToBoolean(value);
  1479. break;
  1480. }
  1481. }
  1482. #region [应用全部保存全部-私有方法]
  1483. /// <summary>
  1484. /// 应用全部私有方法
  1485. /// </summary>
  1486. private void applyAll() {
  1487. }
  1488. /// <summary>
  1489. /// 保存全部私有方法
  1490. /// </summary>
  1491. private void saveAll() {
  1492. for (int i = 0; i < listView1.Items.Count; i++)
  1493. {
  1494. this.listView1.EnsureVisible(i);
  1495. this.listView1.Items[i].Focused = true;
  1496. this.listView1.Items[i].Selected = true;
  1497. this.button2.PerformClick();
  1498. }
  1499. }
  1500. #endregion
  1501. #region [脚本录制]
  1502. private void getScriptRecording()
  1503. {
  1504. string className = InvariantData.path_Action + ".Action" + menuId;
  1505. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  1506. List<Args> args = param.Lists;
  1507. foreach (var item in args)
  1508. {
  1509. item.value = setScriptRecording(item.key);
  1510. }
  1511. appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
  1512. }
  1513. private object setScriptRecording(string key)
  1514. {
  1515. object value = null;
  1516. switch (key)
  1517. {
  1518. case "OpenWhileExportReport":
  1519. value = checkBox1.Checked;
  1520. break;
  1521. case "CalculatorDecimalDigits":
  1522. value = numericUpDown1.Value;
  1523. break;
  1524. case "ExportResults":
  1525. value = isExportResults;
  1526. break;
  1527. case "ExportReports":
  1528. value = isExportReports;
  1529. break;
  1530. case "ExportProjects":
  1531. value = isExportProjects;
  1532. break;
  1533. }
  1534. return value;
  1535. }
  1536. #endregion
  1537. }
  1538. }