| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687 |
- using Metis.ParameterSet;
- using OpenCvSharp;
- using PaintDotNet.Base.CommTool;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- namespace PaintDotNet.DedicatedAnalysis.NonferrousMetals.YYT098814_2016
- {
- internal class TABM4Dialog : NonFMetalsStandardDialog
- {
- #region 属性
- /// <summary>
- /// 是否调用了灰度化的算法
- /// </summary>
- private bool grayBitmap = false;
- int leftX11 = 0, topX11 = 0;
- Bitmap tempHole1Bitmap;
- ////OpenCvSharp.Point[][] contours11;
- int leftX22 = 0, topX22 = 0;
- Bitmap tempHole2Bitmap;
- //OpenCvSharp.Point[][] contours22;
- int leftX33 = 0, topX33 = 0;
- Bitmap tempHole3Bitmap;
- //OpenCvSharp.Point[][] contours33;
- /// <summary>
- /// 平均孔隙截距 用到的参数
- /// </summary>
- Color panel3__BackColor = System.Drawing.Color.Yellow;
- int trackBar4__Value = 3;
- string textBox4__Text = "10";//"100";
- string textBox6__Text = "25";//"10";
- /// <summary>
- /// 记录鼠标最后所在的点的y坐标
- /// </summary>
- int lineNum = 0;
- /// <summary>
- /// 竖直的辅助线
- /// </summary>
- List<Line> vlines = new List<Line>();
- /// <summary>
- /// 组织界面像素y坐标
- /// </summary>
- int planesnumcal = int.MaxValue;
- /// <summary>
- /// 基体平行线
- /// </summary>
- Line line;
- /// <summary>
- /// 是否显示辅助线
- /// </summary>
- bool button2_Clicked = false;
- /// <summary>
- /// 1显示辅助线 0隐藏辅助线
- /// </summary>
- int btnflag = 0;
- ///// <summary>
- ///// 1显示基体界面 2移动基体界面 0隐藏基体界面
- ///// </summary>
- //int btnflag = 0;
- /// <summary>
- /// 基体辅助线和组织界面辅助线
- /// </summary>
- Line top, bottom;
- ///// <summary>
- ///// 横向辅助线
- ///// </summary>
- //List<Line> hlines = new List<Line>();
- /// <summary>
- /// 横向辅助线
- /// </summary>
- List<Line> lines = new List<Line>();
- List<Line> lineDraws = new List<Line>();
- List<Line> line1s = new List<Line>();
- List<Line> line2s = new List<Line>();
- List<Line> line3s = new List<Line>();
- int rect_n = 0;
- //循环计算有效的网格线平均孔隙密度
- float totallength = 0;
- //float perlength = 0;
- int pointsum = 0;
- /// <summary>
- /// 每条平行辅助线和轮廓的交点的集合
- /// </summary>
- List<List<OpenCvSharp.Point>> linePoints = new List<List<OpenCvSharp.Point>>();
- /// <summary>
- /// 点击计算按钮的标识
- /// </summary>
- bool calculation = false;
- float totallength1 = 0;
- float perlength1 = 0;
- int pointsum1 = 0;
- float totallength2 = 0;
- float perlength2 = 0;
- int pointsum2 = 0;
- float totallength3 = 0;
- float perlength3 = 0;
- int pointsum3 = 0;
- //简单计算孔隙面积和总面积等
- double area1 = 0;
- double allarea1 = 0;
- double area2 = 0;
- double allarea2 = 0;
- double area3 = 0;
- double allarea3 = 0;
- //轮廓线颜色、基线颜色
- public Color rectLineColor = Color.IndianRed, baseLineColor = Color.Yellow, scopeLineColor = Color.Red, orgLineColor = Color.LightCoral, rect1LineColor = Color.MediumSpringGreen, rect2LineColor = Color.YellowGreen
- , rect3LineColor = Color.DarkSeaGreen, assistLineColor = Color.ForestGreen;
- //轮廓线线宽、基线线宽、范围线线宽、组织线线宽、区域1线宽、区域2线宽、区域3线宽、辅助线线宽
- public int rectLineWidth = 3, baseLineWidth = 3, scopeLineWidth = 3, orgLineWidth = 3, rect1LineWidth = 3, rect2LineWidth = 3, rect3LineWidth = 3, assistLineWidth = 3;
- //范围线距边界距离
- public int scopeMarginLeft = 25;
- /// <summary>
- /// 轮廓的线
- /// </summary>
- System.Drawing.Point[][] tempLine;
- ///// <summary>
- ///// 孔隙的mat
- ///// </summary>
- //Mat tempHoleMat;
- //Bitmap tempHoleBitmap;
- /// <summary>
- /// 定义变量存储鼠标操作状态 1拖动上辅助线 2拖动下辅助线 /* 3拖动平行辅助线*/
- /// </summary>
- int mouseFlag = 0;
- ///// <summary>
- ///// 1显示辅助线 2移动辅助线 0隐藏辅助线
- ///// </summary>
- //int btnflag = 0;
- int contoursTop = 0;
- ///// <summary>
- ///// 辅助线
- ///// </summary>
- //Line top, bottom;
- /// <summary>
- /// 下面定义三个变量存储鼠标按下的坐标
- /// </summary>
- int xPos;
- int yPos;
- ///// <summary>
- ///// 定义变量存储鼠标操作状态 1拖动左辅助线 2拖动右辅助线 3拖动平行辅助线
- ///// </summary>
- //int mouseFlag = 0;
- ///// <summary>
- ///// 1显示辅助线 2移动辅助线 0隐藏辅助线
- ///// </summary>
- //int btnflag = 0;
- /// <summary>
- /// 左侧辅助线
- /// </summary>
- Line lineleft;
- /// <summary>
- /// 右侧辅助线
- /// </summary>
- Line lineright;
- /// <summary>
- /// 底部辅助线
- /// </summary>
- Line linebottom;
- ///// <summary>
- ///// 横向辅助线上孔隙的线段集合
- ///// </summary>
- //List<Line> honlines = new List<Line>();
- ///// <summary>
- ///// 横向辅助线
- ///// </summary>
- //List<Line> hlines = new List<Line>();
- /// <summary>
- /// 总长度
- /// </summary>
- double res_totalL;
- /// <summary>
- /// 平均孔隙截距
- /// </summary>
- double res_perL;
- /// <summary>
- /// 截点数量
- /// </summary>
- double res_count;
- /// <summary>
- /// 选择标尺的物理长度(微米/像素)
- /// </summary>
- double physical_length = 1;
- /// <summary>
- /// 调色板
- /// </summary>
- private ColorsForm colorsFormGrid;
- private Panel panelC;
- // <summary>
- /// 保存窗口参数 range
- /// </summary>
- private GrainSizeAnalysisModel analysisModel;
- private const string ParamKey_Report = "report";//报告设置
- private const string ParamKey_SetGuideNumber = "setGuideNumber";//设置辅助线条数
- private const string ParamKey_SetShow = "setShow";//设置显示
- private const string ParamKey_PoreRatioColour1 = "poreRatioColour1";//孔隙1体积百分比颜色
- private const string ParamKey_PoreRatioColour2 = "poreRatioColour2";//孔隙2体积百分比颜色
- private const string ParamKey_PoreRatioColour3 = "poreRatioColour3";//孔隙3体积百分比颜色
- private const string ParamKey_PoreRatioShow = "poreRatioShow";//孔隙体积百分比显示
- private const string ParamKey_AvgRangeColour = "avgRangeColour";//平均截距颜色
- private const string ParamKey_AvgRangeWidth = "avgRangeWidth";//平均截距线宽
- private const string ParamKey_AvgRangeSpacing = "avgRangeSpacing";//平均截距间距
- private const string ParamKey_AvgRangeShow = "avgRangeShow";//平均截距显示
- private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数
- //更多
- private const string ParamKey_RectLineColor = "rectLineColor";
- private const string ParamKey_BaseLineColor = "baseLineColor";
- private const string ParamKey_ScopeLineColor = "scopeLineColor";
- private const string ParamKey_OrgLineColor = "orgLineColor";
- private const string ParamKey_Rect1LineColor = "rect1LineColor";
- private const string ParamKey_Rect2LineColor = "rect2LineColor";
- private const string ParamKey_Rect3LineColor = "rect3LineColor";
- private const string ParamKey_AssistLineColor = "assistLineColor";
- private const string ParamKey_RectLineWidth = "rectLineWidth";//轮廓线线宽
- private const string ParamKey_BaseLineWidth = "baseLineWidth";//基线线宽
- private const string ParamKey_ScopeLineWidth = "scopeLineWidth";//范围线线宽
- private const string ParamKey_OrgLineWidth = "orgLineWidth";//组织线线宽
- private const string ParamKey_Rect1LineWidth = "rect1LineWidth";//区域1线宽
- private const string ParamKey_Rect2LineWidth = "rect2LineWidth";//区域2线宽
- private const string ParamKey_Rect3LineWidth = "rect3LineWidth";//区域3线宽
- private const string ParamKey_AssistLineWidth = "assistLineWidth";//辅助线线宽
- private const string ParamKey_ScopeMarginLeft = "scopeMarginLeft";//范围线距边界距离
- #endregion 属性
- #region 组件
- private Button button2;
- private GroupBox groupBox5;
- private Button button14;
- private Button button17;
- private Button button3;
- private Button button15;
- private Button button13;
- private Button button10;
- private Button button4;
- private Button button5;
- private GroupBox groupBox7;
- private Button button6;
- private TextBox textBox6;
- private GroupBox groupBox8;
- private DataGridView dataGridView1;
- private GroupBox groupBox11;
- private Panel panel4;
- private Panel panel5;
- private Panel panel2_0;
- private Label label1;
- private Label label2;
- private Label label7;
- private GroupBox groupBox6;
- private Panel panel3;
- private TrackBar trackBar4;
- private TextBox textBox10;
- private Label label4;
- private Label label6;
- private CheckBox checkBox2;
- private CheckBox checkBox1;
- private CheckBox checkBox3;
- private TextBox textBox4;
- private Label label15;
- private Label label17;
- #endregion 组件
- #region 构造函数
- public TABM4Dialog(AppWorkspace appWorkspace, int menuId) : base(appWorkspace, menuId)
- {
- Dictionary<MeasurementUnit, double> measurementUnitDictionary = Startup.instance.rules;
- this.physical_length = measurementUnitDictionary[MeasurementUnit.Micron];
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- this.analysisModel = analysisModelXml.cloneListParamModel(this.menuId);
- foreach (var item in this.analysisModel.ListParam)
- item.setValue();
- //
- //初始化色板
- //
- this.colorsFormGrid = new ColorsForm();
- this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
- this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
- GetListParamModel();
- InitGridHeader();
- }
- /// <summary>
- /// 初始化表头
- /// </summary>
- private void InitGridHeader()
- {
- //
- //数据展示表
- //
- this.dataGridView1.ColumnHeadersHeight = 23;// 30;//0914###18533
- DataGridViewTextBoxColumn h1 = new DataGridViewTextBoxColumn();
- h1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h1.Width = 144;
- DataGridViewTextBoxColumn h2 = new DataGridViewTextBoxColumn();
- h2.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h2.Width = 144;
- DataGridViewTextBoxColumn h3 = new DataGridViewTextBoxColumn();
- h3.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h3.Width = 144;
- DataGridViewTextBoxColumn h4 = new DataGridViewTextBoxColumn();
- h4.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h4.Width = 160;
- DataGridViewTextBoxColumn h5 = new DataGridViewTextBoxColumn();
- h5.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h5.Width = 144;
- DataGridViewTextBoxColumn h611 = new DataGridViewTextBoxColumn();
- h611.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h611.Width = 156;
- DataGridViewTextBoxColumn h711 = new DataGridViewTextBoxColumn();
- h711.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- h711.Width = 144;
- this.dataGridView1.Columns.Add(h1);
- this.dataGridView1.Columns.Add(h2);
- this.dataGridView1.Columns.Add(h3);
- this.dataGridView1.Columns.Add(h4);
- this.dataGridView1.Columns.Add(h5);
- this.dataGridView1.Columns.Add(h611);
- this.dataGridView1.Columns.Add(h711);
- CustomControl.DataGridViewHelper helper = new CustomControl.DataGridViewHelper(this.dataGridView1);
- helper.Headers.Add(new CustomControl.DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.rea.Text")));
- helper.Headers.Add(new CustomControl.DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.area.text")));
- helper.Headers.Add(new CustomControl.DataGridViewHelper.TopHeader(2, 1, PdnResources.GetString("Menu.Thetotalarea.text")));
- helper.Headers.Add(new CustomControl.DataGridViewHelper.TopHeader(3, 1, PdnResources.GetString("Menu.Percentageofholevolume.text")));
- helper.Headers.Add(new CustomControl.DataGridViewHelper.TopHeader(4, 1, PdnResources.GetString("Menu.Totallengthofintercept.text")));
- helper.Headers.Add(new CustomControl.DataGridViewHelper.TopHeader(5, 1, PdnResources.GetString("Menu.Meanporeintercept.text")));
- helper.Headers.Add(new CustomControl.DataGridViewHelper.TopHeader(6, 1, PdnResources.GetString("Menu.Numberofintercept.text")));
- this.dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[0].ReadOnly = true;
- this.dataGridView1.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;//文字居中
- this.dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[1].ReadOnly = true;
- this.dataGridView1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[2].ReadOnly = true;
- this.dataGridView1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[3].ReadOnly = true;
- this.dataGridView1.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[4].ReadOnly = true;
- this.dataGridView1.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[5].ReadOnly = true;
- this.dataGridView1.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView1.Columns[6].ReadOnly = true;
- this.dataGridView1.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- //this.dataGridView1.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
- //this.dataGridView1.Columns[4].ReadOnly = true;
- //this.dataGridView1.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
- this.dataGridView1.AllowUserToResizeRows = false;
- this.dataGridView1.AllowUserToResizeColumns = false;
- //分析结果表
- //this.dataGridView2.ColumnHeadersHeight = 30;
- //DataGridViewTextBoxColumn h6 = new DataGridViewTextBoxColumn();
- //h6.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- //h6.Width = 185;
- //DataGridViewTextBoxColumn h7 = new DataGridViewTextBoxColumn();
- //h7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- //h7.Width = 185;
- //DataGridViewTextBoxColumn h8 = new DataGridViewTextBoxColumn();
- //h8.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- //h8.Width = 185;
- //DataGridViewTextBoxColumn h9 = new DataGridViewTextBoxColumn();
- //h9.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- //h9.Width = 185;
- //DataGridViewTextBoxColumn h10 = new DataGridViewTextBoxColumn();
- //h10.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- //h10.Width = 185;
- //DataGridViewTextBoxColumn h11 = new DataGridViewTextBoxColumn();
- //h11.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- //h11.Width = 185;
- //DataGridViewTextBoxColumn h12 = new DataGridViewTextBoxColumn();
- //h12.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- //h12.Width = 190;
- //DataGridViewTextBoxColumn h13 = new DataGridViewTextBoxColumn();
- //h13.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
- //h13.Width = 190;
- //this.dataGridView2.Columns.Add(h6);
- //this.dataGridView2.Columns.Add(h7);
- //this.dataGridView2.Columns.Add(h8);
- //this.dataGridView2.Columns.Add(h9);
- //this.dataGridView2.Columns.Add(h10);
- //this.dataGridView2.Columns.Add(h11);
- //this.dataGridView2.Columns.Add(h12);
- //this.dataGridView2.Columns.Add(h13);
- //DataGridViewHelper helper2 = new DataGridViewHelper(this.dataGridView2);
- //helper2.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.picture.Text")));
- //helper2.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.rea.Text")));
- //helper2.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, PdnResources.GetString("Menu.area.text")));
- //helper2.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, PdnResources.GetString("Menu.Thetotalarea.text")));
- //helper2.Headers.Add(new DataGridViewHelper.TopHeader(4, 1, PdnResources.GetString("Menu.Percentageofholevolume.text")));
- //helper2.Headers.Add(new DataGridViewHelper.TopHeader(5, 1, PdnResources.GetString("Menu.Totallengthofporeintercepts.text")));
- //helper2.Headers.Add(new DataGridViewHelper.TopHeader(6, 1, PdnResources.GetString("Menu.Meanporeintercept.text")));
- //helper2.Headers.Add(new DataGridViewHelper.TopHeader(7, 1, PdnResources.GetString("Menu.Numberofintercept.text")));
- //this.dataGridView2.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
- //this.dataGridView2.Columns[0].ReadOnly = true;
- //this.dataGridView2.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
- //this.dataGridView2.Columns[1].ReadOnly = true;
- //this.dataGridView2.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
- //this.dataGridView2.Columns[2].ReadOnly = true;
- //this.dataGridView2.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
- //this.dataGridView2.Columns[3].ReadOnly = true;
- //this.dataGridView2.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
- //this.dataGridView2.Columns[4].ReadOnly = true;
- //this.dataGridView2.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable;
- //this.dataGridView2.Columns[5].ReadOnly = true;
- //this.dataGridView2.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable;
- //this.dataGridView2.Columns[6].ReadOnly = true;
- //this.dataGridView2.Columns[7].SortMode = DataGridViewColumnSortMode.NotSortable;
- //this.dataGridView2.Columns[7].ReadOnly = true;
- //this.dataGridView2.AllowUserToResizeRows = false;
- //this.dataGridView2.AllowUserToResizeColumns = false;
- //DataGridViewTextBoxColumn Column2_total = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column3_total = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column4_total = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column5_total = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column6_total = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column7_total = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column8_total = new System.Windows.Forms.DataGridViewTextBoxColumn();
- //Column2_total.Name = "Column2_total";
- //Column2_total.ReadOnly = true;
- Column3_total.Name = "Column3_total";
- Column3_total.ReadOnly = true;
- Column4_total.Name = "Column4_total";
- Column4_total.ReadOnly = true;
- Column5_total.Name = "Column5_total";
- Column5_total.ReadOnly = true;
- Column6_total.Name = "Column6_total";
- Column6_total.ReadOnly = true;
- Column7_total.Name = "Column7_total";
- Column7_total.ReadOnly = true;
- Column8_total.Name = "Column8_total";
- Column8_total.ReadOnly = true;
- //Column2_total.HeaderText = PdnResources.GetString("Menu.rea.Text");
- Column3_total.HeaderText = PdnResources.GetString("Menu.area.text");
- Column4_total.HeaderText = PdnResources.GetString("Menu.Thetotalarea.text");
- Column5_total.HeaderText = PdnResources.GetString("Menu.Percentageofholevolume.text");
- Column6_total.HeaderText = PdnResources.GetString("Menu.Totallengthofporeintercepts.text");
- Column7_total.HeaderText = PdnResources.GetString("Menu.Meanporeintercept.text");
- Column8_total.HeaderText = PdnResources.GetString("Menu.Numberofintercept.text");
- this.dataGridView_Total.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- //Column2_total,
- Column3_total,
- Column4_total,
- Column5_total,
- Column6_total,
- Column7_total,
- Column8_total});
- this.dataGridView_Total.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView_Total.Columns[0].ReadOnly = true;
- this.dataGridView_Total.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView_Total.Columns[1].ReadOnly = true;
- this.dataGridView_Total.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView_Total.Columns[2].ReadOnly = true;
- this.dataGridView_Total.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView_Total.Columns[3].ReadOnly = true;
- this.dataGridView_Total.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView_Total.Columns[4].ReadOnly = true;
- this.dataGridView_Total.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView_Total.Columns[5].ReadOnly = true;
- //this.dataGridView_Total.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable;
- //this.dataGridView_Total.Columns[6].ReadOnly = true;
- DataGridViewTextBoxColumn Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- DataGridViewTextBoxColumn Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- Column1.Name = "Column1";
- Column1.ReadOnly = true;
- Column2.Name = "Column2";
- Column2.ReadOnly = true;
- Column3.Name = "Column3";
- Column3.ReadOnly = true;
- Column4.Name = "Column4";
- Column4.ReadOnly = true;
- Column5.Name = "Column5";
- Column5.ReadOnly = true;
- Column6.Name = "Column6";
- Column6.ReadOnly = true;
- Column7.Name = "Column7";
- Column7.ReadOnly = true;
- Column8.Name = "Column8";
- Column8.ReadOnly = true;
- Column1.HeaderText = PdnResources.GetString("Menu.picture.Text");
- Column2.HeaderText = PdnResources.GetString("Menu.rea.Text");
- Column3.HeaderText = PdnResources.GetString("Menu.area.text");
- Column4.HeaderText = PdnResources.GetString("Menu.Thetotalarea.text");
- Column5.HeaderText = PdnResources.GetString("Menu.Percentageofholevolume.text");
- Column6.HeaderText = PdnResources.GetString("Menu.Totallengthofporeintercepts.text");
- Column7.HeaderText = PdnResources.GetString("Menu.Meanporeintercept.text");
- Column8.HeaderText = PdnResources.GetString("Menu.Numberofintercept.text");
- this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- Column1,
- Column2,
- Column3,
- Column4,
- Column5,
- Column6,
- Column7,
- Column8});
- //Column1.Width = 195;
- //Column2.Width = 165;
- //Column3.Width = 165;
- //Column4.Width = 165;
- this.dataGridView2.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[0].ReadOnly = true;
- this.dataGridView2.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[1].ReadOnly = true;
- this.dataGridView2.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[2].ReadOnly = true;
- this.dataGridView2.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[3].ReadOnly = true;
- this.dataGridView2.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[4].ReadOnly = true;
- this.dataGridView2.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[5].ReadOnly = true;
- this.dataGridView2.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[6].ReadOnly = true;
- this.dataGridView2.Columns[7].SortMode = DataGridViewColumnSortMode.NotSortable;
- this.dataGridView2.Columns[7].ReadOnly = true;
- }
- #endregion 构造函数
- #region 初始化组件和实现组件事件
- private void InitializeLanguageText()
- {
- this.button6.Text = PdnResources.GetString("Menu.More.text");
- this.groupBox7.Text = PdnResources.GetString("Menu.Organizationinterfacesettings.text");
- //this.label6.Text = PdnResources.GetString("Menu.color.text") + ":";
- //this.label4.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- //this.groupBox6.Text = PdnResources.GetString("Menu.holesetting.text");
- //this.label5.Text = PdnResources.GetString("Menu.color.text") + ":";
- //this.groupBox10.Text = "孔隙";// PdnResources.GetString("Menu.contour.text");
- this.button2.Text = PdnResources.GetString("Menu.reinformation.text");
- this.button5.Text = PdnResources.GetString("Menu.Image.Grayscale.Text");
- this.button4/*button3*/.Text = PdnResources.GetString("Menu.BinaryAction.ErosionExtraction.Text");
- this.button10.Text = PdnResources.GetString("Menu.BinaryAction.DilationExtraction.Text");
- this.button13.Text = PdnResources.GetString("Menu.Definetheorganizationinterface.text");
- this.button3.Text = PdnResources.GetString("Menu.reinformation.text");
- this.button15.Text = PdnResources.GetString("Menu.searchcontour.text");
- this.button17.Text = PdnResources.GetString("Menu.auto-adjust.text");
- this.button14.Text = PdnResources.GetString("Menu.easemodifytheoutline.Text");
- this.groupBox5.Text = PdnResources.GetString("Menu.Basicoperation.text");
- this.Text = "YYT 0988.14-2016(" + PdnResources.GetString("Menu.Organizationinterfacegradientmethod.text") + ")";
- //this.label11.Text = PdnResources.GetString("Menu.Totallengthofporeintercepts.text") + ":";
- //this.label12.Text = PdnResources.GetString("Menu.Meanporeintercept.text") + ":";
- //this.label13.Text = PdnResources.GetString("Menu.Numberofintercept.text") + ":";
- this.groupBox8.Text = PdnResources.GetString("Menu.reckoning.text");
- //this.groupBox8.Text = PdnResources.GetString("Menu.result.text");
- //this.label18.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.label17.Text = PdnResources.GetString("Menu.Numberofauxiliarylines.text") + ":";
- //this.label16.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- //this.label15.Text = PdnResources.GetString("Menu.spacing.text") + ":";
- this.label7.Text = PdnResources.GetString("Menu.hole1.text") + ":";
- this.label2.Text = PdnResources.GetString("Menu.hole2.text") + ":";
- this.label1.Text = PdnResources.GetString("Menu.hole3.text") + ":";
- this.groupBox11.Text = PdnResources.GetString("Menu.Percentageofholevolume.text");
- this.label6.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.label4.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.groupBox6.Text = PdnResources.GetString("Menu.Meanporeintercept.text");
- this.checkBox1.Text = "显示";
- this.checkBox2.Text = "显示";
- this.checkBox3.Text = "显示";
- this.label15.Text = "间距";
- }
- private void InitializeComponent()
- {
- this.button2 = new System.Windows.Forms.Button();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.button14 = new System.Windows.Forms.Button();
- this.button17 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.button15 = new System.Windows.Forms.Button();
- this.button13 = new System.Windows.Forms.Button();
- this.button10 = new System.Windows.Forms.Button();
- this.button4 = new System.Windows.Forms.Button();
- this.button5 = new System.Windows.Forms.Button();
- this.groupBox7 = new System.Windows.Forms.GroupBox();
- this.checkBox3 = new System.Windows.Forms.CheckBox();
- this.button6 = new System.Windows.Forms.Button();
- this.textBox6 = new System.Windows.Forms.TextBox();
- this.label17 = new System.Windows.Forms.Label();
- this.groupBox8 = new System.Windows.Forms.GroupBox();
- this.dataGridView1 = new System.Windows.Forms.DataGridView();
- this.groupBox11 = new System.Windows.Forms.GroupBox();
- this.checkBox2 = new System.Windows.Forms.CheckBox();
- this.panel4 = new System.Windows.Forms.Panel();
- this.panel5 = new System.Windows.Forms.Panel();
- this.panel2_0 = new System.Windows.Forms.Panel();
- this.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.label7 = new System.Windows.Forms.Label();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.textBox4 = new System.Windows.Forms.TextBox();
- this.label15 = new System.Windows.Forms.Label();
- this.checkBox1 = new System.Windows.Forms.CheckBox();
- this.panel3 = new System.Windows.Forms.Panel();
- this.trackBar4 = new System.Windows.Forms.TrackBar();
- this.textBox10 = new System.Windows.Forms.TextBox();
- this.label4 = new System.Windows.Forms.Label();
- this.label6 = new System.Windows.Forms.Label();
- this.groupBox_img.SuspendLayout();
- this.groupBox_report.SuspendLayout();
- this.groupBox_analysisResult1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1_0)).BeginInit();
- this.groupBox5.SuspendLayout();
- this.groupBox7.SuspendLayout();
- this.groupBox8.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
- this.groupBox11.SuspendLayout();
- this.groupBox6.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).BeginInit();
- this.SuspendLayout();
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(96, 39);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 6;
- this.button2.UseVisualStyleBackColor = true;
- //
- // groupBox5
- //
- this.groupBox5.Controls.Add(this.button14);
- this.groupBox5.Controls.Add(this.button17);
- this.groupBox5.Controls.Add(this.button3);
- this.groupBox5.Controls.Add(this.button15);
- this.groupBox5.Controls.Add(this.button13);
- this.groupBox5.Controls.Add(this.button10);
- this.groupBox5.Controls.Add(this.button4);
- this.groupBox5.Controls.Add(this.button5);
- this.groupBox5.Location = new System.Drawing.Point(180, 317);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(353, 66);
- this.groupBox5.TabIndex = 44;
- this.groupBox5.TabStop = false;
- //
- // button14
- //
- this.button14.Location = new System.Drawing.Point(267, 40);
- this.button14.Name = "button14";
- this.button14.Size = new System.Drawing.Size(75, 23);
- this.button14.TabIndex = 8;
- this.button14.UseVisualStyleBackColor = true;
- this.button14.Click += new System.EventHandler(this.button14_Click);
- //
- // button17
- //
- this.button17.Location = new System.Drawing.Point(180, 40);
- this.button17.Name = "button17";
- this.button17.Size = new System.Drawing.Size(75, 23);
- this.button17.TabIndex = 7;
- this.button17.UseVisualStyleBackColor = true;
- this.button17.Click += new System.EventHandler(this.button17_Click);
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(103, 40);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(65, 23);
- this.button3.TabIndex = 6;
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // button15
- //
- this.button15.Location = new System.Drawing.Point(267, 15);
- this.button15.Name = "button15";
- this.button15.Size = new System.Drawing.Size(75, 23);
- this.button15.TabIndex = 5;
- this.button15.UseVisualStyleBackColor = true;
- this.button15.Click += new System.EventHandler(this.button15_Click);
- //
- // button13
- //
- this.button13.Location = new System.Drawing.Point(9, 40);
- this.button13.Name = "button13";
- this.button13.Size = new System.Drawing.Size(85, 23);
- this.button13.TabIndex = 3;
- this.button13.UseVisualStyleBackColor = true;
- this.button13.Click += new System.EventHandler(this.button13_Click);
- //
- // button10
- //
- this.button10.Location = new System.Drawing.Point(180, 15);
- this.button10.Name = "button10";
- this.button10.Size = new System.Drawing.Size(75, 23);
- this.button10.TabIndex = 2;
- this.button10.UseVisualStyleBackColor = true;
- this.button10.Click += new System.EventHandler(this.button10_Click);
- //
- // button4
- //
- this.button4.Location = new System.Drawing.Point(103, 15);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(65, 23);
- this.button4.TabIndex = 1;
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // button5
- //
- this.button5.Location = new System.Drawing.Point(9, 15);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(85, 23);
- this.button5.TabIndex = 0;
- this.button5.UseVisualStyleBackColor = true;
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // groupBox7
- //
- this.groupBox7.Controls.Add(this.checkBox3);
- this.groupBox7.Controls.Add(this.button6);
- this.groupBox7.Controls.Add(this.textBox6);
- this.groupBox7.Controls.Add(this.label17);
- this.groupBox7.Location = new System.Drawing.Point(180, 389);
- this.groupBox7.Name = "groupBox7";
- this.groupBox7.Size = new System.Drawing.Size(355, 35);
- this.groupBox7.TabIndex = 45;
- this.groupBox7.TabStop = false;
- //
- // checkBox3
- //
- this.checkBox3.AutoSize = true;
- this.checkBox3.Location = new System.Drawing.Point(160, 16);
- this.checkBox3.Name = "checkBox3";
- this.checkBox3.Size = new System.Drawing.Size(15, 14);
- this.checkBox3.TabIndex = 26;
- this.checkBox3.UseVisualStyleBackColor = true;
- this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
- //
- // button6
- //
- this.button6.Location = new System.Drawing.Point(284, 10);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(58, 23);
- this.button6.TabIndex = 8;
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // textBox6
- //
- this.textBox6.Location = new System.Drawing.Point(88, 12);
- this.textBox6.Name = "textBox6";
- this.textBox6.Size = new System.Drawing.Size(55, 21);
- this.textBox6.TabIndex = 10;
- this.textBox6.Text = "25";
- this.textBox6.TextChanged += new System.EventHandler(this.textBox6_TextChanged);
- //
- // label17
- //
- this.label17.AutoSize = true;
- this.label17.Location = new System.Drawing.Point(15, 17);
- this.label17.Name = "label17";
- this.label17.Size = new System.Drawing.Size(0, 12);
- this.label17.TabIndex = 1;
- //
- // groupBox8
- //
- this.groupBox8.Controls.Add(this.dataGridView1);
- this.groupBox8.Location = new System.Drawing.Point(178, 522);
- this.groupBox8.Name = "groupBox8";
- this.groupBox8.Size = new System.Drawing.Size(357, 134);
- this.groupBox8.TabIndex = 46;
- this.groupBox8.TabStop = false;
- //
- // dataGridView1
- //
- this.dataGridView1.AllowUserToAddRows = false;
- this.dataGridView1.AllowUserToDeleteRows = false;
- this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
- this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
- this.dataGridView1.Location = new System.Drawing.Point(7, 21);
- this.dataGridView1.MultiSelect = false;
- this.dataGridView1.Name = "dataGridView1";
- this.dataGridView1.RowHeadersVisible = false;
- this.dataGridView1.RowTemplate.Height = 23;
- this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView1.Size = new System.Drawing.Size(344, 107);
- this.dataGridView1.TabIndex = 0;
- //
- // groupBox11
- //
- this.groupBox11.Controls.Add(this.checkBox2);
- this.groupBox11.Controls.Add(this.panel4);
- this.groupBox11.Controls.Add(this.panel5);
- this.groupBox11.Controls.Add(this.panel2_0);
- this.groupBox11.Controls.Add(this.label1);
- this.groupBox11.Controls.Add(this.label2);
- this.groupBox11.Controls.Add(this.label7);
- this.groupBox11.Location = new System.Drawing.Point(180, 428);
- this.groupBox11.Name = "groupBox11";
- this.groupBox11.Size = new System.Drawing.Size(355, 41);
- this.groupBox11.TabIndex = 47;
- this.groupBox11.TabStop = false;
- //
- // checkBox2
- //
- this.checkBox2.AutoSize = true;
- this.checkBox2.Location = new System.Drawing.Point(294, 21);
- this.checkBox2.Name = "checkBox2";
- this.checkBox2.Size = new System.Drawing.Size(15, 14);
- this.checkBox2.TabIndex = 23;
- this.checkBox2.UseVisualStyleBackColor = true;
- this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
- //
- // panel4
- //
- this.panel4.BackColor = System.Drawing.Color.LightCoral;
- this.panel4.Location = new System.Drawing.Point(248, 18);
- this.panel4.Name = "panel4";
- this.panel4.Size = new System.Drawing.Size(34, 21);
- this.panel4.TabIndex = 25;
- this.panel4.Click += new System.EventHandler(this.panel2_Click);
- //
- // panel5
- //
- this.panel5.BackColor = System.Drawing.Color.Orange;
- this.panel5.Location = new System.Drawing.Point(151, 18);
- this.panel5.Name = "panel5";
- this.panel5.Size = new System.Drawing.Size(36, 21);
- this.panel5.TabIndex = 24;
- this.panel5.Click += new System.EventHandler(this.panel2_Click);
- //
- // panel2_0
- //
- this.panel2_0.BackColor = System.Drawing.Color.Yellow;
- this.panel2_0.Location = new System.Drawing.Point(58, 18);
- this.panel2_0.Name = "panel2_0";
- this.panel2_0.Size = new System.Drawing.Size(36, 21);
- this.panel2_0.TabIndex = 22;
- this.panel2_0.Click += new System.EventHandler(this.panel2_Click);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(199, 24);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(0, 12);
- this.label1.TabIndex = 3;
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(104, 24);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(0, 12);
- this.label2.TabIndex = 2;
- //
- // label7
- //
- this.label7.AutoSize = true;
- this.label7.Location = new System.Drawing.Point(15, 24);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(0, 12);
- this.label7.TabIndex = 0;
- //
- // groupBox6
- //
- this.groupBox6.Controls.Add(this.textBox4);
- this.groupBox6.Controls.Add(this.label15);
- this.groupBox6.Controls.Add(this.checkBox1);
- this.groupBox6.Controls.Add(this.panel3);
- this.groupBox6.Controls.Add(this.trackBar4);
- this.groupBox6.Controls.Add(this.textBox10);
- this.groupBox6.Controls.Add(this.label4);
- this.groupBox6.Controls.Add(this.label6);
- this.groupBox6.Location = new System.Drawing.Point(180, 475);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(355, 45);
- this.groupBox6.TabIndex = 48;
- this.groupBox6.TabStop = false;
- //
- // textBox4
- //
- this.textBox4.Location = new System.Drawing.Point(239, 19);
- this.textBox4.Name = "textBox4";
- this.textBox4.Size = new System.Drawing.Size(41, 21);
- this.textBox4.TabIndex = 24;
- this.textBox4.Text = "25";
- //
- // label15
- //
- this.label15.AutoSize = true;
- this.label15.Location = new System.Drawing.Point(209, 24);
- this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(0, 12);
- this.label15.TabIndex = 23;
- //
- // checkBox1
- //
- this.checkBox1.AutoSize = true;
- this.checkBox1.Location = new System.Drawing.Point(294, 21);
- this.checkBox1.Name = "checkBox1";
- this.checkBox1.Size = new System.Drawing.Size(15, 14);
- this.checkBox1.TabIndex = 0;
- this.checkBox1.UseVisualStyleBackColor = true;
- this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
- //
- // panel3
- //
- this.panel3.BackColor = System.Drawing.Color.YellowGreen;
- this.panel3.Location = new System.Drawing.Point(54, 18);
- this.panel3.Name = "panel3";
- this.panel3.Size = new System.Drawing.Size(36, 21);
- this.panel3.TabIndex = 22;
- this.panel3.Click += new System.EventHandler(this.panel2_Click);
- //
- // trackBar4
- //
- this.trackBar4.AutoSize = false;
- this.trackBar4.Cursor = System.Windows.Forms.Cursors.Hand;
- this.trackBar4.Location = new System.Drawing.Point(122, 20);
- this.trackBar4.Maximum = 50;
- this.trackBar4.Minimum = 1;
- this.trackBar4.Name = "trackBar4";
- this.trackBar4.Size = new System.Drawing.Size(49, 21);
- this.trackBar4.TabIndex = 7;
- this.trackBar4.TickStyle = System.Windows.Forms.TickStyle.None;
- this.trackBar4.Value = 3;
- this.trackBar4.Scroll += new System.EventHandler(this.trackBar4_Scroll);
- this.trackBar4.ValueChanged += new System.EventHandler(this.trackBar4_ValueChanged);
- //
- // textBox10
- //
- this.textBox10.Location = new System.Drawing.Point(172, 19);
- this.textBox10.Name = "textBox10";
- this.textBox10.Size = new System.Drawing.Size(30, 21);
- this.textBox10.TabIndex = 6;
- this.textBox10.Text = "3";
- this.textBox10.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxWidth_KeyPress);
- this.textBox10.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox10_KeyUp);
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(96, 24);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(0, 12);
- this.label4.TabIndex = 2;
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(15, 24);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(0, 12);
- this.label6.TabIndex = 0;
- //
- // TABM4Dialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(1127, 822);
- this.Controls.Add(this.groupBox6);
- this.Controls.Add(this.groupBox11);
- this.Controls.Add(this.groupBox8);
- this.Controls.Add(this.groupBox7);
- this.Controls.Add(this.groupBox5);
- this.Name = "TABM4Dialog";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TABM4Dialog_FormClosing);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.Controls.SetChildIndex(this.groupBox_img, 0);
- this.Controls.SetChildIndex(this.groupBox_review, 0);
- this.Controls.SetChildIndex(this.groupBox_analysisResult1, 0);
- this.Controls.SetChildIndex(this.groupBox6groupBox_analysisResult2, 0);
- this.Controls.SetChildIndex(this.groupBox_report, 0);
- this.Controls.SetChildIndex(this.groupBox7, 0);
- this.Controls.SetChildIndex(this.groupBox8, 0);
- this.Controls.SetChildIndex(this.groupBox11, 0);
- this.Controls.SetChildIndex(this.groupBox6, 0);
- this.groupBox_img.ResumeLayout(false);
- this.groupBox_report.ResumeLayout(false);
- this.groupBox_report.PerformLayout();
- this.groupBox_analysisResult1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1_0)).EndInit();
- this.groupBox5.ResumeLayout(false);
- this.groupBox7.ResumeLayout(false);
- this.groupBox7.PerformLayout();
- this.groupBox8.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
- this.groupBox11.ResumeLayout(false);
- this.groupBox11.PerformLayout();
- this.groupBox6.ResumeLayout(false);
- this.groupBox6.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).EndInit();
- this.ResumeLayout(false);
- }
- /// <summary>
- /// 线宽输入框 对输入值做限制
- /// </summary>
- /// <param name="sender"></param>
- private void varifyTextBoxValue(object sender)
- {
- if (string.IsNullOrEmpty(((TextBox)sender)/*this.textBox2*/.Text))
- ((TextBox)sender)/*this.textBox2*/.Text = "1";
- if (Convert.ToInt32(((TextBox)sender)/*this.textBox2*/.Text) > 50)
- ((TextBox)sender)/*this.textBox2*/.Text = "50";
- }
- /// <summary>
- /// 限制只可以输入0-9数字以及退格键
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void textBoxWidth_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar != '\b')//这是允许输入退格键
- {
- int len = ((TextBox)sender)/*this.textBox1*/.Text.Length;
- if (len < 1 && e.KeyChar == '0')
- {
- e.Handled = true;
- }
- else if ((e.KeyChar < '0') || (e.KeyChar > '9'))//这是允许输入0-9数字
- {
- e.Handled = true;
- }
- }
- }
- private void textBox10_KeyUp(object sender, KeyEventArgs e)
- {
- this.varifyTextBoxValue(sender);
- this.trackBar4.Value = Convert.ToInt32(this.textBox10.Text);
- }
- #endregion 初始化组件和实现组件事件
- #region 需继承的一部分方法
- protected override void drawSubclass(Graphics graphics)
- {
- //绘制孔隙体积百分比 (循环绘制轮廓)
- if (checkBox2.Checked && tempHole1Bitmap != null)
- graphics.DrawImage(tempHole1Bitmap, new PointF(leftX11, topX11));
- if (checkBox2.Checked && tempHole2Bitmap != null)
- graphics.DrawImage(tempHole2Bitmap, new PointF(leftX22, topX22));
- if (checkBox2.Checked && tempHole3Bitmap != null)
- graphics.DrawImage(tempHole3Bitmap, new PointF(leftX33, topX33));
- if (checkBox1.Checked && lines != null && lines.Count() > 0)
- {
- Pen bluePen = new Pen(this.assistLineColor, this.assistLineWidth);
- foreach (Line l in lines)
- graphics.DrawLine(bluePen, l.startPoint, l.endPoint);
- //画笔
- Pen yellowPen11 = new Pen(this.panel3.BackColor/*Color.Yellow*/, this.trackBar4.Value/*5*/);
- if (lineDraws != null && lineDraws.Count() > 0)
- foreach (Line l in lineDraws)
- graphics.DrawLine(yellowPen11, l.startPoint, l.endPoint);
- }
- if (tempLine != null && tempLine.Length > 0/* && !bcOriginChecked()*/)//#19575
- {
- Pen lineColor = new Pen(this.rectLineColor, this.rectLineWidth);
- for (int index = 0; index < tempLine.Length; index++)
- {
- System.Drawing.Point[] tempLine1 = tempLine[index];
- graphics.DrawLines(lineColor, tempLine1);
- }
- }
- //if (tempHoleMat != null && tempHoleBitmap != null)
- //{
- // graphics.DrawImage(tempHoleBitmap, new PointF(0, 0));
- //}
- //Pen bluePen = new Pen(this.panel4__BackColor/*Color.FromArgb(255, 0, 208, 202)*/, this.trackBar3__Value);
- ////画左右下辅助线
- //if (lineleft != null)
- // graphics.DrawLine(bluePen, lineleft.startPoint, lineleft.endPoint);
- //if (lineright != null)
- // graphics.DrawLine(bluePen, lineright.startPoint, lineright.endPoint);
- ////if (linebottom != null)
- //// graphics.DrawLine(bluePen, linebottom.startPoint, linebottom.endPoint);
- if (lineleft != null)//line
- {
- graphics.DrawLine(new Pen(this.scopeLineColor, this.scopeLineWidth), lineleft.startPoint, lineleft.endPoint);
- }
- if (lineright != null)//line
- {
- graphics.DrawLine(new Pen(this.scopeLineColor, this.scopeLineWidth), lineright.startPoint, lineright.endPoint);
- }
- if (top != null && bottom != null)
- {
- int planesnum = top.startPoint.Y;// int.Parse(Intent.dict["planesnum"].ToString());
- int planesbottom1 = planesnum + +(int)(200 / physical_length);
- int planesbottom2 = planesnum + +(int)(400 / physical_length);
- int planesbottom3 = bottom.startPoint.Y;// int.Parse(Intent.dict["planesbottom"].ToString());
- if (((bottom.startPoint.Y - planesnum) * physical_length) > 600)
- {
- planesbottom3 = planesnum + +(int)(600 / physical_length);
- }
- graphics.DrawLine(new Pen(rect1LineColor, rect1LineWidth), new System.Drawing.Point(0, planesbottom1), new System.Drawing.Point(this.bitmap.Width, planesbottom1));
- graphics.DrawLine(new Pen(rect2LineColor, rect2LineWidth), new System.Drawing.Point(0, planesbottom2), new System.Drawing.Point(this.bitmap.Width, planesbottom2));
- if (((bottom.startPoint.Y - planesnum) * physical_length) > 600)
- {
- graphics.DrawLine(new Pen(rect3LineColor, rect3LineWidth), new System.Drawing.Point(0, planesbottom3), new System.Drawing.Point(this.bitmap.Width, planesbottom3));
- }
- graphics.DrawLine(new Pen(orgLineColor, orgLineWidth), top.startPoint, top.endPoint);
- graphics.DrawLine(new Pen(baseLineColor, baseLineWidth), bottom.startPoint, bottom.endPoint);
- }
- else if (bottom != null)
- {
- graphics.DrawLine(new Pen(baseLineColor, baseLineWidth), bottom.startPoint, bottom.endPoint);
- }
- //if (hlines != null && hlines.Count() > 0)
- //{
- // foreach (Line l in hlines)
- // {
- // graphics.DrawLine(bluePen, l.startPoint, l.endPoint);
- // }
- //}
- //画笔
- Pen yellowPen = new Pen(this.panel3__BackColor, this.trackBar4__Value);
- //if (honlines != null && honlines.Count() > 0)
- //{
- // foreach (Line l in honlines)
- // {
- // graphics.DrawLine(yellowPen, l.startPoint, l.endPoint);
- // }
- //}
- ////画笔
- //Pen yellowPen = new Pen(this.panel3.BackColor, this.trackBar4.Value);
- if (line == null)
- {
- btnflag = 0;
- //System.Drawing.Point point1 = new System.Drawing.Point(0, lab1Img.Height - 130);
- //System.Drawing.Point point2 = new System.Drawing.Point(lab1Img.Width, lab1Img.Height - 130);
- //line = new Line(point1, point2);
- //graphics.DrawLine(yellowPen, line.startPoint, line.endPoint);
- }
- else
- {
- if (btnflag == 0)
- btnflag = 1;
- graphics.DrawLine(yellowPen, line.startPoint, line.endPoint);
- }
- if (checkBox3.Checked && vlines.Count() > 0)
- {
- Pen bluePen = new Pen(this.assistLineColor, this.assistLineWidth);
- foreach (Line temp in vlines)
- graphics.DrawLine(bluePen, temp.startPoint, temp.endPoint);
- }
- }
- //数据库的name(报告模板)
- protected override string getTemplateName()
- {
- return "Template.Manager.item3.TitaniumAlloyBio4Method";
- }
- //语言包的name(项目工程)
- protected override string getProjectEngineeringName()
- {
- return "Menu.DedicatedAnalysis.NonferrousMetal.TitaniumAlloyBiomaterial.Text";
- }
- protected override void SubclassInitialize()
- {
- InitializeComponent();
- InitializeLanguageText();
- //this.panel1.Click += new System.EventHandler(this.panel1_Click);
- ////this.panel3.Click += new System.EventHandler(this.panel1_Click);
- //this.panel4.Click += new System.EventHandler(this.panel1_Click);
- ////this.groupBox_img.Size = new System.Drawing.Size(158, 544/*514*/);
- ////this.groupBox_review.Size = new System.Drawing.Size(575, 544/*514*/);
- ////this.groupBox_analysisResult1.Location = new System.Drawing.Point(12, 622/*592*/);
- ////this.groupBox6groupBox_analysisResult2.Location = new System.Drawing.Point(242, 622/*592*/);
- ////this.groupBox_report.Location = new System.Drawing.Point(974, 622/*592*/);
- this.ClientSize = new System.Drawing.Size(1127, 892);///*822*/
- IndexChangedFromIndex.Add(2);
- IndexChangedFromIndex.Add(3);
- IndexChangedFromIndex.Add(4);
- IndexChangedFromIndex.Add(5);
- IndexChangedFromIndex.Add(6);
- IndexChangedFromIndex.Add(7);
- IndexChangedToIndex.Add(0, new int[] { 2, 0 });//平均
- IndexChangedToIndex.Add(1, new int[] { 2, 1 });//平均
- IndexChangedToIndex.Add(2, new int[] { 2, 2 });//平均
- IndexChangedToIndex.Add(3, new int[] { 2, 3 });//平均
- IndexChangedToIndex.Add(4, new int[] { 2, 4 });//平均
- IndexChangedToIndex.Add(5, new int[] { 2, 5 });//平均
- //IndexChangedToIndex.Add(1, new int[] { 2/*1*/, 1 });//平均<-求和
- }
- //切换图片时控制前一张图的信息不遗留显示
- protected override void refreshWhileImgChanged()
- {
- this.physical_length = getCurrentWorkspace().GetRuler(MeasurementUnit.Micron);
- calculate1d = false;
- //this.label2.Text = "";
- //this.label7.Text = "";
- //this.label14.Text = "";
- if (top != null)
- top = null;
- if (bottom != null)
- bottom = null;
- if (tempHole1Bitmap != null)
- {
- tempHole1Bitmap.Dispose();
- tempHole1Bitmap = null;
- }
- if (tempHole2Bitmap != null)
- {
- tempHole2Bitmap.Dispose();
- tempHole2Bitmap = null;
- }
- if (tempHole3Bitmap != null)
- {
- tempHole3Bitmap.Dispose();
- tempHole3Bitmap = null;
- }
- vlines.Clear();
- if (line != null)
- {
- btnflag = 0;
- line = null;
- }
- tempLine = new System.Drawing.Point[][] { };
- //hlines.Clear();
- //honlines.Clear();
- if (lineleft != null || linebottom != null || lineright != null)
- {
- btnflag = 0;
- lineleft = null;
- linebottom = null;
- lineright = null;
- }
- //bool BinaryChecked = false;
- //if (getCurrentWorkTag() != null)
- // BinaryChecked = (binaryClass.getModelBinaryCheckFlag(getCurrentWorkTag()) != false);
- //if (!BinaryChecked && (this.documentWorkspace.PhaseModels.Count() == 0 || this.documentWorkspace.PhaseModels[0].mat == null || !this.documentWorkspace.PhaseModels[0].choise))
- //{//#22416
- // binaryClass.performClickBinaryCheck(false);
- //}
- this.grayBitmap = false;
- }
- #endregion
- #region 基础操作
- /// <summary>
- /// 灰度化
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button5_Click(object sender, EventArgs e)
- {
- if (this.bitmap == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text"));
- return;
- }
- if (this.grayBitmap) {
- MessageBox.Show(PdnResources.GetString("Menu.It'salreadygreyscale.text"));
- return;
- }
- this.grayBitmap = true;
- Mat lab1Img = OpenCvSharp.Extensions.BitmapConverter.ToMat(this.bitmap);
- if (lab1Img.Type() != MatType.CV_8UC1)
- {
- lab1Img = lab1Img.CvtColor(ColorConversionCodes.BGR2GRAY);
- Bitmap bitmap2 = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(lab1Img);
- Document document = Document.FromImage(bitmap2);
- this.documentWorkspace.Document = document;
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.It'salreadygreyscale.text"));
- lab1Img.Dispose();
- lab1Img = null;
- }
- /// <summary>
- /// 腐蚀
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- if (this.documentWorkspace.PhaseModels.Count < 1 || !this.documentWorkspace.PhaseModels[0].choise
- || this.documentWorkspace.PhaseModels[0].mat == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasebinarizefirst.text"));
- return;
- }
- Mat lab1Img = this.documentWorkspace.PhaseModels[0].mat;
- Cv2.Erode(lab1Img, lab1Img, new Mat(), null, 1, BorderTypes.Default);
- this.documentWorkspace.PhaseModels[0].mat = lab1Img;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 膨胀
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button10_Click(object sender, EventArgs e)
- {
- if (this.documentWorkspace.PhaseModels.Count < 1 || !this.documentWorkspace.PhaseModels[0].choise
- || this.documentWorkspace.PhaseModels[0].mat == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasebinarizefirst.text"));
- return;
- }
- Mat lab1Img = this.documentWorkspace.PhaseModels[0].mat;
- Cv2.Dilate(lab1Img, lab1Img, new Mat(), null, 1, BorderTypes.Default);
- this.documentWorkspace.PhaseModels[0].mat = lab1Img;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 刷新界面显示的方法
- /// </summary>
- public void refreshWorkSpace()
- {
- //更新左右辅助线位置 (画左右辅助线)
- //if (lineleft == null || lineright == null)
- {
- int margin = Math.Min(this.bitmap.Width / 2 - 5, (int)(this.scopeMarginLeft / this.physical_length));// this.bitmap.Width / 20;
- lineleft = new Line(new System.Drawing.Point(margin, 0), new System.Drawing.Point(margin, this.bitmap.Height));
- lineright = new Line(new System.Drawing.Point(this.bitmap.Width - margin, 0), new System.Drawing.Point(this.bitmap.Width - margin, this.bitmap.Height));
- }
- this.documentWorkspace.Refresh();
- }
- private void checkBox3_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 寻找轮廓
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button15_Click(object sender, EventArgs e)
- {
- if (this.documentWorkspace.PhaseModels.Count < 1 || !this.documentWorkspace.PhaseModels[0].choise/* //###21425 */
- || this.documentWorkspace.PhaseModels[0].mat == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasebinarizefirst.text"));
- return;
- }
- Mat analyzeMat = this.documentWorkspace.PhaseModels[0].mat;
- bool findTempLineSuccess;
- int Rows = analyzeMat.Rows;
- int Cols = analyzeMat.Cols;
- int[] point = new int[2];
- List<System.Drawing.Point> tempPointList = new List<System.Drawing.Point>();
- //多通道图像的格式化
- for (point[1] = 0; point[1] < Cols; point[1]++)
- {
- findTempLineSuccess = false;
- for (point[0] = 1; point[0] < Rows; point[0]++)
- {
- if (analyzeMat.At<Vec4b>(point[0], point[1]).Item3 > 0)
- {
- tempPointList.Add(new System.Drawing.Point(point[1], point[0]));
- findTempLineSuccess = true;//找到了最上边的交点
- break;
- }
- }
- if (!findTempLineSuccess)//如果没有找到最上边的交点,设置交点为图像的最高点
- {
- point[0] = 0;
- tempPointList.Add(new System.Drawing.Point(point[1], point[0]));
- }
- }
- tempLine = new System.Drawing.Point[][] { tempPointList.ToArray() };
- this.documentWorkspace.Refresh();
- //if (this.documentWorkspace.PhaseModels.Count < 1/* || !this.documentWorkspace.PhaseModels[0].choise*/
- // || this.documentWorkspace.PhaseModels[0].mat == null)
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleasebinarizefirst.text"));
- // return;
- //}
- //Mat analyzeMat = this.documentWorkspace.PhaseModels[0].mat;
- //Color tempHoleColor = this.panel1__BackColor;
- //Vec4b vec4B1 = new Vec4b(tempHoleColor.B, tempHoleColor.G, tempHoleColor.R, 255);
- //Vec4b vec4B2 = new Vec4b(0, 0, 0, 0);
- //if (tempHoleMat != null)
- //{
- // tempHoleMat.Dispose();
- // tempHoleMat = null;
- //}
- //tempHoleMat = new Mat(analyzeMat.Size(), MatType.CV_8UC4);
- //int Rows = analyzeMat.Rows;
- //int Cols = analyzeMat.Cols;
- //int[] point = new int[2];
- ////多通道图像的格式化
- //for (point[1] = 0; point[1] < Cols; point[1]++)
- //{
- // for (point[0] = 0; point[0] < Rows; point[0]++)
- // {
- // if (analyzeMat.At<Vec4b>(point[0], point[1]).Item3 > 0)
- // tempHoleMat.Set(point, vec4B2);
- // else
- // tempHoleMat.Set(point, vec4B1);
- // }
- //}
- //tempHoleBitmap = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(tempHoleMat);
- //this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 自动调整
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button17_Click(object sender, EventArgs e)
- {
- if (this.documentWorkspace.PhaseModels.Count < 1/* || !this.documentWorkspace.PhaseModels[0].choise*/
- || this.documentWorkspace.PhaseModels[0].mat == null)
- {
- binaryClass.performClickBinaryCheck(true);
- }
- this.button15.PerformClick();
- }
- /// <summary>
- /// 更多
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- //if (this.bitmap == null)//0914###18535
- //{
- // //MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicturefirst.text"));
- // //return;
- //}
- TABMethod4DialogSetting setting = new TABMethod4DialogSetting(this, this.appWorkspace, this.bitmap == null ? -1 : (this.lstView_img.FocusedItem != null ? this.lstView_img.FocusedItem.Index : this.lstView_img.SelectedItems[0].Index));
- //setting.TopMost = true;
- setting.ShowDialog();
- }
- /// <summary>
- /// 定义组织界面
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button13_Click(object sender, EventArgs e)
- {
- if (this.bitmap == null)//0914###18535
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicturefirst.text"));
- return;
- }
- if (lineleft == null || lineright == null)
- {
- this.Button16_Click(sender, e);
- //MessageBox.Show("请先点击选择视场");
- //return;
- }
- if (tempLine == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseclicktodrawtheoutlinefirst.text"));
- return;
- }
- //Form4 form = new Form4(lineright.startPoint.X - lineleft.startPoint.X, physical_length);
- //form.StartPosition = FormStartPosition.CenterParent;
- //if (form.ShowDialog() != DialogResult.OK)
- //{
- // return;
- //}
- //Intent.dict["per_text"] = textBox1.Text;
- //Intent.dict["num_text"] = textBox2.Text;
- if (this.bitmap/*lab1Img*/ != null/* && drawg != null*/)// && line == null
- {
- refreshPerWidth();
- if (string.IsNullOrWhiteSpace(this.textBox4__Text/*Intent.dict["per_text"]*/.ToString()) || /*Intent.dict["per_text"]*/this.textBox4__Text.ToString() == "")
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseentertheauxiliarylinespacingfirst.text"));
- return;
- }
- int per_w;
- try
- {
- per_w = (int)(float.Parse(/*Intent.dict["per_text"]*/this.textBox4__Text.ToString()) / physical_length);
- }
- catch (Exception b)
- {
- MessageBox.Show(b.Message);
- return;
- }
- per_w = Math.Max(1, per_w);//避免报错“尝试除以零”
- if (bottom == null)//line
- {
- System.Drawing.Point point1 = new System.Drawing.Point(0, this.bitmap.Height - 30/*130*/);
- System.Drawing.Point point2 = new System.Drawing.Point(this.bitmap.Width, this.bitmap.Height - 30/*130*/);
- bottom = new Line(point1, point2);
- //drawg.DrawLine(yellowPen, bottom.startPoint, bottom.endPoint);
- }
- else
- {
- //this.documentWorkspace.Refresh();
- ////drawg.Clear(Color.FromArgb(0, 11, 11, 11));
- ////drawg.DrawLine(yellowPen, bottom.startPoint, bottom.endPoint);
- }
- //画均匀垂直于基体平行线的线
- int y = bottom.endPoint.Y;
- lineNum = bottom.endPoint.Y;
- //trackBar1.Value = lineNum;
- int w = ((lineright.startPoint.X - lineleft.startPoint.X)/*lab1Img.Width*/ / per_w) - 1;
- w = Math.Max(1, w);
- vlines.Clear();
- for (int i = 0; i < w; i++)
- {
- int temp_y = -1;
- //找轮廓内所有跟线的x相交的点,取y最大(//###################最小)的值进行计算
- for (int n = 0; n < tempLine.Length; n++)
- {
- System.Drawing.Point[] pointsL = tempLine[n];
- for (int m = 0; m < pointsL.Length; m++)
- {
- if (pointsL[m].X - lineleft.startPoint.X == per_w * (i + 1))
- {
- if (temp_y == -1)
- {
- temp_y = pointsL[m].Y;
- }
- else
- {
- if (pointsL[m].Y < temp_y)
- {
- temp_y = pointsL[m].Y;
- }
- }
- }
- }
- }
- System.Drawing.Point tpoint1 = new System.Drawing.Point(per_w * (i + 1) + lineleft.startPoint.X, temp_y);
- System.Drawing.Point tpoint2 = new System.Drawing.Point(per_w * (i + 1) + lineleft.startPoint.X, y);
- Line temp = new Line(tpoint1, tpoint2);
- vlines.Add(temp);
- }
- int w11 = vlines.Count();
- w11 = Math.Max(1, w11);
- textBox6__Text = w11.ToString();//0916###18556//##################################
- //////calculated = false;
- ////pictureBox1.Image = map;
- //this.documentWorkspace.Refresh();
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text"));
- return;//
- }
- //获取组织界面
- //-->
- //厚度的数组
- List<int> thickness2 = new List<int>();
- //int[] thickness1 = new int[vlines.Count()];
- //循环每条线,找到和轮廓的交点
- for (int i = 0; i < vlines.Count(); i++)
- {
- ////画点//#############
- //drawg.DrawEllipse(new Pen(Color.Red, 5), vlines[i].startPoint.X - 1, vlines[i].startPoint.Y - 1, 9, 9);
- //drawg.DrawEllipse(new Pen(Color.Red, 5), vlines[i].startPoint.X - 1, lineNum - 1, 9, 9);
- //计算厚度,像素
- thickness2.Add(lineNum - vlines[i].startPoint.Y);
- //thickness1[i] = lineNum - vlines[i].startPoint.Y;
- }
- //计算
- //thickness2.Reverse();//.Sort();//
- thickness2.Sort((x, y) => -x.CompareTo(y));
- //Console.WriteLine(thickness2);
- int lengthForm = Math.Max(1, (int)(thickness2.Count / 20.0));
- int sumForm = 0;
- for (int i = 0; i < lengthForm; i++)
- {
- sumForm += thickness2[i];
- }
- //####################################
- //drawg.DrawLine(new Pen(Color.Yellow, zoom), new System.Drawing.Point(0, lineNum - sumForm / lengthForm), new System.Drawing.Point(lab1Img.Width, lineNum - sumForm / lengthForm));
- planesnumcal = lineNum - sumForm / lengthForm;
- //pictureBox1.Image = map;
- this.Button14_Click(sender, e);
- //////画左右辅助线
- ////if (lineleft == null || lineright == null)
- ////{
- //Pen blueLinePen = new Pen(Color.Blue, zoom);
- //// int margin = lab1Img.Width / 20;
- //// lineleft = new Line(new System.Drawing.Point(margin, 0), new System.Drawing.Point(margin, lab1Img.Height));
- //// lineright = new Line(new System.Drawing.Point(lab1Img.Width - margin, 0), new System.Drawing.Point(lab1Img.Width - margin, lab1Img.Height));
- //// drawg.DrawLine(blueLinePen, lineleft.startPoint, lineleft.endPoint);
- //// drawg.DrawLine(blueLinePen, lineright.startPoint, lineright.endPoint);
- //// pictureBox1.Image = map;
- //// pictureBox1.Refresh();
- ////}
- //drawg.DrawLine(blueLinePen, lineleft.startPoint, lineleft.endPoint);
- //drawg.DrawLine(blueLinePen, lineright.startPoint, lineright.endPoint);
- //pictureBox1.Image = map;
- //pictureBox1.Refresh();
- this.documentWorkspace.Refresh();
- btnflag = 1;
- //if (tempHoleMat == null)
- //{
- // MessageBox.Show("请先进行寻找孔隙操作");
- // return;
- //}
- ////if (contours == null)
- ////{
- //// MessageBox.Show(PdnResources.GetString("Menu.Pleaseclicktodrawtheoutlinefirst.text"));
- //// return;
- ////}
- //////this.showPhaseMat();
- //Mat lab1Img = this.documentWorkspace.PhaseModels[0].mat;
- //if (lab1Img != null/* && drawg != null*/)// && line == null
- //{
- // //if (string.IsNullOrWhiteSpace(this.textBox4.Text) || textBox4.Text == "")
- // //{
- // // MessageBox.Show(PdnResources.GetString("Menu.Pleaseentertheauxiliarylinespacingfirst.text"));
- // // return;
- // //}
- // string width = this.textBox4__Text.Trim();
- // double result;
- // if (!double.TryParse(width, out result))
- // {
- // MessageBox.Show(PdnResources.GetString("Menu.ormatforauxiliarylinespacin.Text"));
- // return;
- // }
- // string width2 = this.textBox6__Text.Trim();
- // int result2;
- // if (!int.TryParse(width2, out result2))
- // {
- // MessageBox.Show(PdnResources.GetString("Menu.Theinputforncorrect.text"));
- // return;
- // }
- // this.drawLines();
- // this.documentWorkspace.Refresh();
- //}
- //else
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleasebinarizefirst.text"));
- //}
- }
- /// <summary>
- /// 选择视场
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Button16_Click(object sender, EventArgs e)
- {
- this.button2_Clicked = true;
- //画左右辅助线
- if (lineleft == null || lineright == null)
- {
- int margin = Math.Min(this.bitmap.Width / 2 - 5, (int)(this.scopeMarginLeft / this.physical_length));// this.bitmap.Width / 20;
- lineleft = new Line(new System.Drawing.Point(margin, 0), new System.Drawing.Point(margin, this.bitmap.Height));
- lineright = new Line(new System.Drawing.Point(this.bitmap.Width - margin, 0), new System.Drawing.Point(this.bitmap.Width - margin, this.bitmap.Height));
- }
- if (bottom == null)//line
- {
- System.Drawing.Point point1 = new System.Drawing.Point(0, this.bitmap.Height - 30/*130*/);
- System.Drawing.Point point2 = new System.Drawing.Point(this.bitmap.Width, this.bitmap.Height - 30/*130*/);
- bottom = new Line(point1, point2);
- //drawg.DrawLine(new Pen(Color.Yellow, zoom)/*yellowPen*/, bottom.startPoint, bottom.endPoint);
- }
- this.documentWorkspace.Refresh();
- btnflag = 1;
- }
- /// <summary>
- /// 划分分析区域
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Button14_Click(object sender, EventArgs e)
- {
- if (planesnumcal == int.MaxValue)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasedefinetnterfacefirst.text"));
- //this.drawLines();
- //MessageBox.Show(PdnResources.GetString("Menu.Thedistancebeselectagain.text"));
- return;
- }
- if (planesnumcal < 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.lineandtr.Text"));
- //this.drawLines();
- //MessageBox.Show(PdnResources.GetString("Menu.Thedistancebeselectagain.text"));
- return;
- }
- try
- {
- int planesnum = planesnumcal;// int.Parse(Intent.dict["planesnum"].ToString());
- int planesbottom = bottom.endPoint.Y;// int.Parse(Intent.dict["planesbottom"].ToString());
- if (((planesbottom - planesnum) * physical_length) < 500)
- {
- this.drawLines();
- MessageBox.Show(PdnResources.GetString("Menu.Thedistancebeselectagain.text"));
- return;
- }
- top = new Line(new System.Drawing.Point(0, planesnum), new System.Drawing.Point(this.bitmap.Width, planesnum));
- bottom = new Line(new System.Drawing.Point(0, planesbottom), new System.Drawing.Point(this.bitmap.Width, planesbottom));
- }
- catch
- {
- MessageBox.Show(PdnResources.GetString("Menu.Failedtodivideanalysisarea.text"));
- return;
- //top = new Line(new System.Drawing.Point(0, lab1Img.Height - (int)(690 / physical_length)), new System.Drawing.Point(lab1Img.Width, lab1Img.Height - (int)(690 / physical_length)));
- }
- //#########
- //Pen blueLinePen = new Pen(Color.Blue, zoom);
- Line bottom1 = new Line(new System.Drawing.Point(0, top.startPoint.Y + (int)(200 / physical_length)), new System.Drawing.Point(this.bitmap.Width, top.startPoint.Y + (int)(200 / physical_length)));
- //drawg.DrawLine(blueLinePen, bottom1.startPoint, bottom1.endPoint);
- Line bottom2 = new Line(new System.Drawing.Point(0, top.startPoint.Y + (int)(400 / physical_length)), new System.Drawing.Point(this.bitmap.Width, top.startPoint.Y + (int)(400 / physical_length)));
- //drawg.DrawLine(blueLinePen, bottom2.startPoint, bottom2.endPoint);
- if (((bottom.startPoint.Y - top.startPoint.Y) * physical_length) > 600)
- {
- Line bottom3 = new Line(new System.Drawing.Point(0, top.startPoint.Y + (int)(600 / physical_length)), new System.Drawing.Point(this.bitmap.Width, top.startPoint.Y + (int)(600 / physical_length)));
- //drawg.DrawLine(blueLinePen, bottom3.startPoint, bottom3.endPoint);
- }
- //drawg.DrawLine(new Pen(Color.Yellow, zoom), bottom.startPoint, bottom.endPoint);
- //pictureBox1.Image = map;
- //pictureBox1.Refresh();
- }
- /// <summary>
- /// 绘制辅助线
- /// </summary>
- private void drawLines()
- {
- string line = this.textBox6__Text.Trim();
- string width = this.textBox4__Text.Trim();
- try
- {
- //画左右下辅助线
- if (lineleft == null || lineright == null)
- {
- int margin = Math.Min(this.bitmap.Width / 2 - 5, (int)(this.scopeMarginLeft / this.physical_length));// this.bitmap/*lab1Img*/.Width / 20;
- lineleft = new Line(new System.Drawing.Point(margin, 0), new System.Drawing.Point(margin, this.bitmap/*lab1Img*/.Height));
- lineright = new Line(new System.Drawing.Point(this.bitmap/*lab1Img*/.Width - margin, 0), new System.Drawing.Point(this.bitmap/*lab1Img*/.Width - margin, this.bitmap/*lab1Img*/.Height));
- }
- if (linebottom == null)
- {
- linebottom = new Line(new System.Drawing.Point(0, this.bitmap/*lab1Img*/.Height - 30/*130*/), new System.Drawing.Point(this.bitmap/*lab1Img*/.Width, this.bitmap/*lab1Img*/.Height - 30/*130*/));
- }
- //画平行的多条辅助线
- int n = int.Parse(line); //线的数量
- int per_w = (int)(double.Parse(width) / this.physical_length); //线的间距(目前当成像素,将来需要从微米转成像素)
- per_w = Math.Max(1, per_w);//避免报错“尝试除以零”
- //hlines.Clear();
- //{
- // for (int i = 0; i < n; i++)
- // {
- // Line l = new Line(new System.Drawing.Point(0, linebottom.startPoint.Y - per_w * i), new System.Drawing.Point(this.bitmap/*lab1Img*/.Width, linebottom.startPoint.Y - per_w * i));
- // //drawg.DrawLine(new Pen(Color.FromArgb(255, 0, 208, 202), zoom), l.startPoint, l.endPoint);
- // hlines.Add(l);
- // }
- //}
- //honlines.Clear();
- btnflag = 1;
- //pictureBox1.Image = map;
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- private void trackBar4_Scroll(object sender, EventArgs e)
- {
- this.textBox10.Text = "" + this.trackBar4.Value;
- }
- private void trackBar4_ValueChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 重置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, EventArgs e)
- {
- if (this.bitmap == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicturefirst.text"));
- return;
- }
- calculate1d = false;
- if (top != null)
- top = null;
- if (bottom != null)
- bottom = null;
- if (tempHole1Bitmap != null)
- {
- tempHole1Bitmap.Dispose();
- tempHole1Bitmap = null;
- }
- if (tempHole2Bitmap != null)
- {
- tempHole2Bitmap.Dispose();
- tempHole2Bitmap = null;
- }
- if (tempHole3Bitmap != null)
- {
- tempHole3Bitmap.Dispose();
- tempHole3Bitmap = null;
- }
- //this.label2.Text = "";
- //this.label7.Text = "";
- //this.label14.Text = "";
- //hlines.Clear();
- //honlines.Clear();
- if (lineleft == null && linebottom == null && lineright == null)
- { }
- else
- {
- btnflag = 0;
- lineleft = null;
- linebottom = null;
- lineright = null;
- }
- //contours = null;
- //vlines.Clear();
- //if (line == null)
- //{
- //}
- //else
- //{
- // btnflag = 0;
- // line = null;
- //}
- tempLine = new System.Drawing.Point[][] { };
- //if (tempHoleMat != null)
- //{
- // tempHoleMat.Dispose();
- // tempHoleMat = null;
- //}
- if (this.documentWorkspace.PhaseModels.Count() > 0)
- {
- this.documentWorkspace.PhaseModels[0].mat = null;
- }
- this.documentWorkspace.PhaseModels[0].choise = false;
- binaryClass.performClickBinaryCheck(false);
- //this.checkBox10.Checked = false;//PdnResources.GetString("Menu.Binarization.text");//####################
- this.grayBitmap = false;
- Document document = Document.FromImage(this.bitmap);
- this.documentWorkspace.Document = document;
- }
- /// <summary>
- /// 修改轮廓
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button14_Click(object sender, EventArgs e)
- {
- if (!(tempLine != null && tempLine.Length > 0))
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseclicktodrawtheoutlinefirst.text"));
- //MessageBox.Show("请先进行寻找轮廓操作"/*PdnResources.GetString("Menu.Pleaseperformuctionfirst.text")*/);
- return;
- }
- IntegrationClass.MetalsBoundaryEditingDialog boundaryEditingDialog = new IntegrationClass.MetalsBoundaryEditingDialog(this.appWorkspace, this.lstView_img.FocusedItem != null ? this.lstView_img.FocusedItem.Index : this.lstView_img.SelectedItems[0].Index, this.rectLineColor
- , tempLine.ToList());//#####################################
- if (boundaryEditingDialog.ShowDialog() == DialogResult.OK)
- {
- tempLine = boundaryEditingDialog.AnalyzePoints.ToArray();
- this.documentWorkspace.Refresh();
- }
- //if (this.bitmap == null)
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text"));
- // return;
- //}
- //if (tempHoleMat == null)
- //{
- // MessageBox.Show("请先进行寻找孔隙操作");
- // return;
- //}
- //IntegrationClass.MetalsHoleAreaEditingDialog boundaryEditingDialog = new IntegrationClass.MetalsHoleAreaEditingDialog(this.appWorkspace, this.lstView_img.FocusedItem.Index, this.panel1__BackColor
- // , tempHoleMat);
- //if (boundaryEditingDialog.ShowDialog() == DialogResult.OK)
- //{
- // tempHoleMat = boundaryEditingDialog.PhaseMat.Clone();
- // tempHoleBitmap = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(tempHoleMat);
- // this.documentWorkspace.Refresh();
- //}
- }
- #endregion 基础操作
- #region 矩形拖动
- /// <summary>
- /// 鼠标按下
- /// </summary>
- /// <param name="drawArea"></param>
- /// <param name="e"></param>
- protected override void OnMouseDown(object sender, MouseEventArgs e)
- {
- if (!CanUseMouseFunctions())
- return;
- try
- {
- //判断
- //画左右下辅助线
- if (linebottom == null || lineleft == null || lineright == null)
- {
- this.documentWorkspace.Cursor = Cursors.Default;
- //在MouseDown处获知鼠标是否按下,并记录下此时的鼠标坐标值;
- if (e.Button == MouseButtons.Left)
- {
- }
- return;
- //int margin = Math.Min(this.bitmap.Width / 2 - 5, (int)(this.scopeMarginLeft / this.physical_length));// lab1Img.Width / 20;
- //lineleft = new Line(new System.Drawing.Point(margin, 0), new System.Drawing.Point(margin, lab1Img.Height));
- //lineright = new Line(new System.Drawing.Point(lab1Img.Width - margin, 0), new System.Drawing.Point(lab1Img.Width - margin, lab1Img.Height));
- }
- System.Drawing.Point point = this.documentWorkspace.GetScalePoint(e.Location);
- float mouse_x = point.X;// ((e.X - panel1.Location.X + 12) * zoom - imgX);
- float mouse_y = point.Y;// ((e.Y - panel1.Location.Y + 12) * zoom - imgY);
- string line = this.textBox6__Text.Trim();
- string width = this.textBox4__Text.Trim();
- //画平行的多条辅助线
- int n = int.Parse(line); //线的数量
- int per_w = (int)(double.Parse(width) / this.physical_length); //线的间距(目前当成像素,将来需要从微米转成像素)
- per_w = Math.Max(1, per_w);//避免报错“尝试除以零”
- int bottomY1 = linebottom.startPoint.Y - per_w * (n - 1);
- if (mouse_x < lineleft.startPoint.X + 10 && mouse_x > lineleft.startPoint.X - 10)
- {
- //拖动左辅助线
- mouseFlag = 1;
- }
- else if (mouse_x < lineright.startPoint.X + 10 && mouse_x > lineright.startPoint.X - 10)
- {
- //拖动右辅助线
- mouseFlag = 2;
- }
- else if (mouse_y < linebottom.startPoint.Y && mouse_y > bottomY1)
- {
- xPos = (int)mouse_x;// e.X;//当前x坐标
- yPos = (int)mouse_y;// e.Y;//当前y坐标
- //拖动平行辅助线
- mouseFlag = 3;
- }
- else
- {
- this.documentWorkspace.Cursor = Cursors.Default;
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>
- /// 移动
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void onMouseMove(object sender, MouseEventArgs e)
- {
- if (!CanUseMouseFunctions())
- return;
- //拖动左右辅助线
- if (mouseFlag == 1 || mouseFlag == 2)
- {
- //Mat ImageROI = null;
- try
- {
- System.Drawing.Point point = this.documentWorkspace.GetScalePoint(e.Location);
- float mouse_x = point.X;// ((e.X - panel1.Location.X + 12) * zoom - imgX);
- float mouse_y = point.Y;// ((e.Y - panel1.Location.Y + 12) * zoom - imgY);
- ////移动左辅助线
- //drawg.Clear(Color.FromArgb(0, 11, 11, 11));
- int margin = (int)mouse_x;
- margin = Math.Min(this.bitmap/*lab1Img*/.Width - 10, margin);
- margin = Math.Max(10, margin);
- if (mouseFlag == 1)
- {
- lineleft = new Line(new System.Drawing.Point(margin, 0), new System.Drawing.Point(margin, this.bitmap/*lab1Img*/.Height));
- }
- else if (mouseFlag == 2)
- {
- lineright = new Line(new System.Drawing.Point(margin, 0), new System.Drawing.Point(margin, this.bitmap/*lab1Img*/.Height));
- }
- this.drawLines();
- this.documentWorkspace.Refresh();
- }
- catch
- {
- }
- finally
- {
- //ImageROI.Dispose();
- //GC.Collect();
- }
- return;
- }
- //拖动平行辅助线
- if (mouseFlag == 3)
- {
- System.Drawing.Point point = this.documentWorkspace.GetScalePoint(e.Location);
- float mouse_x = point.X;// ((e.X - panel1.Location.X + 12) * zoom - imgX);
- float mouse_y = point.Y;// ((e.Y - panel1.Location.Y + 12) * zoom - imgY);
- string line = this.textBox6__Text.Trim();
- string width = this.textBox4__Text.Trim();
- try
- {
- //drawg.Clear(Color.FromArgb(0, 11, 11, 11));
- //画左右下辅助线
- if (lineleft == null || lineright == null)
- {
- int margin = Math.Min(this.bitmap.Width / 2 - 5, (int)(this.scopeMarginLeft / this.physical_length));// this.bitmap/*lab1Img*/.Width / 20;
- lineleft = new Line(new System.Drawing.Point(margin, 0), new System.Drawing.Point(margin, this.bitmap/*lab1Img*/.Height));
- lineright = new Line(new System.Drawing.Point(this.bitmap/*lab1Img*/.Width - margin, 0), new System.Drawing.Point(this.bitmap/*lab1Img*/.Width - margin, this.bitmap/*lab1Img*/.Height));
- }
- if (linebottom == null)
- {
- linebottom = new Line(new System.Drawing.Point(0, this.bitmap/*lab1Img*/.Height - 30/*130*/), new System.Drawing.Point(this.bitmap/*lab1Img*/.Width, this.bitmap/*lab1Img*/.Height - 30/*130*/));
- }
- //bluePen = new Pen(Color.Blue, zoom);
- //drawg.DrawLine(bluePen, lineleft.startPoint, lineleft.endPoint);
- //drawg.DrawLine(bluePen, lineright.startPoint, lineright.endPoint);
- //画平行的多条辅助线
- int n = int.Parse(line); //线的数量
- int per_w = (int)(double.Parse(width) / this.physical_length); //线的间距(目前当成像素,将来需要从微米转成像素)
- per_w = Math.Max(1, per_w);//避免报错“尝试除以零”
- //hlines.Clear();
- //for (int i = 0; i < n; i++)
- //{
- // Line l = new Line(new System.Drawing.Point(0, linebottom.startPoint.Y + (int)(mouse_y - yPos) - per_w * i), new System.Drawing.Point(this.bitmap/*lab1Img*/.Width, linebottom.startPoint.Y + (int)(mouse_y - yPos) - per_w * i));
- // //drawg.DrawLine(new Pen(Color.FromArgb(255, 0, 208, 202), zoom), l.startPoint, l.endPoint);
- // hlines.Add(l);
- //}
- //honlines.Clear();
- btnflag = 1;
- //pictureBox1.Image = map;
- this.documentWorkspace.Refresh();
- }
- catch (Exception ex)
- {
- //MessageBox.Show(ex.Message);//解决不断弹出提示语的bug
- }
- return;
- }
- if (btnflag == 2)
- {
- //Mat ImageROI = null;
- try
- {
- System.Drawing.Point point = this.documentWorkspace.GetScalePoint(e.Location);
- float mouse_y = point.Y;// ((e.Y - panel1.Location.Y + 12) * zoom - imgY);
- ////移动辅助线
- //drawg.Clear(Color.FromArgb(0, 11, 11, 11));
- }
- catch (Exception b)
- {
- //MessageBox.Show(b.Message);//解决不断弹出提示语的bug
- }
- finally
- {
- //ImageROI.Dispose();
- //GC.Collect();
- }
- return;
- }
- if (btnflag == 1)
- {
- try
- {
- System.Drawing.Point point = this.documentWorkspace.GetScalePoint(e.Location);
- float mouse_x = point.X;// ((e.X - panel1.Location.X + 12) * zoom - imgX);
- float mouse_y = point.Y;// ((e.Y - panel1.Location.Y + 12) * zoom - imgY);
- string line = this.textBox6__Text.Trim();
- string width = this.textBox4__Text.Trim();
- //画平行的多条辅助线
- int n = int.Parse(line); //线的数量
- int per_w = (int)(double.Parse(width) / this.physical_length); //线的间距(目前当成像素,将来需要从微米转成像素)
- per_w = Math.Max(1, per_w);//避免报错“尝试除以零”
- int bottomY1 = linebottom.startPoint.Y - per_w * (n - 1);
- if ((mouse_x < lineleft.startPoint.X + 10 && mouse_x > lineleft.startPoint.X - 10) || (mouse_x < lineright.startPoint.X + 10 && mouse_x > lineright.startPoint.X - 10))
- {
- //移动辅助线
- this.documentWorkspace.Cursor = Cursors.SizeWE;
- }
- else if (mouse_y < linebottom.startPoint.Y && mouse_y > bottomY1)
- {
- //移动辅助线
- this.documentWorkspace.Cursor = Cursors.SizeAll;
- }
- else
- {
- this.documentWorkspace.Cursor = Cursors.Default;
- }
- }
- catch (Exception ex)
- {
- //MessageBox.Show(ex.Message);//解决不断弹出提示语的bug
- }
- }
- else
- {
- this.documentWorkspace.Cursor = Cursors.Default;
- }
- }
-
- /// <summary>
- /// 鼠标抬起
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void onMouseUp(object sender, MouseEventArgs e)
- {
- if (!CanUseMouseFunctions())
- return;
- //拖动平行辅助线
- if (mouseFlag == 3)
- {
- System.Drawing.Point point = this.documentWorkspace.GetScalePoint(e.Location);
- float mouse_x = point.X;// ((e.X - panel1.Location.X + 12) * zoom - imgX);
- float mouse_y = point.Y;// ((e.Y - panel1.Location.Y + 12) * zoom - imgY);
- string line = this.textBox6__Text.Trim();
- string width = this.textBox4__Text.Trim();
- try
- {
- //drawg.Clear(Color.FromArgb(0, 11, 11, 11));
- //画左右下辅助线
- if (lineleft == null || lineright == null)
- {
- int margin = Math.Min(this.bitmap.Width / 2 - 5, (int)(this.scopeMarginLeft / this.physical_length));// this.bitmap/*lab1Img*/.Width / 20;
- lineleft = new Line(new System.Drawing.Point(margin, 0), new System.Drawing.Point(margin, this.bitmap/*lab1Img*/.Height));
- lineright = new Line(new System.Drawing.Point(this.bitmap/*lab1Img*/.Width - margin, 0), new System.Drawing.Point(this.bitmap/*lab1Img*/.Width - margin, this.bitmap/*lab1Img*/.Height));
- }
- if (linebottom == null)
- {
- linebottom = new Line(new System.Drawing.Point(0, this.bitmap/*lab1Img*/.Height - 30/*130*/), new System.Drawing.Point(this.bitmap/*lab1Img*/.Width, this.bitmap/*lab1Img*/.Height - 30/*130*/));
- }
- //bluePen = new Pen(Color.Blue, zoom);
- //drawg.DrawLine(bluePen, lineleft.startPoint, lineleft.endPoint);
- //drawg.DrawLine(bluePen, lineright.startPoint, lineright.endPoint);
- //画平行的多条辅助线
- int n = int.Parse(line); //线的数量
- int per_w = (int)(double.Parse(width) / this.physical_length); //线的间距(目前当成像素,将来需要从微米转成像素)
- per_w = Math.Max(1, per_w);//避免报错“尝试除以零”
- //hlines.Clear();
- //for (int i = 0; i < n; i++)
- //{
- // Line l = new Line(new System.Drawing.Point(0, linebottom.startPoint.Y + (int)(mouse_y - yPos) - per_w * i), new System.Drawing.Point(this.bitmap/*lab1Img*/.Width, linebottom.startPoint.Y + (int)(mouse_y - yPos) - per_w * i));
- // //drawg.DrawLine(new Pen(Color.FromArgb(255, 0, 208, 202), zoom), l.startPoint, l.endPoint);
- // hlines.Add(l);
- //}
- //honlines.Clear();
- btnflag = 1;
- //pictureBox1.Image = map;
- linebottom.startPoint.Y = linebottom.startPoint.Y + (int)(mouse_y - yPos);
- this.documentWorkspace.Refresh();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- mouseFlag = 0;
- }
- #endregion
- #region 分析结果的方法
- /// <summary>
- /// 点击保存结果按钮,用来返回需要新增的一行数据
- /// </summary>
- /// <param name="tag"></param>
- /// <param name="imgName"></param>
- /// <returns></returns>
- protected override DataTable toInsertTableRow(string tag, string imgName)
- {
- DataTable dt = new DataTable(tag);
- dt.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
- dt.Columns.Add(PdnResources.GetString("Menu.rea.Text"));
- dt.Columns.Add(PdnResources.GetString("Menu.area.text"));
- dt.Columns.Add(PdnResources.GetString("Menu.Thetotalarea.text"));
- dt.Columns.Add(PdnResources.GetString("Menu.Percentageofholevolume.text"));
- dt.Columns.Add(PdnResources.GetString("Menu.Totallengthofintercept.text"));
- dt.Columns.Add(PdnResources.GetString("Menu.Meanporeintercept.text"));
- dt.Columns.Add(PdnResources.GetString("Menu.Numberofintercept.text"));
- {
- DataRow dataRow = dt.NewRow();
- dataRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
- dataRow[PdnResources.GetString("Menu.rea.Text")] = PdnResources.GetString("Menu.rea.Text") + 1;
- if (true || checkBox2.Checked)
- {
- dataRow[PdnResources.GetString("Menu.area.text")] = this.area1;
- dataRow[PdnResources.GetString("Menu.Thetotalarea.text")] = this.allarea1;
- dataRow[PdnResources.GetString("Menu.Percentageofholevolume.text")] = this.area1 * 100 / this.allarea1;
- }
- else
- {
- dataRow[PdnResources.GetString("Menu.area.text")] = "";
- dataRow[PdnResources.GetString("Menu.Thetotalarea.text")] = "";
- dataRow[PdnResources.GetString("Menu.Percentageofholevolume.text")] = "";
- }
- if (true || checkBox3.Checked)
- {
- dataRow[PdnResources.GetString("Menu.Totallengthofintercept.text")] = this.totallength1;
- dataRow[PdnResources.GetString("Menu.Meanporeintercept.text")] = this.perlength1;
- dataRow[PdnResources.GetString("Menu.Numberofintercept.text")] = this.pointsum1;
- }
- else
- {
- dataRow[PdnResources.GetString("Menu.Totallengthofintercept.text")] = "";
- dataRow[PdnResources.GetString("Menu.Meanporeintercept.text")] = "";
- dataRow[PdnResources.GetString("Menu.Numberofintercept.text")] = "";
- }
- dt.Rows.Add(dataRow);
- }
- {
- DataRow dataRow = dt.NewRow();
- dataRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
- dataRow[PdnResources.GetString("Menu.rea.Text")] = PdnResources.GetString("Menu.rea.Text") + 2;
- if (true || checkBox2.Checked)
- {
- dataRow[PdnResources.GetString("Menu.area.text")] = this.area2;
- dataRow[PdnResources.GetString("Menu.Thetotalarea.text")] = this.allarea2;
- dataRow[PdnResources.GetString("Menu.Percentageofholevolume.text")] = this.area2 * 100 / this.allarea2;
- }
- else
- {
- dataRow[PdnResources.GetString("Menu.area.text")] = "";
- dataRow[PdnResources.GetString("Menu.Thetotalarea.text")] = "";
- dataRow[PdnResources.GetString("Menu.Percentageofholevolume.text")] = "";
- }
- if (true || checkBox3.Checked)
- {
- dataRow[PdnResources.GetString("Menu.Totallengthofintercept.text")] = this.totallength2;
- dataRow[PdnResources.GetString("Menu.Meanporeintercept.text")] = this.perlength2;
- dataRow[PdnResources.GetString("Menu.Numberofintercept.text")] = this.pointsum2;
- }
- else
- {
- dataRow[PdnResources.GetString("Menu.Totallengthofintercept.text")] = "";
- dataRow[PdnResources.GetString("Menu.Meanporeintercept.text")] = "";
- dataRow[PdnResources.GetString("Menu.Numberofintercept.text")] = "";
- }
- dt.Rows.Add(dataRow);
- }
- {
- DataRow dataRow = dt.NewRow();
- dataRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
- dataRow[PdnResources.GetString("Menu.rea.Text")] = PdnResources.GetString("Menu.rea.Text") + 3;
- if (true || checkBox2.Checked)
- {
- dataRow[PdnResources.GetString("Menu.area.text")] = this.area3;
- dataRow[PdnResources.GetString("Menu.Thetotalarea.text")] = this.allarea3;
- dataRow[PdnResources.GetString("Menu.Percentageofholevolume.text")] = this.area3 * 100 / this.allarea3;
- }
- else
- {
- dataRow[PdnResources.GetString("Menu.area.text")] = "";
- dataRow[PdnResources.GetString("Menu.Thetotalarea.text")] = "";
- dataRow[PdnResources.GetString("Menu.Percentageofholevolume.text")] = "";
- }
- if (true || checkBox3.Checked)
- {
- dataRow[PdnResources.GetString("Menu.Totallengthofintercept.text")] = this.totallength3;
- dataRow[PdnResources.GetString("Menu.Meanporeintercept.text")] = this.perlength3;
- dataRow[PdnResources.GetString("Menu.Numberofintercept.text")] = this.pointsum3;
- }
- else
- {
- dataRow[PdnResources.GetString("Menu.Totallengthofintercept.text")] = "";
- dataRow[PdnResources.GetString("Menu.Meanporeintercept.text")] = "";
- dataRow[PdnResources.GetString("Menu.Numberofintercept.text")] = "";
- }
- dt.Rows.Add(dataRow);
- }
- ////dt.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
- ////dt.Columns.Add(PdnResources.GetString("Menu.Averagethickness(μm).text"));
- ////dt.Columns.Add(PdnResources.GetString("Menu.standarddeviation.text"));
- ////dt.Columns.Add(PdnResources.GetString("Menu.confidencebound.text"));
- //DataRow dataRow = dt.NewRow();
- //dataRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
- //dataRow[PdnResources.GetString("Menu.Totallengthofporeintercepts.text")] = res_totalL;
- //dataRow[PdnResources.GetString("Menu.Meanporeintercept.text")] = res_perL;
- //dataRow[PdnResources.GetString("Menu.Numberofintercept.text")] = res_count;
- //dt.Rows.Add(dataRow);
- return dt;
- }
- /// <summary>
- /// 计算结果是否存在
- /// </summary>
- /// <returns>返回是否可以计算和保存结果</returns>
- protected override bool resultCalculateExist()
- {
- return this.documentWorkspace.PhaseModels[0].mat != null;// tempHoleMat != null;// vlines.Count > 0;
- }
- /// <summary>
- /// 拼接中间数据
- /// </summary>
- /// <returns></returns>
- protected override List<List<string>> buildTempDataList()
- {
- //return null;
- 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.Tools.AuxiliaryLine.Text") + PdnResources.GetString("Menu.Xoordinate.Text"));
- //columnName.Add(PdnResources.GetString("Menu.ToYcoordinate.Text"));
- //columnName.Add(PdnResources.GetString("Menu.ToYcoonate.Text"));
- //columnName.Add(PdnResources.GetString("Menu.Tools.AuxiliaryLine.Text") + PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text"));
- //columnName.Add(PdnResources.GetString("Menu.Physicallength.text"));//addAction:这里
- columnName.Add("截线" + PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
- columnName.Add(PdnResources.GetString("Menu.eauxiliarylineYcoordinate.Text"));
- columnName.Add(PdnResources.GetString("Menu.LeftXcoordinate.Text"));
- columnName.Add(PdnResources.GetString("Menu.RightXcoordinate.Text"));
- columnName.Add(PdnResources.GetString("Menu.Lengthofauxiliaryline.Text"));
- columnName.Add(PdnResources.GetString("Menu.Physicallength.text"));//addAction:这里
- dataList.Add(columnName);
- int index = 0;
- //if (honlines != null && honlines.Count() > 0)
- //{
- // foreach (Line l in honlines)
- // {
- // graphics.DrawLine(yellowPen, l.startPoint, l.endPoint);
- // }
- //}
- //循环辅助线的集合
- if (lineDraws != null && lineDraws.Count() > 0)
- {
- //循环每条线,找到和轮廓的交点
- for (int i = 0; i < lineDraws.Count(); i++)
- {
- //Line l = lineDraws[i];
- List<string> strList = new List<string>();
- strList.Add((++index).ToString());
- strList.Add(lineDraws[i].startPoint.Y.ToString());
- strList.Add(lineDraws[i].startPoint.X.ToString());
- strList.Add(lineDraws[i].endPoint.X.ToString());
- strList.Add((lineDraws[i].endPoint.X - lineDraws[i].startPoint.X).ToString());
- strList.Add(((lineDraws[i].endPoint.X - lineDraws[i].startPoint.X) * physical_length).ToString());
- dataList.Add(strList);
- }
- }
- //int index = 0;
- //////厚度的数组
- ////int[] thickness = new int[vlines.Count()];
- ////循环辅助线的集合
- //if (this.vlines.Count > 0)
- //{
- // //循环每条线,找到和轮廓的交点
- // for (int i = 0; i < vlines.Count(); i++)
- // {
- // ////计算厚度,像素
- // //thickness[i] = lineNum - vlines[i].startPoint.Y;
- // List<string> strList = new List<string>();
- // strList.Add((++index).ToString());
- // strList.Add(vlines[i].startPoint.X.ToString());
- // strList.Add(vlines[i].startPoint.Y.ToString());
- // strList.Add(lineNum.ToString());
- // strList.Add((lineNum - vlines[i].startPoint.Y).ToString());
- // strList.Add(((lineNum - vlines[i].startPoint.Y) * physical_length).ToString());
- // dataList.Add(strList);
- // }
- //}
- return dataList;
- }
- /// <summary>
- /// 孔隙体积百分比
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Button3_Click(object sender, EventArgs e)
- {
- int planesnum = top.startPoint.Y;// int.Parse(Intent.dict["planesnum"].ToString());
- int planesbottom3 = bottom.startPoint.Y;// int.Parse(Intent.dict["planesbottom"].ToString());
- if (((planesbottom3 - planesnum) * physical_length) > 600)
- {
- planesbottom3 = planesnum + +(int)(600 / physical_length);
- }
- int planesbottom1 = planesnum + +(int)(200 / physical_length);
- int planesbottom2 = planesnum + +(int)(400 / physical_length);
- //计算三个区域的孔隙体积百分比
- //if (top == null || bottom == null)
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectareafirst.text"));
- // return;
- //}
- Mat lab1Img = this.documentWorkspace.PhaseModels[0].mat;
- ////重新进行处理
- Mat src2 = new Mat();
- lab1Img.CopyTo(src2);
- //简单计算孔隙面积和总面积等
- area1 = 0;
- allarea1 = 0;
- area2 = 0;
- allarea2 = 0;
- area3 = 0;
- allarea3 = 0;
- int leftX = lineleft.startPoint.X;
- int rightX = lineright.startPoint.X;
- //区域1
- try
- {
- //获取用户指定的区域
- Rect rect = new Rect(leftX, planesnum, Math.Max(1, rightX - leftX), planesbottom1 - planesnum);
- Mat tempMat = src2.Clone(rect);
- this.leftX11 = leftX;
- this.topX11 = planesnum;
- Mat tempHole1Mat = new Mat(tempMat.Size(), MatType.CV_8UC4, new Scalar(0, 0, 0, 0));
- Vec4b tempHoleVec4b = new Vec4b(panel2_0.BackColor.B, panel2_0.BackColor.G, panel2_0.BackColor.R, 255);
- area1 = 0;
- int Rows = tempMat.Rows;
- int Cols = tempMat.Cols;
- int[] point = new int[2];
- //简单计算孔隙面积和总面积等
- for (point[1] = 0; point[1] < Cols; point[1]++)
- for (point[0] = 0; point[0] < Rows; point[0]++)
- if (tempMat.At<Vec4b>(point[0], point[1]).Item3 <= 0)
- {
- tempHole1Mat.Set(point, tempHoleVec4b);
- area1++;
- }
- allarea1 = tempMat.Width * (planesbottom1 - planesnum);
- if (tempHole1Bitmap != null)
- {
- tempHole1Bitmap.Dispose();
- tempHole1Bitmap = null;
- }
- tempHole1Bitmap = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(tempHole1Mat);
- tempHole1Mat.Dispose();
- tempHole1Mat = null;
- //this.documentWorkspace.Refresh();
- }
- catch
- {
- }
- //区域2
- try
- {
- //获取用户指定的区域
- Rect rect = new Rect(leftX, planesbottom1, Math.Max(1, rightX - leftX), planesbottom2 - planesbottom1);
- Mat tempMat = src2.Clone(rect);
- this.leftX22 = leftX;
- this.topX22 = planesbottom1;
- Mat tempHole2Mat = new Mat(tempMat.Size(), MatType.CV_8UC4, new Scalar(0, 0, 0, 0));
- Vec4b tempHoleVec4b = new Vec4b(panel5.BackColor.B, panel5.BackColor.G, panel5.BackColor.R, 255);
- area2 = 0;
- int Rows = tempMat.Rows;
- int Cols = tempMat.Cols;
- int[] point = new int[2];
- //简单计算孔隙面积和总面积等
- for (point[1] = 0; point[1] < Cols; point[1]++)
- for (point[0] = 0; point[0] < Rows; point[0]++)
- if (tempMat.At<Vec4b>(point[0], point[1]).Item3 <= 0)
- {
- tempHole2Mat.Set(point, tempHoleVec4b);
- area2++;
- }
- allarea2 = tempMat.Width * (planesbottom2 - planesbottom1);
- if (tempHole2Bitmap != null)
- {
- tempHole2Bitmap.Dispose();
- tempHole2Bitmap = null;
- }
- tempHole2Bitmap = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(tempHole2Mat);
- tempHole2Mat.Dispose();
- tempHole2Mat = null;
- //this.documentWorkspace.Refresh();
- }
- catch
- {
- }
- //区域3
- try
- {
- //获取用户指定的区域
- Rect rect = new Rect(leftX, planesbottom2, Math.Max(1, rightX - leftX), planesbottom3 - planesbottom2);
- Mat tempMat = src2.Clone(rect);
- this.leftX33 = leftX;
- this.topX33 = planesbottom2;
- Mat tempHole3Mat = new Mat(tempMat.Size(), MatType.CV_8UC4, new Scalar(0, 0, 0, 0));
- Vec4b tempHoleVec4b = new Vec4b(panel4.BackColor.B, panel4.BackColor.G, panel4.BackColor.R, 255);
- area3 = 0;
- int Rows = tempMat.Rows;
- int Cols = tempMat.Cols;
- int[] point = new int[2];
- //简单计算孔隙面积和总面积等
- for (point[1] = 0; point[1] < Cols; point[1]++)
- for (point[0] = 0; point[0] < Rows; point[0]++)
- if (tempMat.At<Vec4b>(point[0], point[1]).Item3 <= 0)
- {
- tempHole3Mat.Set(point, tempHoleVec4b);
- area3++;
- }
- allarea3 = tempMat.Width * (planesbottom3 - planesbottom2);
- if (tempHole3Bitmap != null)
- {
- tempHole3Bitmap.Dispose();
- tempHole3Bitmap = null;
- }
- tempHole3Bitmap = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(tempHole3Mat);
- tempHole3Mat.Dispose();
- tempHole3Mat = null;
- //this.documentWorkspace.Refresh();
- }
- catch
- {
- }
- }
- /// <summary>
- /// 相颜色点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void panel2_Click(object sender, EventArgs e)
- {
- this.panelC = (Panel)sender;
- this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(((Panel)sender).BackColor);
- this.colorsFormGrid.ShowDialog();
- }
- /// <summary>
- /// PanelC的调色板颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void gridColorChanged(object sender, EventArgs e)
- {
- Color color = this.colorsFormGrid.UserPrimaryColor.ToColor();
- //更改背景色,触发事件
- this.panelC.BackColor = color;
- if (this.panelC == this.panel2_0 || this.panelC == this.panel5 || this.panelC == this.panel4
- || this.panelC == this.panel3)
- {
- if (this.panelC == this.panel2_0 && tempHole1Bitmap != null)
- {
- Mat tempHole1Mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(tempHole1Bitmap);
- Mat tempHole1MatCopy = new Mat(tempHole1Mat.Size(), MatType.CV_8UC4, new Scalar(0, 0, 0, 0));
- Vec4b tempHoleVec4b = new Vec4b(panel2_0.BackColor.B, panel2_0.BackColor.G, panel2_0.BackColor.R, 255);
- area1 = 0;
- int Rows = tempHole1Mat.Rows;
- int Cols = tempHole1Mat.Cols;
- int[] point = new int[2];
- //简单计算孔隙面积和总面积等
- for (point[1] = 0; point[1] < Cols; point[1]++)
- for (point[0] = 0; point[0] < Rows; point[0]++)
- if (tempHole1Mat.At<Vec4b>(point[0], point[1]).Item3 > 0)
- {
- tempHole1MatCopy.Set(point, tempHoleVec4b);
- area1++;
- }
- if (tempHole1Bitmap != null)
- {
- tempHole1Bitmap.Dispose();
- tempHole1Bitmap = null;
- }
- tempHole1Bitmap = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(tempHole1MatCopy);
- tempHole1Mat.Dispose();
- tempHole1Mat = null;
- tempHole1MatCopy.Dispose();
- tempHole1MatCopy = null;
- }
- if (this.panelC == this.panel5 && tempHole2Bitmap != null)
- {
- Mat tempHole2Mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(tempHole2Bitmap);
- Mat tempHole2MatCopy = new Mat(tempHole2Mat.Size(), MatType.CV_8UC4, new Scalar(0, 0, 0, 0));
- Vec4b tempHoleVec4b = new Vec4b(panel5.BackColor.B, panel5.BackColor.G, panel5.BackColor.R, 255);
- area1 = 0;
- int Rows = tempHole2Mat.Rows;
- int Cols = tempHole2Mat.Cols;
- int[] point = new int[2];
- //简单计算孔隙面积和总面积等
- for (point[1] = 0; point[1] < Cols; point[1]++)
- for (point[0] = 0; point[0] < Rows; point[0]++)
- if (tempHole2Mat.At<Vec4b>(point[0], point[1]).Item3 > 0)
- {
- tempHole2MatCopy.Set(point, tempHoleVec4b);
- area1++;
- }
- if (tempHole2Bitmap != null)
- {
- tempHole2Bitmap.Dispose();
- tempHole2Bitmap = null;
- }
- tempHole2Bitmap = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(tempHole2MatCopy);
- tempHole2Mat.Dispose();
- tempHole2Mat = null;
- tempHole2MatCopy.Dispose();
- tempHole2MatCopy = null;
- }
- if (this.panelC == this.panel4 && tempHole3Bitmap != null)
- {
- Mat tempHole3Mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(tempHole3Bitmap);
- Mat tempHole3MatCopy = new Mat(tempHole3Mat.Size(), MatType.CV_8UC4, new Scalar(0, 0, 0, 0));
- Vec4b tempHoleVec4b = new Vec4b(panel4.BackColor.B, panel4.BackColor.G, panel4.BackColor.R, 255);
- area1 = 0;
- int Rows = tempHole3Mat.Rows;
- int Cols = tempHole3Mat.Cols;
- int[] point = new int[2];
- //简单计算孔隙面积和总面积等
- for (point[1] = 0; point[1] < Cols; point[1]++)
- for (point[0] = 0; point[0] < Rows; point[0]++)
- if (tempHole3Mat.At<Vec4b>(point[0], point[1]).Item3 > 0)
- {
- tempHole3MatCopy.Set(point, tempHoleVec4b);
- area1++;
- }
- if (tempHole3Bitmap != null)
- {
- tempHole3Bitmap.Dispose();
- tempHole3Bitmap = null;
- }
- tempHole3Bitmap = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(tempHole3MatCopy);
- tempHole3Mat.Dispose();
- tempHole3Mat = null;
- tempHole3MatCopy.Dispose();
- tempHole3MatCopy = null;
- }
- this.documentWorkspace.Refresh();
- }
- //关闭色板
- this.colorsFormGrid.Close();
- }
- /// <summary>
- /// 绘制辅助线
- /// </summary>
- private void drawLines11()
- {
- //string line = this.textBox6.Text.Trim();
- this.refreshPerWidth();
- string width = this.textBox4.Text.Trim();
- try
- {
- //drawg.Clear(Color.FromArgb(0, 11, 11, 11));
- //drawg.DrawLine(new Pen(Color.Blue, zoom), lineleft.startPoint, lineleft.endPoint);
- //drawg.DrawLine(new Pen(Color.Blue, zoom), lineright.startPoint, lineright.endPoint);
- //bluePen = new Pen(Color.FromArgb(255, 0, 208, 202), zoom);
- //画平行的多条辅助线
- //int n = int.Parse(line); //线的数量
- int per_w = (int)(double.Parse(width) / this.physical_length); //线的间距(目前当成像素,将来需要从微米转成像素)
- per_w = Math.Max(1, per_w);//避免报错“尝试除以零”
- line1s.Clear();
- line2s.Clear();
- line3s.Clear();
- lines.Clear();
- int rect_3n = (int)(200 / double.Parse(width));
- int planesnum = top.startPoint.Y;// int.Parse(Intent.dict["planesnum"].ToString());
- int planesbottom1 = planesnum + +(int)(200 / physical_length);
- int planesbottom2 = planesnum + +(int)(400 / physical_length);
- int planesbottom3 = bottom.startPoint.Y;// int.Parse(Intent.dict["planesbottom"].ToString());
- if (((bottom.startPoint.Y - planesnum) * physical_length) > 600)
- {
- planesbottom3 = planesnum + +(int)(600 / physical_length);
- }
- else
- {
- rect_3n = (int)(((bottom.startPoint.Y - planesnum) * physical_length - 400) / double.Parse(width));
- }
- rect_n = (int)(200 / double.Parse(width));
- int rightX = lineright.startPoint.X;
- for (int i = 0; i < rect_n; i++)
- {
- int lypos = planesnum + per_w * i + per_w;
- lypos = Math.Min(planesbottom1 - (int)1, lypos);
- Line l = new Line(new System.Drawing.Point(leftX11, lypos), new System.Drawing.Point(rightX, lypos));
- //drawg.DrawLine(bluePen, l.startPoint, l.endPoint);
- line1s.Add(l);
- lines.Add(l);
- }
- for (int i = 0; i < rect_n; i++)
- {
- int lypos = planesbottom1 + per_w * i + per_w;
- lypos = Math.Min(planesbottom2 - (int)/*zoom*/1, lypos);
- Line l = new Line(new System.Drawing.Point(leftX22, lypos), new System.Drawing.Point(rightX, lypos));
- //drawg.DrawLine(bluePen, l.startPoint, l.endPoint);
- line2s.Add(l);
- lines.Add(l);
- }
- for (int i = 0; i < rect_3n/*(n - rect_n * 2)*/; i++)
- {
- int lypos = planesbottom2 + per_w * i + per_w;
- lypos = Math.Min(planesbottom3 - (int)1, lypos);
- Line l = new Line(new System.Drawing.Point(leftX33, lypos), new System.Drawing.Point(rightX, lypos));
- //drawg.DrawLine(bluePen, l.startPoint, l.endPoint);
- line3s.Add(l);
- lines.Add(l);
- }
- //drawg.DrawLine(new Pen(Color.Blue/*Red*/, zoom), new System.Drawing.Point(0, planesbottom1), new System.Drawing.Point(lab1Img.Width, planesbottom1));
- //drawg.DrawLine(new Pen(Color.Blue/*Red*/, zoom), new System.Drawing.Point(0, planesbottom2), new System.Drawing.Point(lab1Img.Width, planesbottom2));
- //if (((bottom.startPoint.Y - planesnum) * physical_length) > 600)
- //{
- // drawg.DrawLine(new Pen(Color.Blue/*Red*/, zoom), new System.Drawing.Point(0, planesbottom3), new System.Drawing.Point(lab1Img.Width, planesbottom3));
- //}
- //drawg.DrawLine(new Pen(Color.Yellow/*White*/, zoom), top.startPoint, top.endPoint);
- //drawg.DrawLine(new Pen(Color.Yellow, zoom), bottom.startPoint, bottom.endPoint);
- //pictureBox1.Image = map;
- this.documentWorkspace.Refresh();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>
- /// 平均孔隙截距
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Button11_Click(object sender, EventArgs e)
- {
- //if (top == null/* || bottom == null*/)
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleasedefinetnterfacefirst.text"));
- // return;
- //}
- Mat analyzeMat = this.documentWorkspace.PhaseModels[0].mat;
- if (this.documentWorkspace.PhaseModels[0].mat == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasebinarizefirst.text"));
- return;
- }
- //if (contours == null)
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleaseclicktodrawtheoutlinefirst.text"));
- // return;
- //}
- drawLines11();
- int n = line1s.Count + line2s.Count + line3s.Count;
- string width = this.textBox4.Text.Trim();
- //string width = this.textBox4__Text.Trim();
- double result = 0;
- if (!double.TryParse(width, out result))
- {
- MessageBox.Show(PdnResources.GetString("Menu.Linespacinginputformatincorrect.text"));
- return;
- }
- //if (double.Parse(width) > 100)//######################
- //{
- // MessageBox.Show("线的间距不应超过100微米");
- // return;
- //}
- //rect_n = (int)(200 / double.Parse(width));
- if ((n - rect_n * 2) < 1)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaserepartition.text"));
- return;
- }
- linePoints.Clear();
- calculation = true;
- int drawsize = 3;
- totallength1 = 0;
- pointsum1 = 0;
- totallength2 = 0;
- pointsum2 = 0;
- totallength3 = 0;
- pointsum3 = 0;
- List<List<OpenCvSharp.Point>> ddd = new List<List<OpenCvSharp.Point>>();
- for (int i = 0; i < lines.Count; i++)
- {
- List<OpenCvSharp.Point> list = new List<OpenCvSharp.Point>();
- int xMinPoint = Math.Min(lineleft.endPoint.X, lineright.endPoint.X);
- int xMaxPoint = Math.Max(lineleft.endPoint.X, lineright.endPoint.X);
- int yLinePoint = lines[i].endPoint.Y;// - 1;
- bool holeLineStart = true;//结束于视场的边缘或孔隙区域的中间,则这个区域不应包括在内
- OpenCvSharp.Point startPoint = new OpenCvSharp.Point(-1, yLinePoint);
- for (int j = xMinPoint; j <= xMaxPoint; j++)
- {
- if (analyzeMat.At<Vec4b>(yLinePoint, j).Item3 <= 0)
- {
- if (!holeLineStart)
- {
- startPoint.X = j;
- //list.Add(new OpenCvSharp.Point(j, yLinePoint));//记录网格线的起始点
- holeLineStart = true;
- }
- }
- else if (holeLineStart)
- {
- holeLineStart = false;
- if (startPoint.X > 0)
- {
- ++pointsum;
- totallength += (j - startPoint.X);
- //honlines.Add(new Line(new System.Drawing.Point(startPoint.X, yLinePoint), new System.Drawing.Point(j, yLinePoint)));
- list.Add(new OpenCvSharp.Point(startPoint.X, yLinePoint));//记录网格线的结束点
- list.Add(new OpenCvSharp.Point(j, yLinePoint));//记录网格线的结束点
- }
- }
- }
- //for (int j = contours.Count() - 1; j >= 0; j--)
- //{
- // List<OpenCvSharp.Point> dsd = contours[j].ToList<OpenCvSharp.Point>();
- // List<OpenCvSharp.Point> lll = dsd.FindAll(a => a.Y == lines[i].endPoint.Y - 1 && a.X > lineleft.endPoint.X && a.X < lineright.endPoint.X);
- // if (lll != null && lll.Count > 0)
- // {
- // //过滤一下,如果点密集,只要一个
- // int finetuning = 0;
- // //过滤,如果一个轮廓返回了一个点或者奇数点,则抛弃
- // List<OpenCvSharp.Point> temp = new List<OpenCvSharp.Point>();
- // foreach (var Point in lll)
- // {
- // //过滤一下,如果点密集,只要一个
- // if (finetuning == 0)
- // {
- // finetuning = Point.X;
- // }
- // else
- // {
- // if ((Point.X == finetuning + 1) || (Point.X == finetuning - 1))
- // {
- // finetuning = Point.X;
- // continue;
- // }
- // finetuning = Point.X;
- // }
- // temp.Add(new OpenCvSharp.Point(Point.X, Point.Y));
- // }
- // list.AddRange(temp);
- // }
- //}
- //list.Sort((a, b) => a.X.CompareTo(b.X));
- ddd.Add(list);
- }
- lineDraws.Clear();
- for (int j = 0; j < n/*rect_n*/; j++)
- {
- var point = ddd[j];
- for (int k = 0; k < point.Count - 1; k+=2)
- {
- //drawg.DrawEllipse(new Pen(Color.Yellow, drawsize), point[k].X, point[k].Y, drawsize, drawsize);
- OpenCvSharp.Point a = point[k];
- OpenCvSharp.Point b = point[k + 1];
- int x = (a.X + b.X) / 2;
- //if (dst1234.At<byte>(a.Y, x) <= 0)
- {
- //++pointsum;
- if (j < rect_n)
- {
- ++pointsum1;
- totallength1 += (b.X - a.X);
- }
- else if (j < rect_n * 2)
- {
- ++pointsum2;
- totallength2 += (b.X - a.X);
- }
- else
- {
- ++pointsum3;
- totallength3 += (b.X - a.X);
- }
- lineDraws.Add(new Line(new System.Drawing.Point(a.X, a.Y), new System.Drawing.Point(b.X, b.Y)));
- ////drawg.DrawLine(new Pen(Color.Yellow, drawsize + 2), temp[k].X, temp[k].Y, temp[k + 1].X, temp[k + 1].Y);
- //drawg.DrawLine(new Pen(Color.Yellow, drawsize), a.X, a.Y, b.X, b.Y);
- }
- }
- }
- //else
- //{
- // //Form8 form = new Form8(lab1Img, null, physical_length, top, bottom, lineleft, lineright);
- // //form.StartPosition = FormStartPosition.CenterParent;
- // //if (form.ShowDialog() != DialogResult.OK)
- // //{
- // // return;
- // //}
- //}
- this.documentWorkspace.Refresh();
- //pictureBox1.Image = map;
- calculate1d = true;
- //循环计算有效的网格线平均孔隙密度
- totallength = 0;
- pointsum = 0;
- totallength1 = (float)(totallength1 * physical_length);
- perlength1 = totallength1 / Math.Max(1, pointsum1);
- pointsum1 = (pointsum1 * 2);
- totallength2 = (float)(totallength2 * physical_length);
- perlength2 = totallength2 / Math.Max(1, pointsum2);
- pointsum2 = (pointsum2 * 2);
- totallength3 = (float)(totallength3 * physical_length);
- perlength3 = totallength3 / Math.Max(1, pointsum3);
- pointsum3 = (pointsum3 * 2);
- }
- /// <summary>
- /// 向数据展示表插入数据
- /// </summary>
- private void AddContentToDataGridView()
- {
- this.dataGridView1.Rows.Clear();
- {
- DataGridViewRow row = new DataGridViewRow();
- row.Height = 21;
- row.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.rea.Text") + 1, ""));
- if (true || checkBox2.Checked)
- {
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.area1.ToString()), ""));
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.allarea1.ToString()), ""));
- row.Cells.Add(CreateTextBoxCell(this.resShow((this.area1 * 100 / this.allarea1).ToString()), ""));
- }
- else
- {
- row.Cells.Add(CreateTextBoxCell("", ""));
- row.Cells.Add(CreateTextBoxCell("", ""));
- row.Cells.Add(CreateTextBoxCell("", ""));
- }
- if (true || checkBox3.Checked)
- {
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.totallength1.ToString()), ""));
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.perlength1.ToString()), ""));
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.pointsum1.ToString()), ""));
- }
- else
- {
- row.Cells.Add(CreateTextBoxCell("", ""));
- row.Cells.Add(CreateTextBoxCell("", ""));
- row.Cells.Add(CreateTextBoxCell("", ""));
- }
- this.dataGridView1.Rows.Add(row);
- }
- {
- DataGridViewRow row = new DataGridViewRow();
- row.Height = 21;
- row.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.rea.Text") + 2, ""));
- if (true || checkBox2.Checked)
- {
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.area2.ToString()), ""));
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.allarea2.ToString()), ""));
- row.Cells.Add(CreateTextBoxCell(this.resShow((this.area2 * 100 / this.allarea2).ToString()), ""));
- }
- else
- {
- row.Cells.Add(CreateTextBoxCell("", ""));
- row.Cells.Add(CreateTextBoxCell("", ""));
- row.Cells.Add(CreateTextBoxCell("", ""));
- }
- if (true || checkBox3.Checked)
- {
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.totallength2.ToString()), ""));
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.perlength2.ToString()), ""));
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.pointsum2.ToString()), ""));
- }
- else
- {
- row.Cells.Add(CreateTextBoxCell("", ""));
- row.Cells.Add(CreateTextBoxCell("", ""));
- row.Cells.Add(CreateTextBoxCell("", ""));
- }
- this.dataGridView1.Rows.Add(row);
- }
- {
- DataGridViewRow row = new DataGridViewRow();
- row.Height = 21;
- row.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.rea.Text") + 3, ""));
- if (true || checkBox2.Checked)
- {
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.area3.ToString()), ""));
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.allarea3.ToString()), ""));
- row.Cells.Add(CreateTextBoxCell(this.resShow((this.area3 * 100 / this.allarea3).ToString()), ""));
- }
- else
- {
- row.Cells.Add(CreateTextBoxCell("", ""));
- row.Cells.Add(CreateTextBoxCell("", ""));
- row.Cells.Add(CreateTextBoxCell("", ""));
- }
- if (true || checkBox3.Checked)
- {
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.totallength3.ToString()), ""));
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.perlength3.ToString()), ""));
- row.Cells.Add(CreateTextBoxCell(this.resShow(this.pointsum3.ToString()), ""));
- }
- else
- {
- row.Cells.Add(CreateTextBoxCell("", ""));
- row.Cells.Add(CreateTextBoxCell("", ""));
- row.Cells.Add(CreateTextBoxCell("", ""));
- }
- this.dataGridView1.Rows.Add(row);
- }
- this.dataGridView1.ClearSelection();
- //this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 2].Selected = true;
- }
- /// <summary>
- /// 计算结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void buttonCalculate_Click(object sender, EventArgs e)
- {
- if (this.documentWorkspace.PhaseModels[0].mat == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasebinarizefirst.text"));
- return;
- }
- //if (!checkBox2.Checked && !checkBox3.Checked)
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleasechrceptinthesetting.text"));
- // return;
- //}
- if (top == null/* || bottom == null*/)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasedefinetnterfacefirst.text"));
- return;
- }
- this.Button3_Click(sender, e);
- this.Button11_Click(sender, e);
- if (calculate1d)
- this.AddContentToDataGridView();
- ////if (top == null || bottom == null)
- ////{
- //// MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectareafirst.text"));
- //// return;
- ////}
- ////int result = 0;
- //if (hlines.Count == 0)
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleasedrawauxiliarylinesfirst.text"));
- // return;
- //}
- //if (!resultCalculateExist())
- //{
- // MessageBox.Show("请先进行寻找孔隙操作");//PdnResources.GetString("Menu.Pleaselookfortheoutlinefirst.text") ;//点击绘制轮廓
- // return;
- // //MessageBox.Show(PdnResources.GetString("Menu.Pleasedrawauxiliarylinesfirst.text"));
- // //return;
- //}
- ////calculation = true;
- ////循环计算有效的网格线平均孔隙密度
- //float totallength = 0;
- ////float perlength = 0;
- //int pointsum = 0;
- ////List<List<OpenCvSharp.Point>> ddd = new List<List<OpenCvSharp.Point>>();
- //honlines.Clear();
- //for (int i = 0; i < hlines.Count; i++)//hlines
- //{
- // //List<OpenCvSharp.Point> list = new List<OpenCvSharp.Point>();
- // int xMinPoint = Math.Min(lineleft.endPoint.X, lineright.endPoint.X);
- // int xMaxPoint = Math.Max(lineleft.endPoint.X, lineright.endPoint.X);
- // int yLinePoint = hlines[i].endPoint.Y;// - 1;
- // bool holeLineStart = true;//结束于视场的边缘或孔隙区域的中间,则这个区域不应包括在内
- // OpenCvSharp.Point startPoint = new OpenCvSharp.Point(-1, yLinePoint);
- // for (int j = xMinPoint; j <= xMaxPoint; j++)
- // {
- // if (tempHoleMat.At<Vec4b>(yLinePoint, j).Item3 > 0)
- // {
- // if (!holeLineStart)
- // {
- // startPoint.X = j;
- // //list.Add(new OpenCvSharp.Point(j, yLinePoint));//记录网格线的起始点
- // holeLineStart = true;
- // }
- // }
- // else if (holeLineStart)
- // {
- // holeLineStart = false;
- // if (startPoint.X > 0)
- // {
- // ++pointsum;
- // totallength += (j - startPoint.X);
- // honlines.Add(new Line(new System.Drawing.Point(startPoint.X, yLinePoint), new System.Drawing.Point(j, yLinePoint)));
- // //list.Add(new OpenCvSharp.Point(j, yLinePoint));//记录网格线的结束点
- // }
- // }
- // }
- // //if (!holeLineStart && list.Count > 0)//起始于视场的边缘或孔隙区域的中间,则这个区域不应包括在内
- // // list.RemoveAt(list.Count - 1);
- // //////for (int j = contours.Count() - 1; j >= 0; j--)//#
- // //////{
- // ////// List<OpenCvSharp.Point> dsd = contours[j].ToList<OpenCvSharp.Point>();
- // ////// List<OpenCvSharp.Point> lll = dsd.FindAll(a => a.Y == hlines[i].endPoint.Y - 1 && a.X > lineleft.endPoint.X && a.X < lineright.endPoint.X);
- // ////// if (lll != null && lll.Count > 0)
- // ////// {
- // ////// //过滤一下,如果点密集,只要一个
- // ////// int finetuning = 0;
- // ////// //过滤,如果一个轮廓返回了一个点或者奇数点,则抛弃
- // ////// List<OpenCvSharp.Point> temp = new List<OpenCvSharp.Point>();
- // ////// foreach (var Point in lll)
- // ////// {
- // ////// //过滤一下,如果点密集,只要一个
- // ////// if (finetuning == 0)
- // ////// {
- // ////// finetuning = Point.X;
- // ////// }
- // ////// else
- // ////// {
- // ////// if ((Point.X == finetuning + 1) || (Point.X == finetuning - 1))
- // ////// {
- // ////// finetuning = Point.X;
- // ////// continue;
- // ////// }
- // ////// finetuning = Point.X;
- // ////// }
- // ////// temp.Add(new OpenCvSharp.Point(Point.X, Point.Y));
- // ////// }
- // ////// list.AddRange(temp);
- // ////// }
- // //////}
- // ////list.Sort((a, b) => a.X.CompareTo(b.X));
- // //ddd.Add(list);
- //}
- //////Cv2.ImShow("dst12344", dst1234);
- ////honlines.Clear();
- //////绘制所有交点
- ////foreach (var point in ddd)
- ////{
- //// for (int k = 0; k < point.Count - 1; k += 2)
- //// {
- //// ////drawg.DrawEllipse(new Pen(Color.Yellow, drawsize), point[k].X, point[k].Y, drawsize, drawsize);
- //// OpenCvSharp.Point a = point[k];
- //// OpenCvSharp.Point b = point[k + 1];
- //// //int x = (a.X + b.X) / 2;
- //// ////lab1NoneContourImg
- //// //if (dst1234.At<byte>(a.Y, x) <= 0)
- //// //{
- //// // ++pointsum;
- //// // totallength += (b.X - a.X);
- //// //honlines.Add(new Line(new System.Drawing.Point(a.X, a.Y), new System.Drawing.Point(b.X, b.Y)));
- //// // //drawg.DrawLine(new Pen(Color.Yellow, drawsize), a.X, a.Y, b.X, b.Y);
- //// //}
- //// ////double innum = Cv2.PointPolygonTest(contours[j], new Point2f(x, a.Y), false);
- //// ////if (innum > 0)
- //// ////{
- //// //// drawg.DrawLine(new Pen(Color.Yellow, drawsize), a.X, a.Y, b.X, b.Y);
- //// //// break;
- //// ////}//########################################
- //// }
- ////}
- ////////Cv2.DrawContours(lab1Img, contours, -1, Scalar.Blue, Cv2.FILLED);
- ////////pictureBox1.BackgroundImage = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(lab1Img);
- //////pictureBox1.Image = map;
- //this.documentWorkspace.Refresh();
- //res_totalL = totallength * physical_length;
- //res_perL = res_totalL / Math.Max(1, pointsum);
- //res_count = Math.Max(1, pointsum);
- ////计算结果
- ////this.label2.Text = this.resShow(res_totalL.ToString());
- ////this.label7.Text = this.resShow(res_perL.ToString());
- ////this.label14.Text = res_count.ToString(); ;
- //calculate1d = true;
- }
- ///// <summary>
- ///// 记录输入文字改变的状态
- ///// </summary>
- //int textBoxChanged = -1;
- ///// <summary>
- ///// 上辅助线居顶距离改变
- ///// </summary>
- ///// <param name="sender"></param>
- ///// <param name="e"></param>
- //private void TextBox4_TextChanged(object sender, EventArgs e)
- //{
- // if (this.bitmap == null)
- // {
- // return;
- // }
- // string width2 = this.textBox6.Text.Trim();
- // int result2;
- // if (!int.TryParse(width2, out result2))
- // {
- // //MessageBox.Show("线的数量输入格式不正确");
- // return;
- // }
- // string width = this.textBox4.Text.Trim();
- // double result;
- // if (!double.TryParse(width, out result))
- // {
- // return;
- // }
- // this.drawLines();
- // this.documentWorkspace.Refresh();
- //}
- /// <summary>
- /// 辅助线数量改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void textBox6_TextChanged(object sender, EventArgs e)
- {
- refreshPerWidth();
- }
- /// <summary>
- /// 更新计算平均涂层厚度辅助线的间距
- /// </summary>
- private void refreshPerWidth()
- {
- if (this.bitmap == null)
- {
- return;
- }
- //画左右辅助线
- if (lineleft == null || lineright == null)
- {
- return;//#21375
- //int margin = Math.Min(this.bitmap.Width / 2 - 5, (int)(this.scopeMarginLeft / this.physical_length));// this.bitmap.Width / 20;
- //lineleft = new Line(new System.Drawing.Point(margin, 0), new System.Drawing.Point(margin, this.bitmap.Height));
- //lineright = new Line(new System.Drawing.Point(this.bitmap.Width - margin, 0), new System.Drawing.Point(this.bitmap.Width - margin, this.bitmap.Height));
- }
- if (string.IsNullOrWhiteSpace(this.textBox6.Text) || textBox6.Text == "")
- {
- return;
- }
- int w;
- try
- {
- w = int.Parse(this.textBox6.Text);
- }
- catch (Exception b)
- {
- MessageBox.Show(b.Message);
- return;
- }
- textBox6__Text = textBox6.Text;
- double per_w = ((lineright.startPoint.X - lineleft.startPoint.X) / Math.Max(1, (w + 1))) * physical_length;
- textBox4__Text = per_w.ToString();
- }
- ///// <summary>
- ///// 下辅助线居底距离改变
- ///// </summary>
- ///// <param name="sender"></param>
- ///// <param name="e"></param>
- //private void TextBox6_TextChanged(object sender, EventArgs e)
- //{
- // if (this.bitmap == null)
- // {
- // return;
- // }
- // string width = this.textBox4.Text.Trim();
- // double result;
- // if (!double.TryParse(width, out result))
- // {
- // //MessageBox.Show(PdnResources.GetString("Menu.Linespacinginputformatincorrect.text"));
- // return;
- // }
- // string width2 = this.textBox6.Text.Trim();
- // int result2;
- // if (!int.TryParse(width2, out result2))
- // {
- // //MessageBox.Show("线的数量输入格式不正确");
- // return;
- // }
- // this.drawLines();
- // this.documentWorkspace.Refresh();
- //}
- /// <summary>
- /// 小数点位数变化时刷新界面的数据
- /// </summary>
- protected override void RefreshDataGridView1()
- {
- if (calculate1d)
- {
- //this.label2.Text = this.resShow(res_totalL.ToString());
- //this.label7.Text = this.resShow(res_perL.ToString());
- //this.label14.Text = this.resShow(res_count.ToString());
- }
- }
- #endregion 分析结果的方法
- #region 参数保存及提取
- /// <summary>
- /// 保存参数的key,value和type
- /// </summary>
- /// <param name="param_key"></param>
- /// <param name="param_value"></param>
- /// <param name="param_type"></param>
- private void saveParamValue(string param_key, string param_value, int param_type)
- {
- bool foundItem = false;
- foreach (var item in this.analysisModel.ListParam)
- {
- if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
- {
- item.param_value = param_value;
- item.setValue();
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- {
- GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
- analysisItem.menuId = this.menuId;
- analysisItem.param_key = param_key;
- analysisItem.param_type = param_type;
- analysisItem.param_value = param_value;
- analysisItem.setValue();
- this.analysisModel.ListParam.Add(analysisItem);
- }
- }
-
- /// <summary>
- /// 保存界面中的参数到model
- /// </summary>
- private void saveDialogParamValues()
- {
- saveParamValue(ParamKey_Report, checkBox_generateReport_opensetting.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//报告设置
- saveParamValue(ParamKey_SetGuideNumber, textBox6.Text, (int)Base.Dtryt.ItemString);//设置辅助线条数
- saveParamValue(ParamKey_SetShow, checkBox3.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//设置显示
- saveParamValue(ParamKey_PoreRatioColour1, panel2_0.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//孔隙1体积百分比颜色
- saveParamValue(ParamKey_PoreRatioColour2, panel5.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//孔隙2体积百分比颜色
- saveParamValue(ParamKey_PoreRatioColour3, panel4.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//孔隙3体积百分比颜色
- saveParamValue(ParamKey_PoreRatioShow, checkBox2.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//孔隙体积百分比显示
- saveParamValue(ParamKey_AvgRangeColour, panel3.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//平均截距颜色
- saveParamValue(ParamKey_AvgRangeWidth, textBox10.Text, (int)Base.Dtryt.ItemString);//平均截距线宽
- saveParamValue(ParamKey_AvgRangeSpacing, textBox4.Text, (int)Base.Dtryt.ItemString);//平均截距间距
- saveParamValue(ParamKey_AvgRangeShow, checkBox1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//平均截距显示
- saveParamValue(ParamKey_DecimalPlace, numericUpDown1_0 != null ? numericUpDown1_0.Value.ToString() : "", (int)Base.Dtryt.Decimal);//保留小数位数
- //更多
- saveParamValue(ParamKey_RectLineColor, rectLineColor.ToArgb().ToString(), (int)Base.Dtryt.Color);
- saveParamValue(ParamKey_BaseLineColor, baseLineColor.ToArgb().ToString(), (int)Base.Dtryt.Color);
- saveParamValue(ParamKey_ScopeLineColor, scopeLineColor.ToArgb().ToString(), (int)Base.Dtryt.Color);
- saveParamValue(ParamKey_OrgLineColor, orgLineColor.ToArgb().ToString(), (int)Base.Dtryt.Color);
- saveParamValue(ParamKey_Rect1LineColor, rect1LineColor.ToArgb().ToString(), (int)Base.Dtryt.Color);
- saveParamValue(ParamKey_Rect2LineColor, rect2LineColor.ToArgb().ToString(), (int)Base.Dtryt.Color);
- saveParamValue(ParamKey_Rect3LineColor, rect3LineColor.ToArgb().ToString(), (int)Base.Dtryt.Color);
- saveParamValue(ParamKey_AssistLineColor, assistLineColor.ToArgb().ToString(), (int)Base.Dtryt.Color);
- saveParamValue(ParamKey_RectLineWidth, rectLineWidth.ToString(), (int)Base.Dtryt.Interger);
- saveParamValue(ParamKey_BaseLineWidth, baseLineWidth.ToString(), (int)Base.Dtryt.Interger);
- saveParamValue(ParamKey_ScopeLineWidth, scopeLineWidth.ToString(), (int)Base.Dtryt.Interger);
- saveParamValue(ParamKey_OrgLineWidth, orgLineWidth.ToString(), (int)Base.Dtryt.Interger);
- saveParamValue(ParamKey_Rect1LineWidth, rect1LineWidth.ToString(), (int)Base.Dtryt.Interger);
- saveParamValue(ParamKey_Rect2LineWidth, rect2LineWidth.ToString(), (int)Base.Dtryt.Interger);
- saveParamValue(ParamKey_Rect3LineWidth, rect3LineWidth.ToString(), (int)Base.Dtryt.Interger);
- saveParamValue(ParamKey_AssistLineWidth, assistLineWidth.ToString(), (int)Base.Dtryt.Interger);
- saveParamValue(ParamKey_ScopeMarginLeft, scopeMarginLeft.ToString(), (int)Base.Dtryt.Interger);
- }
- /// <summary>
- /// 获取保存的参数
- /// </summary>
- private void GetListParamModel()
- {
- if (this.analysisModel != null)
- {
- for (int i = 0; i < this.analysisModel.ListParam.Count; i++)
- {
- switch (this.analysisModel.ListParam[i].param_key)
- {
- case ParamKey_RectLineColor:
- rectLineColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_BaseLineColor:
- baseLineColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_ScopeLineColor:
- scopeLineColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_OrgLineColor:
- orgLineColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_Rect1LineColor:
- rect1LineColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_Rect2LineColor:
- rect2LineColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_Rect3LineColor:
- rect3LineColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_AssistLineColor:
- assistLineColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_RectLineWidth:
- rectLineWidth = (int)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_BaseLineWidth:
- baseLineWidth = (int)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_ScopeLineWidth:
- scopeLineWidth = (int)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_OrgLineWidth:
- orgLineWidth = (int)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Rect1LineWidth:
- rect1LineWidth = (int)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Rect2LineWidth:
- rect2LineWidth = (int)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Rect3LineWidth:
- rect3LineWidth = (int)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_AssistLineWidth:
- assistLineWidth = (int)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_ScopeMarginLeft:
- scopeMarginLeft = (int)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Report:
- checkBox_generateReport_opensetting.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_SetGuideNumber:
- textBox6.Text = this.analysisModel.ListParam[i].value.ToString();
- break;
- case ParamKey_SetShow:
- checkBox3.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_PoreRatioColour1:
- panel2_0.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_PoreRatioColour2:
- panel5.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_PoreRatioColour3:
- panel4.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_PoreRatioShow:
- checkBox2.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_AvgRangeColour:
- panel3.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_AvgRangeWidth:
- textBox10.Text = this.analysisModel.ListParam[i].value.ToString();
- trackBar4.Value = Convert.ToInt32(this.textBox10.Text);
- break;
- case ParamKey_AvgRangeSpacing:
- textBox4.Text = this.analysisModel.ListParam[i].value.ToString();
- break;
- case ParamKey_AvgRangeShow:
- checkBox1.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_DecimalPlace:
- numericUpDown1_0.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
- break;
- }
- }
- }
- }
- /// <summary>
- /// 关闭窗体时保存参数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void TABM4Dialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- this.saveDialogParamValues();
- //xml保存路径
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- foreach (var analysisItem in this.analysisModel.ListParam)
- {
- bool foundItem = false;
- foreach (var item in analysisModelXml.ListParam)
- {
- if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
- {
- item.param_value = analysisItem.param_value;
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- analysisModelXml.ListParam.Add(analysisItem.cloneModel());
- }
- //按路径和名称保存xml文件
- string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
- //保存xml
- FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
- }
- #endregion
- }
- }
|