Ejemplo n.º 1
0
        public void TestImportFromPar()
        {
            Soil S = Soil.Create(SoilParFile.Import("./Temp.par"));

            Assert.AreEqual(S.Name, "BlackVertosol");
            Assert.IsTrue(MathUtility.AreEqual(S.Water.BD,
                                               new double[] { 1.02, 1.03, 1.02, 1.02, 1.06, 1.11, 1.12, 1.15, 1.18, 1.2, 1.25 }));
            Assert.IsTrue(MathUtility.AreEqual(S.OC,
                                               new double[] { 1.04, 0.89, 0.89, 0.89, 0.77, 0.45, 0.27, 0.22, 0.16, 0.13, 0.12 }));
            Assert.IsTrue(MathUtility.AreEqual(S.Crop("nwheat").LL,
                                               new double[] { 0.290, 0.290, 0.320, 0.320, 0.350, 0.380, 0.410, 0.480, 0.470, 0.460, 0.440 }));
        }
Ejemplo n.º 2
0
        public static void ImportFromPar(BaseController Controller)
        {
            OpenFileDialog Dialog = new OpenFileDialog();

            Dialog.Filter           = "Par files (*.par)|*.par|All files (*.*)|*.*";
            Dialog.Title            = "Select 1 or more .par file(s) to import from";
            Dialog.Multiselect      = true;
            Dialog.RestoreDirectory = true;
            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                foreach (string FileName in Dialog.FileNames)
                {
                    Cursor.Current = Cursors.WaitCursor;
                    Controller.Selection.Add(SoilParFile.Import(FileName));
                    Cursor.Current = Cursors.Default;
                }
            }
        }