PolyphaseMutiAreaContent.cs 154 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760
  1. using OpenCvSharp;
  2. using OpenCvSharp.Extensions;
  3. using PaintDotNet.Base;
  4. using PaintDotNet.Base.Enum;
  5. using PaintDotNet.Base.Functionodel;
  6. using PaintDotNet.CustomControl;
  7. using PaintDotNet.Data.Param;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.IO;
  14. using System.Windows.Forms;
  15. using PaintDotNet.DbOpreate.DbBll;
  16. using PaintDotNet.DbOpreate.DbModel;
  17. using PaintDotNet.Base.CommTool;
  18. using System.Linq;
  19. using PaintDotNet.Instrument;
  20. using Metis.ParameterSet;
  21. using static Metis.ParameterSet.GeneralAnalysisModel;
  22. using static Metis.ParameterSet.GeneralAnalysisModel.PolyphaseMutiAreaContentModel;
  23. namespace PaintDotNet.GeneralAnalysis
  24. {
  25. /// <summary>
  26. /// 多相含量
  27. /// </summary>
  28. internal class PolyphaseMutiAreaContent : PdnBaseForm
  29. {
  30. #region 控件
  31. private System.Windows.Forms.GroupBox groupBox4;
  32. private System.Windows.Forms.ListView listView1;
  33. private System.Windows.Forms.GroupBox groupBox1;
  34. private System.Windows.Forms.Button button2;
  35. private System.Windows.Forms.CheckBox checkBox1;
  36. private System.Windows.Forms.Button button1;
  37. private System.Windows.Forms.GroupBox groupBox_review;
  38. private System.Windows.Forms.GroupBox groupBox5;
  39. private System.Windows.Forms.GroupBox groupBox6;
  40. private System.Windows.Forms.GroupBox groupBox7;
  41. private System.Windows.Forms.Label label1;
  42. private System.Windows.Forms.Button button4;
  43. private System.Windows.Forms.Button button3;
  44. private System.Windows.Forms.ImageList imageList1;
  45. private DataGridView dataGridView_results;
  46. private Button button_remove;
  47. private Button button_all;
  48. private IContainer components;
  49. private List<CounterResult> finalResults = new List<CounterResult>();
  50. private List<CounterResult> counterResults = new List<CounterResult>();
  51. private Button btn_close;
  52. private GroupBox groupBox2;
  53. private CheckBox cb8;
  54. private CheckBox cb6;
  55. private CheckBox cb4;
  56. private CheckBox cb7;
  57. private CheckBox cb5;
  58. private CheckBox cb3;
  59. private CheckBox cb2;
  60. private CheckBox cb1;
  61. private Label label7;
  62. private Label label6;
  63. private Label label5;
  64. private TextBox txt_phaseName;
  65. private Label label4;
  66. private ComboBox cb_SelectPhase;
  67. private Label label3;
  68. private RadioButton rb8;
  69. private RadioButton rb7;
  70. private RadioButton rb6;
  71. private RadioButton rb5;
  72. private RadioButton rb4;
  73. private RadioButton rb3;
  74. private RadioButton rb2;
  75. private RadioButton rb1;
  76. private Label label2;
  77. private Panel panel1;
  78. private GroupBox groupBox3;
  79. private CheckBox checkBox11;
  80. private CheckBox checkBox10;
  81. private Button But_DeleteSX;
  82. private Button But_DeleteKD;
  83. private Panel panel2;
  84. private NumericUpDown numericUpDown_RangeEnd;
  85. private NumericUpDown numericUpDown_RangeStart;
  86. private NumericUpDown numericUpDown_SXEnd;
  87. private NumericUpDown numericUpDown_SXStart;
  88. private NumericUpDown numericUpDown_KDEnd;
  89. private NumericUpDown numericUpDown_KDStart;
  90. private ColorRangeControl cRControl;
  91. private NumericUpDown numericUpDown1;
  92. private Button button6;
  93. private Button button5;
  94. #endregion
  95. private GeneralAnalysisCommonControlButtons commonControlButtons;
  96. /// <summary>
  97. /// 主空间
  98. /// </summary>
  99. private AppWorkspace appWorkspace;
  100. /// <summary>
  101. /// 图像面板
  102. /// </summary>
  103. private DocumentWorkspaceWindow documentWorkspace;
  104. /// <summary>
  105. /// 选中图片的mat
  106. /// </summary>
  107. private Mat imageMat;
  108. /// <summary>
  109. /// 默认八个颜色的值
  110. /// </summary>
  111. private Color[] DefaultColor = new Color[] { Color.Red, Color.Blue, Color.Yellow, Color.Green, Color.Gray, Color.Black, Color.Gold, Color.DeepSkyBlue };
  112. /// <summary>
  113. /// 原相
  114. /// </summary>
  115. private List<PhaseModel> phaseModels = new List<PhaseModel>();
  116. /// <summary>
  117. /// 加工后的相
  118. /// </summary>
  119. private List<PhaseModel> viewModels = new List<PhaseModel>();
  120. private List<MutiPolyphaseModel> mPhaseModels = new List<MutiPolyphaseModel>();
  121. private List<PhaseModel> orginPhaseModels = new List<PhaseModel>();
  122. private List<RangeColor> rangeColors = new List<RangeColor>();
  123. private ColorsForm colorsFormGrid;
  124. private int imgIndex = -1;
  125. /// <summary>
  126. /// 处理程序
  127. /// </summary>
  128. private ParamObject action = new Data.Action.Action1010();
  129. private ParamObject action914 = new Data.Action.Action914();
  130. private ParamObject action911 = new Data.Action.Action911();
  131. private List<PolyphaseAnalysisResult> mainPolyphaseAnalysisResults = new List<PolyphaseAnalysisResult>();
  132. private List<PolyphaseAnalysisResult> viewPolyphaseAnalysisResults = new List<PolyphaseAnalysisResult>();
  133. private int decnum = 2;
  134. private int is_all = 0;
  135. private int xiang_num = 0;
  136. private GeneralAnalysisModel generalAnalysisModel = new GeneralAnalysisModel();
  137. private bool userAll = false;
  138. private string selectedImg = string.Empty;
  139. private bool isExportResults = false;
  140. private bool isExportReports = false;
  141. private bool isExportProjects = false;
  142. private int menuId;
  143. private string menuName;
  144. /// <summary>
  145. /// 是否脚本运行
  146. /// </summary>
  147. private Boolean initScriptValues = false;
  148. /// <summary>
  149. /// 初始系统参数配置值
  150. /// </summary>
  151. private int selectIndex;
  152. private List<Bitmap> bitList = new List<Bitmap>();
  153. private Button button9;
  154. private CheckedListBox listBox_analysisResult;
  155. private DataGridViewTextBoxColumn Column5;
  156. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
  157. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
  158. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
  159. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
  160. private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
  161. private Dictionary<string, PolyphaseMutiAreaContentModel> everyImgData = new Dictionary<string, PolyphaseMutiAreaContentModel>();
  162. public PolyphaseMutiAreaContent(AppWorkspace appWorkspace,PdnMenuItem menuItem)
  163. {
  164. InitializeComponent();
  165. InitializeLanguageText();
  166. this.appWorkspace = appWorkspace;
  167. this.colorsFormGrid = new ColorsForm();
  168. this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
  169. this.documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
  170. this.documentWorkspace.Dock = DockStyle.Fill;
  171. this.documentWorkspace.HookMouseEvents();
  172. this.documentWorkspace.AuxiliaryLineEnabled = false;
  173. this.documentWorkspace.Visible = false;
  174. this.groupBox_review.Controls.Add(documentWorkspace);
  175. this.commonControlButtons = new GeneralAnalysisCommonControlButtons();
  176. this.commonControlButtons.Dock = DockStyle.Top;
  177. this.commonControlButtons.Height = 30;
  178. this.commonControlButtons.WithTrackBar();
  179. this.commonControlButtons.trackBar.Minimum = 0;
  180. this.commonControlButtons.trackBar.Maximum = 255;
  181. this.commonControlButtons.trackBar.Value = 255;
  182. this.commonControlButtons.trackLabel.Text = PdnResources.GetString("Menu.transparency.text")+":";
  183. this.groupBox_review.Controls.Add(commonControlButtons);
  184. cRControl = new ColorRangeControl();
  185. cRControl.Height = this.panel1.Height;
  186. this.panel1.Controls.Add(cRControl);
  187. cRControl.Click += CRControl_Click;
  188. cRControl.ColorRangeChangeEvent += new EventHandler(this.ColorRangeChangeEvent);
  189. this.groupBox2.Enabled = false;
  190. this.menuId = menuItem.MenuId;
  191. this.menuName = menuItem.Text;
  192. Init_CheckBoxes();
  193. InitPicList();
  194. SetAnalyzeModelFromXml("Template.Manager.item2.PolyphaseMutiAreaContent");
  195. SetStyle(ControlStyles.UserPaint, true);
  196. SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
  197. SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
  198. InitCommonButtonEvent();
  199. this.Shown += showImg;
  200. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.saveLastData);
  201. }
  202. /// <summary>
  203. /// 获取上次操作参数
  204. /// </summary>
  205. private void getLastData() {
  206. string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
  207. if (!System.IO.File.Exists(filePath))
  208. {
  209. generalAnalysisModel = new GeneralAnalysisModel();
  210. generalAnalysisModel.PolyphaseMutiAreaContentModels = new PolyphaseMutiAreaContentModel();
  211. generalAnalysisModel.PolyphaseCounterAnalysisModels = new PolyphaseCounterAnalysisModel();
  212. generalAnalysisModel.TwoPhaseScaleModels = new TwoPhaseScaleModel();
  213. generalAnalysisModel.PolyphaseContentModels = new PolyphaseContentModel();
  214. generalAnalysisModel.PolyphaseDistanceModels = new PolyphaseDistanceModel();
  215. generalAnalysisModel.DebrisSelectionModels = new GeneralAnalysisModel.DebrisSelectionModel();
  216. generalAnalysisModel.CountNumberAnalysisModels = new CountNumberAnalysisModel();
  217. generalAnalysisModel.PolyphaseMutiAreaContentModels.hasUsed = false;
  218. generalAnalysisModel.PolyphaseCounterAnalysisModels.hasUsed = false;
  219. generalAnalysisModel.TwoPhaseScaleModels.hasUsed = false;
  220. generalAnalysisModel.PolyphaseContentModels.hasUsed = false;
  221. generalAnalysisModel.PolyphaseDistanceModels.hasUsed = false;
  222. generalAnalysisModel.DebrisSelectionModels.hasUsed = false;
  223. generalAnalysisModel.CountNumberAnalysisModels.hasUsed = false;
  224. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
  225. Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
  226. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
  227. }
  228. else
  229. {
  230. generalAnalysisModel = XmlSerializeHelper.DESerializer<GeneralAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  231. if (generalAnalysisModel.PolyphaseMutiAreaContentModels == null) {
  232. generalAnalysisModel.PolyphaseMutiAreaContentModels = new PolyphaseMutiAreaContentModel();
  233. }
  234. if (generalAnalysisModel.PolyphaseMutiAreaContentModels.hasUsed) {
  235. #region [多相数量]
  236. switch (generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter1)
  237. {
  238. case 0:
  239. rb1.Checked = true;
  240. break;
  241. case 1:
  242. rb1.Checked = true;
  243. break;
  244. case 2:
  245. rb1.Checked = true;
  246. rb2.Checked = true;
  247. break;
  248. case 3:
  249. rb1.Checked = true;
  250. rb2.Checked = true;
  251. rb3.Checked = true;
  252. break;
  253. case 4:
  254. rb1.Checked = true;
  255. rb2.Checked = true;
  256. rb3.Checked = true;
  257. rb4.Checked = true;
  258. break;
  259. case 5:
  260. rb1.Checked = true;
  261. rb2.Checked = true;
  262. rb3.Checked = true;
  263. rb4.Checked = true;
  264. rb5.Checked = true;
  265. break;
  266. case 6:
  267. rb1.Checked = true;
  268. rb2.Checked = true;
  269. rb3.Checked = true;
  270. rb4.Checked = true;
  271. rb5.Checked = true;
  272. rb6.Checked = true;
  273. break;
  274. case 7:
  275. rb1.Checked = true;
  276. rb2.Checked = true;
  277. rb3.Checked = true;
  278. rb4.Checked = true;
  279. rb5.Checked = true;
  280. rb6.Checked = true;
  281. rb7.Checked = true;
  282. break;
  283. case 8:
  284. rb1.Checked = true;
  285. rb2.Checked = true;
  286. rb3.Checked = true;
  287. rb4.Checked = true;
  288. rb5.Checked = true;
  289. rb6.Checked = true;
  290. rb7.Checked = true;
  291. rb8.Checked = true;
  292. break;
  293. }
  294. #endregion
  295. #region [显示物相]
  296. string[] allNum = generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter4.Split(',');
  297. if (allNum.Contains("1"))
  298. {
  299. cb1.Checked = true;
  300. }
  301. else
  302. {
  303. cb1.Checked = false;
  304. }
  305. if (allNum.Contains("2"))
  306. {
  307. cb2.Checked = true;
  308. }
  309. else
  310. {
  311. cb2.Checked = false;
  312. }
  313. if (allNum.Contains("3"))
  314. {
  315. cb3.Checked = true;
  316. }
  317. else
  318. {
  319. cb3.Checked = false;
  320. }
  321. if (allNum.Contains("4"))
  322. {
  323. cb4.Checked = true;
  324. }
  325. else
  326. {
  327. cb4.Checked = false;
  328. }
  329. if (allNum.Contains("5"))
  330. {
  331. cb5.Checked = true;
  332. }
  333. else
  334. {
  335. cb5.Checked = false;
  336. }
  337. if (allNum.Contains("6"))
  338. {
  339. cb6.Checked = true;
  340. }
  341. else
  342. {
  343. cb6.Checked = false;
  344. }
  345. if (allNum.Contains("7"))
  346. {
  347. cb7.Checked = true;
  348. }
  349. else
  350. {
  351. cb7.Checked = false;
  352. }
  353. if (allNum.Contains("8"))
  354. {
  355. cb8.Checked = true;
  356. }
  357. else
  358. {
  359. cb8.Checked = false;
  360. }
  361. #endregion
  362. #region [相信息]
  363. for (int i = 0; i < generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter3.Count; i++)
  364. {
  365. PolyphaseData data = generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter3[i];
  366. viewModels[i].color = data.color;
  367. mPhaseModels[i].Model.color = data.color;
  368. mPhaseModels[i].ColorStart = data.downNum;
  369. mPhaseModels[i].ColorEnd = data.upNum;
  370. cRControl.SetColor(i, Color.FromArgb(data.color));
  371. PhaseModel model = this.applyButtonImpl(Color.FromArgb(data.color), data.downNum, data.upNum);
  372. this.documentWorkspace.phaseModels[i] = model;
  373. this.phaseModels[i] = model;
  374. }
  375. this.documentWorkspace.Refresh();
  376. #endregion
  377. checkBox1.Checked = generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter12;
  378. cb_SelectPhase.SelectedItem = generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter2;
  379. if (cb_SelectPhase.SelectedIndex == -1) {
  380. numericUpDown_RangeStart.Value = mPhaseModels[0].ColorStart;
  381. numericUpDown_RangeEnd.Value = mPhaseModels[0].ColorEnd;
  382. }
  383. else
  384. {
  385. numericUpDown_RangeStart.Value = mPhaseModels[cb_SelectPhase.SelectedIndex].ColorStart;
  386. numericUpDown_RangeEnd.Value = mPhaseModels[cb_SelectPhase.SelectedIndex].ColorEnd;
  387. }
  388. commonControlButtons.trackBar.Value = generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter13;
  389. if (generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter5) {
  390. checkBox10.Checked = true;
  391. numericUpDown_KDStart.Value = generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter7;
  392. numericUpDown_KDEnd.Value = generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter8;
  393. }
  394. if (generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter6)
  395. {
  396. checkBox11.Checked = true;
  397. numericUpDown_SXStart.Value = generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter9;
  398. numericUpDown_SXEnd.Value = generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter10;
  399. }
  400. numericUpDown1.Value = generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter11;
  401. for (int i = 0; i < listView1.Items.Count; i++) {
  402. if (everyImgData.ContainsKey(listView1.Items[i].Name))
  403. {
  404. everyImgData[listView1.Items[i].Name] = generalAnalysisModel.PolyphaseMutiAreaContentModels;
  405. }
  406. else {
  407. everyImgData.Add(listView1.Items[i].Name, generalAnalysisModel.PolyphaseMutiAreaContentModels);
  408. }
  409. }
  410. }
  411. }
  412. }
  413. /// <summary>
  414. /// 保存上次操作参数
  415. /// </summary>
  416. private void saveLastData(object sender, EventArgs e)
  417. {
  418. #region [开启脚本录制]
  419. if (appWorkspace.startScriptRecording)
  420. {
  421. getScriptRecording();
  422. }
  423. #endregion
  424. if (generalAnalysisModel.PolyphaseMutiAreaContentModels == null)
  425. {
  426. generalAnalysisModel.PolyphaseMutiAreaContentModels = new PolyphaseMutiAreaContentModel();
  427. }
  428. generalAnalysisModel.PolyphaseMutiAreaContentModels.hasUsed = true;
  429. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter1 = xiang_num;
  430. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter12 = checkBox1.Checked;
  431. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter13 = commonControlButtons.trackBar.Value;
  432. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter2 = cb_SelectPhase.SelectedItem == null ? "" : cb_SelectPhase.SelectedItem.ToString();
  433. if (generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter3 == null)
  434. {
  435. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter3 = new List<PolyphaseData>();
  436. }
  437. var list = new List<PolyphaseData>();
  438. foreach (var s in mPhaseModels)
  439. {
  440. PolyphaseData data = new PolyphaseData();
  441. data.color = s.Model.color;
  442. data.downNum = s.ColorStart;
  443. data.upNum = s.ColorEnd;
  444. list.Add(data);
  445. }
  446. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter3 = list;
  447. #region [保存物相选择]
  448. string all = String.Empty;
  449. if (cb1.Checked)
  450. {
  451. all += "1,";
  452. }
  453. if (cb2.Checked)
  454. {
  455. all += "2,";
  456. }
  457. if (cb3.Checked)
  458. {
  459. all += "3,";
  460. }
  461. if (cb4.Checked)
  462. {
  463. all += "4,";
  464. }
  465. if (cb5.Checked)
  466. {
  467. all += "5,";
  468. }
  469. if (cb6.Checked)
  470. {
  471. all += "6,";
  472. }
  473. if (cb7.Checked)
  474. {
  475. all += "7,";
  476. }
  477. if (cb8.Checked)
  478. {
  479. all += "8,";
  480. }
  481. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter4 = all;
  482. #endregion
  483. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter5 = checkBox10.Checked;
  484. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter6 = checkBox11.Checked;
  485. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter7 = (int)numericUpDown_KDStart.Value;
  486. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter8 = (int)numericUpDown_KDEnd.Value;
  487. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter9 = (int)numericUpDown_SXStart.Value;
  488. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter10 = (int)numericUpDown_SXEnd.Value;
  489. generalAnalysisModel.PolyphaseMutiAreaContentModels.parameter11 = (int)numericUpDown1.Value;
  490. string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
  491. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);
  492. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create);
  493. }
  494. private void showImg(object sender, EventArgs e)
  495. {
  496. listView1.Focus();
  497. if (this.imgIndex != -1)
  498. {
  499. //滚动到指定的行位置
  500. this.listView1.EnsureVisible(this.imgIndex);
  501. this.listView1.Items[imgIndex].Focused = true;
  502. this.listView1.Items[imgIndex].Selected = true;
  503. //如果是脚本执行,将参数带入
  504. if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
  505. {
  506. this.initScriptValues = true;//ScriptAutomatic
  507. //Boolean initScriptValues = true;
  508. ////在这里反射出对应功能的参数类
  509. string className = InvariantData.path_Action + ".Action" + menuId;
  510. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  511. foreach (Args arg in param.Lists)
  512. {
  513. Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
  514. if (param1.value != null)
  515. arg.Value = param1.value;
  516. getValue(arg.key, arg.Value);
  517. }
  518. appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
  519. }
  520. else
  521. {//读取上次关闭窗口时保存的参数
  522. getLastData();
  523. }
  524. }
  525. if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
  526. this.startScriptAutomaticAction();
  527. }
  528. /// <summary>
  529. /// 执行脚本自动化的步骤
  530. /// </summary>
  531. private void startScriptAutomaticAction()
  532. {
  533. //this.button8.PerformClick();
  534. //this.button7.PerformClick();
  535. button8_Click();
  536. button7_Click();
  537. if (isExportResults)//导出结果
  538. this.button4.PerformClick();
  539. if (isExportReports)//生成报告
  540. this.button3.PerformClick();
  541. if (isExportProjects)//导出项目
  542. this.button9.PerformClick();
  543. this.appWorkspace.ScriptAutomatic = false;
  544. this.Close();
  545. }
  546. private void ColorRangeChangeEvent(object sender, EventArgs e)
  547. {
  548. this.numericUpDown_RangeStart.ValueChanged -= this.numericUpDown_RangeStart_ValueChanged;
  549. this.numericUpDown_RangeEnd.ValueChanged -= this.numericUpDown_RangeEnd_ValueChanged;
  550. //this.selectIndex = cRControl.SelectIndex;
  551. this.numericUpDown_RangeStart.Value = rangeColors[selectIndex].Start;
  552. this.numericUpDown_RangeEnd.Value = rangeColors[selectIndex].End;
  553. mPhaseModels[cRControl.SelectIndex].ColorStart = rangeColors[selectIndex].Start;
  554. mPhaseModels[cRControl.SelectIndex].ColorEnd = rangeColors[selectIndex].End;
  555. this.cb_SelectPhase.SelectedIndex = cRControl.SelectIndex;
  556. try
  557. {
  558. mPhaseModels[cRControl.SelectIndex + 1].ColorStart = rangeColors[selectIndex + 1].Start;
  559. }
  560. catch (Exception)
  561. {
  562. }
  563. for (int i = 0; i < this.documentWorkspace.phaseModels.Count; i++)
  564. {
  565. this.documentWorkspace.phaseModels[i] = applyButtonImpl(rangeColors[i].Color, rangeColors[i].Start, rangeColors[i].End);
  566. Bitmap bmp = MakeTransparent(this.documentWorkspace.phaseModels[i].mat.ToBitmap(), this.commonControlButtons.trackBar.Value);
  567. this.documentWorkspace.phaseModels[i].mat = bmp.ToMat();
  568. }
  569. this.documentWorkspace.Refresh();
  570. this.numericUpDown_RangeStart.ValueChanged += this.numericUpDown_RangeStart_ValueChanged;
  571. this.numericUpDown_RangeEnd.ValueChanged += this.numericUpDown_RangeEnd_ValueChanged;
  572. }
  573. private void InitCommonButtonEvent()
  574. {
  575. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  576. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  577. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  578. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  579. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  580. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  581. this.commonControlButtons.trackBar.ValueChanged += new EventHandler(TrackBar_ValueChanged);
  582. }
  583. public Bitmap MakeTransparent(Bitmap src, int num)
  584. {
  585. try
  586. {
  587. int w = src.Width;
  588. int h = src.Height;
  589. Bitmap dstBitmap = new Bitmap(src.Width, src.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
  590. System.Drawing.Imaging.BitmapData srcData = src.LockBits(new Rectangle(0, 0, w, h), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
  591. System.Drawing.Imaging.BitmapData dstData = dstBitmap.LockBits(new Rectangle(0, 0, w, h), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
  592. unsafe
  593. {
  594. byte* pIn = (byte*)srcData.Scan0.ToPointer();
  595. byte* pOut = (byte*)dstData.Scan0.ToPointer();
  596. byte* p;
  597. int stride = srcData.Stride;
  598. int r, g, b, a;
  599. for (int y = 0; y < h; y++)
  600. {
  601. for (int x = 0; x < w; x++)
  602. {
  603. p = pIn;
  604. b = pIn[0];
  605. g = pIn[1];
  606. r = pIn[2];
  607. a = pIn[3];
  608. pOut[0] = (byte)b;
  609. pOut[1] = (byte)g;
  610. pOut[2] = (byte)r;
  611. if (a != 0)
  612. {
  613. pOut[3] = (byte)num;
  614. }else
  615. {
  616. pOut[3] = (byte)a;
  617. }
  618. pIn += 4;
  619. pOut += 4;
  620. }
  621. pIn += srcData.Stride - w * 4;
  622. pOut += srcData.Stride - w * 4;
  623. }
  624. src.UnlockBits(srcData);
  625. dstBitmap.UnlockBits(dstData);
  626. return dstBitmap;
  627. }
  628. }
  629. catch (Exception)
  630. {
  631. return null;
  632. }
  633. }
  634. private void TrackBar_ValueChanged(object sender, EventArgs e)
  635. {
  636. List<int> allCheck = new List<int>();
  637. if (cb1.Checked)
  638. {
  639. allCheck.Add(0);
  640. }
  641. if (cb2.Checked)
  642. {
  643. allCheck.Add(1);
  644. }
  645. if (cb3.Checked)
  646. {
  647. allCheck.Add(2);
  648. }
  649. if (cb4.Checked)
  650. {
  651. allCheck.Add(3);
  652. }
  653. if (cb5.Checked)
  654. {
  655. allCheck.Add(4);
  656. }
  657. if (cb6.Checked)
  658. {
  659. allCheck.Add(5);
  660. }
  661. if (cb7.Checked)
  662. {
  663. allCheck.Add(6);
  664. }
  665. if (cb8.Checked)
  666. {
  667. allCheck.Add(7);
  668. }
  669. for (int i = 0; i < this.documentWorkspace.phaseModels.Count; i++)
  670. {
  671. if (!allCheck.Contains(i))
  672. {
  673. continue;
  674. }
  675. this.documentWorkspace.phaseModels[i] = applyButtonImpl(rangeColors[i].Color, rangeColors[i].Start, rangeColors[i].End);
  676. Bitmap bmp = MakeTransparent(this.documentWorkspace.phaseModels[i].mat.ToBitmap(),this.commonControlButtons.trackBar.Value);
  677. this.documentWorkspace.phaseModels[i].mat = bmp.ToMat();
  678. }
  679. this.documentWorkspace.Refresh();
  680. }
  681. private void zoomInButton_Click(object sender, EventArgs e)
  682. {
  683. if (this.imageMat!= null)
  684. this.documentWorkspace.ZoomIn();
  685. }
  686. private void zoomOutButton_Click(object sender, EventArgs e)
  687. {
  688. if (this.imageMat != null)
  689. this.documentWorkspace.ZoomOut();
  690. }
  691. private void zoomToWindowButton_Click(object sender, EventArgs e)
  692. {
  693. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  694. }
  695. private void actualSizeButton_Click(object sender, EventArgs e)
  696. {
  697. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  698. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  699. }
  700. private void pointerButton_Click(object sender, EventArgs e)
  701. {
  702. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
  703. }
  704. private void mobileModeButton_Click(object sender, EventArgs e)
  705. {
  706. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  707. }
  708. private void CRControl_Click(object sender, EventArgs e)
  709. {
  710. showParams(mPhaseModels[cRControl.SelectIndex]);
  711. }
  712. public void InitPicList()
  713. {
  714. //初始化图片列表
  715. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  716. {
  717. this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  718. this.listView1.Items.Add("", i);
  719. this.listView1.Items[i].ImageIndex = i;
  720. String imageName = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  721. if (listView1.Items.Find(imageName, false).Count() > 0)
  722. {
  723. if (imageName.Split('.').Count() > 1)
  724. {
  725. imageName = imageName.Split('.')[0] + "(" + listView1.Items.Find(imageName, false).Count() + ")." + imageName.Split('.')[1];
  726. }
  727. }
  728. this.listView1.Items[i].Text = imageName;
  729. this.listView1.Items[i].Name = imageName;
  730. if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
  731. {
  732. this.imgIndex = i;
  733. }
  734. }
  735. }
  736. #region init
  737. private void InitializeLanguageText()
  738. {
  739. this.But_DeleteKD.Text = PdnResources.GetString("Menu.application.text");
  740. this.checkBox11.Text = PdnResources.GetString("Menu.Clasticdelete.text") + "(μm²)";
  741. this.checkBox10.Text = PdnResources.GetString("Menu.BinaryAction.HoleRemoval.Text") + "(μm²)";
  742. this.Text = PdnResources.GetString("Menu.GeneralAnalysis.MultiphaseContent.Text");
  743. this.label6.Text = PdnResources.GetString("Menu.Generalanalysis.Multiphasecontent.Phaseinterval.text");
  744. this.label5.Text = PdnResources.GetString("Menu.Generalanalysis.Multiphasecontent.Phasecolor.text");
  745. this.label4.Text = PdnResources.GetString("Menu.Generalanalysis.Multiphasecontent.Phasename.text");
  746. this.label3.Text = PdnResources.GetString("Menu.Generalanalysis.Multiphasecontent.Phaseselection.text");
  747. this.label2.Text = PdnResources.GetString("Menu.Numberofmultiphase.Text");
  748. this.groupBox3.Text = PdnResources.GetString("Menu.BinaryAction.Text");
  749. this.But_DeleteSX.Text = PdnResources.GetString("Menu.application.text");
  750. this.button5.Text = PdnResources.GetString("Menu.LabelAction.SelectAllLabel.Text");
  751. this.cb8.Text = PdnResources.GetString("Menu.phase.text") + "8";
  752. this.cb6.Text = PdnResources.GetString("Menu.phase.text") + "6";
  753. this.cb4.Text = PdnResources.GetString("Menu.phase.text") + "4";
  754. this.cb7.Text = PdnResources.GetString("Menu.phase.text") + "7";
  755. this.cb5.Text = PdnResources.GetString("Menu.phase.text") + "5";
  756. this.cb3.Text = PdnResources.GetString("Menu.phase.text") + "3";
  757. this.cb2.Text = PdnResources.GetString("Menu.phase.text") + "2";
  758. this.cb1.Text = PdnResources.GetString("Menu.phase.text") + "1";
  759. this.label7.Text = PdnResources.GetString("Menu.Generalanalysis.Multiphasecontent.displayphase.text");
  760. this.dataGridViewTextBoxColumn3.HeaderText = PdnResources.GetString("Menu.proportion.text");
  761. this.dataGridViewTextBoxColumn4.HeaderText = PdnResources.GetString("Menu.Phasecontent.text");
  762. this.button9.Text = PdnResources.GetString("Menu.Tools.OpenProject.Text");
  763. this.label1.Text = PdnResources.GetString("Menu.Decimal.text");
  764. this.button4.Text = PdnResources.GetString("Menu.Exportresults.text");
  765. this.button3.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  766. this.groupBox2.Text = PdnResources.GetString("Menu.Generalanalysis.Multiphasecontent.Phasesetting.text");
  767. this.button6.Text = PdnResources.GetString("Menu.Theoriginalcolor.text");
  768. this.groupBox4.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  769. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  770. this.btn_close.Text = PdnResources.GetString("Menu.File.Close.Text");
  771. this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
  772. this.checkBox1.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  773. this.button1.Text = PdnResources.GetString("Menu.Setting.Text");
  774. this.groupBox_review.Text = PdnResources.GetString("Menu.Preview.text");
  775. this.groupBox5.Text = PdnResources.GetString("Menu.Analysisresult.text");
  776. this.button_remove.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  777. this.button_all.Text = PdnResources.GetString("Menu.Showall.text");
  778. this.Column5.HeaderText = PdnResources.GetString("Menu.picture.Text");
  779. this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.Phasename.text");
  780. this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.Phasearea.text");
  781. }
  782. private void InitializeComponent()
  783. {
  784. this.components = new System.ComponentModel.Container();
  785. this.groupBox4 = new System.Windows.Forms.GroupBox();
  786. this.listView1 = new System.Windows.Forms.ListView();
  787. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  788. this.groupBox1 = new System.Windows.Forms.GroupBox();
  789. this.btn_close = new System.Windows.Forms.Button();
  790. this.button2 = new System.Windows.Forms.Button();
  791. this.checkBox1 = new System.Windows.Forms.CheckBox();
  792. this.button1 = new System.Windows.Forms.Button();
  793. this.groupBox_review = new System.Windows.Forms.GroupBox();
  794. this.groupBox5 = new System.Windows.Forms.GroupBox();
  795. this.listBox_analysisResult = new System.Windows.Forms.CheckedListBox();
  796. this.button_remove = new System.Windows.Forms.Button();
  797. this.button_all = new System.Windows.Forms.Button();
  798. this.groupBox6 = new System.Windows.Forms.GroupBox();
  799. this.dataGridView_results = new System.Windows.Forms.DataGridView();
  800. this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  801. this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  802. this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  803. this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  804. this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  805. this.groupBox7 = new System.Windows.Forms.GroupBox();
  806. this.button9 = new System.Windows.Forms.Button();
  807. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  808. this.label1 = new System.Windows.Forms.Label();
  809. this.button4 = new System.Windows.Forms.Button();
  810. this.button3 = new System.Windows.Forms.Button();
  811. this.groupBox2 = new System.Windows.Forms.GroupBox();
  812. this.button6 = new System.Windows.Forms.Button();
  813. this.button5 = new System.Windows.Forms.Button();
  814. this.numericUpDown_RangeEnd = new System.Windows.Forms.NumericUpDown();
  815. this.numericUpDown_RangeStart = new System.Windows.Forms.NumericUpDown();
  816. this.panel2 = new System.Windows.Forms.Panel();
  817. this.cb8 = new System.Windows.Forms.CheckBox();
  818. this.cb6 = new System.Windows.Forms.CheckBox();
  819. this.cb4 = new System.Windows.Forms.CheckBox();
  820. this.cb7 = new System.Windows.Forms.CheckBox();
  821. this.cb5 = new System.Windows.Forms.CheckBox();
  822. this.cb3 = new System.Windows.Forms.CheckBox();
  823. this.cb2 = new System.Windows.Forms.CheckBox();
  824. this.cb1 = new System.Windows.Forms.CheckBox();
  825. this.label7 = new System.Windows.Forms.Label();
  826. this.label6 = new System.Windows.Forms.Label();
  827. this.label5 = new System.Windows.Forms.Label();
  828. this.txt_phaseName = new System.Windows.Forms.TextBox();
  829. this.label4 = new System.Windows.Forms.Label();
  830. this.cb_SelectPhase = new System.Windows.Forms.ComboBox();
  831. this.label3 = new System.Windows.Forms.Label();
  832. this.rb8 = new System.Windows.Forms.RadioButton();
  833. this.rb7 = new System.Windows.Forms.RadioButton();
  834. this.rb6 = new System.Windows.Forms.RadioButton();
  835. this.rb5 = new System.Windows.Forms.RadioButton();
  836. this.rb4 = new System.Windows.Forms.RadioButton();
  837. this.rb3 = new System.Windows.Forms.RadioButton();
  838. this.rb2 = new System.Windows.Forms.RadioButton();
  839. this.rb1 = new System.Windows.Forms.RadioButton();
  840. this.label2 = new System.Windows.Forms.Label();
  841. this.panel1 = new System.Windows.Forms.Panel();
  842. this.groupBox3 = new System.Windows.Forms.GroupBox();
  843. this.numericUpDown_SXEnd = new System.Windows.Forms.NumericUpDown();
  844. this.numericUpDown_SXStart = new System.Windows.Forms.NumericUpDown();
  845. this.numericUpDown_KDEnd = new System.Windows.Forms.NumericUpDown();
  846. this.numericUpDown_KDStart = new System.Windows.Forms.NumericUpDown();
  847. this.But_DeleteSX = new System.Windows.Forms.Button();
  848. this.But_DeleteKD = new System.Windows.Forms.Button();
  849. this.checkBox11 = new System.Windows.Forms.CheckBox();
  850. this.checkBox10 = new System.Windows.Forms.CheckBox();
  851. this.groupBox4.SuspendLayout();
  852. this.groupBox1.SuspendLayout();
  853. this.groupBox5.SuspendLayout();
  854. this.groupBox6.SuspendLayout();
  855. ((System.ComponentModel.ISupportInitialize)(this.dataGridView_results)).BeginInit();
  856. this.groupBox7.SuspendLayout();
  857. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  858. this.groupBox2.SuspendLayout();
  859. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_RangeEnd)).BeginInit();
  860. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_RangeStart)).BeginInit();
  861. this.groupBox3.SuspendLayout();
  862. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_SXEnd)).BeginInit();
  863. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_SXStart)).BeginInit();
  864. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_KDEnd)).BeginInit();
  865. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_KDStart)).BeginInit();
  866. this.SuspendLayout();
  867. //
  868. // groupBox4
  869. //
  870. this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  871. | System.Windows.Forms.AnchorStyles.Left)));
  872. this.groupBox4.Controls.Add(this.listView1);
  873. this.groupBox4.Location = new System.Drawing.Point(13, 72);
  874. this.groupBox4.Margin = new System.Windows.Forms.Padding(4);
  875. this.groupBox4.Name = "groupBox4";
  876. this.groupBox4.Padding = new System.Windows.Forms.Padding(4);
  877. this.groupBox4.Size = new System.Drawing.Size(158, 483);
  878. this.groupBox4.TabIndex = 9;
  879. this.groupBox4.TabStop = false;
  880. this.groupBox4.Text = "图像索引";
  881. //
  882. // listView1
  883. //
  884. this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  885. | System.Windows.Forms.AnchorStyles.Left)
  886. | System.Windows.Forms.AnchorStyles.Right)));
  887. this.listView1.HideSelection = false;
  888. this.listView1.LargeImageList = this.imageList1;
  889. this.listView1.Location = new System.Drawing.Point(8, 26);
  890. this.listView1.Margin = new System.Windows.Forms.Padding(4);
  891. this.listView1.MultiSelect = false;
  892. this.listView1.Name = "listView1";
  893. this.listView1.Size = new System.Drawing.Size(140, 449);
  894. this.listView1.TabIndex = 0;
  895. this.listView1.UseCompatibleStateImageBehavior = false;
  896. this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
  897. //
  898. // imageList1
  899. //
  900. this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  901. this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
  902. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  903. //
  904. // groupBox1
  905. //
  906. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  907. | System.Windows.Forms.AnchorStyles.Right)));
  908. this.groupBox1.Controls.Add(this.btn_close);
  909. this.groupBox1.Controls.Add(this.button2);
  910. this.groupBox1.Controls.Add(this.checkBox1);
  911. this.groupBox1.Controls.Add(this.button1);
  912. this.groupBox1.Location = new System.Drawing.Point(20, 12);
  913. this.groupBox1.Name = "groupBox1";
  914. this.groupBox1.Size = new System.Drawing.Size(1145, 53);
  915. this.groupBox1.TabIndex = 10;
  916. this.groupBox1.TabStop = false;
  917. this.groupBox1.Text = "操作";
  918. //
  919. // btn_close
  920. //
  921. this.btn_close.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  922. this.btn_close.Location = new System.Drawing.Point(972, 21);
  923. this.btn_close.Name = "btn_close";
  924. this.btn_close.Size = new System.Drawing.Size(75, 23);
  925. this.btn_close.TabIndex = 3;
  926. this.btn_close.Text = "关闭";
  927. this.btn_close.UseVisualStyleBackColor = true;
  928. this.btn_close.Click += new System.EventHandler(this.btn_close_Click);
  929. //
  930. // button2
  931. //
  932. this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  933. this.button2.Location = new System.Drawing.Point(1053, 21);
  934. this.button2.Name = "button2";
  935. this.button2.Size = new System.Drawing.Size(75, 23);
  936. this.button2.TabIndex = 2;
  937. this.button2.Text = "保存结果";
  938. this.button2.UseVisualStyleBackColor = true;
  939. this.button2.Click += new System.EventHandler(this.button2_Click);
  940. //
  941. // checkBox1
  942. //
  943. this.checkBox1.AutoSize = true;
  944. this.checkBox1.Location = new System.Drawing.Point(98, 24);
  945. this.checkBox1.Name = "checkBox1";
  946. this.checkBox1.Size = new System.Drawing.Size(132, 16);
  947. this.checkBox1.TabIndex = 1;
  948. this.checkBox1.Text = "生成报告时打开设置";
  949. this.checkBox1.UseVisualStyleBackColor = true;
  950. //
  951. // button1
  952. //
  953. this.button1.Location = new System.Drawing.Point(6, 24);
  954. this.button1.Name = "button1";
  955. this.button1.Size = new System.Drawing.Size(75, 23);
  956. this.button1.TabIndex = 0;
  957. this.button1.Text = "设置";
  958. this.button1.UseVisualStyleBackColor = true;
  959. this.button1.Click += new System.EventHandler(this.button1_Click);
  960. //
  961. // groupBox_review
  962. //
  963. this.groupBox_review.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  964. | System.Windows.Forms.AnchorStyles.Left)
  965. | System.Windows.Forms.AnchorStyles.Right)));
  966. this.groupBox_review.Location = new System.Drawing.Point(590, 72);
  967. this.groupBox_review.Name = "groupBox_review";
  968. this.groupBox_review.Size = new System.Drawing.Size(575, 483);
  969. this.groupBox_review.TabIndex = 12;
  970. this.groupBox_review.TabStop = false;
  971. this.groupBox_review.Text = "预览";
  972. //
  973. // groupBox5
  974. //
  975. this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  976. this.groupBox5.Controls.Add(this.listBox_analysisResult);
  977. this.groupBox5.Controls.Add(this.button_remove);
  978. this.groupBox5.Controls.Add(this.button_all);
  979. this.groupBox5.Location = new System.Drawing.Point(12, 562);
  980. this.groupBox5.Name = "groupBox5";
  981. this.groupBox5.Size = new System.Drawing.Size(224, 165);
  982. this.groupBox5.TabIndex = 13;
  983. this.groupBox5.TabStop = false;
  984. this.groupBox5.Text = "分析结果";
  985. //
  986. // listBox_analysisResult
  987. //
  988. this.listBox_analysisResult.CheckOnClick = true;
  989. this.listBox_analysisResult.FormattingEnabled = true;
  990. this.listBox_analysisResult.HorizontalScrollbar = true;
  991. this.listBox_analysisResult.Location = new System.Drawing.Point(11, 59);
  992. this.listBox_analysisResult.Name = "listBox_analysisResult";
  993. this.listBox_analysisResult.Size = new System.Drawing.Size(202, 100);
  994. this.listBox_analysisResult.TabIndex = 11;
  995. this.listBox_analysisResult.SelectedIndexChanged += new System.EventHandler(this.listBox_analysisResult_SelectedIndexChanged);
  996. //
  997. // button_remove
  998. //
  999. this.button_remove.Location = new System.Drawing.Point(130, 24);
  1000. this.button_remove.Name = "button_remove";
  1001. this.button_remove.Size = new System.Drawing.Size(75, 23);
  1002. this.button_remove.TabIndex = 8;
  1003. this.button_remove.Text = "删除";
  1004. this.button_remove.UseVisualStyleBackColor = true;
  1005. this.button_remove.Click += new System.EventHandler(this.button_remove_Click);
  1006. //
  1007. // button_all
  1008. //
  1009. this.button_all.Location = new System.Drawing.Point(14, 24);
  1010. this.button_all.Name = "button_all";
  1011. this.button_all.Size = new System.Drawing.Size(75, 23);
  1012. this.button_all.TabIndex = 1;
  1013. this.button_all.Text = "全部显示";
  1014. this.button_all.UseVisualStyleBackColor = true;
  1015. this.button_all.Click += new System.EventHandler(this.button_all_Click);
  1016. //
  1017. // groupBox6
  1018. //
  1019. this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  1020. | System.Windows.Forms.AnchorStyles.Right)));
  1021. this.groupBox6.Controls.Add(this.dataGridView_results);
  1022. this.groupBox6.Location = new System.Drawing.Point(249, 562);
  1023. this.groupBox6.Name = "groupBox6";
  1024. this.groupBox6.Size = new System.Drawing.Size(769, 165);
  1025. this.groupBox6.TabIndex = 14;
  1026. this.groupBox6.TabStop = false;
  1027. //
  1028. // dataGridView_results
  1029. //
  1030. this.dataGridView_results.AllowUserToAddRows = false;
  1031. this.dataGridView_results.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  1032. | System.Windows.Forms.AnchorStyles.Right)));
  1033. this.dataGridView_results.BorderStyle = System.Windows.Forms.BorderStyle.None;
  1034. this.dataGridView_results.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  1035. this.dataGridView_results.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  1036. this.Column5,
  1037. this.dataGridViewTextBoxColumn1,
  1038. this.dataGridViewTextBoxColumn2,
  1039. this.dataGridViewTextBoxColumn3,
  1040. this.dataGridViewTextBoxColumn4});
  1041. this.dataGridView_results.Location = new System.Drawing.Point(16, 20);
  1042. this.dataGridView_results.Name = "dataGridView_results";
  1043. this.dataGridView_results.RowHeadersVisible = false;
  1044. this.dataGridView_results.RowHeadersWidth = 51;
  1045. this.dataGridView_results.RowTemplate.Height = 27;
  1046. this.dataGridView_results.Size = new System.Drawing.Size(733, 139);
  1047. this.dataGridView_results.TabIndex = 1;
  1048. //
  1049. // Column5
  1050. //
  1051. this.Column5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
  1052. this.Column5.HeaderText = "Column5";
  1053. this.Column5.MinimumWidth = 6;
  1054. this.Column5.Name = "Column5";
  1055. //
  1056. // dataGridViewTextBoxColumn1
  1057. //
  1058. this.dataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
  1059. this.dataGridViewTextBoxColumn1.HeaderText = "dataGridViewTextBoxColumn1";
  1060. this.dataGridViewTextBoxColumn1.MinimumWidth = 6;
  1061. this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
  1062. //
  1063. // dataGridViewTextBoxColumn2
  1064. //
  1065. this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
  1066. this.dataGridViewTextBoxColumn2.HeaderText = "dataGridViewTextBoxColumn2";
  1067. this.dataGridViewTextBoxColumn2.MinimumWidth = 6;
  1068. this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
  1069. //
  1070. // dataGridViewTextBoxColumn3
  1071. //
  1072. this.dataGridViewTextBoxColumn3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
  1073. this.dataGridViewTextBoxColumn3.HeaderText = "dataGridViewTextBoxColumn3";
  1074. this.dataGridViewTextBoxColumn3.MinimumWidth = 6;
  1075. this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
  1076. //
  1077. // dataGridViewTextBoxColumn4
  1078. //
  1079. this.dataGridViewTextBoxColumn4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
  1080. this.dataGridViewTextBoxColumn4.HeaderText = "dataGridViewTextBoxColumn4";
  1081. this.dataGridViewTextBoxColumn4.MinimumWidth = 6;
  1082. this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
  1083. //
  1084. // groupBox7
  1085. //
  1086. this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  1087. this.groupBox7.Controls.Add(this.button9);
  1088. this.groupBox7.Controls.Add(this.numericUpDown1);
  1089. this.groupBox7.Controls.Add(this.label1);
  1090. this.groupBox7.Controls.Add(this.button4);
  1091. this.groupBox7.Controls.Add(this.button3);
  1092. this.groupBox7.Location = new System.Drawing.Point(1031, 562);
  1093. this.groupBox7.Name = "groupBox7";
  1094. this.groupBox7.Size = new System.Drawing.Size(133, 165);
  1095. this.groupBox7.TabIndex = 15;
  1096. this.groupBox7.TabStop = false;
  1097. //
  1098. // button9
  1099. //
  1100. this.button9.Location = new System.Drawing.Point(29, 89);
  1101. this.button9.Name = "button9";
  1102. this.button9.Size = new System.Drawing.Size(75, 23);
  1103. this.button9.TabIndex = 7;
  1104. this.button9.Text = "项目工程";
  1105. this.button9.UseVisualStyleBackColor = true;
  1106. this.button9.Click += new System.EventHandler(this.button9_Click);
  1107. //
  1108. // numericUpDown1
  1109. //
  1110. this.numericUpDown1.Location = new System.Drawing.Point(62, 127);
  1111. this.numericUpDown1.Maximum = new decimal(new int[] {
  1112. 10,
  1113. 0,
  1114. 0,
  1115. 0});
  1116. this.numericUpDown1.Name = "numericUpDown1";
  1117. this.numericUpDown1.Size = new System.Drawing.Size(42, 21);
  1118. this.numericUpDown1.TabIndex = 4;
  1119. this.numericUpDown1.Value = new decimal(new int[] {
  1120. 2,
  1121. 0,
  1122. 0,
  1123. 0});
  1124. this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
  1125. //
  1126. // label1
  1127. //
  1128. this.label1.AutoSize = true;
  1129. this.label1.Location = new System.Drawing.Point(27, 129);
  1130. this.label1.Name = "label1";
  1131. this.label1.Size = new System.Drawing.Size(41, 12);
  1132. this.label1.TabIndex = 3;
  1133. this.label1.Text = "小数:";
  1134. //
  1135. // button4
  1136. //
  1137. this.button4.Location = new System.Drawing.Point(29, 53);
  1138. this.button4.Name = "button4";
  1139. this.button4.Size = new System.Drawing.Size(75, 23);
  1140. this.button4.TabIndex = 1;
  1141. this.button4.Text = "导出结果";
  1142. this.button4.UseVisualStyleBackColor = true;
  1143. this.button4.Click += new System.EventHandler(this.button4_Click);
  1144. //
  1145. // button3
  1146. //
  1147. this.button3.Location = new System.Drawing.Point(29, 18);
  1148. this.button3.Name = "button3";
  1149. this.button3.Size = new System.Drawing.Size(75, 23);
  1150. this.button3.TabIndex = 0;
  1151. this.button3.Text = "生成报告";
  1152. this.button3.UseVisualStyleBackColor = true;
  1153. this.button3.Click += new System.EventHandler(this.button3_Click);
  1154. //
  1155. // groupBox2
  1156. //
  1157. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  1158. | System.Windows.Forms.AnchorStyles.Left)));
  1159. this.groupBox2.Controls.Add(this.button6);
  1160. this.groupBox2.Controls.Add(this.button5);
  1161. this.groupBox2.Controls.Add(this.numericUpDown_RangeEnd);
  1162. this.groupBox2.Controls.Add(this.numericUpDown_RangeStart);
  1163. this.groupBox2.Controls.Add(this.panel2);
  1164. this.groupBox2.Controls.Add(this.cb8);
  1165. this.groupBox2.Controls.Add(this.cb6);
  1166. this.groupBox2.Controls.Add(this.cb4);
  1167. this.groupBox2.Controls.Add(this.cb7);
  1168. this.groupBox2.Controls.Add(this.cb5);
  1169. this.groupBox2.Controls.Add(this.cb3);
  1170. this.groupBox2.Controls.Add(this.cb2);
  1171. this.groupBox2.Controls.Add(this.cb1);
  1172. this.groupBox2.Controls.Add(this.label7);
  1173. this.groupBox2.Controls.Add(this.label6);
  1174. this.groupBox2.Controls.Add(this.label5);
  1175. this.groupBox2.Controls.Add(this.txt_phaseName);
  1176. this.groupBox2.Controls.Add(this.label4);
  1177. this.groupBox2.Controls.Add(this.cb_SelectPhase);
  1178. this.groupBox2.Controls.Add(this.label3);
  1179. this.groupBox2.Controls.Add(this.rb8);
  1180. this.groupBox2.Controls.Add(this.rb7);
  1181. this.groupBox2.Controls.Add(this.rb6);
  1182. this.groupBox2.Controls.Add(this.rb5);
  1183. this.groupBox2.Controls.Add(this.rb4);
  1184. this.groupBox2.Controls.Add(this.rb3);
  1185. this.groupBox2.Controls.Add(this.rb2);
  1186. this.groupBox2.Controls.Add(this.rb1);
  1187. this.groupBox2.Controls.Add(this.label2);
  1188. this.groupBox2.Controls.Add(this.panel1);
  1189. this.groupBox2.Location = new System.Drawing.Point(178, 72);
  1190. this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 3, 3, 112);
  1191. this.groupBox2.Name = "groupBox2";
  1192. this.groupBox2.Size = new System.Drawing.Size(406, 366);
  1193. this.groupBox2.TabIndex = 18;
  1194. this.groupBox2.TabStop = false;
  1195. this.groupBox2.Text = "相设置";
  1196. //
  1197. // button6
  1198. //
  1199. this.button6.Location = new System.Drawing.Point(279, 311);
  1200. this.button6.Name = "button6";
  1201. this.button6.Size = new System.Drawing.Size(75, 23);
  1202. this.button6.TabIndex = 32;
  1203. this.button6.Text = "原图";
  1204. this.button6.UseVisualStyleBackColor = true;
  1205. this.button6.Click += new System.EventHandler(this.button6_Click);
  1206. //
  1207. // button5
  1208. //
  1209. this.button5.Location = new System.Drawing.Point(188, 311);
  1210. this.button5.Name = "button5";
  1211. this.button5.Size = new System.Drawing.Size(75, 23);
  1212. this.button5.TabIndex = 31;
  1213. this.button5.Text = "全选";
  1214. this.button5.UseVisualStyleBackColor = true;
  1215. this.button5.Click += new System.EventHandler(this.button5_Click);
  1216. //
  1217. // numericUpDown_RangeEnd
  1218. //
  1219. this.numericUpDown_RangeEnd.Location = new System.Drawing.Point(270, 187);
  1220. this.numericUpDown_RangeEnd.Maximum = new decimal(new int[] {
  1221. 256,
  1222. 0,
  1223. 0,
  1224. 0});
  1225. this.numericUpDown_RangeEnd.Name = "numericUpDown_RangeEnd";
  1226. this.numericUpDown_RangeEnd.Size = new System.Drawing.Size(52, 21);
  1227. this.numericUpDown_RangeEnd.TabIndex = 30;
  1228. this.numericUpDown_RangeEnd.ValueChanged += new System.EventHandler(this.numericUpDown_RangeEnd_ValueChanged);
  1229. this.numericUpDown_RangeEnd.KeyUp += new System.Windows.Forms.KeyEventHandler(this.numericUpDown_RangeEnd_KeyUp);
  1230. //
  1231. // numericUpDown_RangeStart
  1232. //
  1233. this.numericUpDown_RangeStart.Location = new System.Drawing.Point(187, 187);
  1234. this.numericUpDown_RangeStart.Maximum = new decimal(new int[] {
  1235. 256,
  1236. 0,
  1237. 0,
  1238. 0});
  1239. this.numericUpDown_RangeStart.Name = "numericUpDown_RangeStart";
  1240. this.numericUpDown_RangeStart.Size = new System.Drawing.Size(51, 21);
  1241. this.numericUpDown_RangeStart.TabIndex = 29;
  1242. this.numericUpDown_RangeStart.ValueChanged += new System.EventHandler(this.numericUpDown_RangeStart_ValueChanged);
  1243. this.numericUpDown_RangeStart.KeyUp += new System.Windows.Forms.KeyEventHandler(this.numericUpDown_RangeStart_KeyUp);
  1244. //
  1245. // panel2
  1246. //
  1247. this.panel2.BackColor = System.Drawing.Color.White;
  1248. this.panel2.Location = new System.Drawing.Point(187, 150);
  1249. this.panel2.Name = "panel2";
  1250. this.panel2.Size = new System.Drawing.Size(135, 22);
  1251. this.panel2.TabIndex = 28;
  1252. this.panel2.Click += new System.EventHandler(this.panel2_Click);
  1253. //
  1254. // cb8
  1255. //
  1256. this.cb8.AutoSize = true;
  1257. this.cb8.Location = new System.Drawing.Point(247, 288);
  1258. this.cb8.Name = "cb8";
  1259. this.cb8.Size = new System.Drawing.Size(42, 16);
  1260. this.cb8.TabIndex = 27;
  1261. this.cb8.Text = "相8";
  1262. this.cb8.UseVisualStyleBackColor = true;
  1263. this.cb8.CheckedChanged += new System.EventHandler(this.cb8_CheckedChanged);
  1264. //
  1265. // cb6
  1266. //
  1267. this.cb6.AutoSize = true;
  1268. this.cb6.Location = new System.Drawing.Point(247, 266);
  1269. this.cb6.Name = "cb6";
  1270. this.cb6.Size = new System.Drawing.Size(42, 16);
  1271. this.cb6.TabIndex = 26;
  1272. this.cb6.Text = "相6";
  1273. this.cb6.UseVisualStyleBackColor = true;
  1274. this.cb6.CheckedChanged += new System.EventHandler(this.cb6_CheckedChanged);
  1275. //
  1276. // cb4
  1277. //
  1278. this.cb4.AutoSize = true;
  1279. this.cb4.Location = new System.Drawing.Point(247, 244);
  1280. this.cb4.Name = "cb4";
  1281. this.cb4.Size = new System.Drawing.Size(42, 16);
  1282. this.cb4.TabIndex = 25;
  1283. this.cb4.Text = "相4";
  1284. this.cb4.UseVisualStyleBackColor = true;
  1285. this.cb4.CheckedChanged += new System.EventHandler(this.cb4_CheckedChanged);
  1286. //
  1287. // cb7
  1288. //
  1289. this.cb7.AutoSize = true;
  1290. this.cb7.Location = new System.Drawing.Point(188, 288);
  1291. this.cb7.Name = "cb7";
  1292. this.cb7.Size = new System.Drawing.Size(42, 16);
  1293. this.cb7.TabIndex = 24;
  1294. this.cb7.Text = "相7";
  1295. this.cb7.UseVisualStyleBackColor = true;
  1296. this.cb7.CheckedChanged += new System.EventHandler(this.cb7_CheckedChanged);
  1297. //
  1298. // cb5
  1299. //
  1300. this.cb5.AutoSize = true;
  1301. this.cb5.Location = new System.Drawing.Point(188, 266);
  1302. this.cb5.Name = "cb5";
  1303. this.cb5.Size = new System.Drawing.Size(42, 16);
  1304. this.cb5.TabIndex = 23;
  1305. this.cb5.Text = "相5";
  1306. this.cb5.UseVisualStyleBackColor = true;
  1307. this.cb5.CheckedChanged += new System.EventHandler(this.cb5_CheckedChanged);
  1308. //
  1309. // cb3
  1310. //
  1311. this.cb3.AutoSize = true;
  1312. this.cb3.Location = new System.Drawing.Point(188, 244);
  1313. this.cb3.Name = "cb3";
  1314. this.cb3.Size = new System.Drawing.Size(42, 16);
  1315. this.cb3.TabIndex = 22;
  1316. this.cb3.Text = "相3";
  1317. this.cb3.UseVisualStyleBackColor = true;
  1318. this.cb3.CheckedChanged += new System.EventHandler(this.cb3_CheckedChanged);
  1319. //
  1320. // cb2
  1321. //
  1322. this.cb2.AutoSize = true;
  1323. this.cb2.Location = new System.Drawing.Point(247, 222);
  1324. this.cb2.Name = "cb2";
  1325. this.cb2.Size = new System.Drawing.Size(42, 16);
  1326. this.cb2.TabIndex = 21;
  1327. this.cb2.Text = "相2";
  1328. this.cb2.UseVisualStyleBackColor = true;
  1329. this.cb2.CheckedChanged += new System.EventHandler(this.cb2_CheckedChanged);
  1330. //
  1331. // cb1
  1332. //
  1333. this.cb1.AutoSize = true;
  1334. this.cb1.Location = new System.Drawing.Point(188, 222);
  1335. this.cb1.Name = "cb1";
  1336. this.cb1.Size = new System.Drawing.Size(42, 16);
  1337. this.cb1.TabIndex = 20;
  1338. this.cb1.Text = "相1";
  1339. this.cb1.UseVisualStyleBackColor = true;
  1340. this.cb1.CheckedChanged += new System.EventHandler(this.cb1_CheckedChanged);
  1341. //
  1342. // label7
  1343. //
  1344. this.label7.AutoSize = true;
  1345. this.label7.Location = new System.Drawing.Point(105, 223);
  1346. this.label7.Name = "label7";
  1347. this.label7.Size = new System.Drawing.Size(53, 12);
  1348. this.label7.TabIndex = 19;
  1349. this.label7.Text = "显示物相";
  1350. //
  1351. // label6
  1352. //
  1353. this.label6.AutoSize = true;
  1354. this.label6.Location = new System.Drawing.Point(105, 189);
  1355. this.label6.Name = "label6";
  1356. this.label6.Size = new System.Drawing.Size(53, 12);
  1357. this.label6.TabIndex = 16;
  1358. this.label6.Text = "物相区间";
  1359. //
  1360. // label5
  1361. //
  1362. this.label5.AutoSize = true;
  1363. this.label5.Location = new System.Drawing.Point(105, 150);
  1364. this.label5.Name = "label5";
  1365. this.label5.Size = new System.Drawing.Size(53, 12);
  1366. this.label5.TabIndex = 14;
  1367. this.label5.Text = "物相颜色";
  1368. //
  1369. // txt_phaseName
  1370. //
  1371. this.txt_phaseName.Location = new System.Drawing.Point(188, 117);
  1372. this.txt_phaseName.Name = "txt_phaseName";
  1373. this.txt_phaseName.ReadOnly = true;
  1374. this.txt_phaseName.Size = new System.Drawing.Size(134, 21);
  1375. this.txt_phaseName.TabIndex = 13;
  1376. //
  1377. // label4
  1378. //
  1379. this.label4.AutoSize = true;
  1380. this.label4.Location = new System.Drawing.Point(105, 117);
  1381. this.label4.Name = "label4";
  1382. this.label4.Size = new System.Drawing.Size(53, 12);
  1383. this.label4.TabIndex = 12;
  1384. this.label4.Text = "物相名称";
  1385. //
  1386. // cb_SelectPhase
  1387. //
  1388. this.cb_SelectPhase.FormattingEnabled = true;
  1389. this.cb_SelectPhase.Location = new System.Drawing.Point(188, 85);
  1390. this.cb_SelectPhase.Name = "cb_SelectPhase";
  1391. this.cb_SelectPhase.Size = new System.Drawing.Size(134, 20);
  1392. this.cb_SelectPhase.TabIndex = 11;
  1393. this.cb_SelectPhase.SelectedIndexChanged += new System.EventHandler(this.cb_SelectPhase_SelectedIndexChanged);
  1394. //
  1395. // label3
  1396. //
  1397. this.label3.AutoSize = true;
  1398. this.label3.Location = new System.Drawing.Point(105, 88);
  1399. this.label3.Name = "label3";
  1400. this.label3.Size = new System.Drawing.Size(53, 12);
  1401. this.label3.TabIndex = 10;
  1402. this.label3.Text = "物相选择";
  1403. //
  1404. // rb8
  1405. //
  1406. this.rb8.AutoSize = true;
  1407. this.rb8.Location = new System.Drawing.Point(293, 57);
  1408. this.rb8.Name = "rb8";
  1409. this.rb8.Size = new System.Drawing.Size(29, 16);
  1410. this.rb8.TabIndex = 9;
  1411. this.rb8.TabStop = true;
  1412. this.rb8.Text = "8";
  1413. this.rb8.UseVisualStyleBackColor = true;
  1414. this.rb8.CheckedChanged += new System.EventHandler(this.rb8_CheckedChanged);
  1415. //
  1416. // rb7
  1417. //
  1418. this.rb7.AutoSize = true;
  1419. this.rb7.Location = new System.Drawing.Point(258, 57);
  1420. this.rb7.Name = "rb7";
  1421. this.rb7.Size = new System.Drawing.Size(29, 16);
  1422. this.rb7.TabIndex = 8;
  1423. this.rb7.TabStop = true;
  1424. this.rb7.Text = "7";
  1425. this.rb7.UseVisualStyleBackColor = true;
  1426. this.rb7.CheckedChanged += new System.EventHandler(this.rb7_CheckedChanged);
  1427. //
  1428. // rb6
  1429. //
  1430. this.rb6.AutoSize = true;
  1431. this.rb6.Location = new System.Drawing.Point(223, 57);
  1432. this.rb6.Name = "rb6";
  1433. this.rb6.Size = new System.Drawing.Size(29, 16);
  1434. this.rb6.TabIndex = 7;
  1435. this.rb6.TabStop = true;
  1436. this.rb6.Text = "6";
  1437. this.rb6.UseVisualStyleBackColor = true;
  1438. this.rb6.CheckedChanged += new System.EventHandler(this.rb6_CheckedChanged);
  1439. //
  1440. // rb5
  1441. //
  1442. this.rb5.AutoSize = true;
  1443. this.rb5.Location = new System.Drawing.Point(188, 57);
  1444. this.rb5.Name = "rb5";
  1445. this.rb5.Size = new System.Drawing.Size(29, 16);
  1446. this.rb5.TabIndex = 6;
  1447. this.rb5.TabStop = true;
  1448. this.rb5.Text = "5";
  1449. this.rb5.UseVisualStyleBackColor = true;
  1450. this.rb5.CheckedChanged += new System.EventHandler(this.rb5_CheckedChanged);
  1451. //
  1452. // rb4
  1453. //
  1454. this.rb4.AutoSize = true;
  1455. this.rb4.Location = new System.Drawing.Point(293, 26);
  1456. this.rb4.Name = "rb4";
  1457. this.rb4.Size = new System.Drawing.Size(29, 16);
  1458. this.rb4.TabIndex = 5;
  1459. this.rb4.TabStop = true;
  1460. this.rb4.Text = "4";
  1461. this.rb4.UseVisualStyleBackColor = true;
  1462. this.rb4.CheckedChanged += new System.EventHandler(this.rb4_CheckedChanged);
  1463. //
  1464. // rb3
  1465. //
  1466. this.rb3.AutoSize = true;
  1467. this.rb3.Location = new System.Drawing.Point(258, 26);
  1468. this.rb3.Name = "rb3";
  1469. this.rb3.Size = new System.Drawing.Size(29, 16);
  1470. this.rb3.TabIndex = 4;
  1471. this.rb3.TabStop = true;
  1472. this.rb3.Text = "3";
  1473. this.rb3.UseVisualStyleBackColor = true;
  1474. this.rb3.CheckedChanged += new System.EventHandler(this.rb3_CheckedChanged);
  1475. //
  1476. // rb2
  1477. //
  1478. this.rb2.AutoSize = true;
  1479. this.rb2.Location = new System.Drawing.Point(223, 26);
  1480. this.rb2.Name = "rb2";
  1481. this.rb2.Size = new System.Drawing.Size(29, 16);
  1482. this.rb2.TabIndex = 3;
  1483. this.rb2.TabStop = true;
  1484. this.rb2.Text = "2";
  1485. this.rb2.UseVisualStyleBackColor = true;
  1486. this.rb2.CheckedChanged += new System.EventHandler(this.rb2_CheckedChanged);
  1487. //
  1488. // rb1
  1489. //
  1490. this.rb1.AutoSize = true;
  1491. this.rb1.Location = new System.Drawing.Point(188, 26);
  1492. this.rb1.Name = "rb1";
  1493. this.rb1.Size = new System.Drawing.Size(29, 16);
  1494. this.rb1.TabIndex = 2;
  1495. this.rb1.TabStop = true;
  1496. this.rb1.Text = "1";
  1497. this.rb1.UseVisualStyleBackColor = true;
  1498. this.rb1.CheckedChanged += new System.EventHandler(this.rb1_CheckedChanged);
  1499. //
  1500. // label2
  1501. //
  1502. this.label2.AutoSize = true;
  1503. this.label2.Location = new System.Drawing.Point(107, 26);
  1504. this.label2.Name = "label2";
  1505. this.label2.Size = new System.Drawing.Size(53, 12);
  1506. this.label2.TabIndex = 1;
  1507. this.label2.Text = "多相数量";
  1508. //
  1509. // panel1
  1510. //
  1511. this.panel1.Location = new System.Drawing.Point(6, 26);
  1512. this.panel1.Name = "panel1";
  1513. this.panel1.Size = new System.Drawing.Size(93, 256);
  1514. this.panel1.TabIndex = 0;
  1515. //
  1516. // groupBox3
  1517. //
  1518. this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  1519. this.groupBox3.Controls.Add(this.numericUpDown_SXEnd);
  1520. this.groupBox3.Controls.Add(this.numericUpDown_SXStart);
  1521. this.groupBox3.Controls.Add(this.numericUpDown_KDEnd);
  1522. this.groupBox3.Controls.Add(this.numericUpDown_KDStart);
  1523. this.groupBox3.Controls.Add(this.But_DeleteSX);
  1524. this.groupBox3.Controls.Add(this.But_DeleteKD);
  1525. this.groupBox3.Controls.Add(this.checkBox11);
  1526. this.groupBox3.Controls.Add(this.checkBox10);
  1527. this.groupBox3.Location = new System.Drawing.Point(178, 444);
  1528. this.groupBox3.Name = "groupBox3";
  1529. this.groupBox3.Size = new System.Drawing.Size(406, 112);
  1530. this.groupBox3.TabIndex = 17;
  1531. this.groupBox3.TabStop = false;
  1532. this.groupBox3.Text = "二值操作";
  1533. //
  1534. // numericUpDown_SXEnd
  1535. //
  1536. this.numericUpDown_SXEnd.Location = new System.Drawing.Point(206, 64);
  1537. this.numericUpDown_SXEnd.Maximum = new decimal(new int[] {
  1538. 100000000,
  1539. 0,
  1540. 0,
  1541. 0});
  1542. this.numericUpDown_SXEnd.Name = "numericUpDown_SXEnd";
  1543. this.numericUpDown_SXEnd.Size = new System.Drawing.Size(51, 21);
  1544. this.numericUpDown_SXEnd.TabIndex = 33;
  1545. //
  1546. // numericUpDown_SXStart
  1547. //
  1548. this.numericUpDown_SXStart.Location = new System.Drawing.Point(135, 64);
  1549. this.numericUpDown_SXStart.Maximum = new decimal(new int[] {
  1550. 10000,
  1551. 0,
  1552. 0,
  1553. 0});
  1554. this.numericUpDown_SXStart.Name = "numericUpDown_SXStart";
  1555. this.numericUpDown_SXStart.Size = new System.Drawing.Size(51, 21);
  1556. this.numericUpDown_SXStart.TabIndex = 32;
  1557. //
  1558. // numericUpDown_KDEnd
  1559. //
  1560. this.numericUpDown_KDEnd.Location = new System.Drawing.Point(206, 31);
  1561. this.numericUpDown_KDEnd.Maximum = new decimal(new int[] {
  1562. 100000000,
  1563. 0,
  1564. 0,
  1565. 0});
  1566. this.numericUpDown_KDEnd.Name = "numericUpDown_KDEnd";
  1567. this.numericUpDown_KDEnd.Size = new System.Drawing.Size(51, 21);
  1568. this.numericUpDown_KDEnd.TabIndex = 31;
  1569. //
  1570. // numericUpDown_KDStart
  1571. //
  1572. this.numericUpDown_KDStart.Location = new System.Drawing.Point(135, 33);
  1573. this.numericUpDown_KDStart.Maximum = new decimal(new int[] {
  1574. 10000,
  1575. 0,
  1576. 0,
  1577. 0});
  1578. this.numericUpDown_KDStart.Name = "numericUpDown_KDStart";
  1579. this.numericUpDown_KDStart.Size = new System.Drawing.Size(51, 21);
  1580. this.numericUpDown_KDStart.TabIndex = 30;
  1581. //
  1582. // But_DeleteSX
  1583. //
  1584. this.But_DeleteSX.Location = new System.Drawing.Point(273, 65);
  1585. this.But_DeleteSX.Name = "But_DeleteSX";
  1586. this.But_DeleteSX.Size = new System.Drawing.Size(75, 23);
  1587. this.But_DeleteSX.TabIndex = 7;
  1588. this.But_DeleteSX.Text = "应用";
  1589. this.But_DeleteSX.UseVisualStyleBackColor = true;
  1590. this.But_DeleteSX.Click += new System.EventHandler(this.But_DeleteSX_Click);
  1591. //
  1592. // But_DeleteKD
  1593. //
  1594. this.But_DeleteKD.Location = new System.Drawing.Point(273, 31);
  1595. this.But_DeleteKD.Name = "But_DeleteKD";
  1596. this.But_DeleteKD.Size = new System.Drawing.Size(75, 23);
  1597. this.But_DeleteKD.TabIndex = 6;
  1598. this.But_DeleteKD.Text = "应用";
  1599. this.But_DeleteKD.UseVisualStyleBackColor = true;
  1600. this.But_DeleteKD.Click += new System.EventHandler(this.But_DeleteKD_Click);
  1601. //
  1602. // checkBox11
  1603. //
  1604. this.checkBox11.AutoSize = true;
  1605. this.checkBox11.Location = new System.Drawing.Point(21, 69);
  1606. this.checkBox11.Name = "checkBox11";
  1607. this.checkBox11.Size = new System.Drawing.Size(108, 16);
  1608. this.checkBox11.TabIndex = 1;
  1609. this.checkBox11.Text = "碎屑删除(μm²)";
  1610. this.checkBox11.UseVisualStyleBackColor = true;
  1611. this.checkBox11.CheckedChanged += new System.EventHandler(this.checkBox11_CheckedChanged);
  1612. //
  1613. // checkBox10
  1614. //
  1615. this.checkBox10.AutoSize = true;
  1616. this.checkBox10.Location = new System.Drawing.Point(21, 36);
  1617. this.checkBox10.Name = "checkBox10";
  1618. this.checkBox10.Size = new System.Drawing.Size(108, 16);
  1619. this.checkBox10.TabIndex = 0;
  1620. this.checkBox10.Text = "孔洞删除(μm²)";
  1621. this.checkBox10.UseVisualStyleBackColor = true;
  1622. this.checkBox10.CheckedChanged += new System.EventHandler(this.checkBox10_CheckedChanged);
  1623. //
  1624. // PolyphaseMutiAreaContent
  1625. //
  1626. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  1627. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  1628. this.ClientSize = new System.Drawing.Size(1177, 744);
  1629. this.Controls.Add(this.groupBox3);
  1630. this.Controls.Add(this.groupBox2);
  1631. this.Controls.Add(this.groupBox7);
  1632. this.Controls.Add(this.groupBox6);
  1633. this.Controls.Add(this.groupBox5);
  1634. this.Controls.Add(this.groupBox_review);
  1635. this.Controls.Add(this.groupBox1);
  1636. this.Controls.Add(this.groupBox4);
  1637. this.Name = "PolyphaseMutiAreaContent";
  1638. this.Text = "多相含量";
  1639. this.Controls.SetChildIndex(this.groupBox4, 0);
  1640. this.Controls.SetChildIndex(this.groupBox1, 0);
  1641. this.Controls.SetChildIndex(this.groupBox_review, 0);
  1642. this.Controls.SetChildIndex(this.groupBox5, 0);
  1643. this.Controls.SetChildIndex(this.groupBox6, 0);
  1644. this.Controls.SetChildIndex(this.groupBox7, 0);
  1645. this.Controls.SetChildIndex(this.groupBox2, 0);
  1646. this.Controls.SetChildIndex(this.groupBox3, 0);
  1647. this.groupBox4.ResumeLayout(false);
  1648. this.groupBox1.ResumeLayout(false);
  1649. this.groupBox1.PerformLayout();
  1650. this.groupBox5.ResumeLayout(false);
  1651. this.groupBox6.ResumeLayout(false);
  1652. ((System.ComponentModel.ISupportInitialize)(this.dataGridView_results)).EndInit();
  1653. this.groupBox7.ResumeLayout(false);
  1654. this.groupBox7.PerformLayout();
  1655. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  1656. this.groupBox2.ResumeLayout(false);
  1657. this.groupBox2.PerformLayout();
  1658. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_RangeEnd)).EndInit();
  1659. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_RangeStart)).EndInit();
  1660. this.groupBox3.ResumeLayout(false);
  1661. this.groupBox3.PerformLayout();
  1662. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_SXEnd)).EndInit();
  1663. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_SXStart)).EndInit();
  1664. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_KDEnd)).EndInit();
  1665. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_KDStart)).EndInit();
  1666. this.ResumeLayout(false);
  1667. }
  1668. #endregion
  1669. private void Init_CheckBoxes()
  1670. {
  1671. foreach (Control ctrl in this.groupBox2.Controls) //遍历窗体中的所有控件,Control是所有控件的基类
  1672. {
  1673. if (ctrl.GetType().Name == "CheckBox") //判断是否为CheckBox
  1674. {
  1675. if (ctrl.Name.IndexOf("cb")>=0)
  1676. {
  1677. CheckBox cBox = (CheckBox)ctrl; //创建CheckBox对象
  1678. cBox.Checked = false;
  1679. cBox.Enabled = false;
  1680. }
  1681. }
  1682. }
  1683. }
  1684. private void ChangeNumber(int num)
  1685. {
  1686. this.documentWorkspace.phaseModels.Clear();
  1687. this.cb_SelectPhase.Items.Clear();
  1688. this.phaseModels.Clear();
  1689. this.mPhaseModels.Clear();
  1690. this.viewModels.Clear();
  1691. this.rangeColors.Clear();
  1692. cb_SelectPhase.Text = "";
  1693. selectIndex = 0;
  1694. this.xiang_num = num;
  1695. Init_CheckBoxes();
  1696. int step = 255 / num;
  1697. for (int i = 0; i < num; i++)
  1698. {
  1699. PhaseModel model = this.applyButtonImpl(DefaultColor[i], i * step, (i + 1) * step);
  1700. model.name = "相" + (i + 1);
  1701. PhaseModel viewModel = new PhaseModel();
  1702. viewModel.choise = model.choise;
  1703. viewModel.color = model.color;
  1704. viewModel.name = model.name;
  1705. viewModel.position = model.position;
  1706. viewModel.mat = new OpenCvSharp.Mat();
  1707. model.mat.CopyTo(viewModel.mat);
  1708. MutiPolyphaseModel mPModel = new MutiPolyphaseModel();
  1709. mPModel.Model = viewModel;
  1710. int start = i * step;
  1711. if (i != 0)
  1712. {
  1713. start += 1;
  1714. }
  1715. mPModel.ColorStart = start;
  1716. mPModel.ColorEnd = (i + 1) * step;
  1717. if (i == num - 1)
  1718. {
  1719. mPModel.ColorEnd = 255;
  1720. }
  1721. mPhaseModels.Add(mPModel);
  1722. viewModels.Add(viewModel);
  1723. phaseModels.Add(model);
  1724. rangeColors.Add(new RangeColor(mPModel.ColorStart, mPModel.ColorEnd, DefaultColor[i]));
  1725. cb_SelectPhase.Items.Add(mPModel.Model.name);
  1726. foreach (Control ctrl in this.groupBox2.Controls) //遍历窗体中的所有控件,Control是所有控件的基类
  1727. {
  1728. if (ctrl.GetType().Name == "CheckBox") //判断是否为CheckBox
  1729. {
  1730. if (ctrl.Name.Equals("cb"+(i+1)))
  1731. {
  1732. CheckBox cBox = (CheckBox)ctrl; //创建CheckBox对象
  1733. cBox.Checked = true;
  1734. cBox.Enabled = true;
  1735. }
  1736. }
  1737. }
  1738. }
  1739. this.cRControl.RangeColors = rangeColors;
  1740. this.cRControl.Refresh();
  1741. this.documentWorkspace.phaseModels = viewModels;
  1742. this.documentWorkspace.Refresh();
  1743. ShowthisParams(mPhaseModels[0]);
  1744. }
  1745. private void ShowthisParams(MutiPolyphaseModel pModel)
  1746. {
  1747. cb_SelectPhase.SelectedText = pModel.Model.name;
  1748. cb_SelectPhase.SelectedIndex = 0;
  1749. selectIndex = cb_SelectPhase.SelectedIndex;
  1750. this.cRControl.SelectIndex = cb_SelectPhase.SelectedIndex;
  1751. txt_phaseName.Text = pModel.Model.name;
  1752. panel2.BackColor = Color.FromArgb(pModel.Model.color);
  1753. numericUpDown_RangeStart.Value = pModel.ColorStart;
  1754. numericUpDown_RangeEnd.Value = pModel.ColorEnd;
  1755. }
  1756. /// <summary>
  1757. /// 参数改变时,重新处理图像
  1758. /// </summary>
  1759. /// <param name="sender"></param>
  1760. /// <param name="e"></param>
  1761. private PhaseModel applyButtonImpl(Color pColor,int start,int end)
  1762. {
  1763. PhaseModel model = new PhaseModel();
  1764. if (this.listView1.FocusedItem != null)
  1765. {
  1766. //判断是否存在视场,如果存在视场,则把视场提取出来,进行处理
  1767. foreach (Args args in action.Lists)
  1768. {
  1769. if (args.Key == "phaseColor")
  1770. {
  1771. args.Value = pColor.ToArgb();
  1772. break;
  1773. }
  1774. if (args.Key == "scope1")
  1775. {
  1776. List<double> twoL = new List<double>();
  1777. twoL.Add(start);
  1778. twoL.Add(end);
  1779. args.Value = twoL;
  1780. }
  1781. }
  1782. if (this.documentWorkspace.GraphicsList.IsExsitView())
  1783. {
  1784. model.mat = action.PerformProcess(
  1785. PaintDotNet.Camera.Tools.ToMat(this.documentWorkspace.GetFullSizeWithRegion()),
  1786. this.imageMat.Clone());
  1787. model.color = pColor.ToArgb();
  1788. model.choise = true;
  1789. }
  1790. else
  1791. {
  1792. model.mat = action.PerformProcess(this.imageMat.Clone());
  1793. model.color = pColor.ToArgb();
  1794. model.choise = true;
  1795. }
  1796. }
  1797. return model;
  1798. }
  1799. #region select phase Numer
  1800. private void rb1_CheckedChanged(object sender, EventArgs e)
  1801. {
  1802. if (rb1.Checked)
  1803. {
  1804. ChangeNumber(1);
  1805. }
  1806. }
  1807. private void rb2_CheckedChanged(object sender, EventArgs e)
  1808. {
  1809. if (rb2.Checked)
  1810. {
  1811. ChangeNumber(2);
  1812. }
  1813. }
  1814. private void rb3_CheckedChanged(object sender, EventArgs e)
  1815. {
  1816. if (rb3.Checked)
  1817. {
  1818. ChangeNumber(3);
  1819. }
  1820. }
  1821. private void rb4_CheckedChanged(object sender, EventArgs e)
  1822. {
  1823. if (rb4.Checked)
  1824. {
  1825. ChangeNumber(4);
  1826. }
  1827. }
  1828. private void rb5_CheckedChanged(object sender, EventArgs e)
  1829. {
  1830. if (rb5.Checked)
  1831. {
  1832. ChangeNumber(5);
  1833. }
  1834. }
  1835. private void rb6_CheckedChanged(object sender, EventArgs e)
  1836. {
  1837. if (rb6.Checked)
  1838. {
  1839. ChangeNumber(6);
  1840. }
  1841. }
  1842. private void rb7_CheckedChanged(object sender, EventArgs e)
  1843. {
  1844. if (rb7.Checked)
  1845. {
  1846. ChangeNumber(7);
  1847. }
  1848. }
  1849. private void rb8_CheckedChanged(object sender, EventArgs e)
  1850. {
  1851. if (rb8.Checked)
  1852. {
  1853. ChangeNumber(8);
  1854. }
  1855. }
  1856. #endregion
  1857. private void listView1_SelectedIndexChanged(object sender, EventArgs e)
  1858. {
  1859. if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
  1860. {
  1861. if (!string.IsNullOrEmpty(this.selectedImg))
  1862. {
  1863. #region [保存图片参数]
  1864. PolyphaseMutiAreaContentModel model = new PolyphaseMutiAreaContentModel();
  1865. model.hasUsed = true;
  1866. model.parameter1 = xiang_num;
  1867. model.parameter12 = checkBox1.Checked;
  1868. model.parameter13 = commonControlButtons.trackBar.Value;
  1869. model.parameter2 = cb_SelectPhase.SelectedItem == null ? "" : cb_SelectPhase.SelectedItem.ToString();
  1870. if (model.parameter3 == null)
  1871. {
  1872. model.parameter3 = new List<PolyphaseData>();
  1873. }
  1874. var list = new List<PolyphaseData>();
  1875. foreach (var s in mPhaseModels)
  1876. {
  1877. PolyphaseData data = new PolyphaseData();
  1878. data.color = s.Model.color;
  1879. data.downNum = s.ColorStart;
  1880. data.upNum = s.ColorEnd;
  1881. list.Add(data);
  1882. }
  1883. model.parameter3 = list;
  1884. #region [保存物相选择]
  1885. string all = String.Empty;
  1886. if (cb1.Checked)
  1887. {
  1888. all += "1,";
  1889. }
  1890. if (cb2.Checked)
  1891. {
  1892. all += "2,";
  1893. }
  1894. if (cb3.Checked)
  1895. {
  1896. all += "3,";
  1897. }
  1898. if (cb4.Checked)
  1899. {
  1900. all += "4,";
  1901. }
  1902. if (cb5.Checked)
  1903. {
  1904. all += "5,";
  1905. }
  1906. if (cb6.Checked)
  1907. {
  1908. all += "6,";
  1909. }
  1910. if (cb7.Checked)
  1911. {
  1912. all += "7,";
  1913. }
  1914. if (cb8.Checked)
  1915. {
  1916. all += "8,";
  1917. }
  1918. model.parameter4 = all;
  1919. #endregion
  1920. model.parameter5 = checkBox10.Checked;
  1921. model.parameter6 = checkBox11.Checked;
  1922. model.parameter7 = (int)numericUpDown_KDStart.Value;
  1923. model.parameter8 = (int)numericUpDown_KDEnd.Value;
  1924. model.parameter9 = (int)numericUpDown_SXStart.Value;
  1925. model.parameter10 = (int)numericUpDown_SXEnd.Value;
  1926. model.parameter11 = (int)numericUpDown1.Value;
  1927. if (everyImgData.ContainsKey(this.selectedImg))
  1928. {
  1929. everyImgData[this.selectedImg] = model;
  1930. }
  1931. else
  1932. {
  1933. everyImgData.Add(this.selectedImg, model);
  1934. }
  1935. #endregion
  1936. }
  1937. this.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
  1938. Document document = Document.FromImageMat(imageMat.Clone());
  1939. this.documentWorkspace.Document = document;
  1940. this.documentWorkspace.Visible = true;
  1941. this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList;
  1942. #region [设置参数]
  1943. this.selectedImg = this.listView1.FocusedItem.Name;
  1944. if (everyImgData.ContainsKey(this.selectedImg)) {
  1945. var imgData = everyImgData[this.selectedImg];
  1946. #region [多相数量]
  1947. switch (imgData.parameter1)
  1948. {
  1949. case 0:
  1950. rb1.Checked = true;
  1951. break;
  1952. case 1:
  1953. rb1.Checked = true;
  1954. break;
  1955. case 2:
  1956. rb1.Checked = true;
  1957. rb2.Checked = true;
  1958. break;
  1959. case 3:
  1960. rb1.Checked = true;
  1961. rb2.Checked = true;
  1962. rb3.Checked = true;
  1963. break;
  1964. case 4:
  1965. rb1.Checked = true;
  1966. rb2.Checked = true;
  1967. rb3.Checked = true;
  1968. rb4.Checked = true;
  1969. break;
  1970. case 5:
  1971. rb1.Checked = true;
  1972. rb2.Checked = true;
  1973. rb3.Checked = true;
  1974. rb4.Checked = true;
  1975. rb5.Checked = true;
  1976. break;
  1977. case 6:
  1978. rb1.Checked = true;
  1979. rb2.Checked = true;
  1980. rb3.Checked = true;
  1981. rb4.Checked = true;
  1982. rb5.Checked = true;
  1983. rb6.Checked = true;
  1984. break;
  1985. case 7:
  1986. rb1.Checked = true;
  1987. rb2.Checked = true;
  1988. rb3.Checked = true;
  1989. rb4.Checked = true;
  1990. rb5.Checked = true;
  1991. rb6.Checked = true;
  1992. rb7.Checked = true;
  1993. break;
  1994. case 8:
  1995. rb1.Checked = true;
  1996. rb2.Checked = true;
  1997. rb3.Checked = true;
  1998. rb4.Checked = true;
  1999. rb5.Checked = true;
  2000. rb6.Checked = true;
  2001. rb7.Checked = true;
  2002. rb8.Checked = true;
  2003. break;
  2004. }
  2005. #endregion
  2006. #region [相信息]
  2007. for (int i = 0; i < imgData.parameter3.Count; i++)
  2008. {
  2009. PolyphaseData data = imgData.parameter3[i];
  2010. viewModels[i].color = data.color;
  2011. mPhaseModels[i].Model.color = data.color;
  2012. mPhaseModels[i].ColorStart = data.downNum;
  2013. mPhaseModels[i].ColorEnd = data.upNum;
  2014. cRControl.SetColor(i, Color.FromArgb(data.color));
  2015. PhaseModel thisModel = this.applyButtonImpl(Color.FromArgb(data.color), data.downNum, data.upNum);
  2016. this.documentWorkspace.phaseModels[i] = thisModel;
  2017. this.phaseModels[i] = thisModel;
  2018. }
  2019. this.documentWorkspace.Refresh();
  2020. #endregion
  2021. checkBox1.Checked = imgData.parameter12;
  2022. cb_SelectPhase.SelectedItem = imgData.parameter2;
  2023. if (cb_SelectPhase.SelectedItem != null) {
  2024. txt_phaseName.Text = cb_SelectPhase.SelectedItem.ToString();
  2025. }
  2026. commonControlButtons.trackBar.Value = imgData.parameter13;
  2027. #region [显示物相]
  2028. string[] allNum = imgData.parameter4.Split(',');
  2029. if (allNum.Contains("1"))
  2030. {
  2031. cb1.Checked = true;
  2032. }
  2033. else
  2034. {
  2035. cb1.Checked = false;
  2036. }
  2037. if (allNum.Contains("2"))
  2038. {
  2039. cb2.Checked = true;
  2040. }
  2041. else
  2042. {
  2043. cb2.Checked = false;
  2044. }
  2045. if (allNum.Contains("3"))
  2046. {
  2047. cb3.Checked = true;
  2048. }
  2049. else
  2050. {
  2051. cb3.Checked = false;
  2052. }
  2053. if (allNum.Contains("4"))
  2054. {
  2055. cb4.Checked = true;
  2056. }
  2057. else
  2058. {
  2059. cb4.Checked = false;
  2060. }
  2061. if (allNum.Contains("5"))
  2062. {
  2063. cb5.Checked = true;
  2064. }
  2065. else
  2066. {
  2067. cb5.Checked = false;
  2068. }
  2069. if (allNum.Contains("6"))
  2070. {
  2071. cb6.Checked = true;
  2072. }
  2073. else
  2074. {
  2075. cb6.Checked = false;
  2076. }
  2077. if (allNum.Contains("7"))
  2078. {
  2079. cb7.Checked = true;
  2080. }
  2081. else
  2082. {
  2083. cb7.Checked = false;
  2084. }
  2085. if (allNum.Contains("8"))
  2086. {
  2087. cb8.Checked = true;
  2088. }
  2089. else
  2090. {
  2091. cb8.Checked = false;
  2092. }
  2093. #endregion
  2094. if (imgData.parameter5)
  2095. {
  2096. checkBox10.Checked = true;
  2097. numericUpDown_KDStart.Value = imgData.parameter7;
  2098. numericUpDown_KDEnd.Value = imgData.parameter8;
  2099. }
  2100. else {
  2101. checkBox10.Checked = false;
  2102. numericUpDown_KDStart.Value = 0;
  2103. numericUpDown_KDEnd.Value = 0;
  2104. }
  2105. if (imgData.parameter6)
  2106. {
  2107. checkBox11.Checked = true;
  2108. numericUpDown_SXStart.Value = imgData.parameter9;
  2109. numericUpDown_SXEnd.Value = imgData.parameter10;
  2110. }
  2111. else
  2112. {
  2113. checkBox11.Checked = false;
  2114. numericUpDown_SXStart.Value = 0;
  2115. numericUpDown_SXEnd.Value = 0;
  2116. }
  2117. numericUpDown1.Value = imgData.parameter11;
  2118. if (cb_SelectPhase.SelectedIndex == -1)
  2119. {
  2120. showParams(mPhaseModels[0]);
  2121. }
  2122. else
  2123. {
  2124. showParams(mPhaseModels[cb_SelectPhase.SelectedIndex]);
  2125. }
  2126. }
  2127. #endregion
  2128. this.orginPhaseModels.Clear();
  2129. groupBox2.Enabled = true;
  2130. }
  2131. }
  2132. private void panel2_Click(object sender, EventArgs e)
  2133. {
  2134. this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
  2135. this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
  2136. this.colorsFormGrid.ShowDialog();
  2137. }
  2138. /// <summary>
  2139. /// Panel2的调色板颜色改变
  2140. /// </summary>
  2141. /// <param name="sender"></param>
  2142. /// <param name="e"></param>
  2143. private void gridColorChanged(object sender, EventArgs e)
  2144. {
  2145. Color color = this.colorsFormGrid.UserPrimaryColor.ToColor();
  2146. //先修改参数
  2147. foreach (Args args in action.Lists)
  2148. {
  2149. if (args.Key == "phaseColor")
  2150. {
  2151. args.Value = color.ToArgb();
  2152. break;
  2153. }
  2154. }
  2155. //更改背景色,触发事件
  2156. this.panel2.BackColor = color;
  2157. //改变配置文件里面的相颜色
  2158. //this.binaryExtractionModel.PhaseColor = color.ToArgb();
  2159. //关闭色板
  2160. RangeColor active = rangeColors[selectIndex];
  2161. active.Color = color;
  2162. rangeColors[selectIndex] = active;
  2163. this.cRControl.RangeColors = rangeColors;
  2164. this.cRControl.Refresh();
  2165. PhaseModel model = this.applyButtonImpl(Color.FromArgb(color.ToArgb()), (int)numericUpDown_RangeStart.Value, (int)numericUpDown_RangeEnd.Value);
  2166. model.name = this.cb_SelectPhase.Items[selectIndex].ToString();
  2167. this.documentWorkspace.phaseModels[selectIndex] = model;
  2168. mPhaseModels[selectIndex].Model = model;
  2169. mPhaseModels[selectIndex].Model.color = color.ToArgb();
  2170. this.phaseModels[selectIndex] = model;
  2171. this.documentWorkspace.Refresh();
  2172. this.colorsFormGrid.Close();
  2173. }
  2174. private void ChangePhaseVisable(int num)
  2175. {
  2176. foreach (Control ctrl in this.groupBox2.Controls) //遍历窗体中的所有控件,Control是所有控件的基类
  2177. {
  2178. if (ctrl.GetType().Name == "CheckBox") //判断是否为CheckBox
  2179. {
  2180. if (ctrl.Name.Equals("cb" + num))
  2181. {
  2182. CheckBox cBox = (CheckBox)ctrl; //创建CheckBox对象
  2183. if (viewModels.Count >= num)
  2184. {
  2185. if (cBox.Checked)
  2186. {
  2187. viewModels[num-1].choise = true;
  2188. phaseModels[num - 1].choise = true;
  2189. }
  2190. else
  2191. {
  2192. viewModels[num-1].choise = false;
  2193. phaseModels[num - 1].choise = false;
  2194. }
  2195. }
  2196. }
  2197. }
  2198. }
  2199. this.documentWorkspace.phaseModels = viewModels;
  2200. this.documentWorkspace.Refresh();
  2201. }
  2202. private void cb1_CheckedChanged(object sender, EventArgs e)
  2203. {
  2204. ChangePhaseVisable(1);
  2205. }
  2206. private void cb2_CheckedChanged(object sender, EventArgs e)
  2207. {
  2208. ChangePhaseVisable(2);
  2209. }
  2210. private void cb3_CheckedChanged(object sender, EventArgs e)
  2211. {
  2212. ChangePhaseVisable(3);
  2213. }
  2214. private void cb4_CheckedChanged(object sender, EventArgs e)
  2215. {
  2216. ChangePhaseVisable(4);
  2217. }
  2218. private void cb5_CheckedChanged(object sender, EventArgs e)
  2219. {
  2220. ChangePhaseVisable(5);
  2221. }
  2222. private void cb6_CheckedChanged(object sender, EventArgs e)
  2223. {
  2224. ChangePhaseVisable(6);
  2225. }
  2226. private void cb7_CheckedChanged(object sender, EventArgs e)
  2227. {
  2228. ChangePhaseVisable(7);
  2229. }
  2230. private void cb8_CheckedChanged(object sender, EventArgs e)
  2231. {
  2232. ChangePhaseVisable(8);
  2233. }
  2234. private void cb_SelectPhase_SelectedIndexChanged(object sender, EventArgs e)
  2235. {
  2236. selectIndex = cb_SelectPhase.SelectedIndex;
  2237. this.cRControl.SelectIndex = cb_SelectPhase.SelectedIndex;
  2238. if (selectIndex != -1)
  2239. {
  2240. txt_phaseName.Text = mPhaseModels[selectIndex].Model.name;
  2241. numericUpDown_RangeStart.Value = mPhaseModels[selectIndex].ColorStart;
  2242. numericUpDown_RangeEnd.Value = mPhaseModels[selectIndex].ColorEnd;
  2243. panel2.BackColor = Color.FromArgb(mPhaseModels[selectIndex].Model.color);
  2244. }
  2245. }
  2246. private void showParams(MutiPolyphaseModel model)
  2247. {
  2248. if (cb_SelectPhase.SelectedIndex == -1) {
  2249. txt_phaseName.Text = model.Model.name;
  2250. }
  2251. numericUpDown_RangeStart.Value = model.ColorStart;
  2252. numericUpDown_RangeEnd.Value = model.ColorEnd;
  2253. panel2.BackColor = Color.FromArgb(model.Model.color);
  2254. }
  2255. private void button2_Click(object sender, EventArgs e)
  2256. {
  2257. if (listView1.SelectedItems.Count==0)
  2258. {
  2259. MessageBox.Show(PdnResources.GetString("Menu.seselecttheimagethatyouwanttoan.Text")+"!");
  2260. return;
  2261. }
  2262. double pxPerUnit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
  2263. String tag = listView1.FocusedItem.Text;
  2264. List<Bitmap> tempBit = new List<Bitmap>();
  2265. if (listView1.FocusedItem != null)
  2266. {
  2267. if (mainPolyphaseAnalysisResults.FindAll(item => item.GraphName.Equals(listView1.FocusedItem.Text)).Count == 0)
  2268. {
  2269. listBox_analysisResult.Items.Add(this.listView1.FocusedItem.Text);
  2270. listBox_analysisResult.SetItemChecked(listBox_analysisResult.Items.Count - 1, true);
  2271. }
  2272. else
  2273. {
  2274. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theresuethertoreplace.text")+"?", PdnResources.GetString("Form.OkButton.Text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  2275. if (dr != DialogResult.OK)
  2276. {
  2277. return;
  2278. }
  2279. mainPolyphaseAnalysisResults.RemoveAll(item => item.GraphName.Equals(listView1.FocusedItem.Text));
  2280. viewPolyphaseAnalysisResults.RemoveAll(item => item.GraphName.Equals(listView1.FocusedItem.Text));
  2281. List<string> list = new List<string>();
  2282. foreach (var s in this.listBox_analysisResult.Items)
  2283. {
  2284. list.Add(s.ToString());
  2285. }
  2286. this.listBox_analysisResult.Items.Clear();
  2287. foreach (var s in list)
  2288. {
  2289. this.listBox_analysisResult.Items.Add(s);
  2290. }
  2291. var thisindex = this.listBox_analysisResult.Items.IndexOf(listView1.FocusedItem.Text);
  2292. this.listBox_analysisResult.SetItemChecked(thisindex, false);
  2293. this.listBox_analysisResult_SelectedIndexChanged(sender, e);
  2294. listBox_analysisResult.SetItemChecked(thisindex, true);
  2295. }
  2296. }else
  2297. {
  2298. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  2299. return;
  2300. }
  2301. if (this.documentWorkspace.GraphicsList.IsExsitView())
  2302. {
  2303. for (int i = 0; i < this.documentWorkspace.phaseModels.Count; i++)
  2304. {
  2305. PhaseModel pModel = this.documentWorkspace.phaseModels[i];
  2306. //if (pModel.choise)
  2307. //{
  2308. Color pColor = new Color();
  2309. pColor = Color.FromArgb(pModel.color);
  2310. Mat front = pModel.mat;
  2311. int phaseAmount = AnalysisTools.GetPointsFromMat(front);
  2312. Bitmap frontTarget = this.documentWorkspace.GetFullSizeWithRegion(front.ToBitmap());
  2313. //获取相的点合计
  2314. int frontAmount = AnalysisTools.GetPointsFromMat(PaintDotNet.Camera.Tools.ToMat(frontTarget));
  2315. Mat background = this.imageMat.Clone();
  2316. Mat roi = new Mat(background, new Rect(0, 0, background.Width, background.Height));
  2317. Mat mask = Mat.FromImageData(front.ToBytes(), ImreadModes.Grayscale);
  2318. front.CopyTo(roi, mask);
  2319. Bitmap target = this.documentWorkspace.GetFullSizeWithRegion(background.ToBitmap());
  2320. Mat targetMat = PaintDotNet.Camera.Tools.ToMat(target);
  2321. //获取合并后视场内的点合计
  2322. int allAmount = AnalysisTools.GetPointsFromMat(targetMat);
  2323. int picAmount = AnalysisTools.GetPointsFromMat(background);
  2324. double cRate = 0f;
  2325. //计算比例
  2326. //视场内部存在相
  2327. if (frontAmount > 0)
  2328. {
  2329. cRate = (double)frontAmount / allAmount;
  2330. }
  2331. else
  2332. {
  2333. //视场内部不存在相
  2334. cRate = (double)phaseAmount / allAmount;
  2335. }
  2336. //计算面积
  2337. double cArea = phaseAmount;
  2338. //计算相含量
  2339. double fRate = (double)phaseAmount / picAmount;
  2340. PolyphaseAnalysisResult pResult = new PolyphaseAnalysisResult();
  2341. pResult.GraphName = this.listView1.FocusedItem.Text;
  2342. pResult.PolyphaseName = mPhaseModels[i].Model.name;
  2343. pResult.PolyphaseArea = cArea * pxPerUnit * pxPerUnit;
  2344. pResult.PolyphaseRate = cRate * 100;
  2345. pResult.PolyphaseAllRate = fRate * 100;
  2346. mainPolyphaseAnalysisResults.Add(pResult);
  2347. viewPolyphaseAnalysisResults.Add(pResult);
  2348. }
  2349. }
  2350. else
  2351. {
  2352. for (int i = 0; i < this.documentWorkspace.phaseModels.Count; i++)
  2353. {
  2354. PhaseModel pModel = this.documentWorkspace.phaseModels[i];
  2355. Color pColor = new Color();
  2356. pColor = Color.FromArgb(pModel.color);
  2357. int phaseArea = AnalysisTools.GetPointsFromMat(pModel.mat);
  2358. Mat sourceMat = this.imageMat.Clone();
  2359. int picAmount = AnalysisTools.GetPointsFromMat(sourceMat);
  2360. //计算面积
  2361. double cRate = (double)phaseArea / picAmount;
  2362. PolyphaseAnalysisResult pResult = new PolyphaseAnalysisResult();
  2363. pResult.GraphName = this.listView1.FocusedItem.Text;
  2364. pResult.PolyphaseName = mPhaseModels[i].Model.name;
  2365. pResult.PolyphaseArea = phaseArea * pxPerUnit * pxPerUnit;
  2366. pResult.PolyphaseRate = cRate * 100;
  2367. pResult.PolyphaseAllRate = cRate * 100;
  2368. mainPolyphaseAnalysisResults.Add(pResult);
  2369. viewPolyphaseAnalysisResults.Add(pResult);
  2370. }
  2371. }
  2372. List<PolyphaseAnalysisResult> selectItems = mainPolyphaseAnalysisResults.FindAll(u => u.GraphName == listView1.FocusedItem.Text);
  2373. for (int i = 0; i < selectItems.Count; i++)
  2374. {
  2375. PolyphaseAnalysisResult pResult = selectItems[i];
  2376. dataGridView_results.Rows.Add(pResult.GraphName, pResult.PolyphaseName, AnalysisTools.GetDecNum(pResult.PolyphaseArea, decnum), AnalysisTools.GetDecNum(pResult.PolyphaseRate, decnum), AnalysisTools.GetDecNum(pResult.PolyphaseAllRate, decnum));
  2377. }
  2378. for (int i = 0; i < this.documentWorkspace.phaseModels.Count; i++) {
  2379. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  2380. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  2381. originalBit.Tag = pantographRatio;
  2382. if (i == 0) {
  2383. tempBit.Add(originalBit);
  2384. }
  2385. Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2386. Graphics graphics = Graphics.FromImage(newBit);
  2387. Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.phaseModels[i].mat);
  2388. graphics.DrawImage(processedBit, new PointF(0, 0));
  2389. newBit.Tag = pantographRatio;
  2390. tempBit.Add(newBit);
  2391. }
  2392. if (bitDic.ContainsKey(tag))
  2393. {
  2394. bitDic[tag].Clear();
  2395. bitDic[tag] = tempBit;
  2396. }
  2397. else
  2398. {
  2399. bitDic.Add(tag, tempBit);
  2400. }
  2401. }
  2402. private void But_DeleteKD_Click(object sender, EventArgs e)
  2403. {
  2404. if (checkBox10.Checked)
  2405. {
  2406. KDDelete(Color.White);
  2407. }
  2408. }
  2409. private void But_DeleteSX_Click(object sender, EventArgs e)
  2410. {
  2411. if (checkBox11.Checked)
  2412. {
  2413. SXDelete();
  2414. }
  2415. }
  2416. private void numericUpDown_RangeStart_ValueChanged(object sender, EventArgs e)
  2417. {
  2418. this.selectIndex = this.cRControl.SelectIndex;
  2419. if (selectIndex == -1) {
  2420. return;
  2421. }
  2422. if (selectIndex != 0) {
  2423. this.rangeColors[selectIndex - 1].End = (int)numericUpDown_RangeStart.Value - 1;
  2424. this.mPhaseModels[selectIndex - 1].ColorEnd = (int)numericUpDown_RangeStart.Value - 1;
  2425. }
  2426. this.rangeColors[selectIndex].Start = (int)numericUpDown_RangeStart.Value;
  2427. this.mPhaseModels[selectIndex].ColorStart = (int)numericUpDown_RangeStart.Value;
  2428. this.cRControl.RangeColors = this.rangeColors;
  2429. this.cRControl.Refresh();
  2430. PhaseModel model = this.applyButtonImpl(Color.FromArgb(mPhaseModels[selectIndex].Model.color), (int)numericUpDown_RangeStart.Value, (int)numericUpDown_RangeEnd.Value);
  2431. this.documentWorkspace.phaseModels[selectIndex] = model;
  2432. this.documentWorkspace.Refresh();
  2433. }
  2434. private void numericUpDown_RangeEnd_ValueChanged(object sender, EventArgs e)
  2435. {
  2436. this.selectIndex = this.cRControl.SelectIndex;
  2437. if (selectIndex == -1)
  2438. {
  2439. return;
  2440. }
  2441. PhaseModel model = this.applyButtonImpl(Color.FromArgb(mPhaseModels[selectIndex].Model.color), (int)numericUpDown_RangeStart.Value, (int)numericUpDown_RangeEnd.Value);
  2442. if ((selectIndex-1)>=0)
  2443. {
  2444. this.rangeColors[selectIndex - 1].End = (int)this.rangeColors[selectIndex].Start - 1;
  2445. this.mPhaseModels[selectIndex-1].ColorEnd = (int)this.rangeColors[selectIndex].Start - 1;
  2446. }
  2447. this.rangeColors[selectIndex].Start = (int)numericUpDown_RangeStart.Value;
  2448. this.rangeColors[selectIndex].End = (int)numericUpDown_RangeEnd.Value;
  2449. this.mPhaseModels[selectIndex].ColorStart = (int)numericUpDown_RangeStart.Value;
  2450. this.mPhaseModels[selectIndex].ColorEnd = (int)numericUpDown_RangeEnd.Value;
  2451. if (this.rangeColors.Count > (selectIndex + 1))
  2452. {
  2453. this.rangeColors[selectIndex + 1].Start = (int)this.rangeColors[selectIndex].End + 1;
  2454. this.mPhaseModels[selectIndex + 1].ColorStart = (int)this.rangeColors[selectIndex].End + 1;
  2455. }
  2456. this.cRControl.RangeColors = this.rangeColors;
  2457. this.cRControl.Refresh();
  2458. this.documentWorkspace.phaseModels[selectIndex] = model;
  2459. this.documentWorkspace.Refresh();
  2460. }
  2461. private void button_all_Click(object sender, EventArgs e)
  2462. {
  2463. dataGridView_results.Rows.Clear();
  2464. if (this.is_all % 2 == 0)
  2465. {
  2466. for (int i = 0; i < listBox_analysisResult.Items.Count; i++)
  2467. {
  2468. listBox_analysisResult.SetItemChecked(i, false);
  2469. }
  2470. }
  2471. else
  2472. {
  2473. for (int i = 0; i < listBox_analysisResult.Items.Count; i++)
  2474. {
  2475. listBox_analysisResult.SetItemChecked(i, true);
  2476. }
  2477. viewPolyphaseAnalysisResults.Clear();
  2478. viewPolyphaseAnalysisResults.AddRange(mainPolyphaseAnalysisResults);
  2479. for (int i = 0; i < viewPolyphaseAnalysisResults.Count; i++)
  2480. {
  2481. PolyphaseAnalysisResult pResult = viewPolyphaseAnalysisResults[i];
  2482. dataGridView_results.Rows.Add(pResult.GraphName, pResult.PolyphaseName, AnalysisTools.GetDecNum(pResult.PolyphaseArea, decnum), AnalysisTools.GetDecNum(pResult.PolyphaseRate, decnum), AnalysisTools.GetDecNum(pResult.PolyphaseAllRate, decnum));
  2483. }
  2484. }
  2485. this.is_all += 1;
  2486. }
  2487. private void button_remove_Click(object sender, EventArgs e)
  2488. {
  2489. var removeList = new List<string>();
  2490. if (listBox_analysisResult.CheckedItems != null && listBox_analysisResult.CheckedItems.Count > 0)
  2491. {
  2492. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.ertodeletetheselectedanalysisres.Text")+"?", PdnResources.GetString("Menu.Edit.Delete.Text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  2493. if (dr == DialogResult.OK)
  2494. {
  2495. dataGridView_results.Rows.Clear();
  2496. foreach (var s in listBox_analysisResult.CheckedItems)
  2497. {
  2498. mainPolyphaseAnalysisResults.RemoveAll(u => u.GraphName == s.ToString());
  2499. viewPolyphaseAnalysisResults.RemoveAll(u => u.GraphName == s.ToString());
  2500. removeList.Add(s.ToString());
  2501. }
  2502. for (int i = 0; i < viewPolyphaseAnalysisResults.Count; i++)
  2503. {
  2504. PolyphaseAnalysisResult pResult = viewPolyphaseAnalysisResults[i];
  2505. dataGridView_results.Rows.Add(pResult.GraphName, pResult.PolyphaseName, AnalysisTools.GetDecNum(pResult.PolyphaseArea, decnum), AnalysisTools.GetDecNum(pResult.PolyphaseRate, decnum), AnalysisTools.GetDecNum(pResult.PolyphaseAllRate, decnum));
  2506. }
  2507. foreach (var m in removeList)
  2508. {
  2509. listBox_analysisResult.Items.Remove(m);
  2510. }
  2511. }
  2512. }
  2513. else
  2514. {
  2515. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagetodelete.Text")+"!");
  2516. }
  2517. }
  2518. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  2519. {
  2520. decnum = (int)numericUpDown1.Value;
  2521. dataGridView_results.Rows.Clear();
  2522. for (int i = 0; i < viewPolyphaseAnalysisResults.Count; i++)
  2523. {
  2524. PolyphaseAnalysisResult pResult = viewPolyphaseAnalysisResults[i];
  2525. dataGridView_results.Rows.Add(pResult.GraphName, pResult.PolyphaseName, AnalysisTools.GetDecNum(pResult.PolyphaseArea,decnum), AnalysisTools.GetDecNum(pResult.PolyphaseRate, decnum), AnalysisTools.GetDecNum(pResult.PolyphaseAllRate, decnum));
  2526. }
  2527. }
  2528. private void KDDelete(Color color)
  2529. {
  2530. //double pxPerUnit = Startup.instance.rules[MeasurementUnit.Micron];
  2531. if (this.listView1.FocusedItem == null) {
  2532. return;
  2533. }
  2534. double pxPerUnit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
  2535. List<PhaseModel> phases = this.phaseModels.FindAll(a => a.choise == true);
  2536. foreach (Args args in action914.Lists)
  2537. {
  2538. if (args.Key == "Scope")
  2539. {
  2540. ((List<double>)args.Value)[0] = (double)numericUpDown_KDStart.Value;
  2541. ((List<double>)args.Value)[1] = (double)numericUpDown_KDEnd.Value;
  2542. }
  2543. if (args.Key == "HoleColor")
  2544. {
  2545. args.Value = color.ToArgb();
  2546. }
  2547. }
  2548. List<PhaseModel> phasesCopy = this.viewModels.FindAll(a => a.choise == true);
  2549. for (int i = 0; i < phases.Count; i++)
  2550. {
  2551. PhaseModel model = new PhaseModel();
  2552. model.choise = phases[i].choise;
  2553. model.color = phases[i].color;
  2554. model.name = phases[i].name;
  2555. model.position = phases[i].position;
  2556. model.mat = new OpenCvSharp.Mat();
  2557. phases[i].mat.CopyTo(model.mat);
  2558. phasesCopy[i].mat = action914.PerformProcess(model, pxPerUnit);
  2559. }
  2560. this.documentWorkspace.Refresh();
  2561. }
  2562. private void SXDelete()
  2563. {
  2564. //double pxPerUnit = Startup.instance.rules[MeasurementUnit.Micron];
  2565. if (this.listView1.FocusedItem == null)
  2566. {
  2567. return;
  2568. }
  2569. double pxPerUnit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
  2570. foreach (Args args in action911.Lists)
  2571. {
  2572. if (args.Key == "FilterParameters")
  2573. {
  2574. args.Value = FilterParameters.Area;
  2575. }
  2576. if (args.Key == "Scope")
  2577. {
  2578. ((List<double>)args.Value)[0] = (double)numericUpDown_SXStart.Value;
  2579. ((List<double>)args.Value)[1] = (double)numericUpDown_SXEnd.Value;
  2580. }
  2581. if (args.Key == "UnitParameters")
  2582. {
  2583. args.Value = MeasurementUnit.Micron;
  2584. }
  2585. if (args.Key == "BoundaryPreservation")
  2586. {
  2587. args.Value = true;
  2588. }
  2589. }
  2590. //this.orginPhaseModels.Clear();
  2591. if (orginPhaseModels.Count == 0)
  2592. {
  2593. foreach (var s in mPhaseModels)
  2594. {
  2595. var phaseCopy = new PhaseModel();
  2596. phaseCopy.mat = s.Model.mat.Clone();
  2597. phaseCopy.color = s.Model.color;
  2598. phaseCopy.choise = s.Model.choise;
  2599. phaseCopy.name = s.Model.name;
  2600. orginPhaseModels.Add(phaseCopy);
  2601. }
  2602. }
  2603. else {
  2604. if (orginPhaseModels.Count < mPhaseModels.Count)
  2605. {
  2606. for (int i = 0; i < mPhaseModels.Count; i++) {
  2607. if (i >= orginPhaseModels.Count)
  2608. {
  2609. var phaseCopy = new PhaseModel();
  2610. phaseCopy.mat = mPhaseModels[i].Model.mat.Clone();
  2611. phaseCopy.color = mPhaseModels[i].Model.color;
  2612. phaseCopy.choise = mPhaseModels[i].Model.choise;
  2613. phaseCopy.name = mPhaseModels[i].Model.name;
  2614. orginPhaseModels.Add(phaseCopy);
  2615. }
  2616. else {
  2617. PhaseModel model = this.applyButtonImpl(Color.FromArgb(mPhaseModels[i].Model.color), mPhaseModels[i].ColorStart, mPhaseModels[i].ColorEnd);
  2618. orginPhaseModels[i].mat = model.mat;
  2619. orginPhaseModels[i].color = mPhaseModels[i].Model.color;
  2620. }
  2621. }
  2622. }
  2623. else if (orginPhaseModels.Count == mPhaseModels.Count)
  2624. {
  2625. for (int i = 0; i < mPhaseModels.Count; i++)
  2626. {
  2627. PhaseModel model = this.applyButtonImpl(Color.FromArgb(mPhaseModels[i].Model.color), mPhaseModels[i].ColorStart, mPhaseModels[i].ColorEnd);
  2628. orginPhaseModels[i].mat = model.mat;
  2629. orginPhaseModels[i].color = mPhaseModels[i].Model.color;
  2630. }
  2631. }
  2632. else {
  2633. for (int i = 0; i < mPhaseModels.Count; i++)
  2634. {
  2635. PhaseModel model = this.applyButtonImpl(Color.FromArgb(mPhaseModels[i].Model.color), mPhaseModels[i].ColorStart, mPhaseModels[i].ColorEnd);
  2636. orginPhaseModels[i].mat = model.mat;
  2637. orginPhaseModels[i].color = mPhaseModels[i].Model.color;
  2638. }
  2639. }
  2640. }
  2641. //foreach (var s in mPhaseModels)
  2642. //{
  2643. // var phaseCopy = new PhaseModel();
  2644. // phaseCopy.mat = s.Model.mat.Clone();
  2645. // phaseCopy.color = s.Model.color;
  2646. // phaseCopy.choise = s.Model.choise;
  2647. // phaseCopy.name = s.Model.name;
  2648. // orginPhaseModels.Add(phaseCopy);
  2649. //}
  2650. for (int i = 0; i < documentWorkspace.phaseModels.Count; i++)
  2651. {
  2652. this.documentWorkspace.phaseModels[i].mat = action911.PerformProcess(orginPhaseModels[i], pxPerUnit);
  2653. };
  2654. this.documentWorkspace.Refresh();
  2655. }
  2656. private void listBox_analysisResult_SelectedIndexChanged(object sender, EventArgs e)
  2657. {
  2658. dataGridView_results.Rows.Clear();
  2659. if (listBox_analysisResult.CheckedItems != null && listBox_analysisResult.CheckedItems.Count > 0)
  2660. {
  2661. foreach (var s in listBox_analysisResult.CheckedItems)
  2662. {
  2663. List<PolyphaseAnalysisResult> selectItems = mainPolyphaseAnalysisResults.FindAll(u => u.GraphName == s.ToString());
  2664. viewPolyphaseAnalysisResults.Clear();
  2665. viewPolyphaseAnalysisResults.AddRange(selectItems);
  2666. for (int i = 0; i < viewPolyphaseAnalysisResults.Count; i++)
  2667. {
  2668. PolyphaseAnalysisResult pResult = viewPolyphaseAnalysisResults[i];
  2669. dataGridView_results.Rows.Add(pResult.GraphName, pResult.PolyphaseName, AnalysisTools.GetDecNum(pResult.PolyphaseArea, decnum), AnalysisTools.GetDecNum(pResult.PolyphaseRate, decnum), AnalysisTools.GetDecNum(pResult.PolyphaseAllRate, decnum));
  2670. }
  2671. }
  2672. }
  2673. }
  2674. private void btn_close_Click(object sender, EventArgs e)
  2675. {
  2676. this.Close();
  2677. }
  2678. private void button4_Click(object sender, EventArgs e)
  2679. {
  2680. if (this.dataGridView_results.Rows.Count > 0)
  2681. {
  2682. SaveFileDialog exe = new SaveFileDialog();
  2683. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  2684. exe.FilterIndex = 0;
  2685. exe.RestoreDirectory = true;
  2686. exe.Title = "Export Excel File";
  2687. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  2688. exe.FileName = PdnResources.GetString("Menu.GeneralAnalysis.MultiphaseContent.Text")+ PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddhhmmss");
  2689. DialogResult dr = exe.ShowDialog();
  2690. if (dr == DialogResult.OK)
  2691. {
  2692. DataTable dtb = new DataTable();
  2693. foreach (DataGridViewColumn c in this.dataGridView_results.Columns)
  2694. {
  2695. dtb.Columns.Add(c.HeaderText);
  2696. }
  2697. for (int r = 0; r < this.dataGridView_results.Rows.Count; r++)
  2698. {
  2699. DataRow dataRow = dtb.NewRow();
  2700. for (int c = 0; c < this.dataGridView_results.Rows[r].Cells.Count; c++)
  2701. {
  2702. dataRow[this.dataGridView_results.Columns[c].HeaderText] = this.dataGridView_results.Rows[r].Cells[c].Value;
  2703. }
  2704. dtb.Rows.Add(dataRow);
  2705. }
  2706. List<DataTable> list = new List<DataTable>();
  2707. list.Add(dtb);
  2708. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
  2709. }
  2710. }
  2711. else
  2712. {
  2713. MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
  2714. }
  2715. }
  2716. private void button5_Click(object sender, EventArgs e)
  2717. {
  2718. foreach (Control ctrl in this.groupBox2.Controls) //遍历窗体中的所有控件,Control是所有控件的基类
  2719. {
  2720. if (ctrl.GetType().Name == "CheckBox") //判断是否为CheckBox
  2721. {
  2722. if (ctrl.Name.Contains("cb"))
  2723. {
  2724. CheckBox cBox = (CheckBox)ctrl; //创建CheckBox对象
  2725. cBox.Checked = true;
  2726. }
  2727. }
  2728. }
  2729. foreach (PhaseModel ph in this.documentWorkspace.phaseModels)
  2730. {
  2731. ph.choise = true;
  2732. }
  2733. this.documentWorkspace.phaseModels = phaseModels;
  2734. this.documentWorkspace.Refresh();
  2735. }
  2736. private void button6_Click(object sender, EventArgs e)
  2737. {
  2738. foreach (Control ctrl in this.groupBox2.Controls) //遍历窗体中的所有控件,Control是所有控件的基类
  2739. {
  2740. if (ctrl.GetType().Name == "CheckBox") //判断是否为CheckBox
  2741. {
  2742. if (ctrl.Name.Contains("cb"))
  2743. {
  2744. CheckBox cBox = (CheckBox)ctrl; //创建CheckBox对象
  2745. cBox.Checked = false;
  2746. }
  2747. }
  2748. }
  2749. foreach (PhaseModel ph in this.documentWorkspace.phaseModels)
  2750. {
  2751. ph.choise = false;
  2752. }
  2753. this.documentWorkspace.phaseModels = phaseModels;
  2754. this.documentWorkspace.Refresh();
  2755. }
  2756. private void checkBox11_CheckedChanged(object sender, EventArgs e)
  2757. {
  2758. if (checkBox11.Checked)
  2759. {
  2760. //SXDelete();
  2761. }else
  2762. {
  2763. numericUpDown_SXStart.Value = 0;
  2764. numericUpDown_SXEnd.Value = 0;
  2765. List<PhaseModel> phases = this.phaseModels.FindAll(a => a.choise == true);
  2766. List<PhaseModel> phasesCopy = this.viewModels.FindAll(a => a.choise == true);
  2767. for (int i = 0; i < phases.Count; i++)
  2768. {
  2769. PhaseModel model = new PhaseModel();
  2770. model.choise = phases[i].choise;
  2771. model.color = phases[i].color;
  2772. model.name = phases[i].name;
  2773. model.position = phases[i].position;
  2774. model.mat = new OpenCvSharp.Mat();
  2775. phases[i].mat.CopyTo(model.mat);
  2776. phasesCopy[i].mat = model.mat;
  2777. }
  2778. this.documentWorkspace.phaseModels = this.viewModels;
  2779. TrackBar_ValueChanged(null, null);
  2780. this.documentWorkspace.Refresh();
  2781. }
  2782. }
  2783. private void checkBox10_CheckedChanged(object sender, EventArgs e)
  2784. {
  2785. if (checkBox10.Checked)
  2786. {
  2787. KDDelete(Color.White);
  2788. }
  2789. else
  2790. {
  2791. numericUpDown_KDStart.Value = 0;
  2792. numericUpDown_KDEnd.Value = 0;
  2793. List<PhaseModel> phases = this.phaseModels.FindAll(a => a.choise == true);
  2794. List<PhaseModel> phasesCopy = this.viewModels.FindAll(a => a.choise == true);
  2795. for (int i = 0; i < phases.Count; i++)
  2796. {
  2797. PhaseModel model = new PhaseModel();
  2798. model.choise = phases[i].choise;
  2799. model.color = phases[i].color;
  2800. model.name = phases[i].name;
  2801. model.position = phases[i].position;
  2802. model.mat = new OpenCvSharp.Mat();
  2803. phases[i].mat.CopyTo(model.mat);
  2804. phasesCopy[i].mat = model.mat;
  2805. }
  2806. this.documentWorkspace.phaseModels = this.viewModels;
  2807. TrackBar_ValueChanged(null, null);
  2808. this.documentWorkspace.Refresh();
  2809. }
  2810. }
  2811. private void Draw(Graphics graphics)
  2812. {
  2813. if (this.documentWorkspace.phaseModels.Count > 0)
  2814. {
  2815. foreach (PhaseModel model in phaseModels)
  2816. {
  2817. if (model.choise && model.mat != null)
  2818. {
  2819. Bitmap map = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(model.mat);
  2820. graphics.DrawImage(map, 0, 0, map.Width, map.Height);
  2821. }
  2822. }
  2823. }
  2824. }
  2825. private void button1_Click(object sender, EventArgs e)
  2826. {
  2827. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item2.PolyphaseMutiAreaContent");
  2828. if (recombinationRateSetDialog.hasModule)
  2829. {
  2830. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  2831. recombinationRateSetDialog.ShowDialog();
  2832. }
  2833. else
  2834. {
  2835. recombinationRateSetDialog = null;
  2836. }
  2837. }
  2838. private void button3_Click(object sender, EventArgs e)
  2839. {
  2840. bitList.Clear();
  2841. if (checkBox1.Checked)
  2842. {
  2843. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item2.PolyphaseMutiAreaContent");
  2844. if (recombinationRateSetDialog.hasModule)
  2845. {
  2846. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  2847. recombinationRateSetDialog.ShowDialog();
  2848. }
  2849. else
  2850. {
  2851. recombinationRateSetDialog = null;
  2852. }
  2853. }
  2854. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  2855. {
  2856. //获取word书签与excel单元格的关系,以字典方式存储
  2857. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  2858. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  2859. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2860. {
  2861. foreach (mic_module_infos info in mic_module_infos)
  2862. {
  2863. tagInfos.Add(info.tag_name, info.cell_position);
  2864. }
  2865. }
  2866. List<List<string>> analysisContent = new List<List<string>>();
  2867. List<string> nameList = new List<string>();
  2868. for (int i = 0; i < this.dataGridView_results.Rows.Count; i++)
  2869. {
  2870. List<string> content1 = new List<string>();
  2871. if (i == 0)
  2872. {
  2873. content1.Add(this.dataGridView_results.Columns[0].HeaderText);
  2874. content1.Add(this.dataGridView_results.Columns[1].HeaderText);
  2875. content1.Add(this.dataGridView_results.Columns[2].HeaderText);
  2876. content1.Add(this.dataGridView_results.Columns[3].HeaderText);
  2877. content1.Add(this.dataGridView_results.Columns[4].HeaderText);
  2878. analysisContent.Add(content1);
  2879. }
  2880. content1 = new List<string>();
  2881. content1.Add(this.dataGridView_results.Rows[i].Cells[0].Value.ToString());
  2882. content1.Add(this.dataGridView_results.Rows[i].Cells[1].Value.ToString());
  2883. content1.Add(this.dataGridView_results.Rows[i].Cells[2].Value.ToString());
  2884. content1.Add(this.dataGridView_results.Rows[i].Cells[3].Value.ToString());
  2885. content1.Add(this.dataGridView_results.Rows[i].Cells[4].Value.ToString());
  2886. analysisContent.Add(content1);
  2887. string tag = this.dataGridView_results.Rows[i].Cells[0].Value.ToString();
  2888. if (nameList.IndexOf(tag) == -1)
  2889. {
  2890. nameList.Add(tag);
  2891. }
  2892. }
  2893. foreach (var s in nameList)
  2894. {
  2895. if (bitDic.ContainsKey(s))
  2896. {
  2897. foreach (var m in bitDic[s])
  2898. {
  2899. bitList.Add(bitDic[s][bitDic[s].IndexOf(m)]);
  2900. }
  2901. }
  2902. }
  2903. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  2904. }
  2905. else
  2906. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  2907. }
  2908. private void numericUpDown_RangeStart_KeyUp(object sender, KeyEventArgs e)
  2909. {
  2910. numericUpDown_RangeStart.Value = numericUpDown_RangeStart.Value;
  2911. }
  2912. private void numericUpDown_RangeEnd_KeyUp(object sender, KeyEventArgs e)
  2913. {
  2914. numericUpDown_RangeEnd.Value = numericUpDown_RangeEnd.Value;
  2915. }
  2916. private void button9_Click(object sender, EventArgs e)
  2917. {
  2918. if (this.dataGridView_results.Rows.Count == 0)
  2919. {
  2920. MessageBox.Show(PdnResources.GetString("Menu.Noresults.text"));
  2921. return;
  2922. }
  2923. if (this.analyzeSettingModel == null)
  2924. {
  2925. MessageBox.Show(PdnResources.GetString("Menu.Pleasesetiirst.Text"));
  2926. return;
  2927. }
  2928. //获取项目工程内的文件夹路径
  2929. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.GeneralAnalysis.MultiphaseContent.Text", this.analyzeSettingModel.savePath);
  2930. if (item != null)
  2931. {
  2932. //向文件夹内保存图片和报告
  2933. if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  2934. {
  2935. //获取word书签与excel单元格的关系,以字典方式存储
  2936. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  2937. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  2938. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2939. {
  2940. foreach (mic_module_infos info in mic_module_infos)
  2941. {
  2942. tagInfos.Add(info.tag_name, info.cell_position);
  2943. }
  2944. }
  2945. List<List<string>> analysisContent = new List<List<string>>();
  2946. List<List<string>> inclusionList = new List<List<string>>();
  2947. List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
  2948. List<Bitmap> bitImgList = new List<Bitmap>();
  2949. List<string> titleContent = new List<string>();
  2950. List<string> nameList = new List<string>();
  2951. for (int i = 0; i < this.dataGridView_results.Rows.Count; i++)
  2952. {
  2953. List<string> content1 = new List<string>();
  2954. if (i == 0)
  2955. {
  2956. content1.Add(this.dataGridView_results.Columns[0].HeaderText);
  2957. content1.Add(this.dataGridView_results.Columns[1].HeaderText);
  2958. content1.Add(this.dataGridView_results.Columns[2].HeaderText);
  2959. content1.Add(this.dataGridView_results.Columns[3].HeaderText);
  2960. analysisContent.Add(content1);
  2961. titleContent.AddRange(content1);
  2962. }
  2963. content1 = new List<string>();
  2964. content1.Add(this.dataGridView_results.Rows[i].Cells[0].Value.ToString());
  2965. content1.Add(this.dataGridView_results.Rows[i].Cells[1].Value.ToString());
  2966. content1.Add(this.dataGridView_results.Rows[i].Cells[2].Value.ToString());
  2967. content1.Add(this.dataGridView_results.Rows[i].Cells[3].Value.ToString());
  2968. analysisContent.Add(content1);
  2969. string tag = this.dataGridView_results.Rows[i].Cells[0].Value.ToString();
  2970. if (nameList.IndexOf(tag) == -1)
  2971. {
  2972. nameList.Add(tag);
  2973. }
  2974. var export = exportModel.Where(m => m.picName == tag).FirstOrDefault();
  2975. if (export == null) {
  2976. ExportProjectModel exportProjectModel = new ExportProjectModel();
  2977. exportProjectModel.dataList = new List<List<string>>();
  2978. exportProjectModel.dataList.Add(titleContent);
  2979. exportProjectModel.dataList.Add(content1);
  2980. exportProjectModel.picName = tag;
  2981. exportProjectModel.tagName = PdnResources.GetString("Menu.GeneralAnalysis.MultiphaseContent.Text");
  2982. exportModel.Add(exportProjectModel);
  2983. }
  2984. else {
  2985. exportModel[exportModel.IndexOf(export)].dataList.Add(content1);
  2986. }
  2987. }
  2988. foreach (var s in nameList) {
  2989. if (bitDic.ContainsKey(s))
  2990. {
  2991. foreach (var m in bitDic[s])
  2992. {
  2993. bitImgList.Add(bitDic[s][bitDic[s].IndexOf(m)]);
  2994. }
  2995. }
  2996. }
  2997. try
  2998. {
  2999. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitImgList, tagInfos, item.path, item.code);
  3000. }
  3001. catch (Exception ex)
  3002. {
  3003. MessageBox.Show(ex.Message);
  3004. }
  3005. }
  3006. else
  3007. {
  3008. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  3009. return;
  3010. }
  3011. //保存项目信息到数据库
  3012. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  3013. }
  3014. }
  3015. /// <summary>
  3016. /// 应用全部
  3017. /// </summary>
  3018. /// <param name="sender"></param>
  3019. /// <param name="e"></param>
  3020. private void button8_Click()
  3021. {
  3022. if (this.listView1.FocusedItem == null)
  3023. {
  3024. return;
  3025. }
  3026. #region [设置参数]
  3027. PolyphaseMutiAreaContentModel model = new PolyphaseMutiAreaContentModel();
  3028. model.hasUsed = true;
  3029. model.parameter1 = xiang_num;
  3030. model.parameter12 = checkBox1.Checked;
  3031. model.parameter13 = commonControlButtons.trackBar.Value;
  3032. model.parameter2 = cb_SelectPhase.SelectedItem == null ? "" : cb_SelectPhase.SelectedItem.ToString();
  3033. if (model.parameter3 == null)
  3034. {
  3035. model.parameter3 = new List<PolyphaseData>();
  3036. }
  3037. var list = new List<PolyphaseData>();
  3038. foreach (var s in mPhaseModels)
  3039. {
  3040. PolyphaseData data = new PolyphaseData();
  3041. data.color = s.Model.color;
  3042. data.downNum = s.ColorStart;
  3043. data.upNum = s.ColorEnd;
  3044. list.Add(data);
  3045. }
  3046. model.parameter3 = list;
  3047. #region [保存物相选择]
  3048. string all = String.Empty;
  3049. if (cb1.Checked)
  3050. {
  3051. all += "1,";
  3052. }
  3053. if (cb2.Checked)
  3054. {
  3055. all += "2,";
  3056. }
  3057. if (cb3.Checked)
  3058. {
  3059. all += "3,";
  3060. }
  3061. if (cb4.Checked)
  3062. {
  3063. all += "4,";
  3064. }
  3065. if (cb5.Checked)
  3066. {
  3067. all += "5,";
  3068. }
  3069. if (cb6.Checked)
  3070. {
  3071. all += "6,";
  3072. }
  3073. if (cb7.Checked)
  3074. {
  3075. all += "7,";
  3076. }
  3077. if (cb8.Checked)
  3078. {
  3079. all += "8,";
  3080. }
  3081. model.parameter4 = all;
  3082. #endregion
  3083. model.parameter5 = checkBox10.Checked;
  3084. model.parameter6 = checkBox11.Checked;
  3085. model.parameter7 = (int)numericUpDown_KDStart.Value;
  3086. model.parameter8 = (int)numericUpDown_KDEnd.Value;
  3087. model.parameter9 = (int)numericUpDown_SXStart.Value;
  3088. model.parameter10 = (int)numericUpDown_SXEnd.Value;
  3089. model.parameter11 = (int)numericUpDown1.Value;
  3090. for (int i = 0; i < listView1.Items.Count; i++)
  3091. {
  3092. if (everyImgData.ContainsKey(listView1.Items[i].Name))
  3093. {
  3094. everyImgData[listView1.Items[i].Name] = model;
  3095. }
  3096. else
  3097. {
  3098. everyImgData.Add(listView1.Items[i].Name, model);
  3099. }
  3100. }
  3101. #endregion
  3102. this.listView1.EnsureVisible(listView1.Items.Count - 1);
  3103. this.listView1.Items[listView1.Items.Count - 1].Focused = true;
  3104. this.listView1.Items[listView1.Items.Count - 1].Selected = true;
  3105. this.userAll = true;
  3106. }
  3107. /// <summary>
  3108. /// 保存到全部
  3109. /// </summary>
  3110. /// <param name="sender"></param>
  3111. /// <param name="e"></param>
  3112. private void button7_Click()
  3113. {
  3114. if (!this.userAll) {
  3115. MessageBox.Show("请先点击应用全部!");
  3116. return;
  3117. }
  3118. for (int i = 0; i < listView1.Items.Count; i++)
  3119. {
  3120. this.listView1.EnsureVisible(i);
  3121. this.listView1.Items[i].Focused = true;
  3122. this.listView1.Items[i].Selected = true;
  3123. this.But_DeleteKD.PerformClick();
  3124. this.But_DeleteSX.PerformClick();
  3125. button2_Click(null, null);
  3126. }
  3127. }
  3128. private void getValue(string key, Object value)
  3129. {
  3130. switch (key)
  3131. {
  3132. case "parameter1":
  3133. switch (Convert.ToInt32(value) + 1)
  3134. {
  3135. case 0:
  3136. rb1.Checked = true;
  3137. break;
  3138. case 1:
  3139. rb1.Checked = true;
  3140. break;
  3141. case 2:
  3142. rb1.Checked = true;
  3143. rb2.Checked = true;
  3144. break;
  3145. case 3:
  3146. rb1.Checked = true;
  3147. rb2.Checked = true;
  3148. rb3.Checked = true;
  3149. break;
  3150. case 4:
  3151. rb1.Checked = true;
  3152. rb2.Checked = true;
  3153. rb3.Checked = true;
  3154. rb4.Checked = true;
  3155. break;
  3156. case 5:
  3157. rb1.Checked = true;
  3158. rb2.Checked = true;
  3159. rb3.Checked = true;
  3160. rb4.Checked = true;
  3161. rb5.Checked = true;
  3162. break;
  3163. case 6:
  3164. rb1.Checked = true;
  3165. rb2.Checked = true;
  3166. rb3.Checked = true;
  3167. rb4.Checked = true;
  3168. rb5.Checked = true;
  3169. rb6.Checked = true;
  3170. break;
  3171. case 7:
  3172. rb1.Checked = true;
  3173. rb2.Checked = true;
  3174. rb3.Checked = true;
  3175. rb4.Checked = true;
  3176. rb5.Checked = true;
  3177. rb6.Checked = true;
  3178. rb7.Checked = true;
  3179. break;
  3180. case 8:
  3181. rb1.Checked = true;
  3182. rb2.Checked = true;
  3183. rb3.Checked = true;
  3184. rb4.Checked = true;
  3185. rb5.Checked = true;
  3186. rb6.Checked = true;
  3187. rb7.Checked = true;
  3188. rb8.Checked = true;
  3189. break;
  3190. }
  3191. break;
  3192. case "parameter2":
  3193. checkBox10.Checked = Convert.ToBoolean(value);
  3194. break;
  3195. case "parameter3":
  3196. numericUpDown_KDStart.Value = Convert.ToDecimal(value);
  3197. break;
  3198. case "parameter4":
  3199. numericUpDown_KDEnd.Value = Convert.ToDecimal(value);
  3200. break;
  3201. case "parameter5":
  3202. checkBox11.Checked = Convert.ToBoolean(value);
  3203. break;
  3204. case "parameter6":
  3205. numericUpDown_SXStart.Value = Convert.ToDecimal(value);
  3206. break;
  3207. case "parameter7":
  3208. numericUpDown_SXEnd.Value = Convert.ToDecimal(value);
  3209. break;
  3210. case "OpenWhileExportReport":
  3211. checkBox1.Checked = Convert.ToBoolean(value);
  3212. break;
  3213. case "CalculatorDecimalDigits":
  3214. numericUpDown1.Value = Convert.ToDecimal(value);
  3215. break;
  3216. case "ExportResults":
  3217. isExportResults = Convert.ToBoolean(value);
  3218. break;
  3219. case "ExportReports":
  3220. isExportReports = Convert.ToBoolean(value);
  3221. break;
  3222. case "ExportProjects":
  3223. isExportProjects = Convert.ToBoolean(value);
  3224. break;
  3225. }
  3226. }
  3227. #region [脚本录制]
  3228. private void getScriptRecording()
  3229. {
  3230. string className = InvariantData.path_Action + ".Action" + menuId;
  3231. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  3232. List<Args> args = param.Lists;
  3233. foreach (var item in args)
  3234. {
  3235. item.value = setScriptRecording(item.key);
  3236. }
  3237. appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
  3238. }
  3239. private object setScriptRecording(string key)
  3240. {
  3241. object value = null;
  3242. switch (key)
  3243. {
  3244. case "parameter1":
  3245. if (rb1.Checked) {
  3246. value = 0;
  3247. }
  3248. if (rb2.Checked)
  3249. {
  3250. value = 1;
  3251. }
  3252. if (rb3.Checked)
  3253. {
  3254. value = 2;
  3255. }
  3256. if (rb4.Checked)
  3257. {
  3258. value = 3;
  3259. }
  3260. if (rb5.Checked)
  3261. {
  3262. value = 4;
  3263. }
  3264. if (rb6.Checked)
  3265. {
  3266. value = 5;
  3267. }
  3268. if (rb7.Checked)
  3269. {
  3270. value = 6;
  3271. }
  3272. if (rb8.Checked)
  3273. {
  3274. value = 7;
  3275. }
  3276. break;
  3277. case "parameter2":
  3278. value = checkBox10.Checked;
  3279. break;
  3280. case "parameter3":
  3281. value = numericUpDown_KDStart.Value;
  3282. break;
  3283. case "parameter4":
  3284. value = numericUpDown_KDEnd.Value;
  3285. break;
  3286. case "parameter5":
  3287. value = checkBox11.Checked;
  3288. break;
  3289. case "parameter6":
  3290. value = numericUpDown_SXStart.Value;
  3291. break;
  3292. case "parameter7":
  3293. value = numericUpDown_SXEnd.Value;
  3294. break;
  3295. case "OpenWhileExportReport":
  3296. value = checkBox1.Checked;
  3297. break;
  3298. case "CalculatorDecimalDigits":
  3299. value = numericUpDown1.Value;
  3300. break;
  3301. case "ExportResults":
  3302. value = isExportResults;
  3303. break;
  3304. case "ExportReports":
  3305. value = isExportReports;
  3306. break;
  3307. case "ExportProjects":
  3308. value = isExportProjects;
  3309. break;
  3310. }
  3311. return value;
  3312. }
  3313. #endregion
  3314. }
  3315. }