GrainSizeStandardDialog.cs 109 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725
  1. using OpenCvSharp;
  2. using PaintDotNet.Annotation;
  3. using PaintDotNet.Base.CommTool;
  4. using PaintDotNet.Base.Functionodel;
  5. using PaintDotNet.Base.SettingModel;
  6. using PaintDotNet.CustomControl;
  7. using PaintDotNet.DbOpreate.DbModel;
  8. using PaintDotNet.Instrument;
  9. using System;
  10. using System.Linq;
  11. using System.Collections;
  12. using System.Collections.Generic;
  13. using System.ComponentModel;
  14. using System.Drawing;
  15. using System.Drawing.Drawing2D;
  16. using System.Windows.Forms;
  17. using Point = System.Drawing.Point;
  18. using PaintDotNet.DedicatedAnalysis.GrainSizeStandard.IntegrationClass;
  19. namespace PaintDotNet.DedicatedAnalysis.GrainSize
  20. {
  21. internal class GrainSizeStandardDialog : PdnBaseForm
  22. {
  23. /// <summary>
  24. /// 用于适配有色金属标准(包括GBT4296_2004、YST347_2004、GBT32461_2012的截距法和面积法)
  25. /// </summary>
  26. protected bool isOtherGrainSizeStandardDialog = false;
  27. #region 属性
  28. /// <summary>
  29. /// 主控件
  30. /// </summary>
  31. private AppWorkspace appWorkspace;
  32. //二值化集成1
  33. BinaryClass binaryClass;
  34. /// <summary>
  35. /// 公共按钮
  36. /// </summary>
  37. private CommonControlButtons commonControlButtons;
  38. /// <summary>
  39. /// 图像面板
  40. /// </summary>
  41. protected DocumentWorkspaceWindow documentWorkspace;
  42. /// <summary>
  43. /// 当前选择的图片
  44. /// </summary>
  45. protected Bitmap bitmap;
  46. /// <summary>
  47. /// 当前选择的图片
  48. /// </summary>
  49. protected Mat matOrg;
  50. protected string oldSelectItem;
  51. public bool comboboxChange = true;
  52. //截点样式集成
  53. protected GrainPointStyleClass styleClass = new GrainPointStyleClass();
  54. /// <summary>
  55. /// 图形上所有的点
  56. /// </summary>
  57. protected List<PointF> linePointList = new List<PointF>();
  58. protected bool isAreaType = false;
  59. /// <summary>
  60. /// 辅助线集成
  61. /// </summary>
  62. protected GrainSizeGuideClass guideClass = new GrainSizeGuideClass();
  63. /// <summary>
  64. /// 用于编号的坐标点集合
  65. /// </summary>
  66. protected List<Point2d> massLabelPoints = new List<Point2d>();
  67. /// <summary>
  68. /// 矩形内的连通域
  69. /// </summary>
  70. protected int within = 0;
  71. private PointF m_StartPoint = Point.Empty;
  72. protected bool m_canMove;
  73. /// <summary>
  74. /// 调色板
  75. /// </summary>
  76. private ColorsForm colorsFormGrid;
  77. //分析结果列表的头标题
  78. /// <summary>
  79. /// PdnResources.GetString("Menu.picture.Text"), PdnResources.GetString("Menu.Tools.GridLine.Text"), "网格面积", PdnResources.GetString("Menu.Numberofgrains.text"), PdnResources.GetString("Menu.Averagegrainsizegrade.text")
  80. /// </summary>
  81. List<string> contentHead;
  82. /// <summary>
  83. /// 保存用于生成报告的图片
  84. /// </summary>
  85. protected List<Bitmap> bitList;
  86. /// <summary>
  87. /// 储存点击保存结果后的所有原图与分析图
  88. /// </summary>
  89. protected Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
  90. /// <summary>
  91. /// 中间数据
  92. /// </summary>
  93. protected List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
  94. /// <summary>
  95. /// 分析结果暂存
  96. /// </summary>
  97. protected List<System.Data.DataTable> dataTables = new List<System.Data.DataTable>();
  98. /// <summary>
  99. /// 全部显示
  100. /// </summary>
  101. protected bool allShow = false;
  102. #endregion
  103. #region 组件
  104. private GroupBox groupBox_operating;
  105. protected GroupBox groupBox_img;
  106. private ListView lstView_img;
  107. private ImageList imageList_img;
  108. private IContainer components;
  109. protected GroupBox groupBox_review;
  110. protected GroupBox groupBox_report;
  111. private Label label_resultPrecision;
  112. private Button button_exportResults;
  113. private Button button_generateReport;
  114. protected GroupBox groupBox6groupBox_analysisResult2;
  115. protected GroupBox groupBox_analysisResult1;
  116. private Button button_setting;
  117. private CheckBox checkBox_generateReport_opensetting;
  118. private GroupBox groupBox4;
  119. private Panel panel1;
  120. private Button button3;
  121. private Label label8;
  122. private NumericUpDown numericUpDown2;
  123. private NumericUpDown numericUpDown1;
  124. private CheckBox checkBox2;
  125. private TextBox textBox6;
  126. private Label label7;
  127. private ComboBox comboBox3;
  128. private Label label6;
  129. private ComboBox comboBox2;
  130. private Label label1;
  131. private CheckBox checkBox1;
  132. private GroupBox groupBox3;
  133. private Button button9;
  134. protected ComboBox comboBox1;
  135. protected DataGridView dataGridView2;
  136. protected ListView listView2;
  137. private Button button16;
  138. private Button button12;
  139. private Button button11;
  140. private NumericUpDown numericUpDown1_0;
  141. private Button button1;
  142. private BinaryControlSmaller bc;
  143. private DataGridViewTextBoxColumn Column1;
  144. private DataGridViewTextBoxColumn Column2;
  145. private DataGridViewTextBoxColumn Column3;
  146. private DataGridViewTextBoxColumn Column4;
  147. private DataGridViewTextBoxColumn Column5;
  148. private Button btn_saveresult;
  149. #endregion
  150. #region 构造函数
  151. public GrainSizeStandardDialog(AppWorkspace appWorkspace, bool isAreaType, bool isOtherGrainSizeStandardDialog = false)
  152. {
  153. this.appWorkspace = appWorkspace;
  154. this.Icon = PdnInfo.AppIcon;
  155. this.Load += new System.EventHandler(this.GrainSizeStandardDialog_Load);
  156. this.colorsFormGrid = new ColorsForm();
  157. this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
  158. this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
  159. this.isAreaType = isAreaType;
  160. this.isOtherGrainSizeStandardDialog = isOtherGrainSizeStandardDialog;
  161. if (isAreaType)
  162. guideClass.createGuideAreaClassModelsNamed(getModelName());
  163. else
  164. guideClass.createGuideClassModelsNamed(getModelName());
  165. InitializeComponent();
  166. if (isOtherGrainSizeStandardDialog)
  167. contentHead = new List<string>() { PdnResources.GetString("Menu.picture.Text"), PdnResources.GetString("Menu.Tools.GridLine.Text"), PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Gridsize.text") + "(μm)", PdnResources.GetString("Menu.Numberofgrains.text"), PdnResources.GetString("Menu.Averagegrainsizegrade.text") };
  168. this.binaryClass = new BinaryClass();
  169. if (isOtherGrainSizeStandardDialog)
  170. InitializeCustomControl();
  171. InitializeLanguageText();
  172. Initialize();
  173. SubclassInitialize();
  174. //初始化头
  175. this.listView2.View = View.Details;
  176. ColumnHeader header0 = new ColumnHeader();
  177. header0.Text = "";
  178. header0.Width = 180;
  179. this.listView2.Columns.Add(header0);
  180. //二值化集成2
  181. bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
  182. binaryClass.createDocumentItemsSmaller(new string[] { PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text"), PdnResources.GetString("Menu.Grainboundarytoreproduce.text"), PdnResources.GetString("Menu.Thegrainsareshownindifferentcolors.text") }
  183. , this.bc, this.appWorkspace, this.documentWorkspace, this.lstView_img);//初始化相的工作结构
  184. binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
  185. InitComboboxValue(null);
  186. this.button11.Visible = true;
  187. this.button16.Visible = false;
  188. SetAnalyzeModelFromXml(getTemplateName());
  189. }
  190. public GrainSizeStandardDialog()
  191. {
  192. InitializeComponent();
  193. }
  194. #endregion
  195. #region 初始化组件
  196. private void InitializeLanguageText()
  197. {
  198. this.Column5.HeaderText = PdnResources.GetString("Menu.Averagegrainsizegrade.text");
  199. this.Column4.HeaderText = PdnResources.GetString("Menu.Numberofgrains.text");
  200. this.Column3.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Gridsize.text") + "(μm)";
  201. this.Column2.HeaderText = PdnResources.GetString("Menu.Tools.GridLine.Text");
  202. this.Column1.HeaderText = PdnResources.GetString("Menu.picture.Text");
  203. this.button9.Text = PdnResources.GetString("Menu.Auxiliarylinesettings.text");
  204. this.groupBox3.Text = PdnResources.GetString("Menu.Tools.GridLine.Text");
  205. this.checkBox1.Text = PdnResources.GetString("Menu.Grainboundarytoreproduce.text");
  206. this.label1.Text = PdnResources.GetString("Menu.Grainboundarytype.text") + ":";
  207. this.label6.Text = PdnResources.GetString("Menu.Denoisingtype.text") + ":";
  208. this.label7.Text = PdnResources.GetString("Menu.Image.Sigma.Text") + ":";
  209. this.checkBox2.Text = PdnResources.GetString("Menu.Grainboundaryenhancement.text");
  210. this.label8.Text = PdnResources.GetString("Menu.Grainboundarysize.text") + ":";
  211. this.button3.Text = PdnResources.GetString("Menu.Grainboundaryedit.text");
  212. this.groupBox4.Text = PdnResources.GetString("Menu.Grainboundarytoreproduce.text");
  213. this.button12.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  214. this.button16.Text = PdnResources.GetString("Menu.Cancelshowall.text");
  215. this.button11.Text = PdnResources.GetString("Menu.Showall.text");
  216. this.groupBox_analysisResult1.Text = PdnResources.GetString("Menu.Analysisresult.text");
  217. this.button_generateReport.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  218. this.button_exportResults.Text = PdnResources.GetString("Menu.Exportresults.text");
  219. this.label_resultPrecision.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
  220. this.button1.Text = PdnResources.GetString("Menu.Exportproject.text");
  221. this.groupBox_review.Text = PdnResources.GetString("Menu.Preview.text");
  222. this.groupBox_img.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  223. this.btn_saveresult.Text = PdnResources.GetString("Menu.Saveresult.text");
  224. this.button_setting.Text = PdnResources.GetString("Menu.Setting.Text");
  225. this.checkBox_generateReport_opensetting.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  226. this.groupBox_operating.Text = PdnResources.GetString("Menu.operation.text");
  227. this.comboBox3.Items.AddRange(new object[] {
  228. PdnResources.GetString("Menu.Gaussiansmoothing.text"),
  229. PdnResources.GetString("Menu.directionalsmoothing.text")});
  230. this.comboBox2.Items.AddRange(new object[] {
  231. PdnResources.GetString("Menu.Brightgrainboundary.text"),
  232. PdnResources.GetString("Menu.Darkgrainboundary.text"),
  233. PdnResources.GetString("Menu.gradient.text")});
  234. }
  235. private void InitializeCustomControl()
  236. {
  237. //
  238. // bc
  239. //
  240. this.bc = new PaintDotNet.CustomControl.BinaryControlSmaller();
  241. this.bc.BinaryBackColor = System.Drawing.Color.Red;
  242. this.bc.BinaryChecked = false;
  243. this.bc.BinaryStyle = 1;
  244. this.bc.Location = new System.Drawing.Point(176, 70);
  245. this.bc.Name = "bc";
  246. this.bc.OriginChecked = false;
  247. this.bc.scope1End = 0D;
  248. this.bc.scope1Start = 0D;
  249. this.bc.scope2End = 0D;
  250. this.bc.scope2Start = 0D;
  251. this.bc.scope3End = 0D;
  252. this.bc.scope3Start = 0D;
  253. this.bc.Size = new System.Drawing.Size(360, 247);
  254. this.bc.TabIndex = 38;
  255. this.Controls.Add(this.bc);
  256. this.Controls.SetChildIndex(this.bc, 0);
  257. }
  258. private void InitializeComponent()
  259. {
  260. this.components = new System.ComponentModel.Container();
  261. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  262. this.groupBox_operating = new System.Windows.Forms.GroupBox();
  263. this.checkBox_generateReport_opensetting = new System.Windows.Forms.CheckBox();
  264. this.button_setting = new System.Windows.Forms.Button();
  265. this.btn_saveresult = new System.Windows.Forms.Button();
  266. this.groupBox_img = new System.Windows.Forms.GroupBox();
  267. this.lstView_img = new System.Windows.Forms.ListView();
  268. this.imageList_img = new System.Windows.Forms.ImageList(this.components);
  269. this.groupBox_review = new System.Windows.Forms.GroupBox();
  270. this.groupBox_report = new System.Windows.Forms.GroupBox();
  271. this.button1 = new System.Windows.Forms.Button();
  272. this.numericUpDown1_0 = new System.Windows.Forms.NumericUpDown();
  273. this.label_resultPrecision = new System.Windows.Forms.Label();
  274. this.button_exportResults = new System.Windows.Forms.Button();
  275. this.button_generateReport = new System.Windows.Forms.Button();
  276. this.groupBox6groupBox_analysisResult2 = new System.Windows.Forms.GroupBox();
  277. this.dataGridView2 = new System.Windows.Forms.DataGridView();
  278. this.groupBox_analysisResult1 = new System.Windows.Forms.GroupBox();
  279. this.button11 = new System.Windows.Forms.Button();
  280. this.listView2 = new System.Windows.Forms.ListView();
  281. this.button16 = new System.Windows.Forms.Button();
  282. this.button12 = new System.Windows.Forms.Button();
  283. this.groupBox4 = new System.Windows.Forms.GroupBox();
  284. this.panel1 = new System.Windows.Forms.Panel();
  285. this.button3 = new System.Windows.Forms.Button();
  286. this.label8 = new System.Windows.Forms.Label();
  287. this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
  288. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  289. this.checkBox2 = new System.Windows.Forms.CheckBox();
  290. this.textBox6 = new System.Windows.Forms.TextBox();
  291. this.label7 = new System.Windows.Forms.Label();
  292. this.comboBox3 = new System.Windows.Forms.ComboBox();
  293. this.label6 = new System.Windows.Forms.Label();
  294. this.comboBox2 = new System.Windows.Forms.ComboBox();
  295. this.label1 = new System.Windows.Forms.Label();
  296. this.checkBox1 = new System.Windows.Forms.CheckBox();
  297. this.groupBox3 = new System.Windows.Forms.GroupBox();
  298. this.button9 = new System.Windows.Forms.Button();
  299. this.comboBox1 = new System.Windows.Forms.ComboBox();
  300. if (isOtherGrainSizeStandardDialog)
  301. {
  302. this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  303. this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  304. this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  305. this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  306. this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  307. }
  308. this.groupBox_operating.SuspendLayout();
  309. this.groupBox_img.SuspendLayout();
  310. this.groupBox_report.SuspendLayout();
  311. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1_0)).BeginInit();
  312. this.groupBox6groupBox_analysisResult2.SuspendLayout();
  313. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
  314. this.groupBox_analysisResult1.SuspendLayout();
  315. this.groupBox4.SuspendLayout();
  316. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
  317. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  318. this.groupBox3.SuspendLayout();
  319. this.SuspendLayout();
  320. //
  321. // groupBox_operating
  322. //
  323. this.groupBox_operating.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  324. | System.Windows.Forms.AnchorStyles.Right)));
  325. this.groupBox_operating.Controls.Add(this.checkBox_generateReport_opensetting);
  326. this.groupBox_operating.Controls.Add(this.button_setting);
  327. this.groupBox_operating.Controls.Add(this.btn_saveresult);
  328. this.groupBox_operating.Location = new System.Drawing.Point(13, 12);
  329. this.groupBox_operating.Name = "groupBox_operating";
  330. this.groupBox_operating.Size = new System.Drawing.Size(1102, 53);
  331. this.groupBox_operating.TabIndex = 12;
  332. this.groupBox_operating.TabStop = false;
  333. //
  334. // checkBox_generateReport_opensetting
  335. //
  336. this.checkBox_generateReport_opensetting.AutoSize = true;
  337. this.checkBox_generateReport_opensetting.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
  338. this.checkBox_generateReport_opensetting.Location = new System.Drawing.Point(91, 24);
  339. this.checkBox_generateReport_opensetting.Name = "checkBox_generateReport_opensetting";
  340. this.checkBox_generateReport_opensetting.Size = new System.Drawing.Size(132, 16);
  341. this.checkBox_generateReport_opensetting.TabIndex = 6;
  342. this.checkBox_generateReport_opensetting.UseVisualStyleBackColor = true;
  343. //
  344. // button_setting
  345. //
  346. this.button_setting.Location = new System.Drawing.Point(6, 20);
  347. this.button_setting.Name = "button_setting";
  348. this.button_setting.Size = new System.Drawing.Size(75, 23);
  349. this.button_setting.TabIndex = 4;
  350. this.button_setting.UseVisualStyleBackColor = true;
  351. this.button_setting.Click += new System.EventHandler(this.button_setting_Click);
  352. //
  353. // btn_saveresult
  354. //
  355. this.btn_saveresult.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  356. this.btn_saveresult.Location = new System.Drawing.Point(992, 20);
  357. this.btn_saveresult.Name = "btn_saveresult";
  358. this.btn_saveresult.Size = new System.Drawing.Size(75, 23);
  359. this.btn_saveresult.TabIndex = 2;
  360. this.btn_saveresult.UseVisualStyleBackColor = true;
  361. this.btn_saveresult.Click += new System.EventHandler(this.btn_saveresult_Click);
  362. //
  363. // groupBox_img
  364. //
  365. this.groupBox_img.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  366. | System.Windows.Forms.AnchorStyles.Left)));
  367. this.groupBox_img.Controls.Add(this.lstView_img);
  368. this.groupBox_img.Location = new System.Drawing.Point(13, 72);
  369. this.groupBox_img.Margin = new System.Windows.Forms.Padding(4);
  370. this.groupBox_img.Name = "groupBox_img";
  371. this.groupBox_img.Padding = new System.Windows.Forms.Padding(4);
  372. this.groupBox_img.Size = new System.Drawing.Size(158, 552);
  373. this.groupBox_img.TabIndex = 13;
  374. this.groupBox_img.TabStop = false;
  375. //
  376. // lstView_img
  377. //
  378. this.lstView_img.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  379. | System.Windows.Forms.AnchorStyles.Left)
  380. | System.Windows.Forms.AnchorStyles.Right)));
  381. this.lstView_img.HideSelection = false;
  382. this.lstView_img.LargeImageList = this.imageList_img;
  383. this.lstView_img.Location = new System.Drawing.Point(8, 26);
  384. this.lstView_img.Margin = new System.Windows.Forms.Padding(4);
  385. this.lstView_img.MultiSelect = false;
  386. this.lstView_img.Name = "lstView_img";
  387. this.lstView_img.Size = new System.Drawing.Size(140, 518);
  388. this.lstView_img.TabIndex = 0;
  389. this.lstView_img.UseCompatibleStateImageBehavior = false;
  390. this.lstView_img.SelectedIndexChanged += new System.EventHandler(this.lstView_img_SelectedIndexChanged);
  391. //
  392. // imageList_img
  393. //
  394. this.imageList_img.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  395. this.imageList_img.ImageSize = new System.Drawing.Size(64, 64);
  396. this.imageList_img.TransparentColor = System.Drawing.Color.Transparent;
  397. //
  398. // groupBox_review
  399. //
  400. this.groupBox_review.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  401. | System.Windows.Forms.AnchorStyles.Left)
  402. | System.Windows.Forms.AnchorStyles.Right)));
  403. this.groupBox_review.Location = new System.Drawing.Point(541, 72);
  404. this.groupBox_review.Name = "groupBox_review";
  405. this.groupBox_review.Size = new System.Drawing.Size(575, 552);
  406. this.groupBox_review.TabIndex = 30;
  407. this.groupBox_review.TabStop = false;
  408. //
  409. // groupBox_report
  410. //
  411. this.groupBox_report.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  412. this.groupBox_report.Controls.Add(this.button1);
  413. this.groupBox_report.Controls.Add(this.numericUpDown1_0);
  414. this.groupBox_report.Controls.Add(this.label_resultPrecision);
  415. this.groupBox_report.Controls.Add(this.button_exportResults);
  416. this.groupBox_report.Controls.Add(this.button_generateReport);
  417. this.groupBox_report.Location = new System.Drawing.Point(974, 630);
  418. this.groupBox_report.Name = "groupBox_report";
  419. this.groupBox_report.Size = new System.Drawing.Size(142, 188);
  420. this.groupBox_report.TabIndex = 33;
  421. this.groupBox_report.TabStop = false;
  422. //
  423. // button1
  424. //
  425. this.button1.Location = new System.Drawing.Point(29, 102);
  426. this.button1.Name = "button1";
  427. this.button1.Size = new System.Drawing.Size(75, 23);
  428. this.button1.TabIndex = 23;
  429. this.button1.UseVisualStyleBackColor = true;
  430. this.button1.Click += new System.EventHandler(this.button1_Click);
  431. //
  432. // numericUpDown1_0
  433. //
  434. this.numericUpDown1_0.Location = new System.Drawing.Point(63, 150);
  435. this.numericUpDown1_0.Maximum = new decimal(new int[] {
  436. 10,
  437. 0,
  438. 0,
  439. 0});
  440. this.numericUpDown1_0.Name = "numericUpDown1_0";
  441. this.numericUpDown1_0.Size = new System.Drawing.Size(56, 21);
  442. this.numericUpDown1_0.TabIndex = 22;
  443. this.numericUpDown1_0.Value = new decimal(new int[] {
  444. 2,
  445. 0,
  446. 0,
  447. 0});
  448. this.numericUpDown1_0.ValueChanged += new System.EventHandler(this.numericUpDown1_0_ValueChanged);
  449. //
  450. // label_resultPrecision
  451. //
  452. this.label_resultPrecision.AutoSize = true;
  453. this.label_resultPrecision.Location = new System.Drawing.Point(26, 154);
  454. this.label_resultPrecision.Name = "label_resultPrecision";
  455. this.label_resultPrecision.Size = new System.Drawing.Size(29, 12);
  456. this.label_resultPrecision.TabIndex = 3;
  457. //
  458. // button_exportResults
  459. //
  460. this.button_exportResults.Location = new System.Drawing.Point(29, 63);
  461. this.button_exportResults.Name = "button_exportResults";
  462. this.button_exportResults.Size = new System.Drawing.Size(75, 23);
  463. this.button_exportResults.TabIndex = 1;
  464. this.button_exportResults.UseVisualStyleBackColor = true;
  465. this.button_exportResults.Click += new System.EventHandler(this.button_exportResults_Click);
  466. //
  467. // button_generateReport
  468. //
  469. this.button_generateReport.Location = new System.Drawing.Point(29, 24);
  470. this.button_generateReport.Name = "button_generateReport";
  471. this.button_generateReport.Size = new System.Drawing.Size(75, 23);
  472. this.button_generateReport.TabIndex = 0;
  473. this.button_generateReport.UseVisualStyleBackColor = true;
  474. this.button_generateReport.Click += new System.EventHandler(this.button_generateReport_Click);
  475. //
  476. // groupBox6groupBox_analysisResult2
  477. //
  478. this.groupBox6groupBox_analysisResult2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  479. | System.Windows.Forms.AnchorStyles.Right)));
  480. this.groupBox6groupBox_analysisResult2.Controls.Add(this.dataGridView2);
  481. this.groupBox6groupBox_analysisResult2.Location = new System.Drawing.Point(242, 630);
  482. this.groupBox6groupBox_analysisResult2.Name = "groupBox6groupBox_analysisResult2";
  483. this.groupBox6groupBox_analysisResult2.Size = new System.Drawing.Size(719, 188);
  484. this.groupBox6groupBox_analysisResult2.TabIndex = 32;
  485. this.groupBox6groupBox_analysisResult2.TabStop = false;
  486. //
  487. // dataGridView2
  488. //
  489. this.dataGridView2.AllowUserToAddRows = false;
  490. this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  491. | System.Windows.Forms.AnchorStyles.Right)));
  492. this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  493. this.dataGridView2.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  494. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  495. dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
  496. dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F);
  497. dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
  498. dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  499. dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  500. dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  501. this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
  502. this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  503. this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  504. this.Column1,
  505. this.Column2,
  506. this.Column3,
  507. this.Column4,
  508. this.Column5});
  509. this.dataGridView2.Location = new System.Drawing.Point(13, 17);
  510. this.dataGridView2.Name = "dataGridView2";
  511. this.dataGridView2.ReadOnly = true;
  512. this.dataGridView2.RowHeadersVisible = false;
  513. this.dataGridView2.RowTemplate.Height = 23;
  514. this.dataGridView2.Size = new System.Drawing.Size(693, 160);
  515. this.dataGridView2.TabIndex = 16;
  516. //
  517. // groupBox_analysisResult1
  518. //
  519. this.groupBox_analysisResult1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  520. this.groupBox_analysisResult1.Controls.Add(this.button11);
  521. this.groupBox_analysisResult1.Controls.Add(this.listView2);
  522. this.groupBox_analysisResult1.Controls.Add(this.button16);
  523. this.groupBox_analysisResult1.Controls.Add(this.button12);
  524. this.groupBox_analysisResult1.Location = new System.Drawing.Point(12, 630);
  525. this.groupBox_analysisResult1.Name = "groupBox_analysisResult1";
  526. this.groupBox_analysisResult1.Size = new System.Drawing.Size(224, 188);
  527. this.groupBox_analysisResult1.TabIndex = 31;
  528. this.groupBox_analysisResult1.TabStop = false;
  529. //
  530. // button11
  531. //
  532. this.button11.BackColor = System.Drawing.SystemColors.Control;
  533. this.button11.Location = new System.Drawing.Point(19, 22);
  534. this.button11.Name = "button11";
  535. this.button11.Size = new System.Drawing.Size(63, 26);
  536. this.button11.TabIndex = 27;
  537. this.button11.UseVisualStyleBackColor = false;
  538. this.button11.Click += new System.EventHandler(this.button11_Click);
  539. //
  540. // listView2
  541. //
  542. this.listView2.FullRowSelect = true;
  543. this.listView2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
  544. this.listView2.HideSelection = false;
  545. this.listView2.Location = new System.Drawing.Point(19, 58);
  546. this.listView2.Name = "listView2";
  547. this.listView2.Size = new System.Drawing.Size(181, 124);
  548. this.listView2.TabIndex = 26;
  549. this.listView2.UseCompatibleStateImageBehavior = false;
  550. this.listView2.SelectedIndexChanged += new System.EventHandler(this.listview2_SelectedIndexChanged);
  551. //
  552. // button16
  553. //
  554. this.button16.BackColor = System.Drawing.SystemColors.Control;
  555. this.button16.Location = new System.Drawing.Point(19, 21);
  556. this.button16.Name = "button16";
  557. this.button16.Size = new System.Drawing.Size(93, 26);
  558. this.button16.TabIndex = 25;
  559. this.button16.UseVisualStyleBackColor = false;
  560. this.button16.Click += new System.EventHandler(this.button16_Click);
  561. //
  562. // button12
  563. //
  564. this.button12.BackColor = System.Drawing.SystemColors.Control;
  565. this.button12.Location = new System.Drawing.Point(149, 21);
  566. this.button12.Name = "button12";
  567. this.button12.Size = new System.Drawing.Size(52, 26);
  568. this.button12.TabIndex = 24;
  569. this.button12.UseVisualStyleBackColor = false;
  570. this.button12.Click += new System.EventHandler(this.button12_Click);
  571. //
  572. // groupBox4
  573. //
  574. this.groupBox4.Controls.Add(this.panel1);
  575. this.groupBox4.Controls.Add(this.button3);
  576. this.groupBox4.Controls.Add(this.label8);
  577. this.groupBox4.Controls.Add(this.numericUpDown2);
  578. this.groupBox4.Controls.Add(this.numericUpDown1);
  579. this.groupBox4.Controls.Add(this.checkBox2);
  580. this.groupBox4.Controls.Add(this.textBox6);
  581. this.groupBox4.Controls.Add(this.label7);
  582. this.groupBox4.Controls.Add(this.comboBox3);
  583. this.groupBox4.Controls.Add(this.label6);
  584. this.groupBox4.Controls.Add(this.comboBox2);
  585. this.groupBox4.Controls.Add(this.label1);
  586. this.groupBox4.Controls.Add(this.checkBox1);
  587. this.groupBox4.Location = new System.Drawing.Point(179, 330);
  588. this.groupBox4.Name = "groupBox4";
  589. this.groupBox4.Size = new System.Drawing.Size(356, 155);
  590. this.groupBox4.TabIndex = 37;
  591. this.groupBox4.TabStop = false;
  592. //
  593. // panel1
  594. //
  595. this.panel1.BackColor = System.Drawing.Color.Red;
  596. this.panel1.Location = new System.Drawing.Point(89, 19);
  597. this.panel1.Name = "panel1";
  598. this.panel1.Size = new System.Drawing.Size(72, 21);
  599. this.panel1.TabIndex = 20;
  600. this.panel1.Click += new System.EventHandler(this.panel1_Click);
  601. //
  602. // button3
  603. //
  604. this.button3.Anchor = System.Windows.Forms.AnchorStyles.Right;
  605. this.button3.Location = new System.Drawing.Point(259, 18);
  606. this.button3.Name = "button3";
  607. this.button3.Size = new System.Drawing.Size(75, 23);
  608. this.button3.TabIndex = 31;
  609. this.button3.UseVisualStyleBackColor = true;
  610. this.button3.Click += new System.EventHandler(this.button3_Click);
  611. //
  612. // label8
  613. //
  614. this.label8.AutoSize = true;
  615. this.label8.Location = new System.Drawing.Point(6, 124);
  616. this.label8.Name = "label8";
  617. this.label8.Size = new System.Drawing.Size(65, 12);
  618. this.label8.TabIndex = 30;
  619. //
  620. // numericUpDown2
  621. //
  622. this.numericUpDown2.DecimalPlaces = 2;
  623. this.numericUpDown2.Location = new System.Drawing.Point(164, 120);
  624. this.numericUpDown2.Maximum = new decimal(new int[] {
  625. 1000,
  626. 0,
  627. 0,
  628. 0});
  629. this.numericUpDown2.Name = "numericUpDown2";
  630. this.numericUpDown2.Size = new System.Drawing.Size(61, 21);
  631. this.numericUpDown2.TabIndex = 29;
  632. this.numericUpDown2.Tag = "max";
  633. this.numericUpDown2.Value = new decimal(new int[] {
  634. 500,
  635. 0,
  636. 0,
  637. 0});
  638. //
  639. // numericUpDown1
  640. //
  641. this.numericUpDown1.DecimalPlaces = 2;
  642. this.numericUpDown1.Location = new System.Drawing.Point(85, 120);
  643. this.numericUpDown1.Maximum = new decimal(new int[] {
  644. 1000,
  645. 0,
  646. 0,
  647. 0});
  648. this.numericUpDown1.Name = "numericUpDown1";
  649. this.numericUpDown1.Size = new System.Drawing.Size(61, 21);
  650. this.numericUpDown1.TabIndex = 28;
  651. this.numericUpDown1.Tag = "min";
  652. this.numericUpDown1.Value = new decimal(new int[] {
  653. 1,
  654. 0,
  655. 0,
  656. 131072});
  657. //
  658. // checkBox2
  659. //
  660. this.checkBox2.AutoSize = true;
  661. this.checkBox2.Checked = true;
  662. this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
  663. this.checkBox2.Location = new System.Drawing.Point(8, 55);
  664. this.checkBox2.Name = "checkBox2";
  665. this.checkBox2.Size = new System.Drawing.Size(72, 16);
  666. this.checkBox2.TabIndex = 26;
  667. this.checkBox2.UseVisualStyleBackColor = true;
  668. //
  669. // textBox6
  670. //
  671. this.textBox6.Location = new System.Drawing.Point(65, 87);
  672. this.textBox6.Name = "textBox6";
  673. this.textBox6.Size = new System.Drawing.Size(45, 21);
  674. this.textBox6.TabIndex = 25;
  675. this.textBox6.Text = "0.5";
  676. this.textBox6.TextChanged += new System.EventHandler(this.textBox6_TextChanged);
  677. //
  678. // label7
  679. //
  680. this.label7.AutoSize = true;
  681. this.label7.Location = new System.Drawing.Point(6, 91);
  682. this.label7.Name = "label7";
  683. this.label7.Size = new System.Drawing.Size(53, 12);
  684. this.label7.TabIndex = 24;
  685. //
  686. // comboBox3
  687. //
  688. this.comboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  689. this.comboBox3.FormattingEnabled = true;
  690. this.comboBox3.Location = new System.Drawing.Point(201, 88);
  691. this.comboBox3.Name = "comboBox3";
  692. this.comboBox3.Size = new System.Drawing.Size(133, 20);
  693. this.comboBox3.TabIndex = 23;
  694. this.comboBox3.SelectedIndexChanged += new System.EventHandler(this.comboBox3_SelectedIndexChanged);
  695. //
  696. // label6
  697. //
  698. this.label6.AutoSize = true;
  699. this.label6.Location = new System.Drawing.Point(136, 91);
  700. this.label6.Name = "label6";
  701. this.label6.Size = new System.Drawing.Size(65, 12);
  702. this.label6.TabIndex = 22;
  703. //
  704. // comboBox2
  705. //
  706. this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  707. this.comboBox2.FormattingEnabled = true;
  708. this.comboBox2.Location = new System.Drawing.Point(201, 53);
  709. this.comboBox2.Name = "comboBox2";
  710. this.comboBox2.Size = new System.Drawing.Size(133, 20);
  711. this.comboBox2.TabIndex = 11;
  712. this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged);
  713. //
  714. // label1
  715. //
  716. this.label1.AutoSize = true;
  717. this.label1.Location = new System.Drawing.Point(136, 56);
  718. this.label1.Name = "label1";
  719. this.label1.Size = new System.Drawing.Size(65, 12);
  720. this.label1.TabIndex = 21;
  721. //
  722. // checkBox1
  723. //
  724. this.checkBox1.AutoSize = true;
  725. this.checkBox1.Location = new System.Drawing.Point(8, 23);
  726. this.checkBox1.Name = "checkBox1";
  727. this.checkBox1.Size = new System.Drawing.Size(72, 16);
  728. this.checkBox1.TabIndex = 7;
  729. this.checkBox1.UseVisualStyleBackColor = true;
  730. this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
  731. //
  732. // groupBox3
  733. //
  734. this.groupBox3.Controls.Add(this.button9);
  735. this.groupBox3.Controls.Add(this.comboBox1);
  736. this.groupBox3.Location = new System.Drawing.Point(179, 491);
  737. this.groupBox3.Name = "groupBox3";
  738. this.groupBox3.Size = new System.Drawing.Size(355, 58);
  739. this.groupBox3.TabIndex = 34;
  740. this.groupBox3.TabStop = false;
  741. //
  742. // button9
  743. //
  744. this.button9.BackColor = System.Drawing.SystemColors.Control;
  745. this.button9.Location = new System.Drawing.Point(241, 19);
  746. this.button9.Name = "button9";
  747. this.button9.Size = new System.Drawing.Size(92, 26);
  748. this.button9.TabIndex = 10;
  749. this.button9.UseVisualStyleBackColor = false;
  750. this.button9.Click += new System.EventHandler(this.button9_Click);
  751. //
  752. // comboBox1
  753. //
  754. this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  755. this.comboBox1.FormattingEnabled = true;
  756. this.comboBox1.Location = new System.Drawing.Point(15, 22);
  757. this.comboBox1.Name = "comboBox1";
  758. this.comboBox1.Size = new System.Drawing.Size(220, 20);
  759. this.comboBox1.TabIndex = 0;
  760. this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
  761. //
  762. // Column1
  763. //
  764. this.Column1.Name = "Column1";
  765. this.Column1.ReadOnly = true;
  766. //
  767. // Column2
  768. //
  769. this.Column2.Name = "Column2";
  770. this.Column2.ReadOnly = true;
  771. //
  772. // Column3
  773. //
  774. this.Column3.Name = "Column3";
  775. this.Column3.ReadOnly = true;
  776. //
  777. // Column4
  778. //
  779. this.Column4.Name = "Column4";
  780. this.Column4.ReadOnly = true;
  781. //
  782. // Column5
  783. //
  784. this.Column5.Name = "Column5";
  785. this.Column5.ReadOnly = true;
  786. //
  787. // GrainSizeStandardDialog
  788. //
  789. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  790. this.ClientSize = new System.Drawing.Size(1127, 830);
  791. this.Controls.Add(this.groupBox4);
  792. this.Controls.Add(this.groupBox3);
  793. this.Controls.Add(this.groupBox_report);
  794. this.Controls.Add(this.groupBox6groupBox_analysisResult2);
  795. this.Controls.Add(this.groupBox_analysisResult1);
  796. this.Controls.Add(this.groupBox_review);
  797. this.Controls.Add(this.groupBox_img);
  798. this.Controls.Add(this.groupBox_operating);
  799. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  800. this.Name = "GrainSizeStandardDialog";
  801. this.Controls.SetChildIndex(this.groupBox_operating, 0);
  802. this.Controls.SetChildIndex(this.groupBox_img, 0);
  803. this.Controls.SetChildIndex(this.groupBox_review, 0);
  804. this.Controls.SetChildIndex(this.groupBox_analysisResult1, 0);
  805. this.Controls.SetChildIndex(this.groupBox6groupBox_analysisResult2, 0);
  806. this.Controls.SetChildIndex(this.groupBox_report, 0);
  807. this.Controls.SetChildIndex(this.groupBox3, 0);
  808. this.Controls.SetChildIndex(this.groupBox4, 0);
  809. this.groupBox_operating.ResumeLayout(false);
  810. this.groupBox_operating.PerformLayout();
  811. this.groupBox_img.ResumeLayout(false);
  812. this.groupBox_report.ResumeLayout(false);
  813. this.groupBox_report.PerformLayout();
  814. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1_0)).EndInit();
  815. this.groupBox6groupBox_analysisResult2.ResumeLayout(false);
  816. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
  817. this.groupBox_analysisResult1.ResumeLayout(false);
  818. this.groupBox4.ResumeLayout(false);
  819. this.groupBox4.PerformLayout();
  820. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
  821. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  822. this.groupBox3.ResumeLayout(false);
  823. this.ResumeLayout(false);
  824. }
  825. public void Initialize()
  826. {
  827. //初始化图片列表
  828. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  829. {
  830. this.imageList_img.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  831. this.lstView_img.Items.Add("", i);
  832. this.lstView_img.Items[i].ImageIndex = i;
  833. this.lstView_img.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  834. this.lstView_img.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  835. }
  836. //
  837. //初始化图像控件
  838. //
  839. this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
  840. this.documentWorkspace.Cursor = Cursors.Default;
  841. this.documentWorkspace.Dock = DockStyle.Fill;
  842. this.documentWorkspace.HookMouseEvents();
  843. this.documentWorkspace.AuxiliaryLineEnabled = false;
  844. this.documentWorkspace.Visible = true;
  845. this.documentWorkspace.panel.MouseDown += OnMouseDown;
  846. this.documentWorkspace.panel.Paint += Panel_Paint;
  847. this.documentWorkspace.panel.MouseMove += onMouseMove;
  848. this.documentWorkspace.panel.MouseUp += onMouseUp;
  849. this.groupBox_review.Controls.Add(this.documentWorkspace);
  850. //
  851. //初始化操作按钮
  852. //
  853. this.commonControlButtons = new CommonControlButtons();
  854. this.commonControlButtons.Dock = DockStyle.Top;
  855. this.commonControlButtons.Height = 30;
  856. this.commonControlButtons.HideZoomToWindowAndActualSize();
  857. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  858. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  859. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  860. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  861. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  862. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  863. groupBox_review.Controls.Add(this.commonControlButtons);
  864. }
  865. #endregion
  866. #region 事件
  867. #region 公共按钮
  868. private void zoomInButton_Click(object sender, EventArgs e)
  869. {
  870. this.documentWorkspace.ZoomIn();
  871. }
  872. private void zoomOutButton_Click(object sender, EventArgs e)
  873. {
  874. this.documentWorkspace.ZoomOut();
  875. }
  876. private void zoomToWindowButton_Click(object sender, EventArgs e)
  877. {
  878. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  879. }
  880. private void actualSizeButton_Click(object sender, EventArgs e)
  881. {
  882. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  883. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  884. }
  885. private void pointerButton_Click(object sender, EventArgs e)
  886. {
  887. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.InclusionNoEffect;
  888. }
  889. private void mobileModeButton_Click(object sender, EventArgs e)
  890. {
  891. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  892. }
  893. #endregion
  894. /// <summary>
  895. /// 设置
  896. /// </summary>
  897. /// <param name="sender"></param>
  898. /// <param name="e"></param>
  899. private void button_setting_Click(object sender, EventArgs e)
  900. {
  901. string templateName = getTemplateName();
  902. AnalyzeSettingDialog metallographicMethodSetDialog = new AnalyzeSettingDialog(this, templateName);
  903. if (metallographicMethodSetDialog.hasModule)
  904. {
  905. metallographicMethodSetDialog.StartPosition = FormStartPosition.CenterScreen;
  906. metallographicMethodSetDialog.ShowDialog();
  907. }
  908. else
  909. {
  910. metallographicMethodSetDialog = null;
  911. }
  912. }
  913. private void btn_saveresult_Click(object sender, EventArgs e)
  914. {
  915. buildListBox_analysisResult();
  916. }
  917. private void lstView_img_SelectedIndexChanged(object sender, EventArgs e)
  918. {
  919. if (this.lstView_img.FocusedItem != null && this.lstView_img.FocusedItem.Selected)
  920. {
  921. this.bitmap = this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  922. //二值化集成4
  923. binaryClass.listView1_SelectedIndexChanged(this.bitmap);
  924. //if (!this.documentWorkspace.PhaseModels[0].choise)
  925. // this.checkBox10.Checked = false;//#
  926. bool existViewFlag = this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].GraphicsList.IsExsitView();
  927. if (!existViewFlag)
  928. {
  929. matOrg = OpenCvSharp.Extensions.BitmapConverter.ToMat(bitmap);
  930. }
  931. else
  932. {
  933. matOrg = OpenCvSharp.Extensions.BitmapConverter.ToMat(this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].GetFullSizeWithRegion());
  934. }
  935. if (this.checkBox1.Checked)
  936. {
  937. this.applyDect();
  938. }
  939. //this.histogramControl1.CreateHistogram(this.bitmap, true, 339, 130, 0);
  940. guideClass.loctation = new PointF(this.documentWorkspace.CompositionSurface.Width / 2, this.documentWorkspace.CompositionSurface.Height / 2);
  941. InitRectangleF();
  942. AddRectangleToRectangleFCaps();
  943. refreshWhileImgChanged();
  944. }
  945. }
  946. #region 矩形拖动
  947. /// <summary>
  948. /// 鼠标按下
  949. /// </summary>
  950. /// <param name="drawArea"></param>
  951. /// <param name="e"></param>
  952. protected virtual void OnMouseDown(object sender, MouseEventArgs e)
  953. {
  954. if (isAreaType)
  955. {
  956. if (this.documentWorkspace.CompositionSurface == null)
  957. return;
  958. // 换算后的点
  959. PointF pointArea = documentWorkspace.GetScalePoint(e.Location);
  960. //辅助线缩放
  961. guideClass.OnMouseDown(pointArea, sender, e);
  962. //辅助线移动
  963. if (e.Button == MouseButtons.Left && e.Clicks == 1)
  964. {
  965. if (guideClass.RectangleFLine.Contains(pointArea))
  966. {
  967. m_canMove = true;
  968. this.m_StartPoint = pointArea;
  969. }
  970. }
  971. return;
  972. }
  973. // 换算后的点
  974. PointF point1 = documentWorkspace.GetScalePoint(e.Location);
  975. if (e.Button == MouseButtons.Left && e.Clicks == 1)
  976. {
  977. if (guideClass.RectangleFLine.Contains(point1))
  978. {
  979. m_canMove = true;
  980. this.m_StartPoint = point1;
  981. }
  982. }
  983. }
  984. /// <summary>
  985. /// 移动
  986. /// </summary>
  987. /// <param name="sender"></param>
  988. /// <param name="e"></param>
  989. protected virtual void onMouseMove(object sender, MouseEventArgs e)
  990. {
  991. this.documentWorkspace.Refresh();
  992. // 换算后的点
  993. PointF point1 = documentWorkspace.GetScalePoint(e.Location);
  994. if (!isAreaType && this.documentWorkspace.CompositionSurface != null && guideClass.onMouseMove(point1, this.comboBox1.SelectedItem, e, this.documentWorkspace.CompositionSurface.Width, this.documentWorkspace.CompositionSurface.Height, getCurrentWorkspace().GetRuler(MeasurementUnit.Micron))
  995. || isAreaType && this.documentWorkspace.CompositionSurface != null && guideClass.onMouseAreaMove(point1, this.comboBox1.SelectedItem, e, this.documentWorkspace.CompositionSurface.Width, this.documentWorkspace.CompositionSurface.Height))// 矩形缩放
  996. {
  997. guideClass.loctation = new PointF(guideClass.RectangleFLine.X + guideClass.RectangleFLine.Width / 2, guideClass.RectangleFLine.Y + guideClass.RectangleFLine.Height / 2);
  998. this.AddRectangleToRectangleFCaps();
  999. this.documentWorkspace.Refresh();
  1000. }
  1001. else if (e.Button == MouseButtons.Left && m_canMove)
  1002. {
  1003. // 矩形偏移
  1004. guideClass.rectangleFLine.Offset(point1.X - this.m_StartPoint.X, point1.Y - this.m_StartPoint.Y);
  1005. guideClass.loctation = new PointF(guideClass.RectangleFLine.X + guideClass.RectangleFLine.Width / 2, guideClass.RectangleFLine.Y + guideClass.RectangleFLine.Height / 2);
  1006. this.m_StartPoint = point1;
  1007. this.AddRectangleToRectangleFCaps();
  1008. this.documentWorkspace.Refresh();
  1009. }
  1010. }
  1011. /// <summary>
  1012. /// 鼠标抬起
  1013. /// </summary>
  1014. /// <param name="sender"></param>
  1015. /// <param name="e"></param>
  1016. private void onMouseUp(object sender, MouseEventArgs e)
  1017. {
  1018. m_canMove = false;
  1019. guideClass.onMouseUp(sender, e);
  1020. }
  1021. #endregion
  1022. /// <summary>
  1023. /// 画布绘制
  1024. /// </summary>
  1025. /// <param name="sender"></param>
  1026. /// <param name="e"></param>
  1027. private void Panel_Paint(object sender, PaintEventArgs e)
  1028. {
  1029. if (this.documentWorkspace.CompositionSurface != null)
  1030. {
  1031. //
  1032. // 以下是计算绘制图片的位置和大小并绘制图片
  1033. //
  1034. System.Drawing.Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
  1035. int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
  1036. int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
  1037. int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
  1038. int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
  1039. //
  1040. // 以下是绘制网格、标注、测量、视场等开始
  1041. //
  1042. e.Graphics.TranslateTransform(x, y);
  1043. e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
  1044. Draw(e.Graphics);
  1045. e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
  1046. e.Graphics.TranslateTransform(-x, -y);
  1047. }
  1048. }
  1049. /// <summary>
  1050. /// 绘制
  1051. /// </summary>
  1052. private void Draw(Graphics graphics)
  1053. {
  1054. // 抗锯齿
  1055. graphics.SmoothingMode = SmoothingMode.AntiAlias;
  1056. drawSubclass(graphics);
  1057. }
  1058. /// <summary>
  1059. /// 切换辅助线
  1060. /// </summary>
  1061. /// <param name="sender"></param>
  1062. /// <param name="e"></param>
  1063. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  1064. {
  1065. if (this.comboBox1.DataSource != null && this.comboBox1.SelectedIndex >= 0)
  1066. {
  1067. UpdateGuideStyle();
  1068. if (this.bitmap != null)
  1069. {
  1070. if (this.comboboxChange)
  1071. {
  1072. guideClass.loctation = new PointF(this.documentWorkspace.CompositionSurface.Width / 2, this.documentWorkspace.CompositionSurface.Height / 2);
  1073. }
  1074. InitRectangleF();
  1075. this.comboboxChange = true;
  1076. }
  1077. this.documentWorkspace.Refresh();
  1078. }
  1079. }
  1080. #endregion
  1081. #region 内部方法
  1082. /// <summary>
  1083. /// 导出项目
  1084. /// </summary>
  1085. /// <param name="sender"></param>
  1086. /// <param name="e"></param>
  1087. private void button1_Click(object sender, EventArgs e)
  1088. {
  1089. if (this.listView2.Items.Count == 0)
  1090. {
  1091. MessageBox.Show(PdnResources.GetString("Menu.Noresults.text"));
  1092. return;
  1093. }
  1094. if (this.checkBox_generateReport_opensetting.Checked)
  1095. this.button_setting.PerformClick();
  1096. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  1097. {
  1098. //获取项目工程内的文件夹路径
  1099. ProjectEngineering.NodeItem nodeItem = this.appWorkspace.GetInsertProjectPath(2, getProjectEngineeringName(), this.analyzeSettingModel.savePath);
  1100. if (nodeItem == null) return;
  1101. //获取word书签与excel单元格的关系,以字典方式存储
  1102. List<mic_module_infos> mic_module_infos = PaintDotNet.DbOpreate.DbBll.mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  1103. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  1104. if (mic_module_infos != null && mic_module_infos.Count > 0)
  1105. {
  1106. foreach (mic_module_infos info in mic_module_infos)
  1107. {
  1108. tagInfos.Add(info.tag_name, info.cell_position);
  1109. }
  1110. }
  1111. //分析结果
  1112. List<List<string>> analysisContent = new List<List<string>>();
  1113. analysisContent.Add(contentHead);
  1114. foreach (DataGridViewRow item in this.dataGridView2.Rows)
  1115. {
  1116. List<string> content = new List<string>();
  1117. for (int i = 0; i < contentHead.Count; i++)
  1118. {
  1119. content.Add(item.Cells[i].Value.ToString());
  1120. }
  1121. analysisContent.Add(content);
  1122. }
  1123. //图片
  1124. bitList = new List<Bitmap>();
  1125. //中间数据
  1126. List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
  1127. if (this.allShow)
  1128. {
  1129. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  1130. {
  1131. bitList.Add(kv.Value[0]);
  1132. bitList.Add(kv.Value[1]);
  1133. }
  1134. //中间数据
  1135. foreach (ExportProjectModel model in this.tempDataModel)
  1136. {
  1137. ExportProjectModel tempModel = new ExportProjectModel();
  1138. tempModel.tagName = model.tagName;
  1139. tempModel.picName = model.picName;
  1140. tempModel.dataList = model.dataList;
  1141. exportModel.Add(tempModel);
  1142. }
  1143. }
  1144. else
  1145. {
  1146. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  1147. {
  1148. foreach (ListViewItem item in this.listView2.SelectedItems)
  1149. {
  1150. if (bitDic.ContainsKey(item.Name))
  1151. {
  1152. bitList.Add(bitDic[item.Name][0]);
  1153. bitList.Add(bitDic[item.Name][1]);
  1154. }
  1155. else if (bitDic.ContainsKey(item.Tag.ToString()))
  1156. {
  1157. bitList.Add(bitDic[item.Tag.ToString()][0]);
  1158. bitList.Add(bitDic[item.Tag.ToString()][1]);
  1159. }
  1160. }
  1161. //中间数据
  1162. foreach (ListViewItem rowItem in this.listView2.SelectedItems)
  1163. {
  1164. foreach (ExportProjectModel model in this.tempDataModel)
  1165. {
  1166. if (model.tagName.Equals(rowItem.Name))
  1167. {
  1168. ExportProjectModel tempModel = new ExportProjectModel();
  1169. tempModel.tagName = model.tagName;
  1170. tempModel.picName = model.picName;
  1171. tempModel.dataList = model.dataList;
  1172. exportModel.Add(tempModel);
  1173. break;
  1174. }
  1175. else if (model.tagName.Equals(rowItem.Tag.ToString()))
  1176. {
  1177. ExportProjectModel tempModel = new ExportProjectModel();
  1178. tempModel.tagName = model.tagName;
  1179. tempModel.picName = model.picName;
  1180. tempModel.dataList = model.dataList;
  1181. exportModel.Add(tempModel);
  1182. break;
  1183. }
  1184. }
  1185. }
  1186. }
  1187. else if (this.listView2.Items.Count > 0)
  1188. {
  1189. ListViewItem rowItem = this.listView2.Items[0];
  1190. if (bitDic.ContainsKey(rowItem.Name))
  1191. {
  1192. bitList.Add(bitDic[rowItem.Name][0]);
  1193. bitList.Add(bitDic[rowItem.Name][1]);
  1194. }
  1195. else if (bitDic.ContainsKey(rowItem.Tag.ToString()))
  1196. {
  1197. bitList.Add(bitDic[rowItem.Tag.ToString()][0]);
  1198. bitList.Add(bitDic[rowItem.Tag.ToString()][1]);
  1199. }
  1200. //中间数据
  1201. foreach (ExportProjectModel model in this.tempDataModel)
  1202. {
  1203. if (model.tagName.Equals(rowItem.Name))
  1204. {
  1205. ExportProjectModel tempModel = new ExportProjectModel();
  1206. tempModel.tagName = model.tagName;
  1207. tempModel.picName = model.picName;
  1208. tempModel.dataList = model.dataList;
  1209. exportModel.Add(tempModel);
  1210. break;
  1211. }
  1212. else if (model.tagName.Equals(rowItem.Tag.ToString()))
  1213. {
  1214. ExportProjectModel tempModel = new ExportProjectModel();
  1215. tempModel.tagName = model.tagName;
  1216. tempModel.picName = model.picName;
  1217. tempModel.dataList = model.dataList;
  1218. exportModel.Add(tempModel);
  1219. break;
  1220. }
  1221. }
  1222. }
  1223. }
  1224. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, nodeItem.path, nodeItem.code);
  1225. //保存项目信息到数据库
  1226. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, nodeItem);
  1227. }
  1228. else
  1229. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  1230. }
  1231. /// <summary>
  1232. /// 导出结果
  1233. /// </summary>
  1234. /// <param name="sender"></param>
  1235. /// <param name="e"></param>
  1236. private void button_exportResults_Click(object sender, EventArgs e)
  1237. {
  1238. if (this.listView2.Items.Count > 0)
  1239. {
  1240. SaveFileDialog exe = new SaveFileDialog();
  1241. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  1242. exe.FilterIndex = 0;
  1243. exe.RestoreDirectory = true;
  1244. exe.Title = "Export Excel File";
  1245. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  1246. exe.FileName = this.Text + PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddHHmmss");
  1247. DialogResult dr = exe.ShowDialog();
  1248. if (dr != DialogResult.OK)
  1249. {
  1250. return;
  1251. }
  1252. System.Data.DataTable dtb = new System.Data.DataTable();
  1253. foreach (var item in this.contentHead)
  1254. {
  1255. dtb.Columns.Add(item);
  1256. }
  1257. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  1258. {
  1259. System.Data.DataRow dataRow = dtb.NewRow();
  1260. for (int k = 0; k < this.contentHead.Count; k++)
  1261. {
  1262. dataRow[this.contentHead[k]] = this.dataGridView2.Rows[i].Cells[k].Value;
  1263. }
  1264. dtb.Rows.Add(dataRow);
  1265. }
  1266. List<System.Data.DataTable> list = new List<System.Data.DataTable>();
  1267. list.Add(dtb);
  1268. ///#########################################
  1269. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, false, false, true);
  1270. }
  1271. else
  1272. MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text")+"!");
  1273. }
  1274. /// <summary>
  1275. /// 辅助线设置
  1276. /// </summary>
  1277. /// <param name="sender"></param>
  1278. /// <param name="e"></param>
  1279. private void button9_Click(object sender, EventArgs e)
  1280. {
  1281. if (this.bitmap == null)
  1282. {
  1283. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  1284. return;
  1285. }
  1286. this.oldSelectItem = (string)this.comboBox1.SelectedItem;
  1287. GrainGuideSettingsDialog grainGuideStyleSettingsDialog = new GrainGuideSettingsDialog(isAreaType ? 1 : 0, getModelName(), getTypeNames(), this.bitmap, this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].GetRuler(MeasurementUnit.Micron));
  1288. grainGuideStyleSettingsDialog.StartPosition = FormStartPosition.CenterScreen;
  1289. grainGuideStyleSettingsDialog.ShowDialog(this);
  1290. }
  1291. //二值化集成3
  1292. #region 二值化相关方法
  1293. /// <summary>
  1294. /// 添加参数改变的监听
  1295. /// </summary>
  1296. /// <param name="sender"></param>
  1297. /// <param name="e"></param>
  1298. private void GrainSizeStandardDialog_Load(object sender, EventArgs e)
  1299. {
  1300. this.comboBox3.Text = PdnResources.GetString("Menu.pdenoisingtype.Text");
  1301. this.comboBox3.SelectedIndex = 1;
  1302. this.comboBox2.Text = PdnResources.GetString("Menu.electthegrainboundarytype.Text");
  1303. this.comboBox2.SelectedIndex = 1;
  1304. this.binaryClass.loadParams();
  1305. this.binaryClass.comboBox1 = this.comboBox1;//##
  1306. }
  1307. private bool bcBinaryChecked()
  1308. {
  1309. return bc != null && bc.BinaryChecked;
  1310. }
  1311. private bool bcOriginChecked()
  1312. {
  1313. return bc != null && bc.OriginChecked;
  1314. }
  1315. /// <summary>
  1316. /// 参数改变时,重新处理图像
  1317. /// </summary>
  1318. /// <param name="sender"></param>
  1319. /// <param name="e"></param>
  1320. private void bClassBinaryImplFinishAction(object sender, EventArgs e)
  1321. {
  1322. this.documentWorkspace.Refresh();
  1323. }
  1324. /// <summary>
  1325. /// 显示原图/原图+二值图
  1326. /// </summary>
  1327. /// <param name="sender"></param>
  1328. /// <param name="e"></param>
  1329. private void bcOriginCheckedChanged(object sender, EventArgs e)
  1330. {
  1331. if (!bcOriginChecked())
  1332. {
  1333. if (bcBinaryChecked())
  1334. this.documentWorkspace.PhaseModels[0].choise = true;
  1335. if (this.toshowPhoseModelAt(1))
  1336. this.documentWorkspace.PhaseModels[1].choise = true;
  1337. this.refreshPhaseModelChoise();
  1338. }
  1339. else
  1340. {
  1341. this.documentWorkspace.PhaseModels[0].choise = false;
  1342. this.documentWorkspace.PhaseModels[1].choise = false;
  1343. }
  1344. this.documentWorkspace.Refresh();
  1345. }
  1346. #endregion
  1347. /// <summary>
  1348. /// 晶界编辑
  1349. /// </summary>
  1350. /// <param name="sender"></param>
  1351. /// <param name="e"></param>
  1352. private void button3_Click(object sender, EventArgs e)
  1353. {
  1354. if (this.documentWorkspace.PhaseModels.Count < 2 || /*this.documentWorkspace.PhaseModels[1].choise == true && */this.documentWorkspace.PhaseModels[1].mat == null)
  1355. {
  1356. MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformuctionfirst.text"));
  1357. return;
  1358. }
  1359. //1013###19326 晶粒度的晶界编辑页面,需要把辅助线带过去(客户编辑只处理辅助线位置的晶界)
  1360. GrainSizeStandard.IntegrationClass.GrainBoundaryEditingDialog boundaryEditingDialog = new GrainSizeStandard.IntegrationClass.GrainBoundaryEditingDialog(this.appWorkspace, this.lstView_img.FocusedItem.Index, this.panel1.BackColor
  1361. , this.documentWorkspace.PhaseModels[1].mat.Clone());
  1362. boundaryEditingDialog.GuideClass = this.guideClass;
  1363. boundaryEditingDialog.SelectedItem = this.comboBox1.SelectedItem;
  1364. if (boundaryEditingDialog.ShowDialog() == DialogResult.OK)
  1365. {
  1366. this.documentWorkspace.PhaseModels[1].mat = boundaryEditingDialog.PhaseMat.Clone();
  1367. this.documentWorkspace.Refresh();
  1368. }
  1369. }
  1370. /// <summary>
  1371. /// 晶界重现
  1372. /// </summary>
  1373. /// <param name="sender"></param>
  1374. /// <param name="e"></param>
  1375. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  1376. {
  1377. if (this.checkBox1.Checked && !bcOriginChecked())
  1378. {
  1379. this.documentWorkspace.PhaseModels[1].choise = true;
  1380. }
  1381. else
  1382. {
  1383. this.documentWorkspace.PhaseModels[1].choise = false;
  1384. this.documentWorkspace.Refresh();
  1385. }
  1386. if (this.checkBox1.Checked)
  1387. {
  1388. this.applyDect();
  1389. }
  1390. else
  1391. AddRectangleToRectangleFCaps();//1009###18946
  1392. }
  1393. private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
  1394. {
  1395. if (this.checkBox1.Checked)
  1396. {
  1397. this.applyDect();
  1398. }
  1399. }
  1400. private void textBox6_TextChanged(object sender, EventArgs e)
  1401. {
  1402. if (this.checkBox1.Checked)
  1403. {
  1404. this.applyDect();
  1405. }
  1406. }
  1407. private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
  1408. {
  1409. if (this.checkBox1.Checked)
  1410. {
  1411. this.applyDect();
  1412. }
  1413. }
  1414. ProgressThreadProcClass procClass;
  1415. double sigma = 0.5;
  1416. Mat OrgImg;// = OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap);// OpenCvSharp.Cv2.ImRead(inputImageFile);
  1417. int dark;// = this.comboBox2.SelectedIndex;// 2;//指定晶界类型,暗晶界dark=1, 否则dark=0, dark=2梯度
  1418. int smooth_type;// = this.comboBox3.SelectedIndex;// 1;//去噪类型: 高斯平滑: smooth_type=0; 方向平滑: smooth_type=1
  1419. //double sigma = double.Parse(textBox6.Text);// 0.5;//如果是高斯平滑,则指定高斯sigma,如果是方向平滑 则忽略此参数
  1420. int enhance;// = this.checkBox2.Checked ? 1 : 0;// 1;//是否增强晶界?不增强:enhance=0; 增强: enhance=1
  1421. double[] cell_size;// = new double[2] { (double)numericUpDown1.Value, (double)numericUpDown2.Value }; ;// new double[2] { 0.01, 500 };//晶界大小
  1422. Mat OrgImg0;
  1423. private void applyDect()
  1424. {
  1425. if (this.bitmap == null)
  1426. {
  1427. return;
  1428. }
  1429. if (!double.TryParse(textBox6.Text, out sigma))
  1430. {
  1431. return;
  1432. }
  1433. //string inputImageFile = "原始图片1.jpg";// "j1.JPG";
  1434. ////char[] inputImageFile2 = inputImageFile.ToCharArray();
  1435. /*Mat */OrgImg = OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap);// OpenCvSharp.Cv2.ImRead(inputImageFile);
  1436. /*int */dark = this.comboBox2.SelectedIndex;// 2;//指定晶界类型,暗晶界dark=1, 否则dark=0, dark=2梯度
  1437. /*int */smooth_type = this.comboBox3.SelectedIndex;// 1;//去噪类型: 高斯平滑: smooth_type=0; 方向平滑: smooth_type=1
  1438. //double sigma = double.Parse(textBox6.Text);// 0.5;//如果是高斯平滑,则指定高斯sigma,如果是方向平滑 则忽略此参数
  1439. /*int */enhance = this.checkBox2.Checked ? 1 : 0;// 1;//是否增强晶界?不增强:enhance=0; 增强: enhance=1
  1440. /*double[] */cell_size = new double[2] { (double)numericUpDown1.Value, (double)numericUpDown2.Value }; ;// new double[2] { 0.01, 500 };//晶界大小
  1441. procClass = new ProgressThreadProcClass();
  1442. procClass.StartProgressAutoAction(this, new System.Threading.ThreadStart(applyDectAction), PdnResources.GetString("Menu.Grainboundarytoreproduce.text"));
  1443. if (OrgImg0 != null)
  1444. {
  1445. this.documentWorkspace.PhaseModels[1].mat = OrgImg0.Clone();
  1446. this.documentWorkspace.Refresh();
  1447. OrgImg0 = null;
  1448. }
  1449. if (OrgImg != null)
  1450. {
  1451. OrgImg.Dispose();
  1452. OrgImg = null;
  1453. }
  1454. //this.runDect(OrgImg, dark, smooth_type, sigma, enhance, cell_size);
  1455. }
  1456. private void applyDectAction()
  1457. {
  1458. OrgImg0 = this.runDect(OrgImg, dark, smooth_type, sigma, enhance, cell_size);
  1459. if (procClass != null) procClass.DismissProgressAction(this);
  1460. }
  1461. private Mat runDect(Mat OrgImg0, int dark, int smooth_type, double sigma, int enhance, double[] cell_size)
  1462. {
  1463. Mat GryImg = new Mat();
  1464. Mat OrgImg = new Mat();
  1465. /////
  1466. if (4 == OrgImg0.Channels())
  1467. {
  1468. Cv2.CvtColor(OrgImg0, OrgImg, ColorConversionCodes.BGRA2BGR);
  1469. }
  1470. else
  1471. {
  1472. OrgImg = OrgImg0.Clone();
  1473. }
  1474. GrainSizeStandard.IntegrationClass.In5segmsurf prm = new GrainSizeStandard.IntegrationClass.In5segmsurf();
  1475. prm.OrgImg = OrgImg;
  1476. /////
  1477. //Cv2.ImShow("src", OrgImg);//kkkkk
  1478. ////Cv2.WaitKey(0);//kkkkk
  1479. //转为为灰度?
  1480. if (3 == OrgImg.Channels() || 4 == OrgImg.Channels())
  1481. {
  1482. Cv2.CvtColor(OrgImg, GryImg, ColorConversionCodes.RGB2GRAY);
  1483. }
  1484. else
  1485. {
  1486. if (1 == OrgImg.Channels())
  1487. {
  1488. GryImg = OrgImg.Clone();
  1489. }
  1490. else
  1491. {
  1492. return null;
  1493. }
  1494. }
  1495. if (1 == dark)
  1496. {
  1497. int Rows = GryImg.Rows;
  1498. int Cols = GryImg.Cols;
  1499. int[] point = new int[2];
  1500. //单通道图像的反色
  1501. for (point[0] = 0; point[0] < Rows; point[0]++)
  1502. {
  1503. for (point[1] = 0; point[1] < Cols; point[1]++)
  1504. {
  1505. byte bTemp = (byte)(255 - GryImg.At<byte>(point[0], point[1]));
  1506. GryImg.Set<byte>(point, bTemp);//mmmmm
  1507. }
  1508. }
  1509. }
  1510. if (2 == dark)
  1511. {
  1512. Mat TempImg = GryImg.Clone();
  1513. Cv2.Sobel(TempImg, GryImg, -1, 2, 2, 3);//mmmmm
  1514. }
  1515. //Cv2.ImShow("src", GryImg);//kkkkk
  1516. //Cv2.WaitKey(0);//kkkkk
  1517. //去噪
  1518. if (0 == smooth_type)
  1519. {
  1520. prm.smoothim_method = "gaussian";
  1521. }
  1522. else
  1523. {
  1524. if (1 == smooth_type)
  1525. {
  1526. prm.smoothim_method = "dirced";
  1527. }
  1528. else
  1529. {
  1530. return null;
  1531. }
  1532. }
  1533. //晶界增强
  1534. if (1 == enhance)
  1535. {
  1536. prm.filterridges = 1;
  1537. }
  1538. else
  1539. {
  1540. prm.filterridges = 0;
  1541. }
  1542. //调用算法
  1543. prm.gaussian_stdev = sigma;
  1544. prm.LEVEL = ".3";
  1545. prm.classifycells_convexarea = 0.50;
  1546. prm.classifycells_convexperim = 0.45;
  1547. GrainSizeStandard.IntegrationClass.OLDcellsegm cellsegm = new GrainSizeStandard.IntegrationClass.OLDcellsegm();
  1548. string[] namehere = new string[1] { "prm" };
  1549. GrainSizeStandard.IntegrationClass.In6segmsurf IN6BNImgs = new GrainSizeStandard.IntegrationClass.In6segmsurf();
  1550. GrainSizeStandard.IntegrationClass.OUTsegmsurf RSTss = cellsegm.mf_segmsurf_progress_auto(GryImg, cell_size[0], cell_size[1], namehere, prm, IN6BNImgs, this.panel1.BackColor, this);
  1551. //cell_size = null;
  1552. //cellsegm = null;
  1553. //namehere = null;
  1554. Cv2.CvtColor(RSTss.wat, OrgImg0, ColorConversionCodes.BGR2BGRA);
  1555. ////Cv2.ImShow("dst", OrgImg0);//kkkkk
  1556. //////Cv2.WaitKey(0);//kkkkk
  1557. //this.documentWorkspace.PhaseModels[1].mat = OrgImg0;// RSTss.wat;// action.PerformProcess(
  1558. //// OpenCvSharp.Extensions.BitmapConverter.ToMat(this.documentWorkspace.GetFullSizeWithRegion()),
  1559. //// OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap));
  1560. //////this.documentWorkspace.PhaseModels[1].color = this.panel2.BackColor.ToArgb();
  1561. //this.documentWorkspace.Refresh();
  1562. //return RSTss.wat;
  1563. //string filename = "D:\\result11.jpg";
  1564. //Cv2.ImWrite(filename, RSTss.wat);
  1565. return OrgImg0;
  1566. }
  1567. private void panel1_Click(object sender, EventArgs e)
  1568. {
  1569. this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
  1570. this.colorsFormGrid.ShowDialog();
  1571. }
  1572. /// <summary>
  1573. /// Panel2的调色板颜色改变
  1574. /// </summary>
  1575. /// <param name="sender"></param>
  1576. /// <param name="e"></param>
  1577. private void gridColorChanged(object sender, EventArgs e)
  1578. {
  1579. Color color = this.colorsFormGrid.UserPrimaryColor.ToColor();
  1580. //更改背景色,触发事件
  1581. this.panel1.BackColor = color;
  1582. this.documentWorkspace.PhaseModels[1].color = this.panel1.BackColor.ToArgb();
  1583. //this.applyDect();//#
  1584. this.documentWorkspace.Refresh();
  1585. //关闭色板
  1586. this.colorsFormGrid.Close();
  1587. }
  1588. #endregion
  1589. #region 可调用方法
  1590. /// <summary>
  1591. /// 是否显示原图
  1592. /// </summary>
  1593. /// <returns></returns>
  1594. protected Boolean showOrimat()
  1595. {
  1596. return bcOriginChecked();
  1597. }
  1598. /// <summary>
  1599. /// 是否能取到二值的结果
  1600. /// </summary>
  1601. /// <returns></returns>
  1602. protected Boolean getBinaryChecked()
  1603. {
  1604. return (bcBinaryChecked() && this.documentWorkspace.PhaseModels[0].mat != null);
  1605. }
  1606. /// <summary>
  1607. /// 是否能取到晶界重现的结果
  1608. /// </summary>
  1609. /// <returns></returns>
  1610. protected Boolean getGrainBoundryChecked()
  1611. {
  1612. return (this.checkBox1.Checked && this.documentWorkspace.PhaseModels[1].mat != null);
  1613. }
  1614. /// <summary>
  1615. /// 返回当前选择的辅助线名称
  1616. /// </summary>
  1617. /// <returns></returns>
  1618. protected string getCurrentGuideName()
  1619. {
  1620. return this.comboBox1.SelectedItem != null ? this.comboBox1.SelectedItem.ToString() : "";
  1621. }
  1622. /// <summary>
  1623. /// 返回当前选择的图片内容
  1624. /// </summary>
  1625. /// <returns></returns>
  1626. protected DocumentWorkspace getCurrentWorkspace()
  1627. {
  1628. return this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem != null ? this.lstView_img.FocusedItem.Index : this.lstView_img.SelectedItems[0].Index];// this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index];
  1629. }
  1630. /// <summary>
  1631. /// 返回当前选择的图片tag
  1632. /// </summary>
  1633. /// <returns></returns>
  1634. protected string getCurrentWorkTag()
  1635. {
  1636. return this.imageList_img.Images.Keys[this.lstView_img.FocusedItem.Index];
  1637. }
  1638. /// <summary>
  1639. /// 获取面积法显示编号的颜色
  1640. /// </summary>
  1641. /// <returns></returns>
  1642. protected Color getGrainBoundryColor()
  1643. {
  1644. return this.panel1.BackColor;
  1645. }
  1646. #endregion
  1647. /// <summary>
  1648. /// 更新截点样式
  1649. /// </summary>
  1650. public void UpdateCupOffPointStyle()
  1651. {
  1652. styleClass.UpdateCupOffPointStyle();
  1653. AddRectangleToRectangleFCaps();
  1654. }
  1655. #region 需继承方法
  1656. protected virtual Boolean toshowPhoseModelAt(int index)
  1657. {
  1658. if (index == 1)
  1659. {
  1660. return (this.checkBox1.Checked && !bcOriginChecked());
  1661. }
  1662. return true;
  1663. }
  1664. /// <summary>
  1665. /// 图片索引改变后调用的事件
  1666. /// </summary>
  1667. protected virtual void refreshWhileImgChanged()
  1668. {
  1669. }
  1670. protected virtual void refreshPhaseModelChoise()
  1671. {
  1672. }
  1673. protected virtual void buildListBox_analysisResult()
  1674. {
  1675. //this.listBox_analysisResult.Items.Clear();
  1676. ////foreach (var item in analysisResults.Keys)
  1677. ////{
  1678. //// this.listBox_analysisResult.Items.Add(new LocalListViewItem(item, item.GetFriendlyName()));
  1679. ////}
  1680. ////buildListView_analysisResult();
  1681. }
  1682. protected virtual void SubclassInitialize()
  1683. {
  1684. throw new NotImplementedException();
  1685. }
  1686. /// <summary>
  1687. /// 辅助线类型
  1688. /// </summary>
  1689. /// <returns></returns>
  1690. protected virtual string[] getTypeNames()
  1691. {
  1692. return new string[] {
  1693. "",
  1694. ""};
  1695. }
  1696. /// <summary>
  1697. /// 辅助线配置文件名称
  1698. /// </summary>
  1699. /// <returns></returns>
  1700. protected virtual string getModelName()
  1701. {
  1702. throw new NotImplementedException();
  1703. }
  1704. /// <summary>
  1705. /// 报告模板命名
  1706. /// </summary>
  1707. /// <returns></returns>
  1708. protected virtual string getTemplateName()
  1709. {
  1710. throw new NotImplementedException();
  1711. }
  1712. /// <summary>
  1713. /// 项目工程内的文件夹路径名称
  1714. /// </summary>
  1715. /// <returns></returns>
  1716. protected virtual string getProjectEngineeringName()
  1717. {
  1718. throw new NotImplementedException();
  1719. }
  1720. /// <summary>
  1721. /// 是否绘制辅助线
  1722. /// </summary>
  1723. /// <param name="graphics"></param>
  1724. /// <returns></returns>
  1725. protected virtual bool drawGuideLines()
  1726. {
  1727. return false;
  1728. }
  1729. /// <summary>
  1730. /// 是否绘制截点
  1731. /// </summary>
  1732. /// <param name="graphics"></param>
  1733. /// <returns></returns>
  1734. protected virtual bool drawGuidePoints()
  1735. {
  1736. return false;
  1737. }
  1738. /// <summary>
  1739. /// 是否绘制编号
  1740. /// </summary>
  1741. /// <param name="graphics"></param>
  1742. /// <returns></returns>
  1743. protected virtual bool drawMassLabelPoints()
  1744. {
  1745. return false;
  1746. }
  1747. protected virtual void drawSubclass(Graphics graphics)
  1748. {
  1749. //显示辅助线
  1750. if (drawGuideLines())
  1751. if (isAreaType)
  1752. guideClass.DrawAreaGuide(graphics, this.comboBox1.SelectedItem);
  1753. else
  1754. guideClass.DrawGuideLines(graphics, this.comboBox1.SelectedItem);
  1755. //显示截点
  1756. if (drawGuidePoints())
  1757. styleClass.DrawGuidePoints(graphics);
  1758. //显示编号
  1759. if (drawMassLabelPoints() && massLabelPoints.Count > 0)
  1760. {
  1761. int index = 0;
  1762. Font myFont = new Font("宋体", 12);
  1763. Brush bush = new SolidBrush(getGrainBoundryColor());//填充的颜色
  1764. foreach (var item in massLabelPoints)
  1765. {
  1766. graphics.DrawString("" + (++index), myFont, bush, (float)item.X - 5, (float)item.Y - 5);
  1767. }
  1768. }
  1769. }
  1770. /// <summary>
  1771. /// 刷新图形边线点集合
  1772. /// </summary>
  1773. protected virtual void AddRectangleToRectangleFCaps()
  1774. {
  1775. if (isAreaType)
  1776. {
  1777. if (this.bitmap == null)
  1778. return;
  1779. this.linePointList.Clear();
  1780. //获取图形上所有的点
  1781. this.linePointList.AddRange(guideClass.getGuideAreaPointList(this.bitmap, this.getCurrentGuideName(), getCurrentWorkspace().GetRuler(MeasurementUnit.Micron)));
  1782. this.documentWorkspace.Refresh();
  1783. return;
  1784. }
  1785. Mat mat;
  1786. if (!getGrainBoundryChecked() && !getBinaryChecked())
  1787. {
  1788. mat = matOrg;
  1789. }
  1790. else
  1791. {
  1792. if (getGrainBoundryChecked())
  1793. {
  1794. if (this.documentWorkspace.PhaseModels[1].mat != null)
  1795. mat = this.documentWorkspace.PhaseModels[1].mat;
  1796. else
  1797. return;
  1798. }
  1799. else if (this.documentWorkspace.PhaseModels[0].mat != null)
  1800. {
  1801. mat = this.documentWorkspace.PhaseModels[0].mat;
  1802. }
  1803. else
  1804. return;
  1805. }
  1806. if (mat == null)
  1807. return;
  1808. this.linePointList.Clear();
  1809. //获取图形上所有的点
  1810. this.linePointList.AddRange(guideClass.getGuidePointList(mat, this.comboBox1.SelectedItem));
  1811. //垂直辅助线 / 水平辅助线
  1812. bool vGuideStylesOrHGuideStyles = guideClass.IsVGuideStylesOrHGuideStyles(this.comboBox1.SelectedItem);
  1813. int matLevel = 0;
  1814. if (getGrainBoundryChecked())
  1815. matLevel = 2;
  1816. else if (getBinaryChecked())
  1817. matLevel = 1;
  1818. else if (!getGrainBoundryChecked() && !getBinaryChecked())
  1819. matLevel = 0;
  1820. //自动添加截点
  1821. styleClass.AddRectangleToRectangleFCaps(mat, matLevel, this.linePointList, vGuideStylesOrHGuideStyles, this.documentWorkspace.CompositionSurface.Width
  1822. , this.documentWorkspace.CompositionSurface.Height);
  1823. this.documentWorkspace.Refresh();
  1824. }
  1825. /// <summary>
  1826. /// 初始化矩形
  1827. /// </summary>
  1828. protected virtual void InitRectangleF()
  1829. {
  1830. if (this.matOrg != null)
  1831. {
  1832. bool foundItem;
  1833. if (isAreaType)
  1834. guideClass.RectangleFLine = guideClass.guideAreaRectLine(this.comboBox1.SelectedItem, out foundItem, true, getCurrentWorkspace().GetRuler(MeasurementUnit.Micron));
  1835. else
  1836. guideClass.RectangleFLine = guideClass.guideRectLine(this.comboBox1.SelectedItem, out foundItem, true, getCurrentWorkspace().GetRuler(MeasurementUnit.Micron));
  1837. if (foundItem)
  1838. this.AddRectangleToRectangleFCaps();
  1839. }
  1840. }
  1841. /// <summary>
  1842. /// 更新辅助线及其样式
  1843. /// </summary>
  1844. protected virtual void UpdateGuideStyle()
  1845. {
  1846. // 更新辅助线及其样式
  1847. if (isAreaType)
  1848. guideClass.UpdateGuideAreaStyle(this.bitmap, this.comboBox1.SelectedItem, this.comboBox1.SelectedIndex > 0, getCurrentWorkspace().GetRuler(MeasurementUnit.Micron));
  1849. else
  1850. guideClass.UpdateGuideStyle(matOrg, this.comboBox1.SelectedItem, true, getCurrentWorkspace().GetRuler(MeasurementUnit.Micron));
  1851. }
  1852. /// <summary>
  1853. /// 辅助线维护
  1854. /// </summary>
  1855. public virtual void InitComboboxValue(ArrayList arrayList)
  1856. {
  1857. UpdateCupOffPointStyle();
  1858. if (isAreaType)
  1859. guideClass.createGuideAreaClassModelsNamed(getModelName());
  1860. else
  1861. guideClass.createGuideClassModelsNamed(getModelName());
  1862. this.comboBox1.DataSource = null;
  1863. if (arrayList != null && arrayList.Count > 0)
  1864. {
  1865. this.comboboxChange = false;
  1866. arrayList.Insert(0, PdnResources.GetString("Menu.Pleaseselecttheauxiliarylineused.text"));
  1867. this.comboBox1.DataSource = arrayList;
  1868. this.comboboxChange = false;
  1869. int oldSelectIndex = -1;
  1870. for (int i = 0; i < this.comboBox1.Items.Count; i++)
  1871. {
  1872. if (this.oldSelectItem.Equals(this.comboBox1.Items[i]))
  1873. {
  1874. oldSelectIndex = i;
  1875. }
  1876. }
  1877. if (oldSelectIndex > -1)
  1878. this.comboBox1.SelectedIndex = oldSelectIndex;
  1879. else if (this.comboBox1.Items.Count > 0)
  1880. this.comboBox1.SelectedIndex = 0;
  1881. }
  1882. else
  1883. {
  1884. ArrayList arrayList1;
  1885. if (isAreaType)
  1886. arrayList1 = guideClass.getComboboxArrayAreaList1();
  1887. else
  1888. arrayList1 = guideClass.getComboboxArrayList1();
  1889. if (arrayList1.Count > 0)
  1890. {
  1891. this.comboBox1.DataSource = arrayList1;
  1892. this.comboBox1.SelectedIndex = 0;
  1893. }
  1894. }
  1895. UpdateGuideStyle();
  1896. this.documentWorkspace.Refresh();
  1897. }
  1898. #endregion
  1899. #region 内部类
  1900. internal class LocalListViewItem
  1901. {
  1902. public DocumentWorkspace Value { get; }
  1903. public string Display { get; }
  1904. public LocalListViewItem(DocumentWorkspace Value, string Display)
  1905. {
  1906. this.Value = Value;
  1907. this.Display = Display;
  1908. }
  1909. }
  1910. internal class DocumentItem
  1911. {
  1912. public Bitmap bitmap;
  1913. public GraphicsList graphicsList;
  1914. public List<PhaseModel> phaseModels;
  1915. //public AnalysisResult analysisResult;
  1916. public DocumentItem(Bitmap bitmap, GraphicsList graphicsList, List<PhaseModel> phaseModels)
  1917. {
  1918. this.bitmap = bitmap;
  1919. this.graphicsList = graphicsList;
  1920. this.phaseModels = phaseModels;
  1921. }
  1922. }
  1923. #endregion
  1924. private void button16_Click(object sender, EventArgs e)
  1925. {
  1926. this.button11.Visible = true;
  1927. this.button16.Visible = false;
  1928. this.button11.Focus();
  1929. this.allShow = false;
  1930. if (this.listView2.SelectedItems.Count <= 0)
  1931. return;
  1932. this.dataGridView2.Rows.Clear();
  1933. for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
  1934. {
  1935. System.Data.DataTable dataTable1 = new System.Data.DataTable();
  1936. foreach (var dataTable in this.dataTables)
  1937. {
  1938. if (this.listView2.SelectedItems.Count > 0)
  1939. {
  1940. if (this.listView2.SelectedItems[i].Tag.Equals(dataTable.TableName))
  1941. dataTable1 = dataTable;
  1942. }
  1943. else
  1944. {
  1945. if (this.listView2.Items[0].Tag.Equals(dataTable.TableName))
  1946. dataTable1 = dataTable;
  1947. }
  1948. }
  1949. DataGridViewRow dgvr = new DataGridViewRow();
  1950. foreach (DataGridViewColumn Column in this.dataGridView2.Columns)
  1951. {
  1952. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  1953. }
  1954. for (int c = 0; c < dataTable1.Columns.Count; c++)
  1955. {
  1956. dgvr.Cells[c].Value = dataTable1.Rows[0][c].ToString();
  1957. }
  1958. this.dataGridView2.Rows.Add(dgvr);
  1959. }
  1960. this.RefreshDataGridView4();
  1961. }
  1962. /// <summary>
  1963. /// 刷新分析结果数据 //#############
  1964. /// </summary>
  1965. protected void RefreshDataGridView4()
  1966. {
  1967. if (!this.allShow)
  1968. {
  1969. if (this.listView2.SelectedItems.Count > 0)
  1970. {
  1971. this.dataGridView2.Rows.Clear();
  1972. for (int j = 0; j < this.listView2.SelectedItems.Count; j++)
  1973. {
  1974. int dataTableIndex = 0;
  1975. for (int i = 0; i < this.dataTables.Count; i++)
  1976. {
  1977. if (this.dataTables[i].TableName.Equals(this.listView2.SelectedItems[j].Tag))
  1978. dataTableIndex = i;
  1979. }
  1980. if (this.dataTables.Count > dataTableIndex && this.dataTables[dataTableIndex].Rows.Count > 0)
  1981. {
  1982. for (int r = 0; r < this.dataTables[dataTableIndex].Rows.Count; r++)
  1983. {
  1984. DataGridViewRow dgvr = new DataGridViewRow();
  1985. foreach (DataGridViewColumn Column in this.dataGridView2.Columns)
  1986. {
  1987. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  1988. }
  1989. for (int c = 0; c < this.dataTables[dataTableIndex].Columns.Count; c++)
  1990. {
  1991. if (c == 2 || c == 3)
  1992. dgvr.Cells[c].Value = Math.Round(double.Parse(string.IsNullOrEmpty(this.dataTables[dataTableIndex].Rows[r][c].ToString()) ? "0" :
  1993. this.dataTables[dataTableIndex].Rows[r][c].ToString()), Convert.ToInt32(this.numericUpDown1_0.Value)) + "";
  1994. else if (c == 4)
  1995. {
  1996. double outValue;
  1997. if (double.TryParse(string.IsNullOrEmpty(this.dataTables[dataTableIndex].Rows[r][c].ToString()) ? "0" :
  1998. this.dataTables[dataTableIndex].Rows[r][c].ToString(), out outValue))
  1999. {
  2000. dgvr.Cells[c].Value = Math.Round(outValue, Convert.ToInt32(this.numericUpDown1_0.Value)) + "";
  2001. }
  2002. else
  2003. dgvr.Cells[c].Value = this.dataTables[dataTableIndex].Rows[r][c].ToString();
  2004. }
  2005. else
  2006. dgvr.Cells[c].Value = this.dataTables[dataTableIndex].Rows[r][c].ToString();
  2007. }
  2008. this.dataGridView2.Rows.Add(dgvr);
  2009. }
  2010. }
  2011. }
  2012. }
  2013. else if (this.listView2.Items.Count > 0)
  2014. {
  2015. this.dataGridView2.Rows.Clear();
  2016. var firstTag = this.listView2.Items[0].Tag;
  2017. int dataTableIndex = 0;
  2018. for (int i = 0; i < this.dataTables.Count; i++)
  2019. {
  2020. if (this.dataTables[i].TableName.Equals(firstTag))
  2021. dataTableIndex = i;
  2022. }
  2023. if (this.dataTables[dataTableIndex].Rows.Count > 0)
  2024. {
  2025. for (int r = 0; r < this.dataTables[dataTableIndex].Rows.Count; r++)
  2026. {
  2027. DataGridViewRow dgvr = new DataGridViewRow();
  2028. foreach (DataGridViewColumn Column in this.dataGridView2.Columns)
  2029. {
  2030. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  2031. }
  2032. for (int c = 0; c < this.dataTables[dataTableIndex].Columns.Count; c++)
  2033. {
  2034. if (c == 2 || c == 3)
  2035. dgvr.Cells[c].Value = Math.Round(double.Parse(string.IsNullOrEmpty(this.dataTables[dataTableIndex].Rows[r][c].ToString()) ? "0" :
  2036. this.dataTables[dataTableIndex].Rows[r][c].ToString()), Convert.ToInt32(this.numericUpDown1_0.Value)) + "";
  2037. else if (c == 4)
  2038. {
  2039. double outValue;
  2040. if (double.TryParse(string.IsNullOrEmpty(this.dataTables[dataTableIndex].Rows[r][c].ToString()) ? "0" :
  2041. this.dataTables[dataTableIndex].Rows[r][c].ToString(), out outValue))
  2042. {
  2043. dgvr.Cells[c].Value = Math.Round(outValue, Convert.ToInt32(this.numericUpDown1_0.Value)) + "";
  2044. }
  2045. else
  2046. dgvr.Cells[c].Value = this.dataTables[dataTableIndex].Rows[r][c].ToString();
  2047. }
  2048. else
  2049. dgvr.Cells[c].Value = this.dataTables[dataTableIndex].Rows[r][c].ToString();
  2050. }
  2051. this.dataGridView2.Rows.Add(dgvr);
  2052. }
  2053. }
  2054. }
  2055. }
  2056. else
  2057. {
  2058. this.dataGridView2.Rows.Clear();
  2059. System.Data.DataTable dataTable = new System.Data.DataTable();
  2060. for (int i = this.dataTables.Count - 1; i >= 0; i--)
  2061. {
  2062. dataTable = this.dataTables[i];
  2063. for (int r = 0; r < dataTable.Rows.Count; r++)
  2064. {
  2065. DataGridViewRow dgvr = new DataGridViewRow();
  2066. foreach (DataGridViewColumn Column in this.dataGridView2.Columns)
  2067. {
  2068. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  2069. }
  2070. for (int c = 0; c < dataTable.Columns.Count; c++)
  2071. {
  2072. if (c == 2 || c == 3)
  2073. dgvr.Cells[c].Value = Math.Round(double.Parse(string.IsNullOrEmpty(dataTable.Rows[r][c].ToString()) ? "0" :
  2074. dataTable.Rows[r][c].ToString()), Convert.ToInt32(this.numericUpDown1_0.Value)) + "";
  2075. else if (c == 4)
  2076. {
  2077. double outValue;
  2078. if (double.TryParse(string.IsNullOrEmpty(dataTable.Rows[r][c].ToString()) ? "0" :
  2079. dataTable.Rows[r][c].ToString(), out outValue))
  2080. {
  2081. dgvr.Cells[c].Value = Math.Round(outValue, Convert.ToInt32(this.numericUpDown1_0.Value)) + "";
  2082. }
  2083. else
  2084. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  2085. }
  2086. else
  2087. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  2088. }
  2089. this.dataGridView2.Rows.Add(dgvr);
  2090. }
  2091. }
  2092. }
  2093. }
  2094. /// <summary>
  2095. /// 切换分析结果
  2096. /// </summary>
  2097. /// <param name="sender"></param>
  2098. /// <param name="e"></param>
  2099. private void listview2_SelectedIndexChanged(object sender, EventArgs e)
  2100. {
  2101. if (!this.allShow)
  2102. {
  2103. if (this.listView2.SelectedItems.Count <= 0)
  2104. return;
  2105. this.dataGridView2.Rows.Clear();
  2106. for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
  2107. {
  2108. System.Data.DataTable dataTable1 = new System.Data.DataTable();
  2109. foreach (var dataTable in this.dataTables)
  2110. {
  2111. if (this.listView2.SelectedItems[i].Tag.Equals(dataTable.TableName))
  2112. dataTable1 = dataTable;
  2113. }
  2114. DataGridViewRow dgvr = new DataGridViewRow();
  2115. foreach (DataGridViewColumn Column in this.dataGridView2.Columns)
  2116. {
  2117. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  2118. }
  2119. for (int c = 0; c < dataTable1.Columns.Count; c++)
  2120. {
  2121. dgvr.Cells[c].Value = dataTable1.Rows[0][c].ToString();
  2122. }
  2123. this.dataGridView2.Rows.Add(dgvr);
  2124. }
  2125. this.RefreshDataGridView4();
  2126. }
  2127. }
  2128. /// <summary>
  2129. /// 全部显示
  2130. /// </summary>
  2131. /// <param name="sender"></param>
  2132. /// <param name="e"></param>
  2133. private void button11_Click(object sender, EventArgs e)
  2134. {
  2135. if (this.listView2.Items.Count > 0)
  2136. {
  2137. this.button11.Visible = false;
  2138. this.button16.Visible = true;
  2139. this.button16.Focus();
  2140. this.allShow = true;
  2141. this.dataGridView2.Rows.Clear();
  2142. for (int i = 0; i < this.dataTables.Count; i++)
  2143. {
  2144. DataGridViewRow dgvr = new DataGridViewRow();
  2145. foreach (DataGridViewColumn Column in this.dataGridView2.Columns)
  2146. {
  2147. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  2148. }
  2149. for (int c = 0; c < this.dataTables[i].Columns.Count; c++)
  2150. {
  2151. dgvr.Cells[c].Value = this.dataTables[i].Rows[0][c].ToString();
  2152. }
  2153. this.dataGridView2.Rows.Add(dgvr);
  2154. }
  2155. this.RefreshDataGridView4();
  2156. }
  2157. else
  2158. {
  2159. MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
  2160. }
  2161. }
  2162. private void button12_Click(object sender, EventArgs e)
  2163. {
  2164. if (this.listView2.Items.Count > 0)
  2165. {
  2166. if (this.listView2.SelectedItems.Count > 0)
  2167. {
  2168. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretcteddata.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  2169. if (dr == DialogResult.OK)
  2170. {
  2171. if (this.listView2.SelectedItems.Count <= 0)
  2172. return;
  2173. for (int i = this.listView2.SelectedItems.Count - 1; i >= 0; i--)
  2174. {
  2175. int selectIndex = this.listView2.SelectedItems[i].Index;
  2176. foreach (var dataTable in this.dataTables)
  2177. {
  2178. if (dataTable.TableName.Equals(this.listView2.SelectedItems[i].Tag))
  2179. {
  2180. this.dataTables.Remove(dataTable);
  2181. break;
  2182. }
  2183. }
  2184. if (bitDic.ContainsKey((string)this.listView2.SelectedItems[i].Tag))
  2185. bitDic.Remove((string)this.listView2.SelectedItems[i].Tag);
  2186. foreach (ExportProjectModel model in this.tempDataModel)
  2187. {
  2188. if (model.tagName.Equals((string)this.listView2.SelectedItems[i].Tag))
  2189. {
  2190. this.tempDataModel.Remove(model);
  2191. break;
  2192. }
  2193. }
  2194. this.listView2.Items.RemoveAt(selectIndex);
  2195. }
  2196. if (this.listView2.Items.Count == 0)
  2197. this.dataGridView2.Rows.Clear();
  2198. else
  2199. RefreshDataGridView4();
  2200. }
  2201. }
  2202. else
  2203. {
  2204. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectthedatatobedeleted.text")+"!");
  2205. }
  2206. }
  2207. else
  2208. {
  2209. MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
  2210. }
  2211. }
  2212. private void numericUpDown1_0_ValueChanged(object sender, EventArgs e)
  2213. {
  2214. this.RefreshDataGridView4();
  2215. }
  2216. /// <summary>
  2217. /// 生成报告
  2218. /// </summary>
  2219. /// <param name="sender"></param>
  2220. /// <param name="e"></param>
  2221. private void button_generateReport_Click(object sender, EventArgs e)
  2222. {
  2223. if (this.listView2.Items.Count == 0)
  2224. {
  2225. MessageBox.Show(PdnResources.GetString("Menu.Noresults.text"));
  2226. return;
  2227. }
  2228. if (this.checkBox_generateReport_opensetting.Checked)
  2229. this.button_setting.PerformClick();
  2230. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  2231. {
  2232. //获取word书签与excel单元格的关系,以字典方式存储
  2233. List<mic_module_infos> mic_module_infos = PaintDotNet.DbOpreate.DbBll.mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  2234. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  2235. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2236. {
  2237. foreach (mic_module_infos info in mic_module_infos)
  2238. {
  2239. tagInfos.Add(info.tag_name, info.cell_position);
  2240. }
  2241. }
  2242. //分析结果
  2243. List<List<string>> analysisContent = new List<List<string>>();
  2244. analysisContent.Add(contentHead);
  2245. foreach (DataGridViewRow item in this.dataGridView2.Rows)
  2246. {
  2247. List<string> content = new List<string>();
  2248. for (int i = 0; i < contentHead.Count; i++)
  2249. {
  2250. content.Add(item.Cells[i].Value.ToString());
  2251. }
  2252. analysisContent.Add(content);
  2253. }
  2254. //图片
  2255. bitList = new List<Bitmap>();
  2256. if (this.allShow)
  2257. {
  2258. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  2259. {
  2260. bitList.Add(kv.Value[0]);
  2261. bitList.Add(kv.Value[1]);
  2262. }
  2263. }
  2264. else
  2265. {
  2266. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  2267. {
  2268. foreach (ListViewItem item in this.listView2.SelectedItems)
  2269. {
  2270. if (bitDic.ContainsKey(item.Name))
  2271. {
  2272. bitList.Add(bitDic[item.Name][0]);
  2273. bitList.Add(bitDic[item.Name][1]);
  2274. }
  2275. else if (bitDic.ContainsKey(item.Tag.ToString()))
  2276. {
  2277. bitList.Add(bitDic[item.Tag.ToString()][0]);
  2278. bitList.Add(bitDic[item.Tag.ToString()][1]);
  2279. }
  2280. }
  2281. }
  2282. else if (this.listView2.Items.Count > 0)
  2283. {
  2284. ListViewItem item = this.listView2.Items[0];
  2285. if (bitDic.ContainsKey(item.Name))
  2286. {
  2287. bitList.Add(bitDic[item.Name][0]);
  2288. bitList.Add(bitDic[item.Name][1]);
  2289. }
  2290. else if (bitDic.ContainsKey(item.Tag.ToString()))
  2291. {
  2292. bitList.Add(bitDic[item.Tag.ToString()][0]);
  2293. bitList.Add(bitDic[item.Tag.ToString()][1]);
  2294. }
  2295. }
  2296. }
  2297. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  2298. }
  2299. else
  2300. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  2301. }
  2302. }
  2303. }