12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211 |
- 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)
- {
- //取消连续
- 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
- }
- }
|