Example #1
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;
                }
            }
        }
        /// <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 selection of un item in the ComboBox2
        /// </summary>
        /// <param name="sender">Object (sender)</param>
        /// <param name="e">Events arguments</param>
        private void ComboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.showModel = false;
            if (this.comboBox2.Text != string.Empty)
            {
                this.idField = 0;
                for (int j = 0; j < this.shapeLayer.DataTable.Columns.Count; j++)
                {
                    if (this.shapeLayer.DataTable.Columns[j].ColumnName == this.comboBox2.Text)
                    {
                        this.idField = j;
                    }
                }

                this.mkriging = new Kriging(this.shapeLayer, this.idField);
                this.pictureBox1.Visible = true;
            }
            else 
            {
                this.groupBox2.Enabled = false;
                this.groupBox3.Enabled = false;
                this.groupBox4.Enabled = false;
                this.pictureBox1.Visible = false;
            }
        }