InclusionsStandardDialog.cs 196 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133
  1. using Metis.DedicatedAnalysis.Inclusions;
  2. using Metis.ParameterSet;
  3. using OpenCvSharp;
  4. using OpenCvSharp.Extensions;
  5. using PaintDotNet.Adjust.BaseImage;
  6. using PaintDotNet.Annotation;
  7. using PaintDotNet.Annotation.DedicatedAnalysis;
  8. using PaintDotNet.Annotation.Enum;
  9. using PaintDotNet.Annotation.FieldView;
  10. using PaintDotNet.Base;
  11. using PaintDotNet.Base.CommTool;
  12. using PaintDotNet.Base.DedicatedAnalysis.Inclusions;
  13. using PaintDotNet.Base.DedicatedAnalysis.Inclusions.Model;
  14. using PaintDotNet.Base.Functionodel;
  15. using PaintDotNet.Base.SettingModel;
  16. using PaintDotNet.CustomControl;
  17. using PaintDotNet.Data.Param;
  18. using PaintDotNet.DbOpreate.DbBll;
  19. using PaintDotNet.DbOpreate.DbModel;
  20. using PaintDotNet.Instrument;
  21. using System;
  22. using System.Collections.Generic;
  23. using System.ComponentModel;
  24. using System.Data;
  25. using System.Drawing;
  26. using System.Drawing.Drawing2D;
  27. using System.IO;
  28. using System.Linq;
  29. using System.Windows.Forms;
  30. using static PaintDotNet.Base.DedicatedAnalysis.Inclusions.InclusionsGlobalSettings;
  31. using static PaintDotNet.Base.DedicatedAnalysis.Inclusions.MethodOfAssessment;
  32. namespace PaintDotNet.DedicatedAnalysis.Inclusions
  33. {
  34. internal class InclusionsStandardDialog : PdnBaseForm
  35. {
  36. #region 属性
  37. #region 属性
  38. /// <summary>
  39. /// 主控件
  40. /// </summary>
  41. private AppWorkspace appWorkspace;
  42. /// <summary>
  43. /// 公共按钮
  44. /// </summary>
  45. private CommonControlButtons commonControlButtons;
  46. /// <summary>
  47. /// 图像面板
  48. /// </summary>
  49. private DocumentWorkspaceWindow documentWorkspace;
  50. private Dictionary<int,DocumentItem> documentItems;
  51. /// <summary>
  52. /// 当前选择的图片
  53. /// </summary>
  54. private Bitmap bitmap;
  55. /// <summary>
  56. /// 初始系统参数配置值
  57. /// </summary>
  58. private BinaryExtractionModel binaryExtractionModel = new BinaryExtractionModel();
  59. /// <summary>
  60. /// 选择的评定方法
  61. /// </summary>
  62. private MethodOfAssessment methodOfAssessment;
  63. private AnalysisResult tempAnalysisResult;
  64. private Dictionary<DocumentWorkspace, AnalysisResult> analysisResults = new Dictionary<DocumentWorkspace, AnalysisResult>();
  65. protected ColorOfInclusions selectedColorOfInclusions;
  66. protected ColorOfInclusions oldSelectedColorOfInclusions;
  67. private int chooseK = 3;
  68. /// <summary>
  69. /// RGB/HLS 选中那个按钮,默认1=R/H 2=G/L 2=B/S
  70. /// </summary>
  71. private int HistogramRGBSelect = 1;
  72. private bool pickColorChecked;
  73. //二值化集成1
  74. private BinaryClass binaryClass;
  75. protected int menuId;
  76. protected string menuName;
  77. // 选定夹杂物类型
  78. private bool clearSelect = false;
  79. private TypesOfInclusions selectedTypesOfInclusions;
  80. // 选定夹杂物类型 操作 记录点
  81. private System.Drawing.Point? selectedTypesOfInclusionsPoint = null;
  82. private System.Drawing.RectangleF? selectedTypesOfInclusionsRectangle = null;
  83. // 视场边长
  84. private int viewNum = 710;
  85. private bool is_showRectangle = false;
  86. private bool is_showOval = false;
  87. private int is_full = 1;
  88. //局部变量
  89. private bool rbcheck = true;
  90. protected InclusionsModel inclusionsModel = new InclusionsModel();
  91. protected InclusionsModel.InclusionParameter thisParameters;
  92. protected int thisParametersIndex = -1;
  93. private bool userAll = false;
  94. private bool firstShow = true;
  95. protected int whichChecked = 0;
  96. private int autoJiaoBen = -1;
  97. #endregion
  98. #region 组件
  99. private GroupBox groupBox_operating;
  100. private Button btn_editInclusions;
  101. private Button btn_statistics;
  102. private GroupBox groupBox_img;
  103. private ListView lstView_img;
  104. private ImageList imageList_img;
  105. private IContainer components;
  106. private GroupBox groupBox_baseSetting;
  107. private ComboBox comboBox_rollingDirection;
  108. private Label label_lwRatioLimit;
  109. private Label label_rollingDirection;
  110. protected NumericUpDown numericUpDown_lwRatioLimit;
  111. protected GroupBox groupBox_colorSetting;
  112. private Panel panel_colorGamut;
  113. protected GroupBox groupBox_displaySetting;
  114. private GroupBox groupBox_histogram;
  115. private CustomControl.HistogramControl histogramControl_colorSetting;
  116. private GroupBox groupBox_colorAdjustment;
  117. private Button button_colorAdjustmentBS;
  118. private Button button_colorAdjustmentGL;
  119. private Button button_colorAdjustmentRH;
  120. private NumericUpDown numericUpDown_colorAdjustmentBSD;
  121. private NumericUpDown numericUpDown_colorAdjustmentBSU;
  122. private Label label_colorAdjustmentBS;
  123. private NumericUpDown numericUpDown_colorAdjustmentGLD;
  124. private NumericUpDown numericUpDown_colorAdjustmentGLU;
  125. private Label label_colorAdjustmentGL;
  126. private NumericUpDown numericUpDown_colorAdjustmentRHD;
  127. private NumericUpDown numericUpDown_colorAdjustmentRHU;
  128. private Label label_colorAdjustmentRH;
  129. private RadioButton radioButton_checkedHLS;
  130. private RadioButton radioButton_checkedRGB;
  131. private GroupBox groupBox_review;
  132. private GroupBox groupBox_report;
  133. private Label label_resultPrecision;
  134. private DomainUpDown domainUpDown_resultPrecision;
  135. private Button button_exportResults;
  136. private Button button_generateReport;
  137. private GroupBox groupBox6groupBox_analysisResult2;
  138. private ListView listView_analysisResult;
  139. private GroupBox groupBox_analysisResult1;
  140. private Button button_remove;
  141. private Button button_all;
  142. private Label label_colorGamut;
  143. private Button button_pickColor;
  144. private Panel panel_colorGamutPhase;
  145. private CheckBox checkBox_showColorGamutPhase;
  146. private ToolTip toolTip_InclusionsDetails;
  147. private ListView listView_analysisResult2;
  148. private Button button_setting;
  149. private CheckedListBox listBox_analysisResult;
  150. private Button btn_clean_result;
  151. private CheckBox checkBox_generateReport_opensetting;
  152. private Button button1;
  153. private ComboBox comboBox1;
  154. private Label label1;
  155. private BinaryControl bc;
  156. private Button btn_drawRecognitionArea;
  157. private Button btn_selectClear;
  158. private Button btn_saveresult;
  159. private Button button2;
  160. private CheckBox checkBox2;
  161. private CheckBox checkBox1;
  162. private RadioButton radioButton2;
  163. private RadioButton radioButton1;
  164. private int isK = 2;
  165. private int imgIndex = -1;
  166. private RectangleF paintRectangle;
  167. private Dictionary<string, List<PhaseModel>> dict = new Dictionary<string, List<PhaseModel>>();
  168. protected double imgPxPerUnit;
  169. protected GroupBox groupBox1;
  170. private Button button4;
  171. private Button button3;
  172. private string dialogText;
  173. private List<AnalysisResult> resultList = new List<AnalysisResult>();
  174. private List<int> hasResultIndexList = new List<int>();
  175. private Dictionary<int,CurrentPageData> everyImgData = new Dictionary<int, CurrentPageData>();
  176. protected string colorName;
  177. private Dictionary<string, List<double>> rgbDict = new Dictionary<string, List<double>>();
  178. private bool isExportResults = false;
  179. private bool isExportReports = false;
  180. private bool isExportProjects = false;
  181. /// <summary>
  182. /// 是否脚本运行
  183. /// </summary>
  184. private Boolean initScriptValues = false;
  185. #endregion
  186. #endregion
  187. #region 构造函数
  188. public InclusionsStandardDialog(AppWorkspace appWorkspace, string dialogText,PdnMenuItem menuitem)
  189. {
  190. this.appWorkspace = appWorkspace;
  191. this.Shown += showImg;
  192. this.Text = dialogText;
  193. this.dialogText = dialogText;
  194. this.Icon = PdnInfo.AppIcon;
  195. InitializeComponent();
  196. this.menuId = menuitem.MenuId;
  197. this.menuName = menuitem.Text;
  198. this.binaryClass = new BinaryClass(menuId);
  199. InitializeComponent2();
  200. Initialize();
  201. //二值化集成2
  202. bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
  203. binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.binary.Text"), PdnResources.GetString("Menu.Theinclusioncolomatches.Text") }
  204. , this.bc, this.appWorkspace, this.documentWorkspace, this.lstView_img);//初始化相的工作结构
  205. binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
  206. this.documentWorkspace.panel.Paint += Panel_Paint;
  207. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.saveLastData);
  208. }
  209. private void showImg(object sender, EventArgs e)
  210. {
  211. lstView_img.Focus();
  212. if (this.imgIndex != -1)
  213. {
  214. //滚动到指定的行位置
  215. this.lstView_img.EnsureVisible(this.imgIndex);
  216. this.lstView_img.Items[imgIndex].Focused = true;
  217. this.lstView_img.Items[imgIndex].Selected = true;
  218. }
  219. this.methodOfAssessment = getMethodOfAssessment();
  220. MethodOfAssessment.activeMethod = this.methodOfAssessment;
  221. SetAnalyzeModelFromXml(this.methodOfAssessment.resourcesName);
  222. SubclassInitialize();
  223. initColorSetting();
  224. initDisplaySetting();
  225. //如果是脚本执行,将参数带入
  226. if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
  227. {
  228. this.initScriptValues = true;//ScriptAutomatic
  229. //Boolean initScriptValues = true;
  230. ////在这里反射出对应功能的参数类
  231. string className = InvariantData.path_Action + ".Action" + menuId;
  232. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  233. foreach (Args arg in param.Lists)
  234. {
  235. Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
  236. if (param1.value != null)
  237. arg.Value = param1.value;
  238. getValue(arg.key, arg.Value);
  239. }
  240. appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
  241. }
  242. else
  243. {//读取上次关闭窗口时保存的参数
  244. getLastData();
  245. }
  246. this.firstShow = false;
  247. binaryClass.RefreshHistogramControl1Values();
  248. // 初始化显示设置区域
  249. foreach (var item in this.groupBox_displaySetting.Controls)
  250. {
  251. if (item is Button)
  252. {
  253. ((Button)item).Click += this.label_displaySetting;
  254. }
  255. }
  256. if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
  257. this.startScriptAutomaticAction();
  258. }
  259. /// <summary>
  260. /// 执行脚本自动化的步骤
  261. /// </summary>
  262. private void startScriptAutomaticAction()
  263. {
  264. this.button4.PerformClick();
  265. this.button3.PerformClick();
  266. this.allCheck();
  267. if (isExportResults)//导出结果
  268. this.button_exportResults.PerformClick();
  269. if (isExportReports)//生成报告
  270. this.button_generateReport.PerformClick();
  271. if (isExportProjects)//导出项目
  272. this.button1.PerformClick();
  273. this.appWorkspace.ScriptAutomatic = false;
  274. this.Close();
  275. }
  276. public InclusionsStandardDialog()
  277. {
  278. InitializeComponent();
  279. }
  280. #endregion
  281. #region 初始化组件
  282. private void InitializeComponent2()
  283. {
  284. this.bc = new PaintDotNet.CustomControl.BinaryControl();
  285. //
  286. // bc
  287. //
  288. this.bc.BinaryBackColor = System.Drawing.Color.Red;
  289. this.bc.BinaryChecked = false;
  290. this.bc.BinaryStyle = 1;
  291. this.bc.Location = new System.Drawing.Point(178, 72);
  292. this.bc.Name = "bc";
  293. this.bc.OriginChecked = false;
  294. this.bc.scope1End = 0D;
  295. this.bc.scope1Start = 0D;
  296. this.bc.scope2End = 0D;
  297. this.bc.scope2Start = 0D;
  298. this.bc.scope3End = 0D;
  299. this.bc.scope3Start = 0D;
  300. this.bc.Size = new System.Drawing.Size(360, 292);
  301. this.bc.TabIndex = 35;
  302. this.Controls.Add(this.bc);
  303. this.Controls.SetChildIndex(this.bc, 0);
  304. //
  305. // histogramControl_colorSetting
  306. //
  307. this.histogramControl_colorSetting = new PaintDotNet.CustomControl.HistogramControl();
  308. this.histogramControl_colorSetting.Flag = 1;
  309. this.histogramControl_colorSetting.Location = new System.Drawing.Point(7, 15);
  310. this.histogramControl_colorSetting.Name = "histogramControl_colorSetting";
  311. this.histogramControl_colorSetting.Size = new System.Drawing.Size(167, 114);
  312. this.histogramControl_colorSetting.TabIndex = 0;
  313. this.groupBox_histogram.Controls.Add(this.histogramControl_colorSetting);
  314. this.comboBox_rollingDirection.Items.AddRange(new object[] {
  315. PdnResources.GetString("Menu.vertical.text"),
  316. PdnResources.GetString("Menu.Level.text")});
  317. this.groupBox_operating.Text = PdnResources.GetString("Menu.operation.text");
  318. this.btn_drawRecognitionArea.Text = PdnResources.GetString("Menu.dentificationarea.Text");
  319. this.checkBox_generateReport_opensetting.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  320. this.btn_clean_result.Text = PdnResources.GetString("Menu.Clearstatistics.text");
  321. this.button_setting.Text = PdnResources.GetString("Menu.Setting.Text");
  322. this.btn_editInclusions.Text = PdnResources.GetString("Menu.Editinclusions.text");
  323. this.btn_statistics.Text = PdnResources.GetString("Menu.Startstatistics.text");
  324. this.btn_saveresult.Text = PdnResources.GetString("Menu.Saveresult.text");
  325. this.groupBox_img.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  326. this.groupBox_baseSetting.Text = PdnResources.GetString("Menu.BasicSettings.text");
  327. this.label1.Text = "K" + PdnResources.GetString("Menu.Imagement.Measurementlist.value.text");
  328. this.label_lwRatioLimit.Text = PdnResources.GetString("Menu.lengthwidthratio.Text");
  329. this.label_rollingDirection.Text = PdnResources.GetString("Menu.Rollingdirection.text");
  330. this.groupBox_colorSetting.Text = PdnResources.GetString("Menu.Inclusioncolorsetting.text");
  331. this.checkBox_showColorGamutPhase.Text = PdnResources.GetString("Menu.Matchthecoloreffect.text");
  332. this.button_pickColor.Text = PdnResources.GetString("Menu.Pickcolor.text");
  333. this.label_colorGamut.Text = PdnResources.GetString("Menu.Colorinterval.text");
  334. this.groupBox_displaySetting.Text = PdnResources.GetString("Menu.displaysetting.text");
  335. this.btn_selectClear.Text = PdnResources.GetString("Menu.Removalofinclusion.Text");
  336. this.groupBox_histogram.Text = PdnResources.GetString("Menu.Tools.Histogram.Text");
  337. this.groupBox_colorAdjustment.Text = PdnResources.GetString("Menu.Coloradjustment.text");
  338. this.groupBox_review.Text = PdnResources.GetString("Menu.Preview.text");
  339. this.button1.Text = PdnResources.GetString("Menu.Tools.OpenProject.Text");
  340. this.label_resultPrecision.Text = PdnResources.GetString("Menu.Decimal.text")+":";
  341. this.button_exportResults.Text = PdnResources.GetString("Menu.Exportresults.text");
  342. this.button_generateReport.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  343. this.groupBox_analysisResult1.Text = PdnResources.GetString("Menu.Analysisresult.text");
  344. this.button_remove.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  345. this.button2.Text = PdnResources.GetString("Menu.ViewSetting.Text");
  346. this.button_all.Text = PdnResources.GetString("Menu.Showall.text");
  347. this.checkBox1.Text = PdnResources.GetString("Menu.Ellipsebox.text");
  348. this.checkBox2.Text = PdnResources.GetString("Menu.Rectangularbox.text");
  349. this.radioButton1.Text = PdnResources.GetString("Menu.ImageCollection.CameraFrame.Text");
  350. this.radioButton2.Text = PdnResources.GetString("Menu.solid.text");
  351. }
  352. private void InitializeComponent()
  353. {
  354. this.components = new System.ComponentModel.Container();
  355. this.groupBox_operating = new System.Windows.Forms.GroupBox();
  356. this.radioButton2 = new System.Windows.Forms.RadioButton();
  357. this.radioButton1 = new System.Windows.Forms.RadioButton();
  358. this.checkBox2 = new System.Windows.Forms.CheckBox();
  359. this.checkBox1 = new System.Windows.Forms.CheckBox();
  360. this.btn_selectClear = new System.Windows.Forms.Button();
  361. this.btn_drawRecognitionArea = new System.Windows.Forms.Button();
  362. this.checkBox_generateReport_opensetting = new System.Windows.Forms.CheckBox();
  363. this.btn_clean_result = new System.Windows.Forms.Button();
  364. this.button_setting = new System.Windows.Forms.Button();
  365. this.btn_editInclusions = new System.Windows.Forms.Button();
  366. this.btn_statistics = new System.Windows.Forms.Button();
  367. this.btn_saveresult = new System.Windows.Forms.Button();
  368. this.button2 = new System.Windows.Forms.Button();
  369. this.groupBox_img = new System.Windows.Forms.GroupBox();
  370. this.lstView_img = new System.Windows.Forms.ListView();
  371. this.imageList_img = new System.Windows.Forms.ImageList(this.components);
  372. this.groupBox_baseSetting = new System.Windows.Forms.GroupBox();
  373. this.comboBox1 = new System.Windows.Forms.ComboBox();
  374. this.label1 = new System.Windows.Forms.Label();
  375. this.comboBox_rollingDirection = new System.Windows.Forms.ComboBox();
  376. this.label_lwRatioLimit = new System.Windows.Forms.Label();
  377. this.label_rollingDirection = new System.Windows.Forms.Label();
  378. this.numericUpDown_lwRatioLimit = new System.Windows.Forms.NumericUpDown();
  379. this.groupBox_colorSetting = new System.Windows.Forms.GroupBox();
  380. this.checkBox_showColorGamutPhase = new System.Windows.Forms.CheckBox();
  381. this.panel_colorGamutPhase = new System.Windows.Forms.Panel();
  382. this.button_pickColor = new System.Windows.Forms.Button();
  383. this.label_colorGamut = new System.Windows.Forms.Label();
  384. this.panel_colorGamut = new System.Windows.Forms.Panel();
  385. this.groupBox_displaySetting = new System.Windows.Forms.GroupBox();
  386. this.groupBox_histogram = new System.Windows.Forms.GroupBox();
  387. this.groupBox_colorAdjustment = new System.Windows.Forms.GroupBox();
  388. this.button_colorAdjustmentBS = new System.Windows.Forms.Button();
  389. this.button_colorAdjustmentGL = new System.Windows.Forms.Button();
  390. this.button_colorAdjustmentRH = new System.Windows.Forms.Button();
  391. this.numericUpDown_colorAdjustmentBSD = new System.Windows.Forms.NumericUpDown();
  392. this.numericUpDown_colorAdjustmentBSU = new System.Windows.Forms.NumericUpDown();
  393. this.label_colorAdjustmentBS = new System.Windows.Forms.Label();
  394. this.numericUpDown_colorAdjustmentGLD = new System.Windows.Forms.NumericUpDown();
  395. this.numericUpDown_colorAdjustmentGLU = new System.Windows.Forms.NumericUpDown();
  396. this.label_colorAdjustmentGL = new System.Windows.Forms.Label();
  397. this.numericUpDown_colorAdjustmentRHD = new System.Windows.Forms.NumericUpDown();
  398. this.numericUpDown_colorAdjustmentRHU = new System.Windows.Forms.NumericUpDown();
  399. this.label_colorAdjustmentRH = new System.Windows.Forms.Label();
  400. this.radioButton_checkedHLS = new System.Windows.Forms.RadioButton();
  401. this.radioButton_checkedRGB = new System.Windows.Forms.RadioButton();
  402. this.groupBox_review = new System.Windows.Forms.GroupBox();
  403. this.groupBox_report = new System.Windows.Forms.GroupBox();
  404. this.button1 = new System.Windows.Forms.Button();
  405. this.label_resultPrecision = new System.Windows.Forms.Label();
  406. this.domainUpDown_resultPrecision = new System.Windows.Forms.DomainUpDown();
  407. this.button_exportResults = new System.Windows.Forms.Button();
  408. this.button_generateReport = new System.Windows.Forms.Button();
  409. this.groupBox6groupBox_analysisResult2 = new System.Windows.Forms.GroupBox();
  410. this.listView_analysisResult2 = new System.Windows.Forms.ListView();
  411. this.listView_analysisResult = new System.Windows.Forms.ListView();
  412. this.groupBox_analysisResult1 = new System.Windows.Forms.GroupBox();
  413. this.listBox_analysisResult = new System.Windows.Forms.CheckedListBox();
  414. this.button_remove = new System.Windows.Forms.Button();
  415. this.button_all = new System.Windows.Forms.Button();
  416. this.toolTip_InclusionsDetails = new System.Windows.Forms.ToolTip(this.components);
  417. this.groupBox1 = new System.Windows.Forms.GroupBox();
  418. this.button4 = new System.Windows.Forms.Button();
  419. this.button3 = new System.Windows.Forms.Button();
  420. this.groupBox_operating.SuspendLayout();
  421. this.groupBox_img.SuspendLayout();
  422. this.groupBox_baseSetting.SuspendLayout();
  423. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).BeginInit();
  424. this.groupBox_colorSetting.SuspendLayout();
  425. this.groupBox_colorAdjustment.SuspendLayout();
  426. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentBSD)).BeginInit();
  427. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentBSU)).BeginInit();
  428. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentGLD)).BeginInit();
  429. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentGLU)).BeginInit();
  430. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentRHD)).BeginInit();
  431. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentRHU)).BeginInit();
  432. this.groupBox_report.SuspendLayout();
  433. this.groupBox6groupBox_analysisResult2.SuspendLayout();
  434. this.groupBox_analysisResult1.SuspendLayout();
  435. this.groupBox1.SuspendLayout();
  436. this.SuspendLayout();
  437. //
  438. // groupBox_operating
  439. //
  440. this.groupBox_operating.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  441. | System.Windows.Forms.AnchorStyles.Right)));
  442. this.groupBox_operating.Controls.Add(this.radioButton2);
  443. this.groupBox_operating.Controls.Add(this.radioButton1);
  444. this.groupBox_operating.Controls.Add(this.checkBox2);
  445. this.groupBox_operating.Controls.Add(this.checkBox1);
  446. this.groupBox_operating.Controls.Add(this.btn_selectClear);
  447. this.groupBox_operating.Controls.Add(this.btn_drawRecognitionArea);
  448. this.groupBox_operating.Controls.Add(this.checkBox_generateReport_opensetting);
  449. this.groupBox_operating.Controls.Add(this.btn_clean_result);
  450. this.groupBox_operating.Controls.Add(this.button_setting);
  451. this.groupBox_operating.Controls.Add(this.btn_editInclusions);
  452. this.groupBox_operating.Controls.Add(this.btn_statistics);
  453. this.groupBox_operating.Controls.Add(this.btn_saveresult);
  454. this.groupBox_operating.Controls.Add(this.button2);
  455. this.groupBox_operating.Location = new System.Drawing.Point(13, 12);
  456. this.groupBox_operating.Name = "groupBox_operating";
  457. this.groupBox_operating.Size = new System.Drawing.Size(1152, 53);
  458. this.groupBox_operating.TabIndex = 12;
  459. this.groupBox_operating.TabStop = false;
  460. //
  461. // radioButton2
  462. //
  463. this.radioButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  464. this.radioButton2.AutoSize = true;
  465. this.radioButton2.Checked = true;
  466. this.radioButton2.Location = new System.Drawing.Point(405, 23);
  467. this.radioButton2.Name = "radioButton2";
  468. this.radioButton2.Size = new System.Drawing.Size(14, 13);
  469. this.radioButton2.TabIndex = 12;
  470. this.radioButton2.TabStop = true;
  471. this.radioButton2.UseVisualStyleBackColor = true;
  472. this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
  473. //
  474. // radioButton1
  475. //
  476. this.radioButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  477. this.radioButton1.AutoSize = true;
  478. this.radioButton1.Location = new System.Drawing.Point(348, 22);
  479. this.radioButton1.Name = "radioButton1";
  480. this.radioButton1.Size = new System.Drawing.Size(14, 13);
  481. this.radioButton1.TabIndex = 11;
  482. this.radioButton1.UseVisualStyleBackColor = true;
  483. this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
  484. //
  485. // checkBox2
  486. //
  487. this.checkBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  488. this.checkBox2.AutoSize = true;
  489. this.checkBox2.Location = new System.Drawing.Point(504, 24);
  490. this.checkBox2.Name = "checkBox2";
  491. this.checkBox2.Size = new System.Drawing.Size(15, 14);
  492. this.checkBox2.TabIndex = 10;
  493. this.checkBox2.UseVisualStyleBackColor = true;
  494. this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
  495. //
  496. // checkBox1
  497. //
  498. this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  499. this.checkBox1.AutoSize = true;
  500. this.checkBox1.Location = new System.Drawing.Point(591, 23);
  501. this.checkBox1.Name = "checkBox1";
  502. this.checkBox1.Size = new System.Drawing.Size(15, 14);
  503. this.checkBox1.TabIndex = 9;
  504. this.checkBox1.UseVisualStyleBackColor = true;
  505. this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
  506. //
  507. // btn_selectClear
  508. //
  509. this.btn_selectClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  510. this.btn_selectClear.Location = new System.Drawing.Point(829, 20);
  511. this.btn_selectClear.Name = "btn_selectClear";
  512. this.btn_selectClear.Size = new System.Drawing.Size(75, 23);
  513. this.btn_selectClear.TabIndex = 0;
  514. this.btn_selectClear.UseVisualStyleBackColor = true;
  515. this.btn_selectClear.Click += new System.EventHandler(this.btn_selectClear_Click);
  516. //
  517. // btn_drawRecognitionArea
  518. //
  519. this.btn_drawRecognitionArea.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  520. this.btn_drawRecognitionArea.Location = new System.Drawing.Point(667, 20);
  521. this.btn_drawRecognitionArea.Name = "btn_drawRecognitionArea";
  522. this.btn_drawRecognitionArea.Size = new System.Drawing.Size(75, 23);
  523. this.btn_drawRecognitionArea.TabIndex = 7;
  524. this.btn_drawRecognitionArea.UseVisualStyleBackColor = true;
  525. this.btn_drawRecognitionArea.Click += new System.EventHandler(this.btn_drawRecognitionArea_Click);
  526. //
  527. // checkBox_generateReport_opensetting
  528. //
  529. this.checkBox_generateReport_opensetting.AutoSize = true;
  530. this.checkBox_generateReport_opensetting.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
  531. this.checkBox_generateReport_opensetting.Location = new System.Drawing.Point(91, 24);
  532. this.checkBox_generateReport_opensetting.Name = "checkBox_generateReport_opensetting";
  533. this.checkBox_generateReport_opensetting.Size = new System.Drawing.Size(15, 14);
  534. this.checkBox_generateReport_opensetting.TabIndex = 6;
  535. this.checkBox_generateReport_opensetting.UseVisualStyleBackColor = true;
  536. //
  537. // btn_clean_result
  538. //
  539. this.btn_clean_result.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  540. this.btn_clean_result.Location = new System.Drawing.Point(991, 20);
  541. this.btn_clean_result.Name = "btn_clean_result";
  542. this.btn_clean_result.Size = new System.Drawing.Size(75, 23);
  543. this.btn_clean_result.TabIndex = 5;
  544. this.btn_clean_result.UseVisualStyleBackColor = true;
  545. this.btn_clean_result.Click += new System.EventHandler(this.btn_clean_result_Click);
  546. //
  547. // button_setting
  548. //
  549. this.button_setting.Location = new System.Drawing.Point(6, 20);
  550. this.button_setting.Name = "button_setting";
  551. this.button_setting.Size = new System.Drawing.Size(75, 23);
  552. this.button_setting.TabIndex = 4;
  553. this.button_setting.UseVisualStyleBackColor = true;
  554. this.button_setting.Click += new System.EventHandler(this.button_setting_Click);
  555. //
  556. // btn_editInclusions
  557. //
  558. this.btn_editInclusions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  559. this.btn_editInclusions.Location = new System.Drawing.Point(748, 20);
  560. this.btn_editInclusions.Name = "btn_editInclusions";
  561. this.btn_editInclusions.Size = new System.Drawing.Size(75, 23);
  562. this.btn_editInclusions.TabIndex = 3;
  563. this.btn_editInclusions.UseVisualStyleBackColor = true;
  564. this.btn_editInclusions.Click += new System.EventHandler(this.btn_editInclusions_Click);
  565. //
  566. // btn_statistics
  567. //
  568. this.btn_statistics.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  569. this.btn_statistics.Location = new System.Drawing.Point(910, 20);
  570. this.btn_statistics.Name = "btn_statistics";
  571. this.btn_statistics.Size = new System.Drawing.Size(75, 23);
  572. this.btn_statistics.TabIndex = 3;
  573. this.btn_statistics.UseVisualStyleBackColor = true;
  574. this.btn_statistics.Click += new System.EventHandler(this.btn_statistics_Click);
  575. //
  576. // btn_saveresult
  577. //
  578. this.btn_saveresult.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  579. this.btn_saveresult.Location = new System.Drawing.Point(1072, 20);
  580. this.btn_saveresult.Name = "btn_saveresult";
  581. this.btn_saveresult.Size = new System.Drawing.Size(75, 23);
  582. this.btn_saveresult.TabIndex = 2;
  583. this.btn_saveresult.UseVisualStyleBackColor = true;
  584. this.btn_saveresult.Click += new System.EventHandler(this.btn_saveresult_Click);
  585. //
  586. // button2
  587. //
  588. this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  589. this.button2.Location = new System.Drawing.Point(667, 20);
  590. this.button2.Name = "button2";
  591. this.button2.Size = new System.Drawing.Size(75, 23);
  592. this.button2.TabIndex = 8;
  593. this.button2.UseVisualStyleBackColor = true;
  594. this.button2.Click += new System.EventHandler(this.button2_Click);
  595. //
  596. // groupBox_img
  597. //
  598. this.groupBox_img.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  599. | System.Windows.Forms.AnchorStyles.Left)));
  600. this.groupBox_img.Controls.Add(this.lstView_img);
  601. this.groupBox_img.Location = new System.Drawing.Point(13, 72);
  602. this.groupBox_img.Margin = new System.Windows.Forms.Padding(4);
  603. this.groupBox_img.Name = "groupBox_img";
  604. this.groupBox_img.Padding = new System.Windows.Forms.Padding(4);
  605. this.groupBox_img.Size = new System.Drawing.Size(158, 630);
  606. this.groupBox_img.TabIndex = 13;
  607. this.groupBox_img.TabStop = false;
  608. //
  609. // lstView_img
  610. //
  611. this.lstView_img.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  612. | System.Windows.Forms.AnchorStyles.Left)
  613. | System.Windows.Forms.AnchorStyles.Right)));
  614. this.lstView_img.HideSelection = false;
  615. this.lstView_img.LargeImageList = this.imageList_img;
  616. this.lstView_img.Location = new System.Drawing.Point(8, 26);
  617. this.lstView_img.Margin = new System.Windows.Forms.Padding(4);
  618. this.lstView_img.MultiSelect = false;
  619. this.lstView_img.Name = "lstView_img";
  620. this.lstView_img.Size = new System.Drawing.Size(140, 596);
  621. this.lstView_img.TabIndex = 0;
  622. this.lstView_img.UseCompatibleStateImageBehavior = false;
  623. this.lstView_img.SelectedIndexChanged += new System.EventHandler(this.lstView_img_SelectedIndexChanged);
  624. this.lstView_img.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseUp);
  625. //
  626. // imageList_img
  627. //
  628. this.imageList_img.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  629. this.imageList_img.ImageSize = new System.Drawing.Size(64, 64);
  630. this.imageList_img.TransparentColor = System.Drawing.Color.Transparent;
  631. //
  632. // groupBox_baseSetting
  633. //
  634. this.groupBox_baseSetting.Controls.Add(this.comboBox1);
  635. this.groupBox_baseSetting.Controls.Add(this.label1);
  636. this.groupBox_baseSetting.Controls.Add(this.comboBox_rollingDirection);
  637. this.groupBox_baseSetting.Controls.Add(this.label_lwRatioLimit);
  638. this.groupBox_baseSetting.Controls.Add(this.label_rollingDirection);
  639. this.groupBox_baseSetting.Controls.Add(this.numericUpDown_lwRatioLimit);
  640. this.groupBox_baseSetting.Location = new System.Drawing.Point(178, 370);
  641. this.groupBox_baseSetting.Name = "groupBox_baseSetting";
  642. this.groupBox_baseSetting.Size = new System.Drawing.Size(360, 51);
  643. this.groupBox_baseSetting.TabIndex = 18;
  644. this.groupBox_baseSetting.TabStop = false;
  645. //
  646. // comboBox1
  647. //
  648. this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  649. this.comboBox1.FormattingEnabled = true;
  650. this.comboBox1.Items.AddRange(new object[] {
  651. "0",
  652. "1",
  653. "2",
  654. "3",
  655. "4",
  656. "5",
  657. "6",
  658. "7",
  659. "8"});
  660. this.comboBox1.Location = new System.Drawing.Point(296, 21);
  661. this.comboBox1.Name = "comboBox1";
  662. this.comboBox1.Size = new System.Drawing.Size(56, 20);
  663. this.comboBox1.TabIndex = 9;
  664. this.comboBox1.SelectionChangeCommitted += new System.EventHandler(this.abc);
  665. //
  666. // label1
  667. //
  668. this.label1.AutoSize = true;
  669. this.label1.Location = new System.Drawing.Point(268, 25);
  670. this.label1.Name = "label1";
  671. this.label1.Size = new System.Drawing.Size(0, 12);
  672. this.label1.TabIndex = 10;
  673. //
  674. // comboBox_rollingDirection
  675. //
  676. this.comboBox_rollingDirection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  677. this.comboBox_rollingDirection.FormattingEnabled = true;
  678. this.comboBox_rollingDirection.Location = new System.Drawing.Point(68, 23);
  679. this.comboBox_rollingDirection.Name = "comboBox_rollingDirection";
  680. this.comboBox_rollingDirection.Size = new System.Drawing.Size(56, 20);
  681. this.comboBox_rollingDirection.TabIndex = 3;
  682. //
  683. // label_lwRatioLimit
  684. //
  685. this.label_lwRatioLimit.AutoSize = true;
  686. this.label_lwRatioLimit.Location = new System.Drawing.Point(130, 26);
  687. this.label_lwRatioLimit.Name = "label_lwRatioLimit";
  688. this.label_lwRatioLimit.Size = new System.Drawing.Size(0, 12);
  689. this.label_lwRatioLimit.TabIndex = 7;
  690. //
  691. // label_rollingDirection
  692. //
  693. this.label_rollingDirection.AutoSize = true;
  694. this.label_rollingDirection.Location = new System.Drawing.Point(8, 26);
  695. this.label_rollingDirection.Name = "label_rollingDirection";
  696. this.label_rollingDirection.Size = new System.Drawing.Size(0, 12);
  697. this.label_rollingDirection.TabIndex = 8;
  698. //
  699. // numericUpDown_lwRatioLimit
  700. //
  701. this.numericUpDown_lwRatioLimit.DecimalPlaces = 2;
  702. this.numericUpDown_lwRatioLimit.Location = new System.Drawing.Point(201, 20);
  703. this.numericUpDown_lwRatioLimit.Maximum = new decimal(new int[] {
  704. 10,
  705. 0,
  706. 0,
  707. 0});
  708. this.numericUpDown_lwRatioLimit.Minimum = new decimal(new int[] {
  709. 1,
  710. 0,
  711. 0,
  712. 0});
  713. this.numericUpDown_lwRatioLimit.Name = "numericUpDown_lwRatioLimit";
  714. this.numericUpDown_lwRatioLimit.Size = new System.Drawing.Size(56, 21);
  715. this.numericUpDown_lwRatioLimit.TabIndex = 5;
  716. this.numericUpDown_lwRatioLimit.Value = new decimal(new int[] {
  717. 3,
  718. 0,
  719. 0,
  720. 0});
  721. this.numericUpDown_lwRatioLimit.ValueChanged += new System.EventHandler(this.numericUpDown_lwRatioLimit_ValueChanged);
  722. //
  723. // groupBox_colorSetting
  724. //
  725. this.groupBox_colorSetting.Controls.Add(this.checkBox_showColorGamutPhase);
  726. this.groupBox_colorSetting.Controls.Add(this.panel_colorGamutPhase);
  727. this.groupBox_colorSetting.Controls.Add(this.button_pickColor);
  728. this.groupBox_colorSetting.Controls.Add(this.label_colorGamut);
  729. this.groupBox_colorSetting.Controls.Add(this.panel_colorGamut);
  730. this.groupBox_colorSetting.Location = new System.Drawing.Point(179, 427);
  731. this.groupBox_colorSetting.Name = "groupBox_colorSetting";
  732. this.groupBox_colorSetting.Size = new System.Drawing.Size(359, 72);
  733. this.groupBox_colorSetting.TabIndex = 26;
  734. this.groupBox_colorSetting.TabStop = false;
  735. //
  736. // checkBox_showColorGamutPhase
  737. //
  738. this.checkBox_showColorGamutPhase.AutoSize = true;
  739. this.checkBox_showColorGamutPhase.Location = new System.Drawing.Point(185, 48);
  740. this.checkBox_showColorGamutPhase.Name = "checkBox_showColorGamutPhase";
  741. this.checkBox_showColorGamutPhase.Size = new System.Drawing.Size(15, 14);
  742. this.checkBox_showColorGamutPhase.TabIndex = 41;
  743. this.checkBox_showColorGamutPhase.UseVisualStyleBackColor = true;
  744. this.checkBox_showColorGamutPhase.CheckedChanged += new System.EventHandler(this.checkBox_showColorGamutPhase_CheckedChanged);
  745. //
  746. // panel_colorGamutPhase
  747. //
  748. this.panel_colorGamutPhase.BackColor = System.Drawing.Color.Lime;
  749. this.panel_colorGamutPhase.Location = new System.Drawing.Point(284, 46);
  750. this.panel_colorGamutPhase.Name = "panel_colorGamutPhase";
  751. this.panel_colorGamutPhase.Size = new System.Drawing.Size(69, 17);
  752. this.panel_colorGamutPhase.TabIndex = 40;
  753. //
  754. // button_pickColor
  755. //
  756. this.button_pickColor.Location = new System.Drawing.Point(284, 17);
  757. this.button_pickColor.Name = "button_pickColor";
  758. this.button_pickColor.Size = new System.Drawing.Size(69, 23);
  759. this.button_pickColor.TabIndex = 36;
  760. this.button_pickColor.UseVisualStyleBackColor = true;
  761. this.button_pickColor.Click += new System.EventHandler(this.button_pickColor_Click);
  762. //
  763. // label_colorGamut
  764. //
  765. this.label_colorGamut.AutoSize = true;
  766. this.label_colorGamut.Location = new System.Drawing.Point(5, 51);
  767. this.label_colorGamut.Name = "label_colorGamut";
  768. this.label_colorGamut.Size = new System.Drawing.Size(0, 12);
  769. this.label_colorGamut.TabIndex = 35;
  770. //
  771. // panel_colorGamut
  772. //
  773. this.panel_colorGamut.Location = new System.Drawing.Point(64, 47);
  774. this.panel_colorGamut.Name = "panel_colorGamut";
  775. this.panel_colorGamut.Size = new System.Drawing.Size(110, 17);
  776. this.panel_colorGamut.TabIndex = 34;
  777. this.panel_colorGamut.Paint += new System.Windows.Forms.PaintEventHandler(this.panel_colorGamut_Paint);
  778. //
  779. // groupBox_displaySetting
  780. //
  781. this.groupBox_displaySetting.Location = new System.Drawing.Point(179, 646);
  782. this.groupBox_displaySetting.Name = "groupBox_displaySetting";
  783. this.groupBox_displaySetting.Size = new System.Drawing.Size(359, 56);
  784. this.groupBox_displaySetting.TabIndex = 29;
  785. this.groupBox_displaySetting.TabStop = false;
  786. //
  787. // groupBox_histogram
  788. //
  789. this.groupBox_histogram.Location = new System.Drawing.Point(179, 505);
  790. this.groupBox_histogram.Name = "groupBox_histogram";
  791. this.groupBox_histogram.Size = new System.Drawing.Size(179, 135);
  792. this.groupBox_histogram.TabIndex = 28;
  793. this.groupBox_histogram.TabStop = false;
  794. //
  795. // groupBox_colorAdjustment
  796. //
  797. this.groupBox_colorAdjustment.Controls.Add(this.button_colorAdjustmentBS);
  798. this.groupBox_colorAdjustment.Controls.Add(this.button_colorAdjustmentGL);
  799. this.groupBox_colorAdjustment.Controls.Add(this.button_colorAdjustmentRH);
  800. this.groupBox_colorAdjustment.Controls.Add(this.numericUpDown_colorAdjustmentBSD);
  801. this.groupBox_colorAdjustment.Controls.Add(this.numericUpDown_colorAdjustmentBSU);
  802. this.groupBox_colorAdjustment.Controls.Add(this.label_colorAdjustmentBS);
  803. this.groupBox_colorAdjustment.Controls.Add(this.numericUpDown_colorAdjustmentGLD);
  804. this.groupBox_colorAdjustment.Controls.Add(this.numericUpDown_colorAdjustmentGLU);
  805. this.groupBox_colorAdjustment.Controls.Add(this.label_colorAdjustmentGL);
  806. this.groupBox_colorAdjustment.Controls.Add(this.numericUpDown_colorAdjustmentRHD);
  807. this.groupBox_colorAdjustment.Controls.Add(this.numericUpDown_colorAdjustmentRHU);
  808. this.groupBox_colorAdjustment.Controls.Add(this.label_colorAdjustmentRH);
  809. this.groupBox_colorAdjustment.Controls.Add(this.radioButton_checkedHLS);
  810. this.groupBox_colorAdjustment.Controls.Add(this.radioButton_checkedRGB);
  811. this.groupBox_colorAdjustment.Location = new System.Drawing.Point(364, 505);
  812. this.groupBox_colorAdjustment.Name = "groupBox_colorAdjustment";
  813. this.groupBox_colorAdjustment.Size = new System.Drawing.Size(174, 135);
  814. this.groupBox_colorAdjustment.TabIndex = 27;
  815. this.groupBox_colorAdjustment.TabStop = false;
  816. //
  817. // button_colorAdjustmentBS
  818. //
  819. this.button_colorAdjustmentBS.Location = new System.Drawing.Point(134, 99);
  820. this.button_colorAdjustmentBS.Name = "button_colorAdjustmentBS";
  821. this.button_colorAdjustmentBS.Size = new System.Drawing.Size(34, 21);
  822. this.button_colorAdjustmentBS.TabIndex = 34;
  823. this.button_colorAdjustmentBS.Text = "B";
  824. this.button_colorAdjustmentBS.UseVisualStyleBackColor = true;
  825. this.button_colorAdjustmentBS.Click += new System.EventHandler(this.button_colorAdjustmentBS_Click);
  826. //
  827. // button_colorAdjustmentGL
  828. //
  829. this.button_colorAdjustmentGL.Location = new System.Drawing.Point(134, 72);
  830. this.button_colorAdjustmentGL.Name = "button_colorAdjustmentGL";
  831. this.button_colorAdjustmentGL.Size = new System.Drawing.Size(34, 21);
  832. this.button_colorAdjustmentGL.TabIndex = 33;
  833. this.button_colorAdjustmentGL.Text = "G";
  834. this.button_colorAdjustmentGL.UseVisualStyleBackColor = true;
  835. this.button_colorAdjustmentGL.Click += new System.EventHandler(this.button_colorAdjustmentGL_Click);
  836. //
  837. // button_colorAdjustmentRH
  838. //
  839. this.button_colorAdjustmentRH.BackColor = System.Drawing.SystemColors.Control;
  840. this.button_colorAdjustmentRH.Location = new System.Drawing.Point(134, 45);
  841. this.button_colorAdjustmentRH.Margin = new System.Windows.Forms.Padding(0);
  842. this.button_colorAdjustmentRH.Name = "button_colorAdjustmentRH";
  843. this.button_colorAdjustmentRH.Size = new System.Drawing.Size(34, 21);
  844. this.button_colorAdjustmentRH.TabIndex = 32;
  845. this.button_colorAdjustmentRH.Text = "R";
  846. this.button_colorAdjustmentRH.UseVisualStyleBackColor = true;
  847. this.button_colorAdjustmentRH.Click += new System.EventHandler(this.button_colorAdjustmentRH_Click);
  848. //
  849. // numericUpDown_colorAdjustmentBSD
  850. //
  851. this.numericUpDown_colorAdjustmentBSD.Location = new System.Drawing.Point(82, 99);
  852. this.numericUpDown_colorAdjustmentBSD.Maximum = new decimal(new int[] {
  853. 255,
  854. 0,
  855. 0,
  856. 0});
  857. this.numericUpDown_colorAdjustmentBSD.Name = "numericUpDown_colorAdjustmentBSD";
  858. this.numericUpDown_colorAdjustmentBSD.Size = new System.Drawing.Size(40, 21);
  859. this.numericUpDown_colorAdjustmentBSD.TabIndex = 30;
  860. this.numericUpDown_colorAdjustmentBSD.Tag = "max";
  861. this.numericUpDown_colorAdjustmentBSD.Value = new decimal(new int[] {
  862. 10,
  863. 0,
  864. 0,
  865. 0});
  866. this.numericUpDown_colorAdjustmentBSD.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
  867. this.numericUpDown_colorAdjustmentBSD.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RGBoRHLSValue_Changed);
  868. //
  869. // numericUpDown_colorAdjustmentBSU
  870. //
  871. this.numericUpDown_colorAdjustmentBSU.Location = new System.Drawing.Point(37, 99);
  872. this.numericUpDown_colorAdjustmentBSU.Maximum = new decimal(new int[] {
  873. 255,
  874. 0,
  875. 0,
  876. 0});
  877. this.numericUpDown_colorAdjustmentBSU.Name = "numericUpDown_colorAdjustmentBSU";
  878. this.numericUpDown_colorAdjustmentBSU.Size = new System.Drawing.Size(40, 21);
  879. this.numericUpDown_colorAdjustmentBSU.TabIndex = 29;
  880. this.numericUpDown_colorAdjustmentBSU.Tag = "min";
  881. this.numericUpDown_colorAdjustmentBSU.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
  882. this.numericUpDown_colorAdjustmentBSU.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RGBoRHLSValue_Changed);
  883. //
  884. // label_colorAdjustmentBS
  885. //
  886. this.label_colorAdjustmentBS.AutoSize = true;
  887. this.label_colorAdjustmentBS.Location = new System.Drawing.Point(10, 103);
  888. this.label_colorAdjustmentBS.Name = "label_colorAdjustmentBS";
  889. this.label_colorAdjustmentBS.Size = new System.Drawing.Size(23, 12);
  890. this.label_colorAdjustmentBS.TabIndex = 31;
  891. this.label_colorAdjustmentBS.Text = "B:";
  892. //
  893. // numericUpDown_colorAdjustmentGLD
  894. //
  895. this.numericUpDown_colorAdjustmentGLD.Location = new System.Drawing.Point(82, 72);
  896. this.numericUpDown_colorAdjustmentGLD.Maximum = new decimal(new int[] {
  897. 255,
  898. 0,
  899. 0,
  900. 0});
  901. this.numericUpDown_colorAdjustmentGLD.Name = "numericUpDown_colorAdjustmentGLD";
  902. this.numericUpDown_colorAdjustmentGLD.Size = new System.Drawing.Size(40, 21);
  903. this.numericUpDown_colorAdjustmentGLD.TabIndex = 27;
  904. this.numericUpDown_colorAdjustmentGLD.Tag = "max";
  905. this.numericUpDown_colorAdjustmentGLD.Value = new decimal(new int[] {
  906. 10,
  907. 0,
  908. 0,
  909. 0});
  910. this.numericUpDown_colorAdjustmentGLD.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
  911. this.numericUpDown_colorAdjustmentGLD.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RGBoRHLSValue_Changed);
  912. //
  913. // numericUpDown_colorAdjustmentGLU
  914. //
  915. this.numericUpDown_colorAdjustmentGLU.Location = new System.Drawing.Point(37, 72);
  916. this.numericUpDown_colorAdjustmentGLU.Maximum = new decimal(new int[] {
  917. 255,
  918. 0,
  919. 0,
  920. 0});
  921. this.numericUpDown_colorAdjustmentGLU.Name = "numericUpDown_colorAdjustmentGLU";
  922. this.numericUpDown_colorAdjustmentGLU.Size = new System.Drawing.Size(40, 21);
  923. this.numericUpDown_colorAdjustmentGLU.TabIndex = 26;
  924. this.numericUpDown_colorAdjustmentGLU.Tag = "min";
  925. this.numericUpDown_colorAdjustmentGLU.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
  926. this.numericUpDown_colorAdjustmentGLU.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RGBoRHLSValue_Changed);
  927. //
  928. // label_colorAdjustmentGL
  929. //
  930. this.label_colorAdjustmentGL.AutoSize = true;
  931. this.label_colorAdjustmentGL.Location = new System.Drawing.Point(10, 76);
  932. this.label_colorAdjustmentGL.Name = "label_colorAdjustmentGL";
  933. this.label_colorAdjustmentGL.Size = new System.Drawing.Size(23, 12);
  934. this.label_colorAdjustmentGL.TabIndex = 28;
  935. this.label_colorAdjustmentGL.Text = "G:";
  936. //
  937. // numericUpDown_colorAdjustmentRHD
  938. //
  939. this.numericUpDown_colorAdjustmentRHD.Location = new System.Drawing.Point(82, 45);
  940. this.numericUpDown_colorAdjustmentRHD.Maximum = new decimal(new int[] {
  941. 255,
  942. 0,
  943. 0,
  944. 0});
  945. this.numericUpDown_colorAdjustmentRHD.Name = "numericUpDown_colorAdjustmentRHD";
  946. this.numericUpDown_colorAdjustmentRHD.Size = new System.Drawing.Size(40, 21);
  947. this.numericUpDown_colorAdjustmentRHD.TabIndex = 8;
  948. this.numericUpDown_colorAdjustmentRHD.Tag = "max";
  949. this.numericUpDown_colorAdjustmentRHD.Value = new decimal(new int[] {
  950. 10,
  951. 0,
  952. 0,
  953. 0});
  954. this.numericUpDown_colorAdjustmentRHD.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
  955. this.numericUpDown_colorAdjustmentRHD.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RGBoRHLSValue_Changed);
  956. //
  957. // numericUpDown_colorAdjustmentRHU
  958. //
  959. this.numericUpDown_colorAdjustmentRHU.Location = new System.Drawing.Point(37, 45);
  960. this.numericUpDown_colorAdjustmentRHU.Maximum = new decimal(new int[] {
  961. 255,
  962. 0,
  963. 0,
  964. 0});
  965. this.numericUpDown_colorAdjustmentRHU.Name = "numericUpDown_colorAdjustmentRHU";
  966. this.numericUpDown_colorAdjustmentRHU.Size = new System.Drawing.Size(40, 21);
  967. this.numericUpDown_colorAdjustmentRHU.TabIndex = 7;
  968. this.numericUpDown_colorAdjustmentRHU.Tag = "min";
  969. this.numericUpDown_colorAdjustmentRHU.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
  970. this.numericUpDown_colorAdjustmentRHU.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RGBoRHLSValue_Changed);
  971. //
  972. // label_colorAdjustmentRH
  973. //
  974. this.label_colorAdjustmentRH.AutoSize = true;
  975. this.label_colorAdjustmentRH.Location = new System.Drawing.Point(10, 49);
  976. this.label_colorAdjustmentRH.Name = "label_colorAdjustmentRH";
  977. this.label_colorAdjustmentRH.Size = new System.Drawing.Size(23, 12);
  978. this.label_colorAdjustmentRH.TabIndex = 25;
  979. this.label_colorAdjustmentRH.Text = "R:";
  980. //
  981. // radioButton_checkedHLS
  982. //
  983. this.radioButton_checkedHLS.AutoSize = true;
  984. this.radioButton_checkedHLS.Location = new System.Drawing.Point(66, 20);
  985. this.radioButton_checkedHLS.Name = "radioButton_checkedHLS";
  986. this.radioButton_checkedHLS.Size = new System.Drawing.Size(41, 16);
  987. this.radioButton_checkedHLS.TabIndex = 4;
  988. this.radioButton_checkedHLS.Text = "HLS";
  989. this.radioButton_checkedHLS.UseVisualStyleBackColor = true;
  990. this.radioButton_checkedHLS.Visible = false;
  991. this.radioButton_checkedHLS.CheckedChanged += new System.EventHandler(this.radioButton_checkedHLS_CheckedChanged);
  992. //
  993. // radioButton_checkedRGB
  994. //
  995. this.radioButton_checkedRGB.AutoSize = true;
  996. this.radioButton_checkedRGB.Checked = true;
  997. this.radioButton_checkedRGB.Location = new System.Drawing.Point(7, 20);
  998. this.radioButton_checkedRGB.Name = "radioButton_checkedRGB";
  999. this.radioButton_checkedRGB.Size = new System.Drawing.Size(41, 16);
  1000. this.radioButton_checkedRGB.TabIndex = 3;
  1001. this.radioButton_checkedRGB.TabStop = true;
  1002. this.radioButton_checkedRGB.Text = "RGB";
  1003. this.radioButton_checkedRGB.UseVisualStyleBackColor = true;
  1004. this.radioButton_checkedRGB.CheckedChanged += new System.EventHandler(this.radioButton_checkedRGB_CheckedChanged);
  1005. //
  1006. // groupBox_review
  1007. //
  1008. this.groupBox_review.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  1009. | System.Windows.Forms.AnchorStyles.Left)
  1010. | System.Windows.Forms.AnchorStyles.Right)));
  1011. this.groupBox_review.Location = new System.Drawing.Point(544, 121);
  1012. this.groupBox_review.Name = "groupBox_review";
  1013. this.groupBox_review.Size = new System.Drawing.Size(622, 581);
  1014. this.groupBox_review.TabIndex = 30;
  1015. this.groupBox_review.TabStop = false;
  1016. //
  1017. // groupBox_report
  1018. //
  1019. this.groupBox_report.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  1020. this.groupBox_report.Controls.Add(this.button1);
  1021. this.groupBox_report.Controls.Add(this.label_resultPrecision);
  1022. this.groupBox_report.Controls.Add(this.domainUpDown_resultPrecision);
  1023. this.groupBox_report.Controls.Add(this.button_exportResults);
  1024. this.groupBox_report.Controls.Add(this.button_generateReport);
  1025. this.groupBox_report.Location = new System.Drawing.Point(1024, 708);
  1026. this.groupBox_report.Name = "groupBox_report";
  1027. this.groupBox_report.Size = new System.Drawing.Size(142, 188);
  1028. this.groupBox_report.TabIndex = 33;
  1029. this.groupBox_report.TabStop = false;
  1030. //
  1031. // button1
  1032. //
  1033. this.button1.Location = new System.Drawing.Point(28, 104);
  1034. this.button1.Name = "button1";
  1035. this.button1.Size = new System.Drawing.Size(75, 23);
  1036. this.button1.TabIndex = 4;
  1037. this.button1.UseVisualStyleBackColor = true;
  1038. this.button1.Click += new System.EventHandler(this.button1_Click);
  1039. //
  1040. // label_resultPrecision
  1041. //
  1042. this.label_resultPrecision.AutoSize = true;
  1043. this.label_resultPrecision.Location = new System.Drawing.Point(21, 148);
  1044. this.label_resultPrecision.Name = "label_resultPrecision";
  1045. this.label_resultPrecision.Size = new System.Drawing.Size(0, 12);
  1046. this.label_resultPrecision.TabIndex = 3;
  1047. //
  1048. // domainUpDown_resultPrecision
  1049. //
  1050. this.domainUpDown_resultPrecision.Location = new System.Drawing.Point(63, 142);
  1051. this.domainUpDown_resultPrecision.Name = "domainUpDown_resultPrecision";
  1052. this.domainUpDown_resultPrecision.ReadOnly = true;
  1053. this.domainUpDown_resultPrecision.Size = new System.Drawing.Size(41, 21);
  1054. this.domainUpDown_resultPrecision.TabIndex = 2;
  1055. this.domainUpDown_resultPrecision.Text = "2";
  1056. this.domainUpDown_resultPrecision.SelectedItemChanged += new System.EventHandler(this.domainUpDown_resultPrecision_SelectedItemChanged);
  1057. //
  1058. // button_exportResults
  1059. //
  1060. this.button_exportResults.Location = new System.Drawing.Point(28, 63);
  1061. this.button_exportResults.Name = "button_exportResults";
  1062. this.button_exportResults.Size = new System.Drawing.Size(75, 24);
  1063. this.button_exportResults.TabIndex = 1;
  1064. this.button_exportResults.UseVisualStyleBackColor = true;
  1065. this.button_exportResults.Click += new System.EventHandler(this.button_exportResults_Click);
  1066. //
  1067. // button_generateReport
  1068. //
  1069. this.button_generateReport.Location = new System.Drawing.Point(29, 24);
  1070. this.button_generateReport.Name = "button_generateReport";
  1071. this.button_generateReport.Size = new System.Drawing.Size(75, 23);
  1072. this.button_generateReport.TabIndex = 0;
  1073. this.button_generateReport.UseVisualStyleBackColor = true;
  1074. this.button_generateReport.Click += new System.EventHandler(this.button_generateReport_Click);
  1075. //
  1076. // groupBox6groupBox_analysisResult2
  1077. //
  1078. this.groupBox6groupBox_analysisResult2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  1079. | System.Windows.Forms.AnchorStyles.Right)));
  1080. this.groupBox6groupBox_analysisResult2.Controls.Add(this.listView_analysisResult2);
  1081. this.groupBox6groupBox_analysisResult2.Controls.Add(this.listView_analysisResult);
  1082. this.groupBox6groupBox_analysisResult2.Location = new System.Drawing.Point(242, 708);
  1083. this.groupBox6groupBox_analysisResult2.Name = "groupBox6groupBox_analysisResult2";
  1084. this.groupBox6groupBox_analysisResult2.Size = new System.Drawing.Size(769, 188);
  1085. this.groupBox6groupBox_analysisResult2.TabIndex = 32;
  1086. this.groupBox6groupBox_analysisResult2.TabStop = false;
  1087. //
  1088. // listView_analysisResult2
  1089. //
  1090. this.listView_analysisResult2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  1091. | System.Windows.Forms.AnchorStyles.Right)));
  1092. this.listView_analysisResult2.FullRowSelect = true;
  1093. this.listView_analysisResult2.GridLines = true;
  1094. this.listView_analysisResult2.HideSelection = false;
  1095. this.listView_analysisResult2.Location = new System.Drawing.Point(6, 114);
  1096. this.listView_analysisResult2.MultiSelect = false;
  1097. this.listView_analysisResult2.Name = "listView_analysisResult2";
  1098. this.listView_analysisResult2.Size = new System.Drawing.Size(757, 63);
  1099. this.listView_analysisResult2.TabIndex = 2;
  1100. this.listView_analysisResult2.UseCompatibleStateImageBehavior = false;
  1101. //
  1102. // listView_analysisResult
  1103. //
  1104. this.listView_analysisResult.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  1105. | System.Windows.Forms.AnchorStyles.Right)));
  1106. this.listView_analysisResult.FullRowSelect = true;
  1107. this.listView_analysisResult.GridLines = true;
  1108. this.listView_analysisResult.HideSelection = false;
  1109. this.listView_analysisResult.Location = new System.Drawing.Point(6, 20);
  1110. this.listView_analysisResult.MultiSelect = false;
  1111. this.listView_analysisResult.Name = "listView_analysisResult";
  1112. this.listView_analysisResult.Size = new System.Drawing.Size(757, 88);
  1113. this.listView_analysisResult.TabIndex = 2;
  1114. this.listView_analysisResult.UseCompatibleStateImageBehavior = false;
  1115. //
  1116. // groupBox_analysisResult1
  1117. //
  1118. this.groupBox_analysisResult1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  1119. this.groupBox_analysisResult1.Controls.Add(this.listBox_analysisResult);
  1120. this.groupBox_analysisResult1.Controls.Add(this.button_remove);
  1121. this.groupBox_analysisResult1.Controls.Add(this.button_all);
  1122. this.groupBox_analysisResult1.Location = new System.Drawing.Point(12, 708);
  1123. this.groupBox_analysisResult1.Name = "groupBox_analysisResult1";
  1124. this.groupBox_analysisResult1.Size = new System.Drawing.Size(224, 188);
  1125. this.groupBox_analysisResult1.TabIndex = 31;
  1126. this.groupBox_analysisResult1.TabStop = false;
  1127. //
  1128. // listBox_analysisResult
  1129. //
  1130. this.listBox_analysisResult.CheckOnClick = true;
  1131. this.listBox_analysisResult.FormattingEnabled = true;
  1132. this.listBox_analysisResult.HorizontalScrollbar = true;
  1133. this.listBox_analysisResult.Location = new System.Drawing.Point(6, 53);
  1134. this.listBox_analysisResult.Name = "listBox_analysisResult";
  1135. this.listBox_analysisResult.Size = new System.Drawing.Size(199, 132);
  1136. this.listBox_analysisResult.TabIndex = 0;
  1137. this.listBox_analysisResult.SelectedIndexChanged += new System.EventHandler(this.listBox_analysisResult_SelectedIndexChanged);
  1138. //
  1139. // button_remove
  1140. //
  1141. this.button_remove.Location = new System.Drawing.Point(130, 24);
  1142. this.button_remove.Name = "button_remove";
  1143. this.button_remove.Size = new System.Drawing.Size(75, 23);
  1144. this.button_remove.TabIndex = 8;
  1145. this.button_remove.UseVisualStyleBackColor = true;
  1146. this.button_remove.Click += new System.EventHandler(this.button_remove_Click);
  1147. //
  1148. // button_all
  1149. //
  1150. this.button_all.Location = new System.Drawing.Point(14, 24);
  1151. this.button_all.Name = "button_all";
  1152. this.button_all.Size = new System.Drawing.Size(75, 23);
  1153. this.button_all.TabIndex = 1;
  1154. this.button_all.UseVisualStyleBackColor = true;
  1155. this.button_all.Click += new System.EventHandler(this.button_all_Click);
  1156. //
  1157. // groupBox1
  1158. //
  1159. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  1160. | System.Windows.Forms.AnchorStyles.Right)));
  1161. this.groupBox1.Controls.Add(this.button4);
  1162. this.groupBox1.Controls.Add(this.button3);
  1163. this.groupBox1.Location = new System.Drawing.Point(544, 71);
  1164. this.groupBox1.Name = "groupBox1";
  1165. this.groupBox1.Size = new System.Drawing.Size(621, 44);
  1166. this.groupBox1.TabIndex = 34;
  1167. this.groupBox1.TabStop = false;
  1168. //
  1169. // button4
  1170. //
  1171. this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1172. this.button4.Location = new System.Drawing.Point(459, 15);
  1173. this.button4.Name = "button4";
  1174. this.button4.Size = new System.Drawing.Size(75, 23);
  1175. this.button4.TabIndex = 9;
  1176. this.button4.Text = "应用全部";
  1177. this.button4.UseVisualStyleBackColor = true;
  1178. this.button4.Click += new System.EventHandler(this.button4_Click);
  1179. //
  1180. // button3
  1181. //
  1182. this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1183. this.button3.Location = new System.Drawing.Point(540, 15);
  1184. this.button3.Name = "button3";
  1185. this.button3.Size = new System.Drawing.Size(75, 23);
  1186. this.button3.TabIndex = 8;
  1187. this.button3.Text = "保存全部";
  1188. this.button3.UseVisualStyleBackColor = true;
  1189. this.button3.Click += new System.EventHandler(this.button3_Click);
  1190. //
  1191. // InclusionsStandardDialog
  1192. //
  1193. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  1194. this.ClientSize = new System.Drawing.Size(1177, 908);
  1195. this.Controls.Add(this.groupBox1);
  1196. this.Controls.Add(this.groupBox_baseSetting);
  1197. this.Controls.Add(this.groupBox_report);
  1198. this.Controls.Add(this.groupBox6groupBox_analysisResult2);
  1199. this.Controls.Add(this.groupBox_analysisResult1);
  1200. this.Controls.Add(this.groupBox_review);
  1201. this.Controls.Add(this.groupBox_displaySetting);
  1202. this.Controls.Add(this.groupBox_histogram);
  1203. this.Controls.Add(this.groupBox_colorAdjustment);
  1204. this.Controls.Add(this.groupBox_colorSetting);
  1205. this.Controls.Add(this.groupBox_img);
  1206. this.Controls.Add(this.groupBox_operating);
  1207. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  1208. this.Name = "InclusionsStandardDialog";
  1209. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InclusionsStandardDialog_FormClosing);
  1210. this.Controls.SetChildIndex(this.groupBox_operating, 0);
  1211. this.Controls.SetChildIndex(this.groupBox_img, 0);
  1212. this.Controls.SetChildIndex(this.groupBox_colorSetting, 0);
  1213. this.Controls.SetChildIndex(this.groupBox_colorAdjustment, 0);
  1214. this.Controls.SetChildIndex(this.groupBox_histogram, 0);
  1215. this.Controls.SetChildIndex(this.groupBox_displaySetting, 0);
  1216. this.Controls.SetChildIndex(this.groupBox_review, 0);
  1217. this.Controls.SetChildIndex(this.groupBox_analysisResult1, 0);
  1218. this.Controls.SetChildIndex(this.groupBox6groupBox_analysisResult2, 0);
  1219. this.Controls.SetChildIndex(this.groupBox_report, 0);
  1220. this.Controls.SetChildIndex(this.groupBox_baseSetting, 0);
  1221. this.Controls.SetChildIndex(this.groupBox1, 0);
  1222. this.groupBox_operating.ResumeLayout(false);
  1223. this.groupBox_operating.PerformLayout();
  1224. this.groupBox_img.ResumeLayout(false);
  1225. this.groupBox_baseSetting.ResumeLayout(false);
  1226. this.groupBox_baseSetting.PerformLayout();
  1227. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).EndInit();
  1228. this.groupBox_colorSetting.ResumeLayout(false);
  1229. this.groupBox_colorSetting.PerformLayout();
  1230. this.groupBox_colorAdjustment.ResumeLayout(false);
  1231. this.groupBox_colorAdjustment.PerformLayout();
  1232. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentBSD)).EndInit();
  1233. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentBSU)).EndInit();
  1234. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentGLD)).EndInit();
  1235. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentGLU)).EndInit();
  1236. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentRHD)).EndInit();
  1237. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentRHU)).EndInit();
  1238. this.groupBox_report.ResumeLayout(false);
  1239. this.groupBox_report.PerformLayout();
  1240. this.groupBox6groupBox_analysisResult2.ResumeLayout(false);
  1241. this.groupBox_analysisResult1.ResumeLayout(false);
  1242. this.groupBox1.ResumeLayout(false);
  1243. this.ResumeLayout(false);
  1244. }
  1245. private void abc(object sender, EventArgs e)
  1246. {
  1247. if (this.listBox_analysisResult.Items.Count > 0)
  1248. {
  1249. MessageBox.Show(PdnResources.GetString("Menu.sultsbeforemodifyingtheKvalue.Text"));
  1250. this.comboBox1.SelectedIndex = chooseK;
  1251. return;
  1252. }
  1253. if (this.lstView_img.FocusedItem != null)
  1254. {
  1255. if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
  1256. {
  1257. everyImgData[this.lstView_img.FocusedItem.Index].kNum = Convert.ToInt32(this.comboBox1.SelectedItem);
  1258. }
  1259. else
  1260. {
  1261. CurrentPageData data = new CurrentPageData(this.autoJiaoBen);
  1262. data.directionIndex = comboBox_rollingDirection.SelectedIndex;
  1263. data.ratio = numericUpDown_lwRatioLimit.Value;
  1264. data.colorCheck = this.checkBox_showColorGamutPhase.Checked;
  1265. data.kNum = Convert.ToInt32(this.comboBox1.SelectedItem);
  1266. everyImgData.Add(this.lstView_img.FocusedItem.Index, data);
  1267. }
  1268. }
  1269. this.comboBox1_SelectedIndexChanged(sender,e);
  1270. }
  1271. public void Initialize()
  1272. {
  1273. if (this.Text == "DIN50602_1985_MethodK")
  1274. {
  1275. this.comboBox1.Visible = true;
  1276. this.label1.Visible = true;
  1277. this.button2.Visible = true;
  1278. this.btn_drawRecognitionArea.Visible = false;
  1279. this.isK = 1;
  1280. }
  1281. else {
  1282. this.comboBox1.Visible = false;
  1283. this.label1.Visible = false;
  1284. this.button2.Visible = false;
  1285. this.btn_drawRecognitionArea.Visible = true;
  1286. this.isK = 2;
  1287. }
  1288. radioButton1.Enabled = false;
  1289. radioButton2.Enabled = false;
  1290. checkBox1.Enabled = false;
  1291. checkBox2.Enabled = false;
  1292. this.Load += new System.EventHandler(this.GrainSizeDialog_Load);
  1293. this.comboBox_rollingDirection.SelectedIndex = 0;
  1294. this.comboBox_rollingDirection.SelectedIndexChanged += new System.EventHandler(this.comboBox_rollingDirection_SelectedIndexChanged);
  1295. this.comboBox1.SelectedIndex = 3;
  1296. //this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
  1297. for (int i = 10; i >= 1 ; i--)
  1298. {
  1299. this.domainUpDown_resultPrecision.Items.Add(i.ToString());
  1300. }
  1301. this.domainUpDown_resultPrecision.SelectedIndex = 8;
  1302. this.documentItems = new Dictionary<int, DocumentItem>();
  1303. //初始化图片列表
  1304. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  1305. {
  1306. this.imageList_img.Images.Add("img" + i , this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  1307. this.lstView_img.Items.Add("", i);
  1308. this.lstView_img.Items[i].ImageIndex = i;
  1309. this.lstView_img.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  1310. this.lstView_img.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  1311. if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
  1312. {
  1313. this.imgIndex = i;
  1314. }
  1315. }
  1316. //
  1317. //初始化图像控件
  1318. //
  1319. this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
  1320. this.documentWorkspace.Cursor = Cursors.Default;
  1321. this.documentWorkspace.Dock = DockStyle.Fill;
  1322. this.documentWorkspace.HookMouseEvents();
  1323. this.documentWorkspace.AuxiliaryLineEnabled = false;
  1324. this.documentWorkspace.Visible = true;
  1325. this.documentWorkspace.panel.Click += new EventHandler(this.documentWorkspace_panel_Click);
  1326. this.documentWorkspace.panel.MouseDown += new MouseEventHandler(this.documentWorkspace_panel_MouseDown);
  1327. this.documentWorkspace.panel.MouseMove += new MouseEventHandler(this.documentWorkspace_panel_MouseMove);
  1328. this.documentWorkspace.panel.MouseUp += new MouseEventHandler(this.documentWorkspace_panel_MouseUp);
  1329. PdnBaseForm.RegisterFormHotKey(Keys.Delete, (key) => { this.documentWorkspace.MouseEvent_Del(null,null); return true; });
  1330. this.groupBox_review.Controls.Add(this.documentWorkspace);
  1331. //
  1332. //初始化操作按钮
  1333. //
  1334. this.commonControlButtons = new CommonControlButtons();
  1335. this.commonControlButtons.Dock = DockStyle.Top;
  1336. this.commonControlButtons.Height = 30;
  1337. this.commonControlButtons.HideZoomToWindowAndActualSize();
  1338. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  1339. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  1340. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  1341. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  1342. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  1343. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  1344. groupBox_review.Controls.Add(this.commonControlButtons);
  1345. this.binaryExtractionModel.ColorInterval = 1;
  1346. this.radioButton_checkedRGB.FlatStyle = FlatStyle.Flat;
  1347. this.radioButton_checkedRGB.BackColor = Color.FromArgb(225, 225, 225);
  1348. this.radioButton_checkedRGB.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  1349. this.radioButton_checkedRGB.FlatAppearance.BorderSize = 2;
  1350. // 直方图
  1351. this.histogramControl_colorSetting.DragOneEventActionFinish += new EventHandler<EventArgs<int>>(this.histogramControl_colorSetting_DragOneEvent);
  1352. this.histogramControl_colorSetting.DragTwoEventActionFinish += new EventHandler<EventArgs<int>>(this.histogramControl_colorSetting_DragTwoEvent);
  1353. // 初始化报告列表
  1354. this.listView_analysisResult.View = View.Details;
  1355. this.listView_analysisResult2.View = View.Details;
  1356. this.listBox_analysisResult.DisplayMember = "Display";
  1357. this.listBox_analysisResult.ValueMember = "Value";
  1358. }
  1359. #endregion
  1360. #region 事件
  1361. #region 公共按钮
  1362. private void zoomInButton_Click(object sender, EventArgs e)
  1363. {
  1364. this.documentWorkspace.ZoomIn();
  1365. }
  1366. private void zoomOutButton_Click(object sender, EventArgs e)
  1367. {
  1368. this.documentWorkspace.ZoomOut();
  1369. }
  1370. private void zoomToWindowButton_Click(object sender, EventArgs e)
  1371. {
  1372. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  1373. }
  1374. private void actualSizeButton_Click(object sender, EventArgs e)
  1375. {
  1376. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  1377. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  1378. }
  1379. private void pointerButton_Click(object sender, EventArgs e)
  1380. {
  1381. this.documentWorkspace.Cursor = Cursors.Default;
  1382. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.InclusionSelectRecognitionArea;
  1383. }
  1384. private void mobileModeButton_Click(object sender, EventArgs e)
  1385. {
  1386. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  1387. }
  1388. #endregion
  1389. private void btn_selectClear_Click(object sender, EventArgs e)
  1390. {
  1391. this.clearSelect = true;
  1392. }
  1393. private void label_displaySetting(object sender, EventArgs e)
  1394. {
  1395. if (this.lstView_img.FocusedItem == null || !this.lstView_img.FocusedItem.Selected)
  1396. {
  1397. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text"));
  1398. return;
  1399. }
  1400. if (this.documentWorkspace.phaseModels[0].mat == null)
  1401. {
  1402. MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformabinaryoperationfirst.text"));
  1403. return;
  1404. }
  1405. //按钮选择
  1406. if (this.isK == 1) {
  1407. this.documentWorkspace.activeTool = DrawToolType.InclusionSelectRecognitionArea;
  1408. }
  1409. if (this.selectedTypesOfInclusions != null) {
  1410. if (this.selectedTypesOfInclusions.Equals(this.methodOfAssessment.inclusionsStandard.globalSettings.typeDics[((Button)sender).Text]))
  1411. {
  1412. this.selectedTypesOfInclusions = null;
  1413. this.button1.Focus();
  1414. }
  1415. else
  1416. {
  1417. this.selectedTypesOfInclusions = this.methodOfAssessment.inclusionsStandard.globalSettings.typeDics[((Button)sender).Text];
  1418. }
  1419. }
  1420. else {
  1421. this.selectedTypesOfInclusions = this.methodOfAssessment.inclusionsStandard.globalSettings.typeDics[((Button)sender).Text];
  1422. }
  1423. }
  1424. private void button_setting_Click(object sender, EventArgs e)
  1425. {
  1426. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, this.methodOfAssessment.resourcesName);
  1427. if (recombinationRateSetDialog.hasModule)
  1428. {
  1429. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  1430. recombinationRateSetDialog.ShowDialog();
  1431. }
  1432. else
  1433. {
  1434. recombinationRateSetDialog = null;
  1435. }
  1436. }
  1437. private void checkBox_showColorGamutPhase_CheckedChanged(object sender, EventArgs e)
  1438. {
  1439. if (this.documentWorkspace.phaseModels.Count == 0)
  1440. {
  1441. return;
  1442. }
  1443. CheckBox checkBox = (CheckBox)sender;
  1444. if (this.lstView_img.FocusedItem != null)
  1445. {
  1446. if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
  1447. {
  1448. everyImgData[this.lstView_img.FocusedItem.Index].colorCheck = this.checkBox_showColorGamutPhase.Checked;
  1449. }
  1450. else
  1451. {
  1452. CurrentPageData data = new CurrentPageData(this.autoJiaoBen);
  1453. data.directionIndex = comboBox_rollingDirection.SelectedIndex;
  1454. data.ratio = numericUpDown_lwRatioLimit.Value;
  1455. data.colorCheck = this.checkBox_showColorGamutPhase.Checked;
  1456. everyImgData.Add(this.lstView_img.FocusedItem.Index, data);
  1457. }
  1458. }
  1459. this.documentWorkspace.phaseModels[this.documentWorkspace.phaseModels.Count - 1].choise = checkBox.Checked;
  1460. this.documentWorkspace.Refresh();
  1461. }
  1462. private void btn_clean_result_Click(object sender, EventArgs e)
  1463. {
  1464. this.tempAnalysisResult = null;
  1465. ToolInclusionSelect.CleanInclusionAll(this.documentWorkspace);
  1466. radioButton1.Enabled = false;
  1467. radioButton2.Enabled = false;
  1468. checkBox1.Enabled = false;
  1469. checkBox2.Enabled = false;
  1470. userAll = false;
  1471. }
  1472. private void btn_statistics_Click(object sender, EventArgs e)
  1473. {
  1474. if (this.isK == 1)
  1475. {
  1476. this.documentWorkspace.activeTool = DrawToolType.InclusionSelectRecognitionArea;
  1477. }
  1478. this.startStatistics();
  1479. radioButton1.Enabled = true;
  1480. radioButton2.Enabled = true;
  1481. checkBox1.Enabled = true;
  1482. checkBox2.Enabled = true;
  1483. }
  1484. private void btn_saveresult_Click(object sender, EventArgs e)
  1485. {
  1486. if (this.tempAnalysisResult == null)
  1487. {
  1488. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttostartstatistics.text"));
  1489. return;
  1490. }
  1491. if (analysisResults.ContainsKey(this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index]))
  1492. {
  1493. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theresuethertoreplace.text") + "?", PdnResources.GetString("Form.OkButton.Text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  1494. if (dr != DialogResult.OK)
  1495. {
  1496. return;
  1497. }
  1498. analysisResults[this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index]] = this.tempAnalysisResult;
  1499. }
  1500. else {
  1501. analysisResults.Add(this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index], this.tempAnalysisResult);
  1502. }
  1503. buildListBox_analysisResult();
  1504. }
  1505. private void lstView_img_SelectedIndexChanged(object sender, EventArgs e)
  1506. {
  1507. if (this.lstView_img.FocusedItem != null && this.lstView_img.FocusedItem.Selected)
  1508. {
  1509. this.imgPxPerUnit = this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
  1510. if (this.methodOfAssessment != null)
  1511. {
  1512. this.methodOfAssessment = getMethodOfAssessment();
  1513. MethodOfAssessment.activeMethod = this.methodOfAssessment;
  1514. SetAnalyzeModelFromXml(this.methodOfAssessment.resourcesName);
  1515. }
  1516. this.bitmap = this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1517. this.tempAnalysisResult = null;
  1518. //二值化
  1519. binaryClass.listView1_SelectedIndexChanged(this.bitmap, this.imageList_img.Images.Keys[this.lstView_img.FocusedItem.Index]);
  1520. var gList = new GraphicsList();
  1521. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].GraphicsList.Count; i++) {
  1522. var obj = this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].GraphicsList[i].Clone();
  1523. gList.Add(obj);
  1524. }
  1525. this.documentWorkspace.GraphicsList = gList;
  1526. this.documentWorkspace.activeTool = DrawToolType.InclusionSelectRecognitionArea;
  1527. if (this.isK == 1)
  1528. {
  1529. this.documentWorkspace.GraphicsList.DeleteAllView();
  1530. var line = new ViewRectangle(0, 0, this.bitmap.Width, this.bitmap.Height);
  1531. line.ISurfaceBox = documentWorkspace;
  1532. line.combineMode = (CombineMode)Enum.Parse(typeof(CombineMode), "Union");
  1533. line.Selected = true;
  1534. this.documentWorkspace.AddGraphicsFromForm(line);
  1535. if (!this.bcBinaryChecked())
  1536. {
  1537. this.documentWorkspace.activeTool = DrawToolType.Pointer;
  1538. }
  1539. this.documentWorkspace.Refresh();
  1540. }
  1541. this.histogramControl_colorSetting.CreateHistogram(this.bitmap, false, this.histogramControl_colorSetting.Width - 1, this.histogramControl_colorSetting.Height - 5, HistogramRGBSelect);
  1542. if (userAll) {
  1543. this.startStatistics();
  1544. }
  1545. if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
  1546. {
  1547. if (everyImgData[this.lstView_img.FocusedItem.Index].thisSelectedColorOfInclusions != null)
  1548. {
  1549. this.colorName = everyImgData[this.lstView_img.FocusedItem.Index].thisSelectedColorOfInclusions.colorName;
  1550. getOldCheck();
  1551. this.selectedColorOfInclusions = everyImgData[this.lstView_img.FocusedItem.Index].thisSelectedColorOfInclusions;
  1552. CalcRGBOrHLSValue();
  1553. UpdateHistogramStartAndEnd();
  1554. }
  1555. else {
  1556. if (this.oldSelectedColorOfInclusions != null)
  1557. {
  1558. this.colorName = this.oldSelectedColorOfInclusions.colorName;
  1559. getOldCheck();
  1560. this.selectedColorOfInclusions = new ColorOfInclusions(this.oldSelectedColorOfInclusions.colorName, this.oldSelectedColorOfInclusions.ofTypes, this.oldSelectedColorOfInclusions.ru, this.oldSelectedColorOfInclusions.rd, this.oldSelectedColorOfInclusions.gu, this.oldSelectedColorOfInclusions.gd, this.oldSelectedColorOfInclusions.bu, this.oldSelectedColorOfInclusions.bd);
  1561. everyImgData[this.lstView_img.FocusedItem.Index].thisSelectedColorOfInclusions = this.selectedColorOfInclusions;
  1562. CalcRGBOrHLSValue();
  1563. UpdateHistogramStartAndEnd();
  1564. }
  1565. }
  1566. comboBox1.SelectedIndex = everyImgData[this.lstView_img.FocusedItem.Index].kNum;
  1567. if (everyImgData[this.lstView_img.FocusedItem.Index].directionIndex >= 0)
  1568. {
  1569. comboBox_rollingDirection.SelectedIndex = everyImgData[this.lstView_img.FocusedItem.Index].directionIndex;
  1570. }
  1571. if (everyImgData[this.lstView_img.FocusedItem.Index].ratio >= numericUpDown_lwRatioLimit.Minimum)
  1572. {
  1573. numericUpDown_lwRatioLimit.Value = everyImgData[this.lstView_img.FocusedItem.Index].ratio;
  1574. }
  1575. checkBox_showColorGamutPhase.Checked = everyImgData[this.lstView_img.FocusedItem.Index].colorCheck;
  1576. }
  1577. else {
  1578. if (this.oldSelectedColorOfInclusions != null) {
  1579. this.colorName = this.oldSelectedColorOfInclusions.colorName;
  1580. getOldCheck();
  1581. this.selectedColorOfInclusions = new ColorOfInclusions(this.oldSelectedColorOfInclusions.colorName, this.oldSelectedColorOfInclusions.ofTypes, this.oldSelectedColorOfInclusions.ru, this.oldSelectedColorOfInclusions.rd, this.oldSelectedColorOfInclusions.gu, this.oldSelectedColorOfInclusions.gd, this.oldSelectedColorOfInclusions.bu, this.oldSelectedColorOfInclusions.bd);
  1582. CalcRGBOrHLSValue();
  1583. UpdateHistogramStartAndEnd();
  1584. }
  1585. comboBox1.SelectedIndex = 5;
  1586. if (thisParameters != null)
  1587. {
  1588. if (thisParameters.parameter1 >= 0)
  1589. {
  1590. comboBox_rollingDirection.SelectedIndex = thisParameters.parameter1;
  1591. }
  1592. if (thisParameters.parameter2 >= numericUpDown_lwRatioLimit.Minimum)
  1593. {
  1594. numericUpDown_lwRatioLimit.Value = thisParameters.parameter2;
  1595. }
  1596. checkBox_showColorGamutPhase.Checked = thisParameters.parameter5;
  1597. }
  1598. }
  1599. }
  1600. else
  1601. {
  1602. this.documentWorkspace.Visible = false;
  1603. }
  1604. }
  1605. private void listBox_analysisResult_SelectedIndexChanged(object sender, EventArgs e)
  1606. {
  1607. buildListView_analysisResult();
  1608. }
  1609. private void button_all_Click(object sender, EventArgs e)
  1610. {
  1611. for (int i = 0; i < this.listBox_analysisResult.Items.Count; i++)
  1612. {
  1613. this.listBox_analysisResult.SetItemChecked(i, true);
  1614. }
  1615. buildListView_analysisResult();
  1616. }
  1617. private void button_remove_Click(object sender, EventArgs e)
  1618. {
  1619. if (this.listBox_analysisResult.Items.Count == 0)
  1620. {
  1621. MessageBox.Show(PdnResources.GetString("Menu.Noresultsatmeasuring.text"));
  1622. return;
  1623. }
  1624. if (MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeleteth.text")+"?", "", MessageBoxButtons.OKCancel) == DialogResult.OK)
  1625. {
  1626. if (this.listBox_analysisResult.CheckedItems.Count == 0)
  1627. {
  1628. return;
  1629. }
  1630. foreach (var item in this.listBox_analysisResult.CheckedItems)
  1631. {
  1632. this.analysisResults.Remove(((LocalListViewItem)item).Value);
  1633. }
  1634. buildListBox_analysisResult();
  1635. }
  1636. }
  1637. private void btn_editInclusions_Click(object sender, EventArgs e)
  1638. {
  1639. if (this.tempAnalysisResult == null)
  1640. {
  1641. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttostartstatistics.text"));
  1642. return;
  1643. }
  1644. DocumentItem item = new DocumentItem(this.bitmap, this.documentWorkspace.GraphicsList, this.documentWorkspace.phaseModels);
  1645. new InclusionEditDialog(this.Text, this.appWorkspace, item, this.tempAnalysisResult, this.inclusionEditDialogCloseCallback,this.is_showRectangle,this.is_showOval,this.is_full,this.isK).ShowDialog();
  1646. }
  1647. private void numericUpDown_lwRatioLimit_ValueChanged(object sender, EventArgs e)
  1648. {
  1649. this.methodOfAssessment.inclusionsStandard.globalSettings.lwRatioLimit = Decimal.ToDouble(this.numericUpDown_lwRatioLimit.Value);
  1650. if (this.lstView_img.FocusedItem != null)
  1651. {
  1652. if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
  1653. {
  1654. everyImgData[this.lstView_img.FocusedItem.Index].ratio = this.numericUpDown_lwRatioLimit.Value;
  1655. }
  1656. else
  1657. {
  1658. CurrentPageData data = new CurrentPageData(this.autoJiaoBen);
  1659. data.directionIndex = comboBox_rollingDirection.SelectedIndex;
  1660. data.ratio = numericUpDown_lwRatioLimit.Value;
  1661. everyImgData.Add(this.lstView_img.FocusedItem.Index, data);
  1662. }
  1663. }
  1664. }
  1665. private void numericUpDown_threshold_ValueChanged(object sender, EventArgs e)
  1666. {
  1667. //this.methodOfAssessment.inclusionsStandard.globalSettings.binaryThreshold = Decimal.ToInt32(this.numericUpDown_threshold.Value);
  1668. }
  1669. private void radioButton_colorSelect_CheckedChanged(object sender, EventArgs e)
  1670. {
  1671. RadioButton checkedButton = this.groupBox_colorSetting.Controls.OfType<RadioButton>()
  1672. .FirstOrDefault(r => r.Checked);
  1673. }
  1674. private void radioButton_checkedRGB_CheckedChanged(object sender, EventArgs e)
  1675. {
  1676. if (this.radioButton_checkedRGB.Checked)
  1677. {
  1678. this.label_colorAdjustmentRH.Text = "R";
  1679. this.label_colorAdjustmentGL.Text = "G";
  1680. this.label_colorAdjustmentBS.Text = "B";
  1681. this.button_colorAdjustmentRH.Text = "R";
  1682. this.button_colorAdjustmentGL.Text = "G";
  1683. this.button_colorAdjustmentBS.Text = "B";
  1684. CalcRGBOrHLSValue();
  1685. UpdateHistogramStartAndEnd();
  1686. }
  1687. }
  1688. private void radioButton_checkedHLS_CheckedChanged(object sender, EventArgs e)
  1689. {
  1690. if (this.radioButton_checkedHLS.Checked)
  1691. {
  1692. this.label_colorAdjustmentRH.Text = "H";
  1693. this.label_colorAdjustmentGL.Text = "L";
  1694. this.label_colorAdjustmentBS.Text = "S";
  1695. this.button_colorAdjustmentRH.Text = "H";
  1696. this.button_colorAdjustmentGL.Text = "L";
  1697. this.button_colorAdjustmentBS.Text = "S";
  1698. CalcRGBOrHLSValue();
  1699. UpdateHistogramStartAndEnd();
  1700. }
  1701. }
  1702. private void RGBoRHLSValue_Changed(object sender, EventArgs e)
  1703. {
  1704. UpdateHistogramStartAndEnd();
  1705. SetPhaseModelRGBOrHLS();
  1706. }
  1707. /// <summary>
  1708. /// RGB/HLS的Button的R/H点击事件
  1709. /// </summary>
  1710. /// <param name="sender"></param>
  1711. /// <param name="e"></param>
  1712. private void button_colorAdjustmentRH_Click(object sender, EventArgs e)
  1713. {
  1714. this.HistogramRGBSelect = 1;
  1715. this.button_colorAdjustmentRH.FlatStyle = FlatStyle.Flat;
  1716. this.button_colorAdjustmentRH.BackColor = Color.FromArgb(225, 225, 225);
  1717. this.button_colorAdjustmentRH.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  1718. this.button_colorAdjustmentRH.FlatAppearance.BorderSize = 1;
  1719. this.button_colorAdjustmentGL.FlatStyle = FlatStyle.Standard;
  1720. this.button_colorAdjustmentGL.BackColor = Control.DefaultBackColor;
  1721. this.button_colorAdjustmentGL.FlatAppearance.BorderColor = Control.DefaultBackColor;
  1722. this.button_colorAdjustmentBS.FlatStyle = FlatStyle.Standard;
  1723. this.button_colorAdjustmentBS.BackColor = Control.DefaultBackColor;
  1724. this.button_colorAdjustmentBS.FlatAppearance.BorderColor = Control.DefaultBackColor;
  1725. //处理直方图
  1726. this.histogramControl_colorSetting.UpdateVerticalBarWithOneScope((int)this.numericUpDown_colorAdjustmentRHU.Value, (int)this.numericUpDown_colorAdjustmentRHD.Value);
  1727. }
  1728. /// <summary>
  1729. /// RGB/HLS的Button的G/L点击事件
  1730. /// </summary>
  1731. /// <param name="sender"></param>
  1732. /// <param name="e"></param>
  1733. private void button_colorAdjustmentGL_Click(object sender, EventArgs e)
  1734. {
  1735. this.HistogramRGBSelect = 2;
  1736. this.button_colorAdjustmentRH.FlatStyle = FlatStyle.Standard;
  1737. this.button_colorAdjustmentRH.BackColor = Control.DefaultBackColor;
  1738. this.button_colorAdjustmentRH.FlatAppearance.BorderColor = Control.DefaultBackColor;
  1739. this.button_colorAdjustmentGL.FlatStyle = FlatStyle.Flat;
  1740. this.button_colorAdjustmentGL.BackColor = Color.FromArgb(225, 225, 225);
  1741. this.button_colorAdjustmentGL.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  1742. this.button_colorAdjustmentGL.FlatAppearance.BorderSize = 1;
  1743. this.button_colorAdjustmentBS.FlatStyle = FlatStyle.Standard;
  1744. this.button_colorAdjustmentBS.BackColor = Control.DefaultBackColor;
  1745. this.button_colorAdjustmentBS.FlatAppearance.BorderColor = Control.DefaultBackColor;
  1746. //处理直方图
  1747. this.histogramControl_colorSetting.UpdateVerticalBarWithOneScope((int)this.numericUpDown_colorAdjustmentGLU.Value, (int)this.numericUpDown_colorAdjustmentGLD.Value);
  1748. }
  1749. /// <summary>
  1750. /// RGB/HLS的Button的B/S点击事件
  1751. /// </summary>
  1752. /// <param name="sender"></param>
  1753. /// <param name="e"></param>
  1754. private void button_colorAdjustmentBS_Click(object sender, EventArgs e)
  1755. {
  1756. this.HistogramRGBSelect = 3;
  1757. this.button_colorAdjustmentRH.FlatStyle = FlatStyle.Standard;
  1758. this.button_colorAdjustmentRH.BackColor = Control.DefaultBackColor;
  1759. this.button_colorAdjustmentRH.FlatAppearance.BorderColor = Control.DefaultBackColor;
  1760. this.button_colorAdjustmentGL.FlatStyle = FlatStyle.Standard;
  1761. this.button_colorAdjustmentGL.BackColor = Control.DefaultBackColor;
  1762. this.button_colorAdjustmentGL.FlatAppearance.BorderColor = Control.DefaultBackColor;
  1763. this.button_colorAdjustmentBS.FlatStyle = FlatStyle.Flat;
  1764. this.button_colorAdjustmentBS.BackColor = Color.FromArgb(225, 225, 225);
  1765. this.button_colorAdjustmentBS.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  1766. this.button_colorAdjustmentBS.FlatAppearance.BorderSize = 1;
  1767. //处理直方图
  1768. this.histogramControl_colorSetting.UpdateVerticalBarWithOneScope((int)this.numericUpDown_colorAdjustmentBSU.Value, (int)this.numericUpDown_colorAdjustmentBSD.Value);
  1769. }
  1770. private void panel_colorGamut_Paint(object sender, PaintEventArgs e)
  1771. {
  1772. Graphics g = e.Graphics;
  1773. Color fColor = Color.FromArgb(Decimal.ToInt32(this.numericUpDown_colorAdjustmentRHU.Value), Decimal.ToInt32(this.numericUpDown_colorAdjustmentGLU.Value), Decimal.ToInt32(this.numericUpDown_colorAdjustmentBSU.Value));
  1774. Color tColor = Color.FromArgb(Decimal.ToInt32(this.numericUpDown_colorAdjustmentRHD.Value), Decimal.ToInt32(this.numericUpDown_colorAdjustmentGLD.Value), Decimal.ToInt32(this.numericUpDown_colorAdjustmentBSD.Value));
  1775. Brush b = new LinearGradientBrush(this.panel_colorGamut.ClientRectangle, fColor, tColor, LinearGradientMode.Horizontal);
  1776. g.FillRectangle(b, this.panel_colorGamut.ClientRectangle);
  1777. if (this.bitmap == null)
  1778. {
  1779. return;
  1780. }
  1781. Mat mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap);
  1782. Color c = this.panel_colorGamutPhase.BackColor;
  1783. for (int i = 0; i < mat.Height; i++)
  1784. {
  1785. for (int j = 0; j < mat.Width; j++)
  1786. {
  1787. Vec3b vec3b = mat.At<Vec3b>(i, j);
  1788. if (this.numericUpDown_colorAdjustmentRHU.Value <= vec3b.Item2 &&
  1789. this.numericUpDown_colorAdjustmentRHD.Value >= vec3b.Item2 &&
  1790. this.numericUpDown_colorAdjustmentGLU.Value <= vec3b.Item1 &&
  1791. this.numericUpDown_colorAdjustmentGLD.Value >= vec3b.Item1 &&
  1792. this.numericUpDown_colorAdjustmentBSU.Value <= vec3b.Item0 &&
  1793. this.numericUpDown_colorAdjustmentBSD.Value >= vec3b.Item0 )
  1794. {
  1795. mat.Set<Vec3b>(i,j,new Vec3b(c.B, c.G, c.R));
  1796. }
  1797. }
  1798. }
  1799. if (this.documentWorkspace.phaseModels.Count > 1 && checkBox_showColorGamutPhase.Checked) {
  1800. this.documentWorkspace.phaseModels[this.documentWorkspace.phaseModels.Count - 1].mat = mat;
  1801. }
  1802. this.documentWorkspace.Refresh();
  1803. }
  1804. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  1805. {
  1806. chooseK = this.comboBox1.SelectedIndex;
  1807. this.btn_statistics_Click(sender,e);
  1808. }
  1809. private void comboBox_rollingDirection_SelectedIndexChanged(object sender, EventArgs e)
  1810. {
  1811. this.methodOfAssessment.inclusionsStandard.globalSettings.rollingDirection = (InclusionsGlobalSettings.RollingDirection)this.comboBox_rollingDirection.SelectedIndex;
  1812. if (this.lstView_img.FocusedItem != null)
  1813. {
  1814. if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
  1815. {
  1816. everyImgData[this.lstView_img.FocusedItem.Index].directionIndex = this.comboBox_rollingDirection.SelectedIndex;
  1817. }
  1818. else
  1819. {
  1820. CurrentPageData data = new CurrentPageData(this.autoJiaoBen);
  1821. data.directionIndex = comboBox_rollingDirection.SelectedIndex;
  1822. data.ratio = numericUpDown_lwRatioLimit.Value;
  1823. everyImgData.Add(this.lstView_img.FocusedItem.Index, data);
  1824. }
  1825. }
  1826. }
  1827. private void histogramControl_colorSetting_DragOneEvent(object sender, EventArgs<int> e)
  1828. {
  1829. if (this.HistogramRGBSelect == 1)
  1830. {
  1831. this.numericUpDown_colorAdjustmentRHU.Value = e.Data;
  1832. }
  1833. if (this.HistogramRGBSelect == 2)
  1834. {
  1835. this.numericUpDown_colorAdjustmentGLU.Value = e.Data;
  1836. }
  1837. if (this.HistogramRGBSelect == 3)
  1838. {
  1839. this.numericUpDown_colorAdjustmentBSU.Value = e.Data;
  1840. }
  1841. this.panel_colorGamut.Refresh();
  1842. }
  1843. private void histogramControl_colorSetting_DragTwoEvent(object sender, EventArgs<int> e)
  1844. {
  1845. if (!button_colorAdjustmentRH.Focused && !button_colorAdjustmentGL.Focused && !button_colorAdjustmentBS.Focused) {
  1846. MessageBox.Show("请选择颜色!");
  1847. return;
  1848. }
  1849. if (this.HistogramRGBSelect == 1)
  1850. {
  1851. this.numericUpDown_colorAdjustmentRHD.Value = e.Data;
  1852. }
  1853. if (this.HistogramRGBSelect == 2)
  1854. {
  1855. this.numericUpDown_colorAdjustmentGLD.Value = e.Data;
  1856. }
  1857. if (this.HistogramRGBSelect == 3)
  1858. {
  1859. this.numericUpDown_colorAdjustmentBSD.Value = e.Data;
  1860. }
  1861. this.panel_colorGamut.Refresh();
  1862. }
  1863. protected void colorSettingRadioButton(object sender, EventArgs e)
  1864. {
  1865. this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions[((RadioButton)sender).Name.Split('_')[1]];
  1866. CalcRGBOrHLSValue();
  1867. UpdateHistogramStartAndEnd();
  1868. if (this.lstView_img.FocusedItem != null)
  1869. {
  1870. if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
  1871. {
  1872. everyImgData[this.lstView_img.FocusedItem.Index].thisSelectedColorOfInclusions = this.selectedColorOfInclusions;
  1873. }
  1874. else
  1875. {
  1876. CurrentPageData data = new CurrentPageData(this.autoJiaoBen);
  1877. data.directionIndex = comboBox_rollingDirection.SelectedIndex;
  1878. data.ratio = numericUpDown_lwRatioLimit.Value;
  1879. data.thisSelectedColorOfInclusions = this.selectedColorOfInclusions;
  1880. everyImgData.Add(this.lstView_img.FocusedItem.Index, data);
  1881. }
  1882. }
  1883. }
  1884. private void btn_drawRecognitionArea_Click(object sender, EventArgs e)
  1885. {
  1886. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.InclusionDrawRecognitionArea;
  1887. }
  1888. /// <summary>
  1889. /// 自动阈值
  1890. /// </summary>
  1891. /// <param name="sender"></param>
  1892. /// <param name="e"></param>
  1893. private void checkBox_autoThreshold_CheckedChanged(object sender, EventArgs e)
  1894. {
  1895. bool check = ((CheckBox)sender).Checked;
  1896. this.methodOfAssessment.inclusionsStandard.globalSettings.autoThreshold = check;
  1897. //numericUpDown_threshold.Visible = !check;
  1898. }
  1899. private void documentWorkspace_panel_Click(object sender, EventArgs e)
  1900. {
  1901. System.Windows.Forms.MouseEventArgs me = (System.Windows.Forms.MouseEventArgs)e;
  1902. if (me.Button == MouseButtons.Left)
  1903. {
  1904. if (this.pickColorChecked)
  1905. {
  1906. if (this.bitmap == null) {
  1907. return;
  1908. }
  1909. System.Drawing.Point pointscroll = this.documentWorkspace.GetScalePoint(me.Location);
  1910. Mat mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap);
  1911. Vec3b vec3b = mat.At<Vec3b>(pointscroll.Y, pointscroll.X);
  1912. Color c = Color.FromArgb(vec3b.Item2, vec3b.Item1, vec3b.Item0);
  1913. this.selectedColorOfInclusions.setColor(c);
  1914. CalcRGBOrHLSValue();
  1915. UpdateHistogramStartAndEnd();
  1916. this.pickColorChecked = false;
  1917. this.documentWorkspace.Cursor = Cursors.Default;
  1918. this.button_pickColor.FlatStyle = FlatStyle.Standard;
  1919. this.button_pickColor.BackColor = Control.DefaultBackColor;
  1920. this.button_pickColor.FlatAppearance.BorderColor = Control.DefaultBackColor;
  1921. }
  1922. }
  1923. else
  1924. {
  1925. System.Drawing.Point pointscroll = this.documentWorkspace.GetScalePoint(((System.Windows.Forms.MouseEventArgs)e).Location);
  1926. for (int i = 0; i < this.documentWorkspace.GraphicsList.Count; i++)
  1927. {
  1928. DrawObject drawObject = this.documentWorkspace.GraphicsList[i];
  1929. if (drawObject.drawToolType == DrawToolType.InclusionSelect)
  1930. {
  1931. Inclusion inclusion = ((InclusionDrawObject)drawObject).inclusion;
  1932. if (inclusion.rectProfile.Contains(pointscroll))
  1933. {
  1934. string showText = "";
  1935. if (inclusion.shape == ParticleShape.Globular)
  1936. {
  1937. showText += PdnResources.GetString("Menu.diameter.text")+":" + inclusion.diameter;
  1938. }
  1939. else
  1940. {
  1941. showText += PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text")+":" + inclusion.physicalLength;
  1942. showText += "\n宽度:" + inclusion.physicalWidth;
  1943. }
  1944. showText += "\n面积:" + inclusion.area;
  1945. showText += "\n类型:" + inclusion.type.type;
  1946. showText += "\n化学特性:" + inclusion.chemicalCharacteristics;
  1947. this.toolTip_InclusionsDetails.Show(showText, (System.Windows.Forms.Control)sender);
  1948. }
  1949. }
  1950. }
  1951. }
  1952. }
  1953. private void documentWorkspace_panel_MouseDown(object sender, MouseEventArgs e)
  1954. {
  1955. if (this.selectedTypesOfInclusions == null && !this.clearSelect)
  1956. {
  1957. return;
  1958. }
  1959. if (e.Button == MouseButtons.Left)
  1960. {
  1961. this.selectedTypesOfInclusionsPoint = e.Location;
  1962. }
  1963. }
  1964. private void documentWorkspace_panel_MouseMove(object sender, MouseEventArgs e)
  1965. {
  1966. Pen pen = null;
  1967. if (this.selectedTypesOfInclusionsPoint == null)
  1968. {
  1969. return;
  1970. }
  1971. if (this.selectedTypesOfInclusions != null)
  1972. {
  1973. pen = new Pen(Color.FromArgb(this.selectedTypesOfInclusions.showColor), 1);
  1974. }
  1975. else if (this.clearSelect)
  1976. {
  1977. pen = new Pen(Color.Black, 1);
  1978. pen.DashStyle = DashStyle.Dash;
  1979. }
  1980. this.documentWorkspace.Refresh();
  1981. float x = Math.Min(this.selectedTypesOfInclusionsPoint.Value.X, e.Location.X);
  1982. float y = Math.Min(this.selectedTypesOfInclusionsPoint.Value.Y, e.Location.Y);
  1983. float width = Math.Abs(this.selectedTypesOfInclusionsPoint.Value.X - e.Location.X);
  1984. float height = Math.Abs(this.selectedTypesOfInclusionsPoint.Value.Y - e.Location.Y);
  1985. this.documentWorkspace.panel.CreateGraphics().DrawRectangles(pen, new RectangleF[] { new RectangleF(x,y,width,height) });
  1986. }
  1987. private void documentWorkspace_panel_MouseUp(object sender, MouseEventArgs e)
  1988. {
  1989. if (this.selectedTypesOfInclusions == null && !this.clearSelect)
  1990. {
  1991. return;
  1992. }
  1993. if (e.Button == MouseButtons.Left)
  1994. {
  1995. if (this.selectedTypesOfInclusionsPoint == null) {
  1996. return;
  1997. }
  1998. var startPoint = this.documentWorkspace.GetScalePoint(this.selectedTypesOfInclusionsPoint.Value);
  1999. var stopPoint = this.documentWorkspace.GetScalePoint(e.Location);
  2000. float x = Math.Min(startPoint.X, stopPoint.X);
  2001. float y = Math.Min(startPoint.Y, stopPoint.Y);
  2002. float width = Math.Abs(startPoint.X - stopPoint.X);
  2003. float height = Math.Abs(startPoint.Y - stopPoint.Y);
  2004. this.selectedTypesOfInclusionsRectangle = new RectangleF(x,y,width,height);
  2005. if (this.selectedTypesOfInclusions != null)
  2006. {
  2007. startStatistics();
  2008. }
  2009. else
  2010. {
  2011. if (this.tempAnalysisResult != null)
  2012. {
  2013. for (int i = this.tempAnalysisResult.inclusions.Count - 1; i >= 0; i--)
  2014. {
  2015. if (this.selectedTypesOfInclusionsRectangle.Value.Contains(this.tempAnalysisResult.inclusions[i].rectProfile)
  2016. || this.selectedTypesOfInclusionsRectangle.Value.IntersectsWith(this.tempAnalysisResult.inclusions[i].rectProfile))
  2017. {
  2018. this.tempAnalysisResult.inclusions.RemoveAt(i);
  2019. }
  2020. }
  2021. ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, this.tempAnalysisResult.inclusions,is_showRectangle,is_showOval, is_full);
  2022. }
  2023. }
  2024. this.clearSelect = false;
  2025. //this.selectedTypesOfInclusions = null;
  2026. this.selectedTypesOfInclusionsPoint = null;
  2027. this.selectedTypesOfInclusionsRectangle = null;
  2028. radioButton1.Enabled = true;
  2029. radioButton2.Enabled = true;
  2030. checkBox1.Enabled = true;
  2031. checkBox2.Enabled = true;
  2032. }
  2033. }
  2034. #endregion
  2035. #region 内部方法
  2036. private void startStatistics()
  2037. {
  2038. if (this.lstView_img.FocusedItem == null || !this.lstView_img.FocusedItem.Selected)
  2039. {
  2040. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text"));
  2041. return;
  2042. }
  2043. if (this.documentWorkspace.phaseModels[0].mat == null || !this.bcBinaryChecked())
  2044. {
  2045. MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformabinaryoperationfirst.text"));
  2046. return;
  2047. }
  2048. ProgressThreadProcClass procClass = new ProgressThreadProcClass();
  2049. int itemCount = 100;
  2050. ProgressThreadProcClass.IFileTransferProgressEvents progressEvents = new ProgressThreadProcClass.IFileTransferProgressEvents();
  2051. System.Threading.ThreadStart copyThreadProc =
  2052. delegate ()
  2053. {
  2054. try
  2055. {
  2056. if (dict.ContainsKey(this.lstView_img.FocusedItem.Text))
  2057. {
  2058. dict[this.lstView_img.FocusedItem.Text] = this.documentWorkspace.phaseModels;
  2059. }
  2060. else
  2061. {
  2062. dict.Add(this.lstView_img.FocusedItem.Text, this.documentWorkspace.phaseModels);
  2063. }
  2064. Mat mat = this.documentWorkspace.phaseModels[0].mat.Clone();
  2065. List<RectangleF> rectangles = new List<RectangleF>();
  2066. if (this.selectedTypesOfInclusionsRectangle != null)
  2067. {
  2068. // 添加框选范围
  2069. rectangles.Add(this.selectedTypesOfInclusionsRectangle.Value);
  2070. // 删除框选范围内夹杂物
  2071. if (this.tempAnalysisResult != null)
  2072. {
  2073. for (int i = this.tempAnalysisResult.inclusions.Count - 1; i >= 0; i--)
  2074. {
  2075. if (this.selectedTypesOfInclusionsRectangle.Value.Contains(this.tempAnalysisResult.inclusions[i].rectProfile)
  2076. || this.selectedTypesOfInclusionsRectangle.Value.IntersectsWith(this.tempAnalysisResult.inclusions[i].rectProfile))
  2077. {
  2078. this.tempAnalysisResult.inclusions.RemoveAt(i);
  2079. }
  2080. }
  2081. }
  2082. }
  2083. for (int i = 0; i < this.documentWorkspace.GraphicsList.Count; i++)
  2084. {
  2085. if (this.documentWorkspace.GraphicsList[i].drawToolType == DrawToolType.InclusionDrawRecognitionArea)
  2086. {
  2087. DedicatedAnalysisDrawObject drawObject = (DrawRecognitionAreaDrawObject)this.documentWorkspace.GraphicsList[i];
  2088. rectangles.Add(drawObject.Rectangle);
  2089. }
  2090. }
  2091. // 二值图非黑色点涂白
  2092. for (int i = 0; i < mat.Height; i++)
  2093. {
  2094. for (int j = 0; j < mat.Width; j++)
  2095. {
  2096. if (mat.At<int>(i, j) == 0)
  2097. {
  2098. mat.Set<Vec3b>(i, j, new Vec3b(255, 255, 255));
  2099. }
  2100. else
  2101. {
  2102. if (rectangles.Count == 0)
  2103. {
  2104. continue;
  2105. }
  2106. bool contains = false;
  2107. // 二值图过滤未选中区域
  2108. foreach (var item in rectangles)
  2109. {
  2110. if (item.Contains(j, i))
  2111. {
  2112. contains = true;
  2113. }
  2114. }
  2115. if (!contains)
  2116. {
  2117. mat.Set<Vec3b>(i, j, new Vec3b(255, 255, 255));
  2118. }
  2119. }
  2120. }
  2121. }
  2122. // 找出正方形视场
  2123. List<RectangleF> rectangleF = new List<RectangleF>();
  2124. for (int i = 0; i < this.documentWorkspace.GraphicsList.Count; i++)
  2125. {
  2126. if (this.documentWorkspace.GraphicsList[i].drawToolType == DrawToolType.ViewSquare || this.documentWorkspace.GraphicsList[i].drawToolType == DrawToolType.ViewRectangle|| this.documentWorkspace.GraphicsList[i].drawToolType == DrawToolType.ViewRectangleEx)
  2127. {
  2128. rectangleF.Add(this.documentWorkspace.GraphicsList[i].Rectangle);
  2129. }
  2130. }
  2131. int k = Convert.ToInt32(this.comboBox1.SelectedItem);
  2132. var rollingDirection = (InclusionsGlobalSettings.RollingDirection)this.comboBox_rollingDirection.SelectedIndex;
  2133. var report = this.methodOfAssessment.generateReport(OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap), mat, rectangleF, isK, this.viewNum, k,this.is_full, rollingDirection);
  2134. if (this.selectedTypesOfInclusionsRectangle == null)
  2135. {
  2136. this.tempAnalysisResult = report;
  2137. }
  2138. else
  2139. {
  2140. foreach (var item in report.inclusions)
  2141. {
  2142. item.type = this.selectedTypesOfInclusions;
  2143. }
  2144. if (this.tempAnalysisResult == null)
  2145. {
  2146. this.tempAnalysisResult = report;
  2147. }
  2148. else
  2149. {
  2150. this.tempAnalysisResult.inclusions.AddRange(report.inclusions);
  2151. }
  2152. this.tempAnalysisResult.buildResultBody();
  2153. }
  2154. if (userAll)
  2155. {
  2156. if (hasResultIndexList.IndexOf(this.lstView_img.FocusedItem.Index) == -1)
  2157. {
  2158. resultList.Add(this.tempAnalysisResult);
  2159. hasResultIndexList.Add(this.lstView_img.FocusedItem.Index);
  2160. }
  2161. else
  2162. {
  2163. resultList[this.lstView_img.FocusedItem.Index] = this.tempAnalysisResult;
  2164. }
  2165. }
  2166. ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, this.tempAnalysisResult.inclusions, is_showRectangle, is_showOval, is_full);
  2167. }
  2168. catch (Exception ex)
  2169. {
  2170. }
  2171. finally
  2172. {
  2173. progressEvents.EndOperation(OperationResult.Finished);
  2174. }
  2175. };
  2176. procClass.StartProgressAction(this, itemCount, copyThreadProc, progressEvents, null);
  2177. }
  2178. private void Panel_Paint(object sender, PaintEventArgs e)
  2179. {
  2180. if (isK == 2) {
  2181. return;
  2182. }
  2183. Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
  2184. int wid = this.documentWorkspace.CompositionSurface == null ? this.documentWorkspace.Width : this.documentWorkspace.CompositionSurface.Width;
  2185. int hei = this.documentWorkspace.CompositionSurface == null ? this.documentWorkspace.Height : this.documentWorkspace.CompositionSurface.Height;
  2186. int width = (int)(wid * this.documentWorkspace.ScaleFactor.Ratio);
  2187. int height = (int)(hei * this.documentWorkspace.ScaleFactor.Ratio);
  2188. int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X: (rc.Width - width) / 2;
  2189. int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
  2190. e.Graphics.TranslateTransform(x, y);
  2191. e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
  2192. if (this.documentWorkspace.GraphicsList.Count > 0)
  2193. {
  2194. Font font = new Font(System.Drawing.SystemFonts.DefaultFont.FontFamily, 40, System.Drawing.SystemFonts.DefaultFont.Style);
  2195. double pxPerUnit = this.imgPxPerUnit;
  2196. int allWidth = (int)(this.bitmap.Width * pxPerUnit);
  2197. int allHeight = (int)(this.bitmap.Height * pxPerUnit);
  2198. if (this.tempAnalysisResult == null) {
  2199. this.paintRectangle = this.documentWorkspace.GraphicsList[0].Rectangle;
  2200. }
  2201. int realWidth = (int)(this.paintRectangle.Width * pxPerUnit);
  2202. int realHeight = (int)(this.paintRectangle.Height * pxPerUnit);
  2203. e.Graphics.DrawString($"{realWidth}/{allWidth}", font, new SolidBrush(Color.Blue), this.paintRectangle.Right, this.paintRectangle.Bottom / 2);
  2204. e.Graphics.DrawString($"{realHeight}/{allHeight}", font, new SolidBrush(Color.Blue), this.paintRectangle.Right / 2, this.paintRectangle.Bottom + 10);
  2205. }
  2206. if (this.tempAnalysisResult != null && this.tempAnalysisResult.segmentationView == 2)
  2207. {
  2208. foreach (var s in this.tempAnalysisResult.MedthodKRectangles)
  2209. {
  2210. e.Graphics.DrawRectangle(new Pen(Color.Black, 0.1f), new Rectangle((int)s.X, (int)s.Y, (int)s.Width, (int)s.Height));
  2211. }
  2212. }
  2213. e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
  2214. e.Graphics.TranslateTransform(-x, -y);
  2215. }
  2216. private void buildListBox_analysisResult()
  2217. {
  2218. this.listBox_analysisResult.Items.Clear();
  2219. foreach (var item in analysisResults.Keys)
  2220. {
  2221. this.listBox_analysisResult.Items.Add(new LocalListViewItem(item, item.GetFriendlyName()));
  2222. }
  2223. buildListView_analysisResult();
  2224. }
  2225. private List<ListViewItem> buildAnalysisResults(DocumentWorkspace workspace, AnalysisResult analysisResult)
  2226. {
  2227. List<ListViewItem> listViews = new List<ListViewItem>();
  2228. foreach (var fieldOfView in analysisResult.resultBody.Keys)
  2229. {
  2230. ListViewItem lvi = new ListViewItem();
  2231. lvi.Text = workspace.GetFriendlyName();
  2232. lvi.SubItems.Add(fieldOfView.name);
  2233. foreach (var item in analysisResult.resultBody[fieldOfView])
  2234. {
  2235. try
  2236. {
  2237. int num = 2;
  2238. if (this.domainUpDown_resultPrecision.SelectedIndex != -1) {
  2239. num = Convert.ToInt32(this.domainUpDown_resultPrecision.Items[this.domainUpDown_resultPrecision.SelectedIndex]);
  2240. }
  2241. lvi.SubItems.Add(Math.Round(Convert.ToDecimal(item), num).ToString());
  2242. }
  2243. catch (Exception ex)
  2244. {
  2245. lvi.SubItems.Add(item);
  2246. }
  2247. }
  2248. listViews.Add(lvi);
  2249. }
  2250. return listViews;
  2251. }
  2252. #region [二值化相关方法]
  2253. /// <summary>
  2254. /// 添加参数改变的监听
  2255. /// </summary>
  2256. /// <param name="sender"></param>
  2257. /// <param name="e"></param>
  2258. private void GrainSizeDialog_Load(object sender, EventArgs e)
  2259. {
  2260. this.binaryClass.loadParams();
  2261. System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
  2262. if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
  2263. this.startScriptAutomaticAction();
  2264. }
  2265. /// <summary>
  2266. /// 参数改变时,重新处理图像
  2267. /// </summary>
  2268. /// <param name="sender"></param>
  2269. /// <param name="e"></param>
  2270. private void bClassBinaryImplFinishAction(object sender, EventArgs e)
  2271. {
  2272. if (!bcOriginChecked())
  2273. {
  2274. if (bcBinaryChecked())
  2275. {
  2276. if (this.isK == 1)
  2277. {
  2278. this.documentWorkspace.activeTool = DrawToolType.InclusionSelectRecognitionArea;
  2279. this.documentWorkspace.Cursor = Cursors.Default;
  2280. }
  2281. }
  2282. else {
  2283. if (this.isK == 1)
  2284. {
  2285. this.documentWorkspace.activeTool = DrawToolType.Pointer;
  2286. }
  2287. }
  2288. }
  2289. else
  2290. {
  2291. if (this.isK == 1)
  2292. {
  2293. this.documentWorkspace.activeTool = DrawToolType.Pointer;
  2294. }
  2295. }
  2296. this.documentWorkspace.Refresh();
  2297. }
  2298. private bool bcBinaryChecked()
  2299. {
  2300. return bc != null && bc.BinaryChecked;
  2301. }
  2302. private bool bcOriginChecked()
  2303. {
  2304. return bc != null && bc.OriginChecked;
  2305. }
  2306. /// <summary>
  2307. /// 显示原图/原图+二值图
  2308. /// </summary>
  2309. /// <param name="sender"></param>
  2310. /// <param name="e"></param>
  2311. private void bcOriginCheckedChanged(object sender, EventArgs e)
  2312. {
  2313. if (!bcOriginChecked())
  2314. {
  2315. if (bcBinaryChecked())
  2316. {
  2317. this.documentWorkspace.PhaseModels[0].choise = true;
  2318. if (this.isK == 1)
  2319. {
  2320. this.documentWorkspace.activeTool = DrawToolType.InclusionSelectRecognitionArea;
  2321. this.documentWorkspace.Cursor = Cursors.Default;
  2322. }
  2323. }
  2324. }
  2325. else
  2326. {
  2327. this.documentWorkspace.PhaseModels[0].choise = false;
  2328. if (this.isK == 1)
  2329. {
  2330. this.documentWorkspace.activeTool = DrawToolType.Pointer;
  2331. }
  2332. }
  2333. this.documentWorkspace.Refresh();
  2334. }
  2335. #endregion [二值化相关方法]
  2336. private void buildListView_analysisResult()
  2337. {
  2338. List<AnalysisResult> conclusions = new List<AnalysisResult>();
  2339. this.listView_analysisResult.Columns.Clear();
  2340. this.listView_analysisResult.Items.Clear();
  2341. this.listView_analysisResult2.Columns.Clear();
  2342. this.listView_analysisResult2.Items.Clear();
  2343. if (analysisResults.Count == 0)
  2344. {
  2345. return;
  2346. }
  2347. if (this.listBox_analysisResult.CheckedItems.Count == 0)
  2348. {
  2349. return;
  2350. }
  2351. this.listView_analysisResult.BeginUpdate();
  2352. // 构建头
  2353. foreach (var item in analysisResults.First().Value.getResultHead())
  2354. {
  2355. ColumnHeader header = new ColumnHeader();
  2356. header.Text = item;
  2357. header.Width = 150;
  2358. this.listView_analysisResult.Columns.Add(header);
  2359. }
  2360. foreach (var item in this.listBox_analysisResult.CheckedItems)
  2361. {
  2362. DocumentWorkspace workspace = ((LocalListViewItem)item).Value;
  2363. this.listView_analysisResult.Items.AddRange(buildAnalysisResults(workspace, analysisResults[workspace]).ToArray());
  2364. conclusions.Add(analysisResults[workspace]);
  2365. }
  2366. this.listView_analysisResult.EndUpdate();
  2367. if (this.listView_analysisResult.Items.Count > 0)
  2368. {
  2369. this.listView_analysisResult.Items[0].Selected = true;
  2370. }
  2371. this.listView_analysisResult2.Columns.Clear();
  2372. this.listView_analysisResult2.Items.Clear();
  2373. ListViewItem lvi = new ListViewItem();
  2374. List<string> strings = this.methodOfAssessment.buildResultConclusion(conclusions);
  2375. // 构建头
  2376. foreach (var item in this.methodOfAssessment.getResultConclusionHead())
  2377. {
  2378. ColumnHeader header = new ColumnHeader();
  2379. header.Text = item;
  2380. header.Width = 150;
  2381. this.listView_analysisResult2.Columns.Add(header);
  2382. }
  2383. try
  2384. {
  2385. int num = 2;
  2386. if (this.domainUpDown_resultPrecision.SelectedIndex != -1)
  2387. {
  2388. num = Convert.ToInt32(this.domainUpDown_resultPrecision.Items[this.domainUpDown_resultPrecision.SelectedIndex]);
  2389. }
  2390. lvi.Text = Math.Round(Convert.ToDecimal(strings[0]), num).ToString();
  2391. }
  2392. catch (Exception ex)
  2393. {
  2394. lvi.Text = strings[0];
  2395. }
  2396. for (int i = 1; i < strings.Count; i++)
  2397. {
  2398. try
  2399. {
  2400. int num = 2;
  2401. if (this.domainUpDown_resultPrecision.SelectedIndex != -1)
  2402. {
  2403. num = Convert.ToInt32(this.domainUpDown_resultPrecision.Items[this.domainUpDown_resultPrecision.SelectedIndex]);
  2404. }
  2405. lvi.SubItems.Add(Math.Round(Convert.ToDecimal(strings[i]), num).ToString());
  2406. }
  2407. catch (Exception ex)
  2408. {
  2409. lvi.SubItems.Add(strings[i]);
  2410. }
  2411. }
  2412. this.listView_analysisResult2.Items.Add(lvi);
  2413. this.listView_analysisResult2.EndUpdate();
  2414. }
  2415. private void inclusionEditDialogCloseCallback()
  2416. {
  2417. if (this.tempAnalysisResult.segmentationView != 2)
  2418. {
  2419. ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, this.tempAnalysisResult.inclusions, is_showRectangle, is_showOval, is_full);
  2420. }
  2421. else
  2422. {
  2423. this.documentWorkspace.Refresh();
  2424. }
  2425. }
  2426. private void UpdateHistogramStartAndEnd()
  2427. {
  2428. if (this.HistogramRGBSelect == 1)
  2429. {
  2430. this.histogramControl_colorSetting.UpdateVerticalBarWithOneScope((int)this.numericUpDown_colorAdjustmentRHU.Value, (int)this.numericUpDown_colorAdjustmentRHD.Value);
  2431. }
  2432. if (this.HistogramRGBSelect == 2)
  2433. {
  2434. this.histogramControl_colorSetting.UpdateVerticalBarWithOneScope((int)this.numericUpDown_colorAdjustmentGLU.Value, (int)this.numericUpDown_colorAdjustmentGLD.Value);
  2435. }
  2436. if (this.HistogramRGBSelect == 3)
  2437. {
  2438. this.histogramControl_colorSetting.UpdateVerticalBarWithOneScope((int)this.numericUpDown_colorAdjustmentBSU.Value, (int)this.numericUpDown_colorAdjustmentBSD.Value);
  2439. }
  2440. }
  2441. private void CalcRGBOrHLSValue()
  2442. {
  2443. this.numericUpDown_colorAdjustmentRHU.ValueChanged -= new System.EventHandler(this.RGBoRHLSValue_Changed);
  2444. this.numericUpDown_colorAdjustmentRHD.ValueChanged -= new System.EventHandler(this.RGBoRHLSValue_Changed);
  2445. this.numericUpDown_colorAdjustmentGLU.ValueChanged -= new System.EventHandler(this.RGBoRHLSValue_Changed);
  2446. this.numericUpDown_colorAdjustmentGLD.ValueChanged -= new System.EventHandler(this.RGBoRHLSValue_Changed);
  2447. this.numericUpDown_colorAdjustmentBSU.ValueChanged -= new System.EventHandler(this.RGBoRHLSValue_Changed);
  2448. this.numericUpDown_colorAdjustmentBSD.ValueChanged -= new System.EventHandler(this.RGBoRHLSValue_Changed);
  2449. this.numericUpDown_colorAdjustmentRHU.KeyUp -= new KeyEventHandler(this.RGBoRHLSValue_Changed);
  2450. this.numericUpDown_colorAdjustmentRHD.KeyUp -= new KeyEventHandler(this.RGBoRHLSValue_Changed);
  2451. this.numericUpDown_colorAdjustmentGLU.KeyUp -= new KeyEventHandler(this.RGBoRHLSValue_Changed);
  2452. this.numericUpDown_colorAdjustmentGLD.KeyUp -= new KeyEventHandler(this.RGBoRHLSValue_Changed);
  2453. this.numericUpDown_colorAdjustmentBSU.KeyUp -= new KeyEventHandler(this.RGBoRHLSValue_Changed);
  2454. this.numericUpDown_colorAdjustmentBSD.KeyUp -= new KeyEventHandler(this.RGBoRHLSValue_Changed);
  2455. if (this.radioButton_checkedRGB.Checked)
  2456. {
  2457. this.numericUpDown_colorAdjustmentRHU.Value = this.selectedColorOfInclusions.rd;
  2458. this.numericUpDown_colorAdjustmentRHD.Value = this.selectedColorOfInclusions.ru;
  2459. this.numericUpDown_colorAdjustmentGLU.Value = this.selectedColorOfInclusions.gd;
  2460. this.numericUpDown_colorAdjustmentGLD.Value = this.selectedColorOfInclusions.gu;
  2461. this.numericUpDown_colorAdjustmentBSU.Value = this.selectedColorOfInclusions.bd;
  2462. this.numericUpDown_colorAdjustmentBSD.Value = this.selectedColorOfInclusions.bu;
  2463. }
  2464. else
  2465. {
  2466. Vec3b rgbd = new Vec3b();
  2467. Vec3b rgbu = new Vec3b();
  2468. rgbd[2] = Decimal.ToByte(this.numericUpDown_colorAdjustmentRHU.Value);
  2469. rgbu[2] = Decimal.ToByte(this.numericUpDown_colorAdjustmentRHD.Value);
  2470. rgbd[1] = Decimal.ToByte(this.numericUpDown_colorAdjustmentGLU.Value);
  2471. rgbu[1] = Decimal.ToByte(this.numericUpDown_colorAdjustmentGLD.Value);
  2472. rgbd[0] = Decimal.ToByte(this.numericUpDown_colorAdjustmentBSU.Value);
  2473. rgbu[0] = Decimal.ToByte(this.numericUpDown_colorAdjustmentBSD.Value);
  2474. double hd, ld, sd, hu, lu, su;
  2475. BaseTools.RGBtoHLS(rgbd, out hd, out ld, out sd);
  2476. BaseTools.RGBtoHLS(rgbu, out hu, out lu, out su);
  2477. this.numericUpDown_colorAdjustmentRHD.Value = new Decimal(hd);
  2478. this.numericUpDown_colorAdjustmentRHU.Value = new Decimal(hu);
  2479. this.numericUpDown_colorAdjustmentGLD.Value = new Decimal(ld);
  2480. this.numericUpDown_colorAdjustmentGLU.Value = new Decimal(lu);
  2481. this.numericUpDown_colorAdjustmentBSD.Value = new Decimal(sd);
  2482. this.numericUpDown_colorAdjustmentBSU.Value = new Decimal(su);
  2483. }
  2484. this.numericUpDown_colorAdjustmentRHU.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
  2485. this.numericUpDown_colorAdjustmentRHD.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
  2486. this.numericUpDown_colorAdjustmentGLU.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
  2487. this.numericUpDown_colorAdjustmentGLD.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
  2488. this.numericUpDown_colorAdjustmentBSU.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
  2489. this.numericUpDown_colorAdjustmentBSD.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
  2490. this.numericUpDown_colorAdjustmentRHU.KeyUp += new KeyEventHandler(this.RGBoRHLSValue_Changed);
  2491. this.numericUpDown_colorAdjustmentRHD.KeyUp += new KeyEventHandler(this.RGBoRHLSValue_Changed);
  2492. this.numericUpDown_colorAdjustmentGLU.KeyUp += new KeyEventHandler(this.RGBoRHLSValue_Changed);
  2493. this.numericUpDown_colorAdjustmentGLD.KeyUp += new KeyEventHandler(this.RGBoRHLSValue_Changed);
  2494. this.numericUpDown_colorAdjustmentBSU.KeyUp += new KeyEventHandler(this.RGBoRHLSValue_Changed);
  2495. this.numericUpDown_colorAdjustmentBSD.KeyUp += new KeyEventHandler(this.RGBoRHLSValue_Changed);
  2496. this.panel_colorGamut.Refresh();
  2497. }
  2498. /// <summary>
  2499. /// 修改当前model的rgb或hls
  2500. /// </summary>
  2501. private void SetPhaseModelRGBOrHLS()
  2502. {
  2503. if (this.radioButton_checkedRGB.Checked)
  2504. {
  2505. if (this.selectedColorOfInclusions != null)
  2506. {
  2507. this.selectedColorOfInclusions.rd = Decimal.ToByte(this.numericUpDown_colorAdjustmentRHU.Value);
  2508. this.selectedColorOfInclusions.ru = Decimal.ToByte(this.numericUpDown_colorAdjustmentRHD.Value);
  2509. this.selectedColorOfInclusions.gd = Decimal.ToByte(this.numericUpDown_colorAdjustmentGLU.Value);
  2510. this.selectedColorOfInclusions.gu = Decimal.ToByte(this.numericUpDown_colorAdjustmentGLD.Value);
  2511. this.selectedColorOfInclusions.bd = Decimal.ToByte(this.numericUpDown_colorAdjustmentBSU.Value);
  2512. this.selectedColorOfInclusions.bu = Decimal.ToByte(this.numericUpDown_colorAdjustmentBSD.Value);
  2513. }
  2514. }
  2515. else
  2516. {
  2517. Vec3b rgbd = BaseTools.HLStoRGB(Decimal.ToDouble(this.numericUpDown_colorAdjustmentRHU.Value), Decimal.ToDouble(this.numericUpDown_colorAdjustmentGLU.Value), Decimal.ToDouble(this.numericUpDown_colorAdjustmentBSU.Value));
  2518. Vec3b rgbu = BaseTools.HLStoRGB(Decimal.ToDouble(this.numericUpDown_colorAdjustmentRHD.Value), Decimal.ToDouble(this.numericUpDown_colorAdjustmentGLD.Value), Decimal.ToDouble(this.numericUpDown_colorAdjustmentBSD.Value));
  2519. this.selectedColorOfInclusions.rd = rgbd[2];
  2520. this.selectedColorOfInclusions.ru = rgbu[2];
  2521. this.selectedColorOfInclusions.gd = rgbd[1];
  2522. this.selectedColorOfInclusions.gu = rgbu[1];
  2523. this.selectedColorOfInclusions.bd = rgbd[0];
  2524. this.selectedColorOfInclusions.bu = rgbu[0];
  2525. }
  2526. if (this.lstView_img.FocusedItem != null)
  2527. {
  2528. if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
  2529. {
  2530. everyImgData[this.lstView_img.FocusedItem.Index].thisSelectedColorOfInclusions = this.selectedColorOfInclusions;
  2531. }
  2532. else
  2533. {
  2534. CurrentPageData data = new CurrentPageData(this.autoJiaoBen);
  2535. data.directionIndex = comboBox_rollingDirection.SelectedIndex;
  2536. data.ratio = numericUpDown_lwRatioLimit.Value;
  2537. data.thisSelectedColorOfInclusions = this.selectedColorOfInclusions;
  2538. everyImgData.Add(this.lstView_img.FocusedItem.Index, data);
  2539. }
  2540. }
  2541. }
  2542. private void button_pickColor_Click(object sender, EventArgs e)
  2543. {
  2544. //this.checkBox_showBinary.Checked = false;
  2545. this.documentWorkspace.Cursor = new Cursor(PdnResources.GetResourceStream("Cursors.ColorPickerToolCursor.cur"));
  2546. this.pickColorChecked = true;
  2547. this.button_pickColor.FlatStyle = FlatStyle.Flat;
  2548. this.button_pickColor.BackColor = Color.FromArgb(225, 225, 225);
  2549. this.button_pickColor.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
  2550. this.button_pickColor.FlatAppearance.BorderSize = 1;
  2551. }
  2552. private void button_generateReport_Click(object sender, EventArgs e)
  2553. {
  2554. if (this.listView_analysisResult.Items.Count == 0)
  2555. {
  2556. MessageBox.Show(PdnResources.GetString("Menu.Noresults.text"));
  2557. return;
  2558. }
  2559. if (this.checkBox_generateReport_opensetting.Checked)
  2560. {
  2561. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, this.methodOfAssessment.resourcesName);
  2562. if (recombinationRateSetDialog.hasModule)
  2563. {
  2564. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  2565. recombinationRateSetDialog.ShowDialog();
  2566. }
  2567. else
  2568. {
  2569. recombinationRateSetDialog = null;
  2570. }
  2571. }
  2572. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  2573. {
  2574. //获取word书签与excel单元格的关系,以字典方式存储
  2575. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  2576. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  2577. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2578. {
  2579. foreach (mic_module_infos info in mic_module_infos)
  2580. {
  2581. tagInfos.Add(info.tag_name, info.cell_position);
  2582. }
  2583. }
  2584. List<List<List<string>>> sheets = new List<List<List<string>>>();
  2585. sheets.Add(new List<List<string>>());
  2586. List<List<string>> contentList = new List<List<string>>();
  2587. List<string> contentHead = new List<string>();
  2588. contentList.Add(contentHead);
  2589. foreach (ColumnHeader c in this.listView_analysisResult2.Columns)
  2590. {
  2591. contentHead.Add(c.Text);
  2592. }
  2593. for (int r = 0; r < this.listView_analysisResult2.Items.Count; r++)
  2594. {
  2595. List<string> contentBody = new List<string>();
  2596. for (int c = 0; c < this.listView_analysisResult2.Items[r].SubItems.Count; c++)
  2597. {
  2598. contentBody.Add(this.listView_analysisResult2.Items[r].SubItems[c].Text);
  2599. }
  2600. contentList.Add(contentBody);
  2601. }
  2602. contentList.Add(new List<string>());
  2603. contentHead = new List<string>();
  2604. contentList.Add(contentHead);
  2605. foreach (ColumnHeader c in this.listView_analysisResult.Columns)
  2606. {
  2607. contentHead.Add(c.Text);
  2608. }
  2609. for (int r = 0; r < this.listView_analysisResult.Items.Count; r++)
  2610. {
  2611. List<string> contentBody = new List<string>();
  2612. for (int c = 0; c < this.listView_analysisResult.Items[r].SubItems.Count; c++)
  2613. {
  2614. contentBody.Add(this.listView_analysisResult.Items[r].SubItems[c].Text);
  2615. }
  2616. contentList.Add(contentBody);
  2617. }
  2618. sheets.Add(contentList);
  2619. List<List<string>> inclusionList = new List<List<string>>();
  2620. List<string> inclusionHead = new List<string>();
  2621. inclusionList.Add(inclusionHead);
  2622. inclusionHead.Add("pixelLength");
  2623. inclusionHead.Add("pixelWidth");
  2624. inclusionHead.Add("physicalLength");
  2625. inclusionHead.Add("physicalWidth");
  2626. inclusionHead.Add("lwRatio");
  2627. inclusionHead.Add("arrangement");
  2628. inclusionHead.Add("shape");
  2629. inclusionHead.Add("shapeFactor");
  2630. inclusionHead.Add("area");
  2631. inclusionHead.Add("diameter");
  2632. inclusionHead.Add("type");
  2633. inclusionHead.Add("color");
  2634. inclusionHead.Add("chemicalCharacteristics");
  2635. inclusionHead.Add("X-Position");
  2636. inclusionHead.Add("Y-Position");
  2637. if (this.isK == 1) {
  2638. inclusionHead.Add("fieldNumber");
  2639. inclusionHead.Add("fieldLeftLimit");
  2640. inclusionHead.Add("fieldRightLimit");
  2641. inclusionHead.Add("fieldTopLimit");
  2642. inclusionHead.Add("fieldBottomLimit");
  2643. inclusionHead.Add("rating");
  2644. }
  2645. foreach (var analysisResult in this.analysisResults.Values)
  2646. {
  2647. foreach (var inclusion in analysisResult.inclusions)
  2648. {
  2649. List<string> inclusionBody = new List<string>();
  2650. inclusionList.Add(inclusionBody);
  2651. inclusionBody.Add(inclusion.pixelLength + "");
  2652. inclusionBody.Add(inclusion.pixelWidth + "");
  2653. inclusionBody.Add(inclusion.physicalLength + "");
  2654. inclusionBody.Add(inclusion.physicalWidth + "");
  2655. inclusionBody.Add(inclusion.lwRatio + "");
  2656. inclusionBody.Add(inclusion.arrangement + "");
  2657. inclusionBody.Add(inclusion.shape + "");
  2658. inclusionBody.Add(inclusion.shapeFactor + "");
  2659. inclusionBody.Add(inclusion.area + "");
  2660. inclusionBody.Add(inclusion.diameter + "");
  2661. inclusionBody.Add(inclusion.type.type + "");
  2662. inclusionBody.Add(inclusion.color == null ? "" : inclusion.color.colorName + "");
  2663. inclusionBody.Add(inclusion.chemicalCharacteristics + "");
  2664. inclusionBody.Add(inclusion.rectProfile.X + "");
  2665. inclusionBody.Add(inclusion.rectProfile.Y + "");
  2666. if (this.isK == 1)
  2667. {
  2668. inclusionBody.Add(inclusion.viewNum + "");
  2669. inclusionBody.Add(inclusion.viewLeft + "");
  2670. inclusionBody.Add(inclusion.viewRight + "");
  2671. inclusionBody.Add(inclusion.viewTop + "");
  2672. inclusionBody.Add(inclusion.viewBottom + "");
  2673. inclusionBody.Add(inclusion.rating + "");
  2674. }
  2675. }
  2676. }
  2677. sheets.Add(inclusionList);
  2678. List<Bitmap> bitList = new List<Bitmap>();
  2679. foreach (var item in this.listBox_analysisResult.CheckedItems)
  2680. {
  2681. DocumentWorkspace workspace = ((LocalListViewItem)item).Value;
  2682. double pantographRatio = workspace.GetRulerMultiple(MeasurementUnit.Micron);
  2683. Bitmap originalBit = workspace.CompositionSurface.CreateAliasedBitmap();
  2684. originalBit.Tag = pantographRatio;
  2685. Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2686. newBit.Tag = pantographRatio;
  2687. Graphics graphics = Graphics.FromImage(newBit);
  2688. foreach (var phase in dict[((LocalListViewItem)item).Display])
  2689. {
  2690. if (phase.mat == null) {
  2691. continue;
  2692. }
  2693. Bitmap processedBit = BitmapConverter.ToBitmap(phase.mat);
  2694. graphics.DrawImage(processedBit, new PointF(0, 0));
  2695. }
  2696. foreach (var inclusion in analysisResults[workspace].inclusions)
  2697. {
  2698. new InclusionDrawObject(workspace, inclusion, this.is_full).Draw(graphics);
  2699. }
  2700. bitList.Add(originalBit);
  2701. bitList.Add(newBit);
  2702. }
  2703. try
  2704. {
  2705. //OfficeFileHandleHelper.CreateAnalysisReportInclusion(this.analyzeSettingModel, sheets, bitList, tagInfos);
  2706. this.appWorkspace.CreateAnalysisReportInclusion(this.analyzeSettingModel, sheets, bitList, tagInfos);
  2707. }
  2708. catch (Exception ex)
  2709. {
  2710. MessageBox.Show(ex.Message);
  2711. }
  2712. }
  2713. else
  2714. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  2715. }
  2716. private void button_exportResults_Click(object sender, EventArgs e)
  2717. {
  2718. if (this.listView_analysisResult.Items.Count == 0)
  2719. {
  2720. MessageBox.Show(PdnResources.GetString("Menu.Noresults.text"));
  2721. return;
  2722. }
  2723. SaveFileDialog exe = new SaveFileDialog();
  2724. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  2725. exe.FilterIndex = 0;
  2726. exe.RestoreDirectory = true;
  2727. //exe.CreatePrompt = true;
  2728. exe.Title = "Export Excel File";
  2729. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  2730. exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + this.methodOfAssessment.resourcesName;
  2731. DialogResult dr = exe.ShowDialog();
  2732. if (dr != DialogResult.OK)
  2733. {
  2734. return;
  2735. }
  2736. List<DataTable> list = new List<DataTable>();
  2737. DataTable dtb = new DataTable();
  2738. foreach (ColumnHeader c in this.listView_analysisResult.Columns)
  2739. {
  2740. dtb.Columns.Add(c.Text);
  2741. }
  2742. for (int r = 0; r < this.listView_analysisResult.Items.Count; r++)
  2743. {
  2744. DataRow dataRow = dtb.NewRow();
  2745. for (int c = 0; c < this.listView_analysisResult.Items[r].SubItems.Count; c++)
  2746. {
  2747. dataRow[c] = this.listView_analysisResult.Items[r].SubItems[c].Text;
  2748. }
  2749. dtb.Rows.Add(dataRow);
  2750. }
  2751. DataTable dtb1 = new DataTable();
  2752. foreach (ColumnHeader c in this.listView_analysisResult2.Columns)
  2753. {
  2754. dtb1.Columns.Add(c.Text);
  2755. }
  2756. for (int r = 0; r < this.listView_analysisResult2.Items.Count; r++)
  2757. {
  2758. DataRow dataRow = dtb1.NewRow();
  2759. for (int c = 0; c < this.listView_analysisResult2.Items[r].SubItems.Count; c++)
  2760. {
  2761. dataRow[c] = this.listView_analysisResult2.Items[r].SubItems[c].Text;
  2762. }
  2763. dtb1.Rows.Add(dataRow);
  2764. }
  2765. DataTable dtb2 = new DataTable();
  2766. dtb2.Columns.Add("pixelLength");
  2767. dtb2.Columns.Add("pixelWidth");
  2768. dtb2.Columns.Add("physicalLength");
  2769. dtb2.Columns.Add("physicalWidth");
  2770. dtb2.Columns.Add("lwRatio");
  2771. dtb2.Columns.Add("arrangement");
  2772. dtb2.Columns.Add("shape");
  2773. dtb2.Columns.Add("shapeFactor");
  2774. dtb2.Columns.Add("area");
  2775. dtb2.Columns.Add("diameter");
  2776. dtb2.Columns.Add("type");
  2777. dtb2.Columns.Add("color");
  2778. dtb2.Columns.Add("chemicalCharacteristics");
  2779. dtb2.Columns.Add("X-Position");
  2780. dtb2.Columns.Add("Y-Position");
  2781. if (this.isK == 1)
  2782. {
  2783. dtb2.Columns.Add("rating");
  2784. }
  2785. foreach (var analysisResult in this.analysisResults.Values)
  2786. {
  2787. foreach (var inclusion in analysisResult.inclusions)
  2788. {
  2789. DataRow dataRow = dtb2.NewRow();
  2790. dataRow[0] = (inclusion.pixelLength + "");
  2791. dataRow[1] = (inclusion.pixelWidth + "");
  2792. dataRow[2] = (inclusion.physicalLength + "");
  2793. dataRow[3] = (inclusion.physicalWidth + "");
  2794. dataRow[4] = (inclusion.lwRatio + "");
  2795. dataRow[5] = (inclusion.arrangement + "");
  2796. dataRow[6] = (inclusion.shape + "");
  2797. dataRow[7] = (inclusion.shapeFactor + "");
  2798. dataRow[8] = (inclusion.area + "");
  2799. dataRow[9] = (inclusion.diameter + "");
  2800. dataRow[10] = (inclusion.type.type + "");
  2801. dataRow[11] = (inclusion.color == null ? "" : inclusion.color.colorName + "");
  2802. dataRow[12] = (inclusion.chemicalCharacteristics + "");
  2803. dataRow[13] = (inclusion.rectProfile.X + "");
  2804. dataRow[14] = (inclusion.rectProfile.Y + "");
  2805. if (this.isK == 1)
  2806. {
  2807. dataRow[15] = (inclusion.rating + "");
  2808. dataRow[8] = (inclusion.areaK + "");
  2809. }
  2810. dtb2.Rows.Add(dataRow);
  2811. }
  2812. }
  2813. dtb.TableName = "Sheet1";
  2814. dtb1.TableName = "Sheet2";
  2815. dtb2.TableName = "Sheet3";
  2816. list.Add(dtb);
  2817. list.Add(dtb1);
  2818. list.Add(dtb2);
  2819. try
  2820. {
  2821. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, true, true);
  2822. }
  2823. catch (Exception ex)
  2824. {
  2825. MessageBox.Show(ex.Message);
  2826. }
  2827. }
  2828. #endregion
  2829. #region 需继承方法
  2830. protected virtual void SubclassInitialize()
  2831. {
  2832. throw new NotImplementedException();
  2833. }
  2834. protected virtual MethodOfAssessment getMethodOfAssessment()
  2835. {
  2836. throw new NotImplementedException();
  2837. }
  2838. protected virtual void initColorSetting()
  2839. {
  2840. throw new NotImplementedException();
  2841. }
  2842. protected virtual void initDisplaySetting()
  2843. {
  2844. throw new NotImplementedException();
  2845. }
  2846. protected virtual void getInclusionParameters()
  2847. {
  2848. }
  2849. protected virtual void saveInclusionParameters()
  2850. {
  2851. }
  2852. protected virtual void getOldCheck()
  2853. {
  2854. }
  2855. #endregion
  2856. #region 内部类
  2857. internal class CurrentPageData
  2858. {
  2859. public CurrentPageData(int isYuanshi) {
  2860. if (isYuanshi == -1)
  2861. {
  2862. kNum = 4;
  2863. }
  2864. else {
  2865. kNum = isYuanshi;
  2866. }
  2867. }
  2868. public int directionIndex { get; set; }
  2869. public decimal ratio { get; set; }
  2870. public ColorOfInclusions thisSelectedColorOfInclusions { get; set; }
  2871. public bool colorCheck { get; set; }
  2872. public int kNum { get; set; }
  2873. }
  2874. internal class LocalListViewItem
  2875. {
  2876. public DocumentWorkspace Value { get; }
  2877. public string Display { get; }
  2878. public LocalListViewItem(DocumentWorkspace Value, string Display)
  2879. {
  2880. this.Value = Value;
  2881. this.Display = Display;
  2882. }
  2883. }
  2884. internal class DocumentItem
  2885. {
  2886. public Bitmap bitmap;
  2887. public GraphicsList graphicsList;
  2888. public List<PhaseModel> phaseModels;
  2889. public AnalysisResult analysisResult;
  2890. public DocumentItem(Bitmap bitmap, GraphicsList graphicsList, List<PhaseModel> phaseModels)
  2891. {
  2892. this.bitmap = bitmap;
  2893. this.graphicsList = graphicsList;
  2894. this.phaseModels = phaseModels;
  2895. }
  2896. }
  2897. #endregion
  2898. private void domainUpDown_resultPrecision_SelectedItemChanged(object sender, EventArgs e)
  2899. {
  2900. buildListView_analysisResult();
  2901. }
  2902. private void button1_Click(object sender, EventArgs e)
  2903. {
  2904. if (this.listView_analysisResult.Items.Count == 0)
  2905. {
  2906. MessageBox.Show(PdnResources.GetString("Menu.Noresults.text"));
  2907. return;
  2908. }
  2909. if (this.analyzeSettingModel == null)
  2910. {
  2911. MessageBox.Show(PdnResources.GetString("Menu.Pleasesetiirst.Text"));
  2912. return;
  2913. }
  2914. //获取项目工程内的文件夹路径
  2915. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.Inclusion.Text", this.analyzeSettingModel.savePath);
  2916. if (item != null)
  2917. {
  2918. //向文件夹内保存图片和报告
  2919. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  2920. {
  2921. //获取word书签与excel单元格的关系,以字典方式存储
  2922. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  2923. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  2924. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2925. {
  2926. foreach (mic_module_infos info in mic_module_infos)
  2927. {
  2928. tagInfos.Add(info.tag_name, info.cell_position);
  2929. }
  2930. }
  2931. List<List<string>> contentList = new List<List<string>>();
  2932. List<string> contentHead = new List<string>();
  2933. contentList.Add(contentHead);
  2934. foreach (ColumnHeader c in this.listView_analysisResult2.Columns)
  2935. {
  2936. contentHead.Add(c.Text);
  2937. }
  2938. for (int r = 0; r < this.listView_analysisResult2.Items.Count; r++)
  2939. {
  2940. List<string> contentBody = new List<string>();
  2941. for (int c = 0; c < this.listView_analysisResult2.Items[r].SubItems.Count; c++)
  2942. {
  2943. contentBody.Add(this.listView_analysisResult2.Items[r].SubItems[c].Text);
  2944. }
  2945. contentList.Add(contentBody);
  2946. }
  2947. contentList.Add(new List<string>());
  2948. contentHead = new List<string>();
  2949. contentList.Add(contentHead);
  2950. foreach (ColumnHeader c in this.listView_analysisResult.Columns)
  2951. {
  2952. contentHead.Add(c.Text);
  2953. }
  2954. for (int r = 0; r < this.listView_analysisResult.Items.Count; r++)
  2955. {
  2956. List<string> contentBody = new List<string>();
  2957. for (int c = 0; c < this.listView_analysisResult.Items[r].SubItems.Count; c++)
  2958. {
  2959. contentBody.Add(this.listView_analysisResult.Items[r].SubItems[c].Text);
  2960. }
  2961. contentList.Add(contentBody);
  2962. }
  2963. List<Bitmap> bitList = new List<Bitmap>();
  2964. List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
  2965. foreach (var itemIt in this.listBox_analysisResult.CheckedItems)
  2966. {
  2967. List<List<string>> inclusionList = new List<List<string>>();
  2968. List<string> inclusionHead = new List<string>();
  2969. inclusionList.Add(inclusionHead);
  2970. inclusionHead.Add("pixelLength");
  2971. inclusionHead.Add("pixelWidth");
  2972. inclusionHead.Add("physicalLength");
  2973. inclusionHead.Add("physicalWidth");
  2974. inclusionHead.Add("lwRatio");
  2975. inclusionHead.Add("arrangement");
  2976. inclusionHead.Add("shape");
  2977. inclusionHead.Add("shapeFactor");
  2978. inclusionHead.Add("area");
  2979. inclusionHead.Add("diameter");
  2980. inclusionHead.Add("type");
  2981. inclusionHead.Add("color");
  2982. inclusionHead.Add("chemicalCharacteristics");
  2983. inclusionHead.Add("X-Position");
  2984. inclusionHead.Add("Y-Position");
  2985. if (this.isK == 1)
  2986. {
  2987. inclusionHead.Add("fieldNumber");
  2988. inclusionHead.Add("fieldLeftLimit");
  2989. inclusionHead.Add("fieldRightLimit");
  2990. inclusionHead.Add("fieldTopLimit");
  2991. inclusionHead.Add("fieldBottomLimit");
  2992. inclusionHead.Add("rating");
  2993. }
  2994. DocumentWorkspace workspace = ((LocalListViewItem)itemIt).Value;
  2995. double pantographRatio = workspace.GetRulerMultiple(MeasurementUnit.Micron);
  2996. Bitmap originalBit = workspace.CompositionSurface.CreateAliasedBitmap();
  2997. originalBit.Tag = pantographRatio;
  2998. Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2999. newBit.Tag = pantographRatio;
  3000. Graphics graphics = Graphics.FromImage(newBit);
  3001. foreach (var phase in dict[((LocalListViewItem)itemIt).Display])
  3002. {
  3003. if (phase.mat == null)
  3004. {
  3005. continue;
  3006. }
  3007. Bitmap processedBit = BitmapConverter.ToBitmap(phase.mat);
  3008. graphics.DrawImage(processedBit, new PointF(0, 0));
  3009. }
  3010. foreach (var inclusion in analysisResults[workspace].inclusions)
  3011. {
  3012. List<string> inclusionBody = new List<string>();
  3013. inclusionBody.Add(inclusion.pixelLength + "");
  3014. inclusionBody.Add(inclusion.pixelWidth + "");
  3015. inclusionBody.Add(inclusion.physicalLength + "");
  3016. inclusionBody.Add(inclusion.physicalWidth + "");
  3017. inclusionBody.Add(inclusion.lwRatio + "");
  3018. inclusionBody.Add(inclusion.arrangement + "");
  3019. inclusionBody.Add(inclusion.shape + "");
  3020. inclusionBody.Add(inclusion.shapeFactor + "");
  3021. if (this.isK == 1)
  3022. {
  3023. inclusionBody.Add(inclusion.areaK + "");
  3024. }
  3025. else {
  3026. inclusionBody.Add(inclusion.area + "");
  3027. }
  3028. inclusionBody.Add(inclusion.diameter + "");
  3029. inclusionBody.Add(inclusion.type.type + "");
  3030. inclusionBody.Add(inclusion.color == null ? "" : inclusion.color.colorName + "");
  3031. inclusionBody.Add(inclusion.chemicalCharacteristics + "");
  3032. inclusionBody.Add(inclusion.rectProfile.X + "");
  3033. inclusionBody.Add(inclusion.rectProfile.Y + "");
  3034. if (this.isK == 1)
  3035. {
  3036. inclusionBody.Add(inclusion.viewNum + "");
  3037. inclusionBody.Add(inclusion.viewLeft + "");
  3038. inclusionBody.Add(inclusion.viewRight + "");
  3039. inclusionBody.Add(inclusion.viewTop + "");
  3040. inclusionBody.Add(inclusion.viewBottom + "");
  3041. inclusionBody.Add(inclusion.rating + "");
  3042. }
  3043. inclusionList.Add(inclusionBody);
  3044. new InclusionDrawObject(workspace, inclusion, this.is_full).Draw(graphics);
  3045. }
  3046. ExportProjectModel exportProjectModel = new ExportProjectModel();
  3047. exportProjectModel.dataList = inclusionList;
  3048. exportProjectModel.picName = ((LocalListViewItem)itemIt).Display;
  3049. exportProjectModel.tagName = PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.Inclusion.Text");
  3050. exportModel.Add(exportProjectModel);
  3051. bitList.Add(originalBit);
  3052. bitList.Add(newBit);
  3053. }
  3054. try
  3055. {
  3056. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, contentList, exportModel, bitList, tagInfos, item.path, item.code);
  3057. }
  3058. catch (Exception ex)
  3059. {
  3060. MessageBox.Show(ex.Message);
  3061. }
  3062. }
  3063. else
  3064. {
  3065. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  3066. return;
  3067. }
  3068. //保存项目信息到数据库
  3069. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  3070. }
  3071. }
  3072. private void button2_Click(object sender, EventArgs e)
  3073. {
  3074. new InclusionViewSetting(this.viewNum,this.inclusionViewSettingCloseCallback).ShowDialog();
  3075. }
  3076. private void inclusionViewSettingCloseCallback(int num)
  3077. {
  3078. this.viewNum = num;
  3079. }
  3080. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  3081. {
  3082. if (this.firstShow) {
  3083. return;
  3084. }
  3085. if (this.tempAnalysisResult == null)
  3086. {
  3087. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttostartstatistics.text"));
  3088. return;
  3089. }
  3090. is_showRectangle = !is_showRectangle;
  3091. ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, this.tempAnalysisResult.inclusions, is_showRectangle, is_showOval, is_full);
  3092. this.documentWorkspace.Refresh();
  3093. }
  3094. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  3095. {
  3096. if (this.firstShow)
  3097. {
  3098. return;
  3099. }
  3100. if (this.tempAnalysisResult == null) {
  3101. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttostartstatistics.text"));
  3102. return;
  3103. }
  3104. is_showOval = !is_showOval;
  3105. ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, this.tempAnalysisResult.inclusions, is_showRectangle, is_showOval, is_full);
  3106. }
  3107. private void radioButton1_CheckedChanged(object sender, EventArgs e)
  3108. {
  3109. if (this.firstShow)
  3110. {
  3111. return;
  3112. }
  3113. if (this.tempAnalysisResult == null)
  3114. {
  3115. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttostartstatistics.text"));
  3116. return;
  3117. }
  3118. if (radioButton1.Checked)
  3119. {
  3120. this.is_full = 2;
  3121. }
  3122. else {
  3123. this.is_full = 1;
  3124. }
  3125. if (this.tempAnalysisResult.segmentationView != 2)
  3126. {
  3127. ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, this.tempAnalysisResult.inclusions, is_showRectangle, is_showOval, is_full);
  3128. }
  3129. else
  3130. {
  3131. this.documentWorkspace.Refresh();
  3132. }
  3133. }
  3134. private void InclusionsStandardDialog_FormClosing(object sender, FormClosingEventArgs e)
  3135. {
  3136. binaryClass.saveParams();
  3137. }
  3138. private void ShownChoiseItemAndInitData(object sender, EventArgs e)
  3139. {
  3140. }
  3141. private void getLastData() {
  3142. string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterInclusionsModel.xml";
  3143. var text = this.dialogText;
  3144. if (!System.IO.File.Exists(filePath))
  3145. {
  3146. inclusionsModel.InclusionParameters = new List<InclusionsModel.InclusionParameter>();
  3147. string[] textList = new string[] { "GBT10561_MethodA", "GBT10561_MethodB", "EN10247_MethodP", "EN10247_MethodM", "EN10247_MethodK", "ISO4967_MethodA",
  3148. "ISO4967_MethodB","JISG0555_MethodA","JISG0555_MethodB","DIN50602_1985_MethodM","DIN50602_1985_MethodK","ASTME45_MethodA","ASTME45_MethodB",
  3149. "ASTME45_MethodC","ASTME45_MethodD","ASTME45_MethodE"};
  3150. for (int i = 0; i < textList.Count(); i++) {
  3151. var inclusionParameters = new InclusionsModel.InclusionParameter();
  3152. inclusionParameters.hasUsed = false;
  3153. inclusionParameters.name = textList[i];
  3154. inclusionsModel.InclusionParameters.Add(inclusionParameters);
  3155. }
  3156. this.thisParametersIndex = textList.ToList().IndexOf(text);
  3157. this.thisParameters = inclusionsModel.InclusionParameters[this.thisParametersIndex];
  3158. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<InclusionsModel>(inclusionsModel);
  3159. Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
  3160. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
  3161. }
  3162. else
  3163. {
  3164. inclusionsModel = XmlSerializeHelper.DESerializer<InclusionsModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
  3165. if (inclusionsModel.InclusionParameters == null) {
  3166. inclusionsModel.InclusionParameters = new List<InclusionsModel.InclusionParameter>();
  3167. }
  3168. thisParameters = inclusionsModel.InclusionParameters.Where(m => m.name.Equals(text)).FirstOrDefault();
  3169. if (thisParameters == null)
  3170. {
  3171. thisParameters = new InclusionsModel.InclusionParameter();
  3172. thisParameters.hasUsed = false;
  3173. thisParameters.name = text;
  3174. inclusionsModel.InclusionParameters.Add(thisParameters);
  3175. this.thisParametersIndex = inclusionsModel.InclusionParameters.Count() - 1;
  3176. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<InclusionsModel>(inclusionsModel);
  3177. Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
  3178. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
  3179. }
  3180. else {
  3181. this.thisParametersIndex = inclusionsModel.InclusionParameters.IndexOf(thisParameters);
  3182. if (thisParameters.hasUsed)
  3183. {
  3184. if (thisParameters.parameter1 >= 0) {
  3185. comboBox_rollingDirection.SelectedIndex = thisParameters.parameter1;
  3186. }
  3187. if (thisParameters.parameter2 >= numericUpDown_lwRatioLimit.Minimum) {
  3188. numericUpDown_lwRatioLimit.Value = thisParameters.parameter2;
  3189. }
  3190. if (thisParameters.parameter14 >= 0) {
  3191. comboBox1.SelectedIndex = thisParameters.parameter14;
  3192. }
  3193. checkBox_showColorGamutPhase.Checked = thisParameters.parameter5;
  3194. domainUpDown_resultPrecision.SelectedIndex = thisParameters.parameter13;
  3195. this.viewNum = thisParameters.parameter16;
  3196. checkBox_generateReport_opensetting.Checked = thisParameters.parameter17;
  3197. radioButton1.Checked = thisParameters.parameter18 == 0 ? true : false;
  3198. radioButton2.Checked = thisParameters.parameter18 == 0 ? false : true;
  3199. if (radioButton1.Checked)
  3200. {
  3201. this.is_full = 2;
  3202. }
  3203. else
  3204. {
  3205. this.is_full = 1;
  3206. }
  3207. checkBox2.Checked = thisParameters.parameter19;
  3208. is_showRectangle = thisParameters.parameter19;
  3209. checkBox1.Checked = thisParameters.parameter20;
  3210. is_showOval = thisParameters.parameter20;
  3211. if (thisParameters.parameter3 > 0)
  3212. {
  3213. this.whichChecked = thisParameters.parameter3;
  3214. getInclusionParameters();
  3215. switch (thisParameters.parameter3)
  3216. {
  3217. case 1:
  3218. if (thisParameters.parameter15 != null && thisParameters.parameter15.Count > 0)
  3219. {
  3220. this.numericUpDown_colorAdjustmentRHU.Value = thisParameters.parameter15[0].parameter7;
  3221. this.numericUpDown_colorAdjustmentRHD.Value = thisParameters.parameter15[0].parameter8;
  3222. this.numericUpDown_colorAdjustmentGLU.Value = thisParameters.parameter15[0].parameter9;
  3223. this.numericUpDown_colorAdjustmentGLD.Value = thisParameters.parameter15[0].parameter10;
  3224. this.numericUpDown_colorAdjustmentBSU.Value = thisParameters.parameter15[0].parameter11;
  3225. this.numericUpDown_colorAdjustmentBSD.Value = thisParameters.parameter15[0].parameter12;
  3226. }
  3227. break;
  3228. case 2:
  3229. if (thisParameters.parameter15 != null && thisParameters.parameter15.Count > 1)
  3230. {
  3231. this.numericUpDown_colorAdjustmentRHU.Value = thisParameters.parameter15[1].parameter7;
  3232. this.numericUpDown_colorAdjustmentRHD.Value = thisParameters.parameter15[1].parameter8;
  3233. this.numericUpDown_colorAdjustmentGLU.Value = thisParameters.parameter15[1].parameter9;
  3234. this.numericUpDown_colorAdjustmentGLD.Value = thisParameters.parameter15[1].parameter10;
  3235. this.numericUpDown_colorAdjustmentBSU.Value = thisParameters.parameter15[1].parameter11;
  3236. this.numericUpDown_colorAdjustmentBSD.Value = thisParameters.parameter15[1].parameter12;
  3237. }
  3238. break;
  3239. case 3:
  3240. if (thisParameters.parameter15 != null && thisParameters.parameter15.Count > 2)
  3241. {
  3242. this.numericUpDown_colorAdjustmentRHU.Value = thisParameters.parameter15[2].parameter7;
  3243. this.numericUpDown_colorAdjustmentRHD.Value = thisParameters.parameter15[2].parameter8;
  3244. this.numericUpDown_colorAdjustmentGLU.Value = thisParameters.parameter15[2].parameter9;
  3245. this.numericUpDown_colorAdjustmentGLD.Value = thisParameters.parameter15[2].parameter10;
  3246. this.numericUpDown_colorAdjustmentBSU.Value = thisParameters.parameter15[2].parameter11;
  3247. this.numericUpDown_colorAdjustmentBSD.Value = thisParameters.parameter15[2].parameter12;
  3248. }
  3249. break;
  3250. case 4:
  3251. if (thisParameters.parameter15 != null && thisParameters.parameter15.Count > 3)
  3252. {
  3253. this.numericUpDown_colorAdjustmentRHU.Value = thisParameters.parameter15[3].parameter7;
  3254. this.numericUpDown_colorAdjustmentRHD.Value = thisParameters.parameter15[3].parameter8;
  3255. this.numericUpDown_colorAdjustmentGLU.Value = thisParameters.parameter15[3].parameter9;
  3256. this.numericUpDown_colorAdjustmentGLD.Value = thisParameters.parameter15[3].parameter10;
  3257. this.numericUpDown_colorAdjustmentBSU.Value = thisParameters.parameter15[3].parameter11;
  3258. this.numericUpDown_colorAdjustmentBSD.Value = thisParameters.parameter15[3].parameter12;
  3259. }
  3260. break;
  3261. }
  3262. button_colorAdjustmentRH.Focus();
  3263. CalcRGBOrHLSValue();
  3264. UpdateHistogramStartAndEnd();
  3265. }
  3266. }
  3267. }
  3268. }
  3269. if (this.selectedColorOfInclusions != null)
  3270. {
  3271. ColorOfInclusions colorOfInclusions = new ColorOfInclusions(this.selectedColorOfInclusions.colorName, this.selectedColorOfInclusions.ofTypes, this.selectedColorOfInclusions.ru, this.selectedColorOfInclusions.rd, this.selectedColorOfInclusions.gu, this.selectedColorOfInclusions.gd, this.selectedColorOfInclusions.bu, this.selectedColorOfInclusions.bd);
  3272. this.oldSelectedColorOfInclusions = colorOfInclusions;
  3273. }
  3274. }
  3275. private void saveLastData(object sender, EventArgs e)
  3276. {
  3277. if (this.thisParametersIndex == -1) {
  3278. return;
  3279. }
  3280. binaryClass.saveParams();
  3281. this.thisParameters.hasUsed = true;
  3282. if (comboBox_rollingDirection.SelectedIndex >= 0)
  3283. {
  3284. thisParameters.parameter1 = comboBox_rollingDirection.SelectedIndex;
  3285. }
  3286. comboBox_rollingDirection.SelectedIndex = thisParameters.parameter1;
  3287. thisParameters.parameter2 = numericUpDown_lwRatioLimit.Value;
  3288. if (comboBox1.SelectedIndex >= 0)
  3289. {
  3290. thisParameters.parameter14 = comboBox1.SelectedIndex;
  3291. }
  3292. thisParameters.parameter5 = checkBox_showColorGamutPhase.Checked;
  3293. this.thisParameters.parameter13 = domainUpDown_resultPrecision.SelectedIndex;
  3294. this.thisParameters.parameter16 = this.viewNum;
  3295. thisParameters.parameter17 = checkBox_generateReport_opensetting.Checked;
  3296. if (radioButton1.Checked)
  3297. {
  3298. thisParameters.parameter18 = 0;
  3299. }
  3300. else if (radioButton2.Checked) {
  3301. thisParameters.parameter18 = 1;
  3302. }
  3303. thisParameters.parameter19 = checkBox2.Checked;
  3304. thisParameters.parameter20 = checkBox1.Checked;
  3305. saveInclusionParameters();
  3306. this.thisParameters.parameter15 = new List<InclusionsModel.InclusionParameter.rgbNum>();
  3307. for (int i = 0; i <= 3; i++) {
  3308. var num = new InclusionsModel.InclusionParameter.rgbNum();
  3309. num.parameter7 = 0;
  3310. num.parameter8 = 0;
  3311. num.parameter9 = 0;
  3312. num.parameter10 = 0;
  3313. num.parameter11 = 0;
  3314. num.parameter12 = 0;
  3315. this.thisParameters.parameter15.Add(num);
  3316. }
  3317. foreach (var item in MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions) {
  3318. switch (item.Key) {
  3319. case "Black":
  3320. this.thisParameters.parameter15[0].parameter7 = item.Value.rd;
  3321. this.thisParameters.parameter15[0].parameter8 = item.Value.ru;
  3322. this.thisParameters.parameter15[0].parameter9 = item.Value.gd;
  3323. this.thisParameters.parameter15[0].parameter10 = item.Value.gu;
  3324. this.thisParameters.parameter15[0].parameter11 = item.Value.bd;
  3325. this.thisParameters.parameter15[0].parameter12 = item.Value.bu;
  3326. break;
  3327. case "LightBlue":
  3328. this.thisParameters.parameter15[1].parameter7 = item.Value.rd;
  3329. this.thisParameters.parameter15[1].parameter8 = item.Value.ru;
  3330. this.thisParameters.parameter15[1].parameter9 = item.Value.gd;
  3331. this.thisParameters.parameter15[1].parameter10 = item.Value.gu;
  3332. this.thisParameters.parameter15[1].parameter11 = item.Value.bd;
  3333. this.thisParameters.parameter15[1].parameter12 = item.Value.bu;
  3334. break;
  3335. case "Colored":
  3336. this.thisParameters.parameter15[1].parameter7 = item.Value.rd;
  3337. this.thisParameters.parameter15[1].parameter8 = item.Value.ru;
  3338. this.thisParameters.parameter15[1].parameter9 = item.Value.gd;
  3339. this.thisParameters.parameter15[1].parameter10 = item.Value.gu;
  3340. this.thisParameters.parameter15[1].parameter11 = item.Value.bd;
  3341. this.thisParameters.parameter15[1].parameter12 = item.Value.bu;
  3342. break;
  3343. case "Gray":
  3344. this.thisParameters.parameter15[2].parameter7 = item.Value.rd;
  3345. this.thisParameters.parameter15[2].parameter8 = item.Value.ru;
  3346. this.thisParameters.parameter15[2].parameter9 = item.Value.gd;
  3347. this.thisParameters.parameter15[2].parameter10 = item.Value.gu;
  3348. this.thisParameters.parameter15[2].parameter11 = item.Value.bd;
  3349. this.thisParameters.parameter15[2].parameter12 = item.Value.bu;
  3350. break;
  3351. case "DarkGray":
  3352. this.thisParameters.parameter15[3].parameter7 = item.Value.rd;
  3353. this.thisParameters.parameter15[3].parameter8 = item.Value.ru;
  3354. this.thisParameters.parameter15[3].parameter9 = item.Value.gd;
  3355. this.thisParameters.parameter15[3].parameter10 = item.Value.gu;
  3356. this.thisParameters.parameter15[3].parameter11 = item.Value.bd;
  3357. this.thisParameters.parameter15[3].parameter12 = item.Value.bu;
  3358. break;
  3359. }
  3360. }
  3361. this.inclusionsModel.InclusionParameters[this.thisParametersIndex] = this.thisParameters;
  3362. string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterInclusionsModel.xml";
  3363. string porosityInfoXml = XmlSerializeHelper.XmlSerialize<InclusionsModel>(inclusionsModel);
  3364. Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
  3365. FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
  3366. #region [开启脚本录制]
  3367. if (appWorkspace.startScriptRecording)
  3368. {
  3369. getScriptRecording();
  3370. }
  3371. #endregion
  3372. }
  3373. /// <summary>
  3374. /// 应用到全部
  3375. /// </summary>
  3376. /// <param name="sender"></param>
  3377. /// <param name="e"></param>
  3378. private void button4_Click(object sender, EventArgs e)
  3379. {
  3380. if (this.lstView_img.FocusedItem == null) {
  3381. return;
  3382. }
  3383. binaryClass.saveParams();
  3384. binaryClass.applyToAll(this.imageList_img.Images.Keys, this.imageList_img.Images.Keys[this.lstView_img.FocusedItem.Index]);
  3385. userAll = true;
  3386. resultList.Clear();
  3387. hasResultIndexList.Clear();
  3388. var data = new CurrentPageData(this.autoJiaoBen);
  3389. var firstIndex = this.lstView_img.FocusedItem.Index;
  3390. if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index)) {
  3391. data = everyImgData[this.lstView_img.FocusedItem.Index];
  3392. }
  3393. for (int i = 0; i < lstView_img.Items.Count; i++) {
  3394. this.lstView_img.EnsureVisible(i);
  3395. this.lstView_img.Items[i].Focused = true;
  3396. this.lstView_img.Items[i].Selected = true;
  3397. if (everyImgData.ContainsKey(i))
  3398. {
  3399. everyImgData[i] = data;
  3400. }
  3401. else {
  3402. everyImgData.Add(i, data);
  3403. }
  3404. if ((i == 0 && lstView_img.Items.Count == 1) || firstIndex == 0)
  3405. {
  3406. this.startStatistics();
  3407. }
  3408. }
  3409. #region [给最后一张图赋值]
  3410. if (data.thisSelectedColorOfInclusions != null)
  3411. {
  3412. this.colorName = data.thisSelectedColorOfInclusions.colorName;
  3413. getOldCheck();
  3414. this.selectedColorOfInclusions = data.thisSelectedColorOfInclusions;
  3415. CalcRGBOrHLSValue();
  3416. UpdateHistogramStartAndEnd();
  3417. }
  3418. else
  3419. {
  3420. if (this.oldSelectedColorOfInclusions != null)
  3421. {
  3422. this.colorName = this.oldSelectedColorOfInclusions.colorName;
  3423. getOldCheck();
  3424. this.selectedColorOfInclusions = new ColorOfInclusions(this.oldSelectedColorOfInclusions.colorName, this.oldSelectedColorOfInclusions.ofTypes, this.oldSelectedColorOfInclusions.ru, this.oldSelectedColorOfInclusions.rd, this.oldSelectedColorOfInclusions.gu, this.oldSelectedColorOfInclusions.gd, this.oldSelectedColorOfInclusions.bu, this.oldSelectedColorOfInclusions.bd);
  3425. data.thisSelectedColorOfInclusions = this.selectedColorOfInclusions;
  3426. CalcRGBOrHLSValue();
  3427. UpdateHistogramStartAndEnd();
  3428. }
  3429. }
  3430. comboBox1.SelectedIndex = data.kNum;
  3431. if (data.directionIndex >= 0)
  3432. {
  3433. comboBox_rollingDirection.SelectedIndex = data.directionIndex;
  3434. }
  3435. if (data.ratio >= numericUpDown_lwRatioLimit.Minimum)
  3436. {
  3437. numericUpDown_lwRatioLimit.Value = data.ratio;
  3438. }
  3439. checkBox_showColorGamutPhase.Checked = data.colorCheck;
  3440. #endregion
  3441. radioButton1.Enabled = true;
  3442. radioButton2.Enabled = true;
  3443. checkBox1.Enabled = true;
  3444. checkBox2.Enabled = true;
  3445. }
  3446. /// <summary>
  3447. /// 保存到全部
  3448. /// </summary>
  3449. /// <param name="sender"></param>
  3450. /// <param name="e"></param>
  3451. private void button3_Click(object sender, EventArgs e)
  3452. {
  3453. if (this.lstView_img.FocusedItem == null)
  3454. {
  3455. return;
  3456. }
  3457. if (resultList.Count() == 0) {
  3458. MessageBox.Show("请先点击应用全部!");
  3459. return;
  3460. }
  3461. if (listBox_analysisResult.Items.Count > 0)
  3462. {
  3463. if (MessageBox.Show(PdnResources.GetString("Menu.Theresuethertoreplace.text") + "?", "", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  3464. {
  3465. for (int i = 0; i < resultList.Count(); i++)
  3466. {
  3467. if (analysisResults.ContainsKey(this.appWorkspace.DocumentWorkspaces[i]))
  3468. {
  3469. continue;
  3470. }
  3471. else
  3472. {
  3473. analysisResults.Add(this.appWorkspace.DocumentWorkspaces[i], resultList[i]);
  3474. }
  3475. buildListBox_analysisResult();
  3476. }
  3477. return;
  3478. }
  3479. }
  3480. for (int i = 0; i < resultList.Count(); i++) {
  3481. if (analysisResults.ContainsKey(this.appWorkspace.DocumentWorkspaces[i]))
  3482. {
  3483. analysisResults[this.appWorkspace.DocumentWorkspaces[i]] = resultList[i];
  3484. }
  3485. else {
  3486. analysisResults.Add(this.appWorkspace.DocumentWorkspaces[i], resultList[i]);
  3487. }
  3488. buildListBox_analysisResult();
  3489. }
  3490. }
  3491. private void allCheck() {
  3492. if (listBox_analysisResult.Items != null && listBox_analysisResult.Items.Count > 0) {
  3493. for (int i = 0; i < listBox_analysisResult.Items.Count; i++) {
  3494. listBox_analysisResult.SetItemChecked(i, true);
  3495. }
  3496. buildListView_analysisResult();
  3497. }
  3498. }
  3499. private void getValue(string key,Object value)
  3500. {
  3501. switch (key)
  3502. {
  3503. case "parameter1":
  3504. comboBox_rollingDirection.SelectedIndex = (int)value;
  3505. break;
  3506. case "parameter2":
  3507. numericUpDown_lwRatioLimit.Value = Convert.ToDecimal(value);
  3508. break;
  3509. case "parameter5":
  3510. checkBox_showColorGamutPhase.Checked = Convert.ToBoolean(value);
  3511. break;
  3512. case "parameter17":
  3513. checkBox_generateReport_opensetting.Checked = Convert.ToBoolean(value);
  3514. break;
  3515. case "parameter18":
  3516. radioButton1.Checked = (int)value == 1 ? true : false;
  3517. radioButton2.Checked = (int)value == 1 ? false : true;
  3518. if (radioButton1.Checked)
  3519. {
  3520. this.is_full = 2;
  3521. }
  3522. else
  3523. {
  3524. this.is_full = 1;
  3525. }
  3526. break;
  3527. case "parameter19":
  3528. checkBox2.Checked = Convert.ToBoolean(value);
  3529. is_showRectangle = Convert.ToBoolean(value);
  3530. break;
  3531. case "parameter20":
  3532. checkBox1.Checked = Convert.ToBoolean(value);
  3533. is_showOval = Convert.ToBoolean(value);
  3534. break;
  3535. case "scopeR":
  3536. List<double> redlist = (List<double>)value;
  3537. if (rgbDict.ContainsKey("red"))
  3538. {
  3539. rgbDict["red"] = redlist;
  3540. }
  3541. else {
  3542. rgbDict.Add("red", redlist);
  3543. }
  3544. break;
  3545. case "scopeG":
  3546. List<double> greenlist = (List<double>)value;
  3547. if (rgbDict.ContainsKey("green"))
  3548. {
  3549. rgbDict["green"] = greenlist;
  3550. }
  3551. else
  3552. {
  3553. rgbDict.Add("green", greenlist);
  3554. }
  3555. break;
  3556. case "scopeB":
  3557. List<double> bluelist = (List<double>)value;
  3558. if (rgbDict.ContainsKey("blue"))
  3559. {
  3560. rgbDict["blue"] = bluelist;
  3561. }
  3562. else
  3563. {
  3564. rgbDict.Add("blue", bluelist);
  3565. }
  3566. break;
  3567. case "parameter3":
  3568. this.whichChecked = (int)value;
  3569. getInclusionParameters();
  3570. this.numericUpDown_colorAdjustmentRHU.Value = (decimal)rgbDict["red"][0];
  3571. this.numericUpDown_colorAdjustmentRHD.Value = (decimal)rgbDict["red"][1];
  3572. this.numericUpDown_colorAdjustmentGLU.Value = (decimal)rgbDict["green"][0];
  3573. this.numericUpDown_colorAdjustmentGLD.Value = (decimal)rgbDict["green"][1];
  3574. this.numericUpDown_colorAdjustmentBSU.Value = (decimal)rgbDict["blue"][0];
  3575. this.numericUpDown_colorAdjustmentBSD.Value = (decimal)rgbDict["blue"][1];
  3576. CalcRGBOrHLSValue();
  3577. UpdateHistogramStartAndEnd();
  3578. break;
  3579. case "OpenWhileExportReport":
  3580. checkBox_generateReport_opensetting.Checked = Convert.ToBoolean(value);
  3581. break;
  3582. case "CalculatorDecimalDigits":
  3583. this.domainUpDown_resultPrecision.TabIndex = (int)value;
  3584. this.domainUpDown_resultPrecision.Text = value.ToString();
  3585. break;
  3586. case "ExportResults":
  3587. isExportResults = Convert.ToBoolean(value);
  3588. break;
  3589. case "ExportReports":
  3590. isExportReports = Convert.ToBoolean(value);
  3591. break;
  3592. case "ExportProjects":
  3593. isExportProjects = Convert.ToBoolean(value);
  3594. break;
  3595. case "parameter14":
  3596. this.comboBox1.SelectedItem = (Convert.ToInt32(value) - 4).ToString();
  3597. this.autoJiaoBen = this.comboBox1.SelectedIndex;
  3598. break;
  3599. case "viewNum":
  3600. this.viewNum = Convert.ToInt32(value);
  3601. break;
  3602. }
  3603. }
  3604. /// <summary>
  3605. /// 不可点击空白区域
  3606. /// </summary>
  3607. /// <param name="sender"></param>
  3608. /// <param name="e"></param>
  3609. private void listView1_MouseUp(object sender, MouseEventArgs e)
  3610. {
  3611. if (e.Button == MouseButtons.Left)
  3612. {
  3613. if (lstView_img.SelectedItems.Count > 0)
  3614. {
  3615. }
  3616. else if (lstView_img.SelectedItems.Count <= 0)//点击空白区
  3617. {
  3618. if (this.lstView_img.FocusedItem != null)
  3619. {
  3620. ListViewItem item = this.lstView_img.GetItemAt(e.X, e.Y);
  3621. if (item == null)
  3622. {
  3623. this.lstView_img.FocusedItem.Selected = true;
  3624. }
  3625. }
  3626. }
  3627. }
  3628. }
  3629. #region [脚本录制]
  3630. private void getScriptRecording()
  3631. {
  3632. string className = InvariantData.path_Action + ".Action" + menuId;
  3633. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  3634. List<Args> args = param.Lists;
  3635. foreach (var item in args)
  3636. {
  3637. item.value = setScriptRecording(item.key);
  3638. }
  3639. //找出二值相关参数 进行赋值
  3640. List<Args> isNullList = args.Where(m => m.value == null).ToList();
  3641. foreach (var item in isNullList)
  3642. {
  3643. item.value = binaryClass.setScriptRecording(item.key);
  3644. }
  3645. appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
  3646. }
  3647. private object setScriptRecording(string key)
  3648. {
  3649. object value = null;
  3650. switch (key)
  3651. {
  3652. case "parameter1":
  3653. value = comboBox_rollingDirection.SelectedIndex;
  3654. break;
  3655. case "parameter2":
  3656. value = numericUpDown_lwRatioLimit.Value;
  3657. break;
  3658. case "parameter5":
  3659. value = checkBox_showColorGamutPhase.Checked;
  3660. break;
  3661. case "parameter17":
  3662. value = checkBox_generateReport_opensetting.Checked;
  3663. break;
  3664. case "parameter18":
  3665. value = radioButton1.Checked ? 1 : 2;
  3666. break;
  3667. case "parameter19":
  3668. value = checkBox2.Checked;
  3669. break;
  3670. case "parameter20":
  3671. value = checkBox1.Checked;
  3672. break;
  3673. case "scopeR":
  3674. value = new List<double>() { (double)this.numericUpDown_colorAdjustmentRHU.Value, (double)this.numericUpDown_colorAdjustmentRHD.Value };
  3675. break;
  3676. case "scopeG":
  3677. value = new List<double>() { (double)this.numericUpDown_colorAdjustmentGLU.Value, (double)this.numericUpDown_colorAdjustmentGLD.Value };
  3678. break;
  3679. case "scopeB":
  3680. value = new List<double>() { (double)this.numericUpDown_colorAdjustmentBSU.Value, (double)this.numericUpDown_colorAdjustmentBSD.Value };
  3681. break;
  3682. case "parameter3":
  3683. value = thisParameters.parameter3;
  3684. break;
  3685. case "OpenWhileExportReport":
  3686. value = checkBox_generateReport_opensetting.Checked;
  3687. break;
  3688. case "CalculatorDecimalDigits":
  3689. value = this.domainUpDown_resultPrecision.SelectedItem;
  3690. break;
  3691. case "ExportResults":
  3692. value = isExportResults;
  3693. break;
  3694. case "ExportReports":
  3695. value = isExportReports;
  3696. break;
  3697. case "ExportProjects":
  3698. value = isExportProjects;
  3699. break;
  3700. case "parameter14":
  3701. value = this.comboBox1.SelectedItem;
  3702. break;
  3703. case "viewNum":
  3704. value = this.viewNum;
  3705. break;
  3706. }
  3707. return value;
  3708. }
  3709. #endregion
  3710. }
  3711. }