| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761 |
- using Metis.ParameterSet;
- using OpenCvSharp;
- using OpenCvSharp.Extensions;
- using PaintDotNet;
- using PaintDotNet.Annotation;
- using PaintDotNet.Annotation.DedicatedAnalysis;
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Annotation.FieldView;
- using PaintDotNet.Base.DedicatedAnalysis.Inclusions;
- using PaintDotNet.Base.DedicatedAnalysis.Inclusions.Model;
- using PaintDotNet.Base.DedicatedAnalysis.Inclusions.Standard.DIN50602_1985.TypesOfAssessment;
- using PaintDotNet.Base.Functionodel;
- using PaintDotNet.Base.SettingModel;
- using PaintDotNet.CustomControl;
- using PaintDotNet.DbOpreate.DbBll;
- using PaintDotNet.DbOpreate.DbModel;
- using PaintDotNet.DedicatedAnalysis.Inclusions;
- using PaintDotNet.Instrument;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using static PaintDotNet.Base.DedicatedAnalysis.Inclusions.InclusionsGlobalSettings;
- using static PaintDotNet.Base.DedicatedAnalysis.Inclusions.MethodOfAssessment;
- using static PaintDotNet.DedicatedAnalysis.Inclusions.InclusionsStandardDialog;
- namespace Metis.DedicatedAnalysis.Inclusions.New_DIN50602_1985
- {
- internal partial class MethodKDialog : PdnBaseForm
- {
- private GroupBox groupBox_operating;
- private CheckBox checkBox_generateReport_opensetting;
- private Button btn_clean_result;
- private Button btn_statistics;
- private Button btn_saveresult;
- private Button button4;
- private Button button3;
- private GroupBox groupBox_img;
- private ListView lstView_img;
- private GroupBox groupBox1;
- private GroupBox groupBox2;
- private GroupBox groupBox3;
- private GroupBox groupBox4;
- private Button button_setting;
- private GroupBox groupBox_report;
- private Label label1;
- private Button button1;
- private Label label_resultPrecision;
- private DomainUpDown domainUpDown_resultPrecision;
- private Button button_exportResults;
- private Button button_generateReport;
- private GroupBox groupBox6groupBox_analysisResult2;
- private ListView listView_analysisResult2;
- private ListView listView_analysisResult;
- private GroupBox groupBox_analysisResult1;
- private CheckedListBox listBox_analysisResult;
- private Button button_remove;
- private Button button_all;
- private Label label4;
- private ComboBox comboBox_rollingDirection;
- private Button button2;
- private RadioButton radioButton2;
- private RadioButton radioButton1;
- private CheckBox checkBox2;
- private CheckBox checkBox1;
- private Button button6;
- private Button button5;
- private Panel panel_color2;
- private Panel panel_color1;
- private AutoAnalysis.MeasureRangeControl measureRangeControl1;
- private GroupBox groupBox_review;
- private Label label2;
- private Label label3;
- private TextBox textBox1;
- private ImageList imageList_img;
- private IContainer components;
- //二值化集成1
- private BinaryControl bc;
- #region 属性
- /// <summary>
- /// 主控件
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 公共按钮
- /// </summary>
- private CommonControlButtons commonControlButtons;
- /// <summary>
- /// 图像面板
- /// </summary>
- private DocumentWorkspaceWindow documentWorkspace;
- private Dictionary<int, DocumentItem> documentItems;
- /// <summary>
- /// 当前选择的图片
- /// </summary>
- private Mat imageMat;
- /// <summary>
- /// 初始系统参数配置值
- /// </summary>
- private BinaryExtractionModel binaryExtractionModel = new BinaryExtractionModel();
- /// <summary>
- /// 选择的评定方法
- /// </summary>
- private MethodOfAssessment methodOfAssessment;
- private AnalysisResult tempAnalysisResult;
- private Dictionary<DocumentWorkspace, AnalysisResult> analysisResults = new Dictionary<DocumentWorkspace, AnalysisResult>();
- protected ColorOfInclusions selectedColorOfInclusions;
- protected ColorOfInclusions oldSelectedColorOfInclusions;
- //二值化集成1
- private BinaryClass binaryClass;
- protected int menuId;
- protected string menuName;
- // 选定夹杂物类型
- private bool clearSelect = false;
- private TypesOfInclusions selectedTypesOfInclusions;
- // 选定夹杂物类型 操作 记录点
- private System.Drawing.Point? selectedTypesOfInclusionsPoint = null;
- private System.Drawing.RectangleF? selectedTypesOfInclusionsRectangle = null;
- // 视场边长
- private int viewNum = 710;
- private bool is_showRectangle = false;
- private bool is_showOval = false;
- private int is_full = 1;
- //局部变量
- private bool rbcheck = true;
- protected InclusionsModel inclusionsModel = new InclusionsModel();
- protected InclusionsModel.InclusionParameter thisParameters;
- protected int thisParametersIndex = -1;
- private bool userAll = false;
- private bool firstShow = true;
- protected int whichChecked = 0;
- private int autoJiaoBen = -1;
- private InclusionSetting inclusionSetting = new InclusionSetting();
- private Dictionary<string, List<PhaseModel>> dict = new Dictionary<string, List<PhaseModel>>();
- private bool isExportResults = false;
- private bool isExportReports = false;
- private bool isExportProjects = false;
- /// <summary>
- /// 是否脚本运行
- /// </summary>
- private Boolean initScriptValues = false;
- private int imgIndex = -1;
- private string dialogText;
- protected double imgPxPerUnit;
- private CheckBox checkBox4;
- private CheckBox checkBox3;
- private RectangleF paintRectangle;
- private ColorsForm oneColorsForm;
- private ColorsForm twoColorsForm;
- #endregion
- public MethodKDialog(AppWorkspace appWorkspace, string dialogText, PdnMenuItem menuitem)
- {
- InitializeComponent();
- InitializeComponent2();
- InitializeLanguageText();
- this.appWorkspace = appWorkspace;
- this.Shown += showImg;
- this.Text = dialogText;
- this.dialogText = dialogText;
- this.Icon = PdnInfo.AppIcon;
- this.menuId = menuitem.MenuId;
- this.menuName = menuitem.Text;
- this.binaryClass = new BinaryClass(menuId);
- Initialize();
- //二值化集成2
- bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
- binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.binary.Text"), PdnResources.GetString("Menu.Theinclusioncolomatches.Text") }
- , this.bc, this.appWorkspace, this.documentWorkspace, this.lstView_img);//初始化相的工作结构
- binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
-
- this.bc.checkBox10.Visible = false;
- this.bc.button6.Visible = false;
- this.bc.panel2.Visible = false;
- this.bc.label2.Visible = false;
- this.bc.setInverseStyle(2);
- this.bc.OnInverseClickAction();
- oneColorsForm = new ColorsForm();
- this.oneColorsForm.StartPosition = FormStartPosition.CenterParent;
- twoColorsForm = new ColorsForm();
- this.twoColorsForm.StartPosition = FormStartPosition.CenterParent;
- this.documentWorkspace.panel.Paint += Panel_Paint;
- #region [组织相信息]
- if (this.documentWorkspace.phaseModels.Count > 0)
- {
- PhaseModel phaseModelS = this.documentWorkspace.phaseModels[0];
- phaseModelS.name = "S";
- phaseModelS.color = this.panel_color1.BackColor.ToArgb();
- if (this.documentWorkspace.phaseModels.Count > 1)
- {
- PhaseModel phaseModelO = this.documentWorkspace.phaseModels[1];
- phaseModelO.name = "O";
- phaseModelO.color = this.panel_color2.BackColor.ToArgb();
- }
- else {
- PhaseModel phaseModelO = new PhaseModel();
- phaseModelO.name = "O";
- phaseModelO.color = this.panel_color2.BackColor.ToArgb();
- this.documentWorkspace.phaseModels.Add(phaseModelO);
- }
- }
- #endregion
- //this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.saveLastData);
- }
- private void InitializeLanguageText()
- {
- this.label2.Text = PdnResources.GetString("Menu.view.text");
- this.button4.Text = PdnResources.GetString("Menu.Applyall.text");
- this.button3.Text = PdnResources.GetString("Menu.File.SaveAll.Text");
- this.checkBox_generateReport_opensetting.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
- this.btn_clean_result.Text = PdnResources.GetString("Menu.Clearstatistics.text");
- this.button_setting.Text = PdnResources.GetString("Menu.Setting.Text");
- this.btn_statistics.Text = PdnResources.GetString("Menu.Startstatistics.text");
- this.btn_saveresult.Text = PdnResources.GetString("Menu.Saveresult.text");
- this.groupBox1.Text = PdnResources.GetString("Menu.OxygenSulfur.text");
- this.groupBox2.Text = PdnResources.GetString("Menu.BasicSettings.text");
- this.button2.Text = PdnResources.GetString("Menu.More.text");
- this.comboBox_rollingDirection.Items.AddRange(new object[] {
- PdnResources.GetString("Menu.Level.text"),
- PdnResources.GetString("Menu.vertical.text")});
- this.label4.Text = PdnResources.GetString("Menu.Rollingdirection.text") + ":";
- this.groupBox3.Text = PdnResources.GetString("Menu.style.text");
- this.radioButton2.Text = PdnResources.GetString("Menu.solid.text");
- this.radioButton1.Text = PdnResources.GetString("Menu.ImageCollection.CameraFrame.Text");
- this.checkBox2.Text = PdnResources.GetString("Menu.ShowRectangle.Text");
- this.checkBox1.Text = PdnResources.GetString("Menu.ShowElliptical.Text");
- this.groupBox4.Text = PdnResources.GetString("Menu.Inclusion.Text");
- this.button6.Text = PdnResources.GetString("Menu.EditInclusion.Text");
- this.button5.Text = PdnResources.GetString("Menu.RemoveInclusions.Text");
- this.label1.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
- this.button1.Text = PdnResources.GetString("Menu.Tools.OpenProject.Text");
- this.button_exportResults.Text = PdnResources.GetString("Menu.Exportresults.text");
- this.button_generateReport.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
- this.button_remove.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.button_all.Text = PdnResources.GetString("Menu.Showall.text");
- this.bc.button4.Text = PdnResources.GetString("Menu.ScreeningIllusion.text");
- }
- #region [组件初始化]
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.groupBox_operating = new System.Windows.Forms.GroupBox();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.label3 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.button4 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.checkBox_generateReport_opensetting = new System.Windows.Forms.CheckBox();
- this.btn_clean_result = new System.Windows.Forms.Button();
- this.button_setting = new System.Windows.Forms.Button();
- this.btn_statistics = new System.Windows.Forms.Button();
- this.btn_saveresult = new System.Windows.Forms.Button();
- this.imageList_img = new System.Windows.Forms.ImageList(this.components);
- this.groupBox_img = new System.Windows.Forms.GroupBox();
- this.lstView_img = new System.Windows.Forms.ListView();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.checkBox4 = new System.Windows.Forms.CheckBox();
- this.checkBox3 = new System.Windows.Forms.CheckBox();
- this.measureRangeControl1 = new Metis.AutoAnalysis.MeasureRangeControl();
- this.panel_color2 = new System.Windows.Forms.Panel();
- this.panel_color1 = new System.Windows.Forms.Panel();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.button2 = new System.Windows.Forms.Button();
- this.comboBox_rollingDirection = new System.Windows.Forms.ComboBox();
- this.label4 = new System.Windows.Forms.Label();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.radioButton2 = new System.Windows.Forms.RadioButton();
- this.radioButton1 = new System.Windows.Forms.RadioButton();
- this.checkBox2 = new System.Windows.Forms.CheckBox();
- this.checkBox1 = new System.Windows.Forms.CheckBox();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.button6 = new System.Windows.Forms.Button();
- this.button5 = new System.Windows.Forms.Button();
- this.groupBox_report = new System.Windows.Forms.GroupBox();
- this.label1 = new System.Windows.Forms.Label();
- 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.groupBox_review = new System.Windows.Forms.GroupBox();
- this.groupBox_operating.SuspendLayout();
- this.groupBox_img.SuspendLayout();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox3.SuspendLayout();
- this.groupBox4.SuspendLayout();
- 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.textBox1);
- this.groupBox_operating.Controls.Add(this.label3);
- this.groupBox_operating.Controls.Add(this.label2);
- this.groupBox_operating.Controls.Add(this.button4);
- this.groupBox_operating.Controls.Add(this.button3);
- this.groupBox_operating.Controls.Add(this.checkBox_generateReport_opensetting);
- this.groupBox_operating.Controls.Add(this.btn_clean_result);
- this.groupBox_operating.Controls.Add(this.button_setting);
- this.groupBox_operating.Controls.Add(this.btn_statistics);
- this.groupBox_operating.Controls.Add(this.btn_saveresult);
- this.groupBox_operating.Location = new System.Drawing.Point(3, 12);
- this.groupBox_operating.Name = "groupBox_operating";
- this.groupBox_operating.Size = new System.Drawing.Size(1170, 53);
- this.groupBox_operating.TabIndex = 13;
- this.groupBox_operating.TabStop = false;
- //
- // textBox1
- //
- this.textBox1.Location = new System.Drawing.Point(650, 19);
- this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(72, 21);
- this.textBox1.TabIndex = 14;
- this.textBox1.Text = "710";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(728, 22);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(23, 12);
- this.label3.TabIndex = 13;
- this.label3.Text = "μm";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(615, 22);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(29, 12);
- this.label2.TabIndex = 12;
- this.label2.Text = "视场";
- //
- // 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(1006, 17);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(75, 23);
- this.button4.TabIndex = 11;
- this.button4.Text = "应用全部";
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_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(1087, 17);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(75, 23);
- this.button3.TabIndex = 10;
- this.button3.Text = "保存全部";
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // 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(132, 16);
- this.checkBox_generateReport_opensetting.TabIndex = 6;
- this.checkBox_generateReport_opensetting.Text = "生成报告时打开设置";
- this.checkBox_generateReport_opensetting.UseVisualStyleBackColor = true;
- //
- // btn_clean_result
- //
- this.btn_clean_result.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btn_clean_result.Location = new System.Drawing.Point(844, 17);
- this.btn_clean_result.Name = "btn_clean_result";
- this.btn_clean_result.Size = new System.Drawing.Size(75, 23);
- this.btn_clean_result.TabIndex = 5;
- this.btn_clean_result.Text = "清除统计";
- this.btn_clean_result.UseVisualStyleBackColor = true;
- this.btn_clean_result.Click += new System.EventHandler(this.btn_clean_result_Click);
- //
- // 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.Text = "设置";
- this.button_setting.UseVisualStyleBackColor = true;
- this.button_setting.Click += new System.EventHandler(this.button_setting_Click);
- //
- // btn_statistics
- //
- this.btn_statistics.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btn_statistics.Location = new System.Drawing.Point(763, 17);
- this.btn_statistics.Name = "btn_statistics";
- this.btn_statistics.Size = new System.Drawing.Size(75, 23);
- this.btn_statistics.TabIndex = 3;
- this.btn_statistics.Text = "开始统计";
- this.btn_statistics.UseVisualStyleBackColor = true;
- this.btn_statistics.Click += new System.EventHandler(this.btn_statistics_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(925, 17);
- this.btn_saveresult.Name = "btn_saveresult";
- this.btn_saveresult.Size = new System.Drawing.Size(75, 23);
- this.btn_saveresult.TabIndex = 2;
- this.btn_saveresult.Text = "保存结果";
- this.btn_saveresult.UseVisualStyleBackColor = true;
- this.btn_saveresult.Click += new System.EventHandler(this.btn_saveresult_Click);
- //
- // 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;
- //
- // groupBox_img
- //
- this.groupBox_img.Controls.Add(this.lstView_img);
- this.groupBox_img.Location = new System.Drawing.Point(3, 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(168, 526);
- this.groupBox_img.TabIndex = 14;
- 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(150, 492);
- this.lstView_img.TabIndex = 0;
- this.lstView_img.UseCompatibleStateImageBehavior = false;
- this.lstView_img.SelectedIndexChanged += new System.EventHandler(this.lstView_img_SelectedIndexChanged);
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.checkBox4);
- this.groupBox1.Controls.Add(this.checkBox3);
- this.groupBox1.Controls.Add(this.measureRangeControl1);
- this.groupBox1.Controls.Add(this.panel_color2);
- this.groupBox1.Controls.Add(this.panel_color1);
- this.groupBox1.Location = new System.Drawing.Point(178, 72);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(360, 47);
- this.groupBox1.TabIndex = 37;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "氧硫";
- //
- // checkBox4
- //
- this.checkBox4.AutoSize = true;
- this.checkBox4.Location = new System.Drawing.Point(209, 18);
- this.checkBox4.Name = "checkBox4";
- this.checkBox4.Size = new System.Drawing.Size(30, 16);
- this.checkBox4.TabIndex = 45;
- this.checkBox4.Text = "O";
- this.checkBox4.UseVisualStyleBackColor = true;
- this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
- //
- // checkBox3
- //
- this.checkBox3.AutoSize = true;
- this.checkBox3.Location = new System.Drawing.Point(30, 18);
- this.checkBox3.Name = "checkBox3";
- this.checkBox3.Size = new System.Drawing.Size(30, 16);
- this.checkBox3.TabIndex = 44;
- this.checkBox3.Text = "S";
- this.checkBox3.UseVisualStyleBackColor = true;
- this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
- //
- // measureRangeControl1
- //
- this.measureRangeControl1.Location = new System.Drawing.Point(201, 33);
- this.measureRangeControl1.Name = "measureRangeControl1";
- this.measureRangeControl1.Size = new System.Drawing.Size(8, 11);
- this.measureRangeControl1.TabIndex = 43;
- //
- // panel_color2
- //
- this.panel_color2.BackColor = System.Drawing.Color.Red;
- this.panel_color2.Location = new System.Drawing.Point(245, 17);
- this.panel_color2.Name = "panel_color2";
- this.panel_color2.Size = new System.Drawing.Size(69, 17);
- this.panel_color2.TabIndex = 42;
- this.panel_color2.Click += new System.EventHandler(this.panel_color2_Click);
- //
- // panel_color1
- //
- this.panel_color1.BackColor = System.Drawing.Color.Blue;
- this.panel_color1.Location = new System.Drawing.Point(66, 17);
- this.panel_color1.Name = "panel_color1";
- this.panel_color1.Size = new System.Drawing.Size(69, 17);
- this.panel_color1.TabIndex = 41;
- this.panel_color1.Click += new System.EventHandler(this.panel_color1_Click);
- //
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.button2);
- this.groupBox2.Controls.Add(this.comboBox_rollingDirection);
- this.groupBox2.Controls.Add(this.label4);
- this.groupBox2.Location = new System.Drawing.Point(178, 417);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(360, 60);
- this.groupBox2.TabIndex = 38;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "基础设置";
- //
- // 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(279, 23);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 5;
- this.button2.Text = "更多";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // comboBox_rollingDirection
- //
- this.comboBox_rollingDirection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox_rollingDirection.FormattingEnabled = true;
- this.comboBox_rollingDirection.Location = new System.Drawing.Point(90, 25);
- this.comboBox_rollingDirection.Name = "comboBox_rollingDirection";
- this.comboBox_rollingDirection.Size = new System.Drawing.Size(56, 20);
- this.comboBox_rollingDirection.TabIndex = 4;
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(19, 28);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(65, 12);
- this.label4.TabIndex = 1;
- this.label4.Text = "轧制方向:";
- //
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.radioButton2);
- this.groupBox3.Controls.Add(this.radioButton1);
- this.groupBox3.Controls.Add(this.checkBox2);
- this.groupBox3.Controls.Add(this.checkBox1);
- this.groupBox3.Location = new System.Drawing.Point(178, 483);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(360, 47);
- this.groupBox3.TabIndex = 39;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "样式";
- //
- // radioButton2
- //
- this.radioButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.radioButton2.AutoSize = true;
- this.radioButton2.Checked = true;
- this.radioButton2.Location = new System.Drawing.Point(84, 16);
- this.radioButton2.Name = "radioButton2";
- this.radioButton2.Size = new System.Drawing.Size(47, 16);
- this.radioButton2.TabIndex = 16;
- this.radioButton2.TabStop = true;
- this.radioButton2.Text = "实心";
- this.radioButton2.UseVisualStyleBackColor = true;
- this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
- //
- // radioButton1
- //
- this.radioButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.radioButton1.AutoSize = true;
- this.radioButton1.Location = new System.Drawing.Point(13, 16);
- this.radioButton1.Name = "radioButton1";
- this.radioButton1.Size = new System.Drawing.Size(47, 16);
- this.radioButton1.TabIndex = 15;
- this.radioButton1.Text = "边框";
- this.radioButton1.UseVisualStyleBackColor = true;
- this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
- //
- // checkBox2
- //
- this.checkBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.checkBox2.AutoSize = true;
- this.checkBox2.Location = new System.Drawing.Point(155, 17);
- this.checkBox2.Name = "checkBox2";
- this.checkBox2.Size = new System.Drawing.Size(84, 16);
- this.checkBox2.TabIndex = 14;
- this.checkBox2.Text = "显示矩形框";
- this.checkBox2.UseVisualStyleBackColor = true;
- this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
- //
- // checkBox1
- //
- this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.checkBox1.AutoSize = true;
- this.checkBox1.Location = new System.Drawing.Point(263, 16);
- this.checkBox1.Name = "checkBox1";
- this.checkBox1.Size = new System.Drawing.Size(84, 16);
- this.checkBox1.TabIndex = 13;
- this.checkBox1.Text = "显示椭圆框";
- this.checkBox1.UseVisualStyleBackColor = true;
- this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
- //
- // groupBox4
- //
- this.groupBox4.Controls.Add(this.button6);
- this.groupBox4.Controls.Add(this.button5);
- this.groupBox4.Location = new System.Drawing.Point(178, 536);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(360, 62);
- this.groupBox4.TabIndex = 40;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "夹杂物操作";
- //
- // button6
- //
- this.button6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button6.Location = new System.Drawing.Point(9, 20);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(75, 23);
- this.button6.TabIndex = 7;
- this.button6.Text = "编辑夹杂物";
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // 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(90, 20);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(75, 23);
- this.button5.TabIndex = 6;
- this.button5.Text = "删除夹杂物";
- this.button5.UseVisualStyleBackColor = true;
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // 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.label1);
- 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(1031, 597);
- this.groupBox_report.Name = "groupBox_report";
- this.groupBox_report.Size = new System.Drawing.Size(142, 188);
- this.groupBox_report.TabIndex = 47;
- this.groupBox_report.TabStop = false;
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(16, 144);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(41, 12);
- this.label1.TabIndex = 5;
- this.label1.Text = "小数:";
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(28, 104);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 4;
- this.button1.Text = "项目工程";
- 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(21, 148);
- 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, 142);
- this.domainUpDown_resultPrecision.Name = "domainUpDown_resultPrecision";
- this.domainUpDown_resultPrecision.ReadOnly = true;
- this.domainUpDown_resultPrecision.Size = new System.Drawing.Size(41, 21);
- this.domainUpDown_resultPrecision.TabIndex = 2;
- this.domainUpDown_resultPrecision.Text = "2";
- //
- // button_exportResults
- //
- this.button_exportResults.Location = new System.Drawing.Point(28, 63);
- this.button_exportResults.Name = "button_exportResults";
- this.button_exportResults.Size = new System.Drawing.Size(75, 24);
- this.button_exportResults.TabIndex = 1;
- this.button_exportResults.Text = "导出结果";
- 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.Text = "生成报告";
- 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(233, 597);
- this.groupBox6groupBox_analysisResult2.Name = "groupBox6groupBox_analysisResult2";
- this.groupBox6groupBox_analysisResult2.Size = new System.Drawing.Size(792, 188);
- this.groupBox6groupBox_analysisResult2.TabIndex = 46;
- 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(780, 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.Size = new System.Drawing.Size(780, 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(3, 597);
- this.groupBox_analysisResult1.Name = "groupBox_analysisResult1";
- this.groupBox_analysisResult1.Size = new System.Drawing.Size(224, 188);
- this.groupBox_analysisResult1.TabIndex = 45;
- 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(212, 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(143, 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.Text = "删除";
- 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(6, 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.Text = "全部显示";
- this.button_all.UseVisualStyleBackColor = true;
- this.button_all.Click += new System.EventHandler(this.button_all_Click);
- //
- // 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(551, 73);
- this.groupBox_review.Name = "groupBox_review";
- this.groupBox_review.Size = new System.Drawing.Size(622, 525);
- this.groupBox_review.TabIndex = 48;
- this.groupBox_review.TabStop = false;
- //
- // MethodKDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(1177, 788);
- this.Controls.Add(this.groupBox_review);
- this.Controls.Add(this.groupBox_report);
- this.Controls.Add(this.groupBox6groupBox_analysisResult2);
- this.Controls.Add(this.groupBox_analysisResult1);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Controls.Add(this.groupBox_img);
- this.Controls.Add(this.groupBox_operating);
- this.Name = "MethodKDialog";
- this.Controls.SetChildIndex(this.groupBox_operating, 0);
- this.Controls.SetChildIndex(this.groupBox_img, 0);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox3, 0);
- this.Controls.SetChildIndex(this.groupBox4, 0);
- this.Controls.SetChildIndex(this.groupBox_analysisResult1, 0);
- this.Controls.SetChildIndex(this.groupBox6groupBox_analysisResult2, 0);
- this.Controls.SetChildIndex(this.groupBox_report, 0);
- this.Controls.SetChildIndex(this.groupBox_review, 0);
- this.groupBox_operating.ResumeLayout(false);
- this.groupBox_operating.PerformLayout();
- this.groupBox_img.ResumeLayout(false);
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- this.groupBox4.ResumeLayout(false);
- this.groupBox_report.ResumeLayout(false);
- this.groupBox_report.PerformLayout();
- this.groupBox6groupBox_analysisResult2.ResumeLayout(false);
- this.groupBox_analysisResult1.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- private void InitializeComponent2()
- {
- this.bc = new PaintDotNet.CustomControl.BinaryControl();
- //
- // bc
- //
- this.bc.BinaryBackColor = System.Drawing.Color.Red;
- this.bc.BinaryChecked = false;
- this.bc.BinaryStyle = 1;
- this.bc.Location = new System.Drawing.Point(178, 120);
- 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 = 35;
- this.Controls.Add(this.bc);
- this.Controls.SetChildIndex(this.bc, 0);
- }
- private void Initialize()
- {
- radioButton1.Enabled = false;
- radioButton2.Enabled = false;
- checkBox1.Enabled = false;
- checkBox2.Enabled = false;
- this.Load += new System.EventHandler(this.GrainSizeDialog_Load);
- this.comboBox_rollingDirection.SelectedIndex = 0;
- this.comboBox_rollingDirection.SelectedIndexChanged += new System.EventHandler(this.comboBox_rollingDirection_SelectedIndexChanged);
- for (int i = 10; i >= 1; 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++)
- {
- 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.documentWorkspace.panel.Click += new EventHandler(this.documentWorkspace_panel_Click);
- this.documentWorkspace.panel.MouseDown += new MouseEventHandler(this.documentWorkspace_panel_MouseDown);
- this.documentWorkspace.panel.MouseMove += new MouseEventHandler(this.documentWorkspace_panel_MouseMove);
- this.documentWorkspace.panel.MouseUp += new MouseEventHandler(this.documentWorkspace_panel_MouseUp);
- PdnBaseForm.RegisterFormHotKey(Keys.Delete, (key) => { this.documentWorkspace.MouseEvent_Del(null, null); return 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 = 2;
- // 初始化报告列表
- this.listView_analysisResult.View = View.Details;
- this.listView_analysisResult2.View = View.Details;
- this.listBox_analysisResult.DisplayMember = "Display";
- this.listBox_analysisResult.ValueMember = "Value";
- #region [处理自动阈值]
- this.bc.button7.Click -= new System.EventHandler(this.bc.button7_Click);
- this.bc.button7.Click += new System.EventHandler(this.AutomaticThreshold);
- //this.bc.button4.Text = "筛选假象";
- #endregion
- }
- /// <summary>
- /// 自动阈值
- /// </summary>
- private void AutomaticThreshold(object sender, EventArgs e)
- {
- //先计算阈值
- //Mat mat = imageMat.Clone();//待测试
- Mat gray = imageMat.CvtColor(ColorConversionCodes.BGR2GRAY);
- double otsu = Cv2.Threshold(gray, gray, 0, 255, ThresholdTypes.Triangle/*.Otsu*/);
- if (otsu <= 10 || otsu >= 245)
- {
- otsu = Cv2.Threshold(imageMat.CvtColor(ColorConversionCodes.BGR2GRAY), gray, 0, 255, ThresholdTypes.Otsu);//.Triangle
- }
- this.bc.numberScopeControl3.minValue = 0;
- this.bc.numberScopeControl3.maxValue = otsu;
- if (otsu <= 139)
- {
- this.bc.numberScopeControl2.minValue = 255;
- this.bc.numberScopeControl2.maxValue = 255;
- }
- else
- {
- this.bc.numberScopeControl3.maxValue = 139;
- this.bc.numberScopeControl2.minValue = 140;
- this.bc.numberScopeControl2.maxValue = otsu;
- }
- if (this.checkBox3.Checked || this.checkBox4.Checked)
- {
- bClassBinaryImplFinishAction(null, null);
- }
- }
- private void showImg(object sender, EventArgs e)
- {
- lstView_img.Focus();
- if (this.imgIndex != -1)
- {
- //滚动到指定的行位置
- this.lstView_img.EnsureVisible(this.imgIndex);
- this.lstView_img.Items[imgIndex].Focused = true;
- this.lstView_img.Items[imgIndex].Selected = true;
- }
- //this.methodOfAssessment = getMethodOfAssessment();
- //MethodOfAssessment.activeMethod = this.methodOfAssessment;
- //SetAnalyzeModelFromXml(this.methodOfAssessment.resourcesName);
- //SubclassInitialize();
- //initColorSetting();
- //initDisplaySetting();
- ////如果是脚本执行,将参数带入
- //if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
- //{
- // this.initScriptValues = true;//ScriptAutomatic
- // //Boolean initScriptValues = true;
- // ////在这里反射出对应功能的参数类
- // string className = InvariantData.path_Action + ".Action" + menuId;
- // ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
- // foreach (Args arg in param.Lists)
- // {
- // Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
- // if (param1.value != null)
- // arg.Value = param1.value;
- // getValue(arg.key, arg.Value);
- // }
- // appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
- //}
- //else
- //{//读取上次关闭窗口时保存的参数
- // getLastData();
- //}
- this.firstShow = false;
- binaryClass.RefreshHistogramControl1Values();
- //// 初始化显示设置区域
- //foreach (var item in this.groupBox_displaySetting.Controls)
- //{
- // if (item is Button)
- // {
- // ((Button)item).Click += this.label_displaySetting;
- // }
- //}
- //if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
- // this.startScriptAutomaticAction();
- }
- #endregion
- #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)
- {
- //if (!bcOriginChecked())
- //{
- // if (bcBinaryChecked())
- // {
- // this.documentWorkspace.ActiveTool = DrawToolType.InclusionSelectRecognitionArea;
- // this.documentWorkspace.Cursor = Cursors.Default;
- // }
- // else
- // {
- // this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
- // }
- //}
- //else
- //{
- // this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
- //}
- if (!checkBox3.Checked && !checkBox4.Checked)
- {
- return;
- }
- if (!bcOriginChecked())
- {
- binaryClass.BinaryImplFinishAction -= new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
- if (checkBox3.Checked)
- {
- List<double> valueList = new List<double>() { this.bc.numberScopeControl3.minValue, this.bc.numberScopeControl3.maxValue };
- this.binaryClass.applyButtonImplMethodInclusion(null, -1, null, 0, this.panel_color1.BackColor.ToArgb(), valueList);
- this.documentWorkspace.PhaseModels[0].choise = true;
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- }
- if (checkBox4.Checked)
- {
- List<double> valueList = new List<double>() { this.bc.numberScopeControl2.minValue, this.bc.numberScopeControl2.maxValue };
- this.binaryClass.applyButtonImplMethodInclusion(null, -1, null, 1, this.panel_color2.BackColor.ToArgb(), valueList);
- this.documentWorkspace.PhaseModels[1].choise = true;
- }
- else
- {
- this.documentWorkspace.PhaseModels[1].choise = false;
- }
- binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = false;
- }
- this.documentWorkspace.Refresh();
- }
- private bool bcBinaryChecked()
- {
- 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;
- // this.documentWorkspace.PhaseModels[1].choise = true;
- // this.documentWorkspace.ActiveTool = DrawToolType.InclusionSelectRecognitionArea;
- // this.documentWorkspace.Cursor = Cursors.Default;
- //}
- this.bClassBinaryImplFinishAction(null, null);
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = false;
- this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
- }
- this.documentWorkspace.Refresh();
- }
- #endregion [二值化相关方法]
- #region [面板相关事件]
- private void documentWorkspace_panel_MouseDown(object sender, MouseEventArgs e)
- {
- if (this.selectedTypesOfInclusions == null && !this.clearSelect)
- {
- return;
- }
- if (e.Button == MouseButtons.Left)
- {
- this.selectedTypesOfInclusionsPoint = e.Location;
- }
- }
- private void documentWorkspace_panel_MouseMove(object sender, MouseEventArgs e)
- {
- Pen pen = null;
- if (this.selectedTypesOfInclusionsPoint == null)
- {
- return;
- }
- if (this.selectedTypesOfInclusions != null)
- {
- pen = new Pen(Color.FromArgb(this.selectedTypesOfInclusions.showColor), 1);
- }
- else if (this.clearSelect)
- {
- pen = new Pen(Color.Black, 1);
- pen.DashStyle = DashStyle.Dash;
- }
- this.documentWorkspace.Refresh();
- float x = Math.Min(this.selectedTypesOfInclusionsPoint.Value.X, e.Location.X);
- float y = Math.Min(this.selectedTypesOfInclusionsPoint.Value.Y, e.Location.Y);
- float width = Math.Abs(this.selectedTypesOfInclusionsPoint.Value.X - e.Location.X);
- float height = Math.Abs(this.selectedTypesOfInclusionsPoint.Value.Y - e.Location.Y);
- this.documentWorkspace.panel.CreateGraphics().DrawRectangles(pen, new RectangleF[] { new RectangleF(x, y, width, height) });
- }
- private void documentWorkspace_panel_MouseUp(object sender, MouseEventArgs e)
- {
- if (this.selectedTypesOfInclusions == null && !this.clearSelect)
- {
- return;
- }
- if (e.Button == MouseButtons.Left)
- {
- if (this.selectedTypesOfInclusionsPoint == null)
- {
- return;
- }
- var startPoint = this.documentWorkspace.GetScalePoint(this.selectedTypesOfInclusionsPoint.Value);
- var stopPoint = this.documentWorkspace.GetScalePoint(e.Location);
- float x = Math.Min(startPoint.X, stopPoint.X);
- float y = Math.Min(startPoint.Y, stopPoint.Y);
- float width = Math.Abs(startPoint.X - stopPoint.X);
- float height = Math.Abs(startPoint.Y - stopPoint.Y);
- this.selectedTypesOfInclusionsRectangle = new RectangleF(x, y, width, height);
- if (this.selectedTypesOfInclusions != null)
- {
- startStatistics();
- }
- else
- {
- if (this.tempAnalysisResult != null)
- {
- for (int i = this.tempAnalysisResult.inclusions.Count - 1; i >= 0; i--)
- {
- if (this.selectedTypesOfInclusionsRectangle.Value.Contains(this.tempAnalysisResult.inclusions[i].rectProfile)
- || this.selectedTypesOfInclusionsRectangle.Value.IntersectsWith(this.tempAnalysisResult.inclusions[i].rectProfile))
- {
- this.tempAnalysisResult.inclusions.RemoveAt(i);
- }
- }
- ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, this.tempAnalysisResult.inclusions, is_showRectangle, is_showOval, is_full);
- }
- }
- this.clearSelect = false;
- this.selectedTypesOfInclusionsPoint = null;
- this.selectedTypesOfInclusionsRectangle = null;
- radioButton1.Enabled = true;
- radioButton2.Enabled = true;
- checkBox1.Enabled = true;
- checkBox2.Enabled = true;
- }
- }
- /// <summary>
- /// 面板绘制
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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 : (rc.Width - width) / 2;
- int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
- e.Graphics.TranslateTransform(x, y);
- e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
- if (this.documentWorkspace.GraphicsList.Count > 0)
- {
- Font font = new Font(System.Drawing.SystemFonts.DefaultFont.FontFamily, 40, System.Drawing.SystemFonts.DefaultFont.Style);
- double pxPerUnit = this.imgPxPerUnit;
- int allWidth = (int)(this.imageMat.Width * pxPerUnit);
- int allHeight = (int)(this.imageMat.Height * pxPerUnit);
- if (this.tempAnalysisResult == null)
- {
- this.paintRectangle = this.documentWorkspace.GraphicsList[0].Rectangle;
- }
- int realWidth = (int)(this.paintRectangle.Width * pxPerUnit);
- int realHeight = (int)(this.paintRectangle.Height * pxPerUnit);
- e.Graphics.DrawString($"{realWidth}/{allWidth}", font, new SolidBrush(Color.Blue), this.paintRectangle.Right, this.paintRectangle.Bottom / 2);
- e.Graphics.DrawString($"{realHeight}/{allHeight}", font, new SolidBrush(Color.Blue), this.paintRectangle.Right / 2, this.paintRectangle.Bottom + 10);
- }
- if (this.tempAnalysisResult != null && this.tempAnalysisResult.segmentationView == 2)
- {
- foreach (var s in this.tempAnalysisResult.MedthodKRectangles)
- {
- e.Graphics.DrawRectangle(new Pen(Color.Black, 0.1f), new Rectangle((int)s.X, (int)s.Y, (int)s.Width, (int)s.Height));
- }
- }
- e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
- e.Graphics.TranslateTransform(-x, -y);
- }
- 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.Cursor = Cursors.Default;
- this.documentWorkspace.ActiveTool = DrawToolType.InclusionSelectRecognitionArea;
- }
- private void mobileModeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = DrawToolType.MoveMode;
- }
- #endregion
- #region [图片选择]
- /// <summary>
- ///
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void lstView_img_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.lstView_img.FocusedItem != null && this.lstView_img.FocusedItem.Selected)
- {
- this.imgPxPerUnit = this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
- //if (this.methodOfAssessment != null)
- //{
- // this.methodOfAssessment = getMethodOfAssessment();
- // MethodOfAssessment.activeMethod = this.methodOfAssessment;
- // SetAnalyzeModelFromXml(this.methodOfAssessment.resourcesName);
- //}
- this.methodOfAssessment = getMethodOfAssessment();
- MethodOfAssessment.activeMethod = this.methodOfAssessment;
- SetAnalyzeModelFromXml(this.methodOfAssessment.resourcesName);
- this.imageMat = this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
- this.tempAnalysisResult = null;
- //二值化
- binaryClass.listView1_SelectedIndexChanged(this.imageMat.Clone(), this.imageList_img.Images.Keys[this.lstView_img.FocusedItem.Index]);
- this.bc.button6_Click(null, null);
- var gList = new GraphicsList();
- 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();
- gList.Add(obj);
- }
- this.documentWorkspace.GraphicsList = gList;
- this.documentWorkspace.ActiveTool = DrawToolType.InclusionSelectRecognitionArea;
- this.documentWorkspace.GraphicsList.DeleteAllView();
- var line = new ViewRectangle(0, 0, this.imageMat.Width, this.imageMat.Height);
- line.ISurfaceBox = documentWorkspace;
- line.combineMode = (CombineMode)Enum.Parse(typeof(CombineMode), "Union");
- line.Selected = true;
- this.documentWorkspace.AddGraphicsFromForm(line);
- if (!this.bcBinaryChecked())
- {
- this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
- }
- //if (userAll)
- //{
- // this.startStatistics();
- //}
- this.documentWorkspace.Refresh();
- }
- else
- {
- this.documentWorkspace.Visible = false;
- }
- }
- #endregion
- #region [设置 样式 操作]
- /// <summary>
- /// S选择
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox3_CheckedChanged(object sender, EventArgs e)
- {
- if (!bcOriginChecked())
- {
- if (checkBox3.Checked)
- {
- binaryClass.BinaryImplFinishAction -= new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
- List<double> valueList = new List<double>() { this.bc.numberScopeControl3.minValue, this.bc.numberScopeControl3.maxValue };
- this.binaryClass.applyButtonImplMethodInclusion(null, -1, null, 0,this.panel_color1.BackColor.ToArgb(), valueList);
- this.documentWorkspace.PhaseModels[0].choise = true;
- binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
- }
- else {
- this.documentWorkspace.PhaseModels[0].choise = false;
- }
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// O选择
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox4_CheckedChanged(object sender, EventArgs e)
- {
- if (!bcOriginChecked())
- {
- if (checkBox4.Checked)
- {
- binaryClass.BinaryImplFinishAction -= new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
- List<double> valueList = new List<double>() { this.bc.numberScopeControl2.minValue, this.bc.numberScopeControl2.maxValue };
- this.binaryClass.applyButtonImplMethodInclusion(null, -1, null, 1, this.panel_color2.BackColor.ToArgb(), valueList);
- this.documentWorkspace.PhaseModels[1].choise = true;
- binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
- }
- else
- {
- this.documentWorkspace.PhaseModels[1].choise = false;
- }
- }
- else
- {
- this.documentWorkspace.PhaseModels[1].choise = false;
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 改变S颜色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void panel_color1_Click(object sender, EventArgs e)
- {
- this.oneColorsForm.UserPrimaryColor = ColorBgra.FromColor(this.panel_color1.BackColor);
- this.oneColorsForm.setSaveBtn_Click(new System.EventHandler(this.oneColorsChanged));
- this.oneColorsForm.ShowDialog();
- }
- private void oneColorsChanged(object sender, EventArgs e)
- {
- Color color = this.oneColorsForm.UserPrimaryColor.ToColor();
- //更改背景色,触发事件
- this.panel_color1.BackColor = color;
- this.oneColorsForm.Close();
- }
- /// <summary>
- /// 改变O颜色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void panel_color2_Click(object sender, EventArgs e)
- {
- this.twoColorsForm.UserPrimaryColor = ColorBgra.FromColor(this.panel_color2.BackColor);
- this.twoColorsForm.setSaveBtn_Click(new System.EventHandler(this.twoColorsChanged));
- this.twoColorsForm.ShowDialog();
- }
- private void twoColorsChanged(object sender, EventArgs e)
- {
- Color color = this.twoColorsForm.UserPrimaryColor.ToColor();
- //更改背景色,触发事件
- this.panel_color2.BackColor = color;
- this.twoColorsForm.Close();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void comboBox_rollingDirection_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.methodOfAssessment.inclusionsStandard.globalSettings.rollingDirection = (InclusionsGlobalSettings.RollingDirection)this.comboBox_rollingDirection.SelectedIndex;
- }
- /// <summary>
- /// 更多操作
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- MethodSettingDialog form = new MethodSettingDialog(inclusionSetting);
- form.StartPosition = FormStartPosition.CenterParent;
- form.TransferEvent += frm_TransEvent;
- form.ShowDialog();
- }
- /// <summary>
- /// 弹窗委托
- /// </summary>
- private void frm_TransEvent(InclusionSetting inclusionSetting)
- {
- this.inclusionSetting = inclusionSetting;
- }
- /// <summary>
- /// 设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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;
- }
- }
- /// <summary>
- /// 边框or实心
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void radioButton1_CheckedChanged(object sender, EventArgs e)
- {
- if (this.firstShow)
- {
- return;
- }
- if (this.tempAnalysisResult == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttostartstatistics.text"));
- return;
- }
- if (radioButton1.Checked)
- {
- this.is_full = 2;
- }
- else
- {
- this.is_full = 1;
- }
- if (this.tempAnalysisResult.segmentationView != 2)
- {
- ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, this.tempAnalysisResult.inclusions, is_showRectangle, is_showOval, is_full);
- }
- else
- {
- this.documentWorkspace.Refresh();
- }
- }
- /// <summary>
- /// 显示矩形框
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- if (this.firstShow)
- {
- return;
- }
- if (this.tempAnalysisResult == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttostartstatistics.text"));
- return;
- }
- is_showRectangle = !is_showRectangle;
- ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, this.tempAnalysisResult.inclusions, is_showRectangle, is_showOval, is_full);
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 显示椭圆框
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- if (this.firstShow)
- {
- return;
- }
- if (this.tempAnalysisResult == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttostartstatistics.text"));
- return;
- }
- is_showOval = !is_showOval;
- ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, this.tempAnalysisResult.inclusions, is_showRectangle, is_showOval, is_full);
- }
- /// <summary>
- /// 编辑夹杂物
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- if (this.tempAnalysisResult == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttostartstatistics.text"));
- return;
- }
- new MethodKInclusionEditDialog(this.appWorkspace,this.tempAnalysisResult.inclusions , this.imageMat,this).ShowDialog();
- }
- /// <summary>
- /// 删除夹杂物
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button5_Click(object sender, EventArgs e)
- {
- this.clearSelect = true;
- }
- /// <summary>
- /// 夹杂物编辑回调
- /// </summary>
- public void inclusionEditDialogCloseCallback(List<Inclusion> inclusions)
- {
- ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, inclusions, is_showRectangle, is_showOval, is_full);
- }
- #endregion
- #region [开始统计 清除统计 保存结果]
- /// <summary>
- /// 开始统计
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btn_statistics_Click(object sender, EventArgs e)
- {
- radioButton1.Enabled = true;
- radioButton2.Enabled = true;
- checkBox1.Enabled = true;
- checkBox2.Enabled = true;
- this.startStatistics();
- }
- /// <summary>
- /// 清除统计
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btn_clean_result_Click(object sender, EventArgs e)
- {
- this.tempAnalysisResult = null;
- ToolInclusionSelect.CleanInclusionAll(this.documentWorkspace);
- radioButton1.Enabled = false;
- radioButton2.Enabled = false;
- checkBox1.Enabled = false;
- checkBox2.Enabled = false;
- //userAll = false;
- }
- /// <summary>
- /// 保存结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btn_saveresult_Click(object sender, EventArgs e)
- {
- if (this.tempAnalysisResult == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttostartstatistics.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)
- {
- return;
- }
- analysisResults[this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index]] = this.tempAnalysisResult;
- }
- else
- {
- analysisResults.Add(this.appWorkspace.DocumentWorkspaces[this.lstView_img.FocusedItem.Index], this.tempAnalysisResult);
- }
- buildListBox_analysisResult();
- }
- 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;
- }
- this.listView_analysisResult2.Columns.Clear();
- this.listView_analysisResult2.Items.Clear();
- ListViewItem lvi = new ListViewItem();
- List<string> strings = this.methodOfAssessment.buildResultConclusion(conclusions);
- // 构建头
- foreach (var item in this.methodOfAssessment.getResultConclusionHead())
- {
- ColumnHeader header = new ColumnHeader();
- header.Text = item;
- header.Width = 150;
- this.listView_analysisResult2.Columns.Add(header);
- }
- 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]);
- }
- 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();
- }
- #endregion
- #region [夹杂物分析]
- private MethodOfAssessment getMethodOfAssessment()
- {
- return new MethodK(this.imgPxPerUnit);
- }
- /// <summary>
- /// 分析开始
- /// </summary>
- private void startStatistics()
- {
- 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;
- }
- ProgressThreadProcClass procClass = new ProgressThreadProcClass();
- int itemCount = 100;
- ProgressThreadProcClass.IFileTransferProgressEvents progressEvents = new ProgressThreadProcClass.IFileTransferProgressEvents();
- System.Threading.ThreadStart copyThreadProc =
- delegate ()
- {
- try
- {
- 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);
- }
- Mat mat;
- bool twoMat = false;
- if (checkBox3.Checked && checkBox4.Checked)
- {
- var mat1 = this.documentWorkspace.phaseModels[0].mat.Clone();
- var mat2 = this.documentWorkspace.phaseModels[1].mat.Clone();
- mat = mat1.CvtColor(ColorConversionCodes.BGR2GRAY)* 255 + mat2.CvtColor(ColorConversionCodes.BGR2GRAY) * 255;
- for (int i = 0; i < mat.Height; i++)
- {
- for (int j = 0; j < mat.Width; j++)
- {
- if (mat.At<byte>(i, j) > 0)
- {
- mat.Set<byte>(i, j, 0);
- }
- else {
- mat.Set<byte>(i, j, 255);
- }
- }
- }
- twoMat = true;
- }
- else if (checkBox3.Checked)
- {
- mat = this.documentWorkspace.phaseModels[0].mat.Clone();
- }
- else if (checkBox4.Checked)
- {
- mat = this.documentWorkspace.phaseModels[1].mat.Clone();
- }
- else {
- mat = this.documentWorkspace.phaseModels[0].mat.Clone();
- }
- List<RectangleF> rectangles = new List<RectangleF>();
- //if (this.selectedTypesOfInclusionsRectangle != null)
- //{
- // // 添加框选范围
- // rectangles.Add(this.selectedTypesOfInclusionsRectangle.Value);
- // // 删除框选范围内夹杂物
- // if (this.tempAnalysisResult != null)
- // {
- // for (int i = this.tempAnalysisResult.inclusions.Count - 1; i >= 0; i--)
- // {
- // if (this.selectedTypesOfInclusionsRectangle.Value.Contains(this.tempAnalysisResult.inclusions[i].rectProfile)
- // || this.selectedTypesOfInclusionsRectangle.Value.IntersectsWith(this.tempAnalysisResult.inclusions[i].rectProfile))
- // {
- // this.tempAnalysisResult.inclusions.RemoveAt(i);
- // }
- // }
- // }
- //}
- for (int i = 0; i < this.documentWorkspace.GraphicsList.Count; i++)
- {
- if (this.documentWorkspace.GraphicsList[i].drawToolType == DrawToolType.InclusionDrawRecognitionArea)
- {
- DedicatedAnalysisDrawObject drawObject = (DrawRecognitionAreaDrawObject)this.documentWorkspace.GraphicsList[i];
- rectangles.Add(drawObject.Rectangle);
- }
- }
- // 二值图非黑色点涂白
- for (int i = 0; i < mat.Height; i++)
- {
- for (int j = 0; j < mat.Width; j++)
- {
- if (!twoMat)
- {
- if (mat.At<int>(i, j) == 0)
- {
- mat.Set<Vec3b>(i, j, new Vec3b(255, 255, 255));
- }
- }
- if (rectangles.Count > 0)
- {
- bool contains = false;
- // 二值图过滤未选中区域
- foreach (var item in rectangles)
- {
- if (item.Contains(j, i))
- {
- contains = true;
- }
- }
- if (!contains)
- {
- mat.Set<Vec3b>(i, j, new Vec3b(255, 255, 255));
- }
- }
- }
- }
- // 找出正方形视场
- List<RectangleF> rectangleF = new List<RectangleF>();
- for (int i = 0; i < this.documentWorkspace.GraphicsList.Count; i++)
- {
- if (this.documentWorkspace.GraphicsList[i].drawToolType == DrawToolType.ViewSquare || this.documentWorkspace.GraphicsList[i].drawToolType == DrawToolType.ViewRectangle || this.documentWorkspace.GraphicsList[i].drawToolType == DrawToolType.ViewRectangleEx)
- {
- rectangleF.Add(this.documentWorkspace.GraphicsList[i].Rectangle);
- }
- }
- int k = inclusionSetting.kNum;
- var rollingDirection = (InclusionsGlobalSettings.RollingDirection)this.comboBox_rollingDirection.SelectedIndex;
- var report = this.methodOfAssessment.generateReport(this.imageMat.Clone(), mat, rectangleF, 1, this.viewNum, k, this.is_full, rollingDirection);
- if (this.selectedTypesOfInclusionsRectangle == null)
- {
- this.tempAnalysisResult = report;
- }
- else
- {
- foreach (var item in report.inclusions)
- {
- item.type = this.selectedTypesOfInclusions;
- }
- if (this.tempAnalysisResult == null)
- {
- this.tempAnalysisResult = report;
- }
- else
- {
- this.tempAnalysisResult.inclusions.AddRange(report.inclusions);
- }
- this.tempAnalysisResult.buildResultBody();
- }
- //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;
- // }
- //}
- ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, this.tempAnalysisResult.inclusions, is_showRectangle, is_showOval, is_full);
- }
- catch (Exception ex)
- {
- }
- finally
- {
- progressEvents.EndOperation(OperationResult.Finished);
- }
- };
- procClass.StartProgressAction(this, itemCount, copyThreadProc, progressEvents, null);
- }
- #endregion
- #region [生成报告 导出报告 项目工程]
- /// <summary>
- /// 生成报告
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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_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);
- }
- contentList.Add(new 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);
- }
- sheets.Add(contentList);
- List<List<string>> inclusionList = new List<List<string>>();
- List<string> inclusionHead = new List<string>();
- inclusionList.Add(inclusionHead);
- inclusionHead.Add("pixelLength");
- inclusionHead.Add("pixelWidth");
- inclusionHead.Add("physicalLength");
- inclusionHead.Add("physicalWidth");
- inclusionHead.Add("lwRatio");
- inclusionHead.Add("arrangement");
- inclusionHead.Add("shape");
- inclusionHead.Add("shapeFactor");
- inclusionHead.Add("area");
- inclusionHead.Add("diameter");
- inclusionHead.Add("type");
- inclusionHead.Add("color");
- inclusionHead.Add("chemicalCharacteristics");
- inclusionHead.Add("X-Position");
- inclusionHead.Add("Y-Position");
- //K法独有
- inclusionHead.Add("fieldNumber");
- inclusionHead.Add("fieldLeftLimit");
- inclusionHead.Add("fieldRightLimit");
- inclusionHead.Add("fieldTopLimit");
- inclusionHead.Add("fieldBottomLimit");
- inclusionHead.Add("rating");
- //if (this.isK == 1)
- //{
-
- //}
- foreach (var analysisResult in this.analysisResults.Values)
- {
- foreach (var inclusion in analysisResult.inclusions)
- {
- List<string> inclusionBody = new List<string>();
- inclusionList.Add(inclusionBody);
- inclusionBody.Add(inclusion.pixelLength + "");
- inclusionBody.Add(inclusion.pixelWidth + "");
- inclusionBody.Add(inclusion.physicalLength + "");
- inclusionBody.Add(inclusion.physicalWidth + "");
- inclusionBody.Add(inclusion.lwRatio + "");
- inclusionBody.Add(inclusion.arrangement + "");
- inclusionBody.Add(inclusion.shape + "");
- inclusionBody.Add(inclusion.shapeFactor + "");
- inclusionBody.Add(inclusion.area + "");
- inclusionBody.Add(inclusion.diameter + "");
- inclusionBody.Add(inclusion.type.type + "");
- inclusionBody.Add(inclusion.color == null ? "" : inclusion.color.colorName + "");
- inclusionBody.Add(inclusion.chemicalCharacteristics + "");
- inclusionBody.Add(inclusion.rectProfile.X + "");
- inclusionBody.Add(inclusion.rectProfile.Y + "");
- //K法独有
- inclusionBody.Add(inclusion.viewNum + "");
- inclusionBody.Add(inclusion.viewLeft + "");
- inclusionBody.Add(inclusion.viewRight + "");
- inclusionBody.Add(inclusion.viewTop + "");
- inclusionBody.Add(inclusion.viewBottom + "");
- inclusionBody.Add(inclusion.rating + "");
- //if (this.isK == 1)
- //{
-
- //}
- }
- }
- sheets.Add(inclusionList);
- 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])
- {
- if (phase.mat == null)
- {
- continue;
- }
- Bitmap processedBit = BitmapConverter.ToBitmap(phase.mat);
- graphics.DrawImage(processedBit, new PointF(0, 0));
- }
- foreach (var inclusion in analysisResults[workspace].inclusions)
- {
- new InclusionDrawObject(workspace, inclusion, this.is_full).Draw(graphics);
- }
- bitList.Add(originalBit);
- bitList.Add(newBit);
- }
- try
- {
- //OfficeFileHandleHelper.CreateAnalysisReportInclusion(this.analyzeSettingModel, sheets, bitList, tagInfos);
- this.appWorkspace.CreateAnalysisReportInclusion(this.analyzeSettingModel, sheets, bitList, tagInfos);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");
- }
- /// <summary>
- /// 导出结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button_exportResults_Click(object sender, EventArgs e)
- {
- if (this.listView_analysisResult.Items.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noresults.text"));
- return;
- }
- SaveFileDialog exe = new SaveFileDialog();
- exe.Filter = "Execl files (*.xlsx)|*.xlsx";
- exe.FilterIndex = 0;
- exe.RestoreDirectory = true;
- //exe.CreatePrompt = true;
- exe.Title = "Export Excel File";
- exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + this.methodOfAssessment.resourcesName;
- DialogResult dr = exe.ShowDialog();
- if (dr != DialogResult.OK)
- {
- return;
- }
- List<DataTable> list = new List<DataTable>();
- 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);
- }
- DataTable dtb2 = new DataTable();
- dtb2.Columns.Add("pixelLength");
- dtb2.Columns.Add("pixelWidth");
- dtb2.Columns.Add("physicalLength");
- dtb2.Columns.Add("physicalWidth");
- dtb2.Columns.Add("lwRatio");
- dtb2.Columns.Add("arrangement");
- dtb2.Columns.Add("shape");
- dtb2.Columns.Add("shapeFactor");
- dtb2.Columns.Add("area");
- dtb2.Columns.Add("diameter");
- dtb2.Columns.Add("type");
- dtb2.Columns.Add("color");
- dtb2.Columns.Add("chemicalCharacteristics");
- dtb2.Columns.Add("X-Position");
- dtb2.Columns.Add("Y-Position");
- //k法独有
- dtb2.Columns.Add("rating");
- //if (this.isK == 1)
- //{
-
- //}
- foreach (var analysisResult in this.analysisResults.Values)
- {
- foreach (var inclusion in analysisResult.inclusions)
- {
- DataRow dataRow = dtb2.NewRow();
- dataRow[0] = (inclusion.pixelLength + "");
- dataRow[1] = (inclusion.pixelWidth + "");
- dataRow[2] = (inclusion.physicalLength + "");
- dataRow[3] = (inclusion.physicalWidth + "");
- dataRow[4] = (inclusion.lwRatio + "");
- dataRow[5] = (inclusion.arrangement + "");
- dataRow[6] = (inclusion.shape + "");
- dataRow[7] = (inclusion.shapeFactor + "");
- dataRow[8] = (inclusion.area + "");
- dataRow[9] = (inclusion.diameter + "");
- dataRow[10] = (inclusion.type.type + "");
- dataRow[11] = (inclusion.color == null ? "" : inclusion.color.colorName + "");
- dataRow[12] = (inclusion.chemicalCharacteristics + "");
- dataRow[13] = (inclusion.rectProfile.X + "");
- dataRow[14] = (inclusion.rectProfile.Y + "");
- //k法独有
- dataRow[15] = (inclusion.rating + "");
- dataRow[8] = (inclusion.areaK + "");
- //if (this.isK == 1)
- //{
-
- //}
- dtb2.Rows.Add(dataRow);
- }
- }
- dtb.TableName = "Sheet1";
- dtb1.TableName = "Sheet2";
- dtb2.TableName = "Sheet3";
- list.Add(dtb);
- list.Add(dtb1);
- list.Add(dtb2);
- try
- {
- this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, true, true);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- /// <summary>
- /// 项目工程
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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;
- }
- //获取项目工程内的文件夹路径
- ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.Inclusion.Text", this.analyzeSettingModel.savePath);
- if (item != 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<string>> contentList = new List<List<string>>();
- 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);
- }
- contentList.Add(new 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);
- }
- List<Bitmap> bitList = new List<Bitmap>();
- List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
- foreach (var itemIt in this.listBox_analysisResult.CheckedItems)
- {
- List<List<string>> inclusionList = new List<List<string>>();
- List<string> inclusionHead = new List<string>();
- inclusionList.Add(inclusionHead);
- inclusionHead.Add("pixelLength");
- inclusionHead.Add("pixelWidth");
- inclusionHead.Add("physicalLength");
- inclusionHead.Add("physicalWidth");
- inclusionHead.Add("lwRatio");
- inclusionHead.Add("arrangement");
- inclusionHead.Add("shape");
- inclusionHead.Add("shapeFactor");
- inclusionHead.Add("area");
- inclusionHead.Add("diameter");
- inclusionHead.Add("type");
- inclusionHead.Add("color");
- inclusionHead.Add("chemicalCharacteristics");
- inclusionHead.Add("X-Position");
- inclusionHead.Add("Y-Position");
- //k法独有
- inclusionHead.Add("fieldNumber");
- inclusionHead.Add("fieldLeftLimit");
- inclusionHead.Add("fieldRightLimit");
- inclusionHead.Add("fieldTopLimit");
- inclusionHead.Add("fieldBottomLimit");
- inclusionHead.Add("rating");
- //if (this.isK == 1)
- //{
-
- //}
- 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])
- {
- if (phase.mat == null)
- {
- continue;
- }
- Bitmap processedBit = BitmapConverter.ToBitmap(phase.mat);
- graphics.DrawImage(processedBit, new PointF(0, 0));
- }
- foreach (var inclusion in analysisResults[workspace].inclusions)
- {
- List<string> inclusionBody = new List<string>();
- inclusionBody.Add(inclusion.pixelLength + "");
- inclusionBody.Add(inclusion.pixelWidth + "");
- inclusionBody.Add(inclusion.physicalLength + "");
- inclusionBody.Add(inclusion.physicalWidth + "");
- inclusionBody.Add(inclusion.lwRatio + "");
- inclusionBody.Add(inclusion.arrangement + "");
- inclusionBody.Add(inclusion.shape + "");
- inclusionBody.Add(inclusion.shapeFactor + "");
- //k法独有
- inclusionBody.Add(inclusion.areaK + "");
- //if (this.isK == 1)
- //{
-
- //}
- //else
- //{
- // inclusionBody.Add(inclusion.area + "");
- //}
- inclusionBody.Add(inclusion.diameter + "");
- inclusionBody.Add(inclusion.type.type + "");
- inclusionBody.Add(inclusion.color == null ? "" : inclusion.color.colorName + "");
- inclusionBody.Add(inclusion.chemicalCharacteristics + "");
- inclusionBody.Add(inclusion.rectProfile.X + "");
- inclusionBody.Add(inclusion.rectProfile.Y + "");
- //k法独有
- inclusionBody.Add(inclusion.viewNum + "");
- inclusionBody.Add(inclusion.viewLeft + "");
- inclusionBody.Add(inclusion.viewRight + "");
- inclusionBody.Add(inclusion.viewTop + "");
- inclusionBody.Add(inclusion.viewBottom + "");
- inclusionBody.Add(inclusion.rating + "");
- //if (this.isK == 1)
- //{
- //}
- inclusionList.Add(inclusionBody);
- new InclusionDrawObject(workspace, inclusion, this.is_full).Draw(graphics);
- }
- ExportProjectModel exportProjectModel = new ExportProjectModel();
- exportProjectModel.dataList = inclusionList;
- exportProjectModel.picName = ((LocalListViewItem)itemIt).Display;
- exportProjectModel.tagName = PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.Inclusion.Text");
- exportModel.Add(exportProjectModel);
- bitList.Add(originalBit);
- bitList.Add(newBit);
- }
- 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);
- }
- }
- #endregion
- #region [应用全部 保存全部]
- /// <summary>
- /// 应用全部
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- }
- /// <summary>
- /// 保存全部
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, EventArgs e)
- {
- }
- #endregion
- #region [全部显示 删除 勾选结果]
- 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();
- }
- 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();
- }
- }
- #endregion
- }
- }
|