123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416 |
- using OpenCvSharp;
- using OpenCvSharp.Extensions;
- using PaintDotNet.Annotation;
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Base.Functionodel;
- using PaintDotNet.CustomControl;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using PaintDotNet.DbOpreate.DbBll;
- using PaintDotNet.DbOpreate.DbModel;
- using PaintDotNet.Base.CommTool;
- using System.IO;
- using PaintDotNet.Base.SettingModel;
- using PaintDotNet.Data.Param;
- using PaintDotNet.Base;
- using PaintDotNet.GeneralAnalysis;
- using PaintDotNet.DedicatedAnalysis.DuctileIron.Common;
- using PaintDotNet;
- using Metis.ParameterSet;
- namespace Metis.DedicatedAnalysis.DeterminationOfNitridingDepth.GBT11354_2005.OrganizationLevel
- {
- internal class OrganizationLevelDialog : PdnBaseForm
- {
- #region
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
- #region Windows Form Designer generated code
- private void InitializeLanguageText()
- {
- this.bc = new PaintDotNet.CustomControl.BinaryControl();
- //
- // bc
- //
- this.bc.BinaryBackColor = System.Drawing.Color.Red;
- this.bc.BinaryChecked = false;
- this.bc.BinaryStyle = 1;
- this.bc.Location = new System.Drawing.Point(151, 56);
- this.bc.Name = "bc";
- this.bc.OriginChecked = false;
- this.bc.scope1End = 0D;
- this.bc.scope1Start = 0D;
- this.bc.scope2End = 0D;
- this.bc.scope2Start = 0D;
- this.bc.scope3End = 0D;
- this.bc.scope3Start = 0D;
- this.bc.Size = new System.Drawing.Size(360, 292);
- this.bc.TabIndex = 36;
- this.Controls.Add(this.bc);
- this.Controls.SetChildIndex(this.bc, 0);
-
- this.Text = "GBT11354-2005(" + PdnResources.GetString("Menu.Theleveloftheoriginalorganization.text") + ")";
- this.checkBox3.Text = PdnResources.GetString("Menu.filter.text");
- this.checkBox2.Text = PdnResources.GetString("Menu.filter.text");
- this.label3.Text = PdnResources.GetString("Menu.range.text") + ":";
- this.groupBox5.Text = PdnResources.GetString("Menu.Particlescreening.text");
- this.btnSetUp.Text = PdnResources.GetString("Menu.Setting.Text");
- this.checkBox1.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
- this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
- this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
- this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
- this.groupBox3.Text = PdnResources.GetString("Menu.Preview.text");
- this.checkBox4.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Showdifofcolor.text");
- this.checkBox5.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Displayarearate.text");
- this.btnColour.Text = PdnResources.GetString("Menu.Colorsetting.text");
- this.btnDisplay.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
- this.checkBox6.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Particleshecalculation.text");
- this.groupBox6.Text = PdnResources.GetString("Menu.paramssettings.text");
- this.groupBox8.Text = PdnResources.GetString("Menu.Theesultshow.text");
- this.button6.Text = PdnResources.GetString("Menu.Showall.text");
- this.button7.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.button8.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
- this.button9.Text = PdnResources.GetString("Menu.Exportresults.text");
- this.label8.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
- this.button1.Text = PdnResources.GetString("Menu.Exportproject.text");
- this.groupBox9.Text = PdnResources.GetString("Menu.Analysisresult.text");
- this.label4.Text = PdnResources.GetString("Menu.minimum.text");
- this.label5.Text = PdnResources.GetString("Menu.max.text");
- this.groupBox7.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Graphitearearaterange.text") + "(%)";
- }
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.groupBox7 = new System.Windows.Forms.GroupBox();
- this.checkBox2 = new System.Windows.Forms.CheckBox();
- this.trackBar6 = new System.Windows.Forms.TrackBar();
- this.trackBar5 = new System.Windows.Forms.TrackBar();
- this.numericUpDown7 = new System.Windows.Forms.NumericUpDown();
- this.numericUpDown6 = new System.Windows.Forms.NumericUpDown();
- this.label5 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.groupBox9 = new System.Windows.Forms.GroupBox();
- this.dataGridView3 = new System.Windows.Forms.DataGridView();
- this.button1 = new System.Windows.Forms.Button();
- this.label10 = new System.Windows.Forms.Label();
- this.label9 = new System.Windows.Forms.Label();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.label8 = new System.Windows.Forms.Label();
- this.button9 = new System.Windows.Forms.Button();
- this.button8 = new System.Windows.Forms.Button();
- this.dataGridView2 = new System.Windows.Forms.DataGridView();
- this.listView2 = new System.Windows.Forms.ListView();
- this.button7 = new System.Windows.Forms.Button();
- this.button6 = new System.Windows.Forms.Button();
- this.groupBox8 = new System.Windows.Forms.GroupBox();
- this.dataGridView1 = new System.Windows.Forms.DataGridView();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.checkBox6 = new System.Windows.Forms.CheckBox();
- this.btnDisplay = new System.Windows.Forms.Button();
- this.btnColour = new System.Windows.Forms.Button();
- this.checkBox5 = new System.Windows.Forms.CheckBox();
- this.checkBox4 = new System.Windows.Forms.CheckBox();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.listView1 = new System.Windows.Forms.ListView();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.button2 = new System.Windows.Forms.Button();
- this.checkBox1 = new System.Windows.Forms.CheckBox();
- this.btnSetUp = new System.Windows.Forms.Button();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.trackBar4 = new System.Windows.Forms.TrackBar();
- this.trackBar2 = new System.Windows.Forms.TrackBar();
- this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
- this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
- this.label3 = new System.Windows.Forms.Label();
- this.checkBox3 = new System.Windows.Forms.CheckBox();
- this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.groupBox7.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar6)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar5)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).BeginInit();
- this.groupBox9.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
- this.groupBox8.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
- this.groupBox6.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox1.SuspendLayout();
- this.groupBox5.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox7
- //
- this.groupBox7.Controls.Add(this.checkBox2);
- this.groupBox7.Controls.Add(this.trackBar6);
- this.groupBox7.Controls.Add(this.trackBar5);
- this.groupBox7.Controls.Add(this.numericUpDown7);
- this.groupBox7.Controls.Add(this.numericUpDown6);
- this.groupBox7.Controls.Add(this.label5);
- this.groupBox7.Controls.Add(this.label4);
- this.groupBox7.Location = new System.Drawing.Point(154, 504);
- this.groupBox7.Name = "groupBox7";
- this.groupBox7.Size = new System.Drawing.Size(357, 72);
- this.groupBox7.TabIndex = 35;
- this.groupBox7.TabStop = false;
- //
- // checkBox2
- //
- this.checkBox2.AutoEllipsis = true;
- this.checkBox2.Location = new System.Drawing.Point(18, 17);
- this.checkBox2.Name = "checkBox2";
- this.checkBox2.Size = new System.Drawing.Size(100, 16);
- this.checkBox2.TabIndex = 19;
- this.checkBox2.UseVisualStyleBackColor = true;
- this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
- //
- // trackBar6
- //
- this.trackBar6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.trackBar6.AutoSize = false;
- this.trackBar6.Location = new System.Drawing.Point(180, 40);
- this.trackBar6.Maximum = 0;
- this.trackBar6.Name = "trackBar6";
- this.trackBar6.Size = new System.Drawing.Size(87, 25);
- this.trackBar6.TabIndex = 17;
- this.trackBar6.TickStyle = System.Windows.Forms.TickStyle.None;
- //
- // trackBar5
- //
- this.trackBar5.AutoSize = false;
- this.trackBar5.Location = new System.Drawing.Point(88, 40);
- this.trackBar5.Maximum = 0;
- this.trackBar5.Name = "trackBar5";
- this.trackBar5.Size = new System.Drawing.Size(87, 25);
- this.trackBar5.TabIndex = 16;
- this.trackBar5.TickStyle = System.Windows.Forms.TickStyle.None;
- //
- // numericUpDown7
- //
- this.numericUpDown7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.numericUpDown7.Location = new System.Drawing.Point(277, 39);
- this.numericUpDown7.Maximum = new decimal(new int[] {
- 0,
- 0,
- 0,
- 0});
- this.numericUpDown7.Name = "numericUpDown7";
- this.numericUpDown7.Size = new System.Drawing.Size(46, 21);
- this.numericUpDown7.TabIndex = 15;
- //
- // numericUpDown6
- //
- this.numericUpDown6.Location = new System.Drawing.Point(35, 39);
- this.numericUpDown6.Maximum = new decimal(new int[] {
- 0,
- 0,
- 0,
- 0});
- this.numericUpDown6.Name = "numericUpDown6";
- this.numericUpDown6.Size = new System.Drawing.Size(48, 21);
- this.numericUpDown6.TabIndex = 14;
- //
- // label5
- //
- this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.label5.AutoEllipsis = true;
- this.label5.Location = new System.Drawing.Point(325, 41);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(30, 16);
- this.label5.TabIndex = 11;
- //
- // label4
- //
- this.label4.AutoEllipsis = true;
- this.label4.Location = new System.Drawing.Point(3, 41);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(30, 16);
- this.label4.TabIndex = 10;
- //
- // groupBox9
- //
- this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox9.Controls.Add(this.dataGridView3);
- this.groupBox9.Controls.Add(this.button1);
- this.groupBox9.Controls.Add(this.label10);
- this.groupBox9.Controls.Add(this.label9);
- this.groupBox9.Controls.Add(this.numericUpDown1);
- this.groupBox9.Controls.Add(this.label8);
- this.groupBox9.Controls.Add(this.button9);
- this.groupBox9.Controls.Add(this.button8);
- this.groupBox9.Controls.Add(this.dataGridView2);
- this.groupBox9.Controls.Add(this.listView2);
- this.groupBox9.Controls.Add(this.button7);
- this.groupBox9.Controls.Add(this.button6);
- this.groupBox9.Location = new System.Drawing.Point(13, 759);
- this.groupBox9.Name = "groupBox9";
- this.groupBox9.Size = new System.Drawing.Size(1306, 204);
- this.groupBox9.TabIndex = 34;
- this.groupBox9.TabStop = false;
- //
- // dataGridView3
- //
- this.dataGridView3.AllowUserToAddRows = false;
- this.dataGridView3.AllowUserToDeleteRows = false;
- this.dataGridView3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.dataGridView3.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView3.BackgroundColor = System.Drawing.Color.White;
- this.dataGridView3.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
- this.dataGridView3.Location = new System.Drawing.Point(202, 122);
- this.dataGridView3.MultiSelect = false;
- this.dataGridView3.Name = "dataGridView3";
- this.dataGridView3.RowHeadersVisible = false;
- this.dataGridView3.RowTemplate.Height = 23;
- this.dataGridView3.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView3.Size = new System.Drawing.Size(950, 76);
- this.dataGridView3.TabIndex = 11;
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button1.AutoEllipsis = true;
- this.button1.Location = new System.Drawing.Point(1167, 108);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(128, 26);
- this.button1.TabIndex = 10;
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // label10
- //
- this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.label10.AutoSize = true;
- this.label10.ForeColor = System.Drawing.SystemColors.ScrollBar;
- this.label10.Location = new System.Drawing.Point(1152, 9);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(11, 192);
- this.label10.TabIndex = 9;
- this.label10.Text = "|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|";
- //
- // label9
- //
- this.label9.AutoSize = true;
- this.label9.ForeColor = System.Drawing.SystemColors.ScrollBar;
- this.label9.Location = new System.Drawing.Point(191, 9);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(11, 192);
- this.label9.TabIndex = 8;
- this.label9.Text = "|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|";
- //
- // numericUpDown1
- //
- this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.numericUpDown1.Location = new System.Drawing.Point(1219, 162);
- this.numericUpDown1.Maximum = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(70, 21);
- this.numericUpDown1.TabIndex = 7;
- this.numericUpDown1.Value = new decimal(new int[] {
- 2,
- 0,
- 0,
- 0});
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
- //
- // label8
- //
- this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.label8.AutoEllipsis = true;
- this.label8.Location = new System.Drawing.Point(1180, 167);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(35, 16);
- this.label8.TabIndex = 6;
- //
- // button9
- //
- this.button9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button9.AutoEllipsis = true;
- this.button9.Location = new System.Drawing.Point(1167, 71);
- this.button9.Name = "button9";
- this.button9.Size = new System.Drawing.Size(128, 26);
- this.button9.TabIndex = 5;
- this.button9.UseVisualStyleBackColor = true;
- this.button9.Click += new System.EventHandler(this.button9_Click);
- //
- // button8
- //
- this.button8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button8.AutoEllipsis = true;
- this.button8.Location = new System.Drawing.Point(1167, 34);
- this.button8.Name = "button8";
- this.button8.Size = new System.Drawing.Size(128, 26);
- this.button8.TabIndex = 4;
- this.button8.UseVisualStyleBackColor = true;
- this.button8.Click += new System.EventHandler(this.button8_Click);
- //
- // dataGridView2
- //
- this.dataGridView2.AllowUserToAddRows = false;
- this.dataGridView2.AllowUserToDeleteRows = false;
- this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView2.BackgroundColor = System.Drawing.Color.White;
- this.dataGridView2.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
- this.dataGridView2.Location = new System.Drawing.Point(202, 14);
- this.dataGridView2.MultiSelect = false;
- this.dataGridView2.Name = "dataGridView2";
- this.dataGridView2.RowHeadersVisible = false;
- this.dataGridView2.RowTemplate.Height = 23;
- this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView2.Size = new System.Drawing.Size(950, 102);
- this.dataGridView2.TabIndex = 3;
- //
- // listView2
- //
- this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.listView2.HideSelection = false;
- this.listView2.Location = new System.Drawing.Point(7, 54);
- this.listView2.Name = "listView2";
- this.listView2.Size = new System.Drawing.Size(181, 140);
- this.listView2.TabIndex = 2;
- this.listView2.UseCompatibleStateImageBehavior = false;
- this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
- //
- // button7
- //
- this.button7.AutoEllipsis = true;
- this.button7.Location = new System.Drawing.Point(136, 18);
- this.button7.Name = "button7";
- this.button7.Size = new System.Drawing.Size(52, 26);
- this.button7.TabIndex = 1;
- this.button7.UseVisualStyleBackColor = true;
- this.button7.Click += new System.EventHandler(this.button7_Click);
- //
- // button6
- //
- this.button6.AutoEllipsis = true;
- this.button6.Location = new System.Drawing.Point(7, 18);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(93, 26);
- this.button6.TabIndex = 0;
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // groupBox8
- //
- this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox8.Controls.Add(this.dataGridView1);
- this.groupBox8.Location = new System.Drawing.Point(154, 579);
- this.groupBox8.Name = "groupBox8";
- this.groupBox8.Size = new System.Drawing.Size(356, 174);
- this.groupBox8.TabIndex = 33;
- this.groupBox8.TabStop = false;
- //
- // dataGridView1
- //
- this.dataGridView1.AllowUserToAddRows = false;
- this.dataGridView1.AllowUserToDeleteRows = false;
- this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
- this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
- this.dataGridView1.Location = new System.Drawing.Point(7, 21);
- this.dataGridView1.MultiSelect = false;
- this.dataGridView1.Name = "dataGridView1";
- this.dataGridView1.RowHeadersVisible = false;
- this.dataGridView1.RowTemplate.Height = 23;
- this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView1.Size = new System.Drawing.Size(345, 147);
- this.dataGridView1.TabIndex = 0;
- //
- // groupBox6
- //
- this.groupBox6.Controls.Add(this.checkBox6);
- this.groupBox6.Controls.Add(this.btnDisplay);
- this.groupBox6.Controls.Add(this.btnColour);
- this.groupBox6.Controls.Add(this.checkBox5);
- this.groupBox6.Controls.Add(this.checkBox4);
- this.groupBox6.Location = new System.Drawing.Point(154, 416);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(357, 87);
- this.groupBox6.TabIndex = 32;
- this.groupBox6.TabStop = false;
- //
- // checkBox6
- //
- this.checkBox6.AutoEllipsis = true;
- this.checkBox6.Location = new System.Drawing.Point(18, 17);
- this.checkBox6.Name = "checkBox6";
- this.checkBox6.Size = new System.Drawing.Size(230, 16);
- this.checkBox6.TabIndex = 11;
- this.checkBox6.UseVisualStyleBackColor = true;
- this.checkBox6.CheckedChanged += new System.EventHandler(this.checkBox6_CheckedChanged);
- //
- // btnDisplay
- //
- this.btnDisplay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnDisplay.AutoEllipsis = true;
- this.btnDisplay.Location = new System.Drawing.Point(250, 55);
- this.btnDisplay.Name = "btnDisplay";
- this.btnDisplay.Size = new System.Drawing.Size(85, 26);
- this.btnDisplay.TabIndex = 10;
- this.btnDisplay.UseVisualStyleBackColor = true;
- this.btnDisplay.Click += new System.EventHandler(this.btnDisplay_Click);
- //
- // btnColour
- //
- this.btnColour.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnColour.AutoEllipsis = true;
- this.btnColour.Location = new System.Drawing.Point(260, 29);
- this.btnColour.Name = "btnColour";
- this.btnColour.Size = new System.Drawing.Size(75, 23);
- this.btnColour.TabIndex = 9;
- this.btnColour.UseVisualStyleBackColor = true;
- this.btnColour.Click += new System.EventHandler(this.btnColour_Click);
- //
- // checkBox5
- //
- this.checkBox5.AutoEllipsis = true;
- this.checkBox5.Location = new System.Drawing.Point(18, 63);
- this.checkBox5.Name = "checkBox5";
- this.checkBox5.Size = new System.Drawing.Size(220, 16);
- this.checkBox5.TabIndex = 8;
- this.checkBox5.UseVisualStyleBackColor = true;
- this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
- //
- // checkBox4
- //
- this.checkBox4.AutoEllipsis = true;
- this.checkBox4.Location = new System.Drawing.Point(18, 40);
- this.checkBox4.Name = "checkBox4";
- this.checkBox4.Size = new System.Drawing.Size(230, 16);
- this.checkBox4.TabIndex = 7;
- this.checkBox4.UseVisualStyleBackColor = true;
- this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
- //
- // groupBox3
- //
- this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox3.Location = new System.Drawing.Point(517, 68);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(802, 685);
- this.groupBox3.TabIndex = 31;
- this.groupBox3.TabStop = false;
- //
- // groupBox2
- //
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox2.Controls.Add(this.listView1);
- this.groupBox2.Location = new System.Drawing.Point(13, 58);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(135, 696);
- this.groupBox2.TabIndex = 30;
- this.groupBox2.TabStop = false;
- //
- // listView1
- //
- this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.listView1.HideSelection = false;
- this.listView1.LargeImageList = this.imageList1;
- this.listView1.Location = new System.Drawing.Point(5, 17);
- this.listView1.MultiSelect = false;
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(124, 673);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
- //
- // imageList1
- //
- this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- //
- // groupBox1
- //
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox1.Controls.Add(this.button2);
- this.groupBox1.Controls.Add(this.checkBox1);
- this.groupBox1.Controls.Add(this.btnSetUp);
- this.groupBox1.Location = new System.Drawing.Point(13, 4);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(1306, 50);
- this.groupBox1.TabIndex = 29;
- this.groupBox1.TabStop = false;
- //
- // button2
- //
- this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.button2.AutoEllipsis = true;
- this.button2.Location = new System.Drawing.Point(1184, 14);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(84, 30);
- this.button2.TabIndex = 2;
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // checkBox1
- //
- this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.checkBox1.AutoEllipsis = true;
- this.checkBox1.Location = new System.Drawing.Point(141, 21);
- this.checkBox1.Name = "checkBox1";
- this.checkBox1.Size = new System.Drawing.Size(140, 16);
- this.checkBox1.TabIndex = 1;
- this.checkBox1.UseVisualStyleBackColor = true;
- //
- // btnSetUp
- //
- this.btnSetUp.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.btnSetUp.AutoEllipsis = true;
- this.btnSetUp.Location = new System.Drawing.Point(15, 14);
- this.btnSetUp.Name = "btnSetUp";
- this.btnSetUp.Size = new System.Drawing.Size(84, 30);
- this.btnSetUp.TabIndex = 0;
- this.btnSetUp.UseVisualStyleBackColor = true;
- this.btnSetUp.Click += new System.EventHandler(this.btnSetUp_Click);
- //
- // groupBox5
- //
- this.groupBox5.Controls.Add(this.trackBar4);
- this.groupBox5.Controls.Add(this.trackBar2);
- this.groupBox5.Controls.Add(this.numericUpDown5);
- this.groupBox5.Controls.Add(this.numericUpDown4);
- this.groupBox5.Controls.Add(this.label3);
- this.groupBox5.Controls.Add(this.checkBox3);
- this.groupBox5.Location = new System.Drawing.Point(154, 348);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(356, 65);
- this.groupBox5.TabIndex = 37;
- this.groupBox5.TabStop = false;
- //
- // trackBar4
- //
- this.trackBar4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.trackBar4.AutoSize = false;
- this.trackBar4.Location = new System.Drawing.Point(180, 33);
- this.trackBar4.Maximum = 0;
- this.trackBar4.Name = "trackBar4";
- this.trackBar4.Size = new System.Drawing.Size(87, 25);
- this.trackBar4.TabIndex = 15;
- this.trackBar4.TickStyle = System.Windows.Forms.TickStyle.None;
- //
- // trackBar2
- //
- this.trackBar2.AutoSize = false;
- this.trackBar2.Location = new System.Drawing.Point(91, 32);
- this.trackBar2.Maximum = 0;
- this.trackBar2.Name = "trackBar2";
- this.trackBar2.Size = new System.Drawing.Size(87, 25);
- this.trackBar2.TabIndex = 14;
- this.trackBar2.TickStyle = System.Windows.Forms.TickStyle.None;
- //
- // numericUpDown5
- //
- this.numericUpDown5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.numericUpDown5.Location = new System.Drawing.Point(278, 33);
- this.numericUpDown5.Maximum = new decimal(new int[] {
- 0,
- 0,
- 0,
- 0});
- this.numericUpDown5.Name = "numericUpDown5";
- this.numericUpDown5.Size = new System.Drawing.Size(62, 21);
- this.numericUpDown5.TabIndex = 12;
- //
- // numericUpDown4
- //
- this.numericUpDown4.Location = new System.Drawing.Point(27, 33);
- this.numericUpDown4.Maximum = new decimal(new int[] {
- 0,
- 0,
- 0,
- 0});
- this.numericUpDown4.Name = "numericUpDown4";
- this.numericUpDown4.Size = new System.Drawing.Size(62, 21);
- this.numericUpDown4.TabIndex = 10;
- //
- // label3
- //
- this.label3.AutoEllipsis = true;
- this.label3.Location = new System.Drawing.Point(9, 67);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(50, 12);
- this.label3.TabIndex = 9;
- //
- // checkBox3
- //
- this.checkBox3.AutoEllipsis = true;
- this.checkBox3.Location = new System.Drawing.Point(18, 14);
- this.checkBox3.Name = "checkBox3";
- this.checkBox3.Size = new System.Drawing.Size(100, 16);
- this.checkBox3.TabIndex = 0;
- this.checkBox3.UseVisualStyleBackColor = true;
- this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
- //
- // OrganizationLevelDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1332, 967);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox7);
- this.Controls.Add(this.groupBox9);
- this.Controls.Add(this.groupBox8);
- this.Controls.Add(this.groupBox6);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Name = "OrganizationLevelDialog";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InclusionsStandardDialog_FormClosing);
- this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData);
- this.Load += new System.EventHandler(this.GrainSizeDialog_Load);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox3, 0);
- this.Controls.SetChildIndex(this.groupBox6, 0);
- this.Controls.SetChildIndex(this.groupBox8, 0);
- this.Controls.SetChildIndex(this.groupBox9, 0);
- this.Controls.SetChildIndex(this.groupBox7, 0);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.groupBox7.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.trackBar6)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar5)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).EndInit();
- this.groupBox9.ResumeLayout(false);
- this.groupBox9.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
- this.groupBox8.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
- this.groupBox6.ResumeLayout(false);
- this.groupBox2.ResumeLayout(false);
- this.groupBox1.ResumeLayout(false);
- this.groupBox5.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- private PaintDotNet.CustomControl.BinaryControl bc;
- private System.Windows.Forms.GroupBox groupBox7;
- private System.Windows.Forms.TrackBar trackBar6;
- private System.Windows.Forms.TrackBar trackBar5;
- private System.Windows.Forms.NumericUpDown numericUpDown7;
- private System.Windows.Forms.NumericUpDown numericUpDown6;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.GroupBox groupBox9;
- private System.Windows.Forms.DataGridView dataGridView3;
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.Label label10;
- private System.Windows.Forms.Label label9;
- private System.Windows.Forms.NumericUpDown numericUpDown1;
- private System.Windows.Forms.Label label8;
- private System.Windows.Forms.Button button9;
- private System.Windows.Forms.Button button8;
- private System.Windows.Forms.DataGridView dataGridView2;
- private System.Windows.Forms.ListView listView2;
- private System.Windows.Forms.Button button7;
- private System.Windows.Forms.Button button6;
- private System.Windows.Forms.GroupBox groupBox8;
- private System.Windows.Forms.DataGridView dataGridView1;
- private System.Windows.Forms.GroupBox groupBox6;
- private System.Windows.Forms.CheckBox checkBox6;
- private System.Windows.Forms.Button btnDisplay;
- private System.Windows.Forms.Button btnColour;
- public System.Windows.Forms.CheckBox checkBox5;
- public System.Windows.Forms.CheckBox checkBox4;
- private System.Windows.Forms.GroupBox groupBox3;
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.ListView listView1;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.Button button2;
- private System.Windows.Forms.CheckBox checkBox1;
- private System.Windows.Forms.Button btnSetUp;
- private System.Windows.Forms.ImageList imageList1;
- private System.Windows.Forms.GroupBox groupBox5;
- private System.Windows.Forms.TrackBar trackBar4;
- private System.Windows.Forms.TrackBar trackBar2;
- private System.Windows.Forms.NumericUpDown numericUpDown5;
- private System.Windows.Forms.NumericUpDown numericUpDown4;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.CheckBox checkBox3;
- #endregion
- public static OrganizationLevelDialog organizationLevelDialog;
- /// <summary>
- /// 调色板
- /// </summary>
- PaintDotNet.ColorsForm colorsForm1;
- PaintDotNet.ColorsForm colorsForm2;
- /// <summary>
- /// 主控件
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 图像面板
- /// </summary>
- public DocumentWorkspaceWindow documentWorkspace;
- /// <summary>
- /// 公共按钮
- /// </summary>
- private CommonControlButtons commonControlButtons;
- /// <summary>
- /// 选中图片的mat
- /// </summary>
- private Mat imageMat;
- /// <summary>
- /// 计算结果的表格集合
- /// </summary>
- private List<DataTable> resultTableList = new List<DataTable>();
- /// <summary>
- /// 保存用于生成报告的图片
- /// </summary>
- private List<Bitmap> bitList;
- /// <summary>
- /// 储存点击保存结果后的所有原图与分析图
- /// </summary>
- private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
- /// <summary>
- /// 是否显示全部
- /// </summary>
- private bool showAll = false;
- /// <summary>
- /// 当前图片是否有视场
- /// </summary>
- private bool isHadView = false;
- /// <summary>
- /// 二值处理后的mat
- /// </summary>
- private Mat binarizationMat;
- /// <summary>
- /// 面积率为0.8-1的mat
- /// </summary>
- private Mat binarizationMat08_1;
- /// <summary>
- /// 面积率为0.6-0.8的mat
- /// </summary>
- private Mat binarizationMat06_08;
- /// <summary>
- /// 面积率为0.4-0.6的mat
- /// </summary>
- private Mat binarizationMat04_06;
- /// <summary>
- /// 面积率为0.2-0.4的mat
- /// </summary>
- private Mat binarizationMat02_04;
- /// <summary>
- /// 面积率为0.1-0.2的mat
- /// </summary>
- private Mat binarizationMat01_02;
- /// <summary>
- /// 面积率为0-0.1的mat
- /// </summary>
- private Mat binarizationMat0_01;
- /// <summary>
- /// 相的集合
- /// </summary>
- private PhaseModel phaseModel;
- /// <summary>
- /// 相的集合
- /// </summary>
- private PhaseModel phaseModel08_1;
- /// <summary>
- /// 相的集合
- /// </summary>
- private PhaseModel phaseModel06_08;
- /// <summary>
- /// 相的集合
- /// </summary>
- private PhaseModel phaseModel04_06;
- /// <summary>
- /// 相的集合
- /// </summary>
- private PhaseModel phaseModel02_04;
- /// <summary>
- /// 相的集合
- /// </summary>
- private PhaseModel phaseModel01_02;
- /// <summary>
- /// 相的集合
- /// </summary>
- private PhaseModel phaseModel0_01;
- /// <summary>
- /// 单位标尺
- /// </summary>
- private double unitLength = 1;
- /// <summary>
- /// 放大倍数
- /// </summary>
- private double multiple = 1;
- /// <summary>
- /// 坐标集合
- /// </summary>
- private List<OpenCvSharp.Point> pointList = new List<OpenCvSharp.Point>();
- /// <summary>
- /// 绘制点
- /// </summary>
- private List<double> leList = new List<double>();
- /// <summary>
- /// 最大点碳化物点集合
- /// </summary>
- private List<List<OpenCvSharp.Point>> maxPoint;
- /// <summary>
- /// 面积率0.8_1碳化物点集合
- /// </summary>
- private List<List<OpenCvSharp.Point>> lstPoint08_1;
- /// <summary>
- /// 面积率0.6_0.8化物点集合
- /// </summary>
- private List<List<OpenCvSharp.Point>> lstPoint06_08;
- /// <summary>
- /// 面积率0.4_0.6化物点集合
- /// </summary>
- private List<List<OpenCvSharp.Point>> lstPoint04_06;
- /// <summary>
- /// 面积率0.2_0.4化物点集合
- /// </summary>
- private List<List<OpenCvSharp.Point>> lstPoint02_04;
- /// <summary>
- /// 面积率0.1_0.2化物点集合
- /// </summary>
- private List<List<OpenCvSharp.Point>> lstPoint01_02;
- /// <summary>
- /// 面积率0_0.1化物点集合
- /// </summary>
- private List<List<OpenCvSharp.Point>> lstPoint0_01;
- /// <summary>
- /// 钨系A标准
- /// </summary>
- private double[] tungstenA = new double[] { 18, 21, 23, 25 };
- /// <summary>
- /// 钨系B标准
- /// </summary>
- private double[] tungstenB = new double[] { 16, 18, 21, 23 };
- /// <summary>
- /// 钼系标准
- /// </summary>
- private double[] molybdenum = new double[] { 6.1, 8.3, 12.5, 15.6, 22.1 };
- /// <summary>
- /// 面积率
- /// </summary>
- private double areaRatio = 0;
- /// <summary>
- /// 面积率最大值
- /// </summary>
- double maxAreaRatio = 0;
- /// <summary>
- /// 面积率最小值
- /// </summary>
- double minAreaRatio = 100;
- /// <summary>
- /// 单视场球化率
- /// </summary>
- double spheroidizationRate = 0;
- /// <summary>
- /// 石墨含量
- /// </summary>
- double spheroidizationAreaRate = 0;
- /// <summary>
- /// 存储面积率颜色字典
- /// </summary>
- public Dictionary<string, Color> colour = new Dictionary<string, Color>();
- // <summary>
- /// 存储字号与颜色字典
- /// </summary>
- public Dictionary<string, Color> colourFont = new Dictionary<string, Color>();
- /// <summary>
- /// 碳化物尺寸最大值
- /// </summary>
- private double maxSize = 0;
- /// <summary>
- /// 是否仅修改相的颜色
- /// </summary>
- private bool changeColor = false;
- /// <summary>
- /// 是否未对图片做其他操作
- /// </summary>
- private bool isFirstSwitch = false;
- /// <summary>
- /// 中间数据
- /// </summary>
- private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
- private bool needChange = true;
- private int defaultIndex = -1;
- /// <summary>
- /// 是否脚本运行
- /// </summary>
- private Boolean initScriptValues = false;
- /// <summary>
- /// 保存窗口参数
- /// </summary>
- private GrainSizeAnalysisModel analysisModel;
- private const string ParamKey_Report = "report";//报告设置
- private const string ParamKey_Screen = "screen";//筛选
- private const string ParamKey_ScreenMin = "screenMin";//面积最小值
- private const string ParamKey_ScreenMax = "screenMax";//面积最大值
- private const string ParamKey_Diameter = "diameter";//直径小于20um不参与计算
- private const string ParamKey_Colour = "colour";//显示不同级别颜色
- private const string ParamKey_AreaRatio = "areaRatio";//显示面积率
- private const string ParamKey_AreaRatioRange = "areaRatioRange";//面积率区间
- private const string ParamKey_AreaRatioRangeMin = "areaRatioRangeMin";//面积率区间最小值
- private const string ParamKey_AreaRatioRangeMax = "areaRatioRangeMax";//面积率区间最大值
- private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数
- private const string ParamKey_panelColour1_08 = "panelColour1_08";//不同区间颜色
- private const string ParamKey_panelColour08_06 = "panelColour08_06";//不同区间颜色
- private const string ParamKey_panelColour06_04 = "panelColour06_04";//不同区间颜色
- private const string ParamKey_panelColour04_02 = "panelColour04_02";//不同区间颜色
- private const string ParamKey_panelColour02_01 = "panelColour02_01";//不同区间颜色
- private const string ParamKey_panelColour01_0 = "panelColour01_0";//不同区间颜色
- private const string ParamKey_FontSize = "fontSize";//字体大小
- private const string ParamKey_FontColour = "fontColour";//字体颜色
- private decimal areaRatioRangeMin = -1;
- private decimal areaRatioRangeMax = -1;
- private decimal areaMin = -1;//面积区间最小
- private decimal areaMax = -1;//面积区间最大
- private string fontSize = "12";
- private Color fontColour = Color.Black;
- #region 二值化相关
- /// <summary>
- /// 调色板
- /// </summary>
- private ColorsForm colorsFormGrid;
- private CheckBox checkBox2;
- private ToolTip toolTip1;
- //二值化集成1
- BinaryClass binaryClass;
- private int menuId;
- private string menuName;
- #endregion
- public OrganizationLevelDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem)
- {
- this.menuId = menuItem.MenuId;
- this.menuName = menuItem.Text;
- binaryClass = new BinaryClass(menuId);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- this.analysisModel = analysisModelXml.cloneListParamModel(this.menuId);
- foreach (var item in this.analysisModel.ListParam)
- item.setValue();
- organizationLevelDialog = this;
- this.appWorkspace = appWorkspace;
- InitializeComponent();
- InitializeLanguageText();
- InitColour();
- InitPicList();
- InitOtherTools();
- //如果是脚本执行,将参数带入
- if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
- {
- this.initScriptValues = true;//ScriptAutomatic
- //Boolean initScriptValues = true;
- ////在这里反射出对应功能的参数类
- string className = InvariantData.path_Action + ".Action" + menuId;
- ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
- foreach (Args arg in param.Lists)
- {
- Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
- if (param1.value != null)
- arg.Value = param1.value;
- getValue(arg.key, arg.Value);
- }
- appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
- }
- else
- {//读取上次关闭窗口时保存的参数
- GetListParamModel();
- }
- InitCommonButtonEvent();
- InitGridHeader();
- SetAnalyzeModelFromXml("Template.Manager.item3.DeterminationGBT11354Level");
- }
- private void ShowImgEvent(object sender, EventArgs e)
- {
- listView1.Focus();
- if (this.defaultIndex != -1)
- {
- this.listView1.Items[defaultIndex].Focused = true;
- this.listView1.Items[defaultIndex].Selected = true;
- }
- }
- /// <summary>
- /// 初始化面积率颜色、字号颜色
- /// </summary>
- private void InitColour()
- {
- colour.Add("panelColour1_08", Color.Orange);
- colour.Add("panelColour08_06", Color.Blue);
- colour.Add("panelColour06_04", Color.Green);
- colour.Add("panelColour04_02", Color.Pink);
- colour.Add("panelColour02_01", Color.Violet);
- colour.Add("panelColour01_0", Color.Yellow);
- colourFont.Add("10", Color.Black);
- }
- /// <summary>
- /// 初始化表头
- /// </summary>
- private void InitGridHeader()
- {
- //
- //结果展示表
- //
- this.dataGridView1.ColumnHeadersHeight = 30;
- DataGridViewTextBoxColumn h1 = new DataGridViewTextBoxColumn();
- h1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h1.Width = 95;
- DataGridViewTextBoxColumn h2 = new DataGridViewTextBoxColumn();
- h2.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h2.Width = 95;
- DataGridViewTextBoxColumn h3 = new DataGridViewTextBoxColumn();
- h3.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h3.Width = 95;
- DataGridViewTextBoxColumn h4 = new DataGridViewTextBoxColumn();
- h4.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h4.Width = 95;
- DataGridViewTextBoxColumn h5 = new DataGridViewTextBoxColumn();
- h5.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h5.Width = 95;
- DataGridViewTextBoxColumn h6 = new DataGridViewTextBoxColumn();
- h6.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h6.Width = 95;
- DataGridViewTextBoxColumn h7 = new DataGridViewTextBoxColumn();
- h7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h7.Width = 95;
- DataGridViewTextBoxColumn h8 = new DataGridViewTextBoxColumn();
- h8.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h8.Width = 95;
- DataGridViewTextBoxColumn h9 = new DataGridViewTextBoxColumn();
- h9.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h9.Width = 95;
- this.dataGridView1.Columns.Add(h1);
- this.dataGridView1.Columns.Add(h2);
- this.dataGridView1.Columns.Add(h3);
- this.dataGridView1.Columns.Add(h4);
- this.dataGridView1.Columns.Add(h5);
- this.dataGridView1.Columns.Add(h6);
- this.dataGridView1.Columns.Add(h7);
- this.dataGridView1.Columns.Add(h8);
- this.dataGridView1.Columns.Add(h9);
- DataGridViewHelper helper = new DataGridViewHelper(this.dataGridView1);
- helper.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.view.text")));
- helper.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, "1-0.8"));
- helper.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, "0.8-0.6"));
- helper.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, "0.6-0.4"));
- helper.Headers.Add(new DataGridViewHelper.TopHeader(4, 1, "0.4-0.2"));
- helper.Headers.Add(new DataGridViewHelper.TopHeader(5, 1, "0.2-0.1"));
- helper.Headers.Add(new DataGridViewHelper.TopHeader(6, 1, "0.1-0"));
- helper.Headers.Add(new DataGridViewHelper.TopHeader(7, 1, PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)"));
- helper.Headers.Add(new DataGridViewHelper.TopHeader(8, 1, PdnResources.GetString("Menu.Levelname.text")));
- this.dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[0].ReadOnly = true;
- this.dataGridView1.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;//文字居中
- this.dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[1].ReadOnly = true;
- this.dataGridView1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[2].ReadOnly = true;
- this.dataGridView1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[3].ReadOnly = true;
- this.dataGridView1.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[4].ReadOnly = true;
- this.dataGridView1.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[5].ReadOnly = true;
- this.dataGridView1.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[6].ReadOnly = true;
- this.dataGridView1.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[7].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[7].ReadOnly = true;
- this.dataGridView1.Columns[7].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[8].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[8].ReadOnly = true;
- this.dataGridView1.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.AllowUserToResizeRows = false;
- this.dataGridView1.AllowUserToResizeColumns = false;
- //
- //分析结果表
- //
- this.dataGridView2.ColumnHeadersHeight = 30;
- DataGridViewTextBoxColumn h11 = new DataGridViewTextBoxColumn();
- //h11.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h11.Width = 115;
- DataGridViewTextBoxColumn h12 = new DataGridViewTextBoxColumn();
- //h12.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h12.Width = 115;
- DataGridViewTextBoxColumn h13 = new DataGridViewTextBoxColumn();
- //h13.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h13.Width = 115;
- DataGridViewTextBoxColumn h14 = new DataGridViewTextBoxColumn();
- //h14.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h14.Width = 115;
- DataGridViewTextBoxColumn h15 = new DataGridViewTextBoxColumn();
- //h15.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h15.Width = 115;
- DataGridViewTextBoxColumn h16 = new DataGridViewTextBoxColumn();
- //h16.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h16.Width = 115;
- DataGridViewTextBoxColumn h17 = new DataGridViewTextBoxColumn();
- //h17.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h17.Width = 115;
- DataGridViewTextBoxColumn h18 = new DataGridViewTextBoxColumn();
- //h18.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h18.Width = 115;
- DataGridViewTextBoxColumn h19 = new DataGridViewTextBoxColumn();
- //h19.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h19.Width = 115;
- DataGridViewTextBoxColumn h20 = new DataGridViewTextBoxColumn();
- //h20.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h20.Width = 115;
- this.dataGridView2.Columns.Add(h11);
- this.dataGridView2.Columns.Add(h12);
- this.dataGridView2.Columns.Add(h13);
- this.dataGridView2.Columns.Add(h14);
- this.dataGridView2.Columns.Add(h15);
- this.dataGridView2.Columns.Add(h16);
- this.dataGridView2.Columns.Add(h17);
- this.dataGridView2.Columns.Add(h18);
- this.dataGridView2.Columns.Add(h19);
- this.dataGridView2.Columns.Add(h20);
- DataGridViewHelper helper2 = new DataGridViewHelper(this.dataGridView2);
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.picture.Text")));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.view.text")));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, "1-0.8"));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, "0.8-0.6"));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(4, 1, "0.6-0.4"));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(5, 1, "0.4-0.2"));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(6, 1, "0.2-0.1"));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(7, 1, "0.1-0"));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(8, 1, PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)"));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(9, 1, PdnResources.GetString("Menu.Levelname.text")));
- this.dataGridView2.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[0].ReadOnly = true;
- this.dataGridView2.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[1].ReadOnly = true;
- this.dataGridView2.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[2].ReadOnly = true;
- this.dataGridView2.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[3].ReadOnly = true;
- this.dataGridView2.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[4].ReadOnly = true;
- this.dataGridView2.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[5].ReadOnly = true;
- this.dataGridView2.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[6].ReadOnly = true;
- this.dataGridView2.Columns[7].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[7].ReadOnly = true;
- this.dataGridView2.Columns[8].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[8].ReadOnly = true;
- this.dataGridView2.Columns[9].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[9].ReadOnly = true;
- this.dataGridView2.AllowUserToResizeRows = false;
- this.dataGridView2.AllowUserToResizeColumns = false;
- this.dataGridView3.ColumnHeadersHeight = 30;
- DataGridViewTextBoxColumn h22 = new DataGridViewTextBoxColumn();
- //h22.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h22.Width = 115;
- DataGridViewTextBoxColumn h23 = new DataGridViewTextBoxColumn();
- //h23.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h23.Width = 115;
- DataGridViewTextBoxColumn h24 = new DataGridViewTextBoxColumn();
- //h24.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h24.Width = 115;
- DataGridViewTextBoxColumn h25 = new DataGridViewTextBoxColumn();
- //h25.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h25.Width = 115;
- DataGridViewTextBoxColumn h26 = new DataGridViewTextBoxColumn();
- //h26.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h26.Width = 115;
- DataGridViewTextBoxColumn h27 = new DataGridViewTextBoxColumn();
- //h27.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h27.Width = 115;
- DataGridViewTextBoxColumn h28 = new DataGridViewTextBoxColumn();
- //h28.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h28.Width = 115;
- DataGridViewTextBoxColumn h29 = new DataGridViewTextBoxColumn();
- //h29.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h29.Width = 115;
- DataGridViewTextBoxColumn h30 = new DataGridViewTextBoxColumn();
- //h30.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h30.Width = 115;
- DataGridViewTextBoxColumn h31 = new DataGridViewTextBoxColumn();
- //h31.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h31.Width = 115;
- this.dataGridView3.Columns.Add(h22);
- this.dataGridView3.Columns.Add(h23);
- this.dataGridView3.Columns.Add(h24);
- this.dataGridView3.Columns.Add(h25);
- this.dataGridView3.Columns.Add(h26);
- this.dataGridView3.Columns.Add(h27);
- this.dataGridView3.Columns.Add(h28);
- this.dataGridView3.Columns.Add(h29);
- this.dataGridView3.Columns.Add(h30);
- this.dataGridView3.Columns.Add(h31);
- DataGridViewHelper helper3 = new DataGridViewHelper(this.dataGridView3);
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.picture.Text")));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.view.text")));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, "1-0.8"));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, "0.8-0.6"));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(4, 1, "0.6-0.4"));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(5, 1, "0.4-0.2"));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(6, 1, "0.2-0.1"));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(7, 1, "0.1-0"));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(8, 1, PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)"));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(9, 1, PdnResources.GetString("Menu.Levelname.text")));
- this.dataGridView3.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[0].ReadOnly = true;
- this.dataGridView3.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[1].ReadOnly = true;
- this.dataGridView3.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[2].ReadOnly = true;
- this.dataGridView3.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[3].ReadOnly = true;
- this.dataGridView3.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[4].ReadOnly = true;
- this.dataGridView3.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[5].ReadOnly = true;
- this.dataGridView3.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[6].ReadOnly = true;
- this.dataGridView3.Columns[7].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[7].ReadOnly = true;
- this.dataGridView3.Columns[8].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[8].ReadOnly = true;
- this.dataGridView3.Columns[9].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView3.Columns[9].ReadOnly = true;
- this.dataGridView3.AllowUserToResizeRows = false;
- this.dataGridView3.AllowUserToResizeColumns = false;
- //
- //左下表
- //
- this.listView2.View = View.Details;
- ColumnHeader header0 = new ColumnHeader();
- header0.Text = PdnResources.GetString("Menu.Imagelist.Text");
- header0.Width = 175;
- this.listView2.Columns.Add(header0);
- }
- /// <summary>
- /// 初始化画布按键功能
- /// </summary>
- private void InitCommonButtonEvent()
- {
- this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
- this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
- this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
- this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
- this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
- this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
- }
- private void zoomInButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomIn();
- }
- private void zoomOutButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomOut();
- }
- private void zoomToWindowButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
- }
- private void actualSizeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
- this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
- }
- private void pointerButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
- }
- private void mobileModeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = DrawToolType.MoveMode;
- }
- /// <summary>
- /// 调色板回调函数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ce"></param>
- private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
- {
- }
- /// <summary>
- /// 初始化其他控件
- /// </summary>
- private void InitOtherTools()
- {
- //
- //初始化图像控件
- //
- this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
- this.documentWorkspace.Dock = DockStyle.Fill;
- this.documentWorkspace.HookMouseEvents();
- this.documentWorkspace.AuxiliaryLineEnabled = false;
- this.documentWorkspace.Visible = false;
- this.documentWorkspace.ActiveTool = DrawToolType.NullTool;
- this.groupBox3.Controls.Add(documentWorkspace);
- //
- //初始化操作按钮
- //
- this.commonControlButtons = new CommonControlButtons();
- this.commonControlButtons.Dock = DockStyle.Top;
- this.commonControlButtons.Height = 30;
- this.commonControlButtons.HideZoomToWindowAndActualSize();
- this.commonControlButtons.Visible = false;
- this.groupBox3.Controls.Add(commonControlButtons);
- //二值化集成2
- bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
- binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text"), PdnResources.GetString("Menu.Particlescreening.text")}
- , this.bc, this.appWorkspace, this.documentWorkspace, this.listView1);//初始化相的工作结构
- binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
- //
- //调色板
- //
- //this.colorsForm1 = new ColorsForm();
- //this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
- //this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
- //
- //调色板
- //
- this.colorsForm1 = new ColorsForm();
- this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
- this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
- this.colorsFormGrid = new ColorsForm();
- this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
- this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
- //
- //颜色panel给定初始值
- //
- //this.panel1.BackColor = Color.Red;
- //获取系统标尺-微米
- //
- //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength);
- //
- //获取系统标尺-放大倍数
- //
- if (this.documentWorkspace.GetGainMultiple() != 0)
- {
- multiple = double.Parse(this.documentWorkspace.GetGainMultiple().ToString());
- }
- }
- //二值化集成3
- #region 二值化相关方法
- private void InclusionsStandardDialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- #region [开启脚本录制]
- if (appWorkspace.startScriptRecording)
- {
- getScriptRecording();
- }
- #endregion
- this.saveDialogParamValues();
- binaryClass.saveParams();
- //xml保存路径
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- foreach (var analysisItem in this.analysisModel.ListParam)
- {
- bool foundItem = false;
- foreach (var item in analysisModelXml.ListParam)
- {
- if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
- {
- item.param_value = analysisItem.param_value;
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- analysisModelXml.ListParam.Add(analysisItem.cloneModel());
- }
- //按路径和名称保存xml文件
- string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
- //保存xml
- FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
- }
- private void ShownChoiseItemAndInitData(object sender, EventArgs e)
- {
- binaryClass.RefreshHistogramControl1Values();
- }
- /// <summary>
- /// 添加参数改变的监听
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void GrainSizeDialog_Load(object sender, EventArgs e)
- {
- this.binaryClass.loadParams();
- }
- private bool bcBinaryChecked()
- {
- return bc != null && bc.BinaryChecked;
- }
- private bool bcOriginChecked()
- {
- return bc != null && bc.OriginChecked;
- }
- /// <summary>
- /// Panel2的调色板颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void gridColorChanged(object sender, EventArgs e)
- {
- this.colorsForm1.Close();
- changeColor = true;
- //ReLoadBinarization();
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 参数改变时,重新处理图像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bClassBinaryImplFinishAction(object sender, EventArgs e)
- {
- if (phaseModel != null)
- {
- sum++;
- this.documentWorkspace.PhaseModels[0].choise = false;
- if (bcBinaryChecked())
- {
- if (bcOriginChecked())
- {
- phaseModel.choise = false;
- }
- else
- {
- phaseModel.choise = true;
- }
- binarizationMat = this.documentWorkspace.PhaseModels[0].mat;
- //changeColor = false;
- ResetAreaAndContent();
- ReloadDebrisSelection();
- //appCommonDisplay.DisplayData(this.dataGridView1, true);
- }
- else
- {
- phaseModel.choise = false;
- if (this.checkBox5.Checked)
- {
- this.documentWorkspace.panel.Paint -= new PaintEventHandler(this.BoxPaintHandler);
- }
- appCommonDisplay.DisplayData(this.dataGridView1, false);
- }
- this.documentWorkspace.Refresh();
- }
- else
- {
- //MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- }
- }
- AppCommon appCommonDisplay = new AppCommon();
- /// <summary>
- /// 显示原图/原图+二值图
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bcOriginCheckedChanged(object sender, EventArgs e)
- {
- if (phaseModel != null)
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- if (!bcBinaryChecked())
- {
- phaseModel.choise = false;
- appCommonDisplay.DisplayData(this.dataGridView1, false);
- }
- else
- {
- if (bcOriginChecked())
- {
- phaseModel.choise = false;
- if (this.checkBox5.Checked)
- {
- this.documentWorkspace.panel.Paint -= new PaintEventHandler(this.BoxPaintHandler);
- }
- appCommonDisplay.DisplayData(this.dataGridView1, false);
- }
- else
- {
- phaseModel.choise = true;
- if (this.checkBox5.Checked)
- {
- this.documentWorkspace.panel.Paint += new PaintEventHandler(this.BoxPaintHandler);
- }
- appCommonDisplay.DisplayData(this.dataGridView1, true);
- }
- }
- this.documentWorkspace.Refresh();
- }
- else
- {
- //MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- }
- }
- #endregion
- /// <summary>
- /// 初始化图片列表数据
- /// </summary>
- public void InitPicList()
- {
- //初始化图片列表
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- {
- this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
- this.listView1.Items.Add("", i);
- this.listView1.Items[i].ImageIndex = i;
- this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
- {
- defaultIndex = i;
- }
- }
- this.Shown += ShowImgEvent;
- }
- /// <summary>
- /// 颜色设置设置按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnColour_Click(object sender, EventArgs e)
- {
- ColorSetting colorSetting = new ColorSetting();
- colorSetting.ShowDialog();
- }
- /// <summary>
- /// 显示参数设置按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnDisplay_Click(object sender, EventArgs e)
- {
- DisplaySetting displaySetting = new DisplaySetting();
- displaySetting.ShowDialog();
- }
- /// <summary>
- /// 设置按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSetUp_Click(object sender, EventArgs e)
- {
- AnalyzeSettingDialog metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.DeterminationGBT11354Level");
- if (metallographicMethodSetDialog.hasModule)
- {
- metallographicMethodSetDialog.StartPosition = FormStartPosition.CenterScreen;
- metallographicMethodSetDialog.ShowDialog();
- }
- else
- {
- metallographicMethodSetDialog = null;
- }
- }
- /// <summary>
- /// 图像索引切换选中事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- double picArea = 0;//图片面积
- int sum;//判断是否二值过
- private void listView1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
- {
- unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
- sum = 0;
- if (this.checkBox5.Checked)
- {
- this.documentWorkspace.panel.Paint -= new PaintEventHandler(this.BoxPaintHandler);
- }
- this.dataGridView1.Rows.Clear();
- this.documentWorkspace.PhaseModels.Clear();
- this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList;
- this.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
- //总面积
- picArea = AnalysisTools.GetPointsFromMat(this.imageMat.Clone());
- changeColor = false;
- phaseModel = new PhaseModel();//同上
- phaseModel.choise = true;
- //二值化集成4
- binaryClass.listView1_SelectedIndexChanged(this.imageMat.Clone(), this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]);
- //binaryClass.listView1_SelectedIndexChanged(this.bitmap, this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]);
- //binaryClass.listView1_SelectedIndexChangedNoCheckedChanged(this.bitmap);
- this.documentWorkspace.PhaseModels[0].choise = false;
- if (binaryClass.getModelMat(this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]) != null)
- {
- this.binarizationMat = binaryClass.getModelMat(this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]).Clone();
- }
- else
- {
- if (this.documentWorkspace.PhaseModels[0].mat == null)
- {
- this.binarizationMat = new Mat();
- }
- else
- {
- this.binarizationMat = this.documentWorkspace.PhaseModels[0].mat.Clone();
- }
- }
- this.documentWorkspace.phaseModels.Add(phaseModel);
- if (sum == 0)
- {
- if (bcOriginChecked())
- {
- phaseModel.choise = false;
- }
- ResetAreaAndContent();
- ReloadDebrisSelection();
- }
- else
- {
- if (bcOriginChecked())
- {
- phaseModel.choise = false;
- }
- else
- {
- phaseModel.choise = true;
- }
- this.documentWorkspace.Refresh();
- }
- sum = 0;
- ////总面积
- //picArea = AnalysisTools.GetPointsFromMat(this.imageMat.Clone());
- //changeColor = false;
- }
- }
- Mat temp;//中间变量
- List<List<OpenCvSharp.Point>> ps;//轮廓的拓扑信息
- List<double> lstEqualDiameter;
- DataTable dtDataGridView1 = null;
- DataTable dtResult = null;
- AppCommon appCommon;
- List<double> lstCarbideArea;//组织分级面积集合
- List<double> lstCarbideAreaRatio;//组织分级面积率集合
- /// <summary>
- /// 刷新颗粒筛选颜色面积率效果
- /// </summary>
- private void ReloadDebrisSelection()
- {
- if (binarizationMat != null && bcBinaryChecked())
- {
- this.dataGridView1.Rows.Clear();
- appCommon = new AppCommon();
- dtDataGridView1 = new DataTable();
- //记录条件范围内石墨
- lstPoint08_1 = new List<List<OpenCvSharp.Point>>();
- lstPoint06_08 = new List<List<OpenCvSharp.Point>>();
- lstPoint04_06 = new List<List<OpenCvSharp.Point>>();
- lstPoint02_04 = new List<List<OpenCvSharp.Point>>();
- lstPoint01_02 = new List<List<OpenCvSharp.Point>>();
- lstPoint0_01 = new List<List<OpenCvSharp.Point>>();
- //记录上个视场内石墨个数
- int prevLstPoint08_1 = 0;
- int prevLstPoint06_08 = 0;
- int prevLstPoint04_06 = 0;
- int prevLstPoint02_04 = 0;
- int prevLstPoint01_02 = 0;
- int prevLstPoint0_01 = 0;
- //记录视场珠光体含量总和
- double carbideNumSum = 0;
- double sumSpheroidizationAreaRate = 0;//石墨含量总和
- lstEqualDiameter = new List<double>();//大于20um等积圆直径集合
- lstCarbideArea = new List<double>();//组织分级面积集合
- lstCarbideAreaRatio = new List<double>();//组织分级面积率集合
- ps = new List<List<OpenCvSharp.Point>>();//轮廓的拓扑信息
- pointList.Clear();
- leList.Clear();
- temp = new Mat();
-
- if (this.documentWorkspace.GraphicsList.IsExsitView())
- {
- List<OpenCvSharp.Point[][]> points = new List<OpenCvSharp.Point[][]>();//各石墨轮廓集合
- List<List<int>> lstAttribute = new List<List<int>>();//各个视场属性集合,索引0-横坐标,1-纵坐标,2-视场宽度,3-视场高度,4-视场面积
- int sumFieldl = 0; //视场个数
- Mat tempCopy = BinaryClass.BGRA2GRAY(binarizationMat);
- //调用处理视场方法
- appCommon.MultiFieldView(appWorkspace, binarizationMat, listView1, documentWorkspace, out points, out lstAttribute, out sumFieldl);
- int h = 0;
- foreach (OpenCvSharp.Point[][] contours in points)
- {
- h++;
- double spheroidizationSum = 0;//石墨个数
- double totalSum = 0;//石墨总数
- double totalAreaSum = 0;//面积总数
- double screenArea = 0;//筛选的面积
- //Mat tempCopy;
- Rect rectCopy;
- for (int i = 0; i < contours.Length; i++)
- {
- for (int f = 0; f < contours[i].Length; f++)
- {
- contours[i][f].X = contours[i][f].X + lstAttribute[h - 1][0];
- contours[i][f].Y = contours[i][f].Y + lstAttribute[h - 1][1];
- }
- double radius; //外接圆半径
- //tempCopy = BinaryClass.BGRA2GRAY(binarizationMat);
- int length = Cv2.FloodFill(tempCopy, contours[i][0], new Scalar(0, 0, 0, 0), out rectCopy, null, null, FloodFillFlags.Link8);
- double area = length;
- double equalDiameter = Math.Sqrt(area / Math.PI) * 2 * unitLength;
- if (this.checkBox3.Checked)
- {
- if (this.checkBox6.Checked)
- {
- if (equalDiameter < 20)
- {
- ps.Add(contours[i].ToList());
- continue;
- }
- if (area >= (this.trackBar2.Value / (unitLength * unitLength)) && area <= (this.trackBar4.Value / (unitLength * unitLength)))
- {
- ps.Add(contours[i].ToList());
- }
- else
- {
- if (contours[i].Length < 5)
- {
- continue;
- }
- else
- {
- OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
- double outerCircle = radius * radius * Math.PI;//外接圆面积
- double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
- if (areaRatio > 0 && areaRatio <= 1)
- {
- totalAreaSum += area;
- totalSum++;
- lstEqualDiameter.Add(equalDiameter);
- if (this.checkBox2.Checked)
- {
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- spheroidizationSum++;
- screenArea += area;
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- pointList.Add(contours[i][0]);
- leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
- areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
- if (areaRatio > 0.8 && areaRatio <= 1)
- {
- lstPoint08_1.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.6 && areaRatio <= 0.8)
- {
- lstPoint06_08.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.4 && areaRatio <= 0.6)
- {
- lstPoint04_06.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.2 && areaRatio <= 0.4)
- {
- lstPoint02_04.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.1 && areaRatio <= 0.2)
- {
- lstPoint01_02.Add(contours[i].ToList());
- }
- else if (areaRatio > 0 && areaRatio <= 0.1)
- {
- lstPoint0_01.Add(contours[i].ToList());
- }
- }
- else
- {
- ps.Add(contours[i].ToList());
- }
- }
- }
- }
- else
- {
- if (area >= (this.trackBar2.Value / (unitLength * unitLength)) && area <= (this.trackBar4.Value / (unitLength * unitLength)))
- {
- ps.Add(contours[i].ToList());
- }
- else
- {
- if (contours[i].Length < 5)
- {
- continue;
- }
- else
- {
- OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
- double outerCircle = radius * radius * Math.PI;//外接圆面积
- double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
- if (areaRatio > 0 && areaRatio <= 1)
- {
- lstEqualDiameter.Add(equalDiameter);
- totalAreaSum += area;
- totalSum++;
- if (this.checkBox2.Checked)
- {
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- spheroidizationSum++;
- screenArea += area;
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- pointList.Add(contours[i][0]);
- leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
- areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
- if (areaRatio > 0.8 && areaRatio <= 1)
- {
- lstPoint08_1.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.6 && areaRatio <= 0.8)
- {
- lstPoint06_08.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.4 && areaRatio <= 0.6)
- {
- lstPoint04_06.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.2 && areaRatio <= 0.4)
- {
- lstPoint02_04.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.1 && areaRatio <= 0.2)
- {
- lstPoint01_02.Add(contours[i].ToList());
- }
- else if (areaRatio > 0 && areaRatio <= 0.1)
- {
- lstPoint0_01.Add(contours[i].ToList());
- }
- }
- else
- {
- ps.Add(contours[i].ToList());
- }
- }
- }
- }
- }
- else
- {
- if (this.checkBox6.Checked)
- {
- if (equalDiameter < 20)
- {
- ps.Add(contours[i].ToList());
- }
- }
- if (contours[i].Length < 5)
- continue;
- else
- {
- if (this.checkBox6.Checked)
- {
- //if (equalDiameter < 20)
- //{
- // ps.Add(contours[i].ToList());
- //}
- if (equalDiameter >= 20)
- {
- OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
- double outerCircle = radius * radius * Math.PI;//外接圆面积
- double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
- if (areaRatio > 0 && areaRatio <= 1)
- {
- lstEqualDiameter.Add(equalDiameter);
- totalAreaSum += area;
- totalSum++;
- if (this.checkBox2.Checked)
- {
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- spheroidizationSum++;
- screenArea += area;
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- pointList.Add(contours[i][0]);
- leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
- areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
- if (areaRatio > 0.8 && areaRatio <= 1)
- {
- lstPoint08_1.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.6 && areaRatio <= 0.8)
- {
- lstPoint06_08.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.4 && areaRatio <= 0.6)
- {
- lstPoint04_06.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.2 && areaRatio <= 0.4)
- {
- lstPoint02_04.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.1 && areaRatio <= 0.2)
- {
- lstPoint01_02.Add(contours[i].ToList());
- }
- else if (areaRatio > 0 && areaRatio <= 0.1)
- {
- lstPoint0_01.Add(contours[i].ToList());
- }
- }
- else
- {
- ps.Add(contours[i].ToList());
- }
- }
- }
- else
- {
- OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
- double outerCircle = radius * radius * Math.PI;//外接圆面积
- double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
- if (areaRatio > 0 && areaRatio <= 1)
- {
- lstEqualDiameter.Add(equalDiameter);
- totalAreaSum += area;
- totalSum++;
- if (this.checkBox2.Checked)
- {
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- spheroidizationSum++;
- screenArea += area;
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- pointList.Add(contours[i][0]);
- leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
- areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
- if (areaRatio > 0.8 && areaRatio <= 1)
- {
- lstPoint08_1.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.6 && areaRatio <= 0.8)
- {
- lstPoint06_08.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.4 && areaRatio <= 0.6)
- {
- lstPoint04_06.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.2 && areaRatio <= 0.4)
- {
- lstPoint02_04.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.1 && areaRatio <= 0.2)
- {
- lstPoint01_02.Add(contours[i].ToList());
- }
- else if (areaRatio > 0 && areaRatio <= 0.1)
- {
- lstPoint0_01.Add(contours[i].ToList());
- }
- }
- else
- {
- ps.Add(contours[i].ToList());
- }
- }
- }
- }
- }
- if (pointList.Count > 0)
- {
- //spheroidizationRate = spheroidizationSum / totalSum;//球化率
- //spheroidizationAreaRate = totalAreaSum / lstAttribute[h - 1][4];//石墨含量
- string level = string.Empty; //组织级别
- double carbideNum = (totalAreaSum - screenArea) / (lstAttribute[h - 1][4] - screenArea); //组织级别数量
- if (carbideNum < 0.01)
- {
- level = "1";
- }
- else if (carbideNum >= 0.01 && carbideNum < 0.05)
- {
- level = "2";
- }
- else if (carbideNum >= 0.05 && carbideNum < 0.15)
- {
- level = "3";
- }
- else if (carbideNum >= 0.15 && carbideNum < 0.25)
- {
- level = "4";
- }
- else if (carbideNum >= 0.25)
- {
- level = "5";
- }
- else
- {
- level = "-";
- }
- this.dataGridView1.Rows.Add($"{PdnResources.GetString("Menu.view.text")}{h}", lstPoint08_1.Count - prevLstPoint08_1, lstPoint06_08.Count - prevLstPoint06_08, lstPoint04_06.Count - prevLstPoint04_06, lstPoint02_04.Count - prevLstPoint02_04, lstPoint01_02.Count - prevLstPoint01_02, lstPoint0_01.Count - prevLstPoint0_01, carbideNum * 100, level);
- carbideNumSum += carbideNum;
- //sumSpheroidizationAreaRate += spheroidizationAreaRate;//石墨含量总和
- prevLstPoint08_1 = lstPoint08_1.Count;
- prevLstPoint06_08 = lstPoint06_08.Count;
- prevLstPoint04_06 = lstPoint04_06.Count;
- prevLstPoint02_04 = lstPoint02_04.Count;
- prevLstPoint01_02 = lstPoint01_02.Count;
- prevLstPoint0_01 = lstPoint0_01.Count;
- }
- }
- if (sumFieldl > 1 && pointList.Count > 0)
- {
- string avgLevel = string.Empty;
- double avgCarbideNum = carbideNumSum / sumFieldl;
- if (avgCarbideNum < 0.01)
- {
- avgLevel = "1";
- }
- else if (avgCarbideNum >= 0.01 && avgCarbideNum < 0.05)
- {
- avgLevel = "2";
- }
- else if (avgCarbideNum >= 0.05 && avgCarbideNum < 0.15)
- {
- avgLevel = "3";
- }
- else if (avgCarbideNum >= 0.15 && avgCarbideNum < 0.25)
- {
- avgLevel = "4";
- }
- else if (avgCarbideNum >= 0.25)
- {
- avgLevel = "5";
- }
- else
- {
- avgLevel = "-";
- }
- this.dataGridView1.Rows.Add(PdnResources.GetString("Menu.Image.Average.Text"), (double)prevLstPoint08_1 / sumFieldl, (double)prevLstPoint06_08 / sumFieldl, (double)prevLstPoint04_06 / sumFieldl, (double)prevLstPoint02_04 / sumFieldl, (double)prevLstPoint01_02 / sumFieldl, (double)prevLstPoint0_01 / sumFieldl, 100 * avgCarbideNum, avgLevel);
- }
- }
- else
- {
- OpenCvSharp.Point[][] contours;//原始轮廓信息
- HierarchyIndex[] hierachy;
- Mat tempCopy = BinaryClass.BGRA2GRAY(binarizationMat);
- Rect rectCopy;
- Cv2.FindContours(BinaryClass.BGRA2GRAY(binarizationMat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone);
- double spheroidizationSum = 0;//石墨个数
- double totalSum = 0;//石墨总数
- double totalAreaSum = 0;//面积总数
- double screenArea = 0;
- for (int i = 0; i < hierachy.Length; i++)
- {
- if (hierachy[i].Parent == -1)
- {
- double radius; //外接圆半径
- //tempCopy = BinaryClass.BGRA2GRAY(binarizationMat);
- //int length = Cv2.FloodFill(temp1234, contours[i][0], new Scalar(0, 0, 0) );
- //int length = Cv2.FloodFill(tempCopy, contours[i][0], new Scalar(0, 0, 0, 0), out rectCopy, null, null, FloodFillFlags.Link8);
- double area = appCommon.Area(tempCopy, contours[i][0]);
- double equalDiameter = Math.Sqrt(area / Math.PI) * 2 * unitLength;
- if (this.checkBox3.Checked)
- {
- if (this.checkBox6.Checked)
- {
- if (equalDiameter < 20)
- {
- ps.Add(contours[i].ToList());
- continue;
- }
- if (area >= (this.trackBar2.Value / (unitLength * unitLength)) && area <= (this.trackBar4.Value / (unitLength * unitLength)))
- {
- ps.Add(contours[i].ToList());
- }
- else
- {
- if (contours[i].Length < 5)
- {
- continue;
- }
- else
- {
- OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
- double outerCircle = radius * radius * Math.PI;//外接圆面积
- double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
- if (areaRatio > 0 && areaRatio <= 1)
- {
- totalAreaSum += area;
- totalSum++;
- lstEqualDiameter.Add(equalDiameter);
- if (this.checkBox2.Checked)
- {
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- spheroidizationSum++;
- screenArea += area;
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- pointList.Add(contours[i][0]);
- leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
- areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
- if (areaRatio > 0.8 && areaRatio <= 1)
- {
- lstPoint08_1.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.6 && areaRatio <= 0.8)
- {
- lstPoint06_08.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.4 && areaRatio <= 0.6)
- {
- lstPoint04_06.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.2 && areaRatio <= 0.4)
- {
- lstPoint02_04.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.1 && areaRatio <= 0.2)
- {
- lstPoint01_02.Add(contours[i].ToList());
- }
- else if (areaRatio > 0 && areaRatio <= 0.1)
- {
- lstPoint0_01.Add(contours[i].ToList());
- }
- }
- else
- {
- ps.Add(contours[i].ToList());
- }
- }
- }
- }
- else
- {
- if (area >= (this.trackBar2.Value / (unitLength * unitLength)) && area <= (this.trackBar4.Value / (unitLength * unitLength)))
- {
- ps.Add(contours[i].ToList());
- }
- else
- {
- if (contours[i].Length < 5)
- {
- continue;
- }
- else
- {
- OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
- double outerCircle = radius * radius * Math.PI;//外接圆面积
- double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
- if (areaRatio > 0 && areaRatio <= 1)
- {
- lstEqualDiameter.Add(equalDiameter);
- totalAreaSum += area;
- totalSum++;
- if (this.checkBox2.Checked)
- {
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- spheroidizationSum++;
- screenArea += area;
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- pointList.Add(contours[i][0]);
- leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
- areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
- if (areaRatio > 0.8 && areaRatio <= 1)
- {
- lstPoint08_1.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.6 && areaRatio <= 0.8)
- {
- lstPoint06_08.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.4 && areaRatio <= 0.6)
- {
- lstPoint04_06.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.2 && areaRatio <= 0.4)
- {
- lstPoint02_04.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.1 && areaRatio <= 0.2)
- {
- lstPoint01_02.Add(contours[i].ToList());
- }
- else if (areaRatio > 0 && areaRatio <= 0.1)
- {
- lstPoint0_01.Add(contours[i].ToList());
- }
- }
- else
- {
- ps.Add(contours[i].ToList());
- }
- }
- }
- }
- }
- else
- {
- if (this.checkBox6.Checked)
- {
- if (equalDiameter < 20)
- {
- ps.Add(contours[i].ToList());
- }
- }
- if (contours[i].Length < 5)
- continue;
- else
- {
- if (this.checkBox6.Checked)
- {
- //if (equalDiameter < 20)
- //{
- // ps.Add(contours[i].ToList());
- //}
- if (equalDiameter >= 20)
- {
- OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
- double outerCircle = radius * radius * Math.PI;//外接圆面积
- double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
- if (areaRatio > 0 && areaRatio <= 1)
- {
- lstEqualDiameter.Add(equalDiameter);
- totalAreaSum += area;
- totalSum++;
- if (this.checkBox2.Checked)
- {
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- spheroidizationSum++;
- screenArea += area;
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- pointList.Add(contours[i][0]);
- leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
- areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
- if (areaRatio > 0.8 && areaRatio <= 1)
- {
- lstPoint08_1.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.6 && areaRatio <= 0.8)
- {
- lstPoint06_08.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.4 && areaRatio <= 0.6)
- {
- lstPoint04_06.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.2 && areaRatio <= 0.4)
- {
- lstPoint02_04.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.1 && areaRatio <= 0.2)
- {
- lstPoint01_02.Add(contours[i].ToList());
- }
- else if (areaRatio > 0 && areaRatio <= 0.1)
- {
- lstPoint0_01.Add(contours[i].ToList());
- }
- }
- else
- {
- ps.Add(contours[i].ToList());
- }
- }
- }
- else
- {
- //OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
- radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
- double outerCircle = radius * radius * Math.PI;//外接圆面积
- double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
- if (areaRatio > 0 && areaRatio <= 1)
- {
- lstEqualDiameter.Add(equalDiameter);
- totalAreaSum += area;
- totalSum++;
- if (this.checkBox2.Checked)
- {
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- spheroidizationSum++;
- screenArea += area;
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- }
- else
- {
- lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
- lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
- }
- pointList.Add(contours[i][0]);
- leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
- areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
- if (areaRatio > 0.8 && areaRatio <= 1)
- {
- lstPoint08_1.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.6 && areaRatio <= 0.8)
- {
- lstPoint06_08.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.4 && areaRatio <= 0.6)
- {
- lstPoint04_06.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.2 && areaRatio <= 0.4)
- {
- lstPoint02_04.Add(contours[i].ToList());
- }
- else if (areaRatio > 0.1 && areaRatio <= 0.2)
- {
- lstPoint01_02.Add(contours[i].ToList());
- }
- else if (areaRatio > 0 && areaRatio <= 0.1)
- {
- lstPoint0_01.Add(contours[i].ToList());
- }
- }
- else
- {
- ps.Add(contours[i].ToList());
- }
- }
- }
- }
- }
- }
- //spheroidizationRate = spheroidizationSum / totalSum;//球化率
- //spheroidizationAreaRate = totalAreaSum / picArea;//石墨含量
- string level = string.Empty; //球化级别
- double carbideNum = (totalAreaSum - screenArea) / (picArea - screenArea); //组织级别数量
- if (carbideNum < 0.01)
- {
- level = "1";
- }
- else if (carbideNum >= 0.01 && carbideNum < 0.05)
- {
- level = "2";
- }
- else if (carbideNum >= 0.05 && carbideNum < 0.15)
- {
- level = "3";
- }
- else if (carbideNum >= 0.15 && carbideNum < 0.25)
- {
- level = "4";
- }
- else if (carbideNum >= 0.25)
- {
- level = "5";
- }
- else
- {
- level = "-";
- }
- if (pointList.Count > 0)
- {
- this.dataGridView1.Rows.Add(PdnResources.GetString("Menu.view.text")+"1", lstPoint08_1.Count - prevLstPoint08_1, lstPoint06_08.Count - prevLstPoint06_08, lstPoint04_06.Count - prevLstPoint04_06, lstPoint02_04.Count - prevLstPoint02_04, lstPoint01_02.Count - prevLstPoint01_02, lstPoint0_01.Count - prevLstPoint0_01, carbideNum * 100, level);
- }
- }
- binarizationMat.CopyTo(temp);
- if (checkBox4.Checked)
- {
- DisplayColor();
- }
- if (checkBox5.Checked && !bcOriginChecked())
- {
- AddPictureBoxEvent();
- }
- Cv2.FillPoly(temp, ps, new Scalar(0, 0, 0, 0)); //筛选颜色
- phaseModel.mat = temp;
- //RefreshDataGridView1();
- this.documentWorkspace.Refresh();
- //数据结果保存
- dtDataGridView1 = appCommon.ResultDataSaving(dataGridView1);
- string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
- string tag = this.imageList1.Images.Keys[this.listView1.FocusedItem.Index];
- //dtResult = new DataTable(tag);
- //分析数据保存
- dtResult = appCommon.AnalysisDataSaving(dataGridView1, imgName, tag);
- if (dtDataGridView1.Rows.Count > 0)
- {
- RefreshDataGridView1();
- }
- if (bcOriginChecked())
- {
- appCommonDisplay.DisplayData(this.dataGridView1, false);
- }
- }
- }
- /// <summary>
- /// 显示不同颜色方法
- /// </summary>
- public void DisplayColor()
- {
- //填充颜色
- if (this.checkBox4.Checked)
- {
- Mat[] arr = temp.Split();
- temp = temp.CvtColor(ColorConversionCodes.BGRA2BGR);
- appCommon.DifferentColor(temp, lstPoint08_1, colour, "panelColour1_08");
- appCommon.DifferentColor(temp, lstPoint06_08, colour, "panelColour08_06");
- appCommon.DifferentColor(temp, lstPoint04_06, colour, "panelColour06_04");
- appCommon.DifferentColor(temp, lstPoint02_04, colour, "panelColour04_02");
- appCommon.DifferentColor(temp, lstPoint01_02, colour, "panelColour02_01");
- appCommon.DifferentColor(temp, lstPoint0_01, colour, "panelColour01_0");
- Mat[] arr2 = temp.Split();
- arr[0] = arr2[0];
- arr[1] = arr2[1];
- arr[2] = arr2[2];
- Cv2.Merge(arr, temp);
- phaseModel.mat = temp;
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 添加内容单元格
- /// </summary>
- /// <param name="text"></param>
- /// <param name="tag"></param>
- /// <returns></returns>
- private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag)
- {
- DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
- textboxcell.Value = text;
- textboxcell.Tag = tag;
- return textboxcell;
- }
- /// <summary>
- /// 刷新其他信息
- /// </summary>
- private void ResetAreaAndContent()
- {
- if (binarizationMat != null && bcBinaryChecked())
- {
- OpenCvSharp.Point[][] contours;//原始轮廓信息
- HierarchyIndex[] hierachy;
- //Mat temp = new Mat();
- //binarizationMat.CopyTo(temp);
- Cv2.FindContours(BinaryClass.BGRA2GRAY(binarizationMat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone);
- if (hierachy.Length > 0)
- {
- double maxArea = 0;//面积最大值
- double minArea = 9999999999;//面积最小值
- double maxAreaRatio = 0;//面积率最大值
- double minAreaRatio = 100;//面积率最小值
- double radius = 0;//外接圆半径
- Mat tempCopy;
- Rect rectCopy;
- for (int i = 0; i < hierachy.Length; i++)
- {
- if (hierachy[i].Parent == -1)
- {
- tempCopy = BinaryClass.BGRA2GRAY(binarizationMat);
- int length = Cv2.FloodFill(tempCopy, contours[i][0], new Scalar(0, 0, 0, 0), out rectCopy, null, null, FloodFillFlags.Link8);
- double area = length;
- if (maxArea < area)
- maxArea = area;
- if (minArea > area)
- minArea = area;
- if (contours[i].Length < 5)
- continue;
- else
- {
- radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
- double outerCircle = radius * radius * Math.PI;//外接圆面积
- double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
- if (areaRatio >= 0 && areaRatio <= 1)
- {
- if (maxAreaRatio < areaRatio * 100)
- maxAreaRatio = areaRatio * 100;
- if (minAreaRatio > areaRatio * 100)
- minAreaRatio = areaRatio * 100;
- }
- }
- }
- }
- //phaseModel.mat = temp;
- if (!changeColor)
- {
- maxArea = maxArea * unitLength * unitLength;
- minArea = minArea * unitLength * unitLength;
- //maxAreaRatio = maxAreaRatio;
- //minAreaRatio = minAreaRatio;
- int maxNum = (int)Math.Ceiling(maxArea);//获取面积最大值
- int minNum = (int)Math.Floor(minArea);//获取面积最小值
- int maxNumRatio = (int)Math.Ceiling(maxAreaRatio);//获取面积率最大值
- int minNumRatio = (int)Math.Floor(minAreaRatio);//获取面积率最小值
- //先解绑事件以防数据赋值异常
- this.numericUpDown4.ValueChanged -= numericUpDown4_ValueChanged;
- this.numericUpDown5.ValueChanged -= numericUpDown5_ValueChanged;
- this.numericUpDown6.ValueChanged -= numericUpDown6_ValueChanged;
- this.numericUpDown7.ValueChanged -= numericUpDown7_ValueChanged;
- this.trackBar2.Scroll -= trackBar2_Scroll;
- this.trackBar4.Scroll -= trackBar4_Scroll;
- this.trackBar5.Scroll -= trackBar5_Scroll;
- this.trackBar6.Scroll -= trackBar6_Scroll;
- this.numericUpDown4.Maximum = maxNum;
- this.numericUpDown4.Minimum = minNum;
- this.trackBar2.Maximum = maxNum;
- this.trackBar2.Minimum = minNum;
- this.numericUpDown5.Maximum = maxNum;
- this.numericUpDown5.Minimum = minNum;
- this.trackBar4.Maximum = maxNum;
- this.trackBar4.Minimum = minNum;
- this.numericUpDown4.Value = minNum;
- this.trackBar2.Value = minNum;
- this.numericUpDown5.Value = maxNum;
- this.trackBar4.Value = maxNum;
- if (maxNumRatio != 0 || minNumRatio != 100)
- {
- this.numericUpDown6.Maximum = maxNumRatio;
- this.numericUpDown6.Minimum = minNumRatio;
- this.trackBar5.Maximum = maxNumRatio;
- this.trackBar5.Minimum = minNumRatio;
- this.numericUpDown7.Maximum = maxNumRatio;
- this.numericUpDown7.Minimum = minNumRatio;
- this.trackBar6.Maximum = maxNumRatio;
- this.trackBar6.Minimum = minNumRatio;
- if (maxNumRatio > 60 && minNumRatio < 60)
- {
- this.trackBar5.Value = 60;
- this.numericUpDown6.Value = 60;
- }
- this.numericUpDown7.Value = maxNumRatio;
- this.trackBar6.Value = maxNumRatio;
- }
- if (areaRatioRangeMin != -1 && areaRatioRangeMin >= this.numericUpDown6.Minimum && areaRatioRangeMin <= this.numericUpDown7.Maximum)
- {
- trackBar5.Value = (int)areaRatioRangeMin;
- this.numericUpDown6.Value = areaRatioRangeMin;
- }
- if (areaRatioRangeMax != -1 && areaRatioRangeMax >= this.numericUpDown6.Value && areaRatioRangeMax <= this.numericUpDown7.Maximum)
- {
- trackBar6.Value = (int)areaRatioRangeMax;
- this.numericUpDown7.Value = areaRatioRangeMax;
- }
- if (areaMin != -1 && areaMin >= this.numericUpDown4.Minimum && areaMin <= this.numericUpDown5.Maximum)
- {
- trackBar2.Value = (int)areaMin;
- this.numericUpDown4.Value = areaMin;
- }
- if (areaMax != -1 && areaMax >= this.numericUpDown4.Value && areaMax <= this.numericUpDown5.Maximum)
- {
- trackBar4.Value = (int)areaMax;
- this.numericUpDown5.Value = areaMax;
- }
- this.numericUpDown4.ValueChanged += new EventHandler(numericUpDown4_ValueChanged);
- this.numericUpDown5.ValueChanged += new EventHandler(numericUpDown5_ValueChanged);
- this.numericUpDown6.ValueChanged += new EventHandler(numericUpDown6_ValueChanged);
- this.numericUpDown7.ValueChanged += new EventHandler(numericUpDown7_ValueChanged);
- this.trackBar2.Scroll += new EventHandler(trackBar2_Scroll);
- this.trackBar4.Scroll += new EventHandler(trackBar4_Scroll);
- this.trackBar5.Scroll += new EventHandler(trackBar5_Scroll);
- this.trackBar6.Scroll += new EventHandler(trackBar6_Scroll);
- //RefreshDataGridView1();
- }
- }
- else
- {
- this.trackBar2.Maximum = 0;
- this.trackBar2.Minimum = 0;
- this.trackBar4.Maximum = 0;
- this.trackBar4.Minimum = 0;
- this.trackBar5.Maximum = 0;
- this.trackBar5.Minimum = 0;
- this.trackBar6.Maximum = 0;
- this.trackBar6.Minimum = 0;
- this.numericUpDown4.Maximum = 0;
- this.numericUpDown4.Minimum = 0;
- this.numericUpDown5.Maximum = 0;
- this.numericUpDown5.Minimum = 0;
- this.numericUpDown6.Maximum = 0;
- this.numericUpDown6.Minimum = 0;
- this.numericUpDown7.Maximum = 0;
- this.numericUpDown7.Minimum = 0;
- }
- }
- }
- /// <summary>
- /// 小数数字框值改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- if (this.numericUpDown1.Value > this.numericUpDown1.Maximum)
- this.numericUpDown1.Value = this.numericUpDown1.Maximum;
- if (this.numericUpDown1.Value < this.numericUpDown1.Minimum)
- this.numericUpDown1.Value = this.numericUpDown1.Minimum;
- RefreshDataGridView1();
- RefreshDataGridView2();
- ReloadDebrisSelection();
- }
- /// <summary>
- /// 是否筛选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox3_CheckedChanged(object sender, EventArgs e)
- {
- if (this.documentWorkspace == null || this.documentWorkspace.CompositionSurface == null)
- return;
- ResetAreaAndContent();
- ReloadDebrisSelection();
- }
- /// <summary>
- /// 颗粒筛选范围最小值
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown4_ValueChanged(object sender, EventArgs e)
- {
- if (this.numericUpDown4.Value > this.numericUpDown5.Value)
- this.numericUpDown4.Value = this.numericUpDown5.Value;
- this.trackBar2.Value = Convert.ToInt32(this.numericUpDown4.Value);
- areaMin = this.numericUpDown4.Value;
- areaMax = this.numericUpDown5.Value;
- //二值判断
- if (this.checkBox3.Checked && bcBinaryChecked() && !this.checkBox4.Checked)
- {
- ReloadDebrisSelection();
- }
- if (this.checkBox3.Checked && bcBinaryChecked() && this.checkBox4.Checked)
- {
- ReloadDebrisSelection();
- }
- }
- /// <summary>
- /// 颗粒筛选范围最大值
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown5_ValueChanged(object sender, EventArgs e)
- {
- if (this.numericUpDown5.Value < this.numericUpDown4.Value)
- this.numericUpDown5.Value = this.numericUpDown4.Value;
- this.trackBar4.Value = Convert.ToInt32(this.numericUpDown5.Value);
- areaMin = this.numericUpDown4.Value;
- areaMax = this.numericUpDown5.Value;
- //二值判断
- if (this.checkBox3.Checked && bcBinaryChecked() && !this.checkBox4.Checked)
- {
- ReloadDebrisSelection();
- }
- if (this.checkBox3.Checked && bcBinaryChecked() && this.checkBox4.Checked)
- {
- ReloadDebrisSelection();
- }
- }
- /// <summary>
- /// 颗粒筛选最小值滚动条
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void trackBar2_Scroll(object sender, EventArgs e)
- {
- this.numericUpDown4.Value = this.trackBar2.Value;
- }
- /// <summary>
- /// 颗粒筛选最大值滚动条
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void trackBar4_Scroll(object sender, EventArgs e)
- {
- this.numericUpDown5.Value = this.trackBar4.Value;
- }
- /// <summary>
- /// 石墨面积率区间最小
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown6_ValueChanged(object sender, EventArgs e)
- {
- if (this.numericUpDown6.Value > this.numericUpDown7.Value)
- this.numericUpDown6.Value = this.numericUpDown7.Value;
- this.trackBar5.Value = Convert.ToInt32(this.numericUpDown6.Value);
- areaRatioRangeMin = this.numericUpDown6.Value;
- areaRatioRangeMax = this.numericUpDown7.Value;
- ReloadDebrisSelection();
- }
- /// <summary>
- /// 石墨面积率区间最大
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown7_ValueChanged(object sender, EventArgs e)
- {
- if (this.numericUpDown7.Value < this.numericUpDown6.Value)
- this.numericUpDown7.Value = this.numericUpDown6.Value;
- this.trackBar6.Value = Convert.ToInt32(this.numericUpDown7.Value);
- areaRatioRangeMin = this.numericUpDown6.Value;
- areaRatioRangeMax = this.numericUpDown7.Value;
- ReloadDebrisSelection();
- }
- /// <summary>
- /// 石墨面积率最小值滚动条
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void trackBar5_Scroll(object sender, EventArgs e)
- {
- this.numericUpDown6.Value = this.trackBar5.Value;
- }
- /// <summary>
- /// 石墨面积率最大值滚动条
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void trackBar6_Scroll(object sender, EventArgs e)
- {
- this.numericUpDown7.Value = this.trackBar6.Value;
- }
- /// <summary>
- /// 显示不同颜色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox4_CheckedChanged(object sender, EventArgs e)
- {
- ReloadDebrisSelection();
- }
- /// <summary>
- /// 添加画布绑定事件
- /// </summary>
- public void AddPictureBoxEvent()
- {
- this.documentWorkspace.panel.Paint -= new PaintEventHandler(this.BoxPaintHandler);
- this.documentWorkspace.panel.Paint += new PaintEventHandler(this.BoxPaintHandler);
- }
- /// <summary>
- /// 绘制事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BoxPaintHandler(object sender, PaintEventArgs e)
- {
- if (this.documentWorkspace.CompositionSurface != null)
- {
- Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
- int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
- int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
- int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
- int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
- e.Graphics.TranslateTransform(x, y);
- e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
- Draw(e.Graphics);
- e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
- e.Graphics.TranslateTransform(-x, -y);
- }
- }
- /// <summary>
- /// 绘制
- /// </summary>
- private void Draw(Graphics graphics)
- {
- graphics.SmoothingMode = SmoothingMode.AntiAlias;
- Pen rectPen = new Pen(Color.Black);
- rectPen.DashStyle = DashStyle.Custom;
- float[] dashArray = { 2.0f, 3.0f };
- rectPen.DashPattern = dashArray;
- if (pointList.Count > 0 && leList.Count > 0)
- {
- for (int i = 0; i < pointList.Count; i++)
- {
- graphics.DrawString(leList[i].ToString(), new Font("宋体", float.Parse(colourFont.Keys.First()), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(colourFont.Values.First()), pointList[i].X, pointList[i].Y);
- }
- }
- }
- /// <summary>
- /// 显示面积率
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox5_CheckedChanged(object sender, EventArgs e)
- {
- if (bcBinaryChecked() && !bcOriginChecked())
- {
- if (checkBox5.Checked)
- {
- ReloadDebrisSelection();
- this.documentWorkspace.Refresh();
- }
- else
- {
- this.documentWorkspace.panel.Paint -= new PaintEventHandler(this.BoxPaintHandler);
- this.documentWorkspace.Refresh();
- }
- }
- }
- /// <summary>
- /// 等积圆直径小于20um的颗粒不参与计算
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox6_CheckedChanged(object sender, EventArgs e)
- {
- ReloadDebrisSelection();
- }
- /// <summary>
- /// 保存结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- if (picArea == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- return;
- }
- else
- {
- //二值判断
- if (!bcBinaryChecked())
- {
- MessageBox.Show(PdnResources.GetString("Menu.PleaseBinarize.text")+"!");
- return;
- }
- }
- if (this.listView1.SelectedItems.Count > 0)
- {
- string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
- string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
- bool replace = false;
- int rowIndex = 0;
- if (this.dataGridView1.Rows.Count > 0 && dataGridView1.Rows[0].Visible)
- {
- if (this.listView2.Items.Count > 0)
- {
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (item.Name.Equals(tag))
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- replace = true;
- }
- else
- {
- return;
- }
- break;
- }
- }
- }
- //添加结果,有重名需要替换
- if (replace)
- {
- for (int i = 0; i < this.resultTableList.Count; i++)
- {
- if (this.resultTableList[i].TableName.Equals(tag))
- {
- rowIndex = i;
- this.resultTableList.Remove(this.resultTableList[i]);
- if (this.pointList.Count > 0)
- {
- resultTableList.Insert(rowIndex, dtResult);
- }
- }
- }
- }
- else
- {
- ListViewItem listViewItem = new ListViewItem();
- listViewItem.Name = tag;
- listViewItem.SubItems[0].Text = imgName;
- this.listView2.Items.Add(listViewItem);
- this.listView2.SelectedItems.Clear();
- this.listView2.Items[this.listView2.Items.Count - 1].Selected = true;
- if (this.pointList.Count > 0)
- {
- resultTableList.Insert(rowIndex, dtResult);
- }
- }
- RefreshDataGridView2();
- //保存处理后的图片
- double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
- List<Bitmap> tempBit = new List<Bitmap>();
- Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- originalBit.Tag = pantographRatio;
- tempBit.Add(originalBit);
- Bitmap processedBit = BitmapConverter.ToBitmap(phaseModel.mat);
- Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
- Graphics graphics = Graphics.FromImage(newBit);
- graphics.DrawImage(processedBit, new PointF(0, 0));
- if (this.checkBox4.Checked)
- {
- DisplayColor();
- }
- if (this.checkBox5.Checked)
- {
- Draw(graphics);
- }
- newBit.Tag = pantographRatio;
- tempBit.Add(newBit);
- if (bitDic.ContainsKey(tag))
- bitDic[tag] = tempBit;
- else
- bitDic.Add(tag, tempBit);
- //拼接中间数据
- List<List<string>> dataList = new List<List<string>>();
- List<string> columnName = new List<string>();
- columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
- if (this.checkBox6.Checked)
- {
- columnName.Add(PdnResources.GetString("Menu.umisoproductcirclediameter.text"));
- }
- else
- {
- columnName.Add(PdnResources.GetString("Menu.Diameterofequalareacircle.text"));
- }
- columnName.Add(PdnResources.GetString("Menu.Thearearatio.text"));
- dataList.Add(columnName);
- if (this.lstEqualDiameter.Count > 0)
- {
- for (int i = 0; i < this.lstEqualDiameter.Count; i++)
- {
- List<string> strList = new List<string>();
- strList.Add((i + 1).ToString());
- strList.Add(this.lstEqualDiameter[i].ToString());
- strList.Add(this.leList[i].ToString());
- dataList.Add(strList);
- }
- }
- bool isExist = false;//是否已存在进行替换
- int modelIndex = -1;//要替换的下标
- for (int j = 0; j < tempDataModel.Count; j++)
- {
- if (tempDataModel[j].tagName.Equals(tag))
- {
- isExist = true;
- modelIndex = j;
- break;
- }
- }
- if (isExist && modelIndex > -1)
- tempDataModel[modelIndex].dataList = dataList;
- else
- {
- ExportProjectModel newModel = new ExportProjectModel();
- newModel.tagName = tag;
- newModel.picName = imgName;
- newModel.dataList = dataList;
- tempDataModel.Add(newModel);
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Nodatatosave.text"));
- }
- }
- }
- /// <summary>
- /// 刷新数据展示表
- /// </summary>
- private void RefreshDataGridView1()
- {
- this.dataGridView1.Rows.Clear();
- if (dtDataGridView1 != null && dtDataGridView1.Rows.Count > 0)
- {
- dataGridView1.Rows.Add(dtDataGridView1.Rows.Count);//增加同等数量的行数
- int i = 0;
- foreach (DataRow row in dtDataGridView1.Rows)//逐个读取单元格的内容;
- {
- DataGridViewRow r1 = dataGridView1.Rows[i];
- r1.Cells[0].Value = row.RowState.ToString();
- for (int j = 0; j < dtDataGridView1.Columns.Count; j++)
- {
- if (j == 0 || j == 8)
- {
- r1.Cells[j].Value = row[j].ToString();
- }
- else
- {
- r1.Cells[j].Value = Math.Round(double.Parse(string.IsNullOrEmpty(row[j].ToString()) ? "0" :
- row[j].ToString()), Convert.ToInt32(this.numericUpDown1.Value));
- }
- }
- i++;
- }
- }
- }
- /// <summary>
- /// 刷新分析结果表
- /// </summary>
- private void RefreshDataGridView2()
- {
- //需要计算平均值的集合
- List<double> lst1_08 = new List<double>();
- List<double> lst08_06 = new List<double>();
- List<double> lst06_04 = new List<double>();
- List<double> lst04_02 = new List<double>();
- List<double> lst02_01 = new List<double>();
- List<double> lst01_0 = new List<double>();
- List<double> lstRate = new List<double>();
- //综合平均值
- double avglst1_08 = 0;
- double avglst08_06 = 0;
- double avglst06_04 = 0;
- double avglst04_02 = 0;
- double avglst02_01 = 0;
- double avglst01_0 = 0;
- double avglstRate = 0;
- if (resultTableList.Count > 0)
- {
- dataGridView2.Rows.Clear();
- dataGridView3.Rows.Clear();
- if (this.showAll)
- {
- //dataGridView2.Rows.Clear();
- int i = 0;
- for (int k = 0; k < resultTableList.Count; k++)
- {
- dataGridView2.Rows.Add(resultTableList[k].Rows.Count);//增加同等数量的行数
- foreach (DataRow row in resultTableList[k].Rows)//逐个读取单元格的内容;
- {
- DataGridViewRow r1 = dataGridView2.Rows[i];
- r1.Cells[0].Value = row.RowState.ToString();
- for (int j = 0; j < resultTableList[k].Columns.Count; j++)
- {
- if (j == 0 || j == 1 || j == 9)
- {
- r1.Cells[j].Value = row[j].ToString();
- }
- else
- {
- r1.Cells[j].Value = Math.Round(double.Parse(string.IsNullOrEmpty(row[j].ToString()) ? "0" :
- row[j].ToString()), Convert.ToInt32(this.numericUpDown1.Value));
- }
- //r1.Cells[j].Value = row[j];
- if (!row[1].Equals(PdnResources.GetString("Menu.Image.Average.Text")))
- {
- if (j == 2)
- {
- lst1_08.Add(double.Parse(row[j].ToString()));
- }
- if (j == 3)
- {
- lst08_06.Add(double.Parse(row[j].ToString()));
- }
- if (j == 4)
- {
- lst06_04.Add(double.Parse(row[j].ToString()));
- }
- if (j == 5)
- {
- lst04_02.Add(double.Parse(row[j].ToString()));
- }
- if (j == 6)
- {
- lst02_01.Add(double.Parse(row[j].ToString()));
- }
- if (j == 7)
- {
- lst01_0.Add(double.Parse(row[j].ToString()));
- }
- if (j == 8)
- {
- lstRate.Add(double.Parse(row[j].ToString()));
- }
- }
- }
- i++;
- }
- }
- }
- else
- {
- //dataGridView2.Rows.Clear();
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- int h = 0;
- for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
- {
- string tableName = this.listView2.SelectedItems[i].Name;
- foreach (DataTable dt in resultTableList)
- {
- if (dt.TableName.Equals(tableName))
- {
- dataGridView2.Rows.Add(dt.Rows.Count);//增加同等数量的行数
- foreach (DataRow row in dt.Rows)//逐个读取单元格的内容;
- {
- DataGridViewRow r1 = dataGridView2.Rows[h];
- r1.Cells[0].Value = row.RowState.ToString();
- for (int j = 0; j < dt.Columns.Count; j++)
- {
- if (j == 0 || j == 1 || j == 9)
- {
- r1.Cells[j].Value = row[j].ToString();
- }
- else
- {
- r1.Cells[j].Value = Math.Round(double.Parse(string.IsNullOrEmpty(row[j].ToString()) ? "0" :
- row[j].ToString()), Convert.ToInt32(this.numericUpDown1.Value));
- }
- //r1.Cells[j].Value = row[j];
- if (!row[1].Equals(PdnResources.GetString("Menu.Image.Average.Text")))
- {
- if (j == 2)
- {
- lst1_08.Add(double.Parse(row[j].ToString()));
- }
- if (j == 3)
- {
- lst08_06.Add(double.Parse(row[j].ToString()));
- }
- if (j == 4)
- {
- lst06_04.Add(double.Parse(row[j].ToString()));
- }
- if (j == 5)
- {
- lst04_02.Add(double.Parse(row[j].ToString()));
- }
- if (j == 6)
- {
- lst02_01.Add(double.Parse(row[j].ToString()));
- }
- if (j == 7)
- {
- lst01_0.Add(double.Parse(row[j].ToString()));
- }
- if (j == 8)
- {
- lstRate.Add(double.Parse(row[j].ToString()));
- }
- }
- }
- h++;
- }
- }
- }
- }
- }
- }
- if (this.listView2.SelectedItems.Count > 0)
- {
- if (lst1_08.Count > 0)
- {
- avglst1_08 = (double)lst1_08.Average();
- }
- if (lst08_06.Count > 0)
- {
- avglst08_06 = (double)lst08_06.Average();
- }
- if (lst06_04.Count > 0)
- {
- avglst06_04 = (double)lst06_04.Average();
- }
- if (lst04_02.Count > 0)
- {
- avglst04_02 = (double)lst04_02.Average();
- }
- if (lst02_01.Count > 0)
- {
- avglst02_01 = (double)lst02_01.Average();
- }
- if (lst01_0.Count > 0)
- {
- avglst01_0 = (double)lst01_0.Average();
- }
- if (lstRate.Count > 0)
- {
- avglstRate = (double)lstRate.Average();
- }
- string avgLevel = string.Empty;
- if (avglstRate / 100 < 0.01)
- {
- avgLevel = "1";
- }
- else if (avglstRate / 100 >= 0.01 && avglstRate / 100 < 0.05)
- {
- avgLevel = "2";
- }
- else if (avglstRate / 100 >= 0.05 && avglstRate / 100 < 0.15)
- {
- avgLevel = "3";
- }
- else if (avglstRate / 100 >= 0.15 && avglstRate / 100 < 0.25)
- {
- avgLevel = "4";
- }
- else if (avglstRate / 100 >= 0.25)
- {
- avgLevel = "5";
- }
- else
- {
- avgLevel = "-";
- }
- this.dataGridView3.Rows.Add(PdnResources.GetString("Menu.comprehensive.text"), PdnResources.GetString("Menu.Comprehensivaverage.text"), Math.Round(double.Parse(string.IsNullOrEmpty(avglst1_08.ToString()) ? "0" : avglst1_08.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglst08_06.ToString()) ? "0" : avglst08_06.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglst06_04.ToString()) ? "0" : avglst06_04.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglst04_02.ToString()) ? "0" : avglst04_02.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglst02_01.ToString()) ? "0" : avglst02_01.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglst01_0.ToString()) ? "0" : avglst01_0.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglstRate.ToString()) ? "0" : avglstRate.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), avgLevel);
- }
- }
- else
- {
- dataGridView2.Rows.Clear();
- dataGridView3.Rows.Clear();
- }
- }
- /// <summary>
- /// 生成报告
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button8_Click(object sender, EventArgs e)
- {
- if (this.checkBox1.Checked)
- this.btnSetUp.PerformClick();
- if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- //分析结果
- List<List<string>> analysisContent = new List<List<string>>();
- List<string> contentHead = new List<string>();
- contentHead.Add(PdnResources.GetString("Menu.picture.Text"));
- contentHead.Add(PdnResources.GetString("Menu.view.text"));
- contentHead.Add("1-0.8");
- contentHead.Add("0.8-0.6");
- contentHead.Add("0.6-0.4");
- contentHead.Add("0.4-0.2");
- contentHead.Add("0.2-0.1");
- contentHead.Add("0.1-0");
- contentHead.Add(PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)");
- contentHead.Add(PdnResources.GetString("Menu.Levelname.text"));
- analysisContent.Add(contentHead);
- foreach (DataGridViewRow item in this.dataGridView2.Rows)
- {
- List<string> content = new List<string>();
- content.Add(item.Cells[0].Value.ToString());
- content.Add(item.Cells[1].Value.ToString());
- content.Add(item.Cells[2].Value.ToString());
- content.Add(item.Cells[3].Value.ToString());
- content.Add(item.Cells[4].Value.ToString());
- content.Add(item.Cells[5].Value.ToString());
- content.Add(item.Cells[6].Value.ToString());
- content.Add(item.Cells[7].Value.ToString());
- content.Add(item.Cells[8].Value.ToString());
- content.Add(item.Cells[9].Value.ToString());
- analysisContent.Add(content);
- }
- analysisContent.Add(new List<string>() { "\r" });
- foreach (DataGridViewRow item in this.dataGridView3.Rows)
- {
- List<string> content = new List<string>();
- content.Add(item.Cells[0].Value.ToString());
- content.Add(item.Cells[1].Value.ToString());
- content.Add(item.Cells[2].Value.ToString());
- content.Add(item.Cells[3].Value.ToString());
- content.Add(item.Cells[4].Value.ToString());
- content.Add(item.Cells[5].Value.ToString());
- content.Add(item.Cells[6].Value.ToString());
- content.Add(item.Cells[7].Value.ToString());
- content.Add(item.Cells[8].Value.ToString());
- content.Add(item.Cells[9].Value.ToString());
- analysisContent.Add(content);
- }
- //图片
- bitList = new List<Bitmap>();
- if (this.showAll)
- {
- foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
- {
- bitList.Add(kv.Value[0]);
- bitList.Add(kv.Value[1]);
- }
- }
- else
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- foreach (ListViewItem item in this.listView2.SelectedItems)
- {
- if (bitDic.ContainsKey(item.Name))
- {
- bitList.Add(bitDic[item.Name][0]);
- bitList.Add(bitDic[item.Name][1]);
- }
- }
- }
- }
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
- }
- /// <summary>
- /// 导出项目
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- if (this.checkBox1.Checked)
- this.btnSetUp.PerformClick();
- if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- PaintDotNet.Instrument.ProjectEngineering.NodeItem nodeItem = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.DuctileIron.Text", this.analyzeSettingModel.savePath);
- if (nodeItem == null) return;
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- //分析结果
- List<List<string>> analysisContent = new List<List<string>>();
- List<string> contentHead = new List<string>();
- contentHead.Add(PdnResources.GetString("Menu.picture.Text"));
- contentHead.Add(PdnResources.GetString("Menu.view.text"));
- contentHead.Add("1-0.8");
- contentHead.Add("0.8-0.6");
- contentHead.Add("0.6-0.4");
- contentHead.Add("0.4-0.2");
- contentHead.Add("0.2-0.1");
- contentHead.Add("0.1-0");
- contentHead.Add(PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)");
- contentHead.Add(PdnResources.GetString("Menu.Levelname.text"));
- analysisContent.Add(contentHead);
- foreach (DataGridViewRow item in this.dataGridView2.Rows)
- {
- List<string> content = new List<string>();
- content.Add(item.Cells[0].Value.ToString());
- content.Add(item.Cells[1].Value.ToString());
- content.Add(item.Cells[2].Value.ToString());
- content.Add(item.Cells[3].Value.ToString());
- content.Add(item.Cells[4].Value.ToString());
- content.Add(item.Cells[5].Value.ToString());
- content.Add(item.Cells[6].Value.ToString());
- content.Add(item.Cells[7].Value.ToString());
- content.Add(item.Cells[8].Value.ToString());
- content.Add(item.Cells[9].Value.ToString());
- analysisContent.Add(content);
- }
- analysisContent.Add(new List<string>() { "\r" });
- foreach (DataGridViewRow item in this.dataGridView3.Rows)
- {
- List<string> content = new List<string>();
- content.Add(item.Cells[0].Value.ToString());
- content.Add(item.Cells[1].Value.ToString());
- content.Add(item.Cells[2].Value.ToString());
- content.Add(item.Cells[3].Value.ToString());
- content.Add(item.Cells[4].Value.ToString());
- content.Add(item.Cells[5].Value.ToString());
- content.Add(item.Cells[6].Value.ToString());
- content.Add(item.Cells[7].Value.ToString());
- content.Add(item.Cells[8].Value.ToString());
- content.Add(item.Cells[9].Value.ToString());
- analysisContent.Add(content);
- }
- //图片
- bitList = new List<Bitmap>();
- if (this.showAll)
- {
- foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
- {
- bitList.Add(kv.Value[0]);
- bitList.Add(kv.Value[1]);
- }
- }
- else
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- foreach (ListViewItem item in this.listView2.SelectedItems)
- {
- if (bitDic.ContainsKey(item.Name))
- {
- bitList.Add(bitDic[item.Name][0]);
- bitList.Add(bitDic[item.Name][1]);
- }
- }
- }
- }
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, nodeItem.path, nodeItem.code);
- //保存项目信息到数据库
- this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, nodeItem);
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
- }
- /// <summary>
- /// 导出结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button9_Click(object sender, EventArgs e)
- {
- if (this.dataGridView2.Rows.Count > 0)
- {
- SaveFileDialog exe = new SaveFileDialog();
- exe.Filter = "Execl files (*.xlsx)|*.xlsx";
- exe.FilterIndex = 0;
- exe.RestoreDirectory = true;
- //exe.CreatePrompt = true;
- exe.Title = "Export Excel File";
- exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- exe.FileName = PdnResources.GetString("Menu.Analysisresultsofnitridingdepthdetermin.text") + DateTime.Now.ToString("yyyyMMddHHmmss");
- DialogResult dr = exe.ShowDialog();
- if (dr != DialogResult.OK)
- return;
- DataTable dtb = new DataTable();
- dtb.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
- dtb.Columns.Add(PdnResources.GetString("Menu.view.text"));
- dtb.Columns.Add("1-0.8");
- dtb.Columns.Add("0.8-0.6");
- dtb.Columns.Add("0.6-0.4");
- dtb.Columns.Add("0.4-0.2");
- dtb.Columns.Add("0.2-0.1");
- dtb.Columns.Add("0.1-0");
- dtb.Columns.Add(PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)");
- dtb.Columns.Add(PdnResources.GetString("Menu.Levelname.text"));
- for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
- {
- DataRow dataRow = dtb.NewRow();
- dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView2.Rows[i].Cells[0].Value;
- dataRow[PdnResources.GetString("Menu.view.text")] = this.dataGridView2.Rows[i].Cells[1].Value;
- dataRow["1-0.8"] = this.dataGridView2.Rows[i].Cells[2].Value;
- dataRow["0.8-0.6"] = this.dataGridView2.Rows[i].Cells[3].Value;
- dataRow["0.6-0.4"] = this.dataGridView2.Rows[i].Cells[4].Value;
- dataRow["0.4-0.2"] = this.dataGridView2.Rows[i].Cells[5].Value;
- dataRow["0.2-0.1"] = this.dataGridView2.Rows[i].Cells[6].Value;
- dataRow["0.1-0"] = this.dataGridView2.Rows[i].Cells[7].Value;
- dataRow[PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)"] = this.dataGridView2.Rows[i].Cells[8].Value;
- dataRow[PdnResources.GetString("Menu.Levelname.text")] = this.dataGridView2.Rows[i].Cells[9].Value;
- dtb.Rows.Add(dataRow);
- }
- DataTable dtb1 = new DataTable();
- dtb1.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
- dtb1.Columns.Add(PdnResources.GetString("Menu.view.text"));
- dtb1.Columns.Add("1-0.8");
- dtb1.Columns.Add("0.8-0.6");
- dtb1.Columns.Add("0.6-0.4");
- dtb1.Columns.Add("0.4-0.2");
- dtb1.Columns.Add("0.2-0.1");
- dtb1.Columns.Add("0.1-0");
- dtb1.Columns.Add(PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)");
- dtb1.Columns.Add(PdnResources.GetString("Menu.Levelname.text"));
- for (int i = 0; i < this.dataGridView3.Rows.Count; i++)
- {
- DataRow dataRow = dtb1.NewRow();
- dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView3.Rows[i].Cells[0].Value;
- dataRow[PdnResources.GetString("Menu.view.text")] = this.dataGridView3.Rows[i].Cells[1].Value;
- dataRow["1-0.8"] = this.dataGridView3.Rows[i].Cells[2].Value;
- dataRow["0.8-0.6"] = this.dataGridView3.Rows[i].Cells[3].Value;
- dataRow["0.6-0.4"] = this.dataGridView3.Rows[i].Cells[4].Value;
- dataRow["0.4-0.2"] = this.dataGridView3.Rows[i].Cells[5].Value;
- dataRow["0.2-0.1"] = this.dataGridView3.Rows[i].Cells[6].Value;
- dataRow["0.1-0"] = this.dataGridView3.Rows[i].Cells[7].Value;
- dataRow[PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)"] = this.dataGridView3.Rows[i].Cells[8].Value;
- dataRow[PdnResources.GetString("Menu.Levelname.text")] = this.dataGridView3.Rows[i].Cells[9].Value;
- dtb1.Rows.Add(dataRow);
- }
- List<DataTable> list = new List<DataTable>();
- list.Add(dtb);
- list.Add(dtb1);
- this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, false, false, true);
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text")+"!");
- }
- private void listView2_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.showAll)
- return;
- RefreshDataGridView2();
- }
- /// <summary>
- /// 全部显示
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- if (this.button6.Text == PdnResources.GetString("Menu.Showall.text"))
- {
- this.button6.Text = PdnResources.GetString("Menu.Cancelshowall.text");
- this.showAll = true;
- RefreshDataGridView2();
- }
- else if (this.button6.Text == PdnResources.GetString("Menu.Cancelshowall.text"))
- {
- this.button6.Text = PdnResources.GetString("Menu.Showall.text");
- this.showAll = false;
- RefreshDataGridView2();
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button7_Click(object sender, EventArgs e)
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Determineallanalysisrlete.text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
- {
- string tableName = this.listView2.SelectedItems[i].Name;
- foreach (DataTable dt in resultTableList)
- {
- if (dt.TableName.Equals(tableName))
- {
- resultTableList.Remove(dt);
- break;
- }
- }
- if (bitDic.ContainsKey(tableName))
- bitDic.Remove(tableName);
- }
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (item.Selected)
- this.listView2.Items.Remove(item);
- }
- RefreshDataGridView2();
- }
- }
- }
- /// <summary>
- /// 设置窗体缩放最小尺寸
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void SpheroidizationLevelDialog_ResizeEnd(object sender, EventArgs e)
- {
- if (this.Width <= 1179)
- {
- this.Width = 1179;
- }
- if (this.Height <= 945)
- {
- this.Height = 945;
- }
- }
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- if (this.documentWorkspace == null || this.documentWorkspace.CompositionSurface == null)
- return;
- //ResetAreaAndContent();
- ReloadDebrisSelection();
- }
- #region 参数保存及提取
- /// <summary>
- /// 保存参数的key,value和type
- /// </summary>
- /// <param name="param_key"></param>
- /// <param name="param_value"></param>
- /// <param name="param_type"></param>
- private void saveParamValue(string param_key, string param_value, int param_type)
- {
- bool foundItem = false;
- foreach (var item in this.analysisModel.ListParam)
- {
- if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
- {
- item.param_value = param_value;
- item.setValue();
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- {
- GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
- analysisItem.menuId = this.menuId;
- analysisItem.param_key = param_key;
- analysisItem.param_type = param_type;
- analysisItem.param_value = param_value;
- analysisItem.setValue();
- this.analysisModel.ListParam.Add(analysisItem);
- }
- }
- /// <summary>
- /// 保存界面中的参数到model
- /// </summary>
- private void saveDialogParamValues()
- {
- saveParamValue(ParamKey_Report, checkBox1.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//报告设置
- saveParamValue(ParamKey_Screen, checkBox3.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//筛选
- saveParamValue(ParamKey_ScreenMin, numericUpDown4 != null ? numericUpDown4.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//面积最小值
- saveParamValue(ParamKey_ScreenMax, numericUpDown5 != null ? numericUpDown5.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//面积最大值
- saveParamValue(ParamKey_Diameter, checkBox6.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//直径小于20um
- saveParamValue(ParamKey_Colour, checkBox4.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//显示不同颜色
- saveParamValue(ParamKey_AreaRatio, checkBox5.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//显示面积率
- saveParamValue(ParamKey_AreaRatioRange, checkBox2.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//显示面积率
- saveParamValue(ParamKey_AreaRatioRangeMin, numericUpDown6 != null ? numericUpDown6.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//面积率区间最小值
- saveParamValue(ParamKey_AreaRatioRangeMax, numericUpDown7 != null ? numericUpDown7.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//面积率区间最大值
- saveParamValue(ParamKey_DecimalPlace, numericUpDown1 != null ? numericUpDown1.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//保留小数位数
- saveParamValue(ParamKey_panelColour1_08, colour != null ? colour[ParamKey_panelColour1_08].ToArgb().ToString() : Color.Orange.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//不同区间颜色
- saveParamValue(ParamKey_panelColour08_06, colour != null ? colour[ParamKey_panelColour08_06].ToArgb().ToString() : Color.Blue.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//不同区间颜色
- saveParamValue(ParamKey_panelColour06_04, colour != null ? colour[ParamKey_panelColour06_04].ToArgb().ToString() : Color.Green.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//不同区间颜色
- saveParamValue(ParamKey_panelColour04_02, colour != null ? colour[ParamKey_panelColour04_02].ToArgb().ToString() : Color.Pink.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//不同区间颜色
- saveParamValue(ParamKey_panelColour02_01, colour != null ? colour[ParamKey_panelColour02_01].ToArgb().ToString() : Color.Violet.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//不同区间颜色
- saveParamValue(ParamKey_panelColour01_0, colour != null ? colour[ParamKey_panelColour01_0].ToArgb().ToString() : Color.Yellow.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//不同区间颜色
- saveParamValue(ParamKey_FontSize, colourFont != null ? colourFont.Keys.First() : "12", (int)PaintDotNet.Base.Dtryt.Interger);//字体大小
- saveParamValue(ParamKey_FontColour, colour != null ? colourFont.Values.First().ToArgb().ToString() : Color.Black.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//字体颜色
- }
- /// <summary>
- /// 获取保存的参数
- /// </summary>
- private void GetListParamModel()
- {
- if (this.analysisModel != null)
- {
- for (int i = 0; i < this.analysisModel.ListParam.Count; i++)
- {
- switch (this.analysisModel.ListParam[i].param_key)
- {
- case ParamKey_Report:
- checkBox1.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Screen:
- checkBox3.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_ScreenMin:
- areaMin = decimal.Parse(this.analysisModel.ListParam[i].param_value);
- break;
- case ParamKey_ScreenMax:
- areaMax = decimal.Parse(this.analysisModel.ListParam[i].param_value);
- break;
- case ParamKey_Diameter:
- checkBox6.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Colour:
- checkBox4.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_AreaRatio:
- checkBox5.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_AreaRatioRange:
- checkBox2.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_AreaRatioRangeMin:
- areaRatioRangeMin = decimal.Parse(this.analysisModel.ListParam[i].param_value);
- break;
- case ParamKey_AreaRatioRangeMax:
- areaRatioRangeMax = decimal.Parse(this.analysisModel.ListParam[i].param_value);
- break;
- case ParamKey_DecimalPlace:
- numericUpDown1.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
- break;
- case ParamKey_panelColour1_08:
- colour.Remove(ParamKey_panelColour1_08);
- colour.Add(ParamKey_panelColour1_08, Color.FromArgb((int)this.analysisModel.ListParam[i].value));
- break;
- case ParamKey_panelColour08_06:
- colour.Remove(ParamKey_panelColour08_06);
- colour.Add(ParamKey_panelColour08_06, Color.FromArgb((int)this.analysisModel.ListParam[i].value));
- break;
- case ParamKey_panelColour06_04:
- colour.Remove(ParamKey_panelColour06_04);
- colour.Add(ParamKey_panelColour06_04, Color.FromArgb((int)this.analysisModel.ListParam[i].value));
- break;
- case ParamKey_panelColour04_02:
- colour.Remove(ParamKey_panelColour04_02);
- colour.Add(ParamKey_panelColour04_02, Color.FromArgb((int)this.analysisModel.ListParam[i].value));
- break;
- case ParamKey_panelColour02_01:
- colour.Remove(ParamKey_panelColour02_01);
- colour.Add(ParamKey_panelColour02_01, Color.FromArgb((int)this.analysisModel.ListParam[i].value));
- break;
- case ParamKey_panelColour01_0:
- colour.Remove(ParamKey_panelColour01_0);
- colour.Add(ParamKey_panelColour01_0, Color.FromArgb((int)this.analysisModel.ListParam[i].value));
- break;
- case ParamKey_FontSize:
- fontSize = this.analysisModel.ListParam[i].value.ToString();
- break;
- case ParamKey_FontColour:
- fontColour = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- }
- }
- colourFont.Clear();
- colourFont.Add(fontSize, fontColour);
- }
- }
- #endregion
- #region [脚本相关]
- private void getValue(string key, object value)
- {
- switch (key)
- {
- case "parameter1":
- checkBox3.Checked = Convert.ToBoolean(value);
- break;
- case "parameter2":
- int min = Convert.ToInt32(value);
- decimal minDec = Convert.ToDecimal(value);
- if (bcBinaryChecked())
- {
- if (trackBar2.Minimum > min || trackBar2.Maximum < min)
- {
- trackBar2.Value = trackBar2.Minimum;
- }
- else
- {
- trackBar2.Value = min;
- }
- if (numericUpDown4.Minimum > min || numericUpDown4.Maximum < min)
- {
- numericUpDown4.Value = numericUpDown4.Minimum;
- }
- else
- {
- numericUpDown4.Value = minDec;
- }
- }
- break;
- case "parameter3":
- int max = Convert.ToInt32(value);
- decimal maxDec = Convert.ToDecimal(value);
- if (bcBinaryChecked())
- {
- if (trackBar4.Minimum > max || trackBar4.Maximum < max)
- {
- trackBar4.Value = trackBar4.Maximum;
- }
- else
- {
- trackBar4.Value = max;
- }
- if (numericUpDown5.Minimum > max || numericUpDown5.Maximum < max)
- {
- numericUpDown5.Value = numericUpDown5.Maximum;
- }
- else
- {
- numericUpDown5.Value = maxDec;
- }
- }
- break;
- case "parameter4":
- checkBox6.Checked = Convert.ToBoolean(value);
- break;
- case "parameter5":
- checkBox4.Checked = Convert.ToBoolean(value);
- break;
- case "parameter6":
- checkBox5.Checked = Convert.ToBoolean(value);
- break;
- case "parameter7":
- fontSize = value.ToString();
- colourFont.Clear();
- colourFont.Add(fontSize, Color.Black);
- break;
- case "parameter8":
- fontColour = Color.FromArgb((int)value);
- if (colourFont.ContainsKey(fontSize))
- {
- colourFont[fontSize] = fontColour;
- }
- else
- {
- colourFont.Add("10", fontColour);
- }
- break;
- case "parameter9":
- if (colour.ContainsKey("panelColour1_08"))
- {
- colour["panelColour1_08"] = Color.FromArgb((int)value);
- }
- else
- {
- colour.Add("panelColour1_08", Color.FromArgb((int)value));
- }
- break;
- case "parameter10":
- if (colour.ContainsKey("panelColour08_06"))
- {
- colour["panelColour08_06"] = Color.FromArgb((int)value);
- }
- else
- {
- colour.Add("panelColour08_06", Color.FromArgb((int)value));
- }
- break;
- case "parameter11":
- if (colour.ContainsKey("panelColour06_04"))
- {
- colour["panelColour06_04"] = Color.FromArgb((int)value);
- }
- else
- {
- colour.Add("panelColour06_04", Color.FromArgb((int)value));
- }
- break;
- case "parameter12":
- if (colour.ContainsKey("panelColour04_02"))
- {
- colour["panelColour04_02"] = Color.FromArgb((int)value);
- }
- else
- {
- colour.Add("panelColour04_02", Color.FromArgb((int)value));
- }
- break;
- case "parameter13":
- if (colour.ContainsKey("panelColour02_01"))
- {
- colour["panelColour02_01"] = Color.FromArgb((int)value);
- }
- else
- {
- colour.Add("panelColour02_01", Color.FromArgb((int)value));
- }
- break;
- case "parameter14":
- if (colour.ContainsKey("panelColour01_0"))
- {
- colour["panelColour01_0"] = Color.FromArgb((int)value);
- }
- else
- {
- colour.Add("panelColour01_0", Color.FromArgb((int)value));
- }
- break;
- case "parameter15":
- int min2 = Convert.ToInt32(value);
- decimal minDec2 = Convert.ToDecimal(value);
- if (trackBar5.Minimum > min2 || trackBar5.Maximum < min2)
- {
- trackBar5.Value = trackBar5.Minimum;
- }
- else
- {
- trackBar5.Value = min2;
- }
- if (numericUpDown6.Minimum > minDec2 || numericUpDown6.Maximum < minDec2)
- {
- numericUpDown6.Value = numericUpDown6.Minimum;
- }
- else
- {
- numericUpDown6.Value = minDec2;
- }
- break;
- case "parameter16":
- int min3 = Convert.ToInt32(value);
- decimal minDec3 = Convert.ToDecimal(value);
- if (trackBar6.Minimum > min3 || trackBar6.Maximum < min3)
- {
- trackBar6.Value = trackBar6.Minimum;
- }
- else
- {
- trackBar6.Value = min3;
- }
- if (numericUpDown7.Minimum > minDec3 || numericUpDown7.Maximum < minDec3)
- {
- numericUpDown7.Value = numericUpDown7.Minimum;
- }
- else
- {
- numericUpDown7.Value = minDec3;
- }
- break;
- case "OpenWhileExportReport":
- checkBox1.Checked = Convert.ToBoolean(value);
- break;
- case "CalculatorDecimalDigits":
- numericUpDown1.Value = Convert.ToDecimal(value);
- break;
- }
- }
- #endregion
- #region [脚本录制]
- private void getScriptRecording()
- {
- string className = InvariantData.path_Action + ".Action" + menuId;
- ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
- List<Args> args = param.Lists;
- foreach (var item in args)
- {
- item.value = setScriptRecording(item.key);
- }
- //找出二值相关参数 进行赋值
- List<Args> isNullList = args.Where(m => m.value == null).ToList();
- foreach (var item in isNullList)
- {
- item.value = binaryClass.setScriptRecording(item.key);
- }
- appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
- }
- private object setScriptRecording(string key)
- {
- object value = null;
- switch (key)
- {
- case "parameter1":
- value = checkBox3.Checked;
- break;
- case "parameter2":
- value = trackBar2.Value;
- break;
- case "parameter3":
- value = trackBar4.Value;
- break;
- case "parameter4":
- value = checkBox6.Checked;
- break;
- case "parameter5":
- value = checkBox4.Checked;
- break;
- case "parameter6":
- value = checkBox5.Checked;
- break;
- case "parameter7":
- value = fontSize;
- break;
- case "parameter8":
- value = fontColour.ToArgb();
- break;
- case "parameter9":
- if (colour.ContainsKey("panelColour1_08"))
- {
- value = colour["panelColour1_08"].ToArgb();
- }
- else
- {
- value = Color.Orange.ToArgb();
- }
- break;
- case "parameter10":
- if (colour.ContainsKey("panelColour08_06"))
- {
- value = colour["panelColour08_06"].ToArgb();
- }
- else
- {
- value = Color.Blue.ToArgb();
- }
- break;
- case "parameter11":
- if (colour.ContainsKey("panelColour06_04"))
- {
- value = colour["panelColour06_04"].ToArgb();
- }
- else
- {
- value = Color.Green.ToArgb();
- }
- break;
- case "parameter12":
- if (colour.ContainsKey("panelColour04_02"))
- {
- value = colour["panelColour04_02"].ToArgb();
- }
- else
- {
- value = Color.Pink.ToArgb();
- }
- break;
- case "parameter13":
- if (colour.ContainsKey("panelColour02_01"))
- {
- value = colour["panelColour02_01"].ToArgb();
- }
- else
- {
- value = Color.Purple.ToArgb();
- }
- break;
- case "parameter14":
- if (colour.ContainsKey("panelColour01_0"))
- {
- value = colour["panelColour01_0"].ToArgb();
- }
- else
- {
- value = Color.Yellow.ToArgb();
- }
- break;
- case "parameter15":
- value = trackBar5.Value;
- break;
- case "parameter16":
- value = trackBar6.Value;
- break;
- case "OpenWhileExportReport":
- value = checkBox1.Checked;
- break;
- case "CalculatorDecimalDigits":
- value = numericUpDown1.Value;
- break;
- case "ExportResults":
- value = false;
- break;
- case "ExportReports":
- value = false;
- break;
- case "ExportProjects":
- value = false;
- break;
- }
- return value;
- }
- #endregion
- }
- }
|