1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213 |
- using Metis.ParameterSet;
- using PaintDotNet.Adjust.BaseImage;
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.Base.Functionodel;
- using System;
- using System.Collections.Generic;
- using System.Windows.Forms;
- namespace PaintDotNet.Binarization
- {
- /// <summary>
- /// 对象处理
- /// </summary>
- internal class ObjectActionDialog : FloatingToolForm//PdnBaseForm
- {
- #region 控件
- private GroupBox groupBox2;
- private GroupBox groupBox3;
- private GroupBox groupBox4;
- private GroupBox groupBox5;
- private GroupBox groupBox6;
- private Button button1;
- private Button button2;
- private Button button3;
- private Button button4;
- private Button button5;
- private Button button6;
- private Button button7;
- private Button button8;
- private Button button9;
- private Button button10;
- private RadioButton radioButton1;
- private RadioButton radioButton2;
- private RadioButton radioButton3;
- private Label label1;
- private Label label2;
- private RadioButton radioButton4;
- private RadioButton radioButton5;
- private RadioButton radioButton6;
- private RadioButton radioButton10;
- private RadioButton radioButton7;
- private RadioButton radioButton8;
- private RadioButton radioButton9;
- private RadioButton radioButton11;
- private RadioButton radioButton12;
- private RadioButton radioButton13;
- private RadioButton radioButton14;
- private RadioButton radioButton15;
- private RadioButton radioButton16;
- private RadioButton radioButton17;
- private RadioButton radioButton18;
- private GroupBox groupBox1;
- private NumericUpDown numericUpDown1;
- private NumericUpDown numericUpDown2;
- #endregion
- /// <summary>
- /// 主控件
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 用来备份的相集合
- /// </summary>
- private List<PhaseModel> PhaseModelsBackUp = new List<PhaseModel>();
- /// <summary>
- /// 是否还原相
- /// </summary>
- private bool restore = true;
- private int menuId;
- #region 保存参数的model和key
- private GrainSizeAnalysisModel analysisModel;
- List<string> optionList = new List<string>();//选项名称集合
- private const string ParamKey_DivisionOption = "divisionOption";//分割选项
- private const string ParamKey_DivisionLineWidth = "divisionLineWidth";//分割线宽
- private const string ParamKey_ConnectOption = "connectOption";//连接选项
- private const string ParamKey_ConnectLineWidth = "connectLineWidth";//连接线宽
- private const string ParamKey_DeleteOption = "deleteOption";//删除选项
- private const string ParamKey_AddOption = "addOption";//添加选项
- private const string ParamKey_ChoiceOption = "choiceOption";//选择选项
- #endregion
- public List<PhaseModel> PhaseModelsBackUpForCopy
- {
- get
- {
- List<PhaseModel> list = new List<PhaseModel>();
- if (this.PhaseModelsBackUp != null && this.PhaseModelsBackUp.Count > 0)
- {
- foreach (PhaseModel phase in this.PhaseModelsBackUp)
- {
- PhaseModel phase1 = new PhaseModel();
- phase1.choise = phase.choise;
- phase1.color = phase.color;
- phase1.mat = new OpenCvSharp.Mat();
- phase.mat.CopyTo(phase1.mat);
- phase1.name = phase.name;
- phase1.position = phase.position;
- list.Add(phase1);
- }
- }
- return list;
- }
- }
-
- public ObjectActionDialog(AppWorkspace appWorkspace,int menuId)
- {
- this.menuId = menuId;
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryActionSaving\\ParameterSaving.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- this.analysisModel = analysisModelXml.cloneListParamModel(this.menuId);
- this.appWorkspace = appWorkspace;
- this.ShowInTaskbar = false;
- this.PhaseModelsBackUp = this.appWorkspace.ActiveDocumentWorkspace.PhaseModelsForCopy;
- this.appWorkspace.ActiveDocumentWorkspaceChanged += new EventHandler(this.ActiveDocumentWorkspaceChanged);
- InitializeComponent();
- InitializeLanguageText();
- this.numericUpDown1.Value = InvariantData.segmentation;
- this.numericUpDown2.Value = InvariantData.connection;
- GetListParamModel();
- }
- private void ActiveDocumentWorkspaceChanged(object sender, EventArgs e)
- {
- if(this.appWorkspace.ActiveDocumentWorkspace!=null)
- this.PhaseModelsBackUp = this.appWorkspace.ActiveDocumentWorkspace.PhaseModelsForCopy;
- }
- private void InitializeLanguageText()
- {
- this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
- this.button2.Text = PdnResources.GetString("Menu.ensure.text");
- this.button1.Text = PdnResources.GetString("Menu.cancel.text");
- this.groupBox2.Text = PdnResources.GetString("Menu.segment.text");
- this.label1.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.radioButton3.Text = PdnResources.GetString("Menu.LabelAction.DrawEllipse.Text");
- this.radioButton2.Text = PdnResources.GetString("Menu.LabelAction.DrawLine.Text");
- this.radioButton1.Text = PdnResources.GetString("Menu.MeasureAction.MeasureBrokenLine.Text");
- this.button3.Text = PdnResources.GetString("Menu.segment.text");
- this.groupBox3.Text = PdnResources.GetString("Menu.connect.text");
- this.radioButton4.Text = PdnResources.GetString("Menu.LabelAction.DrawEllipse.Text");
- this.radioButton5.Text = PdnResources.GetString("Menu.LabelAction.DrawLine.Text");
- this.radioButton6.Text = PdnResources.GetString("Menu.MeasureAction.MeasureBrokenLine.Text");
- this.label2.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.button4.Text = PdnResources.GetString("Menu.connect.text");
- this.groupBox4.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.radioButton10.Text = PdnResources.GetString("Menu.LabelAction.DrawPolygon.Text");
- this.radioButton7.Text = PdnResources.GetString("Menu.LabelAction.DrawEllipse.Text");
- this.radioButton8.Text = PdnResources.GetString("Menu.LabelAction.DrawRectangle.Text");
- this.radioButton9.Text = PdnResources.GetString("Menu.single.text");
- this.button5.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.groupBox5.Text = PdnResources.GetString("Menu.Addto.text");
- this.radioButton11.Text = PdnResources.GetString("Menu.Binaryoperation.Objecthandling.Track.text");
- this.radioButton12.Text = PdnResources.GetString("Menu.LabelAction.DrawPolygon.Text");
- this.radioButton13.Text = PdnResources.GetString("Menu.LabelAction.DrawEllipse.Text");
- this.radioButton14.Text = PdnResources.GetString("Menu.LabelAction.DrawRectangle.Text");
- this.button6.Text = PdnResources.GetString("Menu.Addto.text");
- this.groupBox6.Text = PdnResources.GetString("Menu.MeasureAction.MeasureSelect.Text");
- this.radioButton15.Text = PdnResources.GetString("Menu.LabelAction.DrawPolygon.Text");
- this.radioButton16.Text = PdnResources.GetString("Menu.LabelAction.DrawEllipse.Text");
- this.radioButton17.Text = PdnResources.GetString("Menu.LabelAction.DrawRectangle.Text");
- this.radioButton18.Text = PdnResources.GetString("Menu.single.text");
- this.button10.Text = PdnResources.GetString("Menu.inverse.text");
- this.button9.Text = PdnResources.GetString("Menu.Binaryoperation.Objecthandling.unselectall.text");
- this.button8.Text = PdnResources.GetString("Menu.application.text");
- this.button7.Text = PdnResources.GetString("Menu.MeasureAction.MeasureSelect.Text");
- this.Text = PdnResources.GetString("Menu.BinaryAction.ObjectAction.Text");
- }
- private void InitializeComponent()
- {
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.button2 = new System.Windows.Forms.Button();
- this.button1 = new System.Windows.Forms.Button();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.label1 = new System.Windows.Forms.Label();
- this.radioButton3 = new System.Windows.Forms.RadioButton();
- this.radioButton2 = new System.Windows.Forms.RadioButton();
- this.radioButton1 = new System.Windows.Forms.RadioButton();
- this.button3 = new System.Windows.Forms.Button();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
- this.radioButton4 = new System.Windows.Forms.RadioButton();
- this.radioButton5 = new System.Windows.Forms.RadioButton();
- this.radioButton6 = new System.Windows.Forms.RadioButton();
- this.label2 = new System.Windows.Forms.Label();
- this.button4 = new System.Windows.Forms.Button();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.radioButton10 = new System.Windows.Forms.RadioButton();
- this.radioButton7 = new System.Windows.Forms.RadioButton();
- this.radioButton8 = new System.Windows.Forms.RadioButton();
- this.radioButton9 = new System.Windows.Forms.RadioButton();
- this.button5 = new System.Windows.Forms.Button();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.radioButton11 = new System.Windows.Forms.RadioButton();
- this.radioButton12 = new System.Windows.Forms.RadioButton();
- this.radioButton13 = new System.Windows.Forms.RadioButton();
- this.radioButton14 = new System.Windows.Forms.RadioButton();
- this.button6 = new System.Windows.Forms.Button();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.radioButton15 = new System.Windows.Forms.RadioButton();
- this.radioButton16 = new System.Windows.Forms.RadioButton();
- this.radioButton17 = new System.Windows.Forms.RadioButton();
- this.radioButton18 = new System.Windows.Forms.RadioButton();
- this.button10 = new System.Windows.Forms.Button();
- this.button9 = new System.Windows.Forms.Button();
- this.button8 = new System.Windows.Forms.Button();
- this.button7 = new System.Windows.Forms.Button();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- this.groupBox3.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
- this.groupBox4.SuspendLayout();
- this.groupBox5.SuspendLayout();
- this.groupBox6.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox1.Controls.Add(this.button2);
- this.groupBox1.Controls.Add(this.button1);
- this.groupBox1.Location = new System.Drawing.Point(13, 13);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(396, 52);
- this.groupBox1.TabIndex = 1;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "操作";
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(315, 17);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(75, 23);
- this.button2.TabIndex = 1;
- this.button2.Text = "确定";
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(234, 17);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 0;
- this.button1.Text = "取消";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // groupBox2
- //
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox2.Controls.Add(this.numericUpDown1);
- this.groupBox2.Controls.Add(this.label1);
- this.groupBox2.Controls.Add(this.radioButton3);
- this.groupBox2.Controls.Add(this.radioButton2);
- this.groupBox2.Controls.Add(this.radioButton1);
- this.groupBox2.Controls.Add(this.button3);
- this.groupBox2.Location = new System.Drawing.Point(13, 72);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(396, 52);
- this.groupBox2.TabIndex = 2;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "分割";
- //
- // numericUpDown1
- //
- this.numericUpDown1.Location = new System.Drawing.Point(234, 19);
- this.numericUpDown1.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(75, 21);
- this.numericUpDown1.TabIndex = 5;
- this.numericUpDown1.Value = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(197, 23);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(41, 12);
- this.label1.TabIndex = 4;
- this.label1.Text = "线宽:";
- //
- // radioButton3
- //
- this.radioButton3.AutoSize = true;
- this.radioButton3.Location = new System.Drawing.Point(125, 21);
- this.radioButton3.Name = "radioButton3";
- this.radioButton3.Size = new System.Drawing.Size(47, 16);
- this.radioButton3.TabIndex = 3;
- this.radioButton3.TabStop = true;
- this.radioButton3.Text = "椭圆";
- this.radioButton3.UseVisualStyleBackColor = true;
- //
- // radioButton2
- //
- this.radioButton2.AutoSize = true;
- this.radioButton2.Location = new System.Drawing.Point(72, 21);
- this.radioButton2.Name = "radioButton2";
- this.radioButton2.Size = new System.Drawing.Size(47, 16);
- this.radioButton2.TabIndex = 2;
- this.radioButton2.TabStop = true;
- this.radioButton2.Text = "直线";
- this.radioButton2.UseVisualStyleBackColor = true;
- //
- // radioButton1
- //
- this.radioButton1.AutoSize = true;
- this.radioButton1.Checked = true;
- this.radioButton1.Location = new System.Drawing.Point(19, 21);
- this.radioButton1.Name = "radioButton1";
- this.radioButton1.Size = new System.Drawing.Size(47, 16);
- this.radioButton1.TabIndex = 1;
- this.radioButton1.TabStop = true;
- this.radioButton1.Text = "折线";
- this.radioButton1.UseVisualStyleBackColor = true;
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(315, 18);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(75, 23);
- this.button3.TabIndex = 0;
- this.button3.Text = "分割";
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // groupBox3
- //
- this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox3.Controls.Add(this.numericUpDown2);
- this.groupBox3.Controls.Add(this.radioButton4);
- this.groupBox3.Controls.Add(this.radioButton5);
- this.groupBox3.Controls.Add(this.radioButton6);
- this.groupBox3.Controls.Add(this.label2);
- this.groupBox3.Controls.Add(this.button4);
- this.groupBox3.Location = new System.Drawing.Point(13, 131);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(396, 52);
- this.groupBox3.TabIndex = 3;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "连接";
- //
- // numericUpDown2
- //
- this.numericUpDown2.Location = new System.Drawing.Point(234, 18);
- this.numericUpDown2.Minimum = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.numericUpDown2.Name = "numericUpDown2";
- this.numericUpDown2.Size = new System.Drawing.Size(75, 21);
- this.numericUpDown2.TabIndex = 11;
- this.numericUpDown2.Value = new decimal(new int[] {
- 1,
- 0,
- 0,
- 0});
- this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown2_ValueChanged);
- //
- // radioButton4
- //
- this.radioButton4.AutoSize = true;
- this.radioButton4.Location = new System.Drawing.Point(125, 20);
- this.radioButton4.Name = "radioButton4";
- this.radioButton4.Size = new System.Drawing.Size(47, 16);
- this.radioButton4.TabIndex = 10;
- this.radioButton4.TabStop = true;
- this.radioButton4.Text = "椭圆";
- this.radioButton4.UseVisualStyleBackColor = true;
- //
- // radioButton5
- //
- this.radioButton5.AutoSize = true;
- this.radioButton5.Location = new System.Drawing.Point(72, 20);
- this.radioButton5.Name = "radioButton5";
- this.radioButton5.Size = new System.Drawing.Size(47, 16);
- this.radioButton5.TabIndex = 9;
- this.radioButton5.TabStop = true;
- this.radioButton5.Text = "直线";
- this.radioButton5.UseVisualStyleBackColor = true;
- //
- // radioButton6
- //
- this.radioButton6.AutoSize = true;
- this.radioButton6.Checked = true;
- this.radioButton6.Location = new System.Drawing.Point(19, 20);
- this.radioButton6.Name = "radioButton6";
- this.radioButton6.Size = new System.Drawing.Size(47, 16);
- this.radioButton6.TabIndex = 8;
- this.radioButton6.TabStop = true;
- this.radioButton6.Text = "折线";
- this.radioButton6.UseVisualStyleBackColor = true;
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(197, 21);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(41, 12);
- this.label2.TabIndex = 6;
- this.label2.Text = "线宽:";
- //
- // button4
- //
- this.button4.Location = new System.Drawing.Point(315, 17);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(75, 23);
- this.button4.TabIndex = 0;
- this.button4.Text = "连接";
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // groupBox4
- //
- this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox4.Controls.Add(this.radioButton10);
- this.groupBox4.Controls.Add(this.radioButton7);
- this.groupBox4.Controls.Add(this.radioButton8);
- this.groupBox4.Controls.Add(this.radioButton9);
- this.groupBox4.Controls.Add(this.button5);
- this.groupBox4.Location = new System.Drawing.Point(13, 190);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(396, 52);
- this.groupBox4.TabIndex = 4;
- this.groupBox4.TabStop = false;
- this.groupBox4.Text = "删除";
- //
- // radioButton10
- //
- this.radioButton10.AutoSize = true;
- this.radioButton10.Location = new System.Drawing.Point(178, 21);
- this.radioButton10.Name = "radioButton10";
- this.radioButton10.Size = new System.Drawing.Size(59, 16);
- this.radioButton10.TabIndex = 14;
- this.radioButton10.TabStop = true;
- this.radioButton10.Text = "多边形";
- this.radioButton10.UseVisualStyleBackColor = true;
- //
- // radioButton7
- //
- this.radioButton7.AutoSize = true;
- this.radioButton7.Location = new System.Drawing.Point(125, 21);
- this.radioButton7.Name = "radioButton7";
- this.radioButton7.Size = new System.Drawing.Size(47, 16);
- this.radioButton7.TabIndex = 13;
- this.radioButton7.TabStop = true;
- this.radioButton7.Text = "椭圆";
- this.radioButton7.UseVisualStyleBackColor = true;
- //
- // radioButton8
- //
- this.radioButton8.AutoSize = true;
- this.radioButton8.Location = new System.Drawing.Point(72, 21);
- this.radioButton8.Name = "radioButton8";
- this.radioButton8.Size = new System.Drawing.Size(47, 16);
- this.radioButton8.TabIndex = 12;
- this.radioButton8.TabStop = true;
- this.radioButton8.Text = "矩形";
- this.radioButton8.UseVisualStyleBackColor = true;
- //
- // radioButton9
- //
- this.radioButton9.AutoSize = true;
- this.radioButton9.Checked = true;
- this.radioButton9.Location = new System.Drawing.Point(19, 21);
- this.radioButton9.Name = "radioButton9";
- this.radioButton9.Size = new System.Drawing.Size(47, 16);
- this.radioButton9.TabIndex = 11;
- this.radioButton9.TabStop = true;
- this.radioButton9.Text = "单个";
- this.radioButton9.UseVisualStyleBackColor = true;
- //
- // button5
- //
- this.button5.Location = new System.Drawing.Point(315, 18);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(75, 23);
- this.button5.TabIndex = 0;
- this.button5.Text = "删除";
- this.button5.UseVisualStyleBackColor = true;
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // groupBox5
- //
- this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox5.Controls.Add(this.radioButton11);
- this.groupBox5.Controls.Add(this.radioButton12);
- this.groupBox5.Controls.Add(this.radioButton13);
- this.groupBox5.Controls.Add(this.radioButton14);
- this.groupBox5.Controls.Add(this.button6);
- this.groupBox5.Location = new System.Drawing.Point(13, 249);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(396, 52);
- this.groupBox5.TabIndex = 5;
- this.groupBox5.TabStop = false;
- this.groupBox5.Text = "添加";
- //
- // radioButton11
- //
- this.radioButton11.AutoSize = true;
- this.radioButton11.Location = new System.Drawing.Point(125, 21);
- this.radioButton11.Name = "radioButton11";
- this.radioButton11.Size = new System.Drawing.Size(47, 16);
- this.radioButton11.TabIndex = 18;
- this.radioButton11.TabStop = true;
- this.radioButton11.Text = "轨迹";
- this.radioButton11.UseVisualStyleBackColor = true;
- //
- // radioButton12
- //
- this.radioButton12.AutoSize = true;
- this.radioButton12.Location = new System.Drawing.Point(178, 21);
- this.radioButton12.Name = "radioButton12";
- this.radioButton12.Size = new System.Drawing.Size(59, 16);
- this.radioButton12.TabIndex = 17;
- this.radioButton12.TabStop = true;
- this.radioButton12.Text = "多边形";
- this.radioButton12.UseVisualStyleBackColor = true;
- //
- // radioButton13
- //
- this.radioButton13.AutoSize = true;
- this.radioButton13.Location = new System.Drawing.Point(72, 21);
- this.radioButton13.Name = "radioButton13";
- this.radioButton13.Size = new System.Drawing.Size(47, 16);
- this.radioButton13.TabIndex = 16;
- this.radioButton13.TabStop = true;
- this.radioButton13.Text = "椭圆";
- this.radioButton13.UseVisualStyleBackColor = true;
- //
- // radioButton14
- //
- this.radioButton14.AutoSize = true;
- this.radioButton14.Checked = true;
- this.radioButton14.Location = new System.Drawing.Point(19, 21);
- this.radioButton14.Name = "radioButton14";
- this.radioButton14.Size = new System.Drawing.Size(47, 16);
- this.radioButton14.TabIndex = 15;
- this.radioButton14.TabStop = true;
- this.radioButton14.Text = "单个";
- this.radioButton14.UseVisualStyleBackColor = true;
- //
- // button6
- //
- this.button6.Location = new System.Drawing.Point(315, 18);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(75, 23);
- this.button6.TabIndex = 0;
- this.button6.Text = "添加";
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // groupBox6
- //
- this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox6.Controls.Add(this.radioButton15);
- this.groupBox6.Controls.Add(this.radioButton16);
- this.groupBox6.Controls.Add(this.radioButton17);
- this.groupBox6.Controls.Add(this.radioButton18);
- this.groupBox6.Controls.Add(this.button10);
- this.groupBox6.Controls.Add(this.button9);
- this.groupBox6.Controls.Add(this.button8);
- this.groupBox6.Controls.Add(this.button7);
- this.groupBox6.Location = new System.Drawing.Point(13, 308);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(396, 96);
- this.groupBox6.TabIndex = 6;
- this.groupBox6.TabStop = false;
- this.groupBox6.Text = "选择";
- //
- // radioButton15
- //
- this.radioButton15.AutoSize = true;
- this.radioButton15.Location = new System.Drawing.Point(178, 24);
- this.radioButton15.Name = "radioButton15";
- this.radioButton15.Size = new System.Drawing.Size(59, 16);
- this.radioButton15.TabIndex = 18;
- this.radioButton15.TabStop = true;
- this.radioButton15.Text = "多边形";
- this.radioButton15.UseVisualStyleBackColor = true;
- //
- // radioButton16
- //
- this.radioButton16.AutoSize = true;
- this.radioButton16.Location = new System.Drawing.Point(125, 24);
- this.radioButton16.Name = "radioButton16";
- this.radioButton16.Size = new System.Drawing.Size(47, 16);
- this.radioButton16.TabIndex = 17;
- this.radioButton16.TabStop = true;
- this.radioButton16.Text = "椭圆";
- this.radioButton16.UseVisualStyleBackColor = true;
- //
- // radioButton17
- //
- this.radioButton17.AutoSize = true;
- this.radioButton17.Location = new System.Drawing.Point(72, 24);
- this.radioButton17.Name = "radioButton17";
- this.radioButton17.Size = new System.Drawing.Size(47, 16);
- this.radioButton17.TabIndex = 16;
- this.radioButton17.TabStop = true;
- this.radioButton17.Text = "矩形";
- this.radioButton17.UseVisualStyleBackColor = true;
- //
- // radioButton18
- //
- this.radioButton18.AutoSize = true;
- this.radioButton18.Checked = true;
- this.radioButton18.Location = new System.Drawing.Point(19, 24);
- this.radioButton18.Name = "radioButton18";
- this.radioButton18.Size = new System.Drawing.Size(47, 16);
- this.radioButton18.TabIndex = 15;
- this.radioButton18.TabStop = true;
- this.radioButton18.Text = "单个";
- this.radioButton18.UseVisualStyleBackColor = true;
- //
- // button10
- //
- this.button10.Location = new System.Drawing.Point(153, 60);
- this.button10.Name = "button10";
- this.button10.Size = new System.Drawing.Size(75, 23);
- this.button10.TabIndex = 3;
- this.button10.Text = "反选";
- this.button10.UseVisualStyleBackColor = true;
- this.button10.Click += new System.EventHandler(this.button10_Click);
- //
- // button9
- //
- this.button9.Location = new System.Drawing.Point(234, 60);
- this.button9.Name = "button9";
- this.button9.Size = new System.Drawing.Size(75, 23);
- this.button9.TabIndex = 2;
- this.button9.Text = "全不选";
- this.button9.UseVisualStyleBackColor = true;
- this.button9.Click += new System.EventHandler(this.button9_Click);
- //
- // button8
- //
- this.button8.Location = new System.Drawing.Point(315, 60);
- this.button8.Name = "button8";
- this.button8.Size = new System.Drawing.Size(75, 23);
- this.button8.TabIndex = 1;
- this.button8.Text = "应用";
- this.button8.UseVisualStyleBackColor = true;
- this.button8.Click += new System.EventHandler(this.button8_Click);
- //
- // button7
- //
- this.button7.Location = new System.Drawing.Point(315, 21);
- this.button7.Name = "button7";
- this.button7.Size = new System.Drawing.Size(75, 23);
- this.button7.TabIndex = 0;
- this.button7.Text = "选择";
- this.button7.UseVisualStyleBackColor = true;
- this.button7.Click += new System.EventHandler(this.button7_Click);
- //
- // ObjectActionDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(421, 416);
- this.Controls.Add(this.groupBox6);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox3);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "ObjectActionDialog";
- this.Text = "对象处理";
- //this.TopMost = true;
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ObjectActionDialog_FormClosing);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox3, 0);
- this.Controls.SetChildIndex(this.groupBox4, 0);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.Controls.SetChildIndex(this.groupBox6, 0);
- this.groupBox1.ResumeLayout(false);
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
- this.groupBox4.ResumeLayout(false);
- this.groupBox4.PerformLayout();
- this.groupBox5.ResumeLayout(false);
- this.groupBox5.PerformLayout();
- this.groupBox6.ResumeLayout(false);
- this.groupBox6.PerformLayout();
- this.ResumeLayout(false);
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button5_Click(object sender, EventArgs e)
- {
- if (this.radioButton9.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryDelete;
- }
- }
- else if(this.radioButton8.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryDeleteRectangle;
- }
- }
- else if (this.radioButton7.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryDeleteOval;
- }
- }
- else if (this.radioButton10.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryDeletePolygon;
- }
- }
- }
- /// <summary>
- /// 分割
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, EventArgs e)
- {
- if (this.radioButton1.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinarySplitPolyline;
- }
- }
- else if (this.radioButton2.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinarySplitLine;
- }
- }
- else if (this.radioButton3.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinarySplitOval;
- }
- }
- this.appWorkspace.ActiveDocumentWorkspace.ContinuousBinaryAction = true;
- }
- /// <summary>
- /// 连接
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- if (this.radioButton6.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryConnectionPolygonLine;
- }
- }
- else if (this.radioButton5.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryConnectionLine;
- }
- }
- else if (this.radioButton4.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryConnectionOval;
- }
- }
- this.appWorkspace.ActiveDocumentWorkspace.ContinuousBinaryAction = true;
- }
- /// <summary>
- /// 添加
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- if (this.radioButton14.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryAddRectangle;
- }
- }
- else if (this.radioButton13.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryAddOval;
- }
- }
- else if (this.radioButton11.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryAddTrack;
- }
- }
- else if (this.radioButton12.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryAddPolygon;
- }
- }
- this.appWorkspace.ActiveDocumentWorkspace.ContinuousBinaryAction = true;
- }
- /// <summary>
- /// 选择
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button7_Click(object sender, EventArgs e)
- {
- if (this.radioButton18.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryChoise;
- }
- }
- else if (this.radioButton17.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryChoiseRectangle;
- }
- }
- else if (this.radioButton16.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryChoiseOval;
- }
- }
- else if (this.radioButton15.Checked)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.BinaryChoisePolygon;
- }
- }
- this.appWorkspace.ActiveDocumentWorkspace.ContinuousBinaryAction = true;
- }
- /// <summary>
- /// 取消
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 确定
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- this.restore = false;
- this.Close();
- }
- /// <summary>
- /// 分割
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- InvariantData.segmentation = Convert.ToInt32(this.numericUpDown1.Value);
- }
- /// <summary>
- /// 连接
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown2_ValueChanged(object sender, EventArgs e)
- {
- InvariantData.connection = Convert.ToInt32(this.numericUpDown2.Value);
- }
- /// <summary>
- /// 窗口关闭事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ObjectActionDialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace == null)
- return;
- //取消连续
- this.appWorkspace.ActiveDocumentWorkspace.ContinuousBinaryAction = false;
- //设置活动的窗口工具为指针
- this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.Pointer;
- //清空所有交互操作的draw对象
- this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.DeleteDrawClass(DrawClass.Interaction);
- //如果为true,则还原相
- if (restore)
- {
- this.appWorkspace.ActiveDocumentWorkspace.PhaseModels = this.PhaseModelsBackUp;
- }
- //刷新活动的窗口
- this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- saveDialogParam();
- }
- /// <summary>
- /// 选择,反选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button10_Click(object sender, EventArgs e)
- {
- //判断两个备份的mat和激活的mat不相等才进行处理
- for (int j = 0; j < this.appWorkspace.ActiveDocumentWorkspace.phaseModels.Count; j++)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.phaseModels[j].choise)
- {
- if (!BaseTools.matEqual(this.appWorkspace.ActiveDocumentWorkspace.phaseModels[j].mat, this.PhaseModelsBackUp[j].mat))
- {
- this.appWorkspace.ActiveDocumentWorkspace.BinaryActionAntiElection(j);
- }
- }
- }
- }
- /// <summary>
- /// 选择,全不选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button9_Click(object sender, EventArgs e)
- {
- this.appWorkspace.ActiveDocumentWorkspace.PhaseModels = this.PhaseModelsBackUpForCopy;
- this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- }
- /// <summary>
- /// 选择,应用
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button8_Click(object sender, EventArgs e)
- {
- if(this.appWorkspace.ActiveDocumentWorkspace!=null && this.appWorkspace.ActiveDocumentWorkspace.phaseModels!=null)
- {
- //判断备份的mat和激活的mat不相等才进行处理
- for (int j = 0; j < this.appWorkspace.ActiveDocumentWorkspace.phaseModels.Count; j++)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.phaseModels[j].choise)
- {
- if (!BaseTools.matEqual(this.appWorkspace.ActiveDocumentWorkspace.phaseModels[j].mat, this.PhaseModelsBackUp[j].mat))
- {
- this.appWorkspace.ActiveDocumentWorkspace.BinaryActionAntiConfirm(j);
- }
- }
- }
- }
- }
- #region 参数保存及提取
- /// <summary>
- /// 保存参数的key,value和type
- /// </summary>
- /// <param name="param_key"></param>
- /// <param name="param_value"></param>
- /// <param name="param_type"></param>
- private void saveParamValue(string param_key, string param_value, int param_type)
- {
- bool foundItem = false;
- foreach (var item in this.analysisModel.ListParam)
- {
- if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
- {
- item.param_value = param_value;
- item.setValue();
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- {
- GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
- analysisItem.menuId = this.menuId;
- analysisItem.param_key = param_key;
- analysisItem.param_type = param_type;
- analysisItem.param_value = param_value;
- analysisItem.setValue();
- this.analysisModel.ListParam.Add(analysisItem);
- }
- }
- /// <summary>
- /// 获取被选中的选项放入list
- /// </summary>
- private void OptionList()
- {
- string division = string.Empty;//分割选项
- string connect = string.Empty;//连接选项
- string delete = string.Empty;//删除选项
- string add = string.Empty;//添加选项
- string choice = string.Empty;//选择选项
- if (this.radioButton1.Checked)
- division = this.radioButton1.Text;
- if (this.radioButton2.Checked)
- division = this.radioButton2.Text;
- if (this.radioButton3.Checked)
- division = this.radioButton3.Text;
- if (this.radioButton6.Checked)
- connect = this.radioButton6.Text;
- if (this.radioButton5.Checked)
- connect = this.radioButton5.Text;
- if (this.radioButton4.Checked)
- connect = this.radioButton4.Text;
- if (this.radioButton9.Checked)
- delete = this.radioButton9.Text;
- if (this.radioButton8.Checked)
- delete = this.radioButton8.Text;
- if (this.radioButton7.Checked)
- delete = this.radioButton7.Text;
- if (this.radioButton10.Checked)
- delete = this.radioButton10.Text;
- if (this.radioButton14.Checked)
- add = this.radioButton14.Text;
- if (this.radioButton13.Checked)
- add = this.radioButton13.Text;
- if (this.radioButton11.Checked)
- add = this.radioButton11.Text;
- if (this.radioButton12.Checked)
- add = this.radioButton12.Text;
- if (this.radioButton18.Checked)
- choice = this.radioButton18.Text;
- if (this.radioButton17.Checked)
- choice = this.radioButton17.Text;
- if (this.radioButton16.Checked)
- choice = this.radioButton16.Text;
- if (this.radioButton15.Checked)
- choice = this.radioButton15.Text;
- optionList.Add(division);
- optionList.Add(connect);
- optionList.Add(delete);
- optionList.Add(add);
- optionList.Add(choice);
- }
- /// <summary>
- /// 保存界面中的参数到model
- /// </summary>
- private void saveDialogParamValues()
- {
- OptionList();
- saveParamValue(ParamKey_DivisionOption, optionList[0], (int)Base.Dtryt.ItemString);//分割选项
- saveParamValue(ParamKey_DivisionLineWidth, this.numericUpDown1.Value.ToString(), (int)Base.Dtryt.Decimal);//分割线宽
- saveParamValue(ParamKey_ConnectOption, optionList[1], (int)Base.Dtryt.ItemString);//连接选项
- saveParamValue(ParamKey_ConnectLineWidth, this.numericUpDown2.Value.ToString(), (int)Base.Dtryt.Decimal);//连接线宽
- saveParamValue(ParamKey_DeleteOption, optionList[2], (int)Base.Dtryt.ItemString);//删除选项
- saveParamValue(ParamKey_AddOption, optionList[3], (int)Base.Dtryt.ItemString);//添加选项
- saveParamValue(ParamKey_ChoiceOption, optionList[4], (int)Base.Dtryt.ItemString);//选择选项
- }
- /// <summary>
- /// 获取保存的参数
- /// </summary>
- private void GetListParamModel()
- {
- if (this.analysisModel != null)
- {
- for (int i = 0; i < this.analysisModel.ListParam.Count; i++)
- {
- switch (this.analysisModel.ListParam[i].param_key)
- {
- case ParamKey_DivisionOption:
- if (this.radioButton1.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton1.Checked = true;
- if (this.radioButton2.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton2.Checked = true;
- if (this.radioButton3.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton3.Checked = true;
- break;
- case ParamKey_DivisionLineWidth:
- this.numericUpDown1.Value = decimal.Parse(this.analysisModel.ListParam[i].value.ToString());
- break;
- case ParamKey_ConnectOption:
- if (this.radioButton6.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton6.Checked = true;
- if (this.radioButton5.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton5.Checked = true;
- if (this.radioButton4.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton4.Checked = true;
- break;
- case ParamKey_ConnectLineWidth:
- this.numericUpDown2.Value = decimal.Parse(this.analysisModel.ListParam[i].value.ToString());
- break;
- case ParamKey_DeleteOption:
- if (this.radioButton9.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton9.Checked = true;
- if (this.radioButton8.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton8.Checked = true;
- if (this.radioButton7.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton7.Checked = true;
- if (this.radioButton10.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton10.Checked = true;
- break;
- case ParamKey_AddOption:
- if (this.radioButton14.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton14.Checked = true;
- if (this.radioButton13.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton13.Checked = true;
- if (this.radioButton11.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton11.Checked = true;
- if (this.radioButton12.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton12.Checked = true;
- break;
- case ParamKey_ChoiceOption:
- if (this.radioButton18.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton18.Checked = true;
- if (this.radioButton17.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton17.Checked = true;
- if (this.radioButton16.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton16.Checked = true;
- if (this.radioButton15.Text.Equals(this.analysisModel.ListParam[i].param_value))
- this.radioButton15.Checked = true;
- break;
- }
- }
- }
- }
- private void saveDialogParam()
- {
- this.saveDialogParamValues();
- //xml保存路径
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\BinaryActionSaving\\ParameterSaving.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- foreach (var analysisItem in this.analysisModel.ListParam)
- {
- bool foundItem = false;
- foreach (var item in analysisModelXml.ListParam)
- {
- if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
- {
- item.param_value = analysisItem.param_value;
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- analysisModelXml.ListParam.Add(analysisItem.cloneModel());
- }
- //按路径和名称保存xml文件
- string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
- //保存xml
- FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
- }
- #endregion
- }
- }
|