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