1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223 |
- using Metis.DedicatedAnalysis.Porosity;
- using Metis.DedicatedAnalysis.Porosity.Model;
- using Metis.ParameterSet;
- using OpenCvSharp;
- using OpenCvSharp.Extensions;
- using PaintDotNet.Annotation;
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Annotation.FieldView;
- using PaintDotNet.Annotation.Label;
- using PaintDotNet.Base;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.Base.DedicatedAnalysis.Porosity;
- using PaintDotNet.Base.DedicatedAnalysis.Porosity.Model;
- using PaintDotNet.Base.Functionodel;
- using PaintDotNet.Base.SettingModel;
- using PaintDotNet.Base.SettingModel.LVMModel;
- using PaintDotNet.CustomControl;
- using PaintDotNet.Data.Param;
- using PaintDotNet.DbOpreate.DbBll;
- using PaintDotNet.DbOpreate.DbModel;
- using PaintDotNet.Instrument;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.IO;
- using System.Linq;
- using System.Windows.Forms;
- using static PaintDotNet.Base.DedicatedAnalysis.Porosity.MethodOfAssessment;
- namespace PaintDotNet.DedicatedAnalysis.Porosity
- {
- internal class PorosityStandardDialog : PdnBaseForm
- {
- #region 属性
- #region 属性
- /// <summary>
- /// 主控件
- /// </summary>
- protected AppWorkspace appWorkspace;
- /// <summary>
- /// 公共按钮
- /// </summary>
- private CommonControlButtons commonControlButtons;
- /// <summary>
- /// 图像面板
- /// </summary>
- protected DocumentWorkspaceWindow documentWorkspace;
- //private Dictionary<int, DocumentItem> documentItems;
- /// <summary>
- /// 当前选择的图片
- /// </summary>
- protected Mat imageMat;
- /// <summary>
- /// 处理程序
- /// </summary>
- protected ParamObject action;
- protected Dictionary<int, DocumentItem> documentItems;
- /// <summary>
- /// 外部所有的相
- /// </summary>
- protected List<PhaseModel> originalPhaseModels = new List<PhaseModel>();
- /// <summary>
- /// 是否首次选中
- /// </summary>
- protected int firstChoose = 0;
- protected PorosityConfig porosityConfig;
- /// <summary>
- /// 初始系统参数配置值
- /// </summary>
- private BinaryExtractionModel binaryExtractionModel = new BinaryExtractionModel();
- private Dictionary<DocumentWorkspace, AnalysisResult> analysisResults = new Dictionary<DocumentWorkspace, AnalysisResult>();
- private Dictionary<string, List<PhaseModel>> dict = new Dictionary<string, List<PhaseModel>>();
- /// <summary>
- /// 选择的评定方法
- /// </summary>
- private MethodOfAssessment methodOfAssessment;
- protected AnalysisResult tempAnalysisResult;
- /// <summary>
- /// 视场
- /// </summary>
- private List<RectangleF> rectangleF = new List<RectangleF>();
- /// <summary>
- /// 视场类型
- /// </summary>
- private List<dynamic> rectangleTypeList = new List<dynamic>();
- /// <summary>
- /// 视场
- /// </summary>
- private List<ViewModel> modelList = new List<ViewModel>();
- /// <summary>
- /// 视场
- /// </summary>
- private List<DrawObject> oldDrawList = new List<DrawObject>();
- /// <summary>
- /// 选择的视场
- /// </summary>
- private int chooseIndex = -1;
- /// <summary>
- /// 选择高亮视场
- /// </summary>
- private int chooseGrIndex = -1;
- /// <summary>
- /// 名字集合
- /// </summary>
- private List<string> nameList = new List<string>();
- /// <summary>
- /// PointF集合
- /// </summary>
- private Dictionary<int, PointF[]> pointFDic = new Dictionary<int, PointF[]>();
- /// <summary>
- /// 需要删除的位置
- /// </summary>
- protected int delIndex = -1;
- protected double imgPxPerUnit;
- private int selectPicture = -1;
- private bool userAll = false;
- private List<AnalysisResult> resultList = new List<AnalysisResult>();
- private List<int> hasResultIndexList = new List<int>();
- private bool nodata = false;
- private bool isExportResults = false;
- private bool isExportReports = false;
- private bool isExportProjects = false;
- /// <summary>
- /// 是否脚本运行
- /// </summary>
- private Boolean initScriptValues = false;
- protected string argsKey;
- protected object argsValue;
- protected Dictionary<string, PorosityConfig> everyImgData = new Dictionary<string, PorosityConfig>();
- protected string ImgName;
- #endregion 属性
- #region 组件
- private GroupBox groupBox_operating;
- private GroupBox groupBox_img;
- protected ListView lstView_img;
- private ImageList imageList_img;
- private IContainer components;
- //private GroupBox groupBox_baseSetting;
- private ComboBox comboBox_rollingDirection;
- private Label label_lwRatioLimit;
- private Label label_rollingDirection;
- protected NumericUpDown numericUpDown_lwRatioLimit;
- //protected GroupBox groupBox_colorSetting;
- private Panel panel_colorGamut;
- private CustomControl.HistogramControl histogramControl_colorSetting;
- private Button button_colorAdjustmentBS;
- private Button button_colorAdjustmentGL;
- private Button button_colorAdjustmentRH;
- private NumericUpDown numericUpDown_colorAdjustmentBSD;
- private NumericUpDown numericUpDown_colorAdjustmentBSU;
- private Label label_colorAdjustmentBS;
- private NumericUpDown numericUpDown_colorAdjustmentGLD;
- private NumericUpDown numericUpDown_colorAdjustmentGLU;
- private Label label_colorAdjustmentGL;
- private NumericUpDown numericUpDown_colorAdjustmentRHD;
- private NumericUpDown numericUpDown_colorAdjustmentRHU;
- private Label label_colorAdjustmentRH;
- private RadioButton radioButton_checkedHLS;
- private RadioButton radioButton_checkedRGB;
- private GroupBox groupBox_review;
- private GroupBox groupBox_report;
- private Label label_resultPrecision;
- protected DomainUpDown domainUpDown_resultPrecision;
- private Button button_exportResults;
- private Button button_generateReport;
- private GroupBox groupBox6groupBox_analysisResult2;
- private ListView listView_analysisResult;
- private GroupBox groupBox_analysisResult1;
- private Button button_remove;
- private Button button_all;
- private CheckBox checkBox1;
- private CheckBox checkBox11;
- private CheckBox checkBox3_0;
- private CustomControl.HistogramControl histogramControl_binary;
- private CustomControl.DecimalScopeControl numberScopeControl_binary1;
- private CheckBox checkBox_showBinary;
- private Button button_autoThreshold;
- private Label label_colorGamut;
- private Button button_pickColor;
- private Label label_showBinaryColor;
- private Panel panel_showBinaryColor;
- private Panel panel_colorGamutPhase;
- private CheckBox checkBox_showColorGamutPhase;
- private ToolTip toolTip_InclusionsDetails;
- private ListView listView_analysisResult2;
- private Button button_setting;
- private CheckedListBox listBox_analysisResult;
- private CheckBox checkBox_generateReport_opensetting;
- private Button btn_saveresult;
- private int imgIndex = -1;
- private bool addView = true;
- /// <summary>
- /// 当前点击调色板
- /// </summary>
- private int currentPanel = 1;
- private Button button1;
- //二值化集成1
- private BinaryClass binaryClass;
- protected int menuId;
- protected string menuName;
- private BinaryControl bc;
- private Button button3;
- private ComboBox comboBox2;
- private Label label2;
- /// <summary>
- /// 参数下拉的集合
- /// </summary>
- private List<string> files = new List<string>();
- private viewSetting ViewSetting;
- private int offsetHalfW = 0;
- private Button button2;
- private int offsetHalfH = 0;
- protected PorosityModel porosityModel = new PorosityModel();
- protected PorosityModel.PorosityParameter thisParameters;
- private string dialogText;
- private Button button5;
- private Button button4;
- protected int thisParametersIndex = -1;
- #endregion 组件
- #endregion 属性
- #region 构造函数
- public PorosityStandardDialog()
- {
- //this.Icon = PdnInfo.AppIcon;
- InitializeComponent();
- }
- public PorosityStandardDialog(AppWorkspace appWorkspace, string dialogText, PdnMenuItem menuItem)
- {
- this.firstChoose = 0;
- this.appWorkspace = appWorkspace;
- this.Text = dialogText;
- this.Icon = PdnInfo.AppIcon;
- this.dialogText = dialogText;
- this.Load += new System.EventHandler(this.GrainSizeDialog_Load);
- InitializeComponent();
- this.action = new Data.Action.Action901();
- InitializeCustomControl();
- InitializeLanguageText();
- Initialize();
- InitParameterList();
- getViewSetting();
- this.menuId = menuItem.MenuId;
- this.menuName = menuItem.Text;
- this.binaryClass = new BinaryClass(menuId);
- //二值化集成2
- binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.binary.Text") }
- , this.bc, this.appWorkspace, this.documentWorkspace, this.lstView_img);//初始化相的工作结构
- this.Shown += showImg;
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.saveLastData);
- }
- private void showImg(object sender, EventArgs e)
- {
- lstView_img.Focus();
- if (this.imgIndex != -1)
- {
- //滚动到指定的行位置
- this.lstView_img.EnsureVisible(this.imgIndex);
- this.selectPicture = this.imgIndex;
- this.lstView_img.Items[imgIndex].Focused = true;
- this.lstView_img.Items[imgIndex].Selected = true;
- }
- //如果是脚本执行,将参数带入
- if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
- {
- this.initScriptValues = true;//ScriptAutomatic
- //Boolean initScriptValues = true;
- ////在这里反射出对应功能的参数类
- string className = InvariantData.path_Action + ".Action" + menuId;
- ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
- foreach (Args arg in param.Lists)
- {
- Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
- if (param1.value != null)
- arg.Value = param1.value;
- this.argsKey = arg.key;
- this.argsValue = arg.Value;
- getArgsValue();
- getValue(arg.key, arg.Value);
- }
- appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
- }
- else
- {//读取上次关闭窗口时保存的参数
- getLastData();
- }
- bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
- binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
- if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
- this.startScriptAutomaticAction();
- }
- /// <summary>
- /// 执行脚本自动化的步骤
- /// </summary>
- private void startScriptAutomaticAction()
- {
- this.button4.PerformClick();
- this.button5.PerformClick();
- if (isExportResults)//导出结果
- this.button_exportResults.PerformClick();
- if (isExportReports)//生成报告
- this.button_generateReport.PerformClick();
- if (isExportProjects)//导出项目
- this.button1.PerformClick();
- this.appWorkspace.ScriptAutomatic = false;
- this.Close();
- }
- #endregion 构造函数
- #region 初始化组件
- private void InitializeLanguageText()
- {
- this.groupBox_operating.Text = PdnResources.GetString("Menu.operation.text");
- this.button3.Text = PdnResources.GetString("Menu.ViewSetting.Text");
- this.label2.Text = PdnResources.GetString("Menu.view.text");
- this.checkBox_generateReport_opensetting.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
- this.button_setting.Text = PdnResources.GetString("Menu.Setting.Text");
- this.btn_saveresult.Text = PdnResources.GetString("Menu.Saveresult.text");
- this.groupBox_img.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
- this.comboBox_rollingDirection.Items.AddRange(new object[] {
- PdnResources.GetString("Menu.vertical.text"),
- PdnResources.GetString("Menu.Level.text")});
- this.label_lwRatioLimit.Text = PdnResources.GetString("Menu.lengthwidthratio.Text");
- this.label_rollingDirection.Text = PdnResources.GetString("Menu.Rollingdirection.text");
- this.checkBox_showColorGamutPhase.Text = PdnResources.GetString("Menu.Matchthecoloreffect.text");
- this.button_pickColor.Text = PdnResources.GetString("Menu.Pickcolor.text");
- this.label_colorGamut.Text = PdnResources.GetString("Menu.Colorinterval.text");
- this.groupBox_review.Text = PdnResources.GetString("Menu.Preview.text");
- this.button1.Text = PdnResources.GetString("Menu.Tools.OpenProject.Text");
- this.label_resultPrecision.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
- this.button_exportResults.Text = PdnResources.GetString("Menu.Exportresults.text");
- this.button_generateReport.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
- this.groupBox_analysisResult1.Text = PdnResources.GetString("Menu.Analysisresult.text");
- this.button_remove.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.button_all.Text = PdnResources.GetString("Menu.Showall.text");
- this.label_showBinaryColor.Text = PdnResources.GetString("Menu.BinaryColor.text");
- this.checkBox_showBinary.Text = PdnResources.GetString("Menu.Displaysthebinaryeffect.text");
- this.button_autoThreshold.Text = PdnResources.GetString("Menu.Automaticthreshold.text");
- }
- private void InitializeCustomControl()
- {
- //
- // bc
- //
- this.bc = new PaintDotNet.CustomControl.BinaryControl();
- this.bc.BinaryBackColor = System.Drawing.Color.Red;
- this.bc.BinaryChecked = false;
- this.bc.BinaryStyle = 1;
- this.bc.Location = new System.Drawing.Point(178, 72);
- this.bc.Name = "bc";
- this.bc.OriginChecked = false;
- this.bc.scope1End = 0D;
- this.bc.scope1Start = 0D;
- this.bc.scope2End = 0D;
- this.bc.scope2Start = 0D;
- this.bc.scope3End = 0D;
- this.bc.scope3Start = 0D;
- this.bc.Size = new System.Drawing.Size(360, 292);
- this.bc.TabIndex = 5;
- this.Controls.Add(this.bc);
- this.Controls.SetChildIndex(this.bc, 0);
- }
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.groupBox_operating = new System.Windows.Forms.GroupBox();
- this.button5 = new System.Windows.Forms.Button();
- this.button4 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.comboBox2 = new System.Windows.Forms.ComboBox();
- this.label2 = new System.Windows.Forms.Label();
- this.checkBox_generateReport_opensetting = new System.Windows.Forms.CheckBox();
- this.button_setting = new System.Windows.Forms.Button();
- this.btn_saveresult = new System.Windows.Forms.Button();
- this.checkBox3_0 = new System.Windows.Forms.CheckBox();
- this.groupBox_img = new System.Windows.Forms.GroupBox();
- this.lstView_img = new System.Windows.Forms.ListView();
- this.imageList_img = new System.Windows.Forms.ImageList(this.components);
- this.comboBox_rollingDirection = new System.Windows.Forms.ComboBox();
- this.label_lwRatioLimit = new System.Windows.Forms.Label();
- this.label_rollingDirection = new System.Windows.Forms.Label();
- this.numericUpDown_lwRatioLimit = new System.Windows.Forms.NumericUpDown();
- this.checkBox_showColorGamutPhase = new System.Windows.Forms.CheckBox();
- this.panel_colorGamutPhase = new System.Windows.Forms.Panel();
- this.button_pickColor = new System.Windows.Forms.Button();
- this.label_colorGamut = new System.Windows.Forms.Label();
- this.panel_colorGamut = new System.Windows.Forms.Panel();
- this.histogramControl_colorSetting = new PaintDotNet.CustomControl.HistogramControl();
- this.button_colorAdjustmentBS = new System.Windows.Forms.Button();
- this.button_colorAdjustmentGL = new System.Windows.Forms.Button();
- this.button_colorAdjustmentRH = new System.Windows.Forms.Button();
- this.numericUpDown_colorAdjustmentBSD = new System.Windows.Forms.NumericUpDown();
- this.numericUpDown_colorAdjustmentBSU = new System.Windows.Forms.NumericUpDown();
- this.label_colorAdjustmentBS = new System.Windows.Forms.Label();
- this.numericUpDown_colorAdjustmentGLD = new System.Windows.Forms.NumericUpDown();
- this.numericUpDown_colorAdjustmentGLU = new System.Windows.Forms.NumericUpDown();
- this.label_colorAdjustmentGL = new System.Windows.Forms.Label();
- this.numericUpDown_colorAdjustmentRHD = new System.Windows.Forms.NumericUpDown();
- this.numericUpDown_colorAdjustmentRHU = new System.Windows.Forms.NumericUpDown();
- this.label_colorAdjustmentRH = new System.Windows.Forms.Label();
- this.radioButton_checkedHLS = new System.Windows.Forms.RadioButton();
- this.radioButton_checkedRGB = new System.Windows.Forms.RadioButton();
- this.groupBox_review = new System.Windows.Forms.GroupBox();
- this.groupBox_report = new System.Windows.Forms.GroupBox();
- this.button1 = new System.Windows.Forms.Button();
- this.label_resultPrecision = new System.Windows.Forms.Label();
- this.domainUpDown_resultPrecision = new System.Windows.Forms.DomainUpDown();
- this.button_exportResults = new System.Windows.Forms.Button();
- this.button_generateReport = new System.Windows.Forms.Button();
- this.groupBox6groupBox_analysisResult2 = new System.Windows.Forms.GroupBox();
- this.listView_analysisResult2 = new System.Windows.Forms.ListView();
- this.listView_analysisResult = new System.Windows.Forms.ListView();
- this.groupBox_analysisResult1 = new System.Windows.Forms.GroupBox();
- this.listBox_analysisResult = new System.Windows.Forms.CheckedListBox();
- this.button_remove = new System.Windows.Forms.Button();
- this.button_all = new System.Windows.Forms.Button();
- this.panel_showBinaryColor = new System.Windows.Forms.Panel();
- this.label_showBinaryColor = new System.Windows.Forms.Label();
- this.histogramControl_binary = new PaintDotNet.CustomControl.HistogramControl();
- this.numberScopeControl_binary1 = new PaintDotNet.CustomControl.DecimalScopeControl();
- this.checkBox_showBinary = new System.Windows.Forms.CheckBox();
- this.button_autoThreshold = new System.Windows.Forms.Button();
- this.toolTip_InclusionsDetails = new System.Windows.Forms.ToolTip(this.components);
- this.groupBox_operating.SuspendLayout();
- this.groupBox_img.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentBSD)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentBSU)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentGLD)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentGLU)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentRHD)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentRHU)).BeginInit();
- this.groupBox_report.SuspendLayout();
- this.groupBox6groupBox_analysisResult2.SuspendLayout();
- this.groupBox_analysisResult1.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox_operating
- //
- this.groupBox_operating.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox_operating.Controls.Add(this.button5);
- this.groupBox_operating.Controls.Add(this.button4);
- this.groupBox_operating.Controls.Add(this.button2);
- this.groupBox_operating.Controls.Add(this.button3);
- this.groupBox_operating.Controls.Add(this.comboBox2);
- this.groupBox_operating.Controls.Add(this.label2);
- this.groupBox_operating.Controls.Add(this.checkBox_generateReport_opensetting);
- this.groupBox_operating.Controls.Add(this.button_setting);
- this.groupBox_operating.Controls.Add(this.btn_saveresult);
- this.groupBox_operating.Location = new System.Drawing.Point(13, 12);
- this.groupBox_operating.Name = "groupBox_operating";
- this.groupBox_operating.Size = new System.Drawing.Size(1152, 53);
- this.groupBox_operating.TabIndex = 12;
- this.groupBox_operating.TabStop = false;
- //
- // button5
- //
- this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button5.Location = new System.Drawing.Point(910, 19);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(75, 23);
- this.button5.TabIndex = 46;
- this.button5.Text = "保存全部";
- this.button5.UseVisualStyleBackColor = true;
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // button4
- //
- this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button4.Location = new System.Drawing.Point(829, 19);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(75, 23);
- this.button4.TabIndex = 45;
- this.button4.Text = "应用全部";
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // button2
- //
- this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button2.Location = new System.Drawing.Point(727, 20);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(96, 23);
- this.button2.TabIndex = 44;
- this.button2.Text = "添加视场";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // button3
- //
- this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button3.Location = new System.Drawing.Point(991, 19);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(75, 23);
- this.button3.TabIndex = 43;
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // comboBox2
- //
- this.comboBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.comboBox2.FormattingEnabled = true;
- this.comboBox2.Location = new System.Drawing.Point(550, 21);
- this.comboBox2.Name = "comboBox2";
- this.comboBox2.Size = new System.Drawing.Size(171, 20);
- this.comboBox2.TabIndex = 42;
- this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged);
- //
- // label2
- //
- this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(660, 25);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(0, 12);
- this.label2.TabIndex = 41;
- //
- // checkBox_generateReport_opensetting
- //
- this.checkBox_generateReport_opensetting.AutoSize = true;
- this.checkBox_generateReport_opensetting.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
- this.checkBox_generateReport_opensetting.Location = new System.Drawing.Point(91, 24);
- this.checkBox_generateReport_opensetting.Name = "checkBox_generateReport_opensetting";
- this.checkBox_generateReport_opensetting.Size = new System.Drawing.Size(15, 14);
- this.checkBox_generateReport_opensetting.TabIndex = 6;
- this.checkBox_generateReport_opensetting.UseVisualStyleBackColor = true;
- //
- // button_setting
- //
- this.button_setting.Location = new System.Drawing.Point(6, 20);
- this.button_setting.Name = "button_setting";
- this.button_setting.Size = new System.Drawing.Size(75, 23);
- this.button_setting.TabIndex = 4;
- this.button_setting.UseVisualStyleBackColor = true;
- this.button_setting.Click += new System.EventHandler(this.button_setting_Click);
- //
- // btn_saveresult
- //
- this.btn_saveresult.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btn_saveresult.Location = new System.Drawing.Point(1072, 20);
- this.btn_saveresult.Name = "btn_saveresult";
- this.btn_saveresult.Size = new System.Drawing.Size(75, 23);
- this.btn_saveresult.TabIndex = 2;
- this.btn_saveresult.UseVisualStyleBackColor = true;
- this.btn_saveresult.Click += new System.EventHandler(this.btn_saveresult_Click);
- //
- // checkBox3_0
- //
- this.checkBox3_0.Location = new System.Drawing.Point(0, 0);
- this.checkBox3_0.Name = "checkBox3_0";
- this.checkBox3_0.Size = new System.Drawing.Size(104, 24);
- this.checkBox3_0.TabIndex = 0;
- //
- // groupBox_img
- //
- this.groupBox_img.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox_img.Controls.Add(this.lstView_img);
- this.groupBox_img.Location = new System.Drawing.Point(13, 72);
- this.groupBox_img.Margin = new System.Windows.Forms.Padding(4);
- this.groupBox_img.Name = "groupBox_img";
- this.groupBox_img.Padding = new System.Windows.Forms.Padding(4);
- this.groupBox_img.Size = new System.Drawing.Size(158, 483);
- this.groupBox_img.TabIndex = 13;
- this.groupBox_img.TabStop = false;
- //
- // lstView_img
- //
- this.lstView_img.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.lstView_img.HideSelection = false;
- this.lstView_img.LargeImageList = this.imageList_img;
- this.lstView_img.Location = new System.Drawing.Point(8, 26);
- this.lstView_img.Margin = new System.Windows.Forms.Padding(4);
- this.lstView_img.MultiSelect = false;
- this.lstView_img.Name = "lstView_img";
- this.lstView_img.Size = new System.Drawing.Size(140, 449);
- this.lstView_img.TabIndex = 0;
- this.lstView_img.UseCompatibleStateImageBehavior = false;
- this.lstView_img.SelectedIndexChanged += new System.EventHandler(this.lstView_img_SelectedIndexChanged);
- this.lstView_img.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lstView_img_MouseUp);
- //
- // imageList_img
- //
- this.imageList_img.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageList_img.ImageSize = new System.Drawing.Size(64, 64);
- this.imageList_img.TransparentColor = System.Drawing.Color.Transparent;
- //
- // comboBox_rollingDirection
- //
- this.comboBox_rollingDirection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox_rollingDirection.FormattingEnabled = true;
- this.comboBox_rollingDirection.Location = new System.Drawing.Point(87, 23);
- this.comboBox_rollingDirection.Name = "comboBox_rollingDirection";
- this.comboBox_rollingDirection.Size = new System.Drawing.Size(56, 20);
- this.comboBox_rollingDirection.TabIndex = 3;
- //
- // label_lwRatioLimit
- //
- this.label_lwRatioLimit.AutoSize = true;
- this.label_lwRatioLimit.Location = new System.Drawing.Point(192, 26);
- this.label_lwRatioLimit.Name = "label_lwRatioLimit";
- this.label_lwRatioLimit.Size = new System.Drawing.Size(65, 12);
- this.label_lwRatioLimit.TabIndex = 7;
- //
- // label_rollingDirection
- //
- this.label_rollingDirection.AutoSize = true;
- this.label_rollingDirection.Location = new System.Drawing.Point(10, 26);
- this.label_rollingDirection.Name = "label_rollingDirection";
- this.label_rollingDirection.Size = new System.Drawing.Size(53, 12);
- this.label_rollingDirection.TabIndex = 8;
- //
- // numericUpDown_lwRatioLimit
- //
- this.numericUpDown_lwRatioLimit.DecimalPlaces = 2;
- this.numericUpDown_lwRatioLimit.Location = new System.Drawing.Point(263, 24);
- this.numericUpDown_lwRatioLimit.Maximum = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- this.numericUpDown_lwRatioLimit.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.numericUpDown_lwRatioLimit.Name = "numericUpDown_lwRatioLimit";
- this.numericUpDown_lwRatioLimit.Size = new System.Drawing.Size(56, 21);
- this.numericUpDown_lwRatioLimit.TabIndex = 5;
- this.numericUpDown_lwRatioLimit.Value = new decimal(new int[] {
- 3,
- 0,
- 0,
- 0});
- //
- // checkBox_showColorGamutPhase
- //
- this.checkBox_showColorGamutPhase.AutoSize = true;
- this.checkBox_showColorGamutPhase.Location = new System.Drawing.Point(225, 49);
- this.checkBox_showColorGamutPhase.Name = "checkBox_showColorGamutPhase";
- this.checkBox_showColorGamutPhase.Size = new System.Drawing.Size(96, 16);
- this.checkBox_showColorGamutPhase.TabIndex = 41;
- this.checkBox_showColorGamutPhase.UseVisualStyleBackColor = true;
- //
- // panel_colorGamutPhase
- //
- this.panel_colorGamutPhase.BackColor = System.Drawing.Color.Lime;
- this.panel_colorGamutPhase.Location = new System.Drawing.Point(325, 49);
- this.panel_colorGamutPhase.Name = "panel_colorGamutPhase";
- this.panel_colorGamutPhase.Size = new System.Drawing.Size(69, 17);
- this.panel_colorGamutPhase.TabIndex = 40;
- //
- // button_pickColor
- //
- this.button_pickColor.Location = new System.Drawing.Point(352, 20);
- this.button_pickColor.Name = "button_pickColor";
- this.button_pickColor.Size = new System.Drawing.Size(48, 23);
- this.button_pickColor.TabIndex = 36;
- this.button_pickColor.UseVisualStyleBackColor = true;
- //
- // label_colorGamut
- //
- this.label_colorGamut.AutoSize = true;
- this.label_colorGamut.Location = new System.Drawing.Point(5, 51);
- this.label_colorGamut.Name = "label_colorGamut";
- this.label_colorGamut.Size = new System.Drawing.Size(53, 12);
- this.label_colorGamut.TabIndex = 35;
- //
- // panel_colorGamut
- //
- this.panel_colorGamut.Location = new System.Drawing.Point(64, 47);
- this.panel_colorGamut.Name = "panel_colorGamut";
- this.panel_colorGamut.Size = new System.Drawing.Size(130, 17);
- this.panel_colorGamut.TabIndex = 34;
- //
- // histogramControl_colorSetting
- //
- this.histogramControl_colorSetting.Flag = 1;
- this.histogramControl_colorSetting.Location = new System.Drawing.Point(6, 21);
- this.histogramControl_colorSetting.Name = "histogramControl_colorSetting";
- this.histogramControl_colorSetting.Size = new System.Drawing.Size(188, 114);
- this.histogramControl_colorSetting.TabIndex = 0;
- //
- // button_colorAdjustmentBS
- //
- this.button_colorAdjustmentBS.Location = new System.Drawing.Point(134, 99);
- this.button_colorAdjustmentBS.Name = "button_colorAdjustmentBS";
- this.button_colorAdjustmentBS.Size = new System.Drawing.Size(34, 21);
- this.button_colorAdjustmentBS.TabIndex = 34;
- this.button_colorAdjustmentBS.Text = "B";
- this.button_colorAdjustmentBS.UseVisualStyleBackColor = true;
- //
- // button_colorAdjustmentGL
- //
- this.button_colorAdjustmentGL.Location = new System.Drawing.Point(134, 72);
- this.button_colorAdjustmentGL.Name = "button_colorAdjustmentGL";
- this.button_colorAdjustmentGL.Size = new System.Drawing.Size(34, 21);
- this.button_colorAdjustmentGL.TabIndex = 33;
- this.button_colorAdjustmentGL.Text = "G";
- this.button_colorAdjustmentGL.UseVisualStyleBackColor = true;
- //
- // button_colorAdjustmentRH
- //
- this.button_colorAdjustmentRH.BackColor = System.Drawing.SystemColors.Control;
- this.button_colorAdjustmentRH.Location = new System.Drawing.Point(134, 45);
- this.button_colorAdjustmentRH.Margin = new System.Windows.Forms.Padding(0);
- this.button_colorAdjustmentRH.Name = "button_colorAdjustmentRH";
- this.button_colorAdjustmentRH.Size = new System.Drawing.Size(34, 21);
- this.button_colorAdjustmentRH.TabIndex = 32;
- this.button_colorAdjustmentRH.Text = "R";
- this.button_colorAdjustmentRH.UseVisualStyleBackColor = true;
- //
- // numericUpDown_colorAdjustmentBSD
- //
- this.numericUpDown_colorAdjustmentBSD.Location = new System.Drawing.Point(82, 99);
- this.numericUpDown_colorAdjustmentBSD.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this.numericUpDown_colorAdjustmentBSD.Name = "numericUpDown_colorAdjustmentBSD";
- this.numericUpDown_colorAdjustmentBSD.Size = new System.Drawing.Size(40, 21);
- this.numericUpDown_colorAdjustmentBSD.TabIndex = 30;
- this.numericUpDown_colorAdjustmentBSD.Tag = "max";
- //
- // numericUpDown_colorAdjustmentBSU
- //
- this.numericUpDown_colorAdjustmentBSU.Location = new System.Drawing.Point(37, 99);
- this.numericUpDown_colorAdjustmentBSU.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this.numericUpDown_colorAdjustmentBSU.Name = "numericUpDown_colorAdjustmentBSU";
- this.numericUpDown_colorAdjustmentBSU.Size = new System.Drawing.Size(40, 21);
- this.numericUpDown_colorAdjustmentBSU.TabIndex = 29;
- this.numericUpDown_colorAdjustmentBSU.Tag = "min";
- //
- // label_colorAdjustmentBS
- //
- this.label_colorAdjustmentBS.AutoSize = true;
- this.label_colorAdjustmentBS.Location = new System.Drawing.Point(10, 103);
- this.label_colorAdjustmentBS.Name = "label_colorAdjustmentBS";
- this.label_colorAdjustmentBS.Size = new System.Drawing.Size(23, 12);
- this.label_colorAdjustmentBS.TabIndex = 31;
- this.label_colorAdjustmentBS.Text = "B:";
- //
- // numericUpDown_colorAdjustmentGLD
- //
- this.numericUpDown_colorAdjustmentGLD.Location = new System.Drawing.Point(82, 72);
- this.numericUpDown_colorAdjustmentGLD.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this.numericUpDown_colorAdjustmentGLD.Name = "numericUpDown_colorAdjustmentGLD";
- this.numericUpDown_colorAdjustmentGLD.Size = new System.Drawing.Size(40, 21);
- this.numericUpDown_colorAdjustmentGLD.TabIndex = 27;
- this.numericUpDown_colorAdjustmentGLD.Tag = "max";
- //
- // numericUpDown_colorAdjustmentGLU
- //
- this.numericUpDown_colorAdjustmentGLU.Location = new System.Drawing.Point(37, 72);
- this.numericUpDown_colorAdjustmentGLU.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this.numericUpDown_colorAdjustmentGLU.Name = "numericUpDown_colorAdjustmentGLU";
- this.numericUpDown_colorAdjustmentGLU.Size = new System.Drawing.Size(40, 21);
- this.numericUpDown_colorAdjustmentGLU.TabIndex = 26;
- this.numericUpDown_colorAdjustmentGLU.Tag = "min";
- //
- // label_colorAdjustmentGL
- //
- this.label_colorAdjustmentGL.AutoSize = true;
- this.label_colorAdjustmentGL.Location = new System.Drawing.Point(10, 76);
- this.label_colorAdjustmentGL.Name = "label_colorAdjustmentGL";
- this.label_colorAdjustmentGL.Size = new System.Drawing.Size(23, 12);
- this.label_colorAdjustmentGL.TabIndex = 28;
- this.label_colorAdjustmentGL.Text = "G:";
- //
- // numericUpDown_colorAdjustmentRHD
- //
- this.numericUpDown_colorAdjustmentRHD.Location = new System.Drawing.Point(82, 45);
- this.numericUpDown_colorAdjustmentRHD.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this.numericUpDown_colorAdjustmentRHD.Name = "numericUpDown_colorAdjustmentRHD";
- this.numericUpDown_colorAdjustmentRHD.Size = new System.Drawing.Size(40, 21);
- this.numericUpDown_colorAdjustmentRHD.TabIndex = 8;
- this.numericUpDown_colorAdjustmentRHD.Tag = "max";
- //
- // numericUpDown_colorAdjustmentRHU
- //
- this.numericUpDown_colorAdjustmentRHU.Location = new System.Drawing.Point(37, 45);
- this.numericUpDown_colorAdjustmentRHU.Maximum = new decimal(new int[] {
- 255,
- 0,
- 0,
- 0});
- this.numericUpDown_colorAdjustmentRHU.Name = "numericUpDown_colorAdjustmentRHU";
- this.numericUpDown_colorAdjustmentRHU.Size = new System.Drawing.Size(40, 21);
- this.numericUpDown_colorAdjustmentRHU.TabIndex = 7;
- this.numericUpDown_colorAdjustmentRHU.Tag = "min";
- //
- // label_colorAdjustmentRH
- //
- this.label_colorAdjustmentRH.AutoSize = true;
- this.label_colorAdjustmentRH.Location = new System.Drawing.Point(10, 49);
- this.label_colorAdjustmentRH.Name = "label_colorAdjustmentRH";
- this.label_colorAdjustmentRH.Size = new System.Drawing.Size(23, 12);
- this.label_colorAdjustmentRH.TabIndex = 25;
- this.label_colorAdjustmentRH.Text = "R:";
- //
- // radioButton_checkedHLS
- //
- this.radioButton_checkedHLS.AutoSize = true;
- this.radioButton_checkedHLS.Location = new System.Drawing.Point(66, 20);
- this.radioButton_checkedHLS.Name = "radioButton_checkedHLS";
- this.radioButton_checkedHLS.Size = new System.Drawing.Size(41, 16);
- this.radioButton_checkedHLS.TabIndex = 4;
- this.radioButton_checkedHLS.Text = "HLS";
- this.radioButton_checkedHLS.UseVisualStyleBackColor = true;
- this.radioButton_checkedHLS.Visible = false;
- //
- // radioButton_checkedRGB
- //
- this.radioButton_checkedRGB.AutoSize = true;
- this.radioButton_checkedRGB.Checked = true;
- this.radioButton_checkedRGB.Location = new System.Drawing.Point(7, 20);
- this.radioButton_checkedRGB.Name = "radioButton_checkedRGB";
- this.radioButton_checkedRGB.Size = new System.Drawing.Size(41, 16);
- this.radioButton_checkedRGB.TabIndex = 3;
- this.radioButton_checkedRGB.TabStop = true;
- this.radioButton_checkedRGB.Text = "RGB";
- this.radioButton_checkedRGB.UseVisualStyleBackColor = true;
- //
- // groupBox_review
- //
- this.groupBox_review.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox_review.Location = new System.Drawing.Point(540, 72);
- this.groupBox_review.Name = "groupBox_review";
- this.groupBox_review.Size = new System.Drawing.Size(626, 483);
- this.groupBox_review.TabIndex = 30;
- this.groupBox_review.TabStop = false;
- //
- // groupBox_report
- //
- this.groupBox_report.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox_report.Controls.Add(this.button1);
- this.groupBox_report.Controls.Add(this.label_resultPrecision);
- this.groupBox_report.Controls.Add(this.domainUpDown_resultPrecision);
- this.groupBox_report.Controls.Add(this.button_exportResults);
- this.groupBox_report.Controls.Add(this.button_generateReport);
- this.groupBox_report.Location = new System.Drawing.Point(1024, 561);
- this.groupBox_report.Name = "groupBox_report";
- this.groupBox_report.Size = new System.Drawing.Size(142, 188);
- this.groupBox_report.TabIndex = 33;
- this.groupBox_report.TabStop = false;
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(29, 101);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 4;
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // label_resultPrecision
- //
- this.label_resultPrecision.AutoSize = true;
- this.label_resultPrecision.Location = new System.Drawing.Point(22, 147);
- this.label_resultPrecision.Name = "label_resultPrecision";
- this.label_resultPrecision.Size = new System.Drawing.Size(0, 12);
- this.label_resultPrecision.TabIndex = 3;
- //
- // domainUpDown_resultPrecision
- //
- this.domainUpDown_resultPrecision.Location = new System.Drawing.Point(63, 145);
- this.domainUpDown_resultPrecision.Name = "domainUpDown_resultPrecision";
- this.domainUpDown_resultPrecision.Size = new System.Drawing.Size(41, 21);
- this.domainUpDown_resultPrecision.TabIndex = 2;
- this.domainUpDown_resultPrecision.Text = "2";
- this.domainUpDown_resultPrecision.SelectedItemChanged += new System.EventHandler(this.domainUpDown_resultPrecision_SelectedItemChanged);
- //
- // button_exportResults
- //
- this.button_exportResults.Location = new System.Drawing.Point(29, 62);
- this.button_exportResults.Name = "button_exportResults";
- this.button_exportResults.Size = new System.Drawing.Size(75, 23);
- this.button_exportResults.TabIndex = 1;
- this.button_exportResults.UseVisualStyleBackColor = true;
- this.button_exportResults.Click += new System.EventHandler(this.button_exportResults_Click);
- //
- // button_generateReport
- //
- this.button_generateReport.Location = new System.Drawing.Point(29, 24);
- this.button_generateReport.Name = "button_generateReport";
- this.button_generateReport.Size = new System.Drawing.Size(75, 23);
- this.button_generateReport.TabIndex = 0;
- this.button_generateReport.UseVisualStyleBackColor = true;
- this.button_generateReport.Click += new System.EventHandler(this.button_generateReport_Click);
- //
- // groupBox6groupBox_analysisResult2
- //
- this.groupBox6groupBox_analysisResult2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox6groupBox_analysisResult2.Controls.Add(this.listView_analysisResult2);
- this.groupBox6groupBox_analysisResult2.Controls.Add(this.listView_analysisResult);
- this.groupBox6groupBox_analysisResult2.Location = new System.Drawing.Point(242, 561);
- this.groupBox6groupBox_analysisResult2.Name = "groupBox6groupBox_analysisResult2";
- this.groupBox6groupBox_analysisResult2.Size = new System.Drawing.Size(769, 188);
- this.groupBox6groupBox_analysisResult2.TabIndex = 32;
- this.groupBox6groupBox_analysisResult2.TabStop = false;
- //
- // listView_analysisResult2
- //
- this.listView_analysisResult2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.listView_analysisResult2.FullRowSelect = true;
- this.listView_analysisResult2.GridLines = true;
- this.listView_analysisResult2.HideSelection = false;
- this.listView_analysisResult2.Location = new System.Drawing.Point(6, 114);
- this.listView_analysisResult2.MultiSelect = false;
- this.listView_analysisResult2.Name = "listView_analysisResult2";
- this.listView_analysisResult2.Size = new System.Drawing.Size(757, 63);
- this.listView_analysisResult2.TabIndex = 2;
- this.listView_analysisResult2.UseCompatibleStateImageBehavior = false;
- //
- // listView_analysisResult
- //
- this.listView_analysisResult.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.listView_analysisResult.FullRowSelect = true;
- this.listView_analysisResult.GridLines = true;
- this.listView_analysisResult.HideSelection = false;
- this.listView_analysisResult.Location = new System.Drawing.Point(6, 20);
- this.listView_analysisResult.MultiSelect = false;
- this.listView_analysisResult.Name = "listView_analysisResult";
- this.listView_analysisResult.ShowItemToolTips = true;
- this.listView_analysisResult.Size = new System.Drawing.Size(757, 88);
- this.listView_analysisResult.TabIndex = 2;
- this.listView_analysisResult.UseCompatibleStateImageBehavior = false;
- //
- // groupBox_analysisResult1
- //
- this.groupBox_analysisResult1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox_analysisResult1.Controls.Add(this.listBox_analysisResult);
- this.groupBox_analysisResult1.Controls.Add(this.button_remove);
- this.groupBox_analysisResult1.Controls.Add(this.button_all);
- this.groupBox_analysisResult1.Location = new System.Drawing.Point(12, 561);
- this.groupBox_analysisResult1.Name = "groupBox_analysisResult1";
- this.groupBox_analysisResult1.Size = new System.Drawing.Size(224, 188);
- this.groupBox_analysisResult1.TabIndex = 31;
- this.groupBox_analysisResult1.TabStop = false;
- //
- // listBox_analysisResult
- //
- this.listBox_analysisResult.CheckOnClick = true;
- this.listBox_analysisResult.FormattingEnabled = true;
- this.listBox_analysisResult.HorizontalScrollbar = true;
- this.listBox_analysisResult.Location = new System.Drawing.Point(6, 53);
- this.listBox_analysisResult.Name = "listBox_analysisResult";
- this.listBox_analysisResult.Size = new System.Drawing.Size(199, 132);
- this.listBox_analysisResult.TabIndex = 0;
- this.listBox_analysisResult.SelectedIndexChanged += new System.EventHandler(this.listBox_analysisResult_SelectedIndexChanged);
- //
- // button_remove
- //
- this.button_remove.Location = new System.Drawing.Point(130, 24);
- this.button_remove.Name = "button_remove";
- this.button_remove.Size = new System.Drawing.Size(75, 23);
- this.button_remove.TabIndex = 8;
- this.button_remove.UseVisualStyleBackColor = true;
- this.button_remove.Click += new System.EventHandler(this.button_remove_Click);
- //
- // button_all
- //
- this.button_all.Location = new System.Drawing.Point(14, 24);
- this.button_all.Name = "button_all";
- this.button_all.Size = new System.Drawing.Size(75, 23);
- this.button_all.TabIndex = 1;
- this.button_all.UseVisualStyleBackColor = true;
- this.button_all.Click += new System.EventHandler(this.button_all_Click);
- //
- // panel_showBinaryColor
- //
- this.panel_showBinaryColor.BackColor = System.Drawing.Color.Yellow;
- this.panel_showBinaryColor.Location = new System.Drawing.Point(325, 82);
- this.panel_showBinaryColor.Name = "panel_showBinaryColor";
- this.panel_showBinaryColor.Size = new System.Drawing.Size(69, 17);
- this.panel_showBinaryColor.TabIndex = 38;
- //
- // label_showBinaryColor
- //
- this.label_showBinaryColor.AutoSize = true;
- this.label_showBinaryColor.Location = new System.Drawing.Point(217, 84);
- this.label_showBinaryColor.Name = "label_showBinaryColor";
- this.label_showBinaryColor.Size = new System.Drawing.Size(77, 12);
- this.label_showBinaryColor.TabIndex = 36;
- //
- // histogramControl_binary
- //
- this.histogramControl_binary.Flag = 1;
- this.histogramControl_binary.Location = new System.Drawing.Point(8, 22);
- this.histogramControl_binary.Name = "histogramControl_binary";
- this.histogramControl_binary.Size = new System.Drawing.Size(186, 117);
- this.histogramControl_binary.TabIndex = 16;
- //
- // numberScopeControl_binary1
- //
- this.numberScopeControl_binary1.DecimalPlaces = 0;
- this.numberScopeControl_binary1.Location = new System.Drawing.Point(217, 23);
- this.numberScopeControl_binary1.Maximum = 255D;
- this.numberScopeControl_binary1.maxValue = 0D;
- this.numberScopeControl_binary1.Minimum = 0D;
- this.numberScopeControl_binary1.minValue = 0D;
- this.numberScopeControl_binary1.Name = "numberScopeControl_binary1";
- this.numberScopeControl_binary1.Size = new System.Drawing.Size(150, 22);
- this.numberScopeControl_binary1.TabIndex = 15;
- //
- // checkBox_showBinary
- //
- this.checkBox_showBinary.AutoSize = true;
- this.checkBox_showBinary.Checked = true;
- this.checkBox_showBinary.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox_showBinary.Location = new System.Drawing.Point(217, 116);
- this.checkBox_showBinary.Name = "checkBox_showBinary";
- this.checkBox_showBinary.Size = new System.Drawing.Size(96, 16);
- this.checkBox_showBinary.TabIndex = 11;
- this.checkBox_showBinary.UseVisualStyleBackColor = true;
- //
- // button_autoThreshold
- //
- this.button_autoThreshold.Location = new System.Drawing.Point(217, 51);
- this.button_autoThreshold.Name = "button_autoThreshold";
- this.button_autoThreshold.Size = new System.Drawing.Size(75, 22);
- this.button_autoThreshold.TabIndex = 12;
- this.button_autoThreshold.UseVisualStyleBackColor = true;
- //
- // PorosityStandardDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(1177, 761);
- this.Controls.Add(this.groupBox_report);
- this.Controls.Add(this.groupBox6groupBox_analysisResult2);
- this.Controls.Add(this.groupBox_analysisResult1);
- this.Controls.Add(this.groupBox_review);
- this.Controls.Add(this.groupBox_img);
- this.Controls.Add(this.groupBox_operating);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Name = "PorosityStandardDialog";
- this.Controls.SetChildIndex(this.groupBox_operating, 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.groupBox_operating.ResumeLayout(false);
- this.groupBox_operating.PerformLayout();
- this.groupBox_img.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentBSD)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentBSU)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentGLD)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentGLU)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentRHD)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentRHU)).EndInit();
- this.groupBox_report.ResumeLayout(false);
- this.groupBox_report.PerformLayout();
- this.groupBox6groupBox_analysisResult2.ResumeLayout(false);
- this.groupBox_analysisResult1.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- public void Initialize()
- {
- for (int i = 10; i >= 0; i--)
- {
- this.domainUpDown_resultPrecision.Items.Add(i.ToString());
- }
- this.domainUpDown_resultPrecision.SelectedIndex = 8;
- this.documentItems = new Dictionary<int, DocumentItem>();
- // 构造工作结构
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- {
- //Bitmap bitmap = this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.CreateAliasedBitmap();
- List<PhaseModel> phaseModels = new List<PhaseModel>();
- List<PhaseModel> originalPhaseModels = new List<PhaseModel>();
- //二值化相关
- PhaseModel analysisModel = this.appWorkspace.DocumentWorkspaces[i].AnalysisPhaseModel;
- if (analysisModel == null)
- {
- PhaseModel modelBinary = new PhaseModel();
- modelBinary.choise = true;
- modelBinary.mat = null;
- //modelBinary.color = panel_showBinaryColor.BackColor.ToArgb();//###
- modelBinary.position = originalPhaseModels.Count + 1;
- modelBinary.name = PdnResources.GetString("Menu.binary.Text");
- modelBinary.color = 0;
- phaseModels.Add(analysisModel);
- originalPhaseModels.Add(modelBinary);
- }
- else
- {
- if (analysisModel.name == PdnResources.GetString("Menu.binary.Text"))
- {
- analysisModel.name = PdnResources.GetString("Menu.Multiphasebinary.Text");
- }
- phaseModels.Add(analysisModel);
- originalPhaseModels = this.appWorkspace.DocumentWorkspaces[i].phaseModels.Where(m => m.choise == true).ToList();
- }
- this.documentItems.Add(i, new DocumentItem(this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.CreatedAliasedMat().Clone(), null, phaseModels, originalPhaseModels));
- }
- //初始化图片列表
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- {
- this.imageList_img.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
- this.lstView_img.Items.Add("", i);
- this.lstView_img.Items[i].ImageIndex = i;
- this.lstView_img.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- this.lstView_img.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
- {
- this.imgIndex = i;
- }
- }
- //
- //初始化图像控件
- //
- this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
- this.documentWorkspace.Cursor = Cursors.Default;
- this.documentWorkspace.Dock = DockStyle.Fill;
- this.documentWorkspace.HookMouseEvents();
- this.documentWorkspace.AuxiliaryLineEnabled = false;
- this.documentWorkspace.Visible = true;
- this.groupBox_review.Controls.Add(this.documentWorkspace);
- //
- //初始化操作按钮
- //
- this.commonControlButtons = new CommonControlButtons();
- this.commonControlButtons.Dock = DockStyle.Top;
- this.commonControlButtons.Height = 30;
- this.commonControlButtons.HideZoomToWindowAndActualSize();
- this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
- this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
- this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
- this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
- this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
- this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
- groupBox_review.Controls.Add(this.commonControlButtons);
- //this.binaryExtractionModel.ColorInterval = 1;
- // 初始化报告列表
- this.listView_analysisResult.View = View.Details;
- this.listView_analysisResult2.View = View.Details;
- this.listBox_analysisResult.DisplayMember = "Display";
- this.listBox_analysisResult.ValueMember = "Value";
- documentWorkspace.panel.MouseDown += Panel_Click;
- }
- #endregion 初始化组件
- #region 事件
- #region 公共按钮
- private void zoomInButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomIn();
- }
- private void zoomOutButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomOut();
- }
- private void zoomToWindowButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
- }
- private void actualSizeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
- this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
- }
- private void pointerButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.InclusionNoEffect;
- }
- private void mobileModeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
- }
- #endregion 公共按钮
- private void button_setting_Click(object sender, EventArgs e)
- {
- AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, this.methodOfAssessment.resourcesName);
- if (recombinationRateSetDialog.hasModule)
- {
- recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
- recombinationRateSetDialog.ShowDialog();
- }
- else
- {
- recombinationRateSetDialog = null;
- }
- }
- private void btn_saveresult_Click(object sender, EventArgs e)
- {
- if (this.lstView_img.FocusedItem == null || this.lstView_img.FocusedItem.Index == -1)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicturefirst.text"));
- return;
- }
- //二值化
- if (!bcBinaryChecked())
- {
- if (!userAll)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformbinarizationoperationfirst.text"));
- }
- return;
- }
- if (this.tempAnalysisResult == null)
- {
- if (!userAll)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Nodatatosave.text"));
- }
- return;
- }
- if (analysisResults.ContainsKey(this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index]))
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theresuethertoreplace.text") + "?", PdnResources.GetString("Form.OkButton.Text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- if (dr == DialogResult.OK)
- {
- dict[this.lstView_img.FocusedItem.Text] = this.tempAnalysisResult.phaseModels;
- analysisResults[this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index]] = this.tempAnalysisResult;
- buildListBox_analysisResult();
- save_normal_data();
- }
- return;
- }
- if (dict.ContainsKey(this.lstView_img.FocusedItem.Text))
- {
- dict[this.lstView_img.FocusedItem.Text] = this.documentWorkspace.phaseModels;
- }
- else
- {
- dict.Add(this.lstView_img.FocusedItem.Text, this.documentWorkspace.phaseModels);
- }
- analysisResults.Add(this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index], this.tempAnalysisResult);
- if (userAll)
- {
- if (hasResultIndexList.IndexOf(this.lstView_img.FocusedItem.Index) == -1)
- {
- resultList.Add(this.tempAnalysisResult);
- hasResultIndexList.Add(this.lstView_img.FocusedItem.Index);
- }
- else
- {
- resultList[this.lstView_img.FocusedItem.Index] = this.tempAnalysisResult;
- }
- }
- if (!nodata)
- {
- buildListBox_analysisResult();
- }
- save_normal_data();
- }
- private void lstView_img_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.lstView_img.FocusedItem != null && this.lstView_img.FocusedItem.Selected)
- {
- if (!string.IsNullOrEmpty(ImgName))
- {
- saveEveryImgData();
- }
- this.tempAnalysisResult = null;
- this.documentWorkspace.Document = Document.FromImageMat(this.documentItems[this.lstView_img.FocusedItem.Index].imageMat);
- this.documentWorkspace.Visible = true;
- this.imgPxPerUnit = this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
- this.imageMat = this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
- this.methodOfAssessment = getMethodOfAssessment();
- MethodOfAssessment.activeMethod = this.methodOfAssessment;
- SetAnalyzeModelFromXml(this.methodOfAssessment.resourcesName);
- if (this.bcBinaryChecked())
- {
- this.documentWorkspace.ActiveTool = DrawToolType.InclusionNoEffect;
- }
- else
- {
- if (this.addView)
- {
- this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
- }
- else
- {
- this.documentWorkspace.ActiveTool = DrawToolType.InclusionNoEffect;
- }
- }
- this.originalPhaseModels = this.documentItems[this.lstView_img.FocusedItem.Index].originalPhaseModels;
- clearAllView();
- this.nameList.Clear();
- this.rectangleF.Clear();
- this.rectangleTypeList.Clear();
- //二值化集成4
- if (firstChoose == 0)
- {
- //获取所有外部保存的视场
- InitViewData();
- }
- binaryClass.RefreshHistogramControl1Values();
- if (selectPicture != -1)
- {
- this.binaryClass.saveMat(this.imageList_img.Images.Keys[selectPicture]);
- }
- selectPicture = this.lstView_img.FocusedItem.Index;
- var gList = new GraphicsList();
- if (this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.Count != 0)
- {
- foreach (var s in this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList)
- {
- gList.Add(s.Clone(this.documentWorkspace));
- }
- }
- else
- {
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].GraphicsList.Count; i++)
- {
- var obj = this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].GraphicsList[i].Clone(this.documentWorkspace);
- gList.Add(obj);
- }
- }
- var b = appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].GraphicsList == this.documentWorkspace.GraphicsList;
- binaryClass.listView1_SelectedIndexChanged(this.imageMat.Clone(), this.imageList_img.Images.Keys[selectPicture]);
- this.documentWorkspace.GraphicsList = gList;
- getViewMethod();
- bClassBinaryImplFinishAction(sender, e);
- this.documentWorkspace.Refresh();
- firstChoose += 1;
- this.ImgName = this.lstView_img.FocusedItem.Name;
- getEveryImgData();
- }
- else
- {
- this.documentWorkspace.Visible = false;
- }
- }
- #region [二值化相关方法]
- /// <summary>
- /// 添加参数改变的监听
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void GrainSizeDialog_Load(object sender, EventArgs e)
- {
- this.binaryClass.loadParams();
- System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
- if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
- this.startScriptAutomaticAction();
- }
- /// <summary>
- /// 参数改变时,重新处理图像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bClassBinaryImplFinishAction(object sender, EventArgs e)
- {
- this.originalPhaseModels = this.documentWorkspace.phaseModels.Where(m => m.choise == true).ToList();
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- {
- clearAllView();
- getAllView();
- btn_statistics_Click();
- list_add_data();
- }
- else
- {
- clearAllView();
- }
- }
- else
- {
- clearAllView();
- }
- this.documentWorkspace.Refresh();
- }
- public bool bcBinaryChecked()
- {
- if (this.addView && !bc.BinaryChecked)
- {
- this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
- }
- else
- {
- this.documentWorkspace.ActiveTool = DrawToolType.InclusionNoEffect;
- }
- return bc != null && bc.BinaryChecked;
- }
- private bool bcOriginChecked()
- {
- return bc != null && bc.OriginChecked;
- }
- /// <summary>
- /// 显示原图/原图+二值图
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bcOriginCheckedChanged(object sender, EventArgs e)
- {
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- this.documentWorkspace.PhaseModels[0].choise = true;
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- }
- this.originalPhaseModels = this.documentWorkspace.phaseModels.Where(m => m.choise == true).ToList();
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- {
- this.documentItems[this.lstView_img.FocusedItem.Index].isErZhi = true;
- getAllView();
- list_add_data();
- }
- else
- {
- this.documentItems[this.lstView_img.FocusedItem.Index].isErZhi = false;
- clearAllView();
- }
- }
- else
- {
- this.documentItems[this.lstView_img.FocusedItem.Index].isErZhi = false;
- clearAllView();
- }
- this.documentWorkspace.Refresh();
- }
- #endregion [二值化相关方法]
- private void listBox_analysisResult_SelectedIndexChanged(object sender, EventArgs e)
- {
- buildListView_analysisResult();
- }
- private void button_all_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < this.listBox_analysisResult.Items.Count; i++)
- {
- this.listBox_analysisResult.SetItemChecked(i, true);
- }
- buildListView_analysisResult();
- }
- #endregion 事件
- #region 内部方法
- private void buildListBox_analysisResult()
- {
- this.listBox_analysisResult.Items.Clear();
- foreach (var item in analysisResults.Keys)
- {
- this.listBox_analysisResult.Items.Add(new LocalListViewItem(item, item.GetFriendlyName()));
- }
- buildListView_analysisResult();
- }
- private List<ListViewItem> buildAnalysisResults(DocumentWorkspace workspace, AnalysisResult analysisResult)
- {
- List<ListViewItem> listViews = new List<ListViewItem>();
- foreach (var fieldOfView in analysisResult.resultBody.Keys)
- {
- ListViewItem lvi = new ListViewItem();
- lvi.Text = workspace.GetFriendlyName();
- lvi.SubItems.Add(fieldOfView.name);
- foreach (var item in analysisResult.resultBody[fieldOfView])
- {
- try
- {
- int num = 2;
- if (this.domainUpDown_resultPrecision.SelectedIndex != -1)
- {
- num = Convert.ToInt32(this.domainUpDown_resultPrecision.Items[this.domainUpDown_resultPrecision.SelectedIndex]);
- }
- lvi.SubItems.Add(Math.Round(Convert.ToDecimal(item), num).ToString());
- }
- catch (Exception ex)
- {
- lvi.SubItems.Add(item);
- }
- }
- listViews.Add(lvi);
- }
- return listViews;
- }
- private void buildListView_analysisResult()
- {
- List<AnalysisResult> conclusions = new List<AnalysisResult>();
- this.listView_analysisResult.Columns.Clear();
- this.listView_analysisResult.Items.Clear();
- this.listView_analysisResult2.Columns.Clear();
- this.listView_analysisResult2.Items.Clear();
- if (analysisResults.Count == 0)
- {
- return;
- }
- if (this.listBox_analysisResult.CheckedItems.Count == 0)
- {
- return;
- }
- this.listView_analysisResult.BeginUpdate();
- // 构建头
- foreach (var item in analysisResults.First().Value.getResultHead())
- {
- ColumnHeader header = new ColumnHeader();
- header.Text = item;
- header.Width = 150;
- this.listView_analysisResult.Columns.Add(header);
- }
- foreach (var item in this.listBox_analysisResult.CheckedItems)
- {
- DocumentWorkspace workspace = ((LocalListViewItem)item).Value;
- this.listView_analysisResult.Items.AddRange(buildAnalysisResults(workspace, analysisResults[workspace]).ToArray());
- conclusions.Add(analysisResults[workspace]);
- }
- this.listView_analysisResult.EndUpdate();
- if (this.listView_analysisResult.Items.Count > 0)
- {
- this.listView_analysisResult.Items[0].Selected = true;
- }
- // 构建头
- foreach (var item in this.methodOfAssessment.getResultConclusionHead())
- {
- ColumnHeader header = new ColumnHeader();
- header.Text = item;
- header.Width = 150;
- this.listView_analysisResult2.Columns.Add(header);
- }
- ListViewItem lvi = new ListViewItem();
- List<string> strings = this.methodOfAssessment.buildResultConclusion(conclusions, porosityConfig);
- //保留小数点
- try
- {
- int num = 2;
- if (this.domainUpDown_resultPrecision.SelectedIndex != -1)
- {
- num = Convert.ToInt32(this.domainUpDown_resultPrecision.Items[this.domainUpDown_resultPrecision.SelectedIndex]);
- }
- lvi.Text = Math.Round(Convert.ToDecimal(strings[0]), num).ToString();
- }
- catch (Exception ex)
- {
- lvi.Text = strings[0];
- }
- for (int i = 1; i < strings.Count; i++)
- {
- try
- {
- int num = 2;
- if (this.domainUpDown_resultPrecision.SelectedIndex != -1)
- {
- num = Convert.ToInt32(this.domainUpDown_resultPrecision.Items[this.domainUpDown_resultPrecision.SelectedIndex]);
- }
- if (strings[i].Contains("±"))
- {
- strings[i] = strings[i].Replace("±", "");
- lvi.SubItems.Add("±" + Math.Round(Convert.ToDecimal(strings[i]), num).ToString());
- }
- else
- {
- lvi.SubItems.Add(Math.Round(Convert.ToDecimal(strings[i]), num).ToString());
- }
- }
- catch (Exception ex)
- {
- lvi.SubItems.Add(strings[i]);
- }
- }
- this.listView_analysisResult2.Items.Add(lvi);
- this.listView_analysisResult2.EndUpdate();
- }
- private void button_generateReport_Click(object sender, EventArgs e)
- {
- if (this.listView_analysisResult.Items.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noresults.text"));
- return;
- }
- if (this.checkBox_generateReport_opensetting.Checked)
- {
- AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, this.methodOfAssessment.resourcesName);
- if (recombinationRateSetDialog.hasModule)
- {
- recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
- recombinationRateSetDialog.ShowDialog();
- }
- else
- {
- recombinationRateSetDialog = null;
- }
- }
- if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- List<List<List<string>>> sheets = new List<List<List<string>>>();
- sheets.Add(new List<List<string>>());
- List<List<string>> contentList = new List<List<string>>();
- List<string> contentHead = new List<string>();
- contentList.Add(contentHead);
- foreach (ColumnHeader c in this.listView_analysisResult.Columns)
- {
- contentHead.Add(c.Text);
- }
- for (int r = 0; r < this.listView_analysisResult.Items.Count; r++)
- {
- List<string> contentBody = new List<string>();
- for (int c = 0; c < this.listView_analysisResult.Items[r].SubItems.Count; c++)
- {
- contentBody.Add(this.listView_analysisResult.Items[r].SubItems[c].Text);
- }
- contentList.Add(contentBody);
- }
- contentList.Add(new List<string>());
- contentHead = new List<string>();
- contentList.Add(contentHead);
- foreach (ColumnHeader c in this.listView_analysisResult2.Columns)
- {
- contentHead.Add(c.Text);
- }
- for (int r = 0; r < this.listView_analysisResult2.Items.Count; r++)
- {
- List<string> contentBody = new List<string>();
- for (int c = 0; c < this.listView_analysisResult2.Items[r].SubItems.Count; c++)
- {
- contentBody.Add(this.listView_analysisResult2.Items[r].SubItems[c].Text);
- }
- contentList.Add(contentBody);
- }
- sheets.Add(contentList);
- sheets.Add(new List<List<string>>());
- List<Bitmap> bitList = new List<Bitmap>();
- foreach (var item in this.listBox_analysisResult.CheckedItems)
- {
- DocumentWorkspace workspace = ((LocalListViewItem)item).Value;
- double pantographRatio = workspace.GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
- Bitmap originalBit = workspace.CompositionSurface.CreateAliasedBitmap();
- originalBit.Tag = pantographRatio;
- Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
- newBit.Tag = pantographRatio;
- Graphics graphics = Graphics.FromImage(newBit);
- foreach (var phase in dict[((LocalListViewItem)item).Display])
- {
- Bitmap processedBit = BitmapConverter.ToBitmap(phase.mat);
- graphics.DrawImage(processedBit, new PointF(0, 0));
- }
- bitList.Add(originalBit);
- bitList.Add(newBit);
- }
- try
- {
- this.appWorkspace.CreateAnalysisReportInclusion(this.analyzeSettingModel, sheets, bitList, tagInfos);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");
- }
- private void button_exportResults_Click(object sender, EventArgs e)
- {
- if (this.listView_analysisResult.Items.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noresults.text"));
- return;
- }
- try
- {
- SaveFileDialog exe = new SaveFileDialog();
- exe.Filter = "Execl files (*.xlsx)|*.xlsx";
- exe.FilterIndex = 0;
- exe.RestoreDirectory = true;
- exe.Title = "Export Excel File";
- exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- exe.FileName = DateTime.Now.ToString("yyyyMMddHHmmss") + this.methodOfAssessment.fileName;
- DialogResult dr = exe.ShowDialog();
- if (dr != DialogResult.OK)
- {
- return;
- }
- DataTable dtb = new DataTable();
- foreach (ColumnHeader c in this.listView_analysisResult.Columns)
- {
- dtb.Columns.Add(c.Text);
- }
- for (int r = 0; r < this.listView_analysisResult.Items.Count; r++)
- {
- DataRow dataRow = dtb.NewRow();
- for (int c = 0; c < this.listView_analysisResult.Items[r].SubItems.Count; c++)
- {
- dataRow[c] = this.listView_analysisResult.Items[r].SubItems[c].Text;
- }
- dtb.Rows.Add(dataRow);
- }
- DataTable dtb1 = new DataTable();
- foreach (ColumnHeader c in this.listView_analysisResult2.Columns)
- {
- dtb1.Columns.Add(c.Text);
- }
- for (int r = 0; r < this.listView_analysisResult2.Items.Count; r++)
- {
- DataRow dataRow = dtb1.NewRow();
- for (int c = 0; c < this.listView_analysisResult2.Items[r].SubItems.Count; c++)
- {
- dataRow[c] = this.listView_analysisResult2.Items[r].SubItems[c].Text;
- }
- dtb1.Rows.Add(dataRow);
- }
- List<DataTable> list = new List<DataTable>();
- list.Add(dtb);
- list.Add(dtb1);
- this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>
- /// 初始化参数配置下拉
- /// </summary>
- public void InitParameterList(int index = 0)
- {
- List<string> fileNames = FileOperationHelper.GetFileList(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryExtraction\\");
- files.Clear();
- foreach (string fileName in fileNames)
- {
- string name = fileName.Substring(0, fileName.LastIndexOf("."));
- files.Add(name);
- }
- string nowModelName = Startup.instance.configModel.BinaryParameter.Substring(0, Startup.instance.configModel.Watermark.LastIndexOf("."));
- this.binaryExtractionModel = XmlSerializeHelper.DESerializer<BinaryExtractionModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryExtraction\\Default.xml", FileMode.Open));/*" + this.comboBox1.SelectedItem.ToString() + "*///##############
- }
- #endregion 内部方法
- #region 需继承方法
- protected virtual void getAllView()
- {
- //throw new NotImplementedException();
- }
- protected virtual void SubclassInitialize()
- {
- //throw new NotImplementedException();
- }
- protected virtual MethodOfAssessment getMethodOfAssessment()
- {
- throw new NotImplementedException();
- }
- protected virtual void initColorSetting()
- {
- //throw new NotImplementedException();
- }
- protected virtual void initDisplaySetting()
- {
- //throw new NotImplementedException();
- }
- protected virtual void clearAllView()
- {
- //throw new NotImplementedException();
- }
- protected virtual void list_add_data()
- {
- //throw new NotImplementedException();
- }
- protected virtual void save_normal_data()
- {
- //throw new NotImplementedException();
- }
- protected virtual void toView()
- {
- //throw new NotImplementedException();
- }
- protected virtual void clearOneView()
- {
- }
- protected virtual void changeOneViewColor()
- {
- }
- protected virtual void getArgsValue()
- {
- }
- protected virtual void setArgsValue()
- {
- }
- protected virtual void getEveryImgData()
- {
- }
- protected virtual void saveEveryImgData()
- {
- }
- protected virtual void recalculate()
- {
- if (this.firstChoose != 0)
- {
- btn_statistics_Click();
- if (analysisResults.ContainsKey(this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index]))
- {
- analysisResults[this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index]] = this.tempAnalysisResult;
- }
- else
- {
- analysisResults.Add(this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index], this.tempAnalysisResult);
- }
- buildListView_analysisResult();
- }
- }
- #endregion 需继承方法
- #region 内部类
- internal class LocalListViewItem
- {
- public DocumentWorkspace Value { get; }
- public string Display { get; }
- public LocalListViewItem(DocumentWorkspace Value, string Display)
- {
- this.Value = Value;
- this.Display = Display;
- }
- }
- internal class DocumentItem
- {
- public Mat imageMat;
- public GraphicsList graphicsList;
- public List<PhaseModel> phaseModels;
- public bool isErZhi = false;
- public List<PhaseModel> originalPhaseModels;
- public List<DrawObject> drawGraphicsList = new List<DrawObject>();
- public DocumentItem(Mat imageMat, GraphicsList graphicsList, List<PhaseModel> phaseModels, List<PhaseModel> originalPhaseModels)
- {
- this.imageMat = imageMat;
- this.graphicsList = graphicsList;
- this.phaseModels = phaseModels;
- this.originalPhaseModels = originalPhaseModels;
- }
- }
- #endregion 内部类
- private void domainUpDown_resultPrecision_SelectedItemChanged(object sender, EventArgs e)
- {
- buildListView_analysisResult();
- clearAllView();
- getAllView();
- list_add_data();
- }
- private void button_remove_Click(object sender, EventArgs e)
- {
- if (this.listBox_analysisResult.Items.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noresultsatmeasuring.text"));
- return;
- }
- if (MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeleteth.text") + "?", "", MessageBoxButtons.OKCancel) == DialogResult.OK)
- {
- if (this.listBox_analysisResult.CheckedItems.Count == 0)
- {
- return;
- }
- foreach (var item in this.listBox_analysisResult.CheckedItems)
- {
- this.analysisResults.Remove(((LocalListViewItem)item).Value);
- }
- buildListBox_analysisResult();
- }
- }
- /// <summary>
- /// 识别
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btn_statistics_Click()
- {
- ProgressThreadProcClass procClass = new ProgressThreadProcClass();
- int itemCount = 100;
- ProgressThreadProcClass.IFileTransferProgressEvents progressEvents = new ProgressThreadProcClass.IFileTransferProgressEvents();
- System.Threading.ThreadStart copyThreadProc =
- delegate ()
- {
- if (this.lstView_img.FocusedItem == null || !this.lstView_img.FocusedItem.Selected)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text"));
- return;
- }
- if (this.documentWorkspace.PhaseModels[0].mat == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformabinaryoperationfirst.text"));
- return;
- }
- Mat mat = this.documentWorkspace.PhaseModels[0].mat.Clone();
- for (int i = 0; i < mat.Height; i++)
- {
- for (int j = 0; j < mat.Width; j++)
- {
- if (mat.At<int>(i, j) == 0)
- {
- mat.Set<Vec3b>(i, j, new Vec3b(255, 255, 255));
- }
- }
- }
- #region [获取参数]
- string filePath = Application.StartupPath + "\\PorosityConfig\\6093Config.xml";
- try
- {
- porosityConfig = XmlSerializeHelper.DESerializer<PorosityConfig>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
- }
- catch (Exception ex)
- {
- porosityConfig.diameterType = 1;
- porosityConfig.distanceFactor = 1;
- porosityConfig.maxDiameter = 1;
- porosityConfig.maxPorosityNum = 1;
- porosityConfig.maxPorosityPercent = 1;
- porosityConfig.minDiameter = 1;
- porosityConfig.roughSurface = 1;
- porosityConfig.stressType = "D";
- porosityConfig.diameter = false;
- porosityConfig.minDistanceA = false;
- porosityConfig.minDiameterU = false;
- porosityConfig.surfaceRz = false;
- if (!Directory.Exists(filePath))
- {
- string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityConfig>(porosityConfig);
- Directory.CreateDirectory(Application.StartupPath + "\\PorosityConfig\\");
- FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
- }
- }
- #endregion [获取参数]
- Bitmap bitmap = this.appWorkspace.ActiveDocumentWorkspace.GetCutSizeWithColorWhiteOrTransparentColor(false);
- Mat oldMat = PaintDotNet.Camera.Tools.ToMat(bitmap);
- bool isOne = true;
- if (this.documentWorkspace.GraphicsList.IsExsitView())
- {
- isOne = false;
- }
- for (int i = 0; i < this.originalPhaseModels.Count; i++)
- {
- PhaseModel pModel = this.originalPhaseModels[i];
- if (pModel.mat == null)
- {
- pModel.mat = this.documentWorkspace.phaseModels[i].mat;
- }
- }
- this.rectangleF.Clear();
- this.rectangleTypeList.Clear();
- for (int i = 0; i < this.documentWorkspace.GraphicsList.Count; i++)
- {
- this.rectangleF.Add(this.documentWorkspace.GraphicsList[i].Rectangle);
- this.rectangleTypeList.Add(this.documentWorkspace.GraphicsList[i].drawToolType);
- }
- //识别
- this.tempAnalysisResult = this.methodOfAssessment.generateReport(this.imageMat.Clone(), mat, oldMat, rectangleF, rectangleTypeList, this.originalPhaseModels, porosityConfig, isOne);
- progressEvents.EndOperation(OperationResult.Finished);
- };
- procClass.StartProgressAction(this, itemCount, copyThreadProc, progressEvents, null);
- }
- private void button1_Click(object sender, EventArgs e)
- {
- if (this.listView_analysisResult.Items.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noresults.text"));
- return;
- }
- if (this.analyzeSettingModel == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesetiirst.Text"));
- return;
- }
- int num = 2;
- if (this.domainUpDown_resultPrecision.SelectedIndex != -1)
- {
- num = Convert.ToInt32(this.domainUpDown_resultPrecision.Items[this.domainUpDown_resultPrecision.SelectedIndex]);
- }
- //获取项目工程内的文件夹路径
- ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.NonferrousMetal.Porosity.Text", this.analyzeSettingModel.savePath);
- if (item != null)
- {
- //向文件夹内保存图片和报告
- if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- List<List<string>> contentList = new List<List<string>>();
- List<string> contentHead = new List<string>();
- contentList.Add(contentHead);
- foreach (ColumnHeader c in this.listView_analysisResult.Columns)
- {
- contentHead.Add(c.Text);
- }
- for (int r = 0; r < this.listView_analysisResult.Items.Count; r++)
- {
- List<string> contentBody = new List<string>();
- for (int c = 0; c < this.listView_analysisResult.Items[r].SubItems.Count; c++)
- {
- contentBody.Add(this.listView_analysisResult.Items[r].SubItems[c].Text);
- }
- contentList.Add(contentBody);
- }
- contentList.Add(new List<string>());
- contentHead = new List<string>();
- contentList.Add(contentHead);
- foreach (ColumnHeader c in this.listView_analysisResult2.Columns)
- {
- contentHead.Add(c.Text);
- }
- for (int r = 0; r < this.listView_analysisResult2.Items.Count; r++)
- {
- List<string> contentBody = new List<string>();
- for (int c = 0; c < this.listView_analysisResult2.Items[r].SubItems.Count; c++)
- {
- contentBody.Add(this.listView_analysisResult2.Items[r].SubItems[c].Text);
- }
- contentList.Add(contentBody);
- }
- List<List<string>> inclusionList = new List<List<string>>();
- List<Bitmap> bitList = new List<Bitmap>();
- List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
- foreach (var itemIt in this.listBox_analysisResult.CheckedItems)
- {
- List<List<string>> dataList = new List<List<string>>();
- List<string> inclusionHead = new List<string>();
- inclusionHead.Add(PdnResources.GetString("Menu.Pixellength.text"));
- inclusionHead.Add(PdnResources.GetString("Menu.Pixelwidth.Text"));
- inclusionHead.Add(PdnResources.GetString("Menu.hectuallength.Text"));
- inclusionHead.Add(PdnResources.GetString("Menu.Theactualwidthofthe.Text"));
- dataList.Add(inclusionHead);
- DocumentWorkspace workspace = ((LocalListViewItem)itemIt).Value;
- double pantographRatio = workspace.GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
- Bitmap originalBit = workspace.CompositionSurface.CreateAliasedBitmap();
- originalBit.Tag = pantographRatio;
- Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
- newBit.Tag = pantographRatio;
- Graphics graphics = Graphics.FromImage(newBit);
- foreach (var phase in dict[((LocalListViewItem)itemIt).Display])
- {
- Bitmap processedBit = BitmapConverter.ToBitmap(phase.mat);
- graphics.DrawImage(processedBit, new PointF(0, 0));
- }
- bitList.Add(originalBit);
- bitList.Add(newBit);
- foreach (var inclusion in analysisResults[workspace].porositys)
- {
- List<string> inclusionBody = new List<string>();
- inclusionBody.Add(Math.Round(inclusion.pixelLength, num) + "");
- inclusionBody.Add(Math.Round(inclusion.pixelWidth, num) + "");
- inclusionBody.Add(Math.Round(inclusion.physicalLength, num) + "");
- inclusionBody.Add(Math.Round(inclusion.physicalWidth, num) + "");
- dataList.Add(inclusionBody);
- }
- ExportProjectModel exportProjectModel = new ExportProjectModel();
- exportProjectModel.dataList = dataList;
- exportProjectModel.picName = ((LocalListViewItem)itemIt).Display;
- exportProjectModel.tagName = PdnResources.GetString("Menu.pore.Text");
- exportModel.Add(exportProjectModel);
- }
- try
- {
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, contentList, exportModel, bitList, tagInfos, item.path, item.code);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");
- return;
- }
- //保存项目信息到数据库
- this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
- }
- }
- /// <summary>
- /// 不可点击空白区域
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void lstView_img_MouseUp(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Left)
- {
- if (lstView_img.SelectedItems.Count > 0)
- {
- }
- else if (lstView_img.SelectedItems.Count <= 0)//点击空白区
- {
- if (this.lstView_img.FocusedItem != null)
- {
- ListViewItem item = this.lstView_img.GetItemAt(e.X, e.Y);
- if (item == null)
- {
- this.lstView_img.FocusedItem.Selected = true;
- }
- }
- }
- }
- }
- #region [跳转视场设置相关方法]
- #region [初始方法]
- private void getViewMethod()
- {
- var drawObjectList = new List<DrawObject>();
- // 找出正方形视场
- for (int i = this.documentWorkspace.GraphicsList.Count - 1; i >= 0; i--)
- {
- if (this.documentWorkspace.GraphicsList[i].objectType == DrawClass.View)
- {
- //this.rectangleF.Add(this.documentWorkspace.GraphicsList[i].Rectangle);
- this.rectangleTypeList.Add(this.documentWorkspace.GraphicsList[i].drawToolType);
- drawObjectList.Add(this.documentWorkspace.GraphicsList[i]);
- this.nameList.Add(PdnResources.GetString("Menu.view.text") + $"{i + 1}");
- }
- }
- drawObjectList.Reverse();
- this.nameList.Reverse();
- //this.rectangleF.Reverse();
- this.rectangleTypeList.Reverse();
- foreach (var s in drawObjectList)
- {
- s.Color = retrunColor(drawObjectList.IndexOf(s));
- }
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList = drawObjectList;
- this.documentWorkspace.panel.Paint += Panel_Paint;
- }
- private void InitViewData()
- {
- var list = mic_view_infos_BLL.FindAll();
- if (list != null && list.Count > 0)
- {
- foreach (var s in list)
- {
- ViewListModel model = XmlSerializeHelper.DESerializer<ViewListModel>(s.view_xml);
- foreach (var m in model.Views)
- {
- if (model.Views.Count == 1)
- {
- this.comboBox2.Items.Add($"{s.view_name}");
- }
- else
- {
- this.comboBox2.Items.Add($"{s.view_name}-{model.Views.IndexOf(m) + 1}");
- }
- this.modelList.Add(m);
- }
- }
- }
- }
- #endregion
- private void getViewSetting()
- {
- string filePath = Application.StartupPath + "\\PorosityConfig\\ViewConfig.xml";
- try
- {
- ViewSetting = XmlSerializeHelper.DESerializer<viewSetting>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
- }
- catch (Exception ex)
- {
- ViewSetting = new viewSetting();
- ViewSetting.colorFirst = Color.Red.ToArgb();
- ViewSetting.colorSecond = Color.Yellow.ToArgb();
- ViewSetting.colorThird = Color.Green.ToArgb();
- ViewSetting.colorFourth = Color.Blue.ToArgb();
- ViewSetting.colorFifth = Color.MediumVioletRed.ToArgb();
- ViewSetting.colorSixth = Color.Magenta.ToArgb();
- ViewSetting.colorSeventh = Color.DarkViolet.ToArgb();
- ViewSetting.colorEighth = Color.LightSkyBlue.ToArgb();
- ViewSetting.colorNinth = Color.Cyan.ToArgb();
- ViewSetting.colorTenth = Color.SeaGreen.ToArgb();
- ViewSetting.colorEleventh = Color.DarkOrange.ToArgb();
- ViewSetting.colorTwelfth = Color.Sienna.ToArgb();
- if (!Directory.Exists(filePath))
- {
- string porosityInfoXml = XmlSerializeHelper.XmlSerialize<viewSetting>(ViewSetting);
- Directory.CreateDirectory(Application.StartupPath + "\\PorosityConfig\\");
- FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
- }
- }
- }
- private void button3_Click(object sender, EventArgs e)
- {
- //是否需要二值化
- if (this.lstView_img.FocusedItem == null || !this.lstView_img.FocusedItem.Selected)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text"));
- return;
- }
- double pxPerUnit = this.imgPxPerUnit;
- if (this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList == null || this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.ewbeforesettingfieldofview.Text"));
- return;
- }
- if (bcBinaryChecked())
- {
- MessageBox.Show("请取消二值化后再进行视场设置!");
- return;
- }
- foreach (var s in this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList)
- {
- var g = s.Clone();
- this.oldDrawList.Add(g);
- }
- new PorosityViewSetting(this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList, this.nameList, -1, ViewSetting, this, pxPerUnit).ShowDialog();
- }
- /// <summary>
- /// 清空视场
- /// </summary>
- public void clearView()
- {
- this.documentWorkspace.GraphicsList.DeleteAllView();
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList = new List<DrawObject>();
- this.oldDrawList.Clear();
- //this.pointFDic.Clear();
- this.nameList.Clear();
- this.bc.BinaryChecked = false;
- //this.rectangleF.Clear();
- this.rectangleTypeList.Clear();
- clearAllView();
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 删除视场
- /// </summary>
- public void clearOneView(int id, int index)
- {
- this.documentWorkspace.GraphicsList.RemoveByIds(new List<int>() { id });
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.RemoveAt(index);
- this.delIndex = index;
- this.nameList.RemoveAt(index);
- //this.rectangleF.RemoveAt(index);
- this.rectangleTypeList.RemoveAt(index);
- clearOneView();
- //this.pointFDic.Clear();
- //for (int i = 0; i < this.documentWorkspace.GraphicsList.Count; i++)
- //{
- // this.pointFDic.Add(i, this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[i].GetPoints().ToArray());
- //}
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 视场颜色高亮
- /// </summary>
- public void colorHighlight(int index)
- {
- this.chooseGrIndex = index;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 修改视场颜色
- /// </summary>
- public void changeThisColor(int index, int color)
- {
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Color = Color.FromArgb(color);
- this.delIndex = index;
- changeOneViewColor();
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 修改视场
- /// </summary>
- public void editView()
- {
- this.oldDrawList.Clear();
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 没有保存 返回之前的颜色
- /// </summary>
- public void returnOldColor()
- {
- foreach (var s in this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList)
- {
- var graphics = this.oldDrawList.Where(m => m.ID == s.ID).FirstOrDefault();
- if (graphics == null)
- {
- continue;
- }
- s.Color = graphics.Color;
- }
- this.oldDrawList.Clear();
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 修改中心点x坐标的事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public void numericUpDown3_ValueChange(int id, int index, int newValue, int oldValue)
- {
- if (this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index] != null && !this.appWorkspace.ActiveDocumentWorkspace.mouseStatus)
- {
- int deltaX = newValue - oldValue;
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Move(deltaX, 0);
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Normalize();
- //pointFDic[index] = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].GetPoints().ToArray();
- this.documentWorkspace.Refresh();
- }
- }
- /// <summary>
- /// 修改中心点y坐标的事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public void numericupdown4_valuechange(int id, int index, int newValue, int oldValue)
- {
- if (this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index] != null && !this.appWorkspace.ActiveDocumentWorkspace.mouseStatus)
- {
- int deltay = newValue - oldValue;
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Move(0, deltay);
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Normalize();
- //pointFDic[index] = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].GetPoints().ToArray();
- this.documentWorkspace.Refresh();
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public DrawObject numericUpDown5_ValueChange(int id, int index, int value)
- {
- double pxPerUnit = this.imgPxPerUnit;
- if (this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index] != null && !this.appWorkspace.ActiveDocumentWorkspace.mouseStatus)
- {
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Width = (int)(double.Parse(value.ToString()) / pxPerUnit);
- //if (this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].drawToolType == DrawToolType.ViewTriangle)
- //{
- // this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].endPoint.Y = (float)(this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].startPoint.Y + value / pxPerUnit);
- // this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].MoveHandleTo(new System.Drawing.Point((int)this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].endPoint.X, (int)this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].endPoint.Y), 2);
- // //this.pointFDic[index] = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].GetPoints().ToArray();
- //}
- //else
- if (this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].drawToolType == DrawToolType.ViewSquare || this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].drawToolType == DrawToolType.ViewCircle)
- {
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Height = (int)(double.Parse(value.ToString()) / pxPerUnit);
- }
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Normalize();
- var obj = this.documentWorkspace.GraphicsList.GetById(id);
- if (obj != null)
- {
- obj.Width = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Rectangle.Width;
- obj.Height = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Rectangle.Height;
- obj.Normalize();
- }
- //this.rectangleF[index] = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Rectangle;
- this.documentWorkspace.Refresh();
- return this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index];
- }
- return null;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public DrawObject numericUpDown6_ValueChange(int id, int index, int value)
- {
- double pxPerUnit = this.imgPxPerUnit;
- if (this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index] != null && !this.appWorkspace.ActiveDocumentWorkspace.mouseStatus)
- {
- var type = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].drawToolType;
- switch (type)
- {
- case DrawToolType.ViewOval:
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Height = (int)(double.Parse(value.ToString()) / pxPerUnit);
- break;
- case DrawToolType.ViewCircle:
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Width = ((float)Math.Pow((value / Math.PI), 0.5)) * 2;
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Height = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Width;
- break;
- case DrawToolType.ViewRectangle:
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Height = (int)(double.Parse(value.ToString()) / pxPerUnit);
- break;
- case DrawToolType.ViewTriangle:
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Height = (int)(double.Parse(value.ToString()) / pxPerUnit);
- break;
- case DrawToolType.ViewSquare:
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Height = (float)(Math.Sqrt(value) / pxPerUnit);
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Width = (float)(Math.Sqrt(value) / pxPerUnit);
- break;
- case DrawToolType.ViewPolygon:
- case DrawToolType.ViewTriangleEx:
- case DrawToolType.ViewRectangleEx:
- break;
- }
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Normalize();
- var obj = this.documentWorkspace.GraphicsList.GetById(id);
- if (obj != null)
- {
- obj.Width = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Rectangle.Width;
- obj.Height = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Rectangle.Height;
- obj.Normalize();
- }
- //this.rectangleF[index] = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index].Rectangle;
- this.documentWorkspace.Refresh();
- return this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList[index];
- }
- return null;
- }
- private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.chooseIndex = this.comboBox2.SelectedIndex;
- }
- private void Panel_Click(object sender, MouseEventArgs e)
- {
- if (this.chooseIndex == -1)
- {
- return;
- }
- if (this.addView)
- {
- return;
- }
- if (bcBinaryChecked())
- {
- MessageBox.Show("请取消二值化后再添加!");
- return;
- }
- var name = this.comboBox2.SelectedItem.ToString();
- try
- {
- var model = this.modelList[this.chooseIndex];
- if (e.Button == MouseButtons.Left)
- {
- System.Drawing.Point loc = this.documentWorkspace.GetScalePoint(new PointF(e.X, e.Y));
- DrawToolType type = (DrawToolType)Enum.Parse(typeof(DrawToolType), model.Type);
- ViewBase line = null;
- List<PointF> pointFList = new List<PointF>();
- foreach (var s in model.Points)
- {
- if (model.Points.IndexOf(s) == 0)
- {
- pointFList.Add(new PointF(loc.X, loc.Y));
- continue;
- }
- var xDifference = model.Points[0].X - s.X;
- var yDifference = model.Points[0].Y - s.Y;
- pointFList.Add(new PointF(loc.X - xDifference, loc.Y - yDifference));
- }
- switch (type)
- {
- case DrawToolType.ViewOval:
- line = new ViewOval(pointFList);
- break;
- case DrawToolType.ViewCircle:
- line = new ViewCircle(pointFList);
- break;
- case DrawToolType.ViewRectangle:
- line = new ViewRectangle(pointFList);
- break;
- case DrawToolType.ViewTriangle:
- line = new ViewTriangle(pointFList);
- break;
- case DrawToolType.ViewSquare:
- line = new ViewSquare(pointFList);
- break;
- case DrawToolType.ViewPolygon:
- case DrawToolType.ViewTriangleEx:
- line = new ViewPolygon(pointFList);
- break;
- case DrawToolType.ViewRectangleEx:
- line = new ViewRectangleEx(pointFList);
- break;
- }
- if (line != null)
- {
- line.ISurfaceBox = documentWorkspace;
- line.combineMode = (CombineMode)Enum.Parse(typeof(CombineMode), model.CombineMode);
- line.Selected = true;
- line.Color = retrunColor(this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.Count);
- //pointFDic.Add(this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.Count, pointFList.ToArray());
- this.oldDrawList.Add(line);
- nameList.Add($"{PdnResources.GetString("Menu.view.text") }{nameList.Count()}");
- this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.Insert(0, line);
- documentWorkspace.AddGraphicsFromForm(line);
- //this.rectangleF.Add(line.Rectangle);
- this.rectangleTypeList.Add(line.drawToolType);
- if (this.bcBinaryChecked())
- {
- clearAllView();
- btn_statistics_Click();
- getAllView();
- list_add_data();
- }
- }
- }
- else
- {
- this.comboBox2.SelectedIndex = -1;
- this.chooseIndex = -1;
- }
- }
- catch (Exception ex)
- {
- }
- }
- private void Panel_Paint(object sender, PaintEventArgs e)
- {
- Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
- int wid = this.documentWorkspace.CompositionSurface == null ? this.documentWorkspace.Width : this.documentWorkspace.CompositionSurface.Width;
- int hei = this.documentWorkspace.CompositionSurface == null ? this.documentWorkspace.Height : this.documentWorkspace.CompositionSurface.Height;
- int width = (int)(wid * this.documentWorkspace.ScaleFactor.Ratio);
- int height = (int)(hei * this.documentWorkspace.ScaleFactor.Ratio);
- int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X + offsetHalfW : (rc.Width - width) / 2;
- int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y + offsetHalfH : (rc.Height - height) / 2;
- e.Graphics.TranslateTransform(x, y);
- e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
- foreach (var s in this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList)
- {
- var jiacu = this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.IndexOf(s) == chooseGrIndex ? 10 : 5;
- var pen = new Pen(s.Color, jiacu);
- switch (s.drawToolType)
- {
- case DrawToolType.ViewOval:
- case DrawToolType.ViewCircle:
- if (this.documentWorkspace.GraphicsList[this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.IndexOf(s)] != null)
- {
- e.Graphics.DrawClosedCurve(pen, this.documentWorkspace.GraphicsList[this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.IndexOf(s)].pointArrayList.ToArray());
- }
- break;
- case DrawToolType.ViewSquare:
- case DrawToolType.ViewRectangle:
- if (this.documentWorkspace.GraphicsList[this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.IndexOf(s)] != null)
- {
- var rectangle = this.documentWorkspace.GraphicsList[this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.IndexOf(s)].Rectangle;
- e.Graphics.DrawRectangle(pen, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
- }
- break;
- case DrawToolType.ViewRectangleEx:
- case DrawToolType.ViewPolygon:
- case DrawToolType.ViewTriangle:
- case DrawToolType.ViewTriangleEx:
- if (this.documentWorkspace.GraphicsList[this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.IndexOf(s)] != null)
- {
- var pointF = this.documentWorkspace.GraphicsList[this.documentItems[this.lstView_img.FocusedItem.Index].drawGraphicsList.IndexOf(s)].pointArrayList.ToArray();
- if (pointF != null && pointF.Count() > 1)
- {
- e.Graphics.DrawPolygon(pen, pointF);
- }
- }
- break;
- }
- }
- e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
- e.Graphics.TranslateTransform(-x, -y);
- }
- private Color retrunColor(int index)
- {
- switch ((index + 1) % 12)
- {
- case 1:
- return Color.FromArgb(ViewSetting.colorFirst);
- case 2:
- return Color.FromArgb(ViewSetting.colorSecond);
- case 3:
- return Color.FromArgb(ViewSetting.colorThird);
- case 4:
- return Color.FromArgb(ViewSetting.colorFourth);
- case 5:
- return Color.FromArgb(ViewSetting.colorFifth);
- case 6:
- return Color.FromArgb(ViewSetting.colorSixth);
- case 7:
- return Color.FromArgb(ViewSetting.colorSeventh);
- case 8:
- return Color.FromArgb(ViewSetting.colorEighth);
- case 9:
- return Color.FromArgb(ViewSetting.colorNinth);
- case 10:
- return Color.FromArgb(ViewSetting.colorTenth);
- case 11:
- return Color.FromArgb(ViewSetting.colorEleventh);
- case 12:
- return Color.FromArgb(ViewSetting.colorTwelfth);
- }
- return Color.FromArgb(ViewSetting.colorFirst);
- }
- #endregion [跳转视场设置相关方法]
- private void button2_Click(object sender, EventArgs e)
- {
- if (bcBinaryChecked())
- {
- MessageBox.Show("请取消二值化后再拖动视场或者添加视场!");
- return;
- }
- this.addView = !this.addView;
- if (!this.addView)
- {
- this.button2.Text = "取消添加视场";
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.InclusionNoEffect;
- }
- else
- {
- this.button2.Text = "添加视场";
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
- }
- }
- private void getLastData()
- {
- string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterPorosityModel.xml";
- var text = this.dialogText;
- if (!System.IO.File.Exists(filePath))
- {
- porosityModel.PorosityParameters = new List<PorosityModel.PorosityParameter>();
- string[] textList = new string[] { "PV6093", "VW50093", "VDGP202", "GBT37787" };
- for (int i = 0; i < textList.Count(); i++)
- {
- var porosityParameters = new PorosityModel.PorosityParameter();
- porosityParameters.hasUsed = false;
- porosityParameters.name = textList[i];
- porosityModel.PorosityParameters.Add(porosityParameters);
- }
- this.thisParametersIndex = textList.ToList().IndexOf(text);
- this.thisParameters = porosityModel.PorosityParameters[this.thisParametersIndex];
- string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityModel>(porosityModel);
- Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
- FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
- }
- else
- {
- porosityModel = XmlSerializeHelper.DESerializer<PorosityModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
- if (porosityModel.PorosityParameters == null)
- {
- porosityModel.PorosityParameters = new List<PorosityModel.PorosityParameter>();
- }
- thisParameters = porosityModel.PorosityParameters.Where(m => m.name.Equals(text)).FirstOrDefault();
- if (thisParameters == null)
- {
- thisParameters = new PorosityModel.PorosityParameter();
- thisParameters.hasUsed = false;
- thisParameters.name = text;
- porosityModel.PorosityParameters.Add(thisParameters);
- this.thisParametersIndex = porosityModel.PorosityParameters.Count() - 1;
- string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityModel>(porosityModel);
- Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
- FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
- }
- else
- {
- this.thisParametersIndex = porosityModel.PorosityParameters.IndexOf(thisParameters);
- if (thisParameters.hasUsed)
- {
- checkBox_generateReport_opensetting.Checked = thisParameters.parameter1;
- domainUpDown_resultPrecision.SelectedIndex = thisParameters.parameter2;
- }
- }
- }
- }
- private void saveLastData(object sender, EventArgs e)
- {
- #region [开启脚本录制]
- if (appWorkspace.startScriptRecording)
- {
- getScriptRecording();
- }
- #endregion
- binaryClass.saveParams();
- if (this.thisParametersIndex == -1)
- {
- return;
- }
- this.thisParameters.hasUsed = true;
- thisParameters.parameter1 = checkBox_generateReport_opensetting.Checked;
- thisParameters.parameter2 = domainUpDown_resultPrecision.SelectedIndex;
- this.porosityModel.PorosityParameters[this.thisParametersIndex] = this.thisParameters;
- string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterPorosityModel.xml";
- string porosityInfoXml = XmlSerializeHelper.XmlSerialize<PorosityModel>(porosityModel);
- Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
- FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
- }
- /// <summary>
- /// 应用全部
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- if (this.lstView_img.FocusedItem == null)
- {
- return;
- }
- binaryClass.saveParams();
- binaryClass.applyToAll(this.imageList_img.Images.Keys, this.imageList_img.Images.Keys[this.lstView_img.FocusedItem.Index]);
- userAll = true;
- resultList.Clear();
- hasResultIndexList.Clear();
- analysisResults.Clear();
- //var data = new CurrentPageData();
- var firstIndex = this.lstView_img.FocusedItem.Index;
- //if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
- //{
- // data = everyImgData[this.lstView_img.FocusedItem.Index];
- //}
- nodata = true;
- for (int i = 0; i < lstView_img.Items.Count; i++)
- {
- this.lstView_img.Items[i].EnsureVisible();
- this.lstView_img.Items[i].Focused = true;
- this.lstView_img.Items[i].Selected = true;
- this.btn_saveresult_Click(sender, e);
- }
- nodata = false;
- }
- /// <summary>
- /// 保存全部
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button5_Click(object sender, EventArgs e)
- {
- if (this.lstView_img.FocusedItem == null)
- {
- return;
- }
- if (!userAll)
- {
- MessageBox.Show("请先点击应用全部");
- return;
- }
- if (resultList.Count() == 0)
- {
- MessageBox.Show("无结果数据!");
- return;
- }
- if (listBox_analysisResult.Items.Count > 0)
- {
- if (MessageBox.Show(PdnResources.GetString("Menu.Theresuethertoreplace.text") + "?", "", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- {
- for (int i = 0; i < resultList.Count(); i++)
- {
- if (analysisResults.ContainsKey(this.appWorkspace.DocumentWorkspaces[i]))
- {
- continue;
- }
- else
- {
- analysisResults.Add(this.appWorkspace.DocumentWorkspaces[i], resultList[i]);
- }
- buildListBox_analysisResult();
- }
- return;
- }
- }
- for (int i = 0; i < resultList.Count(); i++)
- {
- if (analysisResults.ContainsKey(this.appWorkspace.DocumentWorkspaces[i]))
- {
- analysisResults[this.appWorkspace.DocumentWorkspaces[i]] = resultList[i];
- }
- else
- {
- analysisResults.Add(this.appWorkspace.DocumentWorkspaces[i], resultList[i]);
- }
- buildListBox_analysisResult();
- }
- for (int i = 0; i < listBox_analysisResult.Items.Count; i++)
- {
- listBox_analysisResult.SetItemChecked(i, true);
- }
- buildListView_analysisResult();
- }
- private void getValue(string key, object value)
- {
- switch (key)
- {
- case "OpenWhileExportReport":
- checkBox_generateReport_opensetting.Checked = Convert.ToBoolean(value);
- break;
- case "CalculatorDecimalDigits":
- domainUpDown_resultPrecision.SelectedIndex = (int)value;
- break;
- case "ExportResults":
- isExportResults = Convert.ToBoolean(value);
- break;
- case "ExportReports":
- isExportReports = Convert.ToBoolean(value);
- break;
- case "ExportProjects":
- isExportProjects = Convert.ToBoolean(value);
- break;
- }
- }
- #region [脚本录制]
- private void getScriptRecording()
- {
- string className = InvariantData.path_Action + ".Action" + menuId;
- ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
- List<Args> args = param.Lists;
- foreach (var item in args)
- {
- item.value = setScriptRecording(item.key);
- }
- //找出子类相关参数 进行赋值
- List<Args> oneIsNullList = args.Where(m => m.value == null).ToList();
- foreach (var item in oneIsNullList)
- {
- this.argsKey = item.key;
- this.setArgsValue();
- item.value = this.argsValue;
- }
- //找出二值相关参数 进行赋值
- List<Args> isNullList = args.Where(m => m.value == null).ToList();
- foreach (var item in isNullList)
- {
- item.value = binaryClass.setScriptRecording(item.key);
- }
- appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
- }
- private object setScriptRecording(string key)
- {
- object value = null;
- switch (key)
- {
- case "OpenWhileExportReport":
- value = checkBox_generateReport_opensetting.Checked;
- break;
- case "CalculatorDecimalDigits":
- value = this.domainUpDown_resultPrecision.SelectedItem;
- break;
- case "ExportResults":
- value = isExportResults;
- break;
- case "ExportReports":
- value = isExportReports;
- break;
- case "ExportProjects":
- value = isExportProjects;
- break;
- }
- return value;
- }
- #endregion
- }
- }
|