public static IKrigingModel SelectModel(Model value) { IKrigingModel model; switch (value) { case Model.Circular: model = new ModelCircular(); break; case Model.Exponential: model = new ModelExponential(); break; case Model.Gaussian: model = new ModelGaussian(); break; case Model.Linear: model = new ModelLineal(); break; case Model.Spherical: model = new ModelSpherical(); break; default: model = new ModelExponential(); break; } return model; }
/// <summary> /// This function is executed after click over button Button1 (apply the model) /// </summary> /// <param name="sender">Object (sender)</param> /// <param name="e">Events arguments</param> private void Button1_Click(object sender, EventArgs e) { IKrigingModel model; if ((this.mtxrange.Text != string.Empty) && (this.mtxc0.Text != string.Empty) && (this.mtxc1.Text != string.Empty)) { if (double.Parse(this.mtxrange.Text) == 0) { MessageBox.Show("Range must be greater than zero"); } else { switch (this.listBox1.SelectedItems[0].ToString()) { case "Gaussian": model = new ModelGaussian(); break; case "Circular": model = new ModelCircular(); break; case "Exponential": model = new ModelExponential(); break; case "Spherical": model = new ModelSpherical(); break; case "Lineal": model = new ModelLineal(); break; default: model = new ModelLineal(); break; } model.C0 = double.Parse(this.mtxc0.Text); model.C1 = double.Parse(this.mtxc1.Text); model.Range = double.Parse(this.mtxrange.Text); this.mkriging = new Kriging(this.shapeLayer, this.idField, model); this.showModel = true; this.VerSemi_Click(sender, e); this.groupBox4.Enabled = true; } } }