コード例 #1
0
 public void RemoveTrend(int idFieldToApplyTrend, Trend trend)
 {
     foreach (Feature fea1 in data.Features)
     {
         double[] value = trend.Interpolate(fea1.Coordinates[0].X, fea1.Coordinates[0].Y, fea1.Coordinates[0].Z, true);
         fea1.DataRow["Trend"] = value[0];
         fea1.DataRow["Used"] = Convert.ToDouble(fea1.DataRow[idFieldToApplyTrend]) - value[0];
     }
 }
コード例 #2
0
ファイル: Interpolators.cs プロジェクト: shoaib-ijaz/geosoft
        private void SelectorMethodProcedure()
        {
            uxMapTrend.SetProjection(env.OriginalData.Projection);
            uxContinuity.SetProjection(KnownCoordinateSystems.Projected.UtmWgs1984.WGS1984UTMZone10N);
            uxKrigingInterpo.SetProjection(env.OriginalData.Projection);

            if (env.Field != null)
            {
                bool continueI = false;
                if (uxFilter.Visible && !String.IsNullOrEmpty(uxFilter.Text))
                    continueI = env.Load(uxFilter.Text);
                else
                    continueI = env.Load();

                if (continueI)
                {
                    if (uxFilter.Visible && !String.IsNullOrEmpty(uxOutputSelection.Text))
                        try
                        {
                            env.Data.SaveAs(uxOutputSelection.Text, true);
                        }
                        catch
                        {
                            MessageBox.Show("The selection data was not saved");
                        }

                    if (env.Transformation != "None" && env.Trend != 0)
                    {


                        //Measured,Trans,Trend, predictedValue1,Error,stdError,stdezError,norValue
                        Trend t = new Trend(env.Data, 1, env.Trend - 1, env.MeanValue);
                        _trend = t;
                        double cell = env.Data.Extent.Width / 50;
                        uxMapTrend.ValuesMinMax = t.extentZ;
                        IRaster newgrid = t.Surface(env.Data.Extent, cell, env.Data.Projection, -32768, Path.GetTempPath() + "\\t.bgd");////********************change path
                        //  newgrid.Name = "Trend";
                        uxMapTrend.SetSurface(newgrid);

                        uxGoodOfFit.Text = Convert.ToString(t.CrossValidation()[0]);

                        uxOrderOfPolynomial.Text = uxRemoveTrend.Text;

                        env.RemoveTrend(1, t);


                        uxPredictedValue2.ChangedCoordinate += uxPredictedValue2_ChangedCoordinate;
                        uxMapTrend.ChangedCoordinate += uxMapTrend_ChangedCoordinate;



                        uxPages.TabPages[1].Enabled = true;
                        uxPages.SelectedIndex = 1;

                    }

                    if (env.Transformation == "None" && env.Trend != 0)
                    {
                        //Measured,Trans,Trend, predictedValue1,Error,stdError,stdezError,norValue

                        Trend t = new Trend(env.Data, 0, env.Trend - 1, env.MeanValue);
                        _trend = t;
                        double cell = env.Data.Extent.Width / 50;
                        uxMapTrend.ValuesMinMax = t.extentZ;
                        IRaster newgrid = t.Surface(env.Data.Extent, cell, env.Data.Projection, -32768, Path.GetTempPath() + "\\t.bgd");////********************change path
                        //  newgrid.Name = "Trend";
                        uxMapTrend.SetSurface(newgrid);

                        uxGoodOfFit.Text = Convert.ToString(t.CrossValidation()[0]);

                        uxOrderOfPolynomial.Text = uxRemoveTrend.Text;

                        env.RemoveTrend(0, t);

                        uxPredictedValue2.ChangedCoordinate += uxPredictedValue2_ChangedCoordinate;
                        uxMapTrend.ChangedCoordinate += uxMapTrend_ChangedCoordinate;

                        uxPages.TabPages[1].Enabled = true;
                        uxPages.SelectedIndex = 1;

                    }

                    if (env.Transformation == "None" && env.Trend == 0)
                    {
                        uxPages.TabPages[1].Enabled = false;
                        uxPages.TabPages[2].Enabled = true;
                        uxPages.SelectedIndex = 2;
                        env.UpdateWorkField(0);
                        StartKriging();

                    }

                    if (env.Transformation != "None" && env.Trend == 0)
                    {
                        uxPages.TabPages[1].Enabled = false;
                        uxPages.TabPages[2].Enabled = true;
                        uxPages.SelectedIndex = 2;
                        env.UpdateWorkField(1);
                        StartKriging();

                    }

                }
            }

            uxOutputInterpolation.DataSource = env.Data.DataTable;
        }