Example #1
2
        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 method execute a test of the Kriging plugin ( it´s needed a shapefile)
        /// It its needed to desable the menus
        /// </summary>
        public void Test()
        {
            ModelExponential model = new ModelExponential();
            model.Range = 700;
            model.C0 = 0;
            model.C1 = 300;

            IFeatureSet shapeLayer = FeatureSet.Open("C:/temp/puntos.shp");

            Kriging mkriging;
            mkriging = new Kriging(shapeLayer, 5, model);

            double height = Math.Abs(shapeLayer.Extent.MaxY - shapeLayer.Extent.MinY);
            double width = Math.Abs(shapeLayer.Extent.MaxX - shapeLayer.Extent.MinX);
            double defaultCellSize = -1;
            if (height <= width)
            {
                defaultCellSize = height / 50;
            }
            else
            {
                defaultCellSize = width / 50;
            }

            string salida = "C:/temp/salida.bil";
            MessageBox.Show("Cellsize:" + defaultCellSize.ToString() + " Projection: " + shapeLayer.Projection);
            mkriging.Surface(shapeLayer.Extent, defaultCellSize, shapeLayer.Projection, -32768, salida);
            MessageBox.Show("Ok..");

        }
Example #3
0
        /// <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;
                }
            }
        }