1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582 |
- 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.DuctileIron.GBT9441_2009.PearliteNumber
- {
- internal partial class PearliteNumberDialog : 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 = 28;
- this.Controls.Add(this.bc);
- this.Controls.SetChildIndex(this.bc, 0);
- this.Text = "GBT9441-2009(" + PdnResources.GetString("Menu.Numberofpearlite.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.checkBox3.Text = PdnResources.GetString("Menu.filter.text");
- this.label3.Text = PdnResources.GetString("Menu.range.text") + ":";
- this.groupBox5.Text = PdnResources.GetString("Menu.Particlescreening.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") + "(%)";
- this.button3.Text = PdnResources.GetString("Menu.File.SaveAll.Text");
- this.button4.Text = PdnResources.GetString("Menu.Applyall.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.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.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.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.button3 = new System.Windows.Forms.Button();
- this.button4 = new System.Windows.Forms.Button();
- 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.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.groupBox2.SuspendLayout();
- this.groupBox1.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox7
- //
- 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(153, 507);
- this.groupBox7.Name = "groupBox7";
- this.groupBox7.Size = new System.Drawing.Size(358, 51);
- this.groupBox7.TabIndex = 27;
- this.groupBox7.TabStop = false;
- //
- // 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(181, 21);
- 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, 21);
- 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(278, 20);
- 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, 20);
- 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.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(325, 25);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(0, 12);
- this.label5.TabIndex = 11;
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(5, 25);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(0, 12);
- 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(1196, 204);
- this.groupBox9.TabIndex = 26;
- 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(227, 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(796, 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.Location = new System.Drawing.Point(1051, 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(1029, 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(210, 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(1103, 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.AutoSize = true;
- this.label8.Location = new System.Drawing.Point(1064, 167);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(0, 12);
- this.label8.TabIndex = 6;
- //
- // button9
- //
- this.button9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button9.Location = new System.Drawing.Point(1051, 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.Location = new System.Drawing.Point(1051, 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(228, 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(795, 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(16, 56);
- 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.Location = new System.Drawing.Point(145, 20);
- 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.Location = new System.Drawing.Point(16, 20);
- 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(153, 562);
- this.groupBox8.Name = "groupBox8";
- this.groupBox8.Size = new System.Drawing.Size(357, 191);
- this.groupBox8.TabIndex = 25;
- 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, 164);
- 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(152, 417);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(358, 87);
- this.groupBox6.TabIndex = 24;
- this.groupBox6.TabStop = false;
- //
- // checkBox6
- //
- this.checkBox6.AutoSize = true;
- this.checkBox6.Location = new System.Drawing.Point(18, 17);
- this.checkBox6.Name = "checkBox6";
- this.checkBox6.Size = new System.Drawing.Size(15, 14);
- 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.Location = new System.Drawing.Point(250, 59);
- this.btnDisplay.Name = "btnDisplay";
- this.btnDisplay.Size = new System.Drawing.Size(85, 20);
- 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.Location = new System.Drawing.Point(260, 33);
- this.btnColour.Name = "btnColour";
- this.btnColour.Size = new System.Drawing.Size(75, 20);
- this.btnColour.TabIndex = 9;
- this.btnColour.UseVisualStyleBackColor = true;
- this.btnColour.Click += new System.EventHandler(this.btnColour_Click);
- //
- // checkBox5
- //
- this.checkBox5.AutoSize = true;
- this.checkBox5.Location = new System.Drawing.Point(18, 63);
- this.checkBox5.Name = "checkBox5";
- this.checkBox5.Size = new System.Drawing.Size(15, 14);
- this.checkBox5.TabIndex = 8;
- this.checkBox5.UseVisualStyleBackColor = true;
- this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
- //
- // checkBox4
- //
- this.checkBox4.AutoSize = true;
- this.checkBox4.Location = new System.Drawing.Point(18, 40);
- this.checkBox4.Name = "checkBox4";
- this.checkBox4.Size = new System.Drawing.Size(15, 14);
- this.checkBox4.TabIndex = 7;
- this.checkBox4.UseVisualStyleBackColor = true;
- this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
- //
- // 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(152, 348);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(358, 65);
- this.groupBox5.TabIndex = 23;
- 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(182, 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(280, 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.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(9, 67);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(0, 12);
- this.label3.TabIndex = 9;
- //
- // checkBox3
- //
- this.checkBox3.AutoSize = true;
- this.checkBox3.Location = new System.Drawing.Point(18, 14);
- this.checkBox3.Name = "checkBox3";
- this.checkBox3.Size = new System.Drawing.Size(15, 14);
- this.checkBox3.TabIndex = 0;
- this.checkBox3.UseVisualStyleBackColor = true;
- this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_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, 61);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(692, 692);
- this.groupBox3.TabIndex = 22;
- 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, 61);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(135, 693);
- this.groupBox2.TabIndex = 21;
- 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, 670);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
- this.listView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDown);
- //
- // 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.button3);
- this.groupBox1.Controls.Add(this.button4);
- 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(1196, 50);
- this.groupBox1.TabIndex = 20;
- 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.Location = new System.Drawing.Point(1016, 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.AutoSize = true;
- this.checkBox1.Location = new System.Drawing.Point(141, 21);
- this.checkBox1.Name = "checkBox1";
- this.checkBox1.Size = new System.Drawing.Size(15, 14);
- 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.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);
- //
- // button3
- //
- this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button3.Location = new System.Drawing.Point(1106, 14);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(84, 30);
- this.button3.TabIndex = 21;
- this.button3.Text = "保存全部";
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // button4
- //
- this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button4.Location = new System.Drawing.Point(926, 14);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(84, 30);
- this.button4.TabIndex = 20;
- this.button4.Text = "应用全部";
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // PearliteNumberDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1222, 967);
- this.Controls.Add(this.groupBox7);
- this.Controls.Add(this.groupBox9);
- this.Controls.Add(this.groupBox8);
- this.Controls.Add(this.groupBox6);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Name = "PearliteNumberDialog";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InclusionsStandardDialog_FormClosing);
- this.Load += new System.EventHandler(this.GrainSizeDialog_Load);
- this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox3, 0);
- this.Controls.SetChildIndex(this.groupBox5, 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.groupBox7.ResumeLayout(false);
- this.groupBox7.PerformLayout();
- ((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.groupBox6.PerformLayout();
- this.groupBox5.ResumeLayout(false);
- this.groupBox5.PerformLayout();
- ((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.groupBox2.ResumeLayout(false);
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- 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 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;
- 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;
- #endregion
- public static PearliteNumberDialog pearliteNumberDialog;
- /// <summary>
- /// 调色板
- /// </summary>
- PaintDotNet.ColorsForm colorsForm1;
- PaintDotNet.ColorsForm colorsForm2;
- /// <summary>
- /// 主控件
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 图像面板
- /// </summary>
- public DocumentWorkspaceWindow documentWorkspace;
- /// <summary>
- /// 公共按钮
- /// </summary>
- private CommonControlButtons commonControlButtons;
- /// <summary>
- /// 选中图片的bitmap
- /// </summary>
- private Bitmap bitmap;
- /// <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 mat;
- /// <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>
- 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;
- /// <summary>
- /// 类型(球铁-1,蠕铁GBT26656-2,蠕铁JBT3829-3)
- /// </summary>
- private int IronType = 0;
- private int defaultIndex = -1;
- private bool isExportResults = false;
- private bool isExportReports = false;
- private bool isExportProjects = false;
- /// <summary>
- /// 是否脚本运行
- /// </summary>
- private Boolean initScriptValues = false;
- /// <summary>
- /// 保存窗口参数
- /// </summary>
- /// <summary>
- /// 各个图片对应数据
- /// </summary>
- private Dictionary<string, GrainSizeAnalysisModel> eachData = new Dictionary<string, GrainSizeAnalysisModel>();
- 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_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;
- //二值化集成1
- BinaryClass binaryClass;
- private Button button3;
- private Button button4;
- private int menuId;
- private string menuName;
- #endregion
- public PearliteNumberDialog(AppWorkspace appWorkspace, int type, PdnMenuItem menuItem)
- {
- this.menuId = menuItem.MenuId;
- this.menuName = menuItem.Text;
- binaryClass = new BinaryClass(menuId);
- IronType = type;
- pearliteNumberDialog = this;
- this.appWorkspace = appWorkspace;
- NullKey();
- InitializeComponent();
- InitializeLanguageText();
- InitColour();
- InitPicList();
- InitOtherTools();
- InitCommonButtonEvent();
- InitGridHeader();
-
- if (IronType == 1)
- {
- SetAnalyzeModelFromXml("Template.Manager.item3.DuctileIronGBT9441Pearlite");
- this.Text = "GBT9441-2009("+ PdnResources.GetString("Menu.Numberofpearlite.Text")+ ")";
- }
- else if (IronType == 2)
- {
- SetAnalyzeModelFromXml("Template.Manager.item3.VermiculateCastGBT26656PN");
- this.Text = "GBT26656-2011("+ PdnResources.GetString("Menu.Numberofpearlite.Text")+ ")";
- }
- else if (IronType == 3)
- {
- SetAnalyzeModelFromXml("Template.Manager.item3.VermiculateCastJBT3829PN");
- this.Text = "JBT3829_1999("+ PdnResources.GetString("Menu.Numberofpearlite.Text")+ ")";
- }
-
- }
- //private void ShowImg()
- //{
- // var chooseImg = this.appWorkspace.DocumentWorkspaces.Where(m => m.Focused == true).FirstOrDefault();
- // if (chooseImg != null)
- // {
- // if (chooseImg.FilePath != null)
- // {
- // var name = chooseImg.FilePath.Split('\\')[chooseImg.FilePath.Split('\\').Length - 1];
- // var index = listView1.Items.IndexOfKey(name);
- // if (index != -1)
- // {
- // this.defaultIndex = index;
- // }
- // }
- // }
- // this.Shown += ShowImgEvent;
- //}
- 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;
- //如果是脚本执行,将参数带入
- 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
- {//读取上次关闭窗口时保存的参数
- GetXmlParameter();
- GetListParamModel();
- }
- if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
- this.startScriptAutomaticAction();
- }
- }
- /// <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 = 130;
- DataGridViewTextBoxColumn h2 = new DataGridViewTextBoxColumn();
- h2.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h2.Width = 130;
- DataGridViewTextBoxColumn h3 = new DataGridViewTextBoxColumn();
- h3.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h3.Width = 130;
- this.dataGridView1.Columns.Add(h1);
- this.dataGridView1.Columns.Add(h2);
- this.dataGridView1.Columns.Add(h3);
- 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, PdnResources.GetString("Menu.Numberofpearlite.Text")+"(%)"));
- helper.Headers.Add(new DataGridViewHelper.TopHeader(2, 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.AllowUserToResizeRows = false;
- this.dataGridView1.AllowUserToResizeColumns = false;
- //
- //分析结果表
- //
- this.dataGridView2.ColumnHeadersHeight = 30;
- DataGridViewTextBoxColumn h11 = new DataGridViewTextBoxColumn();
- //h11.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h11.Width = 187;
- DataGridViewTextBoxColumn h12 = new DataGridViewTextBoxColumn();
- //h12.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h12.Width = 187;
- DataGridViewTextBoxColumn h13 = new DataGridViewTextBoxColumn();
- //h13.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h13.Width = 187;
- DataGridViewTextBoxColumn h14 = new DataGridViewTextBoxColumn();
- //h14.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h14.Width = 187;
- this.dataGridView2.Columns.Add(h11);
- this.dataGridView2.Columns.Add(h12);
- this.dataGridView2.Columns.Add(h13);
- this.dataGridView2.Columns.Add(h14);
- 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, PdnResources.GetString("Menu.Numberofpearlite.Text")+"(%)"));
- helper2.Headers.Add(new DataGridViewHelper.TopHeader(3, 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.AllowUserToResizeRows = false;
- this.dataGridView2.AllowUserToResizeColumns = false;
- this.dataGridView3.ColumnHeadersHeight = 30;
- DataGridViewTextBoxColumn h22 = new DataGridViewTextBoxColumn();
- //h22.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h22.Width = 187;
- DataGridViewTextBoxColumn h23 = new DataGridViewTextBoxColumn();
- //h23.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h23.Width = 187;
- DataGridViewTextBoxColumn h24 = new DataGridViewTextBoxColumn();
- //h24.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h24.Width = 187;
- DataGridViewTextBoxColumn h25 = new DataGridViewTextBoxColumn();
- //h25.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h25.Width = 187;
- this.dataGridView3.Columns.Add(h22);
- this.dataGridView3.Columns.Add(h23);
- this.dataGridView3.Columns.Add(h24);
- this.dataGridView3.Columns.Add(h25);
- 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, PdnResources.GetString("Menu.Numberofpearlite.Text")+"(%)"));
- helper3.Headers.Add(new DataGridViewHelper.TopHeader(3, 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.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.eachData[GetImgKey()].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();
- if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
- this.startScriptAutomaticAction();
- }
- 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 = null;
- if (IronType == 1)
- {
- metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.DuctileIronGBT9441Pearlite");
- }
- else if (IronType == 2)
- {
- metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.VermiculateCastGBT26656PN");
- }
- else if (IronType == 3)
- {
- metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.VermiculateCastJBT3829PN");
- }
- 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);
- GetListParamModel();
- sum = 0;
- if (this.checkBox5.Checked)
- {
- this.documentWorkspace.panel.Paint -= new PaintEventHandler(this.BoxPaintHandler);
- }
- this.dataGridView1.Rows.Clear();
- if (this.documentWorkspace.PhaseModels.Count > 1)
- this.documentWorkspace.PhaseModels.Remove(this.documentWorkspace.PhaseModels[1]);
- this.commonControlButtons.Visible = true;
- this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList;
- this.bitmap = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- //总面积
- picArea = AnalysisTools.GetPointsFromMat(BitmapConverter.ToMat(this.bitmap));
- changeColor = false;
- phaseModel = new PhaseModel();//同上
- phaseModel.choise = true;
- //二值化集成4
- binaryClass.listView1_SelectedIndexChangedNoCheckedChanged(this.bitmap, this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]);
- 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[0].choise = false;
- this.documentWorkspace.phaseModels.Add(phaseModel);
- if (sum == 0)
- {
- if (bcOriginChecked() || !bcBinaryChecked())
- {
- phaseModel.choise = false;
- }
- ResetAreaAndContent();
- ReloadDebrisSelection();
- }
- else
- {
- if (bcOriginChecked() || !bcBinaryChecked())
- {
- phaseModel.choise = false;
- }
- else
- {
- phaseModel.choise = true;
-
- }
- this.documentWorkspace.Refresh();
- }
- sum = 0;
- }
- }
- Mat temp;//中间变量
- List<List<OpenCvSharp.Point>> ps;//轮廓的拓扑信息
- DataTable dtDataGridView1 = null;
- DataTable dtResult = null;
- AppCommon appCommon = new AppCommon();
- List<double> lstScreenArea;//珠光体面积集合
- List<double> lstScreenAreaRatio;//珠光体面积率集合
- /// <summary>
- /// 刷新颗粒筛选颜色面积率效果
- /// </summary>
- private void ReloadDebrisSelection()
- {
- if (binarizationMat != null && bcBinaryChecked())
- {
- this.dataGridView1.Rows.Clear();
-
- 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>>();
- //记录视场珠光体含量总和
- double pearliteNumSum = 0;
- lstScreenArea = new List<double>();//珠光体面积集合
- lstScreenAreaRatio = 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 totalAreaSum = 0;//面积总数
- double screenArea = 0;//筛选的面积
- 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; //外接圆半径
- 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;
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- screenArea += area;
- }
- else
- {
- lstScreenArea.Add(area * unitLength * unitLength);
- lstScreenAreaRatio.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)
- {
- totalAreaSum += area;
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- screenArea += area;
- }
- else
- {
- lstScreenArea.Add(area * unitLength * unitLength);
- lstScreenAreaRatio.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)
- {
- totalAreaSum += area;
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- screenArea += area;
- }
- else
- {
- lstScreenArea.Add(area * unitLength * unitLength);
- lstScreenAreaRatio.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)
- {
- totalAreaSum += area;
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- screenArea += area;
- }
- else
- {
- lstScreenArea.Add(area * unitLength * unitLength);
- lstScreenAreaRatio.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());
- }
- }
- }
- }
- }
- string level = string.Empty; //珠光体级别
- double pearliteNum = (totalAreaSum - screenArea) / (lstAttribute[h - 1][4] - screenArea); //珠光体数量
- if (IronType == 1)
- {
- if (pearliteNum > 0.9)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "95";
- }
- else if (pearliteNum > 0.8 && pearliteNum <= 0.9)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "85";
- }
- else if (pearliteNum > 0.7 && pearliteNum <= 0.8)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "75";
- }
- else if (pearliteNum > 0.6 && pearliteNum <= 0.7)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "65";
- }
- else if (pearliteNum > 0.5 && pearliteNum <= 0.6)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "55";
- }
- else if (pearliteNum > 0.4 && pearliteNum <= 0.5)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "45";
- }
- else if (pearliteNum > 0.3 && pearliteNum <= 0.4)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "35";
- }
- else if (pearliteNum > 0.25 && pearliteNum <= 0.3)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "25";
- }
- else if (pearliteNum > 0.2 && pearliteNum <= 0.25)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "20";
- }
- else if (pearliteNum > 0.15 && pearliteNum <= 0.2)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "15";
- }
- else if (pearliteNum > 0.1 && pearliteNum <= 0.15)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "10";
- }
- else if (pearliteNum > 0 && pearliteNum <= 0.1)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "5";
- }
- else
- {
- level = "-";
- }
- }
- else
- {
- if (pearliteNum > 0.9)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "95";
- }
- else if (pearliteNum > 0.8 && pearliteNum <= 0.9)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "85";
- }
- else if (pearliteNum > 0.7 && pearliteNum <= 0.8)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "75";
- }
- else if (pearliteNum > 0.6 && pearliteNum <= 0.7)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "65";
- }
- else if (pearliteNum > 0.5 && pearliteNum <= 0.6)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "55";
- }
- else if (pearliteNum > 0.4 && pearliteNum <= 0.5)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "45";
- }
- else if (pearliteNum > 0.3 && pearliteNum <= 0.4)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "35";
- }
- else if (pearliteNum > 0.2 && pearliteNum <= 0.3)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "25";
- }
- else if (pearliteNum > 0.1 && pearliteNum <= 0.2)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "15";
- }
- else if (pearliteNum > 0 && pearliteNum <= 0.1)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "5";
- }
- else
- {
- level = "-";
- }
- }
-
- this.dataGridView1.Rows.Add($"{PdnResources.GetString("Menu.view.text")}{h}", pearliteNum * 100, level);
- pearliteNumSum += pearliteNum;
- }
- if (sumFieldl > 1)
- {
- string avgLevel = string.Empty;
- double avgPearliteNum = pearliteNumSum / sumFieldl;
- if (IronType == 1)
- {
- if (avgPearliteNum > 0.9)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "95";
- }
- else if (avgPearliteNum > 0.8 && avgPearliteNum <= 0.9)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "85";
- }
- else if (avgPearliteNum > 0.7 && avgPearliteNum <= 0.8)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "75";
- }
- else if (avgPearliteNum > 0.6 && avgPearliteNum <= 0.7)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "65";
- }
- else if (avgPearliteNum > 0.5 && avgPearliteNum <= 0.6)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "55";
- }
- else if (avgPearliteNum > 0.4 && avgPearliteNum <= 0.5)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "45";
- }
- else if (avgPearliteNum > 0.3 && avgPearliteNum <= 0.4)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "35";
- }
- else if (avgPearliteNum > 0.25 && avgPearliteNum <= 0.3)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "25";
- }
- else if (avgPearliteNum > 0.2 && avgPearliteNum <= 0.25)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "20";
- }
- else if (avgPearliteNum > 0.15 && avgPearliteNum <= 0.2)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "15";
- }
- else if (avgPearliteNum > 0.1 && avgPearliteNum <= 0.15)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "10";
- }
- else if (avgPearliteNum > 0 && avgPearliteNum <= 0.1)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "5";
- }
- else
- {
- avgLevel = "-";
- }
- }
- else
- {
- if (avgPearliteNum > 0.9)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "95";
- }
- else if (avgPearliteNum > 0.8 && avgPearliteNum <= 0.9)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "85";
- }
- else if (avgPearliteNum > 0.7 && avgPearliteNum <= 0.8)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "75";
- }
- else if (avgPearliteNum > 0.6 && avgPearliteNum <= 0.7)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "65";
- }
- else if (avgPearliteNum > 0.5 && avgPearliteNum <= 0.6)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "55";
- }
- else if (avgPearliteNum > 0.4 && avgPearliteNum <= 0.5)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "45";
- }
- else if (avgPearliteNum > 0.3 && avgPearliteNum <= 0.4)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "35";
- }
- else if (avgPearliteNum > 0.2 && avgPearliteNum <= 0.3)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "25";
- }
- else if (avgPearliteNum > 0.1 && avgPearliteNum <= 0.2)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "15";
- }
- else if (avgPearliteNum > 0 && avgPearliteNum <= 0.1)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "5";
- }
- else
- {
- avgLevel = "-";
- }
- }
- this.dataGridView1.Rows.Add(PdnResources.GetString("Menu.Image.Average.Text"), 100 * avgPearliteNum, avgLevel);
- }
- }
- else
- {
- OpenCvSharp.Point[][] contours;//原始轮廓信息
- HierarchyIndex[] hierachy;
- Mat tempCopy = BinaryClass.BGRA2GRAY(binarizationMat);
- Cv2.FindContours(BinaryClass.BGRA2GRAY(binarizationMat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone);
- double totalAreaSum = 0;//面积总数
- double screenArea = 0;
- for (int i = 0; i < hierachy.Length; i++)
- {
- if (hierachy[i].Parent == -1)
- {
- double radius; //外接圆半径
- 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;
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- screenArea += area;
- }
- else
- {
- lstScreenArea.Add(area * unitLength * unitLength);
- lstScreenAreaRatio.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)
- {
- totalAreaSum += area;
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- screenArea += area;
- }
- else
- {
- lstScreenArea.Add(area * unitLength * unitLength);
- lstScreenAreaRatio.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)
- {
- totalAreaSum += area;
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- screenArea += area;
- }
- else
- {
- lstScreenArea.Add(area * unitLength * unitLength);
- lstScreenAreaRatio.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)
- {
- totalAreaSum += area;
- if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
- {
- screenArea += area;
- }
- else
- {
- lstScreenArea.Add(area * unitLength * unitLength);
- lstScreenAreaRatio.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());
- }
- }
- }
- }
- }
- }
- string level = string.Empty; //球化级别
- double pearliteNum = (totalAreaSum - screenArea) / (picArea - screenArea); //珠光体数量
- if (IronType == 1)
- {
- if (pearliteNum > 0.9)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "95";
- }
- else if (pearliteNum > 0.8 && pearliteNum <= 0.9)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "85";
- }
- else if (pearliteNum > 0.7 && pearliteNum <= 0.8)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "75";
- }
- else if (pearliteNum > 0.6 && pearliteNum <= 0.7)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "65";
- }
- else if (pearliteNum > 0.5 && pearliteNum <= 0.6)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "55";
- }
- else if (pearliteNum > 0.4 && pearliteNum <= 0.5)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "45";
- }
- else if (pearliteNum > 0.3 && pearliteNum <= 0.4)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "35";
- }
- else if (pearliteNum > 0.25 && pearliteNum <= 0.3)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "25";
- }
- else if (pearliteNum > 0.2 && pearliteNum <= 0.25)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "20";
- }
- else if (pearliteNum > 0.15 && pearliteNum <= 0.2)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "15";
- }
- else if (pearliteNum > 0.1 && pearliteNum <= 0.15)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "10";
- }
- else if (pearliteNum > 0 && pearliteNum <= 0.1)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "5";
- }
- else
- {
- level = "-";
- }
- }
- else
- {
- if (pearliteNum > 0.9)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "95";
- }
- else if (pearliteNum > 0.8 && pearliteNum <= 0.9)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "85";
- }
- else if (pearliteNum > 0.7 && pearliteNum <= 0.8)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "75";
- }
- else if (pearliteNum > 0.6 && pearliteNum <= 0.7)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "65";
- }
- else if (pearliteNum > 0.5 && pearliteNum <= 0.6)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "55";
- }
- else if (pearliteNum > 0.4 && pearliteNum <= 0.5)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "45";
- }
- else if (pearliteNum > 0.3 && pearliteNum <= 0.4)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "35";
- }
- else if (pearliteNum > 0.2 && pearliteNum <= 0.3)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "25";
- }
- else if (pearliteNum > 0.1 && pearliteNum <= 0.2)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "15";
- }
- else if (pearliteNum > 0 && pearliteNum <= 0.1)
- {
- level = PdnResources.GetString("Menu.bead.Text") + "5";
- }
- else
- {
- level = "-";
- }
- }
- if (pointList.Count > 0)
- {
- this.dataGridView1.Rows.Add(PdnResources.GetString("Menu.view.text")+"1", pearliteNum * 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()
- {
- //this.documentWorkspace.PhaseModels[0].choise = false;
- //填充颜色
- if (this.checkBox4.Checked)
- {
- Mat[] arr = temp.Split();
- temp = temp.CvtColor(ColorConversionCodes.BGRA2BGR);
- for (int i = 0; i < lstPoint08_1.Count; i++)
- {
- int length = Cv2.FloodFill(temp, lstPoint08_1[i][lstPoint08_1[i].Count - 1], new Scalar(colour["panelColour1_08"].B, colour["panelColour1_08"].G, colour["panelColour1_08"].R));
- }
- for (int i = 0; i < lstPoint06_08.Count; i++)
- {
- int length = Cv2.FloodFill(temp, lstPoint06_08[i][lstPoint06_08[i].Count - 1], new Scalar(colour["panelColour08_06"].B, colour["panelColour08_06"].G, colour["panelColour08_06"].R));
- }
- for (int i = 0; i < lstPoint04_06.Count; i++)
- {
- int length = Cv2.FloodFill(temp, lstPoint04_06[i][lstPoint04_06[i].Count - 1], new Scalar(colour["panelColour06_04"].B, colour["panelColour06_04"].G, colour["panelColour06_04"].R));
- }
- for (int i = 0; i < lstPoint02_04.Count; i++)
- {
- int length = Cv2.FloodFill(temp, lstPoint02_04[i][lstPoint02_04[i].Count - 1], new Scalar(colour["panelColour04_02"].B, colour["panelColour04_02"].G, colour["panelColour04_02"].R));
- }
- for (int i = 0; i < lstPoint01_02.Count; i++)
- {
- int length = Cv2.FloodFill(temp, lstPoint01_02[i][lstPoint01_02[i].Count - 1], new Scalar(colour["panelColour02_01"].B, colour["panelColour02_01"].G, colour["panelColour02_01"].R));
- }
- for (int i = 0; i < lstPoint0_01.Count; i++)
- {
- int length = Cv2.FloodFill(temp, lstPoint0_01[i][lstPoint0_01[i].Count - 1], new Scalar(colour["panelColour01_0"].B, colour["panelColour01_0"].G, colour["panelColour01_0"].R));
- }
- 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 tempCopy = BinaryClass.BGRA2GRAY(binarizationMat);
- //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;//外接圆半径
- double area = 0;
- for (int i = 0; i < hierachy.Length; i++)
- {
- if (hierachy[i].Parent == -1)
- {
- area = appCommon.Area(tempCopy, contours[i][0]);
- if (maxArea < area)
- maxArea = area;
- if (minArea > area)
- minArea = area;
- }
- 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)
- {
- 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();
- }
- DialogResult dr;
- /// <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 (!blSaveAll && item.Name.Equals(tag))
- {
- dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text") + "?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- break;
- }
- }
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (item.Name.Equals(tag))
- {
- if (dr == DialogResult.OK || blSaveAll)
- {
- 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"));
- columnName.Add(PdnResources.GetString("Menu.Pearlitearea.Text"));
- columnName.Add(PdnResources.GetString("Menu.Pearliteareay.Text"));
- dataList.Add(columnName);
- if (this.lstScreenArea.Count > 0)
- {
- for (int i = 0; i < this.lstScreenArea.Count; i++)
- {
- List<string> strList = new List<string>();
- strList.Add((i + 1).ToString());
- strList.Add(this.lstScreenArea[i].ToString());
- strList.Add(this.lstScreenAreaRatio[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 == 2)
- {
- 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> lstPearliteNum = new List<double>();
- //综合平均值
- double avgPearliteNum = 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 == 3)
- {
- 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)
- {
- lstPearliteNum.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 == 3)
- {
- 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)
- {
- lstPearliteNum.Add(double.Parse(row[j].ToString()));
- }
- }
- }
- h++;
- }
- }
- }
- }
- }
- }
- if (dataGridView2.Rows.Count > 0)
- {
- if (lstPearliteNum.Count > 0)
- {
- avgPearliteNum = (double)lstPearliteNum.Average();
- }
- string avgLevel = string.Empty;
- if (IronType == 1)
- {
- if (avgPearliteNum / 100 > 0.9)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "95";
- }
- else if (avgPearliteNum / 100 > 0.8 && avgPearliteNum / 100 <= 0.9)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "85";
- }
- else if (avgPearliteNum / 100 > 0.7 && avgPearliteNum / 100 <= 0.8)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "75";
- }
- else if (avgPearliteNum / 100 > 0.6 && avgPearliteNum / 100 <= 0.7)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "65";
- }
- else if (avgPearliteNum / 100 > 0.5 && avgPearliteNum / 100 <= 0.6)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "55";
- }
- else if (avgPearliteNum / 100 > 0.4 && avgPearliteNum / 100 <= 0.5)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "45";
- }
- else if (avgPearliteNum / 100 > 0.3 && avgPearliteNum / 100 <= 0.4)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "35";
- }
- else if (avgPearliteNum / 100 > 0.25 && avgPearliteNum / 100 <= 0.3)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "25";
- }
- else if (avgPearliteNum / 100 > 0.2 && avgPearliteNum / 100 <= 0.25)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "20";
- }
- else if (avgPearliteNum / 100 > 0.15 && avgPearliteNum / 100 <= 0.2)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "15";
- }
- else if (avgPearliteNum / 100 > 0.1 && avgPearliteNum / 100 <= 0.15)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "10";
- }
- else if (avgPearliteNum / 100 > 0 && avgPearliteNum / 100 <= 0.1)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "5";
- }
- else
- {
- avgLevel = "-";
- }
- }
- else
- {
- if (avgPearliteNum / 100 > 0.9)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "95";
- }
- else if (avgPearliteNum / 100 > 0.8 && avgPearliteNum / 100 <= 0.9)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "85";
- }
- else if (avgPearliteNum / 100 > 0.7 && avgPearliteNum / 100 <= 0.8)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "75";
- }
- else if (avgPearliteNum / 100 > 0.6 && avgPearliteNum / 100 <= 0.7)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "65";
- }
- else if (avgPearliteNum / 100 > 0.5 && avgPearliteNum / 100 <= 0.6)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "55";
- }
- else if (avgPearliteNum / 100 > 0.4 && avgPearliteNum / 100 <= 0.5)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "45";
- }
- else if (avgPearliteNum / 100 > 0.3 && avgPearliteNum / 100 <= 0.4)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "35";
- }
- else if (avgPearliteNum / 100 > 0.2 && avgPearliteNum / 100 <= 0.3)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "25";
- }
- else if (avgPearliteNum / 100 > 0.1 && avgPearliteNum / 100 <= 0.2)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "15";
- }
- else if (avgPearliteNum / 100 > 0 && avgPearliteNum / 100 <= 0.1)
- {
- avgLevel = PdnResources.GetString("Menu.bead.Text") + "5";
- }
- else
- {
- avgLevel = "-";
- }
- }
- this.dataGridView3.Rows.Add(PdnResources.GetString("Menu.comprehensive.text"), PdnResources.GetString("Menu.Comprehensivaverage.text"), Math.Round(double.Parse(string.IsNullOrEmpty(avgPearliteNum.ToString()) ? "0" : avgPearliteNum.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 (dataGridView2.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text")+"!");
- return;
- }
- 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(PdnResources.GetString("Menu.Numberofpearlite.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());
- 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());
- 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 (dataGridView2.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text")+"!");
- return;
- }
- 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(PdnResources.GetString("Menu.Numberofpearlite.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());
- 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());
- 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);
-
- if (IronType == 1)
- {
- exe.FileName = PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.DuctileIron.Text")+"(GBT9441" + PdnResources.GetString("Menu.Numberofpearlite.Text")+ ")" + PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddHHmmss");
- }
- else if (IronType == 2)
- {
- exe.FileName = PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.VermiculateCastIron.Text")+"(GBT26656" + PdnResources.GetString("Menu.Numberofpearlite.Text")+ ")" + PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddHHmmss");
- }
- else if (IronType == 3)
- {
- exe.FileName = PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.VermiculateCastIron.Text")+"(JBT3829" + PdnResources.GetString("Menu.Numberofpearlite.Text")+ ")" + PdnResources.GetString("Menu.Analysisresult.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(PdnResources.GetString("Menu.Numberofpearlite.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[PdnResources.GetString("Menu.Numberofpearlite.Text")+"(%)"] = this.dataGridView2.Rows[i].Cells[2].Value;
- dataRow[PdnResources.GetString("Menu.Levelname.text")] = this.dataGridView2.Rows[i].Cells[3].Value;
- dtb.Rows.Add(dataRow);
- }
- for (int i = 0; i < this.dataGridView3.Rows.Count; i++)
- {
- DataRow dataRow = dtb.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[PdnResources.GetString("Menu.Numberofpearlite.Text") + "(%)"] = this.dataGridView3.Rows[i].Cells[2].Value;
- dataRow[PdnResources.GetString("Menu.Levelname.text")] = this.dataGridView3.Rows[i].Cells[3].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(PdnResources.GetString("Menu.Numberofpearlite.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[PdnResources.GetString("Menu.Numberofpearlite.Text")+"(%)"] = this.dataGridView3.Rows[i].Cells[2].Value;
- // dataRow[PdnResources.GetString("Menu.Levelname.text")] = this.dataGridView3.Rows[i].Cells[3].Value;
- // dtb1.Rows.Add(dataRow);
- //}
- List<DataTable> list = new List<DataTable>();
- list.Add(dtb);
- //list.Add(dtb1);
- this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, 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;
- }
- }
- #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;
- if (!this.eachData.ContainsKey(GetImgKey()))
- {
- 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();
- analysisItem.ListParam = new List<GrainSizeAnalysisModel>();
- analysisItem.ListParam.Add(analysisItem);
- this.eachData.Add(GetImgKey(), analysisItem);
- }
- foreach (var item in this.eachData[GetImgKey()].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.eachData[GetImgKey()].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_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.eachData.ContainsKey(GetImgKey()) && this.eachData[GetImgKey()] != null)
- {
- for (int i = 0; i < this.eachData[GetImgKey()].ListParam.Count; i++)
- {
- switch (this.eachData[GetImgKey()].ListParam[i].param_key)
- {
- case ParamKey_Report:
- checkBox1.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
- break;
- case ParamKey_Screen:
- checkBox3.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
- break;
- case ParamKey_ScreenMin:
- areaMin = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
- break;
- case ParamKey_ScreenMax:
- areaMax = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
- break;
- case ParamKey_Diameter:
- checkBox6.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
- break;
- case ParamKey_Colour:
- checkBox4.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
- break;
- case ParamKey_AreaRatio:
- checkBox5.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
- break;
- case ParamKey_AreaRatioRangeMin:
- areaRatioRangeMin = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
- break;
- case ParamKey_AreaRatioRangeMax:
- areaRatioRangeMax = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
- break;
- case ParamKey_DecimalPlace:
- numericUpDown1.Value = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
- break;
- case ParamKey_panelColour1_08:
- colour.Remove(ParamKey_panelColour1_08);
- colour.Add(ParamKey_panelColour1_08, Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value));
- break;
- case ParamKey_panelColour08_06:
- colour.Remove(ParamKey_panelColour08_06);
- colour.Add(ParamKey_panelColour08_06, Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value));
- break;
- case ParamKey_panelColour06_04:
- colour.Remove(ParamKey_panelColour06_04);
- colour.Add(ParamKey_panelColour06_04, Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value));
- break;
- case ParamKey_panelColour04_02:
- colour.Remove(ParamKey_panelColour04_02);
- colour.Add(ParamKey_panelColour04_02, Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value));
- break;
- case ParamKey_panelColour02_01:
- colour.Remove(ParamKey_panelColour02_01);
- colour.Add(ParamKey_panelColour02_01, Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value));
- break;
- case ParamKey_panelColour01_0:
- colour.Remove(ParamKey_panelColour01_0);
- colour.Add(ParamKey_panelColour01_0, Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value));
- break;
- case ParamKey_FontSize:
- fontSize = this.eachData[GetImgKey()].ListParam[i].value.ToString();
- break;
- case ParamKey_FontColour:
- fontColour = Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value);
- break;
- }
- }
- colourFont.Clear();
- colourFont.Add(fontSize, fontColour);
- }
- }
- /// <summary>
- /// 获取XML保存的参数
- /// </summary>
- private void GetXmlParameter()
- {
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
-
- for (int i = 0; i < listView1.Items.Count; i++)
- {
- if (this.eachData.ContainsKey(listView1.Items[i].Index.ToString()))
- {
- this.eachData[listView1.Items[i].Index.ToString()] = analysisModelXml.cloneListParamModel(this.menuId);
- }
- else
- {
- this.eachData.Add(listView1.Items[i].Index.ToString(), analysisModelXml.cloneListParamModel(this.menuId));
- }
- }
- foreach (var item in this.eachData[GetImgKey()].ListParam)
- item.setValue();
- }
- /// <summary>
- /// 保存参数,防止没有图片
- /// </summary>
- private void NullKey()
- {
- GrainSizeAnalysisModel grainsizeanalysismodel = new GrainSizeAnalysisModel();
- grainsizeanalysismodel.ListParam = new List<GrainSizeAnalysisModel>();
- this.eachData.Add("null", grainsizeanalysismodel);
- }
- private string GetImgKey()
- {
- string key = this.listView1.FocusedItem != null ? this.listView1.FocusedItem.Index.ToString() : "null";
- return key;
- }
- #endregion
- private void button4_Click(object sender, EventArgs e)
- {
- if (this.listView1.FocusedItem == null)
- {
- return;
- }
- binaryClass.saveParams();
- binaryClass.applyToAll(this.imageList1.Images.Keys, this.imageList1.Images.Keys[int.Parse(GetImgKey())]);
- saveDialogParamValues();
- GrainSizeAnalysisModel data = new GrainSizeAnalysisModel();
- if (eachData.ContainsKey(GetImgKey()))
- {
- data = eachData[GetImgKey()];
- }
- for (int i = 0; i < listView1.Items.Count; i++)
- {
- eachData[i.ToString()] = data.cloneListParamModel(this.menuId);
- this.listView1.EnsureVisible(i);
- this.listView1.Items[i].Focused = true;
- this.listView1.Items[i].Selected = true;
- }
- }
- private bool blSaveAll = false;
- private void button3_Click(object sender, EventArgs e)
- {
- if (this.listView1.FocusedItem == null)
- {
- return;
- }
- if (eachData.Count - 1 != listView1.Items.Count)
- {
- MessageBox.Show("请先点击应用全部!");
- return;
- }
- saveDialogParamValues();
- int current = int.Parse(GetImgKey());
- for (int i = 0; i < listView1.Items.Count; i++)
- {
- this.listView1.EnsureVisible(i);
- this.listView1.Items[i].Focused = true;
- this.listView1.Items[i].Selected = true;
- this.button2.PerformClick();
- blSaveAll = true;
- }
- this.listView1.EnsureVisible(current);
- this.listView1.Items[current].Focused = true;
- this.listView1.Items[current].Selected = true;
- blSaveAll = false;
- }
- private void listView1_MouseDown(object sender, MouseEventArgs e)
- {
- if (this.listView1.FocusedItem != null)
- saveDialogParamValues();
- }
- #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);
- }
- this.documentWorkspace.Refresh();
- 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;
- case "ExportResults":
- isExportResults = Convert.ToBoolean(value);
- break;
- case "ExportReports":
- isExportReports = Convert.ToBoolean(value);
- break;
- case "ExportProjects":
- isExportProjects = Convert.ToBoolean(value);
- break;
- }
- }
- private void startScriptAutomaticAction()
- {
- this.button4.PerformClick();
- this.button3.PerformClick();
- this.button6.Text = PdnResources.GetString("Menu.Cancelshowall.text");
- this.showAll = true;
- RefreshDataGridView2();
- if (isExportResults)//导出结果
- this.button9.PerformClick();
- if (isExportReports)//生成报告
- this.button8.PerformClick();
- if (isExportProjects)//导出项目
- this.button1.PerformClick();
- this.appWorkspace.ScriptAutomatic = false;
- this.Close();
- }
- #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 = colourFont.First().Key;
- break;
- case "parameter8":
- value = colourFont.First().Value.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 = isExportResults;
- break;
- case "ExportReports":
- value = isExportReports;
- break;
- case "ExportProjects":
- value = isExportProjects;
- break;
- }
- return value;
- }
- #endregion
- }
- }
|