123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537 |
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Windows.Forms;
- using GroupBox = System.Windows.Forms.GroupBox;
- using CheckBox = System.Windows.Forms.CheckBox;
- using Button = System.Windows.Forms.Button;
- using System.Data;
- namespace PaintDotNet.DedicatedAnalysis.GrainSizeStandard.GBT6394
- {
- internal class MethodCutOffDialog : GrainSizeStandardDialog
- {
- /// <summary>
- /// 测定结果暂存
- /// </summary>
- private List<DataTable> dataTable1s = new List<DataTable>();
- /// <summary>
- /// 储存点击保存结果后的所有原图与分析图
- /// </summary>
- private Dictionary<string, List<Bitmap>> bitCeDingDic = new Dictionary<string, List<Bitmap>>();
- #region 组件
- private GroupBox groupBox10;
- private Button button10;
- private Button button7_0;
- private GroupBox groupBox11;
- private CheckBox checkBox5_0;
- private CheckBox checkBox4;
- private CheckBox checkBox3_0;
- private DataGridViewTextBoxColumn ColumnTotal1;
- private DataGridViewTextBoxColumn ColumnTotal2;
- private DataGridViewTextBoxColumn ColumnTotal3;
- private DataGridViewTextBoxColumn ColumnTotal4;
- private DataGridViewTextBoxColumn ColumnTotal5;
- private DataGridViewTextBoxColumn ColumnTotal6;
- private DataGridViewTextBoxColumn Column1;
- private DataGridViewTextBoxColumn Column2;
- private DataGridViewTextBoxColumn Column3;
- private DataGridViewTextBoxColumn Column4;
- private DataGridViewTextBoxColumn Column5;
- private DataGridViewTextBoxColumn Column6;
- private Button button8;
- private Button button6_0;
- #endregion 组件
- #region 构造函数
- public MethodCutOffDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem) : base(appWorkspace, menuItem, null, 0)
- {
- }
- #endregion 构造函数
- #region 初始化组件
- private void InitializeComponentText()
- {
- this.groupBox10.Text = PdnResources.GetString("Menu.sectionoperation.text");
- }
- private void InitializeComponent()
- {
- this.groupBox10 = new System.Windows.Forms.GroupBox();
- this.button8 = new System.Windows.Forms.Button();
- this.button6_0 = new System.Windows.Forms.Button();
- this.button10 = new System.Windows.Forms.Button();
- this.button7_0 = new System.Windows.Forms.Button();
- this.groupBox11 = new System.Windows.Forms.GroupBox();
- this.checkBox5_0 = new System.Windows.Forms.CheckBox();
- this.checkBox4 = new System.Windows.Forms.CheckBox();
- this.checkBox3_0 = new System.Windows.Forms.CheckBox();
- this.ColumnTotal1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.ColumnTotal2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.ColumnTotal3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.ColumnTotal4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.ColumnTotal5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.ColumnTotal6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.groupBox_analysisResult1.SuspendLayout();
- this.groupBox10.SuspendLayout();
- this.groupBox11.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox10
- //
- this.groupBox10.Controls.Add(this.button8);
- this.groupBox10.Controls.Add(this.button6_0);
- this.groupBox10.Controls.Add(this.button10);
- this.groupBox10.Controls.Add(this.button7_0);
- this.groupBox10.Location = new System.Drawing.Point(179, 370);
- this.groupBox10.Name = "groupBox10";
- this.groupBox10.Size = new System.Drawing.Size(208, 74);
- this.groupBox10.TabIndex = 38;
- this.groupBox10.TabStop = false;
- //
- // button8
- //
- this.button8.BackColor = System.Drawing.SystemColors.Control;
- this.button8.Location = new System.Drawing.Point(107, 42);
- this.button8.Name = "button8";
- this.button8.Size = new System.Drawing.Size(95, 26);
- this.button8.TabIndex = 13;
- this.button8.UseVisualStyleBackColor = false;
- this.button8.Click += new System.EventHandler(this.button8_Click);
- //
- // button6_0
- //
- this.button6_0.BackColor = System.Drawing.SystemColors.Control;
- this.button6_0.Location = new System.Drawing.Point(6, 43);
- this.button6_0.Name = "button6_0";
- this.button6_0.Size = new System.Drawing.Size(95, 26);
- this.button6_0.TabIndex = 12;
- this.button6_0.UseVisualStyleBackColor = false;
- this.button6_0.Click += new System.EventHandler(this.button6_0_Click);
- //
- // button10
- //
- this.button10.BackColor = System.Drawing.SystemColors.Control;
- this.button10.Location = new System.Drawing.Point(107, 15);
- this.button10.Name = "button10";
- this.button10.Size = new System.Drawing.Size(95, 26);
- this.button10.TabIndex = 11;
- this.button10.UseVisualStyleBackColor = false;
- this.button10.Click += new System.EventHandler(this.button10_Click);
- //
- // button7_0
- //
- this.button7_0.BackColor = System.Drawing.SystemColors.Control;
- this.button7_0.Location = new System.Drawing.Point(6, 15);
- this.button7_0.Name = "button7_0";
- this.button7_0.Size = new System.Drawing.Size(95, 26);
- this.button7_0.TabIndex = 8;
- this.button7_0.UseVisualStyleBackColor = false;
- this.button7_0.Click += new System.EventHandler(this.button7_0_Click);
- //
- // groupBox11
- //
- this.groupBox11.Controls.Add(this.checkBox5_0);
- this.groupBox11.Controls.Add(this.checkBox4);
- this.groupBox11.Controls.Add(this.checkBox3_0);
- this.groupBox11.Location = new System.Drawing.Point(393, 370);
- this.groupBox11.Name = "groupBox11";
- this.groupBox11.Size = new System.Drawing.Size(142, 74);
- this.groupBox11.TabIndex = 39;
- this.groupBox11.TabStop = false;
- //
- // checkBox5_0
- //
- this.checkBox5_0.AutoSize = true;
- this.checkBox5_0.Checked = true;
- this.checkBox5_0.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox5_0.Location = new System.Drawing.Point(15, 53);
- this.checkBox5_0.Name = "checkBox5_0";
- this.checkBox5_0.Size = new System.Drawing.Size(72, 16);
- this.checkBox5_0.TabIndex = 2;
- this.checkBox5_0.UseVisualStyleBackColor = true;
- this.checkBox5_0.CheckedChanged += new System.EventHandler(this.checkBox5_0_CheckedChanged);
- //
- // checkBox4
- //
- this.checkBox4.AutoSize = true;
- this.checkBox4.Checked = true;
- this.checkBox4.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox4.Location = new System.Drawing.Point(15, 35);
- this.checkBox4.Name = "checkBox4";
- this.checkBox4.Size = new System.Drawing.Size(72, 16);
- this.checkBox4.TabIndex = 1;
- this.checkBox4.UseVisualStyleBackColor = true;
- this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
- //
- // checkBox3_0
- //
- this.checkBox3_0.AutoSize = true;
- this.checkBox3_0.Checked = true;
- this.checkBox3_0.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox3_0.Location = new System.Drawing.Point(15, 17);
- this.checkBox3_0.Name = "checkBox3_0";
- this.checkBox3_0.Size = new System.Drawing.Size(72, 16);
- this.checkBox3_0.TabIndex = 0;
- this.checkBox3_0.UseVisualStyleBackColor = true;
- this.checkBox3_0.CheckedChanged += new System.EventHandler(this.checkBox3_0_CheckedChanged);
- this.dataGridView_Total.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.ColumnTotal3,
- this.ColumnTotal4,
- this.ColumnTotal5,
- this.ColumnTotal6});
- //
- // ColumnTotal1
- //
- this.ColumnTotal1.Name = "ColumnTotal1";
- this.ColumnTotal1.ReadOnly = true;
- //
- // ColumnTotal2
- //
- this.ColumnTotal2.Name = "ColumnTotal2";
- this.ColumnTotal2.ReadOnly = true;
- //
- // ColumnTotal3
- //
- this.ColumnTotal3.Name = "ColumnTotal3";
- this.ColumnTotal3.ReadOnly = true;
- //
- // ColumnTotal4
- //
- this.ColumnTotal4.Name = "ColumnTotal4";
- this.ColumnTotal4.ReadOnly = true;
- //
- // ColumnTotal5
- //
- this.ColumnTotal5.Name = "ColumnTotal5";
- this.ColumnTotal5.ReadOnly = true;
- //
- // ColumnTotal6
- //
- this.ColumnTotal6.Name = "ColumnTotal6";
- this.ColumnTotal6.ReadOnly = true;
- this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column1,
- this.Column2,
- this.Column3,
- this.Column4,
- this.Column5,
- this.Column6});
- //
- // Column1
- //
- this.Column1.Name = "Column1";
- this.Column1.ReadOnly = true;
- //
- // Column2
- //
- this.Column2.Name = "Column2";
- this.Column2.ReadOnly = true;
- //
- // Column3
- //
- this.Column3.Name = "Graisize";
- this.Column3.ReadOnly = true;
- //
- // Column4
- //
- this.Column4.Name = "Grainnumber";
- this.Column4.ReadOnly = true;
- //
- // Column5
- //
- this.Column5.Name = "Grainintercept";
- this.Column5.ReadOnly = true;
- //
- // Column6
- //
- this.Column6.Name = "Graingrade";
- this.Column6.ReadOnly = true;
- //
- // MethodCutOffDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(1127, 810);
- this.Controls.Add(this.groupBox10);
- this.Controls.Add(this.groupBox11);
- this.Name = "MethodCutOffDialog";
- this.TopMost = false;
- this.Load += new System.EventHandler(this.MethodCutOffDialog_Load);
- this.Controls.SetChildIndex(this.groupBox11, 0);
- this.Controls.SetChildIndex(this.groupBox10, 0);
- this.Controls.SetChildIndex(this.groupBox6groupBox_analysisResult2, 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.groupBox_report, 0);
- this.groupBox_analysisResult1.ResumeLayout(false);
- this.groupBox10.ResumeLayout(false);
- this.groupBox11.ResumeLayout(false);
- this.groupBox11.PerformLayout();
- this.ResumeLayout(false);
- }
- #endregion 初始化组件
- #region 需继承方法
- /// <summary>
- /// 是否显示晶界
- /// </summary>
- /// <returns></returns>
- protected override Boolean ShowGrainBoundryChecked()
- {
- return checkBox3_0.Checked;
- }
- //是否绘制辅助线
- protected override bool showGridChecked()
- {
- return checkBox4.Checked;
- }
- //是否绘制截点
- protected override bool drawGuidePoints()
- {
- return (imageMat != null && this.checkBox5_0.Checked);
- }
- //是否显示截点
- protected override Boolean drawDisplaySections()
- {
- return this.checkBox5_0.Checked;
- }
- //辅助线类型
- protected override string[] getTypeNames()
- {
- return new string[] {
- PdnResources.GetString("Menu.Verticalauxiliaryline.text"),
- PdnResources.GetString("Menu.Horizontalauxiliaryline.text"),
- PdnResources.GetString("Menu.Singlecircleauxiliaryline.text"),
- PdnResources.GetString("Menu.Three-circleauxiliaryline.text"),
- PdnResources.GetString("Menu.Compositeauxiliaryline.text")};
- }
- protected override string getTemplateName()
- {
- return "Template.Manager.item3.GrainSizeCutOff6394Method";
- }
- protected override string getProjectEngineeringName()
- {
- return "Menu.DedicatedAnalysis.BlackMetal.GrainSize.Text";
- }
- protected override string getModelName()
- {
- return "GrainSizeGuideStyleModel.xml";
- }
- protected override void SubclassInitialize()
- {
- InitializeComponent();
- InitializeComponentText();
- DetailListNotDoubleIndex.Add(0);
- DetailListNotDoubleIndex.Add(1);
- }
- #endregion
- protected override void refreshWhileImgChanged()
- {
- object ShowGrainBoundry;
- if (GetParamValue1(ParamKey_displaygrainboundaries, out ShowGrainBoundry))//显示晶界
- this.checkBox3_0.Checked = (bool)ShowGrainBoundry;
- if (GetParamValue1(ParamKey_displaygrid, out ShowGrainBoundry))//显示网格
- this.checkBox4.Checked = (bool)ShowGrainBoundry;
- if (GetParamValue1(ParamKey_displaysections, out ShowGrainBoundry))//显示截点
- this.checkBox5_0.Checked = (bool)ShowGrainBoundry;
- }
- private void MethodCutOffDialog_Load(object sender, EventArgs e)
- {
- object ShowGrainBoundry;
- if (GetParamValue1(ParamKey_displaygrainboundaries, out ShowGrainBoundry))//显示晶界
- this.checkBox3_0.Checked = (bool)ShowGrainBoundry;
- if (GetParamValue1(ParamKey_displaygrid, out ShowGrainBoundry))//显示网格
- this.checkBox4.Checked = (bool)ShowGrainBoundry;
- if (GetParamValue1(ParamKey_displaysections, out ShowGrainBoundry))//显示截点
- this.checkBox5_0.Checked = (bool)ShowGrainBoundry;
- this.button8.Text = PdnResources.GetString("Menu.1.5/2section.text");
- this.button6_0.Text = PdnResources.GetString("Menu.0.5sectionstyle.text");
- this.button10.Text = PdnResources.GetString("Menu.Setting.Text");
- this.button7_0.Text = PdnResources.GetString("Menu.1section.text");
- this.groupBox11.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
- this.checkBox5_0.Text = PdnResources.GetString("Menu.displaysections.text");
- this.checkBox4.Text = PdnResources.GetString("Menu.displaygrid.text");
- this.checkBox3_0.Text = PdnResources.GetString("Menu.displaygrainboundaries.text");
- this.ColumnTotal1.HeaderText = PdnResources.GetString("Menu.Intersectinggrainnumber.Text");
- this.ColumnTotal2.HeaderText = PdnResources.GetString("Menu.Numberofgrainsingrid.Text");
- this.ColumnTotal3.HeaderText = PdnResources.GetString("Menu.Totalmeshlength.Text") + "(μm)";
- this.ColumnTotal4.HeaderText = PdnResources.GetString("Menu.umberofpoints.Text");
- this.ColumnTotal5.HeaderText = PdnResources.GetString("Menu.averageintercept.text") + "(μm)";
- this.ColumnTotal6.HeaderText = PdnResources.GetString("Menu.Averagegrainsizegrade.text");
- this.Column1.HeaderText = PdnResources.GetString("Menu.picture.Text");
- this.Column2.HeaderText = PdnResources.GetString("Menu.Tools.GridLine.Text");
- this.Column3.HeaderText = PdnResources.GetString("Menu.Gridlength.text") + "(μm)";
- this.Column4.HeaderText = PdnResources.GetString("Menu.Thenumberofsections.text");
- this.Column5.HeaderText = PdnResources.GetString("Menu.averageintercept.text") + "(μm)";
- this.Column6.HeaderText = PdnResources.GetString("Menu.Averagegrainsizegrade.text");
- this.Text = "GBT6394_2017(" + PdnResources.GetString("Menu.sectionmethod.text") + ")";
- //this.groupBox_img.Size = new System.Drawing.Size(158, 722);
- //this.groupBox_review.Size = new System.Drawing.Size(575, 722);
- //this.groupBox_analysisResult1.Location = new System.Drawing.Point(12, 800);
- //this.groupBox6groupBox_analysisResult2.Location = new System.Drawing.Point(242, 800);
- //this.groupBox_report.Location = new System.Drawing.Point(974, 800);
- }
- /// <summary>
- /// 是否显示网格
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox4_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 是否显示截点
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox5_0_CheckedChanged(object sender, EventArgs e)
- {
- if (!this.checkBox4.Checked)
- MessageBox.Show(PdnResources.GetString("Menu.Nogrid.text")+"!");
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 是否显示晶界
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox3_0_CheckedChanged(object sender, EventArgs e)
- {
- if (!bcOriginChecked() && getGrainBoundryChecked() && checkBox3_0.Checked)
- {
- this.documentWorkspace.PhaseModels[1].choise = true;
- }
- else
- {
- this.documentWorkspace.PhaseModels[1].choise = false;
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 设置截点样式
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button10_Click(object sender, EventArgs e)
- {
- ShowGrainSurveyPointStyleSettingDialog();
- }
- /// <summary>
- /// 鼠标按下
- /// </summary>
- /// <param name="drawArea"></param>
- /// <param name="e"></param>
- protected override void OnMouseDown(object sender, MouseEventArgs e)
- {
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- // 换算后的点
- PointF point1 = documentWorkspace.GetScalePoint(e.Location);
- if (point1.X <= this.documentWorkspace.CompositionSurface.Width
- && point1.X >= 0
- && point1.Y >= 0
- && point1.Y <= this.documentWorkspace.CompositionSurface.Height)
- {
- RectangleF rectangleF;
- // 复合辅助线
- int add = GSSClass.GuideClass.getAddOfRStyle(point1, this.comboBox1.SelectedItem, out rectangleF);
- if (add == 0 && GSSClass.styleClass.PointKb > 0)
- rectangleF = GSSClass.GuideClass.guideModel.RectangleFLine;
- //手动添加截点
- if (this.documentWorkspace.ActiveTool == Annotation.Enum.DrawToolType.InclusionNoEffect && GSSClass.styleClass.OnMouseDownNext(point1, sender, e))
- GSSClass.styleClass.OnMouseDownFirst(point1, rectangleF, GSSClass.standardModel.linePointList, e);
- }
- if (GSSClass.styleClass.PointKb == 0)
- {
- //辅助线缩放
- GSSClass.GuideClass.OnMouseDown(point1, sender, e);
- //辅助线移动
- base.OnMouseDown(sender, e);//##
- }
- ////手动删除截点或取消添加截点
- //GSSClass.styleClass.OnMouseDownNext(point1, sender, e);
- }
- private void button6_0_Click(object sender, EventArgs e)
- {
- if (this.imageMat != null)
- {
- //MessageBox.Show(PdnResources.GetString("Menu.ftbuttontoaddainterceptadd.Text")+"!");
- GSSClass.styleClass.PointKb = 1;
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- }
- }
- /// <summary>
- /// 1截点添加
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button7_0_Click(object sender, EventArgs e)
- {
- if (this.imageMat != null)
- {
- //MessageBox.Show(PdnResources.GetString("Menu.ftbuttontoaddainterceptadd.Text")+"!");
- GSSClass.styleClass.PointKb = 2;
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- }
- }
- private void button8_Click(object sender, EventArgs e)
- {
- if (this.imageMat != null)
- {
- //MessageBox.Show(PdnResources.GetString("Menu.ftbuttontoaddainterceptadd.Text")+"!");
- GSSClass.styleClass.PointKb = 3;
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- }
- }
- }
- }
|