12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509 |
- 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>
- /// 选中图片的mat
- /// </summary>
- private Mat imageMat;
- 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);//二值化后续处理事件
- documentWorkspace.ActiveTool = DrawToolType.NullTool;
- 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 && documentWorkspace.ActiveTool == DrawToolType.NullTool)
- {
- 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 && documentWorkspace.ActiveTool == DrawToolType.NullTool)
- {
- 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 && documentWorkspace.ActiveTool == DrawToolType.NullTool)
- {
- 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.ActiveTool = DrawToolType.NullTool;
- documentWorkspace.Cursor = Cursors.Default;
- documentWorkspace.GraphicsList.UnselectAll();
- 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.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
- Document document = Document.FromImageMat(imageMat.Clone());
- this.documentWorkspace.Document = document;
- this.documentWorkspace.Visible = true;
- Init();
- binaryClass.listView1_SelectedIndexChanged(this.imageMat.Clone());
- 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 = PaintDotNet.Camera.Tools.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
- }
- }
|