| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966 |
- using OpenCvSharp;
- using OpenCvSharp.Extensions;
- using PaintDotNet.Annotation;
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.Base.Functionodel;
- using PaintDotNet.CustomControl;
- using PaintDotNet.DbOpreate.DbBll;
- using PaintDotNet.DbOpreate.DbModel;
- using PaintDotNet.Instrument;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Data.Entity.Migrations.Infrastructure;
- using System.Diagnostics.Contracts;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace PaintDotNet.DedicatedAnalysis.VermiculateCastIron.JBT3829_1999
- {
- /// <summary>
- /// 蠕化级别
- /// </summary>
- internal class VermiculateCastIronJBT3829Classification : PdnBaseForm
- {
- #region 基础控件
- private Button button1;
- private CheckBox checkBox1;
- private Button button2;
- private GroupBox groupBox2;
- private ListView listView1;
- private GroupBox groupBox3;
- private GroupBox groupBox5;
- private GroupBox groupBox6;
- private GroupBox groupBox8;
- private DataGridView dataGridView1;
- private GroupBox groupBox9;
- private Button button6;
- private Button button7;
- private ListView listView2;
- private DataGridView dataGridView2;
- private Button button9;
- private Button button8;
- private NumericUpDown numericUpDown1;
- private Label label8;
- private Label label9;
- private Label label10;
- private ImageList imageList1;
- private IContainer components;
- private GroupBox groupBox1;
- private TrackBar trackBar2;
- private NumericUpDown numericUpDown5;
- private NumericUpDown numericUpDown4;
- private Label label3;
- private CheckBox checkBox3;
- private TrackBar trackBar4;
- private GroupBox groupBox7;
- private Button button4;
- private Button button3;
- private CheckBox checkBox5;
- private CheckBox checkBox4;
- private Label label5;
- private NumericUpDown numericUpDown6;
- private Label label4;
- private DataGridViewTextBoxColumn Column1;
- private DataGridViewTextBoxColumn Column2;
- private DataGridViewTextBoxColumn Column3;
- private DataGridViewTextBoxColumn Column4;
- private DataGridViewTextBoxColumn Column5;
- private DataGridViewTextBoxColumn Column6;
- private DataGridViewTextBoxColumn Column7;
- private DataGridViewTextBoxColumn Column8;
- private DataGridViewTextBoxColumn Column9;
- private DataGridViewTextBoxColumn Column10;
- private DataGridViewTextBoxColumn Column11;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn9;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn10;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn11;
- private DataGridViewTextBoxColumn Column12;
- #endregion
- /// <summary>
- /// 调色板
- /// </summary>
- PaintDotNet.ColorsForm colorsForm1;
- /// <summary>
- /// 主控件
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 图像面板
- /// </summary>
- private DocumentWorkspaceWindow documentWorkspace;
- /// <summary>
- /// 公共按钮
- /// </summary>
- private CommonControlButtons commonControlButtons;
- /// <summary>
- /// 选中图片的bitmap
- /// </summary>
- private Bitmap bitmap;
- /// <summary>
- /// 计算结果的表格集合
- /// </summary>
- private List<DataTable> resultTableList = new List<DataTable>();
- /// <summary>
- /// 保存用于生成报告的图片
- /// </summary>
- private List<Bitmap> bitList;
- /// <summary>
- /// 储存点击保存结果后的所有原图与分析图
- /// </summary>
- private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
- /// <summary>
- /// 是否显示全部
- /// </summary>
- private bool showAll = false;
- /// <summary>
- /// 当前图片是否有视场
- /// </summary>
- private bool isHadView = false;
- /// <summary>
- /// 原图mat-包括视场
- /// </summary>
- private Mat mat;
- /// <summary>
- /// 单位标尺
- /// </summary>
- private double unitLength = 1;
- /// <summary>
- /// 球状点集合
- /// </summary>
- private List<List<OpenCvSharp.Point>> ballPoint;
- /// <summary>
- /// 团状点集合
- /// </summary>
- private List<List<OpenCvSharp.Point>> groupPoint;
- /// <summary>
- /// 蠕虫状点集合
- /// </summary>
- private List<List<OpenCvSharp.Point>> vermicularPoint;
- /// <summary>
- /// 球状圆形系数集合
- /// </summary>
- private List<double> ballCircleList;
- /// <summary>
- /// 团状圆形系数集合
- /// </summary>
- private List<double> groupCircleList;
- /// <summary>
- /// 蠕虫状圆形系数集合
- /// </summary>
- private List<double> vermicularCircleList;
- /// <summary>
- /// 球状面积
- /// </summary>
- private double ballCircleArea;
- /// <summary>
- /// 团状面积
- /// </summary>
- private double groupCircleArea;
- /// <summary>
- /// 蠕虫状面积
- /// </summary>
- private double vermicularCircleArea;
- /// <summary>
- /// 圆形系数
- /// </summary>
- private double[] CircularityCoefficient = new double[] { 0.525, 0.625 };
- /// <summary>
- /// 是否仅修改相的颜色
- /// </summary>
- private bool changeColor = false;
- /// <summary>
- /// 球状颜色
- /// </summary>
- public Color BallColor = Color.LightBlue;
- /// <summary>
- /// 团状颜色
- /// </summary>
- public Color GroupColor = Color.YellowGreen;
- /// <summary>
- /// 蠕虫状颜色
- /// </summary>
- public Color VermicularColor = Color.Yellow;
- /// <summary>
- /// 字体
- /// </summary>
- public string fontStyle = "宋体";
- /// <summary>
- /// 字号
- /// </summary>
- public float fontSize = 12;
- /// <summary>
- /// 字体颜色
- /// </summary>
- public Color fontColor = Color.Black;
- /// <summary>
- /// 放大倍数
- /// </summary>
- private decimal gainNumber;
- /// <summary>
- /// 是否未对图片做其他操作
- /// </summary>
- private bool isFirstSwitch = false;
- /// <summary>
- /// 中间数据
- /// </summary>
- private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
- /// <summary>
- /// 面积
- /// </summary>
- private List<string> tempArea;
- /// <summary>
- /// 最大卡规直径
- /// </summary>
- private List<string> maxCaliperDiameter;
- private Button button5;
- private BinaryControl bc;
- //二值化集成1
- BinaryClass binaryClass;
- private int menuId;
- private string menuName;
- /// <summary>
- /// 原型系数
- /// </summary>
- private List<string> circleCoefficientList;
- public VermiculateCastIronJBT3829Classification(AppWorkspace appWorkspace, PdnMenuItem menuItem)
- {
- this.menuId = menuItem.MenuId;
- this.menuName = menuItem.Text;
- binaryClass = new BinaryClass(menuId);
- this.appWorkspace = appWorkspace;
- InitializeComponent();
- InitializeCustomControl();
- InitializeLanguageText();
- InitGridHeader();
- InitPicList();
- InitOtherTools();
- InitCommonButtonEvent();
- AddPictureBoxEvent();
- SetAnalyzeModelFromXml("Template.Manager.item3.VermiculateCastIronJBT3829");
- }
- private void InitializeCustomControl()
- {
- //
- // 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(147, 60);
- this.bc.Name = "bc";
- this.bc.OriginChecked = false;
- this.bc.scope1End = 0D;
- this.bc.scope1Start = 0D;
- this.bc.scope2End = 0D;
- this.bc.scope2Start = 0D;
- this.bc.scope3End = 0D;
- this.bc.scope3Start = 0D;
- this.bc.Size = new System.Drawing.Size(360, 292);
- this.bc.TabIndex = 19;
- this.Controls.Add(this.bc);
- this.Controls.SetChildIndex(this.bc, 0);
- }
- private void InitializeLanguageText()
- {
- this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
- this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
- this.checkBox1.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
- this.button1.Text = PdnResources.GetString("Menu.Setting.Text");
- this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
- this.groupBox3.Text = PdnResources.GetString("Menu.Preview.text");
- this.groupBox5.Text = PdnResources.GetString("Menu.Particlescreening.text");
- this.label3.Text = PdnResources.GetString("Menu.range.text") + ":";
- this.checkBox3.Text = PdnResources.GetString("Menu.filter.text");
- this.groupBox6.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
- this.button4.Text = PdnResources.GetString("Menu.Colorsetting.text");
- this.button3.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
- this.groupBox8.Text = PdnResources.GetString("Menu.Theesultshow.text");
- this.Column1.HeaderText = PdnResources.GetString("Menu.view.text");
- this.Column8.HeaderText = PdnResources.GetString("Menu.Thetotalarea.text");
- this.groupBox9.Text = PdnResources.GetString("Menu.Analysisresult.text");
- this.button5.Text = PdnResources.GetString("Menu.Exportproject.text");
- this.label8.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
- this.button9.Text = PdnResources.GetString("Menu.Exportresults.text");
- this.button8.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
- this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.picture.Text");
- this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.view.text");
- this.dataGridViewTextBoxColumn9.HeaderText = PdnResources.GetString("Menu.Thetotalarea.text");
- this.button7.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.button6.Text = PdnResources.GetString("Menu.Showall.text");
- }
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- 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.listView1 = new System.Windows.Forms.ListView();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.trackBar4 = new System.Windows.Forms.TrackBar();
- this.trackBar2 = new System.Windows.Forms.TrackBar();
- this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
- this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
- this.label3 = new System.Windows.Forms.Label();
- this.checkBox3 = new System.Windows.Forms.CheckBox();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.button4 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.checkBox5 = new System.Windows.Forms.CheckBox();
- this.checkBox4 = new System.Windows.Forms.CheckBox();
- this.groupBox8 = new System.Windows.Forms.GroupBox();
- this.dataGridView1 = new System.Windows.Forms.DataGridView();
- this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.groupBox9 = new System.Windows.Forms.GroupBox();
- this.button5 = new System.Windows.Forms.Button();
- this.label10 = new System.Windows.Forms.Label();
- this.label9 = new System.Windows.Forms.Label();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.label8 = new System.Windows.Forms.Label();
- this.button9 = new System.Windows.Forms.Button();
- this.button8 = new System.Windows.Forms.Button();
- this.dataGridView2 = new System.Windows.Forms.DataGridView();
- this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.listView2 = new System.Windows.Forms.ListView();
- this.button7 = new System.Windows.Forms.Button();
- this.button6 = new System.Windows.Forms.Button();
- this.groupBox7 = new System.Windows.Forms.GroupBox();
- this.label5 = new System.Windows.Forms.Label();
- this.numericUpDown6 = new System.Windows.Forms.NumericUpDown();
- this.label4 = new System.Windows.Forms.Label();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox5.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
- this.groupBox6.SuspendLayout();
- this.groupBox8.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
- this.groupBox9.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
- this.groupBox7.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox1.Controls.Add(this.button2);
- this.groupBox1.Controls.Add(this.checkBox1);
- this.groupBox1.Controls.Add(this.button1);
- this.groupBox1.Location = new System.Drawing.Point(14, 3);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(1081, 50);
- this.groupBox1.TabIndex = 1;
- this.groupBox1.TabStop = false;
- //
- // button2
- //
- this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.button2.Location = new System.Drawing.Point(985, 14);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(84, 30);
- this.button2.TabIndex = 2;
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // checkBox1
- //
- this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.checkBox1.AutoSize = true;
- this.checkBox1.Location = new System.Drawing.Point(141, 21);
- this.checkBox1.Name = "checkBox1";
- this.checkBox1.Size = new System.Drawing.Size(15, 14);
- this.checkBox1.TabIndex = 1;
- this.checkBox1.UseVisualStyleBackColor = true;
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.button1.Location = new System.Drawing.Point(15, 14);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(84, 30);
- this.button1.TabIndex = 0;
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // groupBox2
- //
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox2.Controls.Add(this.listView1);
- this.groupBox2.Location = new System.Drawing.Point(14, 60);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(135, 607);
- this.groupBox2.TabIndex = 2;
- this.groupBox2.TabStop = false;
- //
- // listView1
- //
- this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.listView1.HideSelection = false;
- this.listView1.LargeImageList = this.imageList1;
- this.listView1.Location = new System.Drawing.Point(5, 17);
- this.listView1.MultiSelect = false;
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(124, 584);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
- //
- // imageList1
- //
- this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- //
- // groupBox3
- //
- this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox3.Location = new System.Drawing.Point(515, 60);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(580, 606);
- this.groupBox3.TabIndex = 3;
- this.groupBox3.TabStop = false;
- //
- // groupBox5
- //
- this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox5.Controls.Add(this.trackBar4);
- this.groupBox5.Controls.Add(this.trackBar2);
- this.groupBox5.Controls.Add(this.numericUpDown5);
- this.groupBox5.Controls.Add(this.numericUpDown4);
- this.groupBox5.Controls.Add(this.label3);
- this.groupBox5.Controls.Add(this.checkBox3);
- this.groupBox5.Location = new System.Drawing.Point(149, 358);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(353, 78);
- this.groupBox5.TabIndex = 5;
- this.groupBox5.TabStop = false;
- //
- // trackBar4
- //
- this.trackBar4.Cursor = System.Windows.Forms.Cursors.Hand;
- this.trackBar4.Location = new System.Drawing.Point(257, 46);
- this.trackBar4.Maximum = 0;
- this.trackBar4.Name = "trackBar4";
- this.trackBar4.Size = new System.Drawing.Size(92, 45);
- this.trackBar4.TabIndex = 14;
- this.trackBar4.TickStyle = System.Windows.Forms.TickStyle.None;
- this.trackBar4.Scroll += new System.EventHandler(this.trackBar4_Scroll);
- //
- // trackBar2
- //
- this.trackBar2.Cursor = System.Windows.Forms.Cursors.Hand;
- this.trackBar2.Location = new System.Drawing.Point(104, 46);
- this.trackBar2.Maximum = 0;
- this.trackBar2.Name = "trackBar2";
- this.trackBar2.Size = new System.Drawing.Size(92, 45);
- this.trackBar2.TabIndex = 13;
- this.trackBar2.TickStyle = System.Windows.Forms.TickStyle.None;
- this.trackBar2.Scroll += new System.EventHandler(this.trackBar2_Scroll);
- //
- // numericUpDown5
- //
- this.numericUpDown5.Location = new System.Drawing.Point(197, 46);
- this.numericUpDown5.Maximum = new decimal(new int[] {
- 0,
- 0,
- 0,
- 0});
- this.numericUpDown5.Name = "numericUpDown5";
- this.numericUpDown5.Size = new System.Drawing.Size(62, 21);
- this.numericUpDown5.TabIndex = 12;
- this.numericUpDown5.ValueChanged += new System.EventHandler(this.numericUpDown5_ValueChanged);
- //
- // numericUpDown4
- //
- this.numericUpDown4.Location = new System.Drawing.Point(44, 46);
- this.numericUpDown4.Maximum = new decimal(new int[] {
- 0,
- 0,
- 0,
- 0});
- this.numericUpDown4.Name = "numericUpDown4";
- this.numericUpDown4.Size = new System.Drawing.Size(62, 21);
- this.numericUpDown4.TabIndex = 10;
- this.numericUpDown4.ValueChanged += new System.EventHandler(this.numericUpDown4_ValueChanged);
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(9, 50);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(0, 12);
- this.label3.TabIndex = 9;
- //
- // checkBox3
- //
- this.checkBox3.AutoSize = true;
- this.checkBox3.Location = new System.Drawing.Point(30, 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);
- //
- // groupBox6
- //
- this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox6.Controls.Add(this.button4);
- this.groupBox6.Controls.Add(this.button3);
- this.groupBox6.Controls.Add(this.checkBox5);
- this.groupBox6.Controls.Add(this.checkBox4);
- this.groupBox6.Location = new System.Drawing.Point(153, 442);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(354, 63);
- this.groupBox6.TabIndex = 6;
- this.groupBox6.TabStop = false;
- //
- // button4
- //
- this.button4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.button4.Location = new System.Drawing.Point(221, 36);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(94, 20);
- this.button4.TabIndex = 3;
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // button3
- //
- this.button3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.button3.Location = new System.Drawing.Point(221, 12);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(94, 20);
- this.button3.TabIndex = 2;
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // checkBox5
- //
- this.checkBox5.AutoSize = true;
- this.checkBox5.Location = new System.Drawing.Point(32, 38);
- this.checkBox5.Name = "checkBox5";
- this.checkBox5.Size = new System.Drawing.Size(156, 16);
- this.checkBox5.TabIndex = 1;
- this.checkBox5.Text = "显示不同级别的石墨颜色";
- this.checkBox5.UseVisualStyleBackColor = true;
- this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
- //
- // checkBox4
- //
- this.checkBox4.AutoSize = true;
- this.checkBox4.Location = new System.Drawing.Point(32, 17);
- 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);
- //
- // groupBox8
- //
- this.groupBox8.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.groupBox8.Controls.Add(this.dataGridView1);
- this.groupBox8.Location = new System.Drawing.Point(149, 554);
- this.groupBox8.Name = "groupBox8";
- this.groupBox8.Size = new System.Drawing.Size(353, 112);
- this.groupBox8.TabIndex = 8;
- this.groupBox8.TabStop = false;
- //
- // dataGridView1
- //
- this.dataGridView1.AllowUserToAddRows = false;
- this.dataGridView1.AllowUserToDeleteRows = false;
- this.dataGridView1.AllowUserToResizeColumns = false;
- this.dataGridView1.AllowUserToResizeRows = false;
- this.dataGridView1.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.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
- this.dataGridView1.ColumnHeadersHeight = 44;
- this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column1,
- this.Column2,
- this.Column3,
- this.Column4,
- this.Column5,
- this.Column6,
- this.Column7,
- this.Column8,
- this.Column9,
- this.Column10,
- this.Column11});
- this.dataGridView1.Location = new System.Drawing.Point(7, 21);
- this.dataGridView1.MultiSelect = false;
- this.dataGridView1.Name = "dataGridView1";
- this.dataGridView1.ReadOnly = true;
- this.dataGridView1.RowHeadersVisible = false;
- this.dataGridView1.RowTemplate.Height = 23;
- this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView1.Size = new System.Drawing.Size(340, 85);
- this.dataGridView1.TabIndex = 0;
- //
- // Column1
- //
- this.Column1.FillWeight = 73.14721F;
- this.Column1.MinimumWidth = 72;
- this.Column1.Name = "Column1";
- this.Column1.ReadOnly = true;
- this.Column1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.Column1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // Column2
- //
- this.Column2.FillWeight = 368.5279F;
- this.Column2.HeaderText = "球状面积";
- this.Column2.MinimumWidth = 66;
- this.Column2.Name = "Column2";
- this.Column2.ReadOnly = true;
- this.Column2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.Column2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // Column3
- //
- this.Column3.FillWeight = 73.14721F;
- this.Column3.HeaderText = "球状个数";
- this.Column3.MinimumWidth = 66;
- this.Column3.Name = "Column3";
- this.Column3.ReadOnly = true;
- this.Column3.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.Column3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // Column4
- //
- this.Column4.FillWeight = 73.14721F;
- this.Column4.HeaderText = "团状、团絮状面积";
- this.Column4.MinimumWidth = 66;
- this.Column4.Name = "Column4";
- this.Column4.ReadOnly = true;
- this.Column4.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.Column4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // Column5
- //
- this.Column5.FillWeight = 73.14721F;
- this.Column5.HeaderText = "团状、团絮状个数";
- this.Column5.MinimumWidth = 66;
- this.Column5.Name = "Column5";
- this.Column5.ReadOnly = true;
- this.Column5.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.Column5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // Column6
- //
- this.Column6.FillWeight = 73.14721F;
- this.Column6.HeaderText = "蠕虫状面积";
- this.Column6.MinimumWidth = 66;
- this.Column6.Name = "Column6";
- this.Column6.ReadOnly = true;
- this.Column6.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.Column6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // Column7
- //
- this.Column7.FillWeight = 73.14721F;
- this.Column7.HeaderText = "蠕虫状个数";
- this.Column7.MinimumWidth = 66;
- this.Column7.Name = "Column7";
- this.Column7.ReadOnly = true;
- this.Column7.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.Column7.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // Column8
- //
- this.Column8.FillWeight = 73.14721F;
- this.Column8.MinimumWidth = 66;
- this.Column8.Name = "Column8";
- this.Column8.ReadOnly = true;
- this.Column8.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.Column8.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // Column9
- //
- this.Column9.FillWeight = 73.14721F;
- this.Column9.HeaderText = "石墨含量";
- this.Column9.MinimumWidth = 66;
- this.Column9.Name = "Column9";
- this.Column9.ReadOnly = true;
- this.Column9.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.Column9.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // Column10
- //
- this.Column10.FillWeight = 73.14721F;
- this.Column10.HeaderText = "蠕化率";
- this.Column10.MinimumWidth = 66;
- this.Column10.Name = "Column10";
- this.Column10.ReadOnly = true;
- this.Column10.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.Column10.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // Column11
- //
- this.Column11.FillWeight = 73.14721F;
- this.Column11.HeaderText = "蠕化级别";
- this.Column11.MinimumWidth = 66;
- this.Column11.Name = "Column11";
- this.Column11.ReadOnly = true;
- this.Column11.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.Column11.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // groupBox9
- //
- this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox9.Controls.Add(this.button5);
- this.groupBox9.Controls.Add(this.label10);
- this.groupBox9.Controls.Add(this.label9);
- this.groupBox9.Controls.Add(this.numericUpDown1);
- this.groupBox9.Controls.Add(this.label8);
- this.groupBox9.Controls.Add(this.button9);
- this.groupBox9.Controls.Add(this.button8);
- this.groupBox9.Controls.Add(this.dataGridView2);
- this.groupBox9.Controls.Add(this.listView2);
- this.groupBox9.Controls.Add(this.button7);
- this.groupBox9.Controls.Add(this.button6);
- this.groupBox9.Location = new System.Drawing.Point(14, 672);
- this.groupBox9.Name = "groupBox9";
- this.groupBox9.Size = new System.Drawing.Size(1081, 204);
- this.groupBox9.TabIndex = 9;
- this.groupBox9.TabStop = false;
- //
- // button5
- //
- this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button5.Location = new System.Drawing.Point(941, 102);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(128, 26);
- this.button5.TabIndex = 10;
- this.button5.UseVisualStyleBackColor = true;
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // label10
- //
- this.label10.AutoSize = true;
- this.label10.ForeColor = System.Drawing.SystemColors.ScrollBar;
- this.label10.Location = new System.Drawing.Point(927, 9);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(11, 192);
- this.label10.TabIndex = 9;
- this.label10.Text = "|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|";
- //
- // label9
- //
- this.label9.AutoSize = true;
- this.label9.ForeColor = System.Drawing.SystemColors.ScrollBar;
- this.label9.Location = new System.Drawing.Point(210, 9);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(11, 192);
- this.label9.TabIndex = 8;
- this.label9.Text = "|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|";
- //
- // numericUpDown1
- //
- this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.numericUpDown1.Location = new System.Drawing.Point(993, 162);
- this.numericUpDown1.Maximum = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(70, 21);
- this.numericUpDown1.TabIndex = 7;
- this.numericUpDown1.Value = new decimal(new int[] {
- 2,
- 0,
- 0,
- 0});
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
- //
- // label8
- //
- this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.label8.AutoSize = true;
- this.label8.Location = new System.Drawing.Point(957, 167);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(0, 12);
- this.label8.TabIndex = 6;
- //
- // button9
- //
- this.button9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button9.Location = new System.Drawing.Point(941, 68);
- this.button9.Name = "button9";
- this.button9.Size = new System.Drawing.Size(128, 26);
- this.button9.TabIndex = 5;
- this.button9.UseVisualStyleBackColor = true;
- this.button9.Click += new System.EventHandler(this.button9_Click);
- //
- // button8
- //
- this.button8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button8.Location = new System.Drawing.Point(941, 34);
- this.button8.Name = "button8";
- this.button8.Size = new System.Drawing.Size(128, 26);
- this.button8.TabIndex = 4;
- this.button8.UseVisualStyleBackColor = true;
- this.button8.Click += new System.EventHandler(this.button8_Click);
- //
- // dataGridView2
- //
- this.dataGridView2.AllowUserToAddRows = false;
- this.dataGridView2.AllowUserToDeleteRows = false;
- this.dataGridView2.AllowUserToResizeColumns = false;
- this.dataGridView2.AllowUserToResizeRows = false;
- this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView2.BackgroundColor = System.Drawing.Color.White;
- this.dataGridView2.ColumnHeadersHeight = 48;
- this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.dataGridViewTextBoxColumn1,
- this.dataGridViewTextBoxColumn2,
- this.dataGridViewTextBoxColumn3,
- this.dataGridViewTextBoxColumn4,
- this.dataGridViewTextBoxColumn5,
- this.dataGridViewTextBoxColumn6,
- this.dataGridViewTextBoxColumn7,
- this.dataGridViewTextBoxColumn8,
- this.dataGridViewTextBoxColumn9,
- this.dataGridViewTextBoxColumn10,
- this.dataGridViewTextBoxColumn11,
- this.Column12});
- this.dataGridView2.Location = new System.Drawing.Point(228, 20);
- this.dataGridView2.MultiSelect = false;
- this.dataGridView2.Name = "dataGridView2";
- this.dataGridView2.ReadOnly = true;
- this.dataGridView2.RowHeadersVisible = false;
- this.dataGridView2.RowTemplate.Height = 23;
- this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView2.Size = new System.Drawing.Size(693, 176);
- this.dataGridView2.TabIndex = 3;
- //
- // dataGridViewTextBoxColumn1
- //
- this.dataGridViewTextBoxColumn1.FillWeight = 59.7742F;
- this.dataGridViewTextBoxColumn1.MinimumWidth = 56;
- this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
- this.dataGridViewTextBoxColumn1.ReadOnly = true;
- this.dataGridViewTextBoxColumn1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.dataGridViewTextBoxColumn1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // dataGridViewTextBoxColumn2
- //
- this.dataGridViewTextBoxColumn2.FillWeight = 57.7742F;
- this.dataGridViewTextBoxColumn2.MinimumWidth = 54;
- this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
- this.dataGridViewTextBoxColumn2.ReadOnly = true;
- this.dataGridViewTextBoxColumn2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.dataGridViewTextBoxColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // dataGridViewTextBoxColumn3
- //
- this.dataGridViewTextBoxColumn3.FillWeight = 59.7742F;
- this.dataGridViewTextBoxColumn3.HeaderText = "球状面积";
- this.dataGridViewTextBoxColumn3.MinimumWidth = 55;
- this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
- this.dataGridViewTextBoxColumn3.ReadOnly = true;
- this.dataGridViewTextBoxColumn3.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.dataGridViewTextBoxColumn3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // dataGridViewTextBoxColumn4
- //
- this.dataGridViewTextBoxColumn4.FillWeight = 59.7742F;
- this.dataGridViewTextBoxColumn4.HeaderText = "球状个数";
- this.dataGridViewTextBoxColumn4.MinimumWidth = 55;
- this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
- this.dataGridViewTextBoxColumn4.ReadOnly = true;
- this.dataGridViewTextBoxColumn4.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.dataGridViewTextBoxColumn4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // dataGridViewTextBoxColumn5
- //
- this.dataGridViewTextBoxColumn5.FillWeight = 59.7742F;
- this.dataGridViewTextBoxColumn5.HeaderText = "团状、团絮状面积";
- this.dataGridViewTextBoxColumn5.MinimumWidth = 55;
- this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
- this.dataGridViewTextBoxColumn5.ReadOnly = true;
- this.dataGridViewTextBoxColumn5.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.dataGridViewTextBoxColumn5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // dataGridViewTextBoxColumn6
- //
- this.dataGridViewTextBoxColumn6.FillWeight = 59.7742F;
- this.dataGridViewTextBoxColumn6.HeaderText = "团状、团絮状个数";
- this.dataGridViewTextBoxColumn6.MinimumWidth = 55;
- this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
- this.dataGridViewTextBoxColumn6.ReadOnly = true;
- this.dataGridViewTextBoxColumn6.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.dataGridViewTextBoxColumn6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // dataGridViewTextBoxColumn7
- //
- this.dataGridViewTextBoxColumn7.FillWeight = 59.7742F;
- this.dataGridViewTextBoxColumn7.HeaderText = "蠕虫状面积";
- this.dataGridViewTextBoxColumn7.MinimumWidth = 55;
- this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
- this.dataGridViewTextBoxColumn7.ReadOnly = true;
- this.dataGridViewTextBoxColumn7.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.dataGridViewTextBoxColumn7.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // dataGridViewTextBoxColumn8
- //
- this.dataGridViewTextBoxColumn8.FillWeight = 59.7742F;
- this.dataGridViewTextBoxColumn8.HeaderText = "蠕虫状个数";
- this.dataGridViewTextBoxColumn8.MinimumWidth = 55;
- this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
- this.dataGridViewTextBoxColumn8.ReadOnly = true;
- this.dataGridViewTextBoxColumn8.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.dataGridViewTextBoxColumn8.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // dataGridViewTextBoxColumn9
- //
- this.dataGridViewTextBoxColumn9.FillWeight = 59.7742F;
- this.dataGridViewTextBoxColumn9.MinimumWidth = 55;
- this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9";
- this.dataGridViewTextBoxColumn9.ReadOnly = true;
- this.dataGridViewTextBoxColumn9.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.dataGridViewTextBoxColumn9.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // dataGridViewTextBoxColumn10
- //
- this.dataGridViewTextBoxColumn10.FillWeight = 59.7742F;
- this.dataGridViewTextBoxColumn10.HeaderText = "石墨含量";
- this.dataGridViewTextBoxColumn10.MinimumWidth = 55;
- this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10";
- this.dataGridViewTextBoxColumn10.ReadOnly = true;
- this.dataGridViewTextBoxColumn10.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.dataGridViewTextBoxColumn10.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // dataGridViewTextBoxColumn11
- //
- this.dataGridViewTextBoxColumn11.FillWeight = 59.7742F;
- this.dataGridViewTextBoxColumn11.HeaderText = "蠕化率";
- this.dataGridViewTextBoxColumn11.MinimumWidth = 55;
- this.dataGridViewTextBoxColumn11.Name = "dataGridViewTextBoxColumn11";
- this.dataGridViewTextBoxColumn11.ReadOnly = true;
- this.dataGridViewTextBoxColumn11.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.dataGridViewTextBoxColumn11.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // Column12
- //
- this.Column12.FillWeight = 59.7742F;
- this.Column12.HeaderText = "蠕化级别";
- this.Column12.MinimumWidth = 55;
- this.Column12.Name = "Column12";
- this.Column12.ReadOnly = true;
- this.Column12.Resizable = System.Windows.Forms.DataGridViewTriState.False;
- this.Column12.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // listView2
- //
- this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.listView2.HideSelection = false;
- this.listView2.Location = new System.Drawing.Point(16, 56);
- this.listView2.Name = "listView2";
- this.listView2.Size = new System.Drawing.Size(181, 140);
- this.listView2.TabIndex = 2;
- this.listView2.UseCompatibleStateImageBehavior = false;
- this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
- //
- // button7
- //
- this.button7.Location = new System.Drawing.Point(145, 20);
- this.button7.Name = "button7";
- this.button7.Size = new System.Drawing.Size(52, 26);
- this.button7.TabIndex = 1;
- this.button7.UseVisualStyleBackColor = true;
- this.button7.Click += new System.EventHandler(this.button7_Click);
- //
- // button6
- //
- this.button6.Location = new System.Drawing.Point(16, 20);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(93, 26);
- this.button6.TabIndex = 0;
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // groupBox7
- //
- this.groupBox7.Controls.Add(this.label5);
- this.groupBox7.Controls.Add(this.numericUpDown6);
- this.groupBox7.Controls.Add(this.label4);
- this.groupBox7.Location = new System.Drawing.Point(149, 511);
- this.groupBox7.Name = "groupBox7";
- this.groupBox7.Size = new System.Drawing.Size(353, 37);
- this.groupBox7.TabIndex = 10;
- this.groupBox7.TabStop = false;
- this.groupBox7.Text = "分类参数设置";
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(197, 19);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(71, 12);
- this.label5.TabIndex = 2;
- this.label5.Text = "μm进行分类";
- //
- // numericUpDown6
- //
- this.numericUpDown6.Location = new System.Drawing.Point(135, 13);
- this.numericUpDown6.Maximum = new decimal(new int[] {
- 50,
- 0,
- 0,
- 0});
- this.numericUpDown6.Name = "numericUpDown6";
- this.numericUpDown6.Size = new System.Drawing.Size(58, 21);
- this.numericUpDown6.TabIndex = 1;
- this.numericUpDown6.Value = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- this.numericUpDown6.ValueChanged += new System.EventHandler(this.numericUpDown6_ValueChanged);
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(30, 19);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(101, 12);
- this.label4.TabIndex = 0;
- this.label4.Text = "最大中心长度大于";
- //
- // VermiculateCastIronJBT3829Classification
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(1107, 881);
- this.Controls.Add(this.groupBox7);
- this.Controls.Add(this.groupBox9);
- this.Controls.Add(this.groupBox8);
- this.Controls.Add(this.groupBox6);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "VermiculateCastIronJBT3829Classification";
- this.Text = "JB/T 3829-1999(蠕化级别)";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InclusionsStandardDialog_FormClosing);
- this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData);
- this.Load += new System.EventHandler(this.GrainSizeDialog_Load);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox3, 0);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.Controls.SetChildIndex(this.groupBox6, 0);
- this.Controls.SetChildIndex(this.groupBox8, 0);
- this.Controls.SetChildIndex(this.groupBox9, 0);
- this.Controls.SetChildIndex(this.groupBox7, 0);
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox5.ResumeLayout(false);
- this.groupBox5.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
- this.groupBox6.ResumeLayout(false);
- this.groupBox6.PerformLayout();
- this.groupBox8.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
- this.groupBox9.ResumeLayout(false);
- this.groupBox9.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
- this.groupBox7.ResumeLayout(false);
- this.groupBox7.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).EndInit();
- this.ResumeLayout(false);
- }
- /// <summary>
- /// 初始化其他控件
- /// </summary>
- private void InitOtherTools()
- {
- //
- //初始化图像控件
- //
- this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
- this.documentWorkspace.Dock = DockStyle.Fill;
- this.documentWorkspace.HookMouseEvents();
- this.documentWorkspace.AuxiliaryLineEnabled = false;
- this.documentWorkspace.Visible = false;
- this.documentWorkspace.activeTool = Annotation.Enum.DrawToolType.NullTool;
- this.groupBox3.Controls.Add(documentWorkspace);
- //
- //初始化操作按钮
- //
- this.commonControlButtons = new CommonControlButtons();
- this.commonControlButtons.Dock = DockStyle.Top;
- this.commonControlButtons.Height = 30;
- this.commonControlButtons.HideZoomToWindowAndActualSize();
- this.commonControlButtons.Visible = false;
- this.groupBox3.Controls.Add(commonControlButtons);
- //
- //调色板
- //
- this.colorsForm1 = new ColorsForm();
- this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.colorsForm1Changed));
- this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
- //
- //
- //获取系统标尺-微米
- //
- this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength);
- //
- //获取系统放大倍数
- //
- this.gainNumber = this.documentWorkspace.GetGainMultiple();
- if (this.gainNumber == 0)
- this.gainNumber = 1;
- //二值化集成2
- bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
- binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text"), PdnResources.GetString("Menu.Grainboundarytoreproduce.text") }
- , this.bc, this.appWorkspace, this.documentWorkspace, this.listView1);//初始化相的工作结构
- binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
- }
- //二值化集成3
- #region 二值化相关方法
- private void InclusionsStandardDialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- binaryClass.saveParams();
- }
- private void ShownChoiseItemAndInitData(object sender, EventArgs e)
- {
- binaryClass.RefreshHistogramControl1Values();
- }
- /// <summary>
- /// 添加参数改变的监听
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void GrainSizeDialog_Load(object sender, EventArgs e)
- {
- this.binaryClass.loadParams();
- }
- private bool bcBinaryChecked()
- {
- return bc != null && bc.BinaryChecked;
- }
- private bool bcOriginChecked()
- {
- return bc != null && bc.OriginChecked;
- }
- bool isChanegd = false;//判断参数是否变化
- /// <summary>
- /// 参数改变时,重新处理图像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bClassBinaryImplFinishAction(object sender, EventArgs e)
- {
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- if (bcBinaryChecked() && this.checkBox3.Checked)
- {
- ResetAreaAndContent();
- ReloadDebrisSelection();
- changeColor = false;
- this.documentWorkspace.PhaseModels[1].choise = true;
- this.documentWorkspace.PhaseModels[0].choise = false;
- }
- else if (bcBinaryChecked() && !this.checkBox3.Checked)
- {
- ResetAreaAndContent();
- changeColor = false;
- this.documentWorkspace.PhaseModels[1].choise = true;
- this.documentWorkspace.PhaseModels[0].choise = false;
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = false;
- }
- isChanegd = true;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 显示原图/原图+二值图
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bcOriginCheckedChanged(object sender, EventArgs e)
- {
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- {
- //this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = true;
- }
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = false;
- }
- this.documentWorkspace.Refresh();
- }
- #endregion
- /// <summary>
- /// 初始化图片列表数据
- /// </summary>
- public void InitPicList()
- {
- //初始化图片列表
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- {
- this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
- this.listView1.Items.Add("", i);
- this.listView1.Items[i].ImageIndex = i;
- this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- }
- }
- /// <summary>
- /// 初始化表头
- /// </summary>
- private void InitGridHeader()
- {
- //
- //结果展示表
- //
- this.dataGridView1.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[7].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[9].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[10].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- //
- //分析结果表
- //
- this.dataGridView2.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView2.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView2.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView2.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView2.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView2.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView2.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView2.Columns[7].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView2.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView2.Columns[9].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView2.Columns[10].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView2.Columns[11].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- //
- //左下表
- //
- this.listView2.View = View.Details;
- ColumnHeader header0 = new ColumnHeader();
- header0.Text = PdnResources.GetString("Menu.Imagelist.Text");
- header0.Width = 175;
- this.listView2.Columns.Add(header0);
- }
- /// <summary>
- /// 初始化画布按键功能
- /// </summary>
- private void InitCommonButtonEvent()
- {
- this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
- this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
- this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
- this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
- this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
- this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
- }
- private void zoomInButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomIn();
- }
- private void zoomOutButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomOut();
- }
- private void zoomToWindowButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
- }
- private void actualSizeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
- this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
- }
- private void pointerButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
- }
- private void mobileModeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
- }
- /// <summary>
- /// 添加画布绑定事件
- /// </summary>
- private void AddPictureBoxEvent()
- {
- this.documentWorkspace.panel.Paint += new PaintEventHandler(this.BoxPaintHandler);
- }
- /// <summary>
- /// 绘制事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void BoxPaintHandler(object sender, PaintEventArgs e)
- {
- if (this.documentWorkspace.CompositionSurface != null)
- {
- Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
- int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
- int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
- int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
- int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
- e.Graphics.TranslateTransform(x, y);
- e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
- Draw(e.Graphics);
- e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
- e.Graphics.TranslateTransform(-x, -y);
- }
- }
- /// <summary>
- /// 绘制
- /// </summary>
- private void Draw(Graphics graphics)
- {
- graphics.SmoothingMode = SmoothingMode.AntiAlias;
- Font font = new Font(this.fontStyle, this.fontSize);
- Brush brush = new SolidBrush(this.fontColor);
- //显示圆形系数
- if (this.checkBox4.Checked && !bcOriginChecked() && bcBinaryChecked())
- {
- if(this.ballPoint != null && this.ballPoint.Count > 0)
- {
- for(int i = 0; i < this.ballPoint.Count; i++)
- {
- graphics.DrawString(Math.Round(this.ballCircleList[i], Convert.ToInt32(this.numericUpDown1.Value)) + "", font, brush,
- new PointF(this.ballPoint[i][this.ballPoint[i].Count - 1].X, this.ballPoint[i][this.ballPoint[i].Count - 1].Y));
- }
- }
- if (this.groupPoint != null && this.groupPoint.Count > 0)
- {
- for (int i = 0; i < this.groupPoint.Count; i++)
- {
- graphics.DrawString(Math.Round(this.groupCircleList[i], Convert.ToInt32(this.numericUpDown1.Value)) + "", font, brush,
- new PointF(this.groupPoint[i][this.groupPoint[i].Count - 1].X, this.groupPoint[i][this.groupPoint[i].Count - 1].Y));
- }
- }
- if (this.vermicularPoint != null && this.vermicularPoint.Count > 0)
- {
- for (int i = 0; i < this.vermicularPoint.Count; i++)
- {
- graphics.DrawString(Math.Round(this.vermicularCircleList[i], Convert.ToInt32(this.numericUpDown1.Value)) + "", font, brush,
- new PointF(this.vermicularPoint[i][this.vermicularPoint[i].Count - 1].X, this.vermicularPoint[i][this.vermicularPoint[i].Count - 1].Y));
- }
- }
- }
- brush.Dispose();
- font.Dispose();
- }
- /// <summary>
- /// 添加内容单元格
- /// </summary>
- /// <param name="text"></param>
- /// <param name="tag"></param>
- /// <returns></returns>
- private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag)
- {
- DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
- textboxcell.Value = text;
- textboxcell.Tag = tag;
- return textboxcell;
- }
- /// <summary>
- /// 设置按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- AnalyzeSettingDialog metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.VermiculateCastIronJBT3829");
- if (metallographicMethodSetDialog.hasModule)
- {
- metallographicMethodSetDialog.StartPosition = FormStartPosition.CenterScreen;
- metallographicMethodSetDialog.ShowDialog();
- }
- else
- {
- metallographicMethodSetDialog = null;
- }
- }
- /// <summary>
- /// 保存结果按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- if (this.listView1.SelectedItems.Count > 0)
- {
- string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
- string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
- bool replace = false;
- int rowIndex = 0;
- if (this.dataGridView1.Rows.Count > 0)
- {
- if (this.listView2.Items.Count > 0)
- {
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (item.Name.Equals(tag))
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- replace = true;
- }
- else
- {
- return;
- }
- break;
- }
- }
- }
- //有重名需要替换
- if (replace)
- {
- for (int i = 0; i < this.resultTableList.Count; i++)
- {
- if (this.resultTableList[i].TableName.Equals(tag))
- {
- rowIndex = i;
- this.resultTableList.Remove(this.resultTableList[i]);
- DataTable dt = new DataTable(tag);
- dt.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
- dt.Columns.Add(PdnResources.GetString("Menu.view.text"));
- dt.Columns.Add("球状面积");
- dt.Columns.Add("球状个数");
- dt.Columns.Add("团状、团絮状面积");
- dt.Columns.Add("团状、团絮状个数");
- dt.Columns.Add("蠕虫状面积");
- dt.Columns.Add("蠕虫状个数");
- dt.Columns.Add(PdnResources.GetString("Menu.Thetotalarea.text"));
- dt.Columns.Add("石墨含量");
- dt.Columns.Add("蠕化率");
- dt.Columns.Add("蠕化级别");
- DataRow dataRow = dt.NewRow();
- dataRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
- dataRow[PdnResources.GetString("Menu.view.text")] = PdnResources.GetString("Menu.view.text")+"1";
- dataRow["球状面积"] = ballCircleArea;
- dataRow["球状个数"] = ballCircleList.Count;
- dataRow["团状、团絮状面积"] = groupCircleArea;
- dataRow["团状、团絮状个数"] = groupCircleList.Count;
- dataRow["蠕虫状面积"] = vermicularCircleArea;
- dataRow["蠕虫状个数"] = vermicularCircleList.Count;
- int bitArea = this.bitmap.Width * this.bitmap.Height;
- dataRow[PdnResources.GetString("Menu.Thetotalarea.text")] = bitArea;
- dataRow["石墨含量"] = (ballCircleArea + groupCircleArea + vermicularCircleArea) / bitArea;
- double CreepRatio = (vermicularCircleArea + 0.5 * groupCircleArea) / (ballCircleArea + groupCircleArea + vermicularCircleArea);
- dataRow["蠕化率"] = CreepRatio;
- if (CreepRatio >= 0.95)
- dataRow["蠕化级别"] = "蠕95";
- else if (CreepRatio < 0.95 && CreepRatio >= 0.9)
- dataRow["蠕化级别"] = "蠕90";
- else if (CreepRatio < 0.9 && CreepRatio >= 0.85)
- dataRow["蠕化级别"] = "蠕85";
- else if (CreepRatio < 0.85 && CreepRatio >= 0.8)
- dataRow["蠕化级别"] = "蠕80";
- else if (CreepRatio < 0.8 && CreepRatio >= 0.7)
- dataRow["蠕化级别"] = "蠕70";
- else if (CreepRatio < 0.7 && CreepRatio >= 0.6)
- dataRow["蠕化级别"] = "蠕60";
- else if (CreepRatio < 0.6 && CreepRatio >= 0.5)
- dataRow["蠕化级别"] = "蠕50";
- else if (CreepRatio < 0.5 && CreepRatio >= 0.4)
- dataRow["蠕化级别"] = "蠕40";
- else
- dataRow["蠕化级别"] = PdnResources.GetString("Menu.Theunknown.Text");
- dt.Rows.Add(dataRow);
- DataRow avgRow = dt.NewRow();
- avgRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
- avgRow[PdnResources.GetString("Menu.view.text")] = PdnResources.GetString("Menu.Image.Average.Text");
- avgRow["球状面积"] = dt.Rows[0][2].ToString();
- avgRow["球状个数"] = dt.Rows[0][3].ToString();
- avgRow["团状、团絮状面积"] = dt.Rows[0][4].ToString();
- avgRow["团状、团絮状个数"] = dt.Rows[0][5].ToString();
- avgRow["蠕虫状面积"] = dt.Rows[0][6].ToString();
- avgRow["蠕虫状个数"] = dt.Rows[0][7].ToString();
- avgRow[PdnResources.GetString("Menu.Thetotalarea.text")] = dt.Rows[0][8].ToString();
- avgRow["石墨含量"] = dt.Rows[0][9].ToString();
- avgRow["蠕化率"] = dt.Rows[0][10].ToString();
- avgRow["蠕化级别"] = dt.Rows[0][11].ToString();
- dt.Rows.Add(avgRow);
- resultTableList.Insert(rowIndex, dt);
- }
- }
- }
- //新增
- else
- {
- ListViewItem listViewItem = new ListViewItem();
- listViewItem.Name = tag;
- listViewItem.SubItems[0].Text = imgName;
- this.listView2.Items.Add(listViewItem);
- this.listView2.SelectedItems.Clear();
- this.listView2.Items[this.listView2.Items.Count - 1].Selected = true;
- DataTable dt = new DataTable(tag);
- dt.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
- dt.Columns.Add(PdnResources.GetString("Menu.view.text"));
- dt.Columns.Add("球状面积");
- dt.Columns.Add("球状个数");
- dt.Columns.Add("团状、团絮状面积");
- dt.Columns.Add("团状、团絮状个数");
- dt.Columns.Add("蠕虫状面积");
- dt.Columns.Add("蠕虫状个数");
- dt.Columns.Add(PdnResources.GetString("Menu.Thetotalarea.text"));
- dt.Columns.Add("石墨含量");
- dt.Columns.Add("蠕化率");
- dt.Columns.Add("蠕化级别");
- DataRow dataRow = dt.NewRow();
- dataRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
- dataRow[PdnResources.GetString("Menu.view.text")] = PdnResources.GetString("Menu.view.text")+"1";
- dataRow["球状面积"] = ballCircleArea;
- dataRow["球状个数"] = ballCircleList.Count;
- dataRow["团状、团絮状面积"] = groupCircleArea;
- dataRow["团状、团絮状个数"] = groupCircleList.Count;
- dataRow["蠕虫状面积"] = vermicularCircleArea;
- dataRow["蠕虫状个数"] = vermicularCircleList.Count;
- int bitArea = this.bitmap.Width * this.bitmap.Height;
- dataRow[PdnResources.GetString("Menu.Thetotalarea.text")] = bitArea;
- dataRow["石墨含量"] = (ballCircleArea + groupCircleArea + vermicularCircleArea) / bitArea;
- double CreepRatio = (vermicularCircleArea + 0.5 * groupCircleArea) / (ballCircleArea + groupCircleArea + vermicularCircleArea);
- dataRow["蠕化率"] = CreepRatio;
- if (CreepRatio >= 0.95)
- dataRow["蠕化级别"] = "蠕95";
- else if (CreepRatio < 0.95 && CreepRatio >= 0.9)
- dataRow["蠕化级别"] = "蠕90";
- else if (CreepRatio < 0.9 && CreepRatio >= 0.85)
- dataRow["蠕化级别"] = "蠕85";
- else if (CreepRatio < 0.85 && CreepRatio >= 0.8)
- dataRow["蠕化级别"] = "蠕80";
- else if (CreepRatio < 0.8 && CreepRatio >= 0.7)
- dataRow["蠕化级别"] = "蠕70";
- else if (CreepRatio < 0.7 && CreepRatio >= 0.6)
- dataRow["蠕化级别"] = "蠕60";
- else if (CreepRatio < 0.6 && CreepRatio >= 0.5)
- dataRow["蠕化级别"] = "蠕50";
- else if (CreepRatio < 0.5 && CreepRatio >= 0.4)
- dataRow["蠕化级别"] = "蠕40";
- else
- dataRow["蠕化级别"] = PdnResources.GetString("Menu.Theunknown.Text");
- dt.Rows.Add(dataRow);
- DataRow avgRow = dt.NewRow();
- avgRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
- avgRow[PdnResources.GetString("Menu.view.text")] = PdnResources.GetString("Menu.Image.Average.Text");
- avgRow["球状面积"] = dt.Rows[0][2].ToString();
- avgRow["球状个数"] = dt.Rows[0][3].ToString();
- avgRow["团状、团絮状面积"] = dt.Rows[0][4].ToString();
- avgRow["团状、团絮状个数"] = dt.Rows[0][5].ToString();
- avgRow["蠕虫状面积"] = dt.Rows[0][6].ToString();
- avgRow["蠕虫状个数"] = dt.Rows[0][7].ToString();
- avgRow[PdnResources.GetString("Menu.Thetotalarea.text")] = dt.Rows[0][8].ToString();
- avgRow["石墨含量"] = dt.Rows[0][9].ToString();
- avgRow["蠕化率"] = dt.Rows[0][10].ToString();
- avgRow["蠕化级别"] = dt.Rows[0][11].ToString();
- dt.Rows.Add(avgRow);
- resultTableList.Add(dt);
- }
- RefreshDataGridView2();
- //保存处理后的图片
- double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
- List<Bitmap> tempBit = new List<Bitmap>();
- Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- originalBit.Tag = pantographRatio;
- tempBit.Add(originalBit);
- Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[1].mat);
- Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
- Graphics graphics = Graphics.FromImage(newBit);
- graphics.DrawImage(processedBit, new PointF(0, 0));
- Draw(graphics);
- newBit.Tag = pantographRatio;
- tempBit.Add(newBit);
- if (bitDic.ContainsKey(tag))
- bitDic[tag] = tempBit;
- else
- bitDic.Add(tag, tempBit);
- //拼接中间数据
- List<List<string>> dataList = new List<List<string>>();
- List<string> columnName = new List<string>();
- columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
- columnName.Add(PdnResources.GetString("Menu.area.text"));
- columnName.Add(PdnResources.GetString("Menu.Maximumcaliperdiameter.text"));
- columnName.Add("圆形系数");
- dataList.Add(columnName);
- if (this.tempArea.Count > 0)
- {
- for (int i = 0; i < this.tempArea.Count; i++)
- {
- List<string> strList = new List<string>();
- strList.Add((i + 1).ToString());
- strList.Add(this.tempArea[i]);
- strList.Add(this.maxCaliperDiameter[i]);
- strList.Add(this.circleCoefficientList[i]);
- dataList.Add(strList);
- }
- }
- bool isExist = false;//是否已存在进行替换
- int modelIndex = -1;//要替换的下标
- for (int j = 0; j < tempDataModel.Count; j++)
- {
- if (tempDataModel[j].tagName.Equals(tag))
- {
- isExist = true;
- modelIndex = j;
- break;
- }
- }
- if (isExist && modelIndex > -1)
- tempDataModel[modelIndex].dataList = dataList;
- else
- {
- ExportProjectModel newModel = new ExportProjectModel();
- newModel.tagName = tag;
- newModel.picName = imgName;
- newModel.dataList = dataList;
- tempDataModel.Add(newModel);
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noinformationtosave.text"));
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapictaurefirst.Text"));
- }
- }
- /// <summary>
- /// 刷新分析结果表
- /// </summary>
- private void RefreshDataGridView2()
- {
- this.dataGridView2.Rows.Clear();
- if (this.showAll)
- {
- if (this.resultTableList.Count > 0)
- {
- foreach (DataTable dt in resultTableList)
- {
- for(int i = 0; i < dt.Rows.Count; i++)
- {
- DataGridViewRow row = new DataGridViewRow();
- row.Height = 30;
- row.Cells.Add(CreateTextBoxCell(dt.Rows[i][0].ToString(), ""));
- row.Cells.Add(CreateTextBoxCell(dt.Rows[i][1].ToString(), ""));
- row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][2].ToString()) ? "0" :
- dt.Rows[i][2].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
- row.Cells.Add(CreateTextBoxCell(dt.Rows[i][3].ToString(), ""));
- row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][4].ToString()) ? "0" :
- dt.Rows[i][4].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
- row.Cells.Add(CreateTextBoxCell(dt.Rows[i][5].ToString(), ""));
- row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][6].ToString()) ? "0" :
- dt.Rows[i][6].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
- row.Cells.Add(CreateTextBoxCell(dt.Rows[i][7].ToString(), ""));
- row.Cells.Add(CreateTextBoxCell(dt.Rows[i][8].ToString(), ""));
- row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][9].ToString()) ? "0" :
- dt.Rows[i][9].ToString()) * 100, Convert.ToInt32(this.numericUpDown1.Value)) + "%", ""));
- row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][10].ToString()) ? "0" :
- dt.Rows[i][10].ToString()) * 100, Convert.ToInt32(this.numericUpDown1.Value)) + "%", ""));
- row.Cells.Add(CreateTextBoxCell(dt.Rows[i][11].ToString(), ""));
- this.dataGridView2.Rows.Add(row);
- }
- }
- }
- }
- else
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
- {
- string tableName = this.listView2.SelectedItems[i].Name;
- foreach (DataTable dt in resultTableList)
- {
- if (dt.TableName.Equals(tableName))
- {
- for (int j = 0; j < dt.Rows.Count; j++)
- {
- DataGridViewRow row = new DataGridViewRow();
- row.Height = 30;
- row.Cells.Add(CreateTextBoxCell(dt.Rows[j][0].ToString(), ""));
- row.Cells.Add(CreateTextBoxCell(dt.Rows[j][1].ToString(), ""));
- row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][2].ToString()) ? "0" :
- dt.Rows[j][2].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
- row.Cells.Add(CreateTextBoxCell(dt.Rows[j][3].ToString(), ""));
- row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][4].ToString()) ? "0" :
- dt.Rows[j][4].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
- row.Cells.Add(CreateTextBoxCell(dt.Rows[j][5].ToString(), ""));
- row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][6].ToString()) ? "0" :
- dt.Rows[j][6].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
- row.Cells.Add(CreateTextBoxCell(dt.Rows[j][7].ToString(), ""));
- row.Cells.Add(CreateTextBoxCell(dt.Rows[j][8].ToString(), ""));
- row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][9].ToString()) ? "0" :
- dt.Rows[j][9].ToString()) * 100, Convert.ToInt32(this.numericUpDown1.Value)) + "%", ""));
- row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][10].ToString()) ? "0" :
- dt.Rows[j][10].ToString()) * 100, Convert.ToInt32(this.numericUpDown1.Value)) + "%", ""));
- row.Cells.Add(CreateTextBoxCell(dt.Rows[j][11].ToString(), ""));
- this.dataGridView2.Rows.Add(row);
- }
- }
- }
- }
- }
- }
- }
- /// <summary>
- /// 全部显示按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- if(this.button6.Text == PdnResources.GetString("Menu.Showall.text"))
- {
- this.button6.Text = PdnResources.GetString("Menu.Cancelshowall.text");
- this.showAll = true;
- RefreshDataGridView2();
- }
- else if (this.button6.Text == PdnResources.GetString("Menu.Cancelshowall.text"))
- {
- this.button6.Text = PdnResources.GetString("Menu.Showall.text");
- this.showAll = false;
- RefreshDataGridView2();
- }
- }
- /// <summary>
- /// 删除按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button7_Click(object sender, EventArgs e)
- {
- if(this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Determineallanalysisrlete.text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
- {
- string tableName = this.listView2.SelectedItems[i].Name;
- foreach (DataTable dt in resultTableList)
- {
- if (dt.TableName.Equals(tableName))
- {
- resultTableList.Remove(dt);
- break;
- }
- }
- if (bitDic.ContainsKey(tableName))
- bitDic.Remove(tableName);
- }
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (item.Selected)
- this.listView2.Items.Remove(item);
- }
- RefreshDataGridView2();
- }
- }
- }
- /// <summary>
- /// 生成报告按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button8_Click(object sender, EventArgs e)
- {
- if (this.checkBox1.Checked)
- this.button1.PerformClick();
- if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- //分析结果
- List<List<string>> analysisContent = new List<List<string>>();
- List<string> contentHead = new List<string>();
- contentHead.Add(PdnResources.GetString("Menu.picture.Text"));
- contentHead.Add(PdnResources.GetString("Menu.view.text"));
- contentHead.Add("球状面积");
- contentHead.Add("球状个数");
- contentHead.Add("团状、团絮状面积");
- contentHead.Add("团状、团絮状个数");
- contentHead.Add("蠕虫状面积");
- contentHead.Add("蠕虫状个数");
- contentHead.Add(PdnResources.GetString("Menu.Thetotalarea.text"));
- contentHead.Add("石墨含量");
- contentHead.Add("蠕化率");
- contentHead.Add("蠕化级别");
- analysisContent.Add(contentHead);
- foreach (DataGridViewRow item in this.dataGridView2.Rows)
- {
- List<string> content = new List<string>();
- content.Add(item.Cells[0].Value.ToString());
- content.Add(item.Cells[1].Value.ToString());
- content.Add(item.Cells[2].Value.ToString());
- content.Add(item.Cells[3].Value.ToString());
- content.Add(item.Cells[4].Value.ToString());
- content.Add(item.Cells[5].Value.ToString());
- content.Add(item.Cells[6].Value.ToString());
- content.Add(item.Cells[7].Value.ToString());
- content.Add(item.Cells[8].Value.ToString());
- content.Add(item.Cells[9].Value.ToString());
- content.Add(item.Cells[10].Value.ToString());
- content.Add(item.Cells[11].Value.ToString());
- analysisContent.Add(content);
- }
- //图片
- bitList = new List<Bitmap>();
- if (this.showAll)
- {
- foreach(KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
- {
- bitList.Add(kv.Value[0]);
- bitList.Add(kv.Value[1]);
- }
- }
- else
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- foreach (ListViewItem item in this.listView2.SelectedItems)
- {
- if (bitDic.ContainsKey(item.Name))
- {
- bitList.Add(bitDic[item.Name][0]);
- bitList.Add(bitDic[item.Name][1]);
- }
- }
- }
- }
-
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
- }
- /// <summary>
- /// 导出结果按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button9_Click(object sender, EventArgs e)
- {
- if (this.dataGridView2.Rows.Count > 0)
- {
- SaveFileDialog exe = new SaveFileDialog();
- exe.Filter = "Execl files (*.xlsx)|*.xlsx";
- exe.FilterIndex = 0;
- exe.RestoreDirectory = true;
- exe.Title = "Export Excel File";
- exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- exe.FileName = "蠕化级别" + PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddHHmmss");
- DialogResult dr = exe.ShowDialog();
- if (dr == DialogResult.OK)
- {
- DataTable dtb = new DataTable();
- dtb.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
- dtb.Columns.Add(PdnResources.GetString("Menu.view.text"));
- dtb.Columns.Add("球状面积");
- dtb.Columns.Add("球状个数");
- dtb.Columns.Add("团状、团絮状面积");
- dtb.Columns.Add("团状、团絮状个数");
- dtb.Columns.Add("蠕虫状面积");
- dtb.Columns.Add("蠕虫状个数");
- dtb.Columns.Add(PdnResources.GetString("Menu.Thetotalarea.text"));
- dtb.Columns.Add("石墨含量");
- dtb.Columns.Add("蠕化率");
- dtb.Columns.Add("蠕化级别");
- for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
- {
- DataRow dataRow = dtb.NewRow();
- dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView2.Rows[i].Cells[0].Value;
- dataRow[PdnResources.GetString("Menu.view.text")] = this.dataGridView2.Rows[i].Cells[1].Value;
- dataRow["球状面积"] = this.dataGridView2.Rows[i].Cells[2].Value;
- dataRow["球状个数"] = this.dataGridView2.Rows[i].Cells[3].Value;
- dataRow["团状、团絮状面积"] = this.dataGridView2.Rows[i].Cells[4].Value;
- dataRow["团状、团絮状个数"] = this.dataGridView2.Rows[i].Cells[5].Value;
- dataRow["蠕虫状面积"] = this.dataGridView2.Rows[i].Cells[6].Value;
- dataRow["蠕虫状个数"] = this.dataGridView2.Rows[i].Cells[7].Value;
- dataRow[PdnResources.GetString("Menu.Thetotalarea.text")] = this.dataGridView2.Rows[i].Cells[8].Value;
- dataRow["石墨含量"] = this.dataGridView2.Rows[i].Cells[9].Value;
- dataRow["蠕化率"] = this.dataGridView2.Rows[i].Cells[10].Value;
- dataRow["蠕化级别"] = this.dataGridView2.Rows[i].Cells[11].Value;
- dtb.Rows.Add(dataRow);
- }
- List<DataTable> list = new List<DataTable>();
- list.Add(dtb);
- this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
- }
- }
- else
- { MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text") + "!"); }
- }
-
- /// <summary>
- /// 图像索引切换选中事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listView1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
- {
- isChanegd = false;
- this.bitmap = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- //二值化集成4
- binaryClass.listView1_SelectedIndexChangedNoCheckedChanged(this.bitmap);
-
- this.documentWorkspace.Visible = true;
- this.commonControlButtons.Visible = true;
-
- //获得图像对应的mat
-
- ballCircleArea = 0;
- groupCircleArea = 0;
- vermicularCircleArea = 0;
- //清除计算并存储的数据
- ballPoint = null;
- groupPoint = null;
- vermicularPoint = null;
- ballCircleList = null;
- groupCircleList = null;
- vermicularCircleList = null;
- changeColor = false;
- isFirstSwitch = true;
- if (isChanegd == false)
- {
- ResetAreaAndContent();
- }
-
- }
- }
- /// <summary>
- /// 计算指定索引列的平均值-暂时没用到
- /// </summary>
- /// <param name="ColumnIndex"></param>
- /// <returns></returns>
- private double CalculateAverage(int ColumnIndex)
- {
- double sum = 0;
- double avg = 0;
- if (this.dataGridView1.Rows.Count > 0)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count - 1; i++)
- {
- try
- {
- double cellValue = double.Parse(this.dataGridView1.Rows[i].Cells[ColumnIndex].Value.ToString());
- sum += cellValue;
- }
- catch (Exception e)
- {
- continue;
- }
- }
- avg = sum / this.dataGridView1.Rows.Count - 1;
- }
- return avg;
- }
- /// <summary>
- /// 分析结果列表选择切换
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listView2_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.showAll)
- return;
- RefreshDataGridView2();
- }
- /// <summary>
- /// 刷新数据展示表
- /// </summary>
- private void RefreshDataGridView1()
- {
- //没处理多市场的索引
- int selectedRowIndex = -1;
- if (this.dataGridView1.Rows.Count > 0)
- selectedRowIndex = this.dataGridView1.SelectedRows[0].Index;
- this.dataGridView1.Rows.Clear();
- if(ballCircleList.Count == 0 && groupCircleList.Count == 0 && vermicularCircleList.Count == 0)
- {
- }
- else
- {
- DataGridViewRow row = new DataGridViewRow();
- row.Height = 37;
- row.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.view.text")+"1", ""));
- //球状面积
- row.Cells.Add(CreateTextBoxCell(Math.Round(ballCircleArea, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
- //球状个数
- row.Cells.Add(CreateTextBoxCell(ballCircleList.Count + "", ""));
- //团状、团絮状面积
- row.Cells.Add(CreateTextBoxCell(Math.Round(groupCircleArea, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
- //团状、团絮状个数
- row.Cells.Add(CreateTextBoxCell(groupCircleList.Count + "", ""));
- //蠕虫状面积
- row.Cells.Add(CreateTextBoxCell(Math.Round(vermicularCircleArea, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
- //蠕虫状个数
- row.Cells.Add(CreateTextBoxCell(vermicularCircleList.Count + "", ""));
- //总面积
- int bitArea = this.bitmap.Width * this.bitmap.Height;
- row.Cells.Add(CreateTextBoxCell(bitArea + "", ""));
- //石墨含量
- row.Cells.Add(CreateTextBoxCell(Math.Round((ballCircleArea + groupCircleArea + vermicularCircleArea) / bitArea * 100, Convert.ToInt32(this.numericUpDown1.Value)) + "%", ""));
- //蠕化率
- double CreepRatio = (vermicularCircleArea + 0.5 * groupCircleArea) / (ballCircleArea + groupCircleArea + vermicularCircleArea);
- row.Cells.Add(CreateTextBoxCell(Math.Round(CreepRatio * 100, Convert.ToInt32(this.numericUpDown1.Value)) + "%", ""));
- //蠕化级别
- if (CreepRatio >= 0.95)
- row.Cells.Add(CreateTextBoxCell("蠕95", ""));
- else if (CreepRatio < 0.95 && CreepRatio >= 0.9)
- row.Cells.Add(CreateTextBoxCell("蠕90", ""));
- else if (CreepRatio < 0.9 && CreepRatio >= 0.85)
- row.Cells.Add(CreateTextBoxCell("蠕85", ""));
- else if (CreepRatio < 0.85 && CreepRatio >= 0.8)
- row.Cells.Add(CreateTextBoxCell("蠕80", ""));
- else if (CreepRatio < 0.8 && CreepRatio >= 0.7)
- row.Cells.Add(CreateTextBoxCell("蠕70", ""));
- else if (CreepRatio < 0.7 && CreepRatio >= 0.6)
- row.Cells.Add(CreateTextBoxCell("蠕60", ""));
- else if (CreepRatio < 0.6 && CreepRatio >= 0.5)
- row.Cells.Add(CreateTextBoxCell("蠕50", ""));
- else if (CreepRatio < 0.5 && CreepRatio >= 0.4)
- row.Cells.Add(CreateTextBoxCell("蠕40", ""));
- else
- row.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.Theunknown.Text"), ""));
- this.dataGridView1.Rows.Add(row);
- //平均列写死
- DataGridViewRow rowAvg = new DataGridViewRow();
- rowAvg.Height = 36;
- rowAvg.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.Image.Average.Text"), ""));
- rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[1].Value.ToString(), ""));
- rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[2].Value.ToString(), ""));
- rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[3].Value.ToString(), ""));
- rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[4].Value.ToString(), ""));
- rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[5].Value.ToString(), ""));
- rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[6].Value.ToString(), ""));
- rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[7].Value.ToString(), ""));
- rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[8].Value.ToString(), ""));
- rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[9].Value.ToString(), ""));
- rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[10].Value.ToString(), ""));
- this.dataGridView1.Rows.Add(rowAvg);
- this.dataGridView1.ClearSelection();
- this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 2].Selected = true;//目前固定一个图只有一个视场,没做特殊处理
- }
- }
- private void colorsForm1Changed(object sender, EventArgs e)
- {
- binaryClass.SetBinaryBackColor(this.colorsForm1.UserPrimaryColor.ToColor());
- this.colorsForm1.Close();
- changeColor = true;
- ReLoadBinarization();
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 小数数字框值改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- if (this.numericUpDown1.Value > this.numericUpDown1.Maximum)
- this.numericUpDown1.Value = this.numericUpDown1.Maximum;
- if (this.numericUpDown1.Value < this.numericUpDown1.Minimum)
- this.numericUpDown1.Value = this.numericUpDown1.Minimum;
- RefreshDataGridView1();
- RefreshDataGridView2();
- if (this.checkBox4.Checked)
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 是否筛选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox3_CheckedChanged(object sender, EventArgs e)
- {
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- if (bcBinaryChecked() && this.checkBox3.Checked)
- {
- ReloadDebrisSelection();
- changeColor = false;
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = true;
- }
- }
- }
- else if (bcBinaryChecked() && !this.checkBox3.Checked)
- {
- changeColor = false;
- ReLoadBinarization();
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = true;
- }
- }
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 二值处理
- /// </summary>
- /// <param name="colorOneStart"></param>
- /// <param name="colorOneEnd"></param>
- /// <param name="phaseColor"></param>
- /// <returns></returns>
- private unsafe Mat Binarization(int colorOneStart, int colorOneEnd, Color phaseColor)
- {
- Mat srcGray;
- if (mat.Type() == MatType.CV_8UC1)
- srcGray = mat;
- else
- srcGray = mat.CvtColor(ColorConversionCodes.BGR2GRAY);
- Mat src = new Mat(mat.Rows, mat.Cols, MatType.CV_8UC4, new Scalar(0, 0, 0, 0));
- int index0 = 0;
- byte* ptr0 = (byte*)mat.Data;
- int index1 = 0;
- byte* ptr1 = (byte*)srcGray.Data;
- int index2 = 0;
- byte* ptr2 = (byte*)src.Data;
- for (int o = 0; o < srcGray.Height; o++)
- {
- for (int p = 0; p < srcGray.Width; p++)
- {
- index0 = (int)((mat.Step() * o) + (p * 4));
- index1 = (int)((srcGray.Step() * o) + (p * 1));
- index2 = (int)((src.Step() * o) + (p * 4));
- if (ptr1[index1] >= colorOneStart && ptr1[index1] <= colorOneEnd)
- {
- if (isHadView)
- {
- if (ptr0[index0 + 3] != 0)
- {
- ptr2[index2] = phaseColor.B;
- ptr2[index2 + 1] = phaseColor.G;
- ptr2[index2 + 2] = phaseColor.R;
- ptr2[index2 + 3] = 255;
- }
- }
- else
- {
- ptr2[index2] = phaseColor.B;
- ptr2[index2 + 1] = phaseColor.G;
- ptr2[index2 + 2] = phaseColor.R;
- ptr2[index2 + 3] = 255;
- }
- }
- }
- }
- return src;
- }
- /// <summary>
- /// 刷新二值效果
- /// </summary>
- private void ReLoadBinarization()
- {
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- if (bcBinaryChecked())
- {
- ResetAreaAndContent();
- if (this.checkBox3.Checked)
- ReloadDebrisSelection();
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].mat = null;
- this.documentWorkspace.PhaseModels[0].choise = false;
- //清除计算并存储的数据
- ballPoint = null;
- groupPoint = null;
- vermicularPoint = null;
- ballCircleList = null;
- groupCircleList = null;
- vermicularCircleList = null;
- tempArea = null;
- maxCaliperDiameter = null;
- circleCoefficientList = null;
- isFirstSwitch = false;
- this.dataGridView1.Rows.Clear();
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 刷新颗粒筛选效果
- /// </summary>
- private void ReloadDebrisSelection()
- {
- if (this.documentWorkspace.PhaseModels[0].mat != null)
- {
- OpenCvSharp.Point[][] contours;//原始轮廓信息
- HierarchyIndex[] hierachy;
- List<List<OpenCvSharp.Point>> ps = new List<List<OpenCvSharp.Point>>();//轮廓的拓扑信息
- Mat temp = new Mat();//中间变量
- this.documentWorkspace.PhaseModels[0].mat.CopyTo(temp);
- Cv2.FindContours(BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone);
- ballPoint = new List<List<OpenCvSharp.Point>>();
- groupPoint = new List<List<OpenCvSharp.Point>>();
- vermicularPoint = new List<List<OpenCvSharp.Point>>();
- ballCircleList = new List<double>();
- groupCircleList = new List<double>();
- vermicularCircleList = new List<double>();
- ballCircleArea = 0;
- groupCircleArea = 0;
- vermicularCircleArea = 0;
- tempArea = new List<string>();
- maxCaliperDiameter = new List<string>();
- circleCoefficientList = new List<string>();
- for (int i = 0; i < hierachy.Length; i++)
- {
- if(hierachy[i].Parent == -1)
- {
- double area = Math.Abs(Cv2.ContourArea(contours[i]));
- if (area >= (this.trackBar2.Value / unitLength) && area <= (this.trackBar4.Value / unitLength))
- {
- ps.Add(contours[i].ToList());
- }
- else
- {
- if (contours[i].Length < 5)
- continue;
- else
- {
- double radius = BasicCalculationHelper.CalcLongTrail(contours[i]);//半径
- if ((decimal)(radius * 2 * unitLength) >= this.numericUpDown6.Value)
- {
- double circleCoefficient = (4 * area) / (Math.PI * (radius * 2) * (radius * 2));
- tempArea.Add((area * unitLength).ToString());
- maxCaliperDiameter.Add((radius * 2 * unitLength).ToString());
- circleCoefficientList.Add(circleCoefficient.ToString());
- if (circleCoefficient > CircularityCoefficient[1])
- {
- ballPoint.Add(contours[i].ToList());
- ballCircleList.Add(circleCoefficient);
- ballCircleArea += area;
- }
- else if (circleCoefficient >= CircularityCoefficient[0] && circleCoefficient <= CircularityCoefficient[1])
- {
- groupPoint.Add(contours[i].ToList());
- groupCircleList.Add(circleCoefficient);
- groupCircleArea += area;
- }
- else if (circleCoefficient < CircularityCoefficient[0])
- {
- vermicularPoint.Add(contours[i].ToList());
- vermicularCircleList.Add(circleCoefficient);
- vermicularCircleArea += area;
- }
- }
- }
- }
- }
- }
- Cv2.FillPoly(temp, ps, new Scalar(0, 0, 0, 0));
- if (this.checkBox5.Checked)
- {
- Cv2.FillPoly(temp, ballPoint, new Scalar(this.BallColor.B, this.BallColor.G, this.BallColor.R, 255));
- Cv2.FillPoly(temp, groupPoint, new Scalar(this.GroupColor.B, this.GroupColor.G, this.GroupColor.R, 255));
- Cv2.FillPoly(temp, vermicularPoint, new Scalar(this.VermicularColor.B, this.VermicularColor.G, this.VermicularColor.R, 255));
- }
- this.documentWorkspace.PhaseModels[1].mat = temp;
- RefreshDataGridView1();
- this.documentWorkspace.Refresh();
- }
- }
- /// <summary>
- /// 刷新其他信息
- /// </summary>
- private void ResetAreaAndContent()
- {
- if(this.documentWorkspace.PhaseModels[0].mat != null && bcBinaryChecked())
- {
- OpenCvSharp.Point[][] contours;//原始轮廓信息
- HierarchyIndex[] hierachy;
- Mat temp = new Mat();
- this.documentWorkspace.PhaseModels[0].mat.CopyTo(temp);
- Cv2.FindContours(BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone);
- if (hierachy.Length > 0)
- {
- double maxArea = 0;//面积最大值
- double minArea = 9999999999;//面积最小值
- ballPoint = new List<List<OpenCvSharp.Point>>();
- groupPoint = new List<List<OpenCvSharp.Point>>();
- vermicularPoint = new List<List<OpenCvSharp.Point>>();
- ballCircleList = new List<double>();
- groupCircleList = new List<double>();
- vermicularCircleList = new List<double>();
- ballCircleArea = 0;
- groupCircleArea = 0;
- vermicularCircleArea = 0;
- tempArea = new List<string>();
- maxCaliperDiameter = new List<string>();
- circleCoefficientList = new List<string>();
- for (int i = 0; i < hierachy.Length; i++)
- {
- double area = Math.Abs(Cv2.ContourArea(contours[i]));
- if (maxArea < area)
- maxArea = area;
- if (minArea > area)
- minArea = area;
- if (contours[i].Length < 5)
- continue;
- else
- {
- double radius = BasicCalculationHelper.CalcLongTrail(contours[i]);//半径
- if ((decimal)(radius * 2 * unitLength) >= this.numericUpDown6.Value)
- {
- double circleCoefficient = (4 * area) / (Math.PI * (radius * 2) * (radius * 2));//原型系数
- tempArea.Add((area * unitLength).ToString());
- maxCaliperDiameter.Add((radius * 2 * unitLength).ToString());
- circleCoefficientList.Add(circleCoefficient.ToString());
- if(circleCoefficient > CircularityCoefficient[1])
- {
- ballPoint.Add(contours[i].ToList());
- ballCircleList.Add(circleCoefficient);
- ballCircleArea += area;
- }
- else if(circleCoefficient >= CircularityCoefficient[0] && circleCoefficient <= CircularityCoefficient[1])
- {
- groupPoint.Add(contours[i].ToList());
- groupCircleList.Add(circleCoefficient);
- groupCircleArea += area;
- }
- else if (circleCoefficient < CircularityCoefficient[0])
- {
- vermicularPoint.Add(contours[i].ToList());
- vermicularCircleList.Add(circleCoefficient);
- vermicularCircleArea += area;
- }
- }
- }
- }
- //显示不同级别石墨颜色
- if (this.checkBox5.Checked)
- {
- Cv2.FillPoly(temp, ballPoint, new Scalar(this.BallColor.B, this.BallColor.G, this.BallColor.R, 255));
- Cv2.FillPoly(temp, groupPoint, new Scalar(this.GroupColor.B, this.GroupColor.G, this.GroupColor.R, 255));
- Cv2.FillPoly(temp, vermicularPoint, new Scalar(this.VermicularColor.B, this.VermicularColor.G, this.VermicularColor.R, 255));
- }
-
- this.documentWorkspace.PhaseModels[1].mat = temp;
- if (!changeColor)
- {
- maxArea = maxArea * unitLength;
- minArea = minArea * unitLength;
- int maxNum = (int)Math.Ceiling(maxArea);//获取面积最大值
- int minNum = (int)Math.Floor(minArea);//获取面积最小值
- //先解绑事件以防数据赋值异常
- this.numericUpDown4.ValueChanged -= numericUpDown4_ValueChanged;
- this.numericUpDown5.ValueChanged -= numericUpDown5_ValueChanged;
- this.trackBar2.Scroll -= trackBar2_Scroll;
- this.trackBar4.Scroll -= trackBar4_Scroll;
- this.numericUpDown4.Maximum = maxNum;
- this.numericUpDown4.Minimum = minNum;
- this.trackBar2.Maximum = maxNum;
- this.trackBar2.Minimum = minNum;
- this.numericUpDown5.Maximum = maxNum;
- this.numericUpDown5.Minimum = minNum;
- this.trackBar4.Maximum = maxNum;
- this.trackBar4.Minimum = minNum;
- this.numericUpDown4.Value = minNum;
- this.trackBar2.Value = minNum;
- this.numericUpDown5.Value = maxNum;
- this.trackBar4.Value = maxNum;
- this.numericUpDown4.ValueChanged += new EventHandler(numericUpDown4_ValueChanged);
- this.numericUpDown5.ValueChanged += new EventHandler(numericUpDown5_ValueChanged);
- this.trackBar2.Scroll += new EventHandler(trackBar2_Scroll);
- this.trackBar4.Scroll += new EventHandler(trackBar4_Scroll);
- RefreshDataGridView1();
- }
- }
- }
- }
- /// <summary>
- /// 颗粒筛选范围最小值
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown4_ValueChanged(object sender, EventArgs e)
- {
- if (this.numericUpDown4.Value > this.numericUpDown5.Value)
- this.numericUpDown4.Value = this.numericUpDown5.Value;
- this.trackBar2.Value = Convert.ToInt32(this.numericUpDown4.Value);
- if(this.checkBox3.Checked && bcBinaryChecked())
- ReloadDebrisSelection();
- }
- /// <summary>
- /// 颗粒筛选范围最大值
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown5_ValueChanged(object sender, EventArgs e)
- {
- if (this.numericUpDown5.Value < this.numericUpDown4.Value)
- this.numericUpDown5.Value = this.numericUpDown4.Value;
- this.trackBar4.Value = Convert.ToInt32(this.numericUpDown5.Value);
- //zhuhsi
- // if(this.checkBox3.Checked && bcBinaryChecked())
- // ReloadDebrisSelection();
- }
- /// <summary>
- /// 颗粒筛选最小值滚动条
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void trackBar2_Scroll(object sender, EventArgs e)
- {
- this.numericUpDown4.Value = this.trackBar2.Value;
- }
- /// <summary>
- /// 颗粒筛选最大值滚动条
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void trackBar4_Scroll(object sender, EventArgs e)
- {
- this.numericUpDown5.Value = this.trackBar4.Value;
- }
- /// <summary>
- /// 是否二值化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- if (!bcBinaryChecked())
- this.checkBox3.Checked = false;
- changeColor = false;
- ReLoadBinarization();
- }
- /// <summary>
- /// 显示参数设置按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, EventArgs e)
- {
- using (VermiculateCastIronSetFontDialog vermiculateCastIronSetFontDialog = new VermiculateCastIronSetFontDialog(this))
- {
- vermiculateCastIronSetFontDialog.StartPosition = FormStartPosition.CenterScreen;
- vermiculateCastIronSetFontDialog.ShowDialog();
- }
- }
- /// <summary>
- /// 颜色设置按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- using (VermiculateCastIronSetColorDialog vermiculateCastIronSetColorDialog = new VermiculateCastIronSetColorDialog(this))
- {
- vermiculateCastIronSetColorDialog.StartPosition = FormStartPosition.CenterScreen;
- vermiculateCastIronSetColorDialog.ShowDialog();
- }
- }
- /// <summary>
- /// 设置页修改颜色
- /// </summary>
- /// <param name="BallColor"></param>
- /// <param name="GroupColor"></param>
- /// <param name="VermicularColor"></param>
- public void SetVermiculateCastIronColor(Color BallColor, Color GroupColor, Color VermicularColor)
- {
- this.BallColor = BallColor;
- this.GroupColor = GroupColor;
- this.VermicularColor = VermicularColor;
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- if (bcBinaryChecked() && this.checkBox3.Checked)
- ReloadDebrisSelection();
- else if (bcBinaryChecked() && !this.checkBox3.Checked)
- {
- changeColor = false;
- ReLoadBinarization();
- }
- }
- /// <summary>
- /// 设置页修改字体
- /// </summary>
- /// <param name="BallColor"></param>
- /// <param name="GroupColor"></param>
- /// <param name="VermicularColor"></param>
- public void SetVermiculateCastIronFont(string fontStyle, float fontSize, Color fontColor)
- {
- this.fontStyle = fontStyle;
- this.fontSize = fontSize;
- this.fontColor = fontColor;
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- if (bcBinaryChecked() && this.checkBox3.Checked)
- ReloadDebrisSelection();
- else if (bcBinaryChecked() && !this.checkBox3.Checked)
- {
- changeColor = false;
- ReLoadBinarization();
- }
- }
- /// <summary>
- /// 选中显示不同级别石墨颜色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox5_CheckedChanged(object sender, EventArgs e)
- {
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- if (bcBinaryChecked() && this.checkBox3.Checked)
- ReloadDebrisSelection();
- else if (bcBinaryChecked() && !this.checkBox3.Checked)
- {
- changeColor = false;
- ReLoadBinarization();
- }
- }
- /// <summary>
- /// 修改限制长度
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown6_ValueChanged(object sender, EventArgs e)
- {
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- if (bcBinaryChecked() && this.checkBox3.Checked)
- ReloadDebrisSelection();
- else if (bcBinaryChecked() && !this.checkBox3.Checked)
- {
- changeColor = false;
- ReLoadBinarization();
- }
- }
- /// <summary>
- /// 是否显示圆形系数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox4_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 导出项目按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button5_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.analyzeSettingModel == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");
- return;
- }
- //获取项目工程内的文件夹路径
- ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.VermiculateCastIron.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<string> contentHead = new List<string>();
- contentHead.Add(PdnResources.GetString("Menu.picture.Text"));
- contentHead.Add(PdnResources.GetString("Menu.view.text"));
- contentHead.Add("球状面积");
- contentHead.Add("球状个数");
- contentHead.Add("团状、团絮状面积");
- contentHead.Add("团状、团絮状个数");
- contentHead.Add("蠕虫状面积");
- contentHead.Add("蠕虫状个数");
- contentHead.Add(PdnResources.GetString("Menu.Thetotalarea.text"));
- contentHead.Add("石墨含量");
- contentHead.Add("蠕化率");
- contentHead.Add("蠕化级别");
- analysisContent.Add(contentHead);
- foreach (DataGridViewRow rowItem in this.dataGridView2.Rows)
- {
- List<string> content = new List<string>();
- content.Add(rowItem.Cells[0].Value.ToString());
- content.Add(rowItem.Cells[1].Value.ToString());
- content.Add(rowItem.Cells[2].Value.ToString());
- content.Add(rowItem.Cells[3].Value.ToString());
- content.Add(rowItem.Cells[4].Value.ToString());
- content.Add(rowItem.Cells[5].Value.ToString());
- content.Add(rowItem.Cells[6].Value.ToString());
- content.Add(rowItem.Cells[7].Value.ToString());
- content.Add(rowItem.Cells[8].Value.ToString());
- content.Add(rowItem.Cells[9].Value.ToString());
- content.Add(rowItem.Cells[10].Value.ToString());
- content.Add(rowItem.Cells[11].Value.ToString());
- analysisContent.Add(content);
- }
- //图片
- bitList = new List<Bitmap>();
- if (this.showAll)
- {
- foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
- {
- bitList.Add(kv.Value[0]);
- bitList.Add(kv.Value[1]);
- }
- }
- else
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- foreach (ListViewItem rowItem in this.listView2.SelectedItems)
- {
- if (bitDic.ContainsKey(rowItem.Name))
- {
- bitList.Add(bitDic[rowItem.Name][0]);
- bitList.Add(bitDic[rowItem.Name][1]);
- }
- }
- }
- }
- //中间数据
- if (!this.showAll)
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
- foreach (ListViewItem rowItem in this.listView2.SelectedItems)
- {
- foreach (ExportProjectModel model in this.tempDataModel)
- {
- if (model.tagName.Equals(rowItem.Name))
- {
- ExportProjectModel tempModel = new ExportProjectModel();
- tempModel.tagName = model.tagName;
- tempModel.picName = model.picName;
- tempModel.dataList = model.dataList;
- exportModel.Add(tempModel);
- break;
- }
- }
- }
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);
- }
- }
- else
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, item.path, item.code);
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
- return;
- }
- //保存项目信息到数据库
- this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
- }
- }
- catch (Exception)
- {
- }
- }
- }
- }
|