1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490 |
- using Metis.ParameterSet;
- using OpenCvSharp;
- using PaintDotNet.Annotation;
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Annotation.Label;
- using PaintDotNet.Annotation.PhysicalPhaseAction;
- using PaintDotNet.Base;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.Base.Functionodel;
- using PaintDotNet.Base.SettingModel;
- using PaintDotNet.CustomControl;
- using PaintDotNet.Data.Param;
- using PaintDotNet.DbOpreate.DbBll;
- using PaintDotNet.DbOpreate.DbModel;
- using PaintDotNet.GeneralAnalysis;
- using PaintDotNet.GeneralAnalysis.AnalysisResultTemplate;
- using PaintDotNet.Instrument;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Windows.Forms;
- using static PaintDotNet.Base.SettingModel.LabelStyleModel;
- namespace PaintDotNet.DedicatedAnalysis.Porosity
- {
- internal class PV1112Dialog : PdnBaseForm
- {
- #region 控件
- private System.Windows.Forms.GroupBox groupBox4;
- private System.Windows.Forms.ListView listView1;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.Button button2;
- private System.Windows.Forms.Button button5;
- private System.Windows.Forms.CheckBox checkBox1;
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.GroupBox groupBox_review;
- private System.Windows.Forms.GroupBox groupBox5;
- private System.Windows.Forms.GroupBox groupBox6;
- private System.Windows.Forms.GroupBox groupBox7;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Button button4;
- private System.Windows.Forms.Button button3;
- private System.Windows.Forms.ImageList imageList1;
- private DataGridView dataGridView_results;
- private Button button_remove;
- private Button button_all;
- private GroupBox groupBox8;
- private GroupBox groupBox9;
- private GroupBox groupBox10;
- private GroupBox groupBox11;
- private CheckBox checkBox3;
- private Label label3;
- private CustomControl.TriangleTrackBar triangleTrackBar1;
- private Label label5;
- private NumericUpDown numericUpDown1;
- private Label label6;
- private Panel panel2;
- private RadioButton rb_2;
- private RadioButton rb_1;
- private Panel panel3;
- private Label label7;
- private RadioButton rb_4;
- private RadioButton rb_3;
- private Label label8;
- private Label label9;
- private NumericUpDown numericUpDown2;
- private NumericUpDown numericUpDown3;
- private Label lbl_line;
- private System.Data.SQLite.SQLiteCommand sqLiteCommand1;
- private CustomControl.TriangleTrackBar triangleTrackBar2;
- private Label label13;
- private CheckBox checkBox4;
- private CheckBox checkBox5;
- private CheckBox checkBox6;
- private NumericUpDown numericUpDown5;
- private NumericUpDown numericUpDown4;
- private Label label11;
- private Label label10;
- private Panel panel4;
- private RadioButton radioButton1;
- private RadioButton radioButton2;
- private Label lbl_kl_max;
- private Label lbl_kl_min;
- private IContainer components;
- private double imgPxPerUnit;
- private int menuId;
- private string menuName;
- //二值化集成1
- BinaryClass binaryClass;
- private BinaryControl bc;
- private int imgIndex = -1;
- /// <summary>
- /// 初始系统参数配置值
- /// </summary>
- private BinaryExtractionModel binaryExtractionModel = new BinaryExtractionModel();
- List<DrawObject> rmObjects = new List<DrawObject>();
- /// <summary>
- /// 参数下拉的集合
- /// </summary>
- private List<string> files = new List<string>();
- private Dictionary<int, DocumentItem> documentItems;
- private Button button9;
- private DataGridViewTextBoxColumn Column5;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
- private DataGridViewTextBoxColumn meanMedianSpacing;
- private Dictionary<string, List<List<string>>> intermediateDataList = new Dictionary<string, List<List<string>>>();
- private CheckedListBox listBox_analysisResult;
- private bool isCheck = false;
- /// <summary>
- /// 当前点击调色板
- /// </summary>
- private int currentPanel = 1;
- #endregion
- #region InitializeComponent
- private void InitializeLanguageText()
- {
- this.rb_3.Text = PdnResources.GetString("Menu.solid.text");
- this.rb_4.Text = PdnResources.GetString("Menu.Hollow.text");
- this.label7.Text = PdnResources.GetString("Menu.style.text");
- this.label8.Text = PdnResources.GetString("Menu.shape.text");
- this.label9.Text = PdnResources.GetString("Menu.size.text");
- this.lbl_line.Text = PdnResources.GetString("Menu.Linewidth.text");
- this.label10.Text = PdnResources.GetString("Menu.color.text");
- this.label11.Text = PdnResources.GetString("Menu.error.text");
-
- this.groupBox10.Text = PdnResources.GetString("Menu.Interceptformatting.text");
- this.radioButton1.Text = PdnResources.GetString("Menu.Measuringline.text");
- this.radioButton2.Text = PdnResources.GetString("Menu.Generalanalysis.Phasespacing.Thenumberofsections.text");
- this.groupBox9.Text = PdnResources.GetString("Menu.operation.text");
- this.label5.Text = PdnResources.GetString("Menu.Linewidth.text");
- this.label6.Text = PdnResources.GetString("Menu.color.text");
- this.groupBox8.Text = PdnResources.GetString("Menu.Measuringlinesetting.text");
- this.button3.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
- this.button4.Text = PdnResources.GetString("Menu.Exportresults.text");
- this.label1.Text = PdnResources.GetString("Menu.Decimal.text")+":";
- this.button9.Text = PdnResources.GetString("Menu.Tools.OpenProject.Text");
- this.meanMedianSpacing.HeaderText = PdnResources.GetString("Menu.Meanedianspacing.Text");
- this.dataGridViewTextBoxColumn3.HeaderText = PdnResources.GetString("Menu.Numberofintercept.text");
- this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.Generalanalysis.Phasespacing.variance.text");
- this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.Generalanalysis.Phasespacing.Averagespacing.text");
- this.Column5.HeaderText = PdnResources.GetString("Menu.picture.Text");
- this.button_all.Text = PdnResources.GetString("Menu.Showall.text");
- this.button_remove.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.groupBox5.Text = PdnResources.GetString("Menu.Analysisresult.text");
- this.groupBox_review.Text = PdnResources.GetString("Menu.Preview.text");
- this.checkBox3.Text = PdnResources.GetString("Menu.filter.text");
- this.label3.Text = PdnResources.GetString("Menu.minimum.text");
- this.label13.Text = PdnResources.GetString("Menu.max.text");
- this.groupBox2.Text = PdnResources.GetString("Menu.Particlescreening.text");
- this.button1.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.groupBox4.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
- button5.Text = PdnResources.GetString("Menu.File.Close.Text");
- this.Text = "PV1112(" + PdnResources.GetString("Menu.Dendritispacing.Text") + ")";
- //this.checkBox4.Text = PdnResources.GetString("Menu.displaygrainboundaries.text");
- this.checkBox5.Text = PdnResources.GetString("Menu.displaygrid.text");
- this.checkBox6.Text = PdnResources.GetString("Menu.displaysections.text");
- this.groupBox11.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
- this.rb_1.Text = PdnResources.GetString("Menu.circular.Text");
- this.rb_2.Text = PdnResources.GetString("Menu.Square.text");
- }
- private void InitializeCustomCotrol()
- {
- //
- // bc
- //
- this.bc = new PaintDotNet.CustomControl.BinaryControl();
- this.bc.BinaryBackColor = System.Drawing.Color.Red;
- this.bc.BinaryChecked = false;
- this.bc.BinaryStyle = 1;
- this.bc.Location = new System.Drawing.Point(177, 72);
- 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(362, 292);
- this.bc.TabIndex = 22;
- this.Controls.Add(this.bc);
- this.Controls.SetChildIndex(this.bc, 0);
- }
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.button5 = new System.Windows.Forms.Button();
- this.groupBox4 = 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.button1 = new System.Windows.Forms.Button();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.lbl_kl_max = new System.Windows.Forms.Label();
- this.lbl_kl_min = new System.Windows.Forms.Label();
- this.triangleTrackBar2 = new PaintDotNet.CustomControl.TriangleTrackBar();
- this.label13 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.triangleTrackBar1 = new PaintDotNet.CustomControl.TriangleTrackBar();
- this.checkBox3 = new System.Windows.Forms.CheckBox();
- this.groupBox_review = new System.Windows.Forms.GroupBox();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.listBox_analysisResult = new System.Windows.Forms.CheckedListBox();
- this.button_remove = new System.Windows.Forms.Button();
- this.button_all = new System.Windows.Forms.Button();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.dataGridView_results = new System.Windows.Forms.DataGridView();
- this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.meanMedianSpacing = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.groupBox7 = new System.Windows.Forms.GroupBox();
- this.button9 = new System.Windows.Forms.Button();
- this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
- this.label1 = new System.Windows.Forms.Label();
- this.button4 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.groupBox8 = new System.Windows.Forms.GroupBox();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.label6 = new System.Windows.Forms.Label();
- this.panel2 = new System.Windows.Forms.Panel();
- this.label5 = new System.Windows.Forms.Label();
- this.groupBox9 = new System.Windows.Forms.GroupBox();
- this.radioButton2 = new System.Windows.Forms.RadioButton();
- this.radioButton1 = new System.Windows.Forms.RadioButton();
- this.groupBox10 = new System.Windows.Forms.GroupBox();
- this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
- this.label11 = new System.Windows.Forms.Label();
- this.label10 = new System.Windows.Forms.Label();
- this.panel4 = new System.Windows.Forms.Panel();
- this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
- this.lbl_line = new System.Windows.Forms.Label();
- this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
- this.label9 = new System.Windows.Forms.Label();
- this.label8 = new System.Windows.Forms.Label();
- this.panel3 = new System.Windows.Forms.Panel();
- this.label7 = new System.Windows.Forms.Label();
- this.rb_4 = new System.Windows.Forms.RadioButton();
- this.rb_3 = new System.Windows.Forms.RadioButton();
- this.rb_2 = new System.Windows.Forms.RadioButton();
- this.rb_1 = new System.Windows.Forms.RadioButton();
- this.groupBox11 = new System.Windows.Forms.GroupBox();
- this.checkBox6 = new System.Windows.Forms.CheckBox();
- this.checkBox5 = new System.Windows.Forms.CheckBox();
- this.checkBox4 = new System.Windows.Forms.CheckBox();
- this.sqLiteCommand1 = new System.Data.SQLite.SQLiteCommand();
- this.groupBox4.SuspendLayout();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox5.SuspendLayout();
- this.groupBox6.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView_results)).BeginInit();
- this.groupBox7.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
- this.groupBox8.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- this.groupBox9.SuspendLayout();
- this.groupBox10.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
- this.panel3.SuspendLayout();
- this.groupBox11.SuspendLayout();
- this.SuspendLayout();
- //
- // button5
- //
- button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- button5.Location = new System.Drawing.Point(956, 21);
- button5.Name = "button5";
- button5.Size = new System.Drawing.Size(75, 23);
- button5.TabIndex = 3;
- button5.UseVisualStyleBackColor = true;
- button5.Click += new System.EventHandler(this.button5_Click);
- //
- // groupBox4
- //
- this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox4.Controls.Add(this.listView1);
- this.groupBox4.Location = new System.Drawing.Point(13, 72);
- this.groupBox4.Margin = new System.Windows.Forms.Padding(4);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Padding = new System.Windows.Forms.Padding(4);
- this.groupBox4.Size = new System.Drawing.Size(158, 665);
- this.groupBox4.TabIndex = 9;
- this.groupBox4.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(8, 26);
- this.listView1.Margin = new System.Windows.Forms.Padding(4);
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(140, 631);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- this.listView1.SelectedIndexChanged += new System.EventHandler(this.ListViewSelectedIndexChanged);
- //
- // 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.button5);
- this.groupBox1.Controls.Add(this.button2);
- this.groupBox1.Controls.Add(this.checkBox1);
- this.groupBox1.Controls.Add(this.button1);
- this.groupBox1.Location = new System.Drawing.Point(20, 12);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(1145, 53);
- this.groupBox1.TabIndex = 10;
- this.groupBox1.TabStop = false;
- //
- // button2
- //
- this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button2.Location = new System.Drawing.Point(1053, 21);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 2;
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // checkBox1
- //
- this.checkBox1.AutoSize = true;
- this.checkBox1.Location = new System.Drawing.Point(98, 24);
- this.checkBox1.Name = "checkBox1";
- this.checkBox1.Size = new System.Drawing.Size(15, 14);
- this.checkBox1.TabIndex = 1;
- this.checkBox1.UseVisualStyleBackColor = true;
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(6, 24);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 0;
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.lbl_kl_max);
- this.groupBox2.Controls.Add(this.lbl_kl_min);
- this.groupBox2.Controls.Add(this.triangleTrackBar2);
- this.groupBox2.Controls.Add(this.label13);
- this.groupBox2.Controls.Add(this.label3);
- this.groupBox2.Controls.Add(this.triangleTrackBar1);
- this.groupBox2.Controls.Add(this.checkBox3);
- this.groupBox2.Location = new System.Drawing.Point(178, 369);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(361, 76);
- this.groupBox2.TabIndex = 11;
- this.groupBox2.TabStop = false;
- //
- // lbl_kl_max
- //
- this.lbl_kl_max.AutoSize = true;
- this.lbl_kl_max.Location = new System.Drawing.Point(300, 48);
- this.lbl_kl_max.Name = "lbl_kl_max";
- this.lbl_kl_max.Size = new System.Drawing.Size(11, 12);
- this.lbl_kl_max.TabIndex = 8;
- this.lbl_kl_max.Text = "0";
- //
- // lbl_kl_min
- //
- this.lbl_kl_min.AutoSize = true;
- this.lbl_kl_min.Location = new System.Drawing.Point(300, 21);
- this.lbl_kl_min.Name = "lbl_kl_min";
- this.lbl_kl_min.Size = new System.Drawing.Size(11, 12);
- this.lbl_kl_min.TabIndex = 7;
- this.lbl_kl_min.Text = "0";
- //
- // triangleTrackBar2
- //
- this.triangleTrackBar2.Location = new System.Drawing.Point(116, 44);
- this.triangleTrackBar2.Maximum = 10;
- this.triangleTrackBar2.Minimum = 0;
- this.triangleTrackBar2.Name = "triangleTrackBar2";
- this.triangleTrackBar2.Size = new System.Drawing.Size(180, 26);
- this.triangleTrackBar2.TabIndex = 6;
- this.triangleTrackBar2.Value = 0;
- this.triangleTrackBar2.TrackBarScroll += new System.EventHandler(this.triangleTrackBar2_TrackBarScroll);
- //
- // label13
- //
- this.label13.AutoSize = true;
- this.label13.Location = new System.Drawing.Point(77, 50);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(0, 12);
- this.label13.TabIndex = 5;
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(77, 21);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(0, 12);
- this.label3.TabIndex = 2;
- this.label3.Click += new System.EventHandler(this.label3_Click);
- //
- // triangleTrackBar1
- //
- this.triangleTrackBar1.Location = new System.Drawing.Point(116, 14);
- this.triangleTrackBar1.Maximum = 10;
- this.triangleTrackBar1.Minimum = 0;
- this.triangleTrackBar1.Name = "triangleTrackBar1";
- this.triangleTrackBar1.Size = new System.Drawing.Size(180, 26);
- this.triangleTrackBar1.TabIndex = 1;
- this.triangleTrackBar1.Value = 0;
- this.triangleTrackBar1.TrackBarScroll += new System.EventHandler(this.triangleTrackBar1_TrackBarScroll);
- //
- // checkBox3
- //
- this.checkBox3.AutoSize = true;
- this.checkBox3.Location = new System.Drawing.Point(18, 21);
- 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);
- //
- // groupBox_review
- //
- this.groupBox_review.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.groupBox_review.Location = new System.Drawing.Point(544, 72);
- this.groupBox_review.Name = "groupBox_review";
- this.groupBox_review.Size = new System.Drawing.Size(621, 665);
- this.groupBox_review.TabIndex = 12;
- this.groupBox_review.TabStop = false;
- //
- // groupBox5
- //
- this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox5.Controls.Add(this.listBox_analysisResult);
- this.groupBox5.Controls.Add(this.button_remove);
- this.groupBox5.Controls.Add(this.button_all);
- this.groupBox5.Location = new System.Drawing.Point(12, 749);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(224, 165);
- this.groupBox5.TabIndex = 13;
- this.groupBox5.TabStop = false;
- //
- // listBox_analysisResult
- //
- this.listBox_analysisResult.CheckOnClick = true;
- this.listBox_analysisResult.FormattingEnabled = true;
- this.listBox_analysisResult.HorizontalScrollbar = true;
- this.listBox_analysisResult.Location = new System.Drawing.Point(11, 53);
- this.listBox_analysisResult.Name = "listBox_analysisResult";
- this.listBox_analysisResult.Size = new System.Drawing.Size(202, 100);
- this.listBox_analysisResult.TabIndex = 9;
- this.listBox_analysisResult.SelectedIndexChanged += new System.EventHandler(this.listBox_analysisResult_SelectedIndexChanged);
- //
- // button_remove
- //
- this.button_remove.Location = new System.Drawing.Point(130, 24);
- this.button_remove.Name = "button_remove";
- this.button_remove.Size = new System.Drawing.Size(75, 23);
- this.button_remove.TabIndex = 8;
- this.button_remove.UseVisualStyleBackColor = true;
- this.button_remove.Click += new System.EventHandler(this.button_remove_Click);
- //
- // button_all
- //
- this.button_all.Location = new System.Drawing.Point(14, 24);
- this.button_all.Name = "button_all";
- this.button_all.Size = new System.Drawing.Size(75, 23);
- this.button_all.TabIndex = 1;
- this.button_all.UseVisualStyleBackColor = true;
- this.button_all.Click += new System.EventHandler(this.button_all_Click);
- //
- // groupBox6
- //
- this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox6.Controls.Add(this.dataGridView_results);
- this.groupBox6.Location = new System.Drawing.Point(257, 749);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(678, 165);
- this.groupBox6.TabIndex = 14;
- this.groupBox6.TabStop = false;
- //
- // dataGridView_results
- //
- this.dataGridView_results.AllowUserToAddRows = false;
- this.dataGridView_results.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.dataGridView_results.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView_results.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.dataGridView_results.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dataGridView_results.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column5,
- this.dataGridViewTextBoxColumn1,
- this.dataGridViewTextBoxColumn2,
- this.dataGridViewTextBoxColumn3,
- this.meanMedianSpacing});
- this.dataGridView_results.Location = new System.Drawing.Point(16, 29);
- this.dataGridView_results.Name = "dataGridView_results";
- this.dataGridView_results.RowHeadersVisible = false;
- this.dataGridView_results.RowTemplate.Height = 27;
- this.dataGridView_results.Size = new System.Drawing.Size(645, 130);
- this.dataGridView_results.TabIndex = 1;
- //
- // Column5
- //
- this.Column5.Name = "Column5";
- //
- // dataGridViewTextBoxColumn1
- //
- this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
- //
- // dataGridViewTextBoxColumn2
- //
- this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
- //
- // dataGridViewTextBoxColumn3
- //
- this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
- //
- // meanMedianSpacing
- //
- this.meanMedianSpacing.Name = "meanMedianSpacing";
- //
- // groupBox7
- //
- this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox7.Controls.Add(this.button9);
- this.groupBox7.Controls.Add(this.numericUpDown5);
- this.groupBox7.Controls.Add(this.label1);
- this.groupBox7.Controls.Add(this.button4);
- this.groupBox7.Controls.Add(this.button3);
- this.groupBox7.Location = new System.Drawing.Point(941, 744);
- this.groupBox7.Name = "groupBox7";
- this.groupBox7.Size = new System.Drawing.Size(224, 165);
- this.groupBox7.TabIndex = 15;
- this.groupBox7.TabStop = false;
- //
- // button9
- //
- this.button9.Location = new System.Drawing.Point(30, 95);
- this.button9.Name = "button9";
- this.button9.Size = new System.Drawing.Size(107, 23);
- this.button9.TabIndex = 6;
- this.button9.UseVisualStyleBackColor = true;
- this.button9.Click += new System.EventHandler(this.button9_Click);
- //
- // numericUpDown5
- //
- this.numericUpDown5.Location = new System.Drawing.Point(60, 131);
- this.numericUpDown5.Maximum = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- this.numericUpDown5.Name = "numericUpDown5";
- this.numericUpDown5.Size = new System.Drawing.Size(74, 21);
- this.numericUpDown5.TabIndex = 5;
- this.numericUpDown5.Value = new decimal(new int[] {
- 2,
- 0,
- 0,
- 0});
- this.numericUpDown5.ValueChanged += new System.EventHandler(this.numericUpDown5_ValueChanged);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(22, 133);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(0, 12);
- this.label1.TabIndex = 3;
- //
- // button4
- //
- this.button4.Location = new System.Drawing.Point(30, 58);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(107, 23);
- this.button4.TabIndex = 1;
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(30, 20);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(107, 23);
- this.button3.TabIndex = 0;
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // groupBox8
- //
- this.groupBox8.Controls.Add(this.numericUpDown1);
- this.groupBox8.Controls.Add(this.label6);
- this.groupBox8.Controls.Add(this.panel2);
- this.groupBox8.Controls.Add(this.label5);
- this.groupBox8.Location = new System.Drawing.Point(177, 451);
- this.groupBox8.Name = "groupBox8";
- this.groupBox8.Size = new System.Drawing.Size(361, 51);
- this.groupBox8.TabIndex = 18;
- this.groupBox8.TabStop = false;
- //
- // numericUpDown1
- //
- this.numericUpDown1.Location = new System.Drawing.Point(64, 25);
- this.numericUpDown1.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(74, 21);
- this.numericUpDown1.TabIndex = 4;
- this.numericUpDown1.Value = new decimal(new int[] {
- 2,
- 0,
- 0,
- 0});
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(179, 27);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(0, 12);
- this.label6.TabIndex = 3;
- //
- // panel2
- //
- this.panel2.BackColor = System.Drawing.Color.Blue;
- this.panel2.Location = new System.Drawing.Point(216, 25);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(96, 19);
- this.panel2.TabIndex = 2;
- this.panel2.Click += new System.EventHandler(this.panel2_Click);
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(10, 27);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(0, 12);
- this.label5.TabIndex = 0;
- //
- // groupBox9
- //
- this.groupBox9.Controls.Add(this.radioButton2);
- this.groupBox9.Controls.Add(this.radioButton1);
- this.groupBox9.Location = new System.Drawing.Point(178, 508);
- this.groupBox9.Name = "groupBox9";
- this.groupBox9.Size = new System.Drawing.Size(361, 50);
- this.groupBox9.TabIndex = 19;
- this.groupBox9.TabStop = false;
- //
- // radioButton2
- //
- this.radioButton2.AutoSize = true;
- this.radioButton2.Location = new System.Drawing.Point(181, 20);
- this.radioButton2.Name = "radioButton2";
- this.radioButton2.Size = new System.Drawing.Size(14, 13);
- this.radioButton2.TabIndex = 4;
- this.radioButton2.TabStop = true;
- this.radioButton2.UseVisualStyleBackColor = true;
- this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
- //
- // radioButton1
- //
- this.radioButton1.AutoSize = true;
- this.radioButton1.Checked = true;
- this.radioButton1.Location = new System.Drawing.Point(65, 20);
- this.radioButton1.Name = "radioButton1";
- this.radioButton1.Size = new System.Drawing.Size(14, 13);
- this.radioButton1.TabIndex = 3;
- this.radioButton1.TabStop = true;
- this.radioButton1.UseVisualStyleBackColor = true;
- this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
- //
- // groupBox10
- //
- this.groupBox10.Controls.Add(this.numericUpDown4);
- this.groupBox10.Controls.Add(this.label11);
- this.groupBox10.Controls.Add(this.label10);
- this.groupBox10.Controls.Add(this.panel4);
- this.groupBox10.Controls.Add(this.numericUpDown3);
- this.groupBox10.Controls.Add(this.lbl_line);
- this.groupBox10.Controls.Add(this.numericUpDown2);
- this.groupBox10.Controls.Add(this.label9);
- this.groupBox10.Controls.Add(this.label8);
- this.groupBox10.Controls.Add(this.panel3);
- this.groupBox10.Controls.Add(this.rb_2);
- this.groupBox10.Controls.Add(this.rb_1);
- this.groupBox10.Location = new System.Drawing.Point(178, 564);
- this.groupBox10.Name = "groupBox10";
- this.groupBox10.Size = new System.Drawing.Size(361, 102);
- this.groupBox10.TabIndex = 20;
- this.groupBox10.TabStop = false;
- //
- // numericUpDown4
- //
- this.numericUpDown4.Location = new System.Drawing.Point(212, 72);
- this.numericUpDown4.Maximum = new decimal(new int[] {
- 10000,
- 0,
- 0,
- 0});
- this.numericUpDown4.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.numericUpDown4.Name = "numericUpDown4";
- this.numericUpDown4.Size = new System.Drawing.Size(74, 21);
- this.numericUpDown4.TabIndex = 24;
- this.numericUpDown4.Value = new decimal(new int[] {
- 30,
- 0,
- 0,
- 0});
- this.numericUpDown4.ValueChanged += new System.EventHandler(this.numericUpDown4_ValueChanged);
- //
- // label11
- //
- this.label11.AutoSize = true;
- this.label11.Location = new System.Drawing.Point(174, 75);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(0, 12);
- this.label11.TabIndex = 23;
- //
- // label10
- //
- this.label10.AutoSize = true;
- this.label10.Location = new System.Drawing.Point(179, 51);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(0, 12);
- this.label10.TabIndex = 22;
- //
- // panel4
- //
- this.panel4.BackColor = System.Drawing.Color.Yellow;
- this.panel4.Location = new System.Drawing.Point(212, 48);
- this.panel4.Name = "panel4";
- this.panel4.Size = new System.Drawing.Size(100, 19);
- this.panel4.TabIndex = 21;
- this.panel4.Click += new System.EventHandler(this.panel4_Click);
- //
- // numericUpDown3
- //
- this.numericUpDown3.Location = new System.Drawing.Point(65, 72);
- this.numericUpDown3.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.numericUpDown3.Name = "numericUpDown3";
- this.numericUpDown3.Size = new System.Drawing.Size(74, 21);
- this.numericUpDown3.TabIndex = 14;
- this.numericUpDown3.Value = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown3_ValueChanged);
- //
- // lbl_line
- //
- this.lbl_line.AutoSize = true;
- this.lbl_line.Location = new System.Drawing.Point(16, 75);
- this.lbl_line.Name = "lbl_line";
- this.lbl_line.Size = new System.Drawing.Size(0, 12);
- this.lbl_line.TabIndex = 13;
- //
- // numericUpDown2
- //
- this.numericUpDown2.Location = new System.Drawing.Point(64, 46);
- this.numericUpDown2.Name = "numericUpDown2";
- this.numericUpDown2.Size = new System.Drawing.Size(74, 21);
- this.numericUpDown2.TabIndex = 10;
- this.numericUpDown2.Value = new decimal(new int[] {
- 20,
- 0,
- 0,
- 0});
- this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown2_ValueChanged);
- //
- // label9
- //
- this.label9.AutoSize = true;
- this.label9.Location = new System.Drawing.Point(16, 51);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(0, 12);
- this.label9.TabIndex = 9;
- //
- // label8
- //
- this.label8.AutoSize = true;
- this.label8.Location = new System.Drawing.Point(16, 24);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(0, 12);
- this.label8.TabIndex = 8;
- //
- // panel3
- //
- this.panel3.Controls.Add(this.label7);
- this.panel3.Controls.Add(this.rb_4);
- this.panel3.Controls.Add(this.rb_3);
- this.panel3.Location = new System.Drawing.Point(175, 11);
- this.panel3.Name = "panel3";
- this.panel3.Size = new System.Drawing.Size(176, 34);
- this.panel3.TabIndex = 5;
- //
- // label7
- //
- this.label7.AutoSize = true;
- this.label7.Location = new System.Drawing.Point(17, 11);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(0, 12);
- this.label7.TabIndex = 7;
- //
- // rb_4
- //
- this.rb_4.AutoSize = true;
- this.rb_4.Checked = true;
- this.rb_4.Location = new System.Drawing.Point(120, 9);
- this.rb_4.Name = "rb_4";
- this.rb_4.Size = new System.Drawing.Size(14, 13);
- this.rb_4.TabIndex = 6;
- this.rb_4.TabStop = true;
- this.rb_4.UseVisualStyleBackColor = true;
- this.rb_4.CheckedChanged += new System.EventHandler(this.rb_4_CheckedChanged);
- //
- // rb_3
- //
- this.rb_3.AutoSize = true;
- this.rb_3.Location = new System.Drawing.Point(60, 9);
- this.rb_3.Name = "rb_3";
- this.rb_3.Size = new System.Drawing.Size(14, 13);
- this.rb_3.TabIndex = 5;
- this.rb_3.UseVisualStyleBackColor = true;
- this.rb_3.CheckedChanged += new System.EventHandler(this.rb_3_CheckedChanged);
- //
- // rb_2
- //
- this.rb_2.AutoSize = true;
- this.rb_2.Location = new System.Drawing.Point(116, 20);
- this.rb_2.Name = "rb_2";
- this.rb_2.Size = new System.Drawing.Size(14, 13);
- this.rb_2.TabIndex = 1;
- this.rb_2.UseVisualStyleBackColor = true;
- this.rb_2.CheckedChanged += new System.EventHandler(this.rb_2_CheckedChanged);
- //
- // rb_1
- //
- this.rb_1.AutoSize = true;
- this.rb_1.Checked = true;
- this.rb_1.Location = new System.Drawing.Point(65, 20);
- this.rb_1.Name = "rb_1";
- this.rb_1.Size = new System.Drawing.Size(14, 13);
- this.rb_1.TabIndex = 0;
- this.rb_1.TabStop = true;
- this.rb_1.UseVisualStyleBackColor = true;
- this.rb_1.CheckedChanged += new System.EventHandler(this.rb_1_CheckedChanged);
- //
- // groupBox11
- //
- this.groupBox11.Controls.Add(this.checkBox6);
- this.groupBox11.Controls.Add(this.checkBox5);
- this.groupBox11.Controls.Add(this.checkBox4);
- this.groupBox11.Location = new System.Drawing.Point(178, 672);
- this.groupBox11.Name = "groupBox11";
- this.groupBox11.Size = new System.Drawing.Size(360, 66);
- this.groupBox11.TabIndex = 21;
- this.groupBox11.TabStop = false;
- //
- // checkBox6
- //
- this.checkBox6.AutoSize = true;
- this.checkBox6.Checked = true;
- this.checkBox6.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox6.Location = new System.Drawing.Point(240, 30);
- this.checkBox6.Name = "checkBox6";
- this.checkBox6.Size = new System.Drawing.Size(15, 14);
- this.checkBox6.TabIndex = 2;
- this.checkBox6.UseVisualStyleBackColor = true;
- this.checkBox6.CheckedChanged += new System.EventHandler(this.checkBox6_CheckedChanged);
- //
- // checkBox5
- //
- this.checkBox5.AutoSize = true;
- this.checkBox5.Checked = true;
- this.checkBox5.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox5.Location = new System.Drawing.Point(140, 30);
- this.checkBox5.Name = "checkBox5";
- this.checkBox5.Size = new System.Drawing.Size(15, 14);
- this.checkBox5.TabIndex = 1;
- this.checkBox5.UseVisualStyleBackColor = true;
- this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
- //
- // checkBox4
- //
- this.checkBox4.AutoSize = true;
- this.checkBox4.Checked = true;
- this.checkBox4.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox4.Location = new System.Drawing.Point(18, 30);
- this.checkBox4.Name = "checkBox4";
- this.checkBox4.Size = new System.Drawing.Size(96, 16);
- this.checkBox4.TabIndex = 0;
- this.checkBox4.Text = "显示二值数据";
- this.checkBox4.UseVisualStyleBackColor = true;
- this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
- //
- // sqLiteCommand1
- //
- this.sqLiteCommand1.CommandText = null;
- //
- // PV1112Dialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1177, 926);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox11);
- this.Controls.Add(this.groupBox10);
- this.Controls.Add(this.groupBox9);
- this.Controls.Add(this.groupBox8);
- this.Controls.Add(this.groupBox7);
- this.Controls.Add(this.groupBox6);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox_review);
- this.Controls.Add(this.groupBox1);
- this.Controls.Add(this.groupBox4);
- this.Name = "PV1112Dialog";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Dialog_FormClosing);
- this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData);
- this.Controls.SetChildIndex(this.groupBox4, 0);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox_review, 0);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.Controls.SetChildIndex(this.groupBox6, 0);
- this.Controls.SetChildIndex(this.groupBox7, 0);
- this.Controls.SetChildIndex(this.groupBox8, 0);
- this.Controls.SetChildIndex(this.groupBox9, 0);
- this.Controls.SetChildIndex(this.groupBox10, 0);
- this.Controls.SetChildIndex(this.groupBox11, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.groupBox4.ResumeLayout(false);
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
- this.groupBox5.ResumeLayout(false);
- this.groupBox6.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView_results)).EndInit();
- this.groupBox7.ResumeLayout(false);
- this.groupBox7.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
- this.groupBox8.ResumeLayout(false);
- this.groupBox8.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- this.groupBox9.ResumeLayout(false);
- this.groupBox9.PerformLayout();
- this.groupBox10.ResumeLayout(false);
- this.groupBox10.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
- this.panel3.ResumeLayout(false);
- this.panel3.PerformLayout();
- this.groupBox11.ResumeLayout(false);
- this.groupBox11.PerformLayout();
- this.ResumeLayout(false);
- }
- public void Initialize()
- {
- //
- //初始化图像控件
- //
- this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
- this.documentWorkspace.Cursor = Cursors.Default;
- this.documentWorkspace.Dock = DockStyle.Fill;
- this.documentWorkspace.HookMouseEvents();
- this.documentWorkspace.AuxiliaryLineEnabled = false;
- this.documentWorkspace.Visible = true;
- //this.documentWorkspace.panel.Click += new EventHandler(this.documentWorkspace_panel_Click);
- this.groupBox_review.Controls.Add(this.documentWorkspace);
- //
- //初始化操作按钮
- //
- this.commonControlButtons = new CommonControlButtons();
- this.commonControlButtons.Dock = DockStyle.Top;
- this.commonControlButtons.Height = 30;
- this.commonControlButtons.HideZoomToWindowAndActualSize();
- 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);
- groupBox_review.Controls.Add(this.commonControlButtons);
- documentWorkspace.panel.MouseDown += Panel_MouseDown;
- documentWorkspace.panel.MouseUp += Panel_MouseUp;
- documentWorkspace.panel.Paint += Panel_Paint;
- documentWorkspace.panel.MouseMove += Panel_MouseMove;
- //documentWorkspace.panel.DoubleClick += new EventHandler(deleteLine);
- this.dataGridView_results.ClearSelection();
- }
- #endregion
- private CommonControlButtons commonControlButtons;
- /// <summary>
- /// 主空间
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 图像面板
- /// </summary>
- private DocumentWorkspaceWindow documentWorkspace;
- /// <summary>
- /// 选中图片的bitmap
- /// </summary>
- private Bitmap bitmap;
- int decnum = 2;
- DrawAnalysisModel lineStyleModel = new DrawAnalysisModel();
- DrawAnalysisModel pointStyleModel = new DrawAnalysisModel();
- private ColorsForm colorsFormGrid;
- private ColorsForm lineColorsFormGrid;
- private ColorsForm PointcolorsFormGrid;
- List<PolyphaseDistanceResult> allResults = new List<PolyphaseDistanceResult>();
- //0 画线 1 画截点
- private int drawaction = 0;
- List<PolyphaseDistanceLineResult> lineResults = new List<PolyphaseDistanceLineResult>();
- List<DrawObject> drawObjects = new List<DrawObject>();
- private int offsetHalfW = 0;
- private int offsetHalfH = 0;
- private int m_tolerance = 30;
- private int tolerance = 2;
- //0 画线 1 删除
- private int lineAction = 0;
- private decimal maxArea = 0;
- private System.Drawing.Point lineStartPos = new System.Drawing.Point();
- private DrawMulLineA activeLine = null;
- private PhaseModel activePhaseModel = null;
- //private List<Bitmap> bitList = new List<Bitmap>();
- private List<Bitmap> bitList = new List<Bitmap>();
- private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
- private Mat original;
- // <summary>
- /// 保存窗口参数 range
- /// </summary>
- private GrainSizeAnalysisModel analysisModel;
- private const string ParamKey_Report = "report";//报告设置
- private const string ParamKey_Screen = "screen";//筛选
- private const string ParamKey_ScreenMin = "screenMin";//面积最小值
- private const string ParamKey_ScreenMax = "screenMax";//面积最大值
- private const string ParamKey_MeasuringWidth = "measuringWidth";//测量线宽
- private const string ParamKey_MeasuringColour = "measuringColour";//测量线颜色
- private const string ParamKey_ChoiceMeasuring = "choiceMeasuring";//选择测量线
- private const string ParamKey_ChoiceSection = "choiceSection";//选择测截点
- private const string ParamKey_ChoiceRound = "choiceRound";//截点圆形
- private const string ParamKey_ChoiceSquare = "choiceSquare";//截点方形
- private const string ParamKey_ChoiceSolid = "choiceSolid";//截点实心
- private const string ParamKey_ChoiceHollow = "choiceHollow";//截点空心
- private const string ParamKey_ChoiceSize = "choiceSize";//截点大小
- private const string ParamKey_ChoiceColour = "choiceColour";//截点颜色
- private const string ParamKey_ChoiceWidth = "choiceWidth";//截点线宽
- private const string ParamKey_ChoiceError = "choiceError";//截点误差
- private const string ParamKey_Binary = "binary";//二值显示
- private const string ParamKey_Grid = "grid";//网格显示
- private const string ParamKey_Section = "section";//网格显示
- private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数
- /// <summary>
- /// 是否脚本运行
- /// </summary>
- private Boolean initScriptValues = false;
- public PV1112Dialog()
- {
- InitializeComponent();
- }
- #region 公共按钮
- 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)
- {
- documentWorkspace.panel.MouseMove += Panel_MouseMove;
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
- }
- private void mobileModeButton_Click(object sender, EventArgs e)
- {
- documentWorkspace.panel.MouseMove -= Panel_MouseMove;
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
- }
- #endregion
- public PV1112Dialog(AppWorkspace appWorkspace, PdnMenuItem menuItem)
- {
- InitializeComponent();
- this.menuId = menuItem.MenuId;
- this.menuName = menuItem.Text;
- this.binaryClass = new BinaryClass(menuId);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- this.analysisModel = analysisModelXml.cloneListParamModel(this.menuId);
- foreach (var item in this.analysisModel.ListParam)
- item.setValue();
- InitializeCustomCotrol();
- InitializeLanguageText();
- this.lineColorsFormGrid = new ColorsForm();
- this.lineColorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
- this.Load += new System.EventHandler(this.GrainSizeDialog_Load);
- this.PointcolorsFormGrid = new ColorsForm();
- this.PointcolorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
- this.appWorkspace = appWorkspace;
- Initialize();
- InitPicList();
- this.groupBox_review.DoubleClick += null;
- InitParameterList();
- //InitParameterToControl();
- //InitHistogramDragEvent();
- SetAnalyzeModelFromXml("Template.Manager.item3.Aluminum_PV1112");
- SetStyle(ControlStyles.UserPaint, true);
- SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
- SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
- UpdateStyle();
- InitCommonButtonEvent();
- //二值化集成2
- bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
- binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text") }
- , this.bc, this.appWorkspace, this.documentWorkspace, this.listView1);//初始化相的工作结构
- binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
- this.Shown += showImg;
- }
- private void showImg(object sender, EventArgs e)
- {
- listView1.Focus();
- if (this.imgIndex != -1)
- {
- //滚动到指定的行位置
- this.listView1.EnsureVisible(this.imgIndex);
- this.listView1.Items[imgIndex].Focused = true;
- this.listView1.Items[imgIndex].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
- {//读取上次关闭窗口时保存的参数
- GetListParamModel();
- }
- }
- }
- private void getValue(string key, Object value)
- {
- switch (key)
- {
- case "parameter11":
- numericUpDown1.Value = Convert.ToDecimal(value);
- break;
- case "parameter12":
- panel2.BackColor = Color.FromArgb(Convert.ToInt32(value));
- break;
- case "parameter13":
- radioButton1.Checked = (int)value == 1 ? true : false;
- radioButton2.Checked = (int)value == 1 ? false : true;
- break;
- case "parameter14":
- rb_1.Checked = (int)value == 1 ? true : false;
- rb_2.Checked = (int)value == 1 ? false : true;
- break;
- case "parameter15":
- rb_3.Checked = (int)value == 1 ? true : false;
- rb_4.Checked = (int)value == 1 ? false : true;
- break;
- case "parameter16":
- numericUpDown2.Value = Convert.ToDecimal(value);
- break;
- case "parameter17":
- numericUpDown3.Value = Convert.ToDecimal(value);
- break;
- case "parameter18":
- numericUpDown4.Value = Convert.ToDecimal(value);
- break;
- case "parameter19":
- checkBox4.Checked = Convert.ToBoolean(value);
- break;
- case "parameter20":
- checkBox5.Checked = Convert.ToBoolean(value);
- break;
- case "parameter21":
- checkBox6.Checked = Convert.ToBoolean(value);
- break;
- case "parameter22":
- panel4.BackColor = Color.FromArgb(Convert.ToInt32(value));
- break;
- case "OpenWhileExportReport":
- checkBox1.Checked = Convert.ToBoolean(value);
- break;
- case "CalculatorDecimalDigits":
- numericUpDown5.Value = Convert.ToDecimal(value);
- break;
- }
- }
- private void Init()
- {
- this.drawObjects.Clear();
- this.lineResults.Clear();
- //this.documentWorkspace.phaseModels.Clear();
- //this.documentWorkspace.GraphicsList.Clear();
- }
- private void Panel_MouseMove(object sender, MouseEventArgs e)
- {
- System.Drawing.Point pointscroll = this.documentWorkspace.GetScalePoint(new PointF(e.X, e.Y));
- if (e.Button == MouseButtons.Left)
- {
- if (drawaction == 0)
- {
- if (activeLine != null)
- {
- if (activeLine.pointArray.Count == 1)
- activeLine.pointArray.Add(pointscroll);
- else
- activeLine.pointArray[1] = pointscroll;
- }
- }
- this.documentWorkspace.Refresh();
- }
- }
- private void Panel_Paint(object sender, PaintEventArgs e)
- {
- Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
- int wid = this.documentWorkspace.CompositionSurface == null ? this.documentWorkspace.Width : this.documentWorkspace.CompositionSurface.Width;
- int hei = this.documentWorkspace.CompositionSurface == null ? this.documentWorkspace.Height : this.documentWorkspace.CompositionSurface.Height;
- int width = (int)(wid * this.documentWorkspace.ScaleFactor.Ratio);
- int height = (int)(hei * this.documentWorkspace.ScaleFactor.Ratio);
- int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X + offsetHalfW : (rc.Width - width) / 2;
- int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y + offsetHalfH : (rc.Height - height) / 2;
- e.Graphics.TranslateTransform(x, y);
- e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
- if (drawObjects != null)
- {
- foreach (DrawObject drobj in drawObjects)
- {
- drobj.Draw(e.Graphics);
- }
- }
- e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
- e.Graphics.TranslateTransform(-x, -y);
- }
- #region [二值化相关方法]
- private void Dialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- #region [开启脚本录制]
- if (appWorkspace.startScriptRecording)
- {
- getScriptRecording();
- }
- #endregion
- binaryClass.saveParams();
- this.saveDialogParamValues();
- //xml保存路径
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- foreach (var analysisItem in this.analysisModel.ListParam)
- {
- bool foundItem = false;
- foreach (var item in analysisModelXml.ListParam)
- {
- if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
- {
- item.param_value = analysisItem.param_value;
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- analysisModelXml.ListParam.Add(analysisItem.cloneModel());
- }
- //按路径和名称保存xml文件
- string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
- //保存xml
- FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
- }
- private void ShownChoiseItemAndInitData(object sender, EventArgs e)
- {
- binaryClass.RefreshHistogramControl1Values();
- }
- /// <summary>
- /// 添加参数改变的监听
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void GrainSizeDialog_Load(object sender, EventArgs e)
- {
- this.binaryClass.loadParams();
- }
- private bool bcBinaryChecked()
- {
- return bc != null && bc.BinaryChecked;
- }
- /// <summary>
- /// 参数改变时,重新处理图像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bClassBinaryImplFinishAction(object sender, EventArgs e)
- {
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- {
- if (checkBox4.Checked)
- {
- this.documentWorkspace.PhaseModels[0].choise = true;
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- }
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- }
- if (bcBinaryChecked())
- {
- this.drawObjects.AddRange(this.rmObjects);
- this.rmObjects.Clear();
- }
- else
- {
- this.rmObjects = this.drawObjects.FindAll(u => u.drawToolType != DrawToolType.DrawMulLineA);
- this.drawObjects.RemoveAll(u => u.drawToolType != DrawToolType.DrawMulLineA);
- }
- }
- UpdateLine();
- this.documentWorkspace.Refresh();
- }
- private bool bcOriginChecked()
- {
- return bc != null && bc.OriginChecked;
- }
- /// <summary>
- /// 显示原图/原图+二值图
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bcOriginCheckedChanged(object sender, EventArgs e)
- {
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- {
- if (checkBox4.Checked)
- {
- this.documentWorkspace.PhaseModels[0].choise = true;
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- }
- }
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- }
- this.documentWorkspace.Refresh();
- }
- private void UpdateLine()
- {
- List<DrawObject> lines = drawObjects.FindAll(u => u.drawToolType == DrawToolType.DrawMulLineA);
- Mat mat = documentWorkspace.phaseModels[0].mat.Clone();
- if (mat.Channels() <= 3)
- {
- mat = mat.CvtColor(ColorConversionCodes.BGR2BGRA);
- }
- Color color = Color.FromArgb(documentWorkspace.phaseModels[0].color);
- foreach (var line in lines)
- {
- if (line == null || line.GetPoints().Count < 2)
- {
- continue;
- }
- PointF a = line.GetPoints()[0];
- PointF b = line.GetPoints()[1];
- List<System.Drawing.Point> points = new List<System.Drawing.Point>();
- int linkCount = 0;
- PolyphaseDistanceLineResult lineResult = lineResults.Find(u => u.LineID == line.ID);
- if (lineResult == null)
- {
- continue;
- }
- foreach (int pointid in lineResult.PointIDs.Keys)
- {
- DrawObject dr = drawObjects.Find(u => u.ID == pointid);
- if (dr != null)
- {
- this.drawObjects.Remove(dr);
- }
- }
- List<System.Drawing.Point> linePoints = Bresenhamline(a, b);
- for (int i = 0; i < linePoints.Count; i++)
- {
- System.Drawing.Point ploc = linePoints[i];
- if (ploc.X < mat.Cols && ploc.Y < mat.Rows && ploc.X >= 0 && ploc.Y >= 0)
- {
- Vec4b targetPoint = mat.At<Vec4b>(ploc.Y, ploc.X);
- if (targetPoint[0] == color.B && targetPoint[1] == color.G && targetPoint[2] == color.R && targetPoint[3] == 255)
- {
- linkCount++;
- if (linkCount == 1)
- {
- points.Add(new System.Drawing.Point(ploc.X, ploc.Y));
- if (pointStyleModel.DrawType == 0)
- {
- DrawCircleA circleA = new DrawCircleA(documentWorkspace, ploc.X, ploc.Y, 1, 1, pointStyleModel);
- circleA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(circleA.ID, ploc);
- this.drawObjects.Add(circleA);
- }
- else
- {
- DrawSquareA squareA = new DrawSquareA(documentWorkspace, ploc.X, ploc.Y, 1, 1, pointStyleModel);
- squareA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(squareA.ID, ploc);
- this.drawObjects.Add(squareA);
- }
- }
- else if ((linkCount % m_tolerance) == 0)
- {
- if (pointStyleModel.DrawType == 0)
- {
- DrawCircleA circleA = new DrawCircleA(documentWorkspace, ploc.X, ploc.Y, 1, 1, pointStyleModel);
- circleA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(circleA.ID, ploc);
- this.drawObjects.Add(circleA);
- }
- else
- {
- DrawSquareA squareA = new DrawSquareA(documentWorkspace, ploc.X, ploc.Y, 1, 1, pointStyleModel);
- squareA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(squareA.ID, ploc);
- this.drawObjects.Add(squareA);
- }
- }
- }
- else
- {
- linkCount = 0;
- }
- }
- }
- lineResults.Add(lineResult);
- }
- documentWorkspace.Refresh();
- }
- #endregion
- private void UpdateStyle()
- {
- lineStyleModel.lineColor = panel2.BackColor.ToArgb();
- lineStyleModel.lineWidth = (int)numericUpDown1.Value;
- pointStyleModel.lineWidth = (int)numericUpDown3.Value;
- pointStyleModel.size = (int)numericUpDown2.Value;
- if (checkBox6.Checked)
- {
- pointStyleModel.fillColor = panel4.BackColor.ToArgb();
- pointStyleModel.lineColor = panel4.BackColor.ToArgb();
- }
- else
- {
- pointStyleModel.fillColor = Color.FromArgb(0, 255, 255, 255).ToArgb();
- pointStyleModel.lineColor = Color.FromArgb(0, 255, 255, 255).ToArgb();
- }
- m_tolerance = (int)numericUpDown4.Value;
- if (rb_3.Checked)
- {
- pointStyleModel.fillType = 1;
- }
- else if (rb_4.Checked)
- {
- pointStyleModel.fillType = 0;
- }
- if (rb_1.Checked)
- {
- pointStyleModel.DrawType = 0;
- List<DrawObject> lines = drawObjects.FindAll(u => u.drawToolType == DrawToolType.DrawMulLineA);
- foreach (DrawObject lineObj in lines)
- {
- PolyphaseDistanceLineResult lineResult = lineResults.Find(u => u.LineID == lineObj.ID);
- if (lineResult == null) {
- continue;
- }
- Hashtable newPoints = new Hashtable();
- foreach (int pointid in lineResult.PointIDs.Keys)
- {
- DrawObject dr = drawObjects.Find(u => u.ID == pointid);
- if (dr != null)
- {
- this.drawObjects.Remove(dr);
- }
- System.Drawing.Point linePoint = (System.Drawing.Point)lineResult.PointIDs[pointid];
- //lineResult.PointIDs.Remove(pointid);
- DrawCircleA squareA = new DrawCircleA(documentWorkspace, linePoint.X, linePoint.Y, 1, 1, pointStyleModel);
- squareA.ISurfaceBox = documentWorkspace;
- newPoints.Add(squareA.ID, linePoint);
- this.drawObjects.Add(squareA);
- }
- lineResult.PointIDs = newPoints;
- }
- }
- else if (rb_2.Checked)
- {
- pointStyleModel.DrawType = 1;
- List<DrawObject> lines = drawObjects.FindAll(u => u.drawToolType == DrawToolType.DrawMulLineA);
- foreach (DrawObject lineObj in lines)
- {
- PolyphaseDistanceLineResult lineResult = lineResults.Find(u => u.LineID == lineObj.ID);
- if (lineResult == null) {
- continue;
- }
- Hashtable newPoints = new Hashtable();
- foreach (int pointid in lineResult.PointIDs.Keys)
- {
- DrawObject dr = drawObjects.Find(u => u.ID == pointid);
- if (dr != null)
- {
- this.drawObjects.Remove(dr);
- }
- System.Drawing.Point linePoint = (System.Drawing.Point)lineResult.PointIDs[pointid];
- //lineResult.PointIDs.Remove(pointid);
- DrawSquareA squareA = new DrawSquareA(documentWorkspace, linePoint.X, linePoint.Y, 1, 1, pointStyleModel);
- squareA.ISurfaceBox = documentWorkspace;
- newPoints.Add(squareA.ID, linePoint);
- this.drawObjects.Add(squareA);
- }
- lineResult.PointIDs = newPoints;
- }
- }
- decnum = (int)numericUpDown5.Value;
- this.documentWorkspace.Refresh();
- }
- //private void deleteLine(object sender, EventArgs e)
- //{
- // System.Drawing.Point loc = documentWorkspace.GetScalePoint(new PointF(e.X, e.Y));
- // DrawObject line = getDrawObjectsByLocation(new PointF(loc.X, loc.Y), DrawToolType.DrawMulLineA);
- // //首先判断是否在线上
- // if (line != null)
- // {
- // PolyphaseDistanceLineResult lineResult = lineResults.Find(u => u.LineID == line.ID);
- // //画线模式,发现线,则删除
- // if (lineResult != null)
- // {
- // foreach (int pointid in lineResult.PointIDs.Keys)
- // {
- // DrawObject dr = drawObjects.Find(u => u.ID == pointid);
- // if (dr != null)
- // {
- // this.drawObjects.Remove(dr);
- // }
- // }
- // this.drawObjects.Remove(line);
- // lineResults.RemoveAll(u => u.LineID == line.ID);
- // activeLine = null;
- // lineAction = 1;
- // }
- // }
- // documentWorkspace.Refresh();
- //}
- private DrawObject getDrawObjectsByLocation(PointF point, DrawToolType drawToolType)
- {
- foreach (DrawObject dr in drawObjects)
- {
- if (dr.drawToolType == drawToolType)
- {
- if (dr.drawToolType == DrawToolType.DrawMulLineA)
- {
- //判断线
- if (dr.GetPoints().Count > 1)
- {
- PointF a = dr.GetPoints()[0];
- PointF b = dr.GetPoints()[1];
- List<System.Drawing.Point> linePoints = Bresenhamline(a, b);
- for (int i = 0; i < linePoints.Count; i++)
- {
- if (ComparePoint(new System.Drawing.Point((int)point.X, (int)point.Y), linePoints[i], tolerance))
- {
- return dr;
- }
- }
- }
- }
- if (dr.drawToolType == drawToolType)
- {
- System.Drawing.Point pointLocation = new System.Drawing.Point((int)dr.GetPoints()[0].X, (int)dr.GetPoints()[0].Y);
- if (ComparePoint(new System.Drawing.Point((int)point.X, (int)point.Y), pointLocation, tolerance))
- {
- return dr;
- }
- }
- }
- }
- return null;
- }
- private bool ComparePoint(System.Drawing.Point source, System.Drawing.Point target, int tolerance)
- {
- if ((source.X >= (target.X - tolerance)) && (source.X <= (target.X + tolerance)) && (source.Y >= (target.Y - tolerance)) && (source.Y <= (target.Y + tolerance)))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- private void Panel_MouseDown(object sender, MouseEventArgs e)
- {
- //二值化
- if (documentWorkspace.phaseModels.Count == 0 || !bcBinaryChecked())
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformbinarizationoperationfirst.text"));
- }
- if (e.Button == MouseButtons.Left)
- {
- System.Drawing.Point loc = documentWorkspace.GetScalePoint(new PointF(e.X, e.Y));
- DrawObject line = getDrawObjectsByLocation(new PointF(loc.X, loc.Y), DrawToolType.DrawMulLineA);
- //首先判断是否在线上
- if (line != null)
- {
- PolyphaseDistanceLineResult lineResult = lineResults.Find(u => u.LineID == line.ID);
- //List<System.Drawing.Point> activeLinePoints = (List<System.Drawing.Point>)linesPoints[line.ID];
- if (drawaction == 1)
- {
- DrawObject circleObject = getDrawObjectsByLocation(new PointF(loc.X, loc.Y), DrawToolType.DrawCircleA);
- DrawObject squareObject = getDrawObjectsByLocation(new PointF(loc.X, loc.Y), DrawToolType.DrawSquareA);
- if (circleObject == null && squareObject == null)
- {
- //碰撞检测,如未检测到对象则新增。
- if (line.GetPoints().Count >= 2)
- {
- PointF a = line.GetPoints()[0];
- PointF b = line.GetPoints()[1];
- List<System.Drawing.Point> linePoints = Bresenhamline(a, b);
- System.Drawing.Point linePoint = linePoints.Find(u => ComparePoint(u, loc, tolerance));
- if (linePoint != null)
- {
- if (pointStyleModel.DrawType == 0)
- {
- DrawCircleA circleA = new DrawCircleA(documentWorkspace, loc.X, loc.Y, 1, 1, pointStyleModel);
- circleA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(circleA.ID, linePoint);
- this.drawObjects.Add(circleA);
- }
- else
- {
- DrawSquareA squareA = new DrawSquareA(documentWorkspace, loc.X, loc.Y, 1, 1, pointStyleModel);
- squareA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(squareA.ID, linePoint);
- this.drawObjects.Add(squareA);
- }
- //activeLinePoints.Add(linePoint);
- }
- }
- }
- else
- {
- if (e.Clicks > 1)
- {
- //如果存在截点,则删除截点
- if (circleObject != null)
- {
- this.drawObjects.Remove(circleObject);
- if (lineResult != null)
- {
- lineResult.PointIDs.Remove(circleObject.ID);
- }
- }
- if (squareObject != null)
- {
- this.drawObjects.Remove(squareObject);
- if (lineResult != null)
- {
- lineResult.PointIDs.Remove(squareObject.ID);
- }
- }
- }
- }
- }
- else
- {
- if (e.Clicks > 1)
- {
- //画线模式,发现线,则删除
- if (lineResult != null)
- {
- foreach (int pointid in lineResult.PointIDs.Keys)
- {
- DrawObject dr = drawObjects.Find(u => u.ID == pointid);
- if (dr != null)
- {
- this.drawObjects.Remove(dr);
- }
- }
- this.drawObjects.Remove(line);
- lineResults.RemoveAll(u => u.LineID == line.ID);
- activeLine = null;
-
- }
- }
- lineAction = 1;
- }
- }
- else
- {
- lineStartPos = this.documentWorkspace.GetScalePoint(new PointF(e.X, e.Y));
- this.documentWorkspace.AnalysisStyleModel = lineStyleModel;
- activeLine = new DrawMulLineA(this.documentWorkspace, lineStartPos.X, lineStartPos.Y);
- this.drawObjects.Add(activeLine);
- lineAction = 0;
- }
- documentWorkspace.Refresh();
- }
- }
- int XiangSu = 1;
- /// <summary>
- /// Bresenham画线算法,给出两个点a,b
- /// </summary>
- /// PS:这里XiangSu是光栅的最小距离,因为我是在高分辨率的窗口中模拟低分辨率效果,
- /// 所以用这个XiangSu来控制模拟的光栅最小单元格的边的大小,实际运用中XiangSu=1
- /// <param name="a"></param>
- /// <param name="b"></param>
- List<System.Drawing.Point> Bresenhamline(System.Drawing.PointF a, System.Drawing.PointF b)
- {
- List<System.Drawing.Point> tempP = new List<System.Drawing.Point>();
- int x, y, dx, dy, s1, s2, p, temp, interchange, i;
- x = (int)a.X;
- y = (int)a.Y;
- dx = Math.Abs((int)b.X - (int)a.X);
- dy = Math.Abs((int)b.Y - (int)a.Y);
- if (b.X > a.X)
- s1 = XiangSu;
- else
- s1 = -XiangSu;
- if (b.Y > a.Y)
- s2 = XiangSu;
- else
- s2 = -XiangSu;
- if (dy > dx)
- {
- temp = dx;
- dx = dy;
- dy = temp;
- interchange = 1;
- }
- else
- interchange = 0;
- p = 2 * dy - dx;
- for (i = 1; i <= dx; i += XiangSu)
- {
- System.Drawing.Point tempp = new System.Drawing.Point(x, y);
- tempp.X = x;
- tempp.Y = y;
- tempP.Add(tempp);
- //Vram[x + y * 600] = true;//把该片内存置为边界标记
- if (p >= 0)
- {
- if (interchange == 0)
- y = y + s2;
- else
- x = x + s1;
- p = p - 2 * dx;
- }
- if (interchange == 0)
- x = x + s1;
- else
- y = y + s2;
- p = p + 2 * dy;
- }
- return tempP;
- }
- private void Panel_MouseUp(object sender, MouseEventArgs e)
- {
- if (e.Clicks > 1) {
- return;
- }
- //画线
- if (drawaction == 0)
- {
- if (e.Button == MouseButtons.Left)
- {
- if (lineAction == 0)
- {
- if (activeLine != null && activeLine.GetPoints().Count > 1)
- {
- PointF a = activeLine.GetPoints()[0];
- PointF b = activeLine.GetPoints()[1];
- List<System.Drawing.Point> points = new List<System.Drawing.Point>();
- Mat mat = documentWorkspace.phaseModels[0].mat.Clone();
- if (mat.Channels() <= 3)
- {
- mat = mat.CvtColor(ColorConversionCodes.BGR2BGRA);
- }
- Color color = Color.FromArgb(documentWorkspace.phaseModels[0].color);
- int linkCount = 0;
- PolyphaseDistanceLineResult lineResult = new PolyphaseDistanceLineResult();
- lineResult.LineID = activeLine.ID;
- List<System.Drawing.Point> linePoints = Bresenhamline(a, b);
- for (int i = 0; i < linePoints.Count; i++)
- {
- System.Drawing.Point ploc = linePoints[i];
- if (ploc.X < mat.Cols && ploc.Y < mat.Rows && ploc.X >= 0 && ploc.Y >= 0)
- {
- Vec4b targetPoint = mat.At<Vec4b>(ploc.Y, ploc.X);
- if (targetPoint[0] == color.B && targetPoint[1] == color.G && targetPoint[2] == color.R && targetPoint[3] == 255)
- {
- linkCount++;
- if (linkCount == 1)
- {
- points.Add(new System.Drawing.Point(ploc.X, ploc.Y));
- if (pointStyleModel.DrawType == 0)
- {
- DrawCircleA circleA = new DrawCircleA(documentWorkspace, ploc.X, ploc.Y, 1, 1, pointStyleModel);
- circleA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(circleA.ID, ploc);
- this.drawObjects.Add(circleA);
- }
- else
- {
- DrawSquareA squareA = new DrawSquareA(documentWorkspace, ploc.X, ploc.Y, 1, 1, pointStyleModel);
- squareA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(squareA.ID, ploc);
- this.drawObjects.Add(squareA);
- }
- }
- else if ((linkCount % m_tolerance) == 0)
- {
- if (pointStyleModel.DrawType == 0)
- {
- DrawCircleA circleA = new DrawCircleA(documentWorkspace, ploc.X, ploc.Y, 1, 1, pointStyleModel);
- circleA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(circleA.ID, ploc);
- this.drawObjects.Add(circleA);
- }
- else
- {
- DrawSquareA squareA = new DrawSquareA(documentWorkspace, ploc.X, ploc.Y, 1, 1, pointStyleModel);
- squareA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(squareA.ID, ploc);
- this.drawObjects.Add(squareA);
- }
- }
- }
- else
- {
- linkCount = 0;
- }
- }
- }
- lineResults.Add(lineResult);
- }
- }
- }
- }
- documentWorkspace.Refresh();
- }
- 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;
- String imageName = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- if (listView1.Items.Find(imageName, false).Count() > 0)
- {
- if (imageName.Split('.').Count() > 1)
- {
- imageName = imageName.Split('.')[0] + "(" + listView1.Items.Find(imageName, false).Count() + ")." + imageName.Split('.')[1];
- }
- }
- this.listView1.Items[i].Text = imageName;
- this.listView1.Items[i].Name = imageName;
- if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
- {
- this.imgIndex = i;
- }
- }
- }
- /// <summary>
- /// ListView图片选择改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ListViewSelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
- {
- this.imgPxPerUnit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
- this.bitmap = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- Document document = Document.FromImage(bitmap);
- this.documentWorkspace.Document = document;
- this.documentWorkspace.Visible = true;
- Init();
- binaryClass.listView1_SelectedIndexChanged(this.bitmap);
- if (bcOriginChecked())
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.Refresh();
- }
-
- if (this.isCheck)
- {
- checkBox3_CheckedChanged(sender, e);
- triangleTrackBar2.Value = triangleTrackBar2.Maximum;
- lbl_kl_max.Text = triangleTrackBar2.Maximum.ToString();
- }
- if (this.documentWorkspace.phaseModels.Count > 0)
- {
- original = this.documentWorkspace.phaseModels[0].mat.Clone();
- }
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- double pxPerUnit = this.imgPxPerUnit;
- if (lineResults.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Therearenomeasuringlinesortransversals.Text")+"!");
- return;
- }
- string tag = listView1.FocusedItem.Text;
- List<Bitmap> tempBit = new List<Bitmap>();
- double avgDistince = 0f;
- double distinceSum = 0f;
- double allavrSum = 0f;
- //计算间距
- int distinceCount = 0;
- double medianNum = 0;
- int pointCount = 0;
- //中位数结果集合
- List<double> medianList = new List<double>();
- List<List<string>> dataList = new List<List<string>>();
- List<string> titleList = new List<string>();
- titleList.Add(PdnResources.GetString("Menu.Thetotallength.Text"));
- titleList.Add(PdnResources.GetString("Menu.Dendrite.Text"));
- titleList.Add(PdnResources.GetString("Menu.Theaveragelengthof.Text"));
- titleList.Add(PdnResources.GetString("Menu.Themedian.Text"));
- dataList.Add(titleList);
- for (int i = 0; i < lineResults.Count; i++)
- {
- List<string> newList = new List<string>();
- double zhongWei = 0;
- double everydistinceSum = 0f;
- pointCount += lineResults[i].PointIDs.Count;
- System.Drawing.Point[] pointArray = new System.Drawing.Point[lineResults[i].PointIDs.Count];
- lineResults[i].PointIDs.Values.CopyTo(pointArray, 0);
- pointArray = pointArray.OrderBy(p => p.X).ThenBy(p => p.Y).ToArray();
- List<double> allDistince = new List<double>();
- int lastNum = 1;
- if (pointArray.Count() % 2 != 0) {
- lastNum = 2;
- }
- for (int j = 0; j < pointArray.Count() - lastNum; j += 2)
- {
- double distince = BasicCalculationHelper.GetDistance(pointArray[j], pointArray[j + 1], 10);
- distinceSum += distince * pxPerUnit;
- everydistinceSum += distince * pxPerUnit;
- distinceCount++;
- allDistince.Add(distince * pxPerUnit);
- }
- allDistince = allDistince.OrderBy(a => a).ToList();//将数组从小到大排列
- int count = allDistince.Count();
- //求中位数
- if (count == 0) {
- } else if (count == 1) {
- zhongWei = allDistince[0];
- medianList.Add(allDistince[0]);
- }
- else if (count % 2 == 0)
- {
- //偶数
- var mindex = count / 2;
- zhongWei = (allDistince[mindex - 1] + allDistince[mindex]) / 2;
- medianList.Add(zhongWei);
- }
- else
- {
- //奇数
- var mindex = (count + 1) / 2;
- zhongWei = allDistince[mindex - 1];
- medianList.Add(zhongWei);
- }
- if (everydistinceSum != 0) {
- newList.Add(everydistinceSum.ToString());
- newList.Add((pointArray.Count() / 2).ToString());
- newList.Add(Math.Round(everydistinceSum / (pointArray.Count() / 2), 2).ToString());
- allavrSum += Math.Round(everydistinceSum / (pointArray.Count() / 2), 2);
- newList.Add(zhongWei.ToString());
- dataList.Add(newList);
- }
- }
- if (intermediateDataList.ContainsKey(listView1.FocusedItem.Text.ToString()))
- {
- intermediateDataList[listView1.FocusedItem.Text.ToString()] = dataList;
- }
- else {
- intermediateDataList.Add(listView1.FocusedItem.Text.ToString(), dataList);
- }
- if (lineResults.Count > 0)
- {
- avgDistince = allavrSum / lineResults.Count;
- }
- //if (medianSum > 0) {
- // medianAvr = medianSum / lineResults.Count;
- //}
- #region [懒得封装 在复制一遍]
- if (medianList.Count == 0)
- {
- }
- else if (medianList.Count == 1)
- {
- medianNum = medianList[0];
- }
- else if (medianList.Count / 2 == 0)
- {
- //偶数
- var mindex = medianList.Count / 2;
- medianNum = (medianList[mindex - 1] + medianList[mindex]) / 2;
- }
- else
- {
- //奇数
- var mindex = (medianList.Count + 1) / 2;
- medianNum = medianList[mindex - 1];
- }
- #endregion
- //计算方差
- double dfSum = 0f;
- double fc = 0f;
- int fcCount = 0;
- for (int i = 0; i < lineResults.Count; i++)
- {
- System.Drawing.Point[] pointArray = new System.Drawing.Point[lineResults[i].PointIDs.Count];
- lineResults[i].PointIDs.Values.CopyTo(pointArray, 0);
- pointArray = pointArray.OrderBy(p => p.X).ThenBy(p => p.Y).ToArray();
- int lastNum = 1;
- if (pointArray.Count() % 2 != 0)
- {
- lastNum = 2;
- }
- for (int j = 0; j < pointArray.Count() - lastNum; j += 2)
- {
- double distince = BasicCalculationHelper.GetDistance(pointArray[j], pointArray[j + 1], 10) * pxPerUnit;
- double df = Math.Pow((distince - avgDistince), 2);
- dfSum += df;
- fcCount++;
- }
- }
- if (fcCount > 0)
- {
- fc = dfSum / fcCount;
- }
- PolyphaseDistanceResult result = new PolyphaseDistanceResult(listView1.FocusedItem.Text.ToString(), avgDistince, fc, pointCount, medianNum);
- if (listView1.SelectedItems.Count > 0)
- {
- List<PolyphaseDistanceResult> editResults = allResults.FindAll(item => item.GraphName.Equals(listView1.FocusedItem.Text));
- if (editResults.Count == 0)
- {
- listBox_analysisResult.Items.Add(this.listView1.FocusedItem.Text);
- listBox_analysisResult.SetItemChecked(listBox_analysisResult.Items.Count - 1, true);
- allResults.Add(result);
- dataGridView_results.Rows.Add(result.GraphName, AnalysisTools.GetDecNum(result.AvgDistince, decnum), AnalysisTools.GetDecNum(result.Fc, decnum), result.Count, AnalysisTools.GetDecNum(result.medianAvr, decnum));
- if (result.Fc < 9 || (result.AvgDistince - result.medianAvr) > 5)
- {
- dataGridView_results.Rows[dataGridView_results.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Red;
- }
- }
- else
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theresuethertoreplace.text")+"?", PdnResources.GetString("Form.OkButton.Text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- if (dr != DialogResult.OK)
- {
- return;
- }
- int index = allResults.FindIndex(item => item.GraphName.Equals(listView1.FocusedItem.Text));
- allResults[index] = result;
- List<string> list = new List<string>();
- foreach (var s in this.listBox_analysisResult.Items) {
- list.Add(s.ToString());
- }
- this.listBox_analysisResult.Items.Clear();
- foreach (var s in list) {
- this.listBox_analysisResult.Items.Add(s);
- }
- var thisindex = this.listBox_analysisResult.Items.IndexOf(listView1.FocusedItem.Text);
- listBox_analysisResult.SetItemChecked(thisindex, true);
- this.dataGridView_results.Rows.Clear();
- dataGridView_results.Rows.Add(result.GraphName, AnalysisTools.GetDecNum(result.AvgDistince, decnum), AnalysisTools.GetDecNum(result.Fc, decnum), result.Count, AnalysisTools.GetDecNum(result.medianAvr, decnum));
- if (result.Fc < 9 || (result.AvgDistince - result.medianAvr) > 5)
- {
- dataGridView_results.Rows[dataGridView_results.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Red;
- }
- }
- double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
- Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- originalBit.Tag = pantographRatio;
- tempBit.Add(originalBit);
- Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
- Graphics graphics = Graphics.FromImage(newBit);
- Draw(graphics);
- newBit.Tag = pantographRatio;
- tempBit.Add(newBit);
- if (bitDic.ContainsKey(tag))
- {
- bitDic[tag].Clear();
- bitDic[tag] = tempBit;
- }
- else
- {
- bitDic.Add(tag, tempBit);
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- }
- }
- private void Draw(Graphics graphics)
- {
- if (this.documentWorkspace.phaseModels.Count > 0)
- {
- foreach (PhaseModel model in this.documentWorkspace.phaseModels)
- {
- if (model.choise && model.mat != null)
- {
- Bitmap map = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(model.mat);
- graphics.DrawImage(map, 0, 0, map.Width, map.Height);
- }
- }
- if (drawObjects != null)
- {
- foreach (DrawObject drobj in drawObjects)
- {
- drobj.Draw(graphics);
- }
- }
- }
- }
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- UpdateStyle();
- }
- private void rb_1_CheckedChanged(object sender, EventArgs e)
- {
- if (rb_1.Checked)
- {
- UpdateStyle();
- }
- }
- private void rb_2_CheckedChanged(object sender, EventArgs e)
- {
- if (rb_2.Checked)
- {
- UpdateStyle();
- }
- }
- private void numericUpDown2_ValueChanged(object sender, EventArgs e)
- {
- UpdateStyle();
- }
- private void numericUpDown3_ValueChanged(object sender, EventArgs e)
- {
- UpdateStyle();
- }
- private void rb_3_CheckedChanged(object sender, EventArgs e)
- {
- if (rb_3.Checked)
- {
- UpdateStyle();
- }
- }
- private void rb_4_CheckedChanged(object sender, EventArgs e)
- {
- if (rb_4.Checked)
- {
- UpdateStyle();
- }
- }
- private void panel2_Click(object sender, EventArgs e)
- {
- this.lineColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
- this.lineColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.lineColorChanged));
- this.lineColorsFormGrid.ShowDialog();
- }
- private void lineColorChanged(object sender, EventArgs e)
- {
- Color color = this.lineColorsFormGrid.UserPrimaryColor.ToColor();
- //更改背景色,触发事件
- this.panel2.BackColor = color;
- //改变配置文件里面的相颜色
- //this.binaryExtractionModel.PhaseColor = color.ToArgb();
- //关闭色板
- UpdateStyle();
- this.lineColorsFormGrid.Close();
- }
- private void panel4_Click(object sender, EventArgs e)
- {
- this.PointcolorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel4.BackColor);
- this.PointcolorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.PointColorChanged));
- this.PointcolorsFormGrid.ShowDialog();
- }
- private void PointColorChanged(object sender, EventArgs e)
- {
- Color color = this.PointcolorsFormGrid.UserPrimaryColor.ToColor();
- //更改背景色,触发事件
- this.panel4.BackColor = color;
- //改变配置文件里面的相颜色
- //this.binaryExtractionModel.PhaseColor = color.ToArgb();
- //关闭色板
- UpdateStyle();
- this.PointcolorsFormGrid.Close();
- }
- private void checkBox6_CheckedChanged(object sender, EventArgs e)
- {
- if (checkBox6.Checked)
- {
- pointStyleModel.fillColor = panel4.BackColor.ToArgb();
- pointStyleModel.lineColor = panel4.BackColor.ToArgb();
- }
- else
- {
- pointStyleModel.fillColor = Color.FromArgb(0, 255, 255, 255).ToArgb();
- pointStyleModel.lineColor = Color.FromArgb(0, 255, 255, 255).ToArgb();
- }
- documentWorkspace.Refresh();
- }
- private void checkBox5_CheckedChanged(object sender, EventArgs e)
- {
- if (checkBox5.Checked)
- {
- lineStyleModel.lineColor = panel2.BackColor.ToArgb();
- }
- else
- {
- lineStyleModel.lineColor = Color.FromArgb(0, 255, 255, 255).ToArgb();
- }
- documentWorkspace.Refresh();
- }
- private void checkBox4_CheckedChanged(object sender, EventArgs e)
- {
- if (checkBox4.Checked)
- {
- if (documentWorkspace.phaseModels.Count > 0)
- {
- documentWorkspace.phaseModels[0].choise = true;
- }
- }
- else
- {
- if (documentWorkspace.phaseModels.Count > 0)
- {
- documentWorkspace.phaseModels[0].choise = false;
- }
- }
- documentWorkspace.Refresh();
- }
- private void triangleTrackBar2_TrackBarScroll(object sender, EventArgs e)
- {
- //Mat mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(this.documentWorkspace.CompositionSurface.CreateAliasedBitmap());
- if (this.documentWorkspace.phaseModels.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformbinarizationoperationfirst.text")+"!");
- return;
- }
- this.documentWorkspace.phaseModels[0].mat = original.Clone();
- GetAreaBetweenMinToMax(triangleTrackBar1.Value, triangleTrackBar2.Value, this.documentWorkspace.phaseModels[0].mat);
- lbl_kl_max.Text = triangleTrackBar2.Value.ToString();
- redrawForTolerance();
- this.documentWorkspace.Refresh();
- }
- private void triangleTrackBar1_TrackBarScroll(object sender, EventArgs e)
- {
- if (this.documentWorkspace.phaseModels.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformbinarizationoperationfirst.text")+"!");
- return;
- }
- this.documentWorkspace.phaseModels[0].mat = original.Clone();
- GetAreaBetweenMinToMax(triangleTrackBar1.Value, triangleTrackBar2.Value, this.documentWorkspace.phaseModels[0].mat);
- lbl_kl_min.Text = triangleTrackBar1.Value.ToString();
- redrawForTolerance();
- this.documentWorkspace.Refresh();
- }
- private decimal getMaxArea(Mat pMat)
- {
- double maxArea = 0;
- Mat mat = Mat.FromImageData(pMat.ToBytes(), ImreadModes.Grayscale);
- HierarchyIndex[] hierarchy;
- OpenCvSharp.Point[][] contours;
- Cv2.FindContours(mat, out contours, out hierarchy, RetrievalModes.External, ContourApproximationModes.ApproxNone);
- for (int i = 0; i < contours.Count(); i++)
- {
- double area = (Cv2.FloodFill(mat, contours[i][0], new Scalar(0, 0, 0, 0)));
- if (area > maxArea)
- {
- maxArea = area;
- }
- }
- return (decimal)maxArea;
- }
- private void checkBox3_CheckedChanged(object sender, EventArgs e)
- {
- this.isCheck = checkBox3.Checked;
- if (checkBox3.Checked)
- {
- if (this.documentWorkspace.phaseModels.Count > 0)
- {
- double pxPerUnit = this.imgPxPerUnit;
- if (this.documentWorkspace.phaseModels[0].mat != null)
- {
- maxArea = (int)Math.Ceiling(Convert.ToDouble(getMaxArea(this.documentWorkspace.phaseModels[0].mat)) * pxPerUnit * pxPerUnit);
- }
- triangleTrackBar1.Maximum = (int)maxArea;
- triangleTrackBar2.Maximum = (int)maxArea;
- }
- else
- {
- //MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformbinarizationoperationfirst.text")+"!");
- return;
- }
- }
- else
- {
- triangleTrackBar1.Value = 0;
- triangleTrackBar2.Value = 0;
- lbl_kl_max.Text = "0";
- lbl_kl_min.Text = "0";
- this.documentWorkspace.Refresh();
- //GetAreaBetweenMinToMax(triangleTrackBar1.Value, triangleTrackBar2.Value, this.documentWorkspace.phaseModels[0].mat);
- }
- }
- private void GetAreaBetweenMinToMax(decimal areaMin, decimal areaMax, Mat pMat)
- {
- if (!checkBox3.Checked)
- {
- return;
- }
- List<OpenCvSharp.Point[]> selectContours = new List<OpenCvSharp.Point[]>();
- List<OpenCvSharp.Point[]> unSelectContours = new List<OpenCvSharp.Point[]>();
- Mat mat = Mat.FromImageData(pMat.ToBytes(), ImreadModes.Grayscale);
- double pxPerUnit = this.imgPxPerUnit;
- HierarchyIndex[] hierarchy;
- OpenCvSharp.Point[][] contours;
- Cv2.FindContours(mat, out contours, out hierarchy, RetrievalModes.External, ContourApproximationModes.ApproxNone);
- for (int i = 0; i < contours.Length; i++)
- {
- double area = (Cv2.FloodFill(mat, contours[i][0], new Scalar(0, 0, 0, 0)) - contours[i].Length / 2.0) * pxPerUnit * pxPerUnit;
- if (area >= (double) areaMin && area <= (double) areaMax)
- {
- selectContours.Add(contours[i]);
- }
- else
- {
- unSelectContours.Add(contours[i]);
- }
- }
- Cv2.DrawContours(documentWorkspace.phaseModels[0].mat, selectContours, -1, new Scalar(this.documentWorkspace.phaseModels[0].color), Cv2.FILLED);
- documentWorkspace.Refresh();
- }
- private void numericUpDown4_ValueChanged(object sender, EventArgs e)
- {
- m_tolerance = (int)numericUpDown4.Value;
- redrawForTolerance();
- this.documentWorkspace.Refresh();
- }
- private void redrawForTolerance()
- {
- if (drawaction == 0)
- {
- List<DrawObject> lines = drawObjects.FindAll(u => u.drawToolType == DrawToolType.DrawMulLineA);
- foreach (DrawObject lineObj in lines)
- {
- PolyphaseDistanceLineResult lineResult = lineResults.Find(u => u.LineID == lineObj.ID);
- if (lineResult != null)
- {
- //删除原有点
- foreach (int pointid in lineResult.PointIDs.Keys)
- {
- DrawObject dr = drawObjects.Find(u => u.ID == pointid);
- if (dr != null)
- {
- this.drawObjects.Remove(dr);
- }
- }
- lineResult.PointIDs.Clear();
- //画新点
- if (lineObj != null && lineObj.GetPoints().Count > 1)
- {
- PointF a = lineObj.GetPoints()[0];
- PointF b = lineObj.GetPoints()[1];
- List<System.Drawing.Point> points = new List<System.Drawing.Point>();
- Mat mat = documentWorkspace.phaseModels[0].mat.Clone();
- if (mat.Channels() <= 3)
- {
- mat = mat.CvtColor(ColorConversionCodes.BGR2BGRA);
- }
- Color color = Color.FromArgb(documentWorkspace.phaseModels[0].color);
- int linkCount = 0;
- lineResult.LineID = lineObj.ID;
- List<System.Drawing.Point> linePoints = Bresenhamline(a, b);
- for (int i = 0; i < linePoints.Count; i++)
- {
- System.Drawing.Point ploc = linePoints[i];
- if (ploc.X < mat.Cols && ploc.Y < mat.Rows && ploc.X >= 0 && ploc.Y >= 0)
- {
- Vec4b targetPoint = mat.At<Vec4b>(ploc.Y, ploc.X);
- if (targetPoint[0] == color.B && targetPoint[1] == color.G && targetPoint[2] == color.R && targetPoint[3] == 255)
- {
- linkCount++;
- if (linkCount == 1)
- {
- points.Add(new System.Drawing.Point(ploc.X, ploc.Y));
- if (pointStyleModel.DrawType == 0)
- {
- DrawCircleA circleA = new DrawCircleA(documentWorkspace, ploc.X, ploc.Y, 1, 1, pointStyleModel);
- circleA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(circleA.ID, ploc);
- this.drawObjects.Add(circleA);
- }
- else
- {
- DrawSquareA squareA = new DrawSquareA(documentWorkspace, ploc.X, ploc.Y, 1, 1, pointStyleModel);
- squareA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(squareA.ID, ploc);
- this.drawObjects.Add(squareA);
- }
- }
- else if ((linkCount % m_tolerance) == 0)
- {
- if (pointStyleModel.DrawType == 0)
- {
- DrawCircleA circleA = new DrawCircleA(documentWorkspace, ploc.X, ploc.Y, 1, 1, pointStyleModel);
- circleA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(circleA.ID, ploc);
- this.drawObjects.Add(circleA);
- }
- else
- {
- DrawSquareA squareA = new DrawSquareA(documentWorkspace, ploc.X, ploc.Y, 1, 1, pointStyleModel);
- squareA.ISurfaceBox = documentWorkspace;
- lineResult.PointIDs.Add(squareA.ID, ploc);
- this.drawObjects.Add(squareA);
- }
- }
- }
- else
- {
- linkCount = 0;
- }
- }
- }//end for
- }//end if
- }//end if
- }// end foreach
- }//end for if
- }
- private void button_all_Click(object sender, EventArgs e)
- {
- dataGridView_results.Rows.Clear();
- for (int i = 0; i < listBox_analysisResult.Items.Count; i++) {
- listBox_analysisResult.SetItemChecked(i, true);
- }
- for (int i = 0; i < allResults.Count; i++)
- {
- PolyphaseDistanceResult editResult = allResults[i];
- dataGridView_results.Rows.Add(editResult.GraphName, AnalysisTools.GetDecNum(editResult.AvgDistince, decnum), AnalysisTools.GetDecNum(editResult.Fc, decnum), editResult.Count, AnalysisTools.GetDecNum(editResult.medianAvr, decnum));
- if (editResult.Fc < 9 || (editResult.AvgDistince - editResult.medianAvr) > 5)
- {
- dataGridView_results.Rows[dataGridView_results.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Red;
- }
- }
- }
- private void listBox_analysisResult_SelectedIndexChanged(object sender, EventArgs e)
- {
- dataGridView_results.Rows.Clear();
- if (listBox_analysisResult.CheckedItems != null && listBox_analysisResult.CheckedItems.Count > 0)
- {
- foreach (var s in listBox_analysisResult.CheckedItems) {
- List<PolyphaseDistanceResult> editResults = allResults.FindAll(u => u.GraphName == s.ToString());
- for (int i = 0; i < editResults.Count; i++)
- {
- PolyphaseDistanceResult editResult = editResults[i];
- dataGridView_results.Rows.Add(editResult.GraphName, AnalysisTools.GetDecNum(editResult.AvgDistince, decnum), AnalysisTools.GetDecNum(editResult.Fc, decnum), editResult.Count, AnalysisTools.GetDecNum(editResult.medianAvr, decnum));
- if (editResult.Fc < 9 || (editResult.AvgDistince - editResult.medianAvr) > 5)
- {
- dataGridView_results.Rows[dataGridView_results.Rows.Count - 1].DefaultCellStyle.BackColor = Color.Red;
- }
- }
- }
- }
- }
- private void button_remove_Click(object sender, EventArgs e)
- {
- var removeList = new List<string>();
- if (listBox_analysisResult.CheckedItems != null && listBox_analysisResult.CheckedItems.Count > 0)
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.ertodeletetheselectedanalysisres.Text")+"?", PdnResources.GetString("Menu.Edit.Delete.Text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- foreach (var s in listBox_analysisResult.CheckedItems) {
- for (int i = 0; i < dataGridView_results.Rows.Count; i++)
- {
- if (dataGridView_results.Rows[i].Cells[0].Value.ToString() == s.ToString())
- {
- dataGridView_results.Rows.RemoveAt(i);
- }
- }
- allResults.RemoveAll(u => u.GraphName == s.ToString());
- removeList.Add(s.ToString());
- }
- foreach (var m in removeList) {
- listBox_analysisResult.Items.Remove(m);
- }
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.cttheanalysisresultsthatyouwanttod.Text")+"!");
- }
- }
- private void numericUpDown5_ValueChanged(object sender, EventArgs e)
- {
- decnum = (int)numericUpDown5.Value;
- for (int i = 0; i < this.dataGridView_results.Rows.Count; i++)
- {
- PolyphaseDistanceResult result = allResults.Find(u => u.GraphName == dataGridView_results.Rows[i].Cells[0].Value.ToString());
- if (result != null)
- {
- dataGridView_results.Rows[i].Cells[1].Value = AnalysisTools.GetDecNum(result.AvgDistince, decnum);
- dataGridView_results.Rows[i].Cells[2].Value = AnalysisTools.GetDecNum(result.Fc, decnum);
- dataGridView_results.Rows[i].Cells[4].Value = AnalysisTools.GetDecNum(result.medianAvr, decnum);
- if (result.Fc < 9 || (result.AvgDistince - result.medianAvr) > 5)
- {
- dataGridView_results.Rows[i].DefaultCellStyle.BackColor = Color.Red;
- }
- }
- }
- }
- private void button5_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void radioButton1_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButton1.Checked)
- {
- drawaction = 0;
- }
- }
- private void radioButton2_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButton2.Checked)
- {
- drawaction = 1;
- }
- }
- private void label3_Click(object sender, EventArgs e)
- {
- }
- private void button4_Click(object sender, EventArgs e)
- {
- if (this.dataGridView_results.Rows.Count > 0)
- {
- SaveFileDialog exe = new SaveFileDialog();
- exe.Filter = "Execl files (*.xlsx)|*.xlsx";
- exe.FilterIndex = 0;
- exe.RestoreDirectory = true;
- //exe.CreatePrompt = true;
- exe.Title = "Export Excel File";
- exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + PdnResources.GetString("Menu.Dendritispacing.Text")+ PdnResources.GetString("Menu.Analysisresult.text");
- DialogResult dr = exe.ShowDialog();
- if (dr != DialogResult.OK)
- {
- return;
- }
- DataTable dtb = new DataTable();
- foreach (DataGridViewColumn c in this.dataGridView_results.Columns)
- {
- dtb.Columns.Add(c.HeaderText);
- }
- for (int r = 0; r < this.dataGridView_results.Rows.Count; r++)
- {
- DataRow dataRow = dtb.NewRow();
- for (int c = 0; c < this.dataGridView_results.Rows[r].Cells.Count; c++)
- {
- dataRow[this.dataGridView_results.Columns[c].HeaderText] = this.dataGridView_results.Rows[r].Cells[c].Value;
- }
- dtb.Rows.Add(dataRow);
- }
- List<DataTable> list = new List<DataTable>();
- list.Add(dtb);
- this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, false, false, true);
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.Aluminum_PV1112");
- if (recombinationRateSetDialog.hasModule)
- {
- recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
- recombinationRateSetDialog.ShowDialog();
- }
- else
- {
- recombinationRateSetDialog = null;
- }
- }
- private void button3_Click(object sender, EventArgs e)
- {
- if (checkBox1.Checked)
- {
- AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.Aluminum_PV1112");
- if (recombinationRateSetDialog.hasModule)
- {
- recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
- recombinationRateSetDialog.ShowDialog();
- }
- else
- {
- recombinationRateSetDialog = null;
- }
- }
- bitList.Clear();
- 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>>();
- for (int i = 0; i < this.dataGridView_results.Rows.Count; i++)
- {
- List<string> content1 = new List<string>();
- if (i == 0)
- {
- content1.Add(this.dataGridView_results.Columns[0].HeaderText);
- content1.Add(this.dataGridView_results.Columns[1].HeaderText);
- content1.Add(this.dataGridView_results.Columns[2].HeaderText);
- content1.Add(this.dataGridView_results.Columns[3].HeaderText);
- content1.Add(this.dataGridView_results.Columns[4].HeaderText);
- analysisContent.Add(content1);
- }
- content1 = new List<string>();
- content1.Add(this.dataGridView_results.Rows[i].Cells[0].Value.ToString());
- content1.Add(this.dataGridView_results.Rows[i].Cells[1].Value.ToString());
- content1.Add(this.dataGridView_results.Rows[i].Cells[2].Value.ToString());
- content1.Add(this.dataGridView_results.Rows[i].Cells[3].Value.ToString());
- content1.Add(this.dataGridView_results.Rows[i].Cells[4].Value.ToString());
- analysisContent.Add(content1);
- string tag = this.dataGridView_results.Rows[i].Cells[0].Value.ToString();
- if (bitDic.ContainsKey(tag))
- {
- bitList.Add(bitDic[tag][0]);
- bitList.Add(bitDic[tag][1]);
- }
- }
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
- }
- /// <summary>
- /// 初始化参数配置下拉
- /// </summary>
- public void InitParameterList(int index = 0)
- {
- List<string> fileNames = FileOperationHelper.GetFileList(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryExtraction\\");
- files.Clear();
- foreach (string fileName in fileNames)
- {
- string name = fileName.Substring(0, fileName.LastIndexOf("."));
- files.Add(name);
- }
- string nowModelName = Startup.instance.configModel.BinaryParameter.Substring(0, Startup.instance.configModel.Watermark.LastIndexOf("."));
- this.binaryExtractionModel = XmlSerializeHelper.DESerializer<BinaryExtractionModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryExtraction\\Default.xml", FileMode.Open));/*" + this.comboBox1.SelectedItem.ToString() + "*///##############
- //this.binaryExtractionModel.ColorInterval = 1;
- }
- #region 内部类
- internal class LocalListViewItem
- {
- public DocumentWorkspace Value { get; }
- public string Display { get; }
- public LocalListViewItem(DocumentWorkspace Value, string Display)
- {
- this.Value = Value;
- this.Display = Display;
- }
- }
- internal class DocumentItem
- {
- public Bitmap bitmap;
- public GraphicsList graphicsList;
- public List<PhaseModel> phaseModels;
- public bool isErZhi = false;
- public DocumentItem(Bitmap bitmap, GraphicsList graphicsList, List<PhaseModel> phaseModels)
- {
- this.bitmap = bitmap;
- this.graphicsList = graphicsList;
- this.phaseModels = phaseModels;
- }
- }
- #endregion
- private void button9_Click(object sender, EventArgs e)
- {
- if (this.dataGridView_results.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noresults.text"));
- return;
- }
- if (this.analyzeSettingModel == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesetiirst.Text"));
- return;
- }
- //获取项目工程内的文件夹路径
- ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.NonferrousMetal.AluminiumAlloy.Text", this.analyzeSettingModel.savePath);
- if (item != null)
- {
- //向文件夹内保存图片和报告
- if (!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<List<string>> inclusionList = new List<List<string>>();
- List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
- List<Bitmap> bitImgList = new List<Bitmap>();
- for (int i = 0; i < this.dataGridView_results.Rows.Count; i++)
- {
- List<string> content1 = new List<string>();
- if (i == 0)
- {
- content1.Add(this.dataGridView_results.Columns[0].HeaderText);
- content1.Add(this.dataGridView_results.Columns[1].HeaderText);
- content1.Add(this.dataGridView_results.Columns[2].HeaderText);
- content1.Add(this.dataGridView_results.Columns[3].HeaderText);
- content1.Add(this.dataGridView_results.Columns[4].HeaderText);
- analysisContent.Add(content1);
- }
- content1 = new List<string>();
- content1.Add(this.dataGridView_results.Rows[i].Cells[0].Value.ToString());
- content1.Add(this.dataGridView_results.Rows[i].Cells[1].Value.ToString());
- content1.Add(this.dataGridView_results.Rows[i].Cells[2].Value.ToString());
- content1.Add(this.dataGridView_results.Rows[i].Cells[3].Value.ToString());
- content1.Add(this.dataGridView_results.Rows[i].Cells[4].Value.ToString());
- analysisContent.Add(content1);
- string tag = this.dataGridView_results.Rows[i].Cells[0].Value.ToString();
- if (intermediateDataList.ContainsKey(tag)) {
- ExportProjectModel exportProjectModel = new ExportProjectModel();
- exportProjectModel.dataList = intermediateDataList[tag];
- exportProjectModel.picName = tag;
- exportProjectModel.tagName = PdnResources.GetString("Menu.Dendritispacing.Text");
- exportModel.Add(exportProjectModel);
- }
- if (bitDic.ContainsKey(tag))
- {
- bitImgList.Add(bitDic[tag][0]);
- bitImgList.Add(bitDic[tag][1]);
- }
- }
- try
- {
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitImgList, tagInfos, item.path, item.code);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
- return;
- }
- //保存项目信息到数据库
- this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
- }
- }
- #region 参数保存及提取
- /// <summary>
- /// 保存参数的key,value和type
- /// </summary>
- /// <param name="param_key"></param>
- /// <param name="param_value"></param>
- /// <param name="param_type"></param>
- private void saveParamValue(string param_key, string param_value, int param_type)
- {
- bool foundItem = false;
- foreach (var item in this.analysisModel.ListParam)
- {
- if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
- {
- item.param_value = param_value;
- item.setValue();
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- {
- GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
- analysisItem.menuId = this.menuId;
- analysisItem.param_key = param_key;
- analysisItem.param_type = param_type;
- analysisItem.param_value = param_value;
- analysisItem.setValue();
- this.analysisModel.ListParam.Add(analysisItem);
- }
- }
- /// <summary>
- /// 保存界面中的参数到model
- /// </summary>
- private void saveDialogParamValues()
- {
- saveParamValue(ParamKey_Report, checkBox1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//筛选
- saveParamValue(ParamKey_Screen, checkBox3.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//报告设置
- saveParamValue(ParamKey_ScreenMin, triangleTrackBar1.Value.ToString(), (int)Base.Dtryt.Interger);//面积最小值
- saveParamValue(ParamKey_ScreenMax, triangleTrackBar2.Value.ToString(), (int)Base.Dtryt.Interger);//面积最大值
- saveParamValue(ParamKey_MeasuringWidth, numericUpDown1.Value.ToString(), (int)Base.Dtryt.Decimal);//测量线宽
- saveParamValue(ParamKey_MeasuringColour, panel2.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//测量线颜色
- saveParamValue(ParamKey_ChoiceMeasuring, radioButton1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//选择测量线
- saveParamValue(ParamKey_ChoiceSection, radioButton2.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//选择测截点
- saveParamValue(ParamKey_ChoiceRound, rb_1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//截点圆形
- saveParamValue(ParamKey_ChoiceSquare, rb_2.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//截点方形
- saveParamValue(ParamKey_ChoiceSolid, rb_3.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//截点实心
- saveParamValue(ParamKey_ChoiceHollow, rb_4.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//截点空心
- saveParamValue(ParamKey_ChoiceSize, numericUpDown2.Value.ToString(), (int)Base.Dtryt.Decimal);//截点大小
- saveParamValue(ParamKey_ChoiceColour, panel4.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//截点颜色
- saveParamValue(ParamKey_ChoiceWidth, numericUpDown3.Value.ToString(), (int)Base.Dtryt.Decimal);//截点线宽
- saveParamValue(ParamKey_ChoiceError, numericUpDown4.Value.ToString(), (int)Base.Dtryt.Decimal);//截点误差
- saveParamValue(ParamKey_Binary, checkBox4.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//二值显示
- saveParamValue(ParamKey_Grid, checkBox5.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//网格显示
- saveParamValue(ParamKey_Section, checkBox6.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//截点显示
- saveParamValue(ParamKey_DecimalPlace, numericUpDown5 != null ? numericUpDown5.Value.ToString() : "", (int)Base.Dtryt.Decimal);//保留小数位数
- }
- /// <summary>
- /// 获取保存的参数
- /// </summary>
- private void GetListParamModel()
- {
- if (this.analysisModel != null)
- {
- for (int i = 0; i < this.analysisModel.ListParam.Count; i++)
- {
- switch (this.analysisModel.ListParam[i].param_key)
- {
- case ParamKey_Report:
- checkBox1.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Screen:
- checkBox3.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_ScreenMin:
- var val1 = Convert.ToInt32(this.analysisModel.ListParam[i].value);
- if (val1 < triangleTrackBar1.Minimum || val1 > triangleTrackBar1.Maximum)
- {
- triangleTrackBar1.Value = triangleTrackBar1.Minimum;
- lbl_kl_min.Text = triangleTrackBar1.Value.ToString();
- }
- else {
- triangleTrackBar1.Value = val1;
- lbl_kl_min.Text = triangleTrackBar1.Value.ToString();
- }
- break;
- case ParamKey_ScreenMax:
- var val2 = Convert.ToInt32(this.analysisModel.ListParam[i].value);
- if (val2 < triangleTrackBar2.Minimum || val2 > triangleTrackBar2.Maximum)
- {
- triangleTrackBar2.Value = triangleTrackBar2.Maximum;
- lbl_kl_max.Text = triangleTrackBar2.Value.ToString();
- }
- else
- {
- triangleTrackBar2.Value = val2;
- lbl_kl_max.Text = triangleTrackBar2.Value.ToString();
- }
- break;
- case ParamKey_MeasuringWidth:
- numericUpDown1.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
- break;
- case ParamKey_MeasuringColour:
- panel2.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_ChoiceMeasuring:
- radioButton1.Checked = (Boolean)this.analysisModel.ListParam[i].value; ;
- break;
- case ParamKey_ChoiceSection:
- radioButton2.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_ChoiceRound:
- rb_1.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_ChoiceSquare:
- rb_2.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_ChoiceSolid:
- rb_3.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_ChoiceHollow:
- rb_4.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_ChoiceSize:
- numericUpDown2.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
- break;
- case ParamKey_ChoiceColour:
- panel4.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_ChoiceWidth:
- numericUpDown3.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
- break;
- case ParamKey_ChoiceError:
- numericUpDown4.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
- break;
- case ParamKey_Binary:
- checkBox4.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- checkBox4_CheckedChanged(null, null);
- break;
- case ParamKey_Grid:
- checkBox5.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- checkBox5_CheckedChanged(null, null);
- break;
- case ParamKey_Section:
- checkBox6.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- checkBox6_CheckedChanged(null, null);
- break;
- case ParamKey_DecimalPlace:
- numericUpDown5.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
- break;
- }
- }
- }
- }
- #endregion
- #region [脚本录制]
- private void getScriptRecording()
- {
- string className = InvariantData.path_Action + ".Action" + menuId;
- ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
- List<Args> args = param.Lists;
- foreach (var item in args)
- {
- item.value = setScriptRecording(item.key);
- }
- //找出二值相关参数 进行赋值
- List<Args> isNullList = args.Where(m => m.value == null).ToList();
- foreach (var item in isNullList)
- {
- item.value = binaryClass.setScriptRecording(item.key);
- }
- appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
- }
- private object setScriptRecording(string key)
- {
- object value = null;
- switch (key)
- {
- case "parameter11":
- value = numericUpDown1.Value;
- break;
- case "parameter12":
- value = panel2.BackColor.ToArgb();
- break;
- case "parameter13":
- value = radioButton1.Checked ? 1 : 2;
- break;
- case "parameter14":
- value = rb_1.Checked ? 1 : 2;
- break;
- case "parameter15":
- value = rb_3.Checked ? 1 : 2;
- break;
- case "parameter16":
- value = numericUpDown2.Value;
- break;
- case "parameter17":
- value = numericUpDown3.Value;
- break;
- case "parameter18":
- value = numericUpDown4.Value;
- break;
- case "parameter19":
- value = checkBox4.Checked;
- break;
- case "parameter20":
- value = checkBox5.Checked;
- break;
- case "parameter21":
- value = checkBox6.Checked;
- break;
- case "parameter22":
- value = panel4.BackColor.ToArgb();
- break;
- case "OpenWhileExportReport":
- value = checkBox1.Checked;
- break;
- case "CalculatorDecimalDigits":
- value = numericUpDown5.Value;
- break;
- case "ExportResults":
- value = false;
- break;
- case "ExportReports":
- value = false;
- break;
- case "ExportProjects":
- value = false;
- break;
- }
- return value;
- }
- #endregion
- }
- }
-
|