Esempio n. 1
0
 /// <summary>
 /// Reads a GGUStratic XML profile data file.
 /// </summary>
 /// <param name="fileName"></param>
 /// <returns>Profile data</returns>
 public static DrillingProbes ByFileName(string fileName)
 {
     return(new DrillingProbes
     {
         ProfileData = DrillingProfiles.ReadFrom(fileName)
     });
 }
Esempio n. 2
0
        public void TestReadAndReferencing()
        {
            Assert.IsTrue(File.Exists("GGUDrillingProfilesExample.xml"));
            var profiles = DrillingProfiles.ReadFrom("GGUDrillingProfilesExample.xml");

            Assert.IsNotNull(profiles);

            // Check referencing works
            Assert.IsTrue(profiles.Drillings.Any());
            Assert.IsTrue(profiles.Drillings.Any(d => d.SoilLayers.Any()));
            Assert.IsTrue(profiles.Drillings.Any(d => d.SoilLayers.SelectMany(l => l.SoilMainTypes).Any()));
        }
Esempio n. 3
0
        public void TestDrillingWiseGrouping()
        {
            using (var text = File.CreateText("GGUDrillingProfilesExample.txt"))
            {
                Assert.IsTrue(File.Exists("GGUDrillingProfilesExample.xml"));
                var profiles = DrillingProfiles.ReadFrom(@"GGUDrillingProfilesExample.xml");
                Assert.IsNotNull(profiles);

                foreach (var d in profiles.Drillings)
                {
                    text.Write($"{d.Name}; {d.Position.Easting}; {d.Position.Northing}; {d.Position.Height.ToString("0.00", CultureInfo.InvariantCulture)}; ");
                    string[] soils = d.SoilLayers.Select(l => $"{l.Info}; {l.Depth.ToString("0.00", CultureInfo.InvariantCulture)}").ToArray();
                    for (int i = 1; i < soils.Length; i++)
                    {
                        text.Write($"{soils[i]}; ");
                    }
                    text.Write("\n");
                }

                text.Close();
            }
        }