using Metis.DedicatedAnalysis.Inclusions;
using Metis.ParameterSet;
using OpenCvSharp;
using OpenCvSharp.Extensions;
using PaintDotNet.Adjust.BaseImage;
using PaintDotNet.Annotation;
using PaintDotNet.Annotation.DedicatedAnalysis;
using PaintDotNet.Annotation.Enum;
using PaintDotNet.Annotation.FieldView;
using PaintDotNet.Base;
using PaintDotNet.Base.CommTool;
using PaintDotNet.Base.DedicatedAnalysis.Inclusions;
using PaintDotNet.Base.DedicatedAnalysis.Inclusions.Model;
using PaintDotNet.Base.Functionodel;
using PaintDotNet.Base.SettingModel;
using PaintDotNet.CustomControl;
using PaintDotNet.Data.Param;
using PaintDotNet.DbOpreate.DbBll;
using PaintDotNet.DbOpreate.DbModel;
using PaintDotNet.Instrument;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using static PaintDotNet.Base.DedicatedAnalysis.Inclusions.InclusionsGlobalSettings;
using static PaintDotNet.Base.DedicatedAnalysis.Inclusions.MethodOfAssessment;
namespace PaintDotNet.DedicatedAnalysis.Inclusions
{
internal class InclusionsStandardDialog : PdnBaseForm
{
#region 属性
#region 属性
///
/// 主控件
///
private AppWorkspace appWorkspace;
///
/// 公共按钮
///
private CommonControlButtons commonControlButtons;
///
/// 图像面板
///
private DocumentWorkspaceWindow documentWorkspace;
private Dictionary documentItems;
///
/// 当前选择的图片
///
private Mat imageMat;
///
/// 初始系统参数配置值
///
private BinaryExtractionModel binaryExtractionModel = new BinaryExtractionModel();
///
/// 选择的评定方法
///
private MethodOfAssessment methodOfAssessment;
private AnalysisResult tempAnalysisResult;
private Dictionary analysisResults = new Dictionary();
protected ColorOfInclusions selectedColorOfInclusions;
protected ColorOfInclusions oldSelectedColorOfInclusions;
private int chooseK = 3;
///
/// RGB/HLS 选中那个按钮,默认1=R/H 2=G/L 2=B/S
///
private int HistogramRGBSelect = 1;
private bool pickColorChecked;
//二值化集成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;
#endregion
#region 组件
private GroupBox groupBox_operating;
private Button btn_editInclusions;
private Button btn_statistics;
private GroupBox groupBox_img;
private ListView lstView_img;
private ImageList imageList_img;
private IContainer components;
private GroupBox groupBox_baseSetting;
private ComboBox comboBox_rollingDirection;
private Label label_lwRatioLimit;
private Label label_rollingDirection;
protected NumericUpDown numericUpDown_lwRatioLimit;
protected GroupBox groupBox_colorSetting;
private Panel panel_colorGamut;
protected GroupBox groupBox_displaySetting;
private GroupBox groupBox_histogram;
private CustomControl.HistogramControl histogramControl_colorSetting;
private GroupBox groupBox_colorAdjustment;
private Button button_colorAdjustmentBS;
private Button button_colorAdjustmentGL;
private Button button_colorAdjustmentRH;
private NumericUpDown numericUpDown_colorAdjustmentBSD;
private NumericUpDown numericUpDown_colorAdjustmentBSU;
private Label label_colorAdjustmentBS;
private NumericUpDown numericUpDown_colorAdjustmentGLD;
private NumericUpDown numericUpDown_colorAdjustmentGLU;
private Label label_colorAdjustmentGL;
private NumericUpDown numericUpDown_colorAdjustmentRHD;
private NumericUpDown numericUpDown_colorAdjustmentRHU;
private Label label_colorAdjustmentRH;
private RadioButton radioButton_checkedHLS;
private RadioButton radioButton_checkedRGB;
private GroupBox groupBox_review;
private GroupBox groupBox_report;
private Label label_resultPrecision;
private DomainUpDown domainUpDown_resultPrecision;
private Button button_exportResults;
private Button button_generateReport;
private GroupBox groupBox6groupBox_analysisResult2;
private ListView listView_analysisResult;
private GroupBox groupBox_analysisResult1;
private Button button_remove;
private Button button_all;
private Label label_colorGamut;
private Button button_pickColor;
private Panel panel_colorGamutPhase;
private CheckBox checkBox_showColorGamutPhase;
private ToolTip toolTip_InclusionsDetails;
private ListView listView_analysisResult2;
private Button button_setting;
private CheckedListBox listBox_analysisResult;
private Button btn_clean_result;
private CheckBox checkBox_generateReport_opensetting;
private Button button1;
private ComboBox comboBox1;
private Label label1;
private BinaryControl bc;
private Button btn_drawRecognitionArea;
private Button btn_selectClear;
private Button btn_saveresult;
private Button button2;
private CheckBox checkBox2;
private CheckBox checkBox1;
private RadioButton radioButton2;
private RadioButton radioButton1;
private int isK = 2;
private int imgIndex = -1;
private RectangleF paintRectangle;
private Dictionary> dict = new Dictionary>();
protected double imgPxPerUnit;
protected GroupBox groupBox1;
private Button button4;
private Button button3;
private string dialogText;
private List resultList = new List();
private List hasResultIndexList = new List();
private Dictionary everyImgData = new Dictionary();
protected string colorName;
private Dictionary> rgbDict = new Dictionary>();
private bool isExportResults = false;
private bool isExportReports = false;
private bool isExportProjects = false;
private RadioButton radioButton3;
private RadioButton radioButton4;
private RadioButton radioButton5;
///
/// 是否脚本运行
///
private Boolean initScriptValues = false;
#endregion
#endregion
#region 构造函数
public InclusionsStandardDialog(AppWorkspace appWorkspace, string dialogText, PdnMenuItem menuitem)
{
this.appWorkspace = appWorkspace;
this.Shown += showImg;
this.Text = dialogText;
this.dialogText = dialogText;
this.Icon = PdnInfo.AppIcon;
InitializeComponent();
this.menuId = menuitem.MenuId;
this.menuName = menuitem.Text;
this.binaryClass = new BinaryClass(menuId);
InitializeComponent2();
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.documentWorkspace.panel.Paint += Panel_Paint;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.saveLastData);
}
private void showImg(object sender, EventArgs e)
{
lstView_img.Focus();
if (this.imgIndex != -1)
{
//滚动到指定的行位置
this.lstView_img.EnsureVisible(this.imgIndex);
this.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();
}
///
/// 执行脚本自动化的步骤
///
private void startScriptAutomaticAction()
{
this.button4.PerformClick();
this.button3.PerformClick();
this.allCheck();
if (isExportResults)//导出结果
this.button_exportResults.PerformClick();
if (isExportReports)//生成报告
this.button_generateReport.PerformClick();
if (isExportProjects)//导出项目
this.button1.PerformClick();
this.appWorkspace.ScriptAutomatic = false;
this.Close();
}
public InclusionsStandardDialog()
{
InitializeComponent();
}
#endregion
#region 初始化组件
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, 72);
this.bc.Name = "bc";
this.bc.OriginChecked = false;
this.bc.scope1End = 0D;
this.bc.scope1Start = 0D;
this.bc.scope2End = 0D;
this.bc.scope2Start = 0D;
this.bc.scope3End = 0D;
this.bc.scope3Start = 0D;
this.bc.Size = new System.Drawing.Size(360, 292);
this.bc.TabIndex = 35;
this.Controls.Add(this.bc);
this.Controls.SetChildIndex(this.bc, 0);
//
// histogramControl_colorSetting
//
this.histogramControl_colorSetting = new PaintDotNet.CustomControl.HistogramControl();
this.histogramControl_colorSetting.Flag = 1;
this.histogramControl_colorSetting.Location = new System.Drawing.Point(7, 15);
this.histogramControl_colorSetting.Name = "histogramControl_colorSetting";
this.histogramControl_colorSetting.Size = new System.Drawing.Size(167, 114);
this.histogramControl_colorSetting.TabIndex = 0;
this.groupBox_histogram.Controls.Add(this.histogramControl_colorSetting);
this.comboBox_rollingDirection.Items.AddRange(new object[] {
PdnResources.GetString("Menu.vertical.text"),
PdnResources.GetString("Menu.Level.text")});
this.groupBox_operating.Text = PdnResources.GetString("Menu.operation.text");
this.btn_drawRecognitionArea.Text = PdnResources.GetString("Menu.dentificationarea.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_editInclusions.Text = PdnResources.GetString("Menu.Editinclusions.text");
this.btn_statistics.Text = PdnResources.GetString("Menu.Startstatistics.text");
this.btn_saveresult.Text = PdnResources.GetString("Menu.Saveresult.text");
this.groupBox_img.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
this.groupBox_baseSetting.Text = PdnResources.GetString("Menu.BasicSettings.text");
this.label1.Text = "K" + PdnResources.GetString("Menu.Imagement.Measurementlist.value.text");
this.label_lwRatioLimit.Text = PdnResources.GetString("Menu.lengthwidthratio.Text");
this.label_rollingDirection.Text = PdnResources.GetString("Menu.Rollingdirection.text");
this.groupBox_colorSetting.Text = PdnResources.GetString("Menu.Inclusioncolorsetting.text");
this.checkBox_showColorGamutPhase.Text = PdnResources.GetString("Menu.Matchthecoloreffect.text");
this.button_pickColor.Text = PdnResources.GetString("Menu.Pickcolor.text");
this.label_colorGamut.Text = PdnResources.GetString("Menu.Colorinterval.text");
this.groupBox_displaySetting.Text = PdnResources.GetString("Menu.displaysetting.text");
this.btn_selectClear.Text = PdnResources.GetString("Menu.Removalofinclusion.Text");
this.groupBox_histogram.Text = PdnResources.GetString("Menu.Tools.Histogram.Text");
this.groupBox_colorAdjustment.Text = PdnResources.GetString("Menu.Coloradjustment.text");
this.groupBox_review.Text = PdnResources.GetString("Menu.Preview.text");
this.button1.Text = PdnResources.GetString("Menu.Tools.OpenProject.Text");
this.label_resultPrecision.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
this.button_exportResults.Text = PdnResources.GetString("Menu.Exportresults.text");
this.button_generateReport.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
this.groupBox_analysisResult1.Text = PdnResources.GetString("Menu.Analysisresult.text");
this.button_remove.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
this.button2.Text = PdnResources.GetString("Menu.ViewSetting.Text");
this.button_all.Text = PdnResources.GetString("Menu.Showall.text");
this.checkBox1.Text = PdnResources.GetString("Menu.Ellipsebox.text");
this.checkBox2.Text = PdnResources.GetString("Menu.Rectangularbox.text");
this.radioButton1.Text = PdnResources.GetString("Menu.ImageCollection.CameraFrame.Text");
this.radioButton2.Text = PdnResources.GetString("Menu.solid.text");
this.button4.Text = PdnResources.GetString("Menu.Applyall.text");
this.button3.Text = PdnResources.GetString("Menu.File.SaveAll.Text");
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.groupBox_operating = 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.btn_selectClear = new System.Windows.Forms.Button();
this.btn_drawRecognitionArea = 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_editInclusions = new System.Windows.Forms.Button();
this.btn_statistics = new System.Windows.Forms.Button();
this.btn_saveresult = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.groupBox_img = new System.Windows.Forms.GroupBox();
this.lstView_img = new System.Windows.Forms.ListView();
this.imageList_img = new System.Windows.Forms.ImageList(this.components);
this.groupBox_baseSetting = new System.Windows.Forms.GroupBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.comboBox_rollingDirection = new System.Windows.Forms.ComboBox();
this.label_lwRatioLimit = new System.Windows.Forms.Label();
this.label_rollingDirection = new System.Windows.Forms.Label();
this.numericUpDown_lwRatioLimit = new System.Windows.Forms.NumericUpDown();
this.groupBox_colorSetting = new System.Windows.Forms.GroupBox();
this.checkBox_showColorGamutPhase = new System.Windows.Forms.CheckBox();
this.panel_colorGamutPhase = new System.Windows.Forms.Panel();
this.button_pickColor = new System.Windows.Forms.Button();
this.label_colorGamut = new System.Windows.Forms.Label();
this.panel_colorGamut = new System.Windows.Forms.Panel();
this.groupBox_displaySetting = new System.Windows.Forms.GroupBox();
this.groupBox_histogram = new System.Windows.Forms.GroupBox();
this.groupBox_colorAdjustment = new System.Windows.Forms.GroupBox();
this.button_colorAdjustmentBS = new System.Windows.Forms.Button();
this.button_colorAdjustmentGL = new System.Windows.Forms.Button();
this.button_colorAdjustmentRH = new System.Windows.Forms.Button();
this.numericUpDown_colorAdjustmentBSD = new System.Windows.Forms.NumericUpDown();
this.numericUpDown_colorAdjustmentBSU = new System.Windows.Forms.NumericUpDown();
this.label_colorAdjustmentBS = new System.Windows.Forms.Label();
this.numericUpDown_colorAdjustmentGLD = new System.Windows.Forms.NumericUpDown();
this.numericUpDown_colorAdjustmentGLU = new System.Windows.Forms.NumericUpDown();
this.label_colorAdjustmentGL = new System.Windows.Forms.Label();
this.numericUpDown_colorAdjustmentRHD = new System.Windows.Forms.NumericUpDown();
this.numericUpDown_colorAdjustmentRHU = new System.Windows.Forms.NumericUpDown();
this.label_colorAdjustmentRH = new System.Windows.Forms.Label();
this.radioButton_checkedHLS = new System.Windows.Forms.RadioButton();
this.radioButton_checkedRGB = new System.Windows.Forms.RadioButton();
this.groupBox_review = new System.Windows.Forms.GroupBox();
this.groupBox_report = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.label_resultPrecision = new System.Windows.Forms.Label();
this.domainUpDown_resultPrecision = new System.Windows.Forms.DomainUpDown();
this.button_exportResults = new System.Windows.Forms.Button();
this.button_generateReport = new System.Windows.Forms.Button();
this.groupBox6groupBox_analysisResult2 = new System.Windows.Forms.GroupBox();
this.listView_analysisResult2 = new System.Windows.Forms.ListView();
this.listView_analysisResult = new System.Windows.Forms.ListView();
this.groupBox_analysisResult1 = new System.Windows.Forms.GroupBox();
this.listBox_analysisResult = new System.Windows.Forms.CheckedListBox();
this.button_remove = new System.Windows.Forms.Button();
this.button_all = new System.Windows.Forms.Button();
this.toolTip_InclusionsDetails = new System.Windows.Forms.ToolTip(this.components);
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.radioButton4 = new System.Windows.Forms.RadioButton();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.radioButton5 = new System.Windows.Forms.RadioButton();
this.groupBox_operating.SuspendLayout();
this.groupBox_img.SuspendLayout();
this.groupBox_baseSetting.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).BeginInit();
this.groupBox_colorSetting.SuspendLayout();
this.groupBox_colorAdjustment.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentBSD)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentBSU)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentGLD)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentGLU)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentRHD)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentRHU)).BeginInit();
this.groupBox_report.SuspendLayout();
this.groupBox6groupBox_analysisResult2.SuspendLayout();
this.groupBox_analysisResult1.SuspendLayout();
this.groupBox1.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.radioButton2);
this.groupBox_operating.Controls.Add(this.radioButton1);
this.groupBox_operating.Controls.Add(this.checkBox2);
this.groupBox_operating.Controls.Add(this.checkBox1);
this.groupBox_operating.Controls.Add(this.btn_selectClear);
this.groupBox_operating.Controls.Add(this.btn_drawRecognitionArea);
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_editInclusions);
this.groupBox_operating.Controls.Add(this.btn_statistics);
this.groupBox_operating.Controls.Add(this.btn_saveresult);
this.groupBox_operating.Controls.Add(this.button2);
this.groupBox_operating.Location = new System.Drawing.Point(13, 12);
this.groupBox_operating.Name = "groupBox_operating";
this.groupBox_operating.Size = new System.Drawing.Size(1152, 53);
this.groupBox_operating.TabIndex = 12;
this.groupBox_operating.TabStop = false;
//
// 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(405, 23);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(14, 13);
this.radioButton2.TabIndex = 12;
this.radioButton2.TabStop = true;
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(348, 22);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(14, 13);
this.radioButton1.TabIndex = 11;
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(504, 24);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(15, 14);
this.checkBox2.TabIndex = 10;
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(591, 23);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(15, 14);
this.checkBox1.TabIndex = 9;
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// btn_selectClear
//
this.btn_selectClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_selectClear.Location = new System.Drawing.Point(829, 20);
this.btn_selectClear.Name = "btn_selectClear";
this.btn_selectClear.Size = new System.Drawing.Size(75, 23);
this.btn_selectClear.TabIndex = 0;
this.btn_selectClear.UseVisualStyleBackColor = true;
this.btn_selectClear.Click += new System.EventHandler(this.btn_selectClear_Click);
//
// btn_drawRecognitionArea
//
this.btn_drawRecognitionArea.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_drawRecognitionArea.Location = new System.Drawing.Point(667, 20);
this.btn_drawRecognitionArea.Name = "btn_drawRecognitionArea";
this.btn_drawRecognitionArea.Size = new System.Drawing.Size(75, 23);
this.btn_drawRecognitionArea.TabIndex = 7;
this.btn_drawRecognitionArea.UseVisualStyleBackColor = true;
this.btn_drawRecognitionArea.Click += new System.EventHandler(this.btn_drawRecognitionArea_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(15, 14);
this.checkBox_generateReport_opensetting.TabIndex = 6;
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(991, 20);
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.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.UseVisualStyleBackColor = true;
this.button_setting.Click += new System.EventHandler(this.button_setting_Click);
//
// btn_editInclusions
//
this.btn_editInclusions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_editInclusions.Location = new System.Drawing.Point(748, 20);
this.btn_editInclusions.Name = "btn_editInclusions";
this.btn_editInclusions.Size = new System.Drawing.Size(75, 23);
this.btn_editInclusions.TabIndex = 3;
this.btn_editInclusions.UseVisualStyleBackColor = true;
this.btn_editInclusions.Click += new System.EventHandler(this.btn_editInclusions_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(910, 20);
this.btn_statistics.Name = "btn_statistics";
this.btn_statistics.Size = new System.Drawing.Size(75, 23);
this.btn_statistics.TabIndex = 3;
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(1072, 20);
this.btn_saveresult.Name = "btn_saveresult";
this.btn_saveresult.Size = new System.Drawing.Size(75, 23);
this.btn_saveresult.TabIndex = 2;
this.btn_saveresult.UseVisualStyleBackColor = true;
this.btn_saveresult.Click += new System.EventHandler(this.btn_saveresult_Click);
//
// 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(667, 20);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 8;
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// groupBox_img
//
this.groupBox_img.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox_img.Controls.Add(this.lstView_img);
this.groupBox_img.Location = new System.Drawing.Point(13, 72);
this.groupBox_img.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.groupBox_img.Name = "groupBox_img";
this.groupBox_img.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.groupBox_img.Size = new System.Drawing.Size(158, 630);
this.groupBox_img.TabIndex = 13;
this.groupBox_img.TabStop = false;
//
// lstView_img
//
this.lstView_img.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lstView_img.HideSelection = false;
this.lstView_img.LargeImageList = this.imageList_img;
this.lstView_img.Location = new System.Drawing.Point(8, 26);
this.lstView_img.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.lstView_img.MultiSelect = false;
this.lstView_img.Name = "lstView_img";
this.lstView_img.Size = new System.Drawing.Size(140, 596);
this.lstView_img.TabIndex = 0;
this.lstView_img.UseCompatibleStateImageBehavior = false;
this.lstView_img.SelectedIndexChanged += new System.EventHandler(this.lstView_img_SelectedIndexChanged);
this.lstView_img.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseUp);
//
// imageList_img
//
this.imageList_img.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
this.imageList_img.ImageSize = new System.Drawing.Size(64, 64);
this.imageList_img.TransparentColor = System.Drawing.Color.Transparent;
//
// groupBox_baseSetting
//
this.groupBox_baseSetting.Controls.Add(this.comboBox1);
this.groupBox_baseSetting.Controls.Add(this.label1);
this.groupBox_baseSetting.Controls.Add(this.comboBox_rollingDirection);
this.groupBox_baseSetting.Controls.Add(this.label_lwRatioLimit);
this.groupBox_baseSetting.Controls.Add(this.label_rollingDirection);
this.groupBox_baseSetting.Controls.Add(this.numericUpDown_lwRatioLimit);
this.groupBox_baseSetting.Location = new System.Drawing.Point(178, 370);
this.groupBox_baseSetting.Name = "groupBox_baseSetting";
this.groupBox_baseSetting.Size = new System.Drawing.Size(360, 51);
this.groupBox_baseSetting.TabIndex = 18;
this.groupBox_baseSetting.TabStop = false;
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8"});
this.comboBox1.Location = new System.Drawing.Point(296, 21);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(56, 20);
this.comboBox1.TabIndex = 9;
this.comboBox1.SelectionChangeCommitted += new System.EventHandler(this.abc);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(268, 25);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(0, 12);
this.label1.TabIndex = 10;
//
// comboBox_rollingDirection
//
this.comboBox_rollingDirection.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox_rollingDirection.FormattingEnabled = true;
this.comboBox_rollingDirection.Location = new System.Drawing.Point(68, 23);
this.comboBox_rollingDirection.Name = "comboBox_rollingDirection";
this.comboBox_rollingDirection.Size = new System.Drawing.Size(56, 20);
this.comboBox_rollingDirection.TabIndex = 3;
//
// label_lwRatioLimit
//
this.label_lwRatioLimit.AutoSize = true;
this.label_lwRatioLimit.Location = new System.Drawing.Point(130, 26);
this.label_lwRatioLimit.Name = "label_lwRatioLimit";
this.label_lwRatioLimit.Size = new System.Drawing.Size(0, 12);
this.label_lwRatioLimit.TabIndex = 7;
//
// label_rollingDirection
//
this.label_rollingDirection.AutoSize = true;
this.label_rollingDirection.Location = new System.Drawing.Point(8, 26);
this.label_rollingDirection.Name = "label_rollingDirection";
this.label_rollingDirection.Size = new System.Drawing.Size(0, 12);
this.label_rollingDirection.TabIndex = 8;
//
// numericUpDown_lwRatioLimit
//
this.numericUpDown_lwRatioLimit.DecimalPlaces = 2;
this.numericUpDown_lwRatioLimit.Location = new System.Drawing.Point(201, 20);
this.numericUpDown_lwRatioLimit.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown_lwRatioLimit.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown_lwRatioLimit.Name = "numericUpDown_lwRatioLimit";
this.numericUpDown_lwRatioLimit.Size = new System.Drawing.Size(56, 21);
this.numericUpDown_lwRatioLimit.TabIndex = 5;
this.numericUpDown_lwRatioLimit.Value = new decimal(new int[] {
3,
0,
0,
0});
this.numericUpDown_lwRatioLimit.ValueChanged += new System.EventHandler(this.numericUpDown_lwRatioLimit_ValueChanged);
//
// groupBox_colorSetting
//
this.groupBox_colorSetting.Controls.Add(this.checkBox_showColorGamutPhase);
this.groupBox_colorSetting.Controls.Add(this.panel_colorGamutPhase);
this.groupBox_colorSetting.Controls.Add(this.button_pickColor);
this.groupBox_colorSetting.Controls.Add(this.label_colorGamut);
this.groupBox_colorSetting.Controls.Add(this.panel_colorGamut);
this.groupBox_colorSetting.Location = new System.Drawing.Point(179, 427);
this.groupBox_colorSetting.Name = "groupBox_colorSetting";
this.groupBox_colorSetting.Size = new System.Drawing.Size(359, 72);
this.groupBox_colorSetting.TabIndex = 26;
this.groupBox_colorSetting.TabStop = false;
//
// checkBox_showColorGamutPhase
//
this.checkBox_showColorGamutPhase.AutoSize = true;
this.checkBox_showColorGamutPhase.Location = new System.Drawing.Point(185, 48);
this.checkBox_showColorGamutPhase.Name = "checkBox_showColorGamutPhase";
this.checkBox_showColorGamutPhase.Size = new System.Drawing.Size(15, 14);
this.checkBox_showColorGamutPhase.TabIndex = 41;
this.checkBox_showColorGamutPhase.UseVisualStyleBackColor = true;
this.checkBox_showColorGamutPhase.CheckedChanged += new System.EventHandler(this.checkBox_showColorGamutPhase_CheckedChanged);
//
// panel_colorGamutPhase
//
this.panel_colorGamutPhase.BackColor = System.Drawing.Color.Lime;
this.panel_colorGamutPhase.Location = new System.Drawing.Point(284, 46);
this.panel_colorGamutPhase.Name = "panel_colorGamutPhase";
this.panel_colorGamutPhase.Size = new System.Drawing.Size(69, 17);
this.panel_colorGamutPhase.TabIndex = 40;
//
// button_pickColor
//
this.button_pickColor.Location = new System.Drawing.Point(284, 17);
this.button_pickColor.Name = "button_pickColor";
this.button_pickColor.Size = new System.Drawing.Size(69, 23);
this.button_pickColor.TabIndex = 36;
this.button_pickColor.UseVisualStyleBackColor = true;
this.button_pickColor.Click += new System.EventHandler(this.button_pickColor_Click);
//
// label_colorGamut
//
this.label_colorGamut.AutoSize = true;
this.label_colorGamut.Location = new System.Drawing.Point(5, 51);
this.label_colorGamut.Name = "label_colorGamut";
this.label_colorGamut.Size = new System.Drawing.Size(0, 12);
this.label_colorGamut.TabIndex = 35;
//
// panel_colorGamut
//
this.panel_colorGamut.Location = new System.Drawing.Point(64, 47);
this.panel_colorGamut.Name = "panel_colorGamut";
this.panel_colorGamut.Size = new System.Drawing.Size(110, 17);
this.panel_colorGamut.TabIndex = 34;
this.panel_colorGamut.Paint += new System.Windows.Forms.PaintEventHandler(this.panel_colorGamut_Paint);
//
// groupBox_displaySetting
//
this.groupBox_displaySetting.Location = new System.Drawing.Point(179, 646);
this.groupBox_displaySetting.Name = "groupBox_displaySetting";
this.groupBox_displaySetting.Size = new System.Drawing.Size(359, 56);
this.groupBox_displaySetting.TabIndex = 29;
this.groupBox_displaySetting.TabStop = false;
//
// groupBox_histogram
//
this.groupBox_histogram.Location = new System.Drawing.Point(179, 505);
this.groupBox_histogram.Name = "groupBox_histogram";
this.groupBox_histogram.Size = new System.Drawing.Size(179, 135);
this.groupBox_histogram.TabIndex = 28;
this.groupBox_histogram.TabStop = false;
//
// groupBox_colorAdjustment
//
this.groupBox_colorAdjustment.Controls.Add(this.button_colorAdjustmentBS);
this.groupBox_colorAdjustment.Controls.Add(this.button_colorAdjustmentGL);
this.groupBox_colorAdjustment.Controls.Add(this.button_colorAdjustmentRH);
this.groupBox_colorAdjustment.Controls.Add(this.numericUpDown_colorAdjustmentBSD);
this.groupBox_colorAdjustment.Controls.Add(this.numericUpDown_colorAdjustmentBSU);
this.groupBox_colorAdjustment.Controls.Add(this.label_colorAdjustmentBS);
this.groupBox_colorAdjustment.Controls.Add(this.numericUpDown_colorAdjustmentGLD);
this.groupBox_colorAdjustment.Controls.Add(this.numericUpDown_colorAdjustmentGLU);
this.groupBox_colorAdjustment.Controls.Add(this.label_colorAdjustmentGL);
this.groupBox_colorAdjustment.Controls.Add(this.numericUpDown_colorAdjustmentRHD);
this.groupBox_colorAdjustment.Controls.Add(this.numericUpDown_colorAdjustmentRHU);
this.groupBox_colorAdjustment.Controls.Add(this.label_colorAdjustmentRH);
this.groupBox_colorAdjustment.Controls.Add(this.radioButton_checkedHLS);
this.groupBox_colorAdjustment.Controls.Add(this.radioButton_checkedRGB);
this.groupBox_colorAdjustment.Location = new System.Drawing.Point(364, 505);
this.groupBox_colorAdjustment.Name = "groupBox_colorAdjustment";
this.groupBox_colorAdjustment.Size = new System.Drawing.Size(174, 135);
this.groupBox_colorAdjustment.TabIndex = 27;
this.groupBox_colorAdjustment.TabStop = false;
//
// button_colorAdjustmentBS
//
this.button_colorAdjustmentBS.Location = new System.Drawing.Point(134, 99);
this.button_colorAdjustmentBS.Name = "button_colorAdjustmentBS";
this.button_colorAdjustmentBS.Size = new System.Drawing.Size(34, 21);
this.button_colorAdjustmentBS.TabIndex = 34;
this.button_colorAdjustmentBS.Text = "B";
this.button_colorAdjustmentBS.UseVisualStyleBackColor = true;
this.button_colorAdjustmentBS.Click += new System.EventHandler(this.button_colorAdjustmentBS_Click);
//
// button_colorAdjustmentGL
//
this.button_colorAdjustmentGL.Location = new System.Drawing.Point(134, 72);
this.button_colorAdjustmentGL.Name = "button_colorAdjustmentGL";
this.button_colorAdjustmentGL.Size = new System.Drawing.Size(34, 21);
this.button_colorAdjustmentGL.TabIndex = 33;
this.button_colorAdjustmentGL.Text = "G";
this.button_colorAdjustmentGL.UseVisualStyleBackColor = true;
this.button_colorAdjustmentGL.Click += new System.EventHandler(this.button_colorAdjustmentGL_Click);
//
// button_colorAdjustmentRH
//
this.button_colorAdjustmentRH.BackColor = System.Drawing.SystemColors.Control;
this.button_colorAdjustmentRH.Location = new System.Drawing.Point(134, 45);
this.button_colorAdjustmentRH.Margin = new System.Windows.Forms.Padding(0);
this.button_colorAdjustmentRH.Name = "button_colorAdjustmentRH";
this.button_colorAdjustmentRH.Size = new System.Drawing.Size(34, 21);
this.button_colorAdjustmentRH.TabIndex = 32;
this.button_colorAdjustmentRH.Text = "R";
this.button_colorAdjustmentRH.UseVisualStyleBackColor = true;
this.button_colorAdjustmentRH.Click += new System.EventHandler(this.button_colorAdjustmentRH_Click);
//
// numericUpDown_colorAdjustmentBSD
//
this.numericUpDown_colorAdjustmentBSD.Location = new System.Drawing.Point(82, 99);
this.numericUpDown_colorAdjustmentBSD.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericUpDown_colorAdjustmentBSD.Name = "numericUpDown_colorAdjustmentBSD";
this.numericUpDown_colorAdjustmentBSD.Size = new System.Drawing.Size(40, 21);
this.numericUpDown_colorAdjustmentBSD.TabIndex = 30;
this.numericUpDown_colorAdjustmentBSD.Tag = "max";
this.numericUpDown_colorAdjustmentBSD.Value = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown_colorAdjustmentBSD.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentBSD.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RGBoRHLSValue_Changed);
//
// numericUpDown_colorAdjustmentBSU
//
this.numericUpDown_colorAdjustmentBSU.Location = new System.Drawing.Point(37, 99);
this.numericUpDown_colorAdjustmentBSU.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericUpDown_colorAdjustmentBSU.Name = "numericUpDown_colorAdjustmentBSU";
this.numericUpDown_colorAdjustmentBSU.Size = new System.Drawing.Size(40, 21);
this.numericUpDown_colorAdjustmentBSU.TabIndex = 29;
this.numericUpDown_colorAdjustmentBSU.Tag = "min";
this.numericUpDown_colorAdjustmentBSU.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentBSU.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RGBoRHLSValue_Changed);
//
// label_colorAdjustmentBS
//
this.label_colorAdjustmentBS.AutoSize = true;
this.label_colorAdjustmentBS.Location = new System.Drawing.Point(10, 103);
this.label_colorAdjustmentBS.Name = "label_colorAdjustmentBS";
this.label_colorAdjustmentBS.Size = new System.Drawing.Size(23, 12);
this.label_colorAdjustmentBS.TabIndex = 31;
this.label_colorAdjustmentBS.Text = "B:";
//
// numericUpDown_colorAdjustmentGLD
//
this.numericUpDown_colorAdjustmentGLD.Location = new System.Drawing.Point(82, 72);
this.numericUpDown_colorAdjustmentGLD.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericUpDown_colorAdjustmentGLD.Name = "numericUpDown_colorAdjustmentGLD";
this.numericUpDown_colorAdjustmentGLD.Size = new System.Drawing.Size(40, 21);
this.numericUpDown_colorAdjustmentGLD.TabIndex = 27;
this.numericUpDown_colorAdjustmentGLD.Tag = "max";
this.numericUpDown_colorAdjustmentGLD.Value = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown_colorAdjustmentGLD.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentGLD.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RGBoRHLSValue_Changed);
//
// numericUpDown_colorAdjustmentGLU
//
this.numericUpDown_colorAdjustmentGLU.Location = new System.Drawing.Point(37, 72);
this.numericUpDown_colorAdjustmentGLU.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericUpDown_colorAdjustmentGLU.Name = "numericUpDown_colorAdjustmentGLU";
this.numericUpDown_colorAdjustmentGLU.Size = new System.Drawing.Size(40, 21);
this.numericUpDown_colorAdjustmentGLU.TabIndex = 26;
this.numericUpDown_colorAdjustmentGLU.Tag = "min";
this.numericUpDown_colorAdjustmentGLU.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentGLU.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RGBoRHLSValue_Changed);
//
// label_colorAdjustmentGL
//
this.label_colorAdjustmentGL.AutoSize = true;
this.label_colorAdjustmentGL.Location = new System.Drawing.Point(10, 76);
this.label_colorAdjustmentGL.Name = "label_colorAdjustmentGL";
this.label_colorAdjustmentGL.Size = new System.Drawing.Size(23, 12);
this.label_colorAdjustmentGL.TabIndex = 28;
this.label_colorAdjustmentGL.Text = "G:";
//
// numericUpDown_colorAdjustmentRHD
//
this.numericUpDown_colorAdjustmentRHD.Location = new System.Drawing.Point(82, 45);
this.numericUpDown_colorAdjustmentRHD.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericUpDown_colorAdjustmentRHD.Name = "numericUpDown_colorAdjustmentRHD";
this.numericUpDown_colorAdjustmentRHD.Size = new System.Drawing.Size(40, 21);
this.numericUpDown_colorAdjustmentRHD.TabIndex = 8;
this.numericUpDown_colorAdjustmentRHD.Tag = "max";
this.numericUpDown_colorAdjustmentRHD.Value = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown_colorAdjustmentRHD.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentRHD.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RGBoRHLSValue_Changed);
//
// numericUpDown_colorAdjustmentRHU
//
this.numericUpDown_colorAdjustmentRHU.Location = new System.Drawing.Point(37, 45);
this.numericUpDown_colorAdjustmentRHU.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericUpDown_colorAdjustmentRHU.Name = "numericUpDown_colorAdjustmentRHU";
this.numericUpDown_colorAdjustmentRHU.Size = new System.Drawing.Size(40, 21);
this.numericUpDown_colorAdjustmentRHU.TabIndex = 7;
this.numericUpDown_colorAdjustmentRHU.Tag = "min";
this.numericUpDown_colorAdjustmentRHU.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentRHU.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RGBoRHLSValue_Changed);
//
// label_colorAdjustmentRH
//
this.label_colorAdjustmentRH.AutoSize = true;
this.label_colorAdjustmentRH.Location = new System.Drawing.Point(10, 49);
this.label_colorAdjustmentRH.Name = "label_colorAdjustmentRH";
this.label_colorAdjustmentRH.Size = new System.Drawing.Size(23, 12);
this.label_colorAdjustmentRH.TabIndex = 25;
this.label_colorAdjustmentRH.Text = "R:";
//
// radioButton_checkedHLS
//
this.radioButton_checkedHLS.AutoSize = true;
this.radioButton_checkedHLS.Location = new System.Drawing.Point(66, 20);
this.radioButton_checkedHLS.Name = "radioButton_checkedHLS";
this.radioButton_checkedHLS.Size = new System.Drawing.Size(41, 16);
this.radioButton_checkedHLS.TabIndex = 4;
this.radioButton_checkedHLS.Text = "HLS";
this.radioButton_checkedHLS.UseVisualStyleBackColor = true;
this.radioButton_checkedHLS.Visible = false;
this.radioButton_checkedHLS.CheckedChanged += new System.EventHandler(this.radioButton_checkedHLS_CheckedChanged);
//
// radioButton_checkedRGB
//
this.radioButton_checkedRGB.AutoSize = true;
this.radioButton_checkedRGB.Checked = true;
this.radioButton_checkedRGB.Location = new System.Drawing.Point(7, 20);
this.radioButton_checkedRGB.Name = "radioButton_checkedRGB";
this.radioButton_checkedRGB.Size = new System.Drawing.Size(41, 16);
this.radioButton_checkedRGB.TabIndex = 3;
this.radioButton_checkedRGB.TabStop = true;
this.radioButton_checkedRGB.Text = "RGB";
this.radioButton_checkedRGB.UseVisualStyleBackColor = true;
this.radioButton_checkedRGB.CheckedChanged += new System.EventHandler(this.radioButton_checkedRGB_CheckedChanged);
//
// groupBox_review
//
this.groupBox_review.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox_review.Location = new System.Drawing.Point(544, 121);
this.groupBox_review.Name = "groupBox_review";
this.groupBox_review.Size = new System.Drawing.Size(622, 581);
this.groupBox_review.TabIndex = 30;
this.groupBox_review.TabStop = false;
//
// groupBox_report
//
this.groupBox_report.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox_report.Controls.Add(this.button1);
this.groupBox_report.Controls.Add(this.label_resultPrecision);
this.groupBox_report.Controls.Add(this.domainUpDown_resultPrecision);
this.groupBox_report.Controls.Add(this.button_exportResults);
this.groupBox_report.Controls.Add(this.button_generateReport);
this.groupBox_report.Location = new System.Drawing.Point(1024, 708);
this.groupBox_report.Name = "groupBox_report";
this.groupBox_report.Size = new System.Drawing.Size(142, 188);
this.groupBox_report.TabIndex = 33;
this.groupBox_report.TabStop = false;
//
// button1
//
this.button1.Location = new System.Drawing.Point(28, 104);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 4;
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label_resultPrecision
//
this.label_resultPrecision.AutoSize = true;
this.label_resultPrecision.Location = new System.Drawing.Point(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";
this.domainUpDown_resultPrecision.SelectedItemChanged += new System.EventHandler(this.domainUpDown_resultPrecision_SelectedItemChanged);
//
// 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.UseVisualStyleBackColor = true;
this.button_exportResults.Click += new System.EventHandler(this.button_exportResults_Click);
//
// button_generateReport
//
this.button_generateReport.Location = new System.Drawing.Point(29, 24);
this.button_generateReport.Name = "button_generateReport";
this.button_generateReport.Size = new System.Drawing.Size(75, 23);
this.button_generateReport.TabIndex = 0;
this.button_generateReport.UseVisualStyleBackColor = true;
this.button_generateReport.Click += new System.EventHandler(this.button_generateReport_Click);
//
// groupBox6groupBox_analysisResult2
//
this.groupBox6groupBox_analysisResult2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6groupBox_analysisResult2.Controls.Add(this.listView_analysisResult2);
this.groupBox6groupBox_analysisResult2.Controls.Add(this.listView_analysisResult);
this.groupBox6groupBox_analysisResult2.Location = new System.Drawing.Point(242, 708);
this.groupBox6groupBox_analysisResult2.Name = "groupBox6groupBox_analysisResult2";
this.groupBox6groupBox_analysisResult2.Size = new System.Drawing.Size(769, 188);
this.groupBox6groupBox_analysisResult2.TabIndex = 32;
this.groupBox6groupBox_analysisResult2.TabStop = false;
//
// listView_analysisResult2
//
this.listView_analysisResult2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listView_analysisResult2.FullRowSelect = true;
this.listView_analysisResult2.GridLines = true;
this.listView_analysisResult2.HideSelection = false;
this.listView_analysisResult2.Location = new System.Drawing.Point(6, 114);
this.listView_analysisResult2.MultiSelect = false;
this.listView_analysisResult2.Name = "listView_analysisResult2";
this.listView_analysisResult2.Size = new System.Drawing.Size(757, 63);
this.listView_analysisResult2.TabIndex = 2;
this.listView_analysisResult2.UseCompatibleStateImageBehavior = false;
//
// listView_analysisResult
//
this.listView_analysisResult.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listView_analysisResult.FullRowSelect = true;
this.listView_analysisResult.GridLines = true;
this.listView_analysisResult.HideSelection = false;
this.listView_analysisResult.Location = new System.Drawing.Point(6, 20);
this.listView_analysisResult.MultiSelect = false;
this.listView_analysisResult.Name = "listView_analysisResult";
this.listView_analysisResult.Size = new System.Drawing.Size(757, 88);
this.listView_analysisResult.TabIndex = 2;
this.listView_analysisResult.UseCompatibleStateImageBehavior = false;
//
// groupBox_analysisResult1
//
this.groupBox_analysisResult1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox_analysisResult1.Controls.Add(this.listBox_analysisResult);
this.groupBox_analysisResult1.Controls.Add(this.button_remove);
this.groupBox_analysisResult1.Controls.Add(this.button_all);
this.groupBox_analysisResult1.Location = new System.Drawing.Point(12, 708);
this.groupBox_analysisResult1.Name = "groupBox_analysisResult1";
this.groupBox_analysisResult1.Size = new System.Drawing.Size(224, 188);
this.groupBox_analysisResult1.TabIndex = 31;
this.groupBox_analysisResult1.TabStop = false;
//
// listBox_analysisResult
//
this.listBox_analysisResult.CheckOnClick = true;
this.listBox_analysisResult.FormattingEnabled = true;
this.listBox_analysisResult.HorizontalScrollbar = true;
this.listBox_analysisResult.Location = new System.Drawing.Point(6, 53);
this.listBox_analysisResult.Name = "listBox_analysisResult";
this.listBox_analysisResult.Size = new System.Drawing.Size(199, 116);
this.listBox_analysisResult.TabIndex = 0;
this.listBox_analysisResult.SelectedIndexChanged += new System.EventHandler(this.listBox_analysisResult_SelectedIndexChanged);
//
// button_remove
//
this.button_remove.Location = new System.Drawing.Point(130, 24);
this.button_remove.Name = "button_remove";
this.button_remove.Size = new System.Drawing.Size(75, 23);
this.button_remove.TabIndex = 8;
this.button_remove.UseVisualStyleBackColor = true;
this.button_remove.Click += new System.EventHandler(this.button_remove_Click);
//
// button_all
//
this.button_all.Location = new System.Drawing.Point(14, 24);
this.button_all.Name = "button_all";
this.button_all.Size = new System.Drawing.Size(75, 23);
this.button_all.TabIndex = 1;
this.button_all.UseVisualStyleBackColor = true;
this.button_all.Click += new System.EventHandler(this.button_all_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.radioButton5);
this.groupBox1.Controls.Add(this.radioButton3);
this.groupBox1.Controls.Add(this.radioButton4);
this.groupBox1.Controls.Add(this.button4);
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Location = new System.Drawing.Point(544, 71);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(621, 44);
this.groupBox1.TabIndex = 34;
this.groupBox1.TabStop = false;
//
// radioButton3
//
this.radioButton3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.radioButton3.AutoSize = true;
this.radioButton3.Checked = true;
this.radioButton3.Location = new System.Drawing.Point(377, 19);
this.radioButton3.Name = "radioButton3";
this.radioButton3.Size = new System.Drawing.Size(59, 16);
this.radioButton3.TabIndex = 14;
this.radioButton3.TabStop = true;
this.radioButton3.Text = "旧算法";
this.radioButton3.UseVisualStyleBackColor = true;
//
// radioButton4
//
this.radioButton4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.radioButton4.AutoSize = true;
this.radioButton4.Location = new System.Drawing.Point(314, 19);
this.radioButton4.Name = "radioButton4";
this.radioButton4.Size = new System.Drawing.Size(59, 16);
this.radioButton4.TabIndex = 13;
this.radioButton4.Text = "新算法";
this.radioButton4.UseVisualStyleBackColor = true;
//
// 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(459, 15);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 9;
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(540, 15);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 8;
this.button3.Text = "保存全部";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// radioButton5
//
this.radioButton5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.radioButton5.AutoSize = true;
this.radioButton5.Location = new System.Drawing.Point(225, 18);
this.radioButton5.Name = "radioButton5";
this.radioButton5.Size = new System.Drawing.Size(83, 16);
this.radioButton5.TabIndex = 15;
this.radioButton5.Text = "新算法(二)";
this.radioButton5.UseVisualStyleBackColor = true;
//
// InclusionsStandardDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.ClientSize = new System.Drawing.Size(1177, 908);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox_baseSetting);
this.Controls.Add(this.groupBox_report);
this.Controls.Add(this.groupBox6groupBox_analysisResult2);
this.Controls.Add(this.groupBox_analysisResult1);
this.Controls.Add(this.groupBox_review);
this.Controls.Add(this.groupBox_displaySetting);
this.Controls.Add(this.groupBox_histogram);
this.Controls.Add(this.groupBox_colorAdjustment);
this.Controls.Add(this.groupBox_colorSetting);
this.Controls.Add(this.groupBox_img);
this.Controls.Add(this.groupBox_operating);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Location = new System.Drawing.Point(0, 0);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "InclusionsStandardDialog";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InclusionsStandardDialog_FormClosing);
this.Controls.SetChildIndex(this.groupBox_operating, 0);
this.Controls.SetChildIndex(this.groupBox_img, 0);
this.Controls.SetChildIndex(this.groupBox_colorSetting, 0);
this.Controls.SetChildIndex(this.groupBox_colorAdjustment, 0);
this.Controls.SetChildIndex(this.groupBox_histogram, 0);
this.Controls.SetChildIndex(this.groupBox_displaySetting, 0);
this.Controls.SetChildIndex(this.groupBox_review, 0);
this.Controls.SetChildIndex(this.groupBox_analysisResult1, 0);
this.Controls.SetChildIndex(this.groupBox6groupBox_analysisResult2, 0);
this.Controls.SetChildIndex(this.groupBox_report, 0);
this.Controls.SetChildIndex(this.groupBox_baseSetting, 0);
this.Controls.SetChildIndex(this.groupBox1, 0);
this.groupBox_operating.ResumeLayout(false);
this.groupBox_operating.PerformLayout();
this.groupBox_img.ResumeLayout(false);
this.groupBox_baseSetting.ResumeLayout(false);
this.groupBox_baseSetting.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_lwRatioLimit)).EndInit();
this.groupBox_colorSetting.ResumeLayout(false);
this.groupBox_colorSetting.PerformLayout();
this.groupBox_colorAdjustment.ResumeLayout(false);
this.groupBox_colorAdjustment.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentBSD)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentBSU)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentGLD)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentGLU)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentRHD)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_colorAdjustmentRHU)).EndInit();
this.groupBox_report.ResumeLayout(false);
this.groupBox_report.PerformLayout();
this.groupBox6groupBox_analysisResult2.ResumeLayout(false);
this.groupBox_analysisResult1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
private void abc(object sender, EventArgs e)
{
if (this.listBox_analysisResult.Items.Count > 0)
{
MessageBox.Show(PdnResources.GetString("Menu.sultsbeforemodifyingtheKvalue.Text"));
this.comboBox1.SelectedIndex = chooseK;
return;
}
if (this.lstView_img.FocusedItem != null)
{
if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
{
everyImgData[this.lstView_img.FocusedItem.Index].kNum = Convert.ToInt32(this.comboBox1.SelectedItem);
}
else
{
CurrentPageData data = new CurrentPageData(this.autoJiaoBen);
data.directionIndex = comboBox_rollingDirection.SelectedIndex;
data.ratio = numericUpDown_lwRatioLimit.Value;
data.colorCheck = this.checkBox_showColorGamutPhase.Checked;
data.kNum = Convert.ToInt32(this.comboBox1.SelectedItem);
everyImgData.Add(this.lstView_img.FocusedItem.Index, data);
}
}
this.comboBox1_SelectedIndexChanged(sender, e);
}
public void Initialize()
{
if (this.Text == "DIN50602_1985_MethodK")
{
this.comboBox1.Visible = true;
this.label1.Visible = true;
this.button2.Visible = true;
this.btn_drawRecognitionArea.Visible = false;
this.isK = 1;
}
else
{
this.comboBox1.Visible = false;
this.label1.Visible = false;
this.button2.Visible = false;
this.btn_drawRecognitionArea.Visible = true;
this.isK = 2;
}
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);
this.comboBox1.SelectedIndex = 3;
//this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
for (int i = 10; i >= 1; i--)
{
this.domainUpDown_resultPrecision.Items.Add(i.ToString());
}
this.domainUpDown_resultPrecision.SelectedIndex = 8;
this.documentItems = new Dictionary();
//初始化图片列表
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 = 1;
this.radioButton_checkedRGB.FlatStyle = FlatStyle.Flat;
this.radioButton_checkedRGB.BackColor = Color.FromArgb(225, 225, 225);
this.radioButton_checkedRGB.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
this.radioButton_checkedRGB.FlatAppearance.BorderSize = 2;
// 直方图
this.histogramControl_colorSetting.DragOneEventActionFinish += new EventHandler>(this.histogramControl_colorSetting_DragOneEvent);
this.histogramControl_colorSetting.DragTwoEventActionFinish += new EventHandler>(this.histogramControl_colorSetting_DragTwoEvent);
// 初始化报告列表
this.listView_analysisResult.View = View.Details;
this.listView_analysisResult2.View = View.Details;
this.listBox_analysisResult.DisplayMember = "Display";
this.listBox_analysisResult.ValueMember = "Value";
}
#endregion
#region 事件
#region 公共按钮
private void zoomInButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ZoomIn();
}
private void zoomOutButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ZoomOut();
}
private void zoomToWindowButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
}
private void actualSizeButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
}
private void pointerButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.Cursor = Cursors.Default;
this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.InclusionSelectRecognitionArea;
}
private void mobileModeButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
}
#endregion
private void btn_selectClear_Click(object sender, EventArgs e)
{
this.clearSelect = true;
}
private void label_displaySetting(object sender, EventArgs e)
{
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;
}
//按钮选择
if (this.isK == 1)
{
this.documentWorkspace.ActiveTool = DrawToolType.InclusionSelectRecognitionArea;
}
if (this.selectedTypesOfInclusions != null)
{
if (this.selectedTypesOfInclusions.Equals(this.methodOfAssessment.inclusionsStandard.globalSettings.typeDics[((Button)sender).Text]))
{
this.selectedTypesOfInclusions = null;
this.button1.Focus();
}
else
{
this.selectedTypesOfInclusions = this.methodOfAssessment.inclusionsStandard.globalSettings.typeDics[((Button)sender).Text];
}
}
else
{
this.selectedTypesOfInclusions = this.methodOfAssessment.inclusionsStandard.globalSettings.typeDics[((Button)sender).Text];
}
}
private void button_setting_Click(object sender, EventArgs e)
{
AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, this.methodOfAssessment.resourcesName);
if (recombinationRateSetDialog.hasModule)
{
recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
recombinationRateSetDialog.ShowDialog();
}
else
{
recombinationRateSetDialog = null;
}
}
private void checkBox_showColorGamutPhase_CheckedChanged(object sender, EventArgs e)
{
if (this.documentWorkspace.phaseModels.Count == 0)
{
return;
}
CheckBox checkBox = (CheckBox)sender;
if (this.lstView_img.FocusedItem != null)
{
if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
{
everyImgData[this.lstView_img.FocusedItem.Index].colorCheck = this.checkBox_showColorGamutPhase.Checked;
}
else
{
CurrentPageData data = new CurrentPageData(this.autoJiaoBen);
data.directionIndex = comboBox_rollingDirection.SelectedIndex;
data.ratio = numericUpDown_lwRatioLimit.Value;
data.colorCheck = this.checkBox_showColorGamutPhase.Checked;
everyImgData.Add(this.lstView_img.FocusedItem.Index, data);
}
}
this.documentWorkspace.phaseModels[this.documentWorkspace.phaseModels.Count - 1].choise = checkBox.Checked;
this.documentWorkspace.Refresh();
}
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;
}
private void btn_statistics_Click(object sender, EventArgs e)
{
if (this.isK == 1)
{
this.documentWorkspace.ActiveTool = DrawToolType.InclusionSelectRecognitionArea;
}
this.startStatistics();
radioButton1.Enabled = true;
radioButton2.Enabled = true;
checkBox1.Enabled = true;
checkBox2.Enabled = true;
}
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 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.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]);
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;
if (this.isK == 1)
{
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;
}
this.documentWorkspace.Refresh();
}
this.histogramControl_colorSetting.CreateHistogram(this.imageMat, false, this.histogramControl_colorSetting.Width - 1, this.histogramControl_colorSetting.Height - 5, HistogramRGBSelect);
if (userAll)
{
this.startStatistics();
}
if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
{
if (everyImgData[this.lstView_img.FocusedItem.Index].thisSelectedColorOfInclusions != null)
{
this.colorName = everyImgData[this.lstView_img.FocusedItem.Index].thisSelectedColorOfInclusions.colorName;
getOldCheck();
this.selectedColorOfInclusions = everyImgData[this.lstView_img.FocusedItem.Index].thisSelectedColorOfInclusions;
CalcRGBOrHLSValue();
UpdateHistogramStartAndEnd();
}
else
{
if (this.oldSelectedColorOfInclusions != null)
{
this.colorName = this.oldSelectedColorOfInclusions.colorName;
getOldCheck();
this.selectedColorOfInclusions = new ColorOfInclusions(this.oldSelectedColorOfInclusions.colorName, this.oldSelectedColorOfInclusions.ofTypes, this.oldSelectedColorOfInclusions.ru, this.oldSelectedColorOfInclusions.rd, this.oldSelectedColorOfInclusions.gu, this.oldSelectedColorOfInclusions.gd, this.oldSelectedColorOfInclusions.bu, this.oldSelectedColorOfInclusions.bd);
everyImgData[this.lstView_img.FocusedItem.Index].thisSelectedColorOfInclusions = this.selectedColorOfInclusions;
CalcRGBOrHLSValue();
UpdateHistogramStartAndEnd();
}
}
comboBox1.SelectedIndex = everyImgData[this.lstView_img.FocusedItem.Index].kNum;
if (everyImgData[this.lstView_img.FocusedItem.Index].directionIndex >= 0)
{
comboBox_rollingDirection.SelectedIndex = everyImgData[this.lstView_img.FocusedItem.Index].directionIndex;
}
if (everyImgData[this.lstView_img.FocusedItem.Index].ratio >= numericUpDown_lwRatioLimit.Minimum)
{
numericUpDown_lwRatioLimit.Value = everyImgData[this.lstView_img.FocusedItem.Index].ratio;
}
checkBox_showColorGamutPhase.Checked = everyImgData[this.lstView_img.FocusedItem.Index].colorCheck;
}
else
{
if (this.oldSelectedColorOfInclusions != null)
{
this.colorName = this.oldSelectedColorOfInclusions.colorName;
getOldCheck();
this.selectedColorOfInclusions = new ColorOfInclusions(this.oldSelectedColorOfInclusions.colorName, this.oldSelectedColorOfInclusions.ofTypes, this.oldSelectedColorOfInclusions.ru, this.oldSelectedColorOfInclusions.rd, this.oldSelectedColorOfInclusions.gu, this.oldSelectedColorOfInclusions.gd, this.oldSelectedColorOfInclusions.bu, this.oldSelectedColorOfInclusions.bd);
CalcRGBOrHLSValue();
UpdateHistogramStartAndEnd();
}
comboBox1.SelectedIndex = 5;
if (thisParameters != null)
{
if (thisParameters.parameter1 >= 0)
{
comboBox_rollingDirection.SelectedIndex = thisParameters.parameter1;
}
if (thisParameters.parameter2 >= numericUpDown_lwRatioLimit.Minimum)
{
numericUpDown_lwRatioLimit.Value = thisParameters.parameter2;
}
checkBox_showColorGamutPhase.Checked = thisParameters.parameter5;
}
}
}
else
{
this.documentWorkspace.Visible = false;
}
}
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();
}
}
private void btn_editInclusions_Click(object sender, EventArgs e)
{
if (this.tempAnalysisResult == null)
{
MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttostartstatistics.text"));
return;
}
DocumentItem item = new DocumentItem(this.imageMat.Clone(), this.documentWorkspace.GraphicsList, this.documentWorkspace.phaseModels);
new InclusionEditDialog(this.Text, this.appWorkspace, item, this.tempAnalysisResult, this.inclusionEditDialogCloseCallback, this.is_showRectangle, this.is_showOval, this.is_full, this.isK).ShowDialog();
}
private void numericUpDown_lwRatioLimit_ValueChanged(object sender, EventArgs e)
{
this.methodOfAssessment.inclusionsStandard.globalSettings.lwRatioLimit = Decimal.ToDouble(this.numericUpDown_lwRatioLimit.Value);
if (this.lstView_img.FocusedItem != null)
{
if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
{
everyImgData[this.lstView_img.FocusedItem.Index].ratio = this.numericUpDown_lwRatioLimit.Value;
}
else
{
CurrentPageData data = new CurrentPageData(this.autoJiaoBen);
data.directionIndex = comboBox_rollingDirection.SelectedIndex;
data.ratio = numericUpDown_lwRatioLimit.Value;
everyImgData.Add(this.lstView_img.FocusedItem.Index, data);
}
}
}
private void numericUpDown_threshold_ValueChanged(object sender, EventArgs e)
{
//this.methodOfAssessment.inclusionsStandard.globalSettings.binaryThreshold = Decimal.ToInt32(this.numericUpDown_threshold.Value);
}
private void radioButton_colorSelect_CheckedChanged(object sender, EventArgs e)
{
RadioButton checkedButton = this.groupBox_colorSetting.Controls.OfType()
.FirstOrDefault(r => r.Checked);
}
private void radioButton_checkedRGB_CheckedChanged(object sender, EventArgs e)
{
if (this.radioButton_checkedRGB.Checked)
{
this.label_colorAdjustmentRH.Text = "R";
this.label_colorAdjustmentGL.Text = "G";
this.label_colorAdjustmentBS.Text = "B";
this.button_colorAdjustmentRH.Text = "R";
this.button_colorAdjustmentGL.Text = "G";
this.button_colorAdjustmentBS.Text = "B";
CalcRGBOrHLSValue();
UpdateHistogramStartAndEnd();
}
}
private void radioButton_checkedHLS_CheckedChanged(object sender, EventArgs e)
{
if (this.radioButton_checkedHLS.Checked)
{
this.label_colorAdjustmentRH.Text = "H";
this.label_colorAdjustmentGL.Text = "L";
this.label_colorAdjustmentBS.Text = "S";
this.button_colorAdjustmentRH.Text = "H";
this.button_colorAdjustmentGL.Text = "L";
this.button_colorAdjustmentBS.Text = "S";
CalcRGBOrHLSValue();
UpdateHistogramStartAndEnd();
}
}
private void RGBoRHLSValue_Changed(object sender, EventArgs e)
{
UpdateHistogramStartAndEnd();
SetPhaseModelRGBOrHLS();
}
///
/// RGB/HLS的Button的R/H点击事件
///
///
///
private void button_colorAdjustmentRH_Click(object sender, EventArgs e)
{
this.HistogramRGBSelect = 1;
this.button_colorAdjustmentRH.FlatStyle = FlatStyle.Flat;
this.button_colorAdjustmentRH.BackColor = Color.FromArgb(225, 225, 225);
this.button_colorAdjustmentRH.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
this.button_colorAdjustmentRH.FlatAppearance.BorderSize = 1;
this.button_colorAdjustmentGL.FlatStyle = FlatStyle.Standard;
this.button_colorAdjustmentGL.BackColor = Control.DefaultBackColor;
this.button_colorAdjustmentGL.FlatAppearance.BorderColor = Control.DefaultBackColor;
this.button_colorAdjustmentBS.FlatStyle = FlatStyle.Standard;
this.button_colorAdjustmentBS.BackColor = Control.DefaultBackColor;
this.button_colorAdjustmentBS.FlatAppearance.BorderColor = Control.DefaultBackColor;
//处理直方图
this.histogramControl_colorSetting.UpdateVerticalBarWithOneScope((int)this.numericUpDown_colorAdjustmentRHU.Value, (int)this.numericUpDown_colorAdjustmentRHD.Value);
}
///
/// RGB/HLS的Button的G/L点击事件
///
///
///
private void button_colorAdjustmentGL_Click(object sender, EventArgs e)
{
this.HistogramRGBSelect = 2;
this.button_colorAdjustmentRH.FlatStyle = FlatStyle.Standard;
this.button_colorAdjustmentRH.BackColor = Control.DefaultBackColor;
this.button_colorAdjustmentRH.FlatAppearance.BorderColor = Control.DefaultBackColor;
this.button_colorAdjustmentGL.FlatStyle = FlatStyle.Flat;
this.button_colorAdjustmentGL.BackColor = Color.FromArgb(225, 225, 225);
this.button_colorAdjustmentGL.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
this.button_colorAdjustmentGL.FlatAppearance.BorderSize = 1;
this.button_colorAdjustmentBS.FlatStyle = FlatStyle.Standard;
this.button_colorAdjustmentBS.BackColor = Control.DefaultBackColor;
this.button_colorAdjustmentBS.FlatAppearance.BorderColor = Control.DefaultBackColor;
//处理直方图
this.histogramControl_colorSetting.UpdateVerticalBarWithOneScope((int)this.numericUpDown_colorAdjustmentGLU.Value, (int)this.numericUpDown_colorAdjustmentGLD.Value);
}
///
/// RGB/HLS的Button的B/S点击事件
///
///
///
private void button_colorAdjustmentBS_Click(object sender, EventArgs e)
{
this.HistogramRGBSelect = 3;
this.button_colorAdjustmentRH.FlatStyle = FlatStyle.Standard;
this.button_colorAdjustmentRH.BackColor = Control.DefaultBackColor;
this.button_colorAdjustmentRH.FlatAppearance.BorderColor = Control.DefaultBackColor;
this.button_colorAdjustmentGL.FlatStyle = FlatStyle.Standard;
this.button_colorAdjustmentGL.BackColor = Control.DefaultBackColor;
this.button_colorAdjustmentGL.FlatAppearance.BorderColor = Control.DefaultBackColor;
this.button_colorAdjustmentBS.FlatStyle = FlatStyle.Flat;
this.button_colorAdjustmentBS.BackColor = Color.FromArgb(225, 225, 225);
this.button_colorAdjustmentBS.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
this.button_colorAdjustmentBS.FlatAppearance.BorderSize = 1;
//处理直方图
this.histogramControl_colorSetting.UpdateVerticalBarWithOneScope((int)this.numericUpDown_colorAdjustmentBSU.Value, (int)this.numericUpDown_colorAdjustmentBSD.Value);
}
private void panel_colorGamut_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Color fColor = Color.FromArgb(Decimal.ToInt32(this.numericUpDown_colorAdjustmentRHU.Value), Decimal.ToInt32(this.numericUpDown_colorAdjustmentGLU.Value), Decimal.ToInt32(this.numericUpDown_colorAdjustmentBSU.Value));
Color tColor = Color.FromArgb(Decimal.ToInt32(this.numericUpDown_colorAdjustmentRHD.Value), Decimal.ToInt32(this.numericUpDown_colorAdjustmentGLD.Value), Decimal.ToInt32(this.numericUpDown_colorAdjustmentBSD.Value));
Brush b = new LinearGradientBrush(this.panel_colorGamut.ClientRectangle, fColor, tColor, LinearGradientMode.Horizontal);
g.FillRectangle(b, this.panel_colorGamut.ClientRectangle);
if (this.imageMat == null)
{
return;
}
Mat mat = this.imageMat.Clone();
Color c = this.panel_colorGamutPhase.BackColor;
for (int i = 0; i < mat.Height; i++)
{
for (int j = 0; j < mat.Width; j++)
{
Vec3b vec3b = mat.At(i, j);
if (this.numericUpDown_colorAdjustmentRHU.Value <= vec3b.Item2 &&
this.numericUpDown_colorAdjustmentRHD.Value >= vec3b.Item2 &&
this.numericUpDown_colorAdjustmentGLU.Value <= vec3b.Item1 &&
this.numericUpDown_colorAdjustmentGLD.Value >= vec3b.Item1 &&
this.numericUpDown_colorAdjustmentBSU.Value <= vec3b.Item0 &&
this.numericUpDown_colorAdjustmentBSD.Value >= vec3b.Item0)
{
mat.Set(i, j, new Vec3b(c.B, c.G, c.R));
}
}
}
if (this.documentWorkspace.phaseModels.Count > 1 && checkBox_showColorGamutPhase.Checked)
{
this.documentWorkspace.phaseModels[this.documentWorkspace.phaseModels.Count - 1].mat = mat;
}
this.documentWorkspace.Refresh();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
chooseK = this.comboBox1.SelectedIndex;
this.btn_statistics_Click(sender, e);
}
private void comboBox_rollingDirection_SelectedIndexChanged(object sender, EventArgs e)
{
this.methodOfAssessment.inclusionsStandard.globalSettings.rollingDirection = (InclusionsGlobalSettings.RollingDirection)this.comboBox_rollingDirection.SelectedIndex;
if (this.lstView_img.FocusedItem != null)
{
if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
{
everyImgData[this.lstView_img.FocusedItem.Index].directionIndex = this.comboBox_rollingDirection.SelectedIndex;
}
else
{
CurrentPageData data = new CurrentPageData(this.autoJiaoBen);
data.directionIndex = comboBox_rollingDirection.SelectedIndex;
data.ratio = numericUpDown_lwRatioLimit.Value;
everyImgData.Add(this.lstView_img.FocusedItem.Index, data);
}
}
}
private void histogramControl_colorSetting_DragOneEvent(object sender, EventArgs e)
{
if (this.HistogramRGBSelect == 1)
{
this.numericUpDown_colorAdjustmentRHU.Value = e.Data;
}
if (this.HistogramRGBSelect == 2)
{
this.numericUpDown_colorAdjustmentGLU.Value = e.Data;
}
if (this.HistogramRGBSelect == 3)
{
this.numericUpDown_colorAdjustmentBSU.Value = e.Data;
}
this.panel_colorGamut.Refresh();
}
private void histogramControl_colorSetting_DragTwoEvent(object sender, EventArgs e)
{
if (!button_colorAdjustmentRH.Focused && !button_colorAdjustmentGL.Focused && !button_colorAdjustmentBS.Focused)
{
MessageBox.Show("请选择颜色!");
return;
}
if (this.HistogramRGBSelect == 1)
{
this.numericUpDown_colorAdjustmentRHD.Value = e.Data;
}
if (this.HistogramRGBSelect == 2)
{
this.numericUpDown_colorAdjustmentGLD.Value = e.Data;
}
if (this.HistogramRGBSelect == 3)
{
this.numericUpDown_colorAdjustmentBSD.Value = e.Data;
}
this.panel_colorGamut.Refresh();
}
protected void colorSettingRadioButton(object sender, EventArgs e)
{
this.selectedColorOfInclusions = MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions[((RadioButton)sender).Name.Split('_')[1]];
CalcRGBOrHLSValue();
UpdateHistogramStartAndEnd();
if (this.lstView_img.FocusedItem != null)
{
if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
{
everyImgData[this.lstView_img.FocusedItem.Index].thisSelectedColorOfInclusions = this.selectedColorOfInclusions;
}
else
{
CurrentPageData data = new CurrentPageData(this.autoJiaoBen);
data.directionIndex = comboBox_rollingDirection.SelectedIndex;
data.ratio = numericUpDown_lwRatioLimit.Value;
data.thisSelectedColorOfInclusions = this.selectedColorOfInclusions;
everyImgData.Add(this.lstView_img.FocusedItem.Index, data);
}
}
}
private void btn_drawRecognitionArea_Click(object sender, EventArgs e)
{
this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.InclusionDrawRecognitionArea;
}
///
/// 自动阈值
///
///
///
private void checkBox_autoThreshold_CheckedChanged(object sender, EventArgs e)
{
bool check = ((CheckBox)sender).Checked;
this.methodOfAssessment.inclusionsStandard.globalSettings.autoThreshold = check;
//numericUpDown_threshold.Visible = !check;
}
private void documentWorkspace_panel_Click(object sender, EventArgs e)
{
System.Windows.Forms.MouseEventArgs me = (System.Windows.Forms.MouseEventArgs)e;
if (me.Button == MouseButtons.Left)
{
if (this.pickColorChecked)
{
if (this.imageMat == null)
{
return;
}
System.Drawing.Point pointscroll = this.documentWorkspace.GetScalePoint(me.Location);
Mat mat = this.imageMat.Clone();
Vec3b vec3b = mat.At(pointscroll.Y, pointscroll.X);
Color c = Color.FromArgb(vec3b.Item2, vec3b.Item1, vec3b.Item0);
this.selectedColorOfInclusions.setColor(c);
CalcRGBOrHLSValue();
UpdateHistogramStartAndEnd();
this.pickColorChecked = false;
this.documentWorkspace.Cursor = Cursors.Default;
this.button_pickColor.FlatStyle = FlatStyle.Standard;
this.button_pickColor.BackColor = Control.DefaultBackColor;
this.button_pickColor.FlatAppearance.BorderColor = Control.DefaultBackColor;
}
}
else
{
System.Drawing.Point pointscroll = this.documentWorkspace.GetScalePoint(((System.Windows.Forms.MouseEventArgs)e).Location);
for (int i = 0; i < this.documentWorkspace.GraphicsList.Count; i++)
{
DrawObject drawObject = this.documentWorkspace.GraphicsList[i];
if (drawObject.drawToolType == DrawToolType.InclusionSelect)
{
Inclusion inclusion = ((InclusionDrawObject)drawObject).inclusion;
if (inclusion.rectProfile.Contains(pointscroll))
{
string showText = "";
if (inclusion.shape == ParticleShape.Globular)
{
showText += PdnResources.GetString("Menu.diameter.text") + ":" + inclusion.diameter;
}
else
{
showText += PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text") + ":" + inclusion.physicalLength;
showText += "\n宽度:" + inclusion.physicalWidth;
}
showText += "\n面积:" + inclusion.area;
showText += "\n类型:" + inclusion.type.type;
showText += "\n化学特性:" + inclusion.chemicalCharacteristics;
this.toolTip_InclusionsDetails.Show(showText, (System.Windows.Forms.Control)sender);
}
}
}
}
}
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.selectedTypesOfInclusions = null;
this.selectedTypesOfInclusionsPoint = null;
this.selectedTypesOfInclusionsRectangle = null;
radioButton1.Enabled = true;
radioButton2.Enabled = true;
checkBox1.Enabled = true;
checkBox2.Enabled = true;
}
}
#endregion
#region 内部方法
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 || !this.bcBinaryChecked())
{
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 = this.documentWorkspace.phaseModels[0].mat.Clone();
List rectangles = new List();
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 (mat.At(i, j) == 0)
{
mat.Set(i, j, new Vec3b(255, 255, 255));
}
else
{
if (rectangles.Count == 0)
{
continue;
}
bool contains = false;
// 二值图过滤未选中区域
foreach (var item in rectangles)
{
if (item.Contains(j, i))
{
contains = true;
}
}
if (!contains)
{
mat.Set(i, j, new Vec3b(255, 255, 255));
}
}
}
}
// 找出正方形视场
List rectangleF = new List();
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 = Convert.ToInt32(this.comboBox1.SelectedItem);
var rollingDirection = (InclusionsGlobalSettings.RollingDirection)this.comboBox_rollingDirection.SelectedIndex;
AnalysisResult report;
if (this.radioButton3.Checked)
{
report = this.methodOfAssessment.generateReport(this.imageMat.Clone(), mat, rectangleF, isK, this.viewNum, k, this.is_full, rollingDirection);
}
else {
bool isNew = this.radioButton5.Checked ? true : false;
report = this.methodOfAssessment.NewGenerateReport(this.imageMat.Clone(), mat, rectangleF, isK, this.viewNum, k, this.is_full, rollingDirection, isNew);
}
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);
}
private void Panel_Paint(object sender, PaintEventArgs e)
{
if (isK == 2)
{
return;
}
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 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 buildAnalysisResults(DocumentWorkspace workspace, AnalysisResult analysisResult)
{
List listViews = new List();
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;
}
#region [二值化相关方法]
///
/// 添加参数改变的监听
///
///
///
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();
}
///
/// 参数改变时,重新处理图像
///
///
///
private void bClassBinaryImplFinishAction(object sender, EventArgs e)
{
if (!bcOriginChecked())
{
if (bcBinaryChecked())
{
if (this.isK == 1)
{
this.documentWorkspace.ActiveTool = DrawToolType.InclusionSelectRecognitionArea;
this.documentWorkspace.Cursor = Cursors.Default;
}
}
else
{
if (this.isK == 1)
{
this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
}
}
}
else
{
if (this.isK == 1)
{
this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
}
}
this.documentWorkspace.Refresh();
}
private bool bcBinaryChecked()
{
return bc != null && bc.BinaryChecked;
}
private bool bcOriginChecked()
{
return bc != null && bc.OriginChecked;
}
///
/// 显示原图/原图+二值图
///
///
///
private void bcOriginCheckedChanged(object sender, EventArgs e)
{
if (!bcOriginChecked())
{
if (bcBinaryChecked())
{
this.documentWorkspace.PhaseModels[0].choise = true;
if (this.isK == 1)
{
this.documentWorkspace.ActiveTool = DrawToolType.InclusionSelectRecognitionArea;
this.documentWorkspace.Cursor = Cursors.Default;
}
}
}
else
{
this.documentWorkspace.PhaseModels[0].choise = false;
if (this.isK == 1)
{
this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
}
}
this.documentWorkspace.Refresh();
}
#endregion [二值化相关方法]
private void buildListView_analysisResult()
{
List conclusions = new List();
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 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();
}
private void inclusionEditDialogCloseCallback()
{
if (this.tempAnalysisResult.segmentationView != 2)
{
ToolInclusionSelect.CleanAndDrawInclusionAll(this.documentWorkspace, this.tempAnalysisResult.inclusions, is_showRectangle, is_showOval, is_full);
}
else
{
this.documentWorkspace.Refresh();
}
}
private void UpdateHistogramStartAndEnd()
{
if (this.HistogramRGBSelect == 1)
{
this.histogramControl_colorSetting.UpdateVerticalBarWithOneScope((int)this.numericUpDown_colorAdjustmentRHU.Value, (int)this.numericUpDown_colorAdjustmentRHD.Value);
}
if (this.HistogramRGBSelect == 2)
{
this.histogramControl_colorSetting.UpdateVerticalBarWithOneScope((int)this.numericUpDown_colorAdjustmentGLU.Value, (int)this.numericUpDown_colorAdjustmentGLD.Value);
}
if (this.HistogramRGBSelect == 3)
{
this.histogramControl_colorSetting.UpdateVerticalBarWithOneScope((int)this.numericUpDown_colorAdjustmentBSU.Value, (int)this.numericUpDown_colorAdjustmentBSD.Value);
}
}
private void CalcRGBOrHLSValue()
{
this.numericUpDown_colorAdjustmentRHU.ValueChanged -= new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentRHD.ValueChanged -= new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentGLU.ValueChanged -= new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentGLD.ValueChanged -= new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentBSU.ValueChanged -= new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentBSD.ValueChanged -= new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentRHU.KeyUp -= new KeyEventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentRHD.KeyUp -= new KeyEventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentGLU.KeyUp -= new KeyEventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentGLD.KeyUp -= new KeyEventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentBSU.KeyUp -= new KeyEventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentBSD.KeyUp -= new KeyEventHandler(this.RGBoRHLSValue_Changed);
if (this.radioButton_checkedRGB.Checked)
{
this.numericUpDown_colorAdjustmentRHU.Value = this.selectedColorOfInclusions.rd;
this.numericUpDown_colorAdjustmentRHD.Value = this.selectedColorOfInclusions.ru;
this.numericUpDown_colorAdjustmentGLU.Value = this.selectedColorOfInclusions.gd;
this.numericUpDown_colorAdjustmentGLD.Value = this.selectedColorOfInclusions.gu;
this.numericUpDown_colorAdjustmentBSU.Value = this.selectedColorOfInclusions.bd;
this.numericUpDown_colorAdjustmentBSD.Value = this.selectedColorOfInclusions.bu;
}
else
{
Vec3b rgbd = new Vec3b();
Vec3b rgbu = new Vec3b();
rgbd[2] = Decimal.ToByte(this.numericUpDown_colorAdjustmentRHU.Value);
rgbu[2] = Decimal.ToByte(this.numericUpDown_colorAdjustmentRHD.Value);
rgbd[1] = Decimal.ToByte(this.numericUpDown_colorAdjustmentGLU.Value);
rgbu[1] = Decimal.ToByte(this.numericUpDown_colorAdjustmentGLD.Value);
rgbd[0] = Decimal.ToByte(this.numericUpDown_colorAdjustmentBSU.Value);
rgbu[0] = Decimal.ToByte(this.numericUpDown_colorAdjustmentBSD.Value);
double hd, ld, sd, hu, lu, su;
BaseTools.RGBtoHLS(rgbd, out hd, out ld, out sd);
BaseTools.RGBtoHLS(rgbu, out hu, out lu, out su);
this.numericUpDown_colorAdjustmentRHD.Value = new Decimal(hd);
this.numericUpDown_colorAdjustmentRHU.Value = new Decimal(hu);
this.numericUpDown_colorAdjustmentGLD.Value = new Decimal(ld);
this.numericUpDown_colorAdjustmentGLU.Value = new Decimal(lu);
this.numericUpDown_colorAdjustmentBSD.Value = new Decimal(sd);
this.numericUpDown_colorAdjustmentBSU.Value = new Decimal(su);
}
this.numericUpDown_colorAdjustmentRHU.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentRHD.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentGLU.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentGLD.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentBSU.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentBSD.ValueChanged += new System.EventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentRHU.KeyUp += new KeyEventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentRHD.KeyUp += new KeyEventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentGLU.KeyUp += new KeyEventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentGLD.KeyUp += new KeyEventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentBSU.KeyUp += new KeyEventHandler(this.RGBoRHLSValue_Changed);
this.numericUpDown_colorAdjustmentBSD.KeyUp += new KeyEventHandler(this.RGBoRHLSValue_Changed);
this.panel_colorGamut.Refresh();
}
///
/// 修改当前model的rgb或hls
///
private void SetPhaseModelRGBOrHLS()
{
if (this.radioButton_checkedRGB.Checked)
{
if (this.selectedColorOfInclusions != null)
{
this.selectedColorOfInclusions.rd = Decimal.ToByte(this.numericUpDown_colorAdjustmentRHU.Value);
this.selectedColorOfInclusions.ru = Decimal.ToByte(this.numericUpDown_colorAdjustmentRHD.Value);
this.selectedColorOfInclusions.gd = Decimal.ToByte(this.numericUpDown_colorAdjustmentGLU.Value);
this.selectedColorOfInclusions.gu = Decimal.ToByte(this.numericUpDown_colorAdjustmentGLD.Value);
this.selectedColorOfInclusions.bd = Decimal.ToByte(this.numericUpDown_colorAdjustmentBSU.Value);
this.selectedColorOfInclusions.bu = Decimal.ToByte(this.numericUpDown_colorAdjustmentBSD.Value);
}
}
else
{
Vec3b rgbd = BaseTools.HLStoRGB(Decimal.ToDouble(this.numericUpDown_colorAdjustmentRHU.Value), Decimal.ToDouble(this.numericUpDown_colorAdjustmentGLU.Value), Decimal.ToDouble(this.numericUpDown_colorAdjustmentBSU.Value));
Vec3b rgbu = BaseTools.HLStoRGB(Decimal.ToDouble(this.numericUpDown_colorAdjustmentRHD.Value), Decimal.ToDouble(this.numericUpDown_colorAdjustmentGLD.Value), Decimal.ToDouble(this.numericUpDown_colorAdjustmentBSD.Value));
this.selectedColorOfInclusions.rd = rgbd[2];
this.selectedColorOfInclusions.ru = rgbu[2];
this.selectedColorOfInclusions.gd = rgbd[1];
this.selectedColorOfInclusions.gu = rgbu[1];
this.selectedColorOfInclusions.bd = rgbd[0];
this.selectedColorOfInclusions.bu = rgbu[0];
}
if (this.lstView_img.FocusedItem != null)
{
if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
{
everyImgData[this.lstView_img.FocusedItem.Index].thisSelectedColorOfInclusions = this.selectedColorOfInclusions;
}
else
{
CurrentPageData data = new CurrentPageData(this.autoJiaoBen);
data.directionIndex = comboBox_rollingDirection.SelectedIndex;
data.ratio = numericUpDown_lwRatioLimit.Value;
data.thisSelectedColorOfInclusions = this.selectedColorOfInclusions;
everyImgData.Add(this.lstView_img.FocusedItem.Index, data);
}
}
}
private void button_pickColor_Click(object sender, EventArgs e)
{
//this.checkBox_showBinary.Checked = false;
this.documentWorkspace.Cursor = new Cursor(PdnResources.GetResourceStream("Cursors.ColorPickerToolCursor.cur"));
this.pickColorChecked = true;
this.button_pickColor.FlatStyle = FlatStyle.Flat;
this.button_pickColor.BackColor = Color.FromArgb(225, 225, 225);
this.button_pickColor.FlatAppearance.BorderColor = Color.FromArgb(0, 120, 215);
this.button_pickColor.FlatAppearance.BorderSize = 1;
}
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_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
Dictionary tagInfos = new Dictionary();
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>> sheets = new List>>();
sheets.Add(new List>());
List> contentList = new List>();
List contentHead = new List();
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 contentBody = new List();
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());
contentHead = new List();
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 contentBody = new List();
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> inclusionList = new List>();
List inclusionHead = new List();
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");
if (this.isK == 1)
{
inclusionHead.Add("fieldNumber");
inclusionHead.Add("fieldLeftLimit");
inclusionHead.Add("fieldRightLimit");
inclusionHead.Add("fieldTopLimit");
inclusionHead.Add("fieldBottomLimit");
inclusionHead.Add("rating");
}
foreach (var analysisResult in this.analysisResults.Values)
{
foreach (var inclusion in analysisResult.inclusions)
{
List inclusionBody = new List();
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 + "");
if (this.isK == 1)
{
inclusionBody.Add(inclusion.viewNum + "");
inclusionBody.Add(inclusion.viewLeft + "");
inclusionBody.Add(inclusion.viewRight + "");
inclusionBody.Add(inclusion.viewTop + "");
inclusionBody.Add(inclusion.viewBottom + "");
inclusionBody.Add(inclusion.rating + "");
}
}
}
sheets.Add(inclusionList);
List bitList = new List();
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") + "!");
}
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 list = new List();
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");
if (this.isK == 1)
{
dtb2.Columns.Add("rating");
}
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 + "");
if (this.isK == 1)
{
dataRow[15] = (inclusion.rating + "");
dataRow[8] = (inclusion.areaK + "");
}
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);
}
}
#endregion
#region 需继承方法
protected virtual void SubclassInitialize()
{
throw new NotImplementedException();
}
protected virtual MethodOfAssessment getMethodOfAssessment()
{
throw new NotImplementedException();
}
protected virtual void initColorSetting()
{
throw new NotImplementedException();
}
protected virtual void initDisplaySetting()
{
throw new NotImplementedException();
}
protected virtual void getInclusionParameters()
{
}
protected virtual void saveInclusionParameters()
{
}
protected virtual void getOldCheck()
{
}
#endregion
#region 内部类
internal class CurrentPageData
{
public CurrentPageData(int isYuanshi)
{
if (isYuanshi == -1)
{
kNum = 4;
}
else
{
kNum = isYuanshi;
}
}
public int directionIndex { get; set; }
public decimal ratio { get; set; }
public ColorOfInclusions thisSelectedColorOfInclusions { get; set; }
public bool colorCheck { get; set; }
public int kNum { get; set; }
}
internal class LocalListViewItem
{
public DocumentWorkspace Value { get; }
public string Display { get; }
public LocalListViewItem(DocumentWorkspace Value, string Display)
{
this.Value = Value;
this.Display = Display;
}
}
internal class DocumentItem
{
public Mat imageMat;
public GraphicsList graphicsList;
public List phaseModels;
public AnalysisResult analysisResult;
public DocumentItem(Mat imageMat, GraphicsList graphicsList, List phaseModels)
{
this.imageMat = imageMat;
this.graphicsList = graphicsList;
this.phaseModels = phaseModels;
}
}
#endregion
private void domainUpDown_resultPrecision_SelectedItemChanged(object sender, EventArgs e)
{
buildListView_analysisResult();
}
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_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
Dictionary tagInfos = new Dictionary();
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> contentList = new List>();
List contentHead = new List();
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 contentBody = new List();
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());
contentHead = new List();
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 contentBody = new List();
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 bitList = new List();
List exportModel = new List();
foreach (var itemIt in this.listBox_analysisResult.CheckedItems)
{
List> inclusionList = new List>();
List inclusionHead = new List();
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");
if (this.isK == 1)
{
inclusionHead.Add("fieldNumber");
inclusionHead.Add("fieldLeftLimit");
inclusionHead.Add("fieldRightLimit");
inclusionHead.Add("fieldTopLimit");
inclusionHead.Add("fieldBottomLimit");
inclusionHead.Add("rating");
}
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 inclusionBody = new List();
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 + "");
if (this.isK == 1)
{
inclusionBody.Add(inclusion.areaK + "");
}
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 + "");
if (this.isK == 1)
{
inclusionBody.Add(inclusion.viewNum + "");
inclusionBody.Add(inclusion.viewLeft + "");
inclusionBody.Add(inclusion.viewRight + "");
inclusionBody.Add(inclusion.viewTop + "");
inclusionBody.Add(inclusion.viewBottom + "");
inclusionBody.Add(inclusion.rating + "");
}
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);
}
}
private void button2_Click(object sender, EventArgs e)
{
new InclusionViewSetting(this.viewNum, this.inclusionViewSettingCloseCallback).ShowDialog();
}
private void inclusionViewSettingCloseCallback(int num)
{
this.viewNum = num;
}
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();
}
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);
}
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();
}
}
private void InclusionsStandardDialog_FormClosing(object sender, FormClosingEventArgs e)
{
binaryClass.saveParams();
}
private void ShownChoiseItemAndInitData(object sender, EventArgs e)
{
}
private void getLastData()
{
string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterInclusionsModel.xml";
var text = this.dialogText;
if (!System.IO.File.Exists(filePath))
{
inclusionsModel.InclusionParameters = new List();
string[] textList = new string[] { "GBT10561_MethodA", "GBT10561_MethodB", "EN10247_MethodP", "EN10247_MethodM", "EN10247_MethodK", "ISO4967_MethodA",
"ISO4967_MethodB","JISG0555_MethodA","JISG0555_MethodB","DIN50602_1985_MethodM","DIN50602_1985_MethodK","ASTME45_MethodA","ASTME45_MethodB",
"ASTME45_MethodC","ASTME45_MethodD","ASTME45_MethodE"};
for (int i = 0; i < textList.Count(); i++)
{
var inclusionParameters = new InclusionsModel.InclusionParameter();
inclusionParameters.hasUsed = false;
inclusionParameters.name = textList[i];
inclusionsModel.InclusionParameters.Add(inclusionParameters);
}
this.thisParametersIndex = textList.ToList().IndexOf(text);
this.thisParameters = inclusionsModel.InclusionParameters[this.thisParametersIndex];
string porosityInfoXml = XmlSerializeHelper.XmlSerialize(inclusionsModel);
Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
}
else
{
inclusionsModel = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
if (inclusionsModel.InclusionParameters == null)
{
inclusionsModel.InclusionParameters = new List();
}
thisParameters = inclusionsModel.InclusionParameters.Where(m => m.name.Equals(text)).FirstOrDefault();
if (thisParameters == null)
{
thisParameters = new InclusionsModel.InclusionParameter();
thisParameters.hasUsed = false;
thisParameters.name = text;
inclusionsModel.InclusionParameters.Add(thisParameters);
this.thisParametersIndex = inclusionsModel.InclusionParameters.Count() - 1;
string porosityInfoXml = XmlSerializeHelper.XmlSerialize(inclusionsModel);
Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
}
else
{
this.thisParametersIndex = inclusionsModel.InclusionParameters.IndexOf(thisParameters);
if (thisParameters.hasUsed)
{
if (thisParameters.parameter1 >= 0)
{
comboBox_rollingDirection.SelectedIndex = thisParameters.parameter1;
}
if (thisParameters.parameter2 >= numericUpDown_lwRatioLimit.Minimum)
{
numericUpDown_lwRatioLimit.Value = thisParameters.parameter2;
}
if (thisParameters.parameter14 >= 0)
{
comboBox1.SelectedIndex = thisParameters.parameter14;
}
checkBox_showColorGamutPhase.Checked = thisParameters.parameter5;
domainUpDown_resultPrecision.SelectedIndex = thisParameters.parameter13;
this.viewNum = thisParameters.parameter16;
checkBox_generateReport_opensetting.Checked = thisParameters.parameter17;
radioButton1.Checked = thisParameters.parameter18 == 0 ? true : false;
radioButton2.Checked = thisParameters.parameter18 == 0 ? false : true;
if (radioButton1.Checked)
{
this.is_full = 2;
}
else
{
this.is_full = 1;
}
checkBox2.Checked = thisParameters.parameter19;
is_showRectangle = thisParameters.parameter19;
checkBox1.Checked = thisParameters.parameter20;
is_showOval = thisParameters.parameter20;
if (thisParameters.parameter3 > 0)
{
this.whichChecked = thisParameters.parameter3;
getInclusionParameters();
switch (thisParameters.parameter3)
{
case 1:
if (thisParameters.parameter15 != null && thisParameters.parameter15.Count > 0)
{
this.numericUpDown_colorAdjustmentRHU.Value = thisParameters.parameter15[0].parameter7;
this.numericUpDown_colorAdjustmentRHD.Value = thisParameters.parameter15[0].parameter8;
this.numericUpDown_colorAdjustmentGLU.Value = thisParameters.parameter15[0].parameter9;
this.numericUpDown_colorAdjustmentGLD.Value = thisParameters.parameter15[0].parameter10;
this.numericUpDown_colorAdjustmentBSU.Value = thisParameters.parameter15[0].parameter11;
this.numericUpDown_colorAdjustmentBSD.Value = thisParameters.parameter15[0].parameter12;
}
break;
case 2:
if (thisParameters.parameter15 != null && thisParameters.parameter15.Count > 1)
{
this.numericUpDown_colorAdjustmentRHU.Value = thisParameters.parameter15[1].parameter7;
this.numericUpDown_colorAdjustmentRHD.Value = thisParameters.parameter15[1].parameter8;
this.numericUpDown_colorAdjustmentGLU.Value = thisParameters.parameter15[1].parameter9;
this.numericUpDown_colorAdjustmentGLD.Value = thisParameters.parameter15[1].parameter10;
this.numericUpDown_colorAdjustmentBSU.Value = thisParameters.parameter15[1].parameter11;
this.numericUpDown_colorAdjustmentBSD.Value = thisParameters.parameter15[1].parameter12;
}
break;
case 3:
if (thisParameters.parameter15 != null && thisParameters.parameter15.Count > 2)
{
this.numericUpDown_colorAdjustmentRHU.Value = thisParameters.parameter15[2].parameter7;
this.numericUpDown_colorAdjustmentRHD.Value = thisParameters.parameter15[2].parameter8;
this.numericUpDown_colorAdjustmentGLU.Value = thisParameters.parameter15[2].parameter9;
this.numericUpDown_colorAdjustmentGLD.Value = thisParameters.parameter15[2].parameter10;
this.numericUpDown_colorAdjustmentBSU.Value = thisParameters.parameter15[2].parameter11;
this.numericUpDown_colorAdjustmentBSD.Value = thisParameters.parameter15[2].parameter12;
}
break;
case 4:
if (thisParameters.parameter15 != null && thisParameters.parameter15.Count > 3)
{
this.numericUpDown_colorAdjustmentRHU.Value = thisParameters.parameter15[3].parameter7;
this.numericUpDown_colorAdjustmentRHD.Value = thisParameters.parameter15[3].parameter8;
this.numericUpDown_colorAdjustmentGLU.Value = thisParameters.parameter15[3].parameter9;
this.numericUpDown_colorAdjustmentGLD.Value = thisParameters.parameter15[3].parameter10;
this.numericUpDown_colorAdjustmentBSU.Value = thisParameters.parameter15[3].parameter11;
this.numericUpDown_colorAdjustmentBSD.Value = thisParameters.parameter15[3].parameter12;
}
break;
}
button_colorAdjustmentRH.Focus();
CalcRGBOrHLSValue();
UpdateHistogramStartAndEnd();
}
}
}
}
if (this.selectedColorOfInclusions != null)
{
ColorOfInclusions colorOfInclusions = new ColorOfInclusions(this.selectedColorOfInclusions.colorName, this.selectedColorOfInclusions.ofTypes, this.selectedColorOfInclusions.ru, this.selectedColorOfInclusions.rd, this.selectedColorOfInclusions.gu, this.selectedColorOfInclusions.gd, this.selectedColorOfInclusions.bu, this.selectedColorOfInclusions.bd);
this.oldSelectedColorOfInclusions = colorOfInclusions;
}
}
private void saveLastData(object sender, EventArgs e)
{
if (this.thisParametersIndex == -1)
{
return;
}
binaryClass.saveParams();
this.thisParameters.hasUsed = true;
if (comboBox_rollingDirection.SelectedIndex >= 0)
{
thisParameters.parameter1 = comboBox_rollingDirection.SelectedIndex;
}
comboBox_rollingDirection.SelectedIndex = thisParameters.parameter1;
thisParameters.parameter2 = numericUpDown_lwRatioLimit.Value;
if (comboBox1.SelectedIndex >= 0)
{
thisParameters.parameter14 = comboBox1.SelectedIndex;
}
thisParameters.parameter5 = checkBox_showColorGamutPhase.Checked;
this.thisParameters.parameter13 = domainUpDown_resultPrecision.SelectedIndex;
this.thisParameters.parameter16 = this.viewNum;
thisParameters.parameter17 = checkBox_generateReport_opensetting.Checked;
if (radioButton1.Checked)
{
thisParameters.parameter18 = 0;
}
else if (radioButton2.Checked)
{
thisParameters.parameter18 = 1;
}
thisParameters.parameter19 = checkBox2.Checked;
thisParameters.parameter20 = checkBox1.Checked;
saveInclusionParameters();
this.thisParameters.parameter15 = new List();
for (int i = 0; i <= 3; i++)
{
var num = new InclusionsModel.InclusionParameter.rgbNum();
num.parameter7 = 0;
num.parameter8 = 0;
num.parameter9 = 0;
num.parameter10 = 0;
num.parameter11 = 0;
num.parameter12 = 0;
this.thisParameters.parameter15.Add(num);
}
foreach (var item in MethodOfAssessment.activeMethod.inclusionsStandard.globalSettings.colorOfInclusions)
{
switch (item.Key)
{
case "Black":
this.thisParameters.parameter15[0].parameter7 = item.Value.rd;
this.thisParameters.parameter15[0].parameter8 = item.Value.ru;
this.thisParameters.parameter15[0].parameter9 = item.Value.gd;
this.thisParameters.parameter15[0].parameter10 = item.Value.gu;
this.thisParameters.parameter15[0].parameter11 = item.Value.bd;
this.thisParameters.parameter15[0].parameter12 = item.Value.bu;
break;
case "LightBlue":
this.thisParameters.parameter15[1].parameter7 = item.Value.rd;
this.thisParameters.parameter15[1].parameter8 = item.Value.ru;
this.thisParameters.parameter15[1].parameter9 = item.Value.gd;
this.thisParameters.parameter15[1].parameter10 = item.Value.gu;
this.thisParameters.parameter15[1].parameter11 = item.Value.bd;
this.thisParameters.parameter15[1].parameter12 = item.Value.bu;
break;
case "Colored":
this.thisParameters.parameter15[1].parameter7 = item.Value.rd;
this.thisParameters.parameter15[1].parameter8 = item.Value.ru;
this.thisParameters.parameter15[1].parameter9 = item.Value.gd;
this.thisParameters.parameter15[1].parameter10 = item.Value.gu;
this.thisParameters.parameter15[1].parameter11 = item.Value.bd;
this.thisParameters.parameter15[1].parameter12 = item.Value.bu;
break;
case "Gray":
this.thisParameters.parameter15[2].parameter7 = item.Value.rd;
this.thisParameters.parameter15[2].parameter8 = item.Value.ru;
this.thisParameters.parameter15[2].parameter9 = item.Value.gd;
this.thisParameters.parameter15[2].parameter10 = item.Value.gu;
this.thisParameters.parameter15[2].parameter11 = item.Value.bd;
this.thisParameters.parameter15[2].parameter12 = item.Value.bu;
break;
case "DarkGray":
this.thisParameters.parameter15[3].parameter7 = item.Value.rd;
this.thisParameters.parameter15[3].parameter8 = item.Value.ru;
this.thisParameters.parameter15[3].parameter9 = item.Value.gd;
this.thisParameters.parameter15[3].parameter10 = item.Value.gu;
this.thisParameters.parameter15[3].parameter11 = item.Value.bd;
this.thisParameters.parameter15[3].parameter12 = item.Value.bu;
break;
}
}
this.inclusionsModel.InclusionParameters[this.thisParametersIndex] = this.thisParameters;
string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterInclusionsModel.xml";
string porosityInfoXml = XmlSerializeHelper.XmlSerialize(inclusionsModel);
Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
#region [开启脚本录制]
if (appWorkspace.startScriptRecording)
{
getScriptRecording();
}
#endregion
}
///
/// 应用到全部
///
///
///
private void button4_Click(object sender, EventArgs e)
{
if (this.lstView_img.FocusedItem == null)
{
return;
}
binaryClass.saveParams();
binaryClass.applyToAll(this.imageList_img.Images.Keys, this.imageList_img.Images.Keys[this.lstView_img.FocusedItem.Index]);
userAll = true;
resultList.Clear();
hasResultIndexList.Clear();
var data = new CurrentPageData(this.autoJiaoBen);
var firstIndex = this.lstView_img.FocusedItem.Index;
if (everyImgData.ContainsKey(this.lstView_img.FocusedItem.Index))
{
data = everyImgData[this.lstView_img.FocusedItem.Index];
}
for (int i = 0; i < lstView_img.Items.Count; i++)
{
this.lstView_img.EnsureVisible(i);
this.lstView_img.Items[i].Focused = true;
this.lstView_img.Items[i].Selected = true;
if (everyImgData.ContainsKey(i))
{
everyImgData[i] = data;
}
else
{
everyImgData.Add(i, data);
}
if ((i == 0 && lstView_img.Items.Count == 1) || firstIndex == 0)
{
this.startStatistics();
}
}
#region [给最后一张图赋值]
if (data.thisSelectedColorOfInclusions != null)
{
this.colorName = data.thisSelectedColorOfInclusions.colorName;
getOldCheck();
this.selectedColorOfInclusions = data.thisSelectedColorOfInclusions;
CalcRGBOrHLSValue();
UpdateHistogramStartAndEnd();
}
else
{
if (this.oldSelectedColorOfInclusions != null)
{
this.colorName = this.oldSelectedColorOfInclusions.colorName;
getOldCheck();
this.selectedColorOfInclusions = new ColorOfInclusions(this.oldSelectedColorOfInclusions.colorName, this.oldSelectedColorOfInclusions.ofTypes, this.oldSelectedColorOfInclusions.ru, this.oldSelectedColorOfInclusions.rd, this.oldSelectedColorOfInclusions.gu, this.oldSelectedColorOfInclusions.gd, this.oldSelectedColorOfInclusions.bu, this.oldSelectedColorOfInclusions.bd);
data.thisSelectedColorOfInclusions = this.selectedColorOfInclusions;
CalcRGBOrHLSValue();
UpdateHistogramStartAndEnd();
}
}
comboBox1.SelectedIndex = data.kNum;
if (data.directionIndex >= 0)
{
comboBox_rollingDirection.SelectedIndex = data.directionIndex;
}
if (data.ratio >= numericUpDown_lwRatioLimit.Minimum)
{
numericUpDown_lwRatioLimit.Value = data.ratio;
}
checkBox_showColorGamutPhase.Checked = data.colorCheck;
#endregion
radioButton1.Enabled = true;
radioButton2.Enabled = true;
checkBox1.Enabled = true;
checkBox2.Enabled = true;
}
///
/// 保存到全部
///
///
///
private void button3_Click(object sender, EventArgs e)
{
if (this.lstView_img.FocusedItem == null)
{
return;
}
if (resultList.Count() == 0)
{
MessageBox.Show(PdnResources.GetString("Menu.PleaseClickApplyAllFirst.text") +"!");
return;
}
if (listBox_analysisResult.Items.Count > 0)
{
if (MessageBox.Show(PdnResources.GetString("Menu.Theresuethertoreplace.text") + "?", "", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
{
for (int i = 0; i < resultList.Count(); i++)
{
if (analysisResults.ContainsKey(this.appWorkspace.DocumentWorkspaces[i]))
{
continue;
}
else
{
analysisResults.Add(this.appWorkspace.DocumentWorkspaces[i], resultList[i]);
}
buildListBox_analysisResult();
}
return;
}
}
for (int i = 0; i < resultList.Count(); i++)
{
if (analysisResults.ContainsKey(this.appWorkspace.DocumentWorkspaces[i]))
{
analysisResults[this.appWorkspace.DocumentWorkspaces[i]] = resultList[i];
}
else
{
analysisResults.Add(this.appWorkspace.DocumentWorkspaces[i], resultList[i]);
}
buildListBox_analysisResult();
}
}
private void allCheck()
{
if (listBox_analysisResult.Items != null && listBox_analysisResult.Items.Count > 0)
{
for (int i = 0; i < listBox_analysisResult.Items.Count; i++)
{
listBox_analysisResult.SetItemChecked(i, true);
}
buildListView_analysisResult();
}
}
private void getValue(string key, Object value)
{
switch (key)
{
case "parameter1":
comboBox_rollingDirection.SelectedIndex = (int)value;
break;
case "parameter2":
numericUpDown_lwRatioLimit.Value = Convert.ToDecimal(value);
break;
case "parameter5":
checkBox_showColorGamutPhase.Checked = Convert.ToBoolean(value);
break;
case "parameter17":
checkBox_generateReport_opensetting.Checked = Convert.ToBoolean(value);
break;
case "parameter18":
radioButton1.Checked = (int)value == 1 ? true : false;
radioButton2.Checked = (int)value == 1 ? false : true;
if (radioButton1.Checked)
{
this.is_full = 2;
}
else
{
this.is_full = 1;
}
break;
case "parameter19":
checkBox2.Checked = Convert.ToBoolean(value);
is_showRectangle = Convert.ToBoolean(value);
break;
case "parameter20":
checkBox1.Checked = Convert.ToBoolean(value);
is_showOval = Convert.ToBoolean(value);
break;
case "scopeR":
List redlist = (List)value;
if (rgbDict.ContainsKey("red"))
{
rgbDict["red"] = redlist;
}
else
{
rgbDict.Add("red", redlist);
}
break;
case "scopeG":
List greenlist = (List)value;
if (rgbDict.ContainsKey("green"))
{
rgbDict["green"] = greenlist;
}
else
{
rgbDict.Add("green", greenlist);
}
break;
case "scopeB":
List bluelist = (List)value;
if (rgbDict.ContainsKey("blue"))
{
rgbDict["blue"] = bluelist;
}
else
{
rgbDict.Add("blue", bluelist);
}
break;
case "parameter3":
this.whichChecked = (int)value;
getInclusionParameters();
this.numericUpDown_colorAdjustmentRHU.Value = (decimal)rgbDict["red"][0];
this.numericUpDown_colorAdjustmentRHD.Value = (decimal)rgbDict["red"][1];
this.numericUpDown_colorAdjustmentGLU.Value = (decimal)rgbDict["green"][0];
this.numericUpDown_colorAdjustmentGLD.Value = (decimal)rgbDict["green"][1];
this.numericUpDown_colorAdjustmentBSU.Value = (decimal)rgbDict["blue"][0];
this.numericUpDown_colorAdjustmentBSD.Value = (decimal)rgbDict["blue"][1];
CalcRGBOrHLSValue();
UpdateHistogramStartAndEnd();
break;
case "OpenWhileExportReport":
checkBox_generateReport_opensetting.Checked = Convert.ToBoolean(value);
break;
case "CalculatorDecimalDigits":
this.domainUpDown_resultPrecision.TabIndex = (int)value;
this.domainUpDown_resultPrecision.Text = value.ToString();
break;
case "ExportResults":
isExportResults = Convert.ToBoolean(value);
break;
case "ExportReports":
isExportReports = Convert.ToBoolean(value);
break;
case "ExportProjects":
isExportProjects = Convert.ToBoolean(value);
break;
case "parameter14":
this.comboBox1.SelectedItem = (Convert.ToInt32(value) - 4).ToString();
this.autoJiaoBen = this.comboBox1.SelectedIndex;
break;
case "viewNum":
this.viewNum = Convert.ToInt32(value);
break;
}
}
///
/// 不可点击空白区域
///
///
///
private void listView1_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (lstView_img.SelectedItems.Count > 0)
{
}
else if (lstView_img.SelectedItems.Count <= 0)//点击空白区
{
if (this.lstView_img.FocusedItem != null)
{
ListViewItem item = this.lstView_img.GetItemAt(e.X, e.Y);
if (item == null)
{
this.lstView_img.FocusedItem.Selected = true;
}
}
}
}
}
#region [脚本录制]
private void getScriptRecording()
{
string className = InvariantData.path_Action + ".Action" + menuId;
ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
List args = param.Lists;
foreach (var item in args)
{
item.value = setScriptRecording(item.key);
}
//找出二值相关参数 进行赋值
List isNullList = args.Where(m => m.value == null).ToList();
foreach (var item in isNullList)
{
item.value = binaryClass.setScriptRecording(item.key);
}
appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
}
private object setScriptRecording(string key)
{
object value = null;
switch (key)
{
case "parameter1":
value = comboBox_rollingDirection.SelectedIndex;
break;
case "parameter2":
value = numericUpDown_lwRatioLimit.Value;
break;
case "parameter5":
value = checkBox_showColorGamutPhase.Checked;
break;
case "parameter17":
value = checkBox_generateReport_opensetting.Checked;
break;
case "parameter18":
value = radioButton1.Checked ? 1 : 2;
break;
case "parameter19":
value = checkBox2.Checked;
break;
case "parameter20":
value = checkBox1.Checked;
break;
case "scopeR":
value = new List() { (double)this.numericUpDown_colorAdjustmentRHU.Value, (double)this.numericUpDown_colorAdjustmentRHD.Value };
break;
case "scopeG":
value = new List() { (double)this.numericUpDown_colorAdjustmentGLU.Value, (double)this.numericUpDown_colorAdjustmentGLD.Value };
break;
case "scopeB":
value = new List() { (double)this.numericUpDown_colorAdjustmentBSU.Value, (double)this.numericUpDown_colorAdjustmentBSD.Value };
break;
case "parameter3":
value = thisParameters.parameter3;
break;
case "OpenWhileExportReport":
value = checkBox_generateReport_opensetting.Checked;
break;
case "CalculatorDecimalDigits":
value = this.domainUpDown_resultPrecision.SelectedItem;
break;
case "ExportResults":
value = isExportResults;
break;
case "ExportReports":
value = isExportReports;
break;
case "ExportProjects":
value = isExportProjects;
break;
case "parameter14":
value = this.comboBox1.SelectedItem;
break;
case "viewNum":
value = this.viewNum;
break;
}
return value;
}
#endregion
}
}