Esempio n. 1
0
        public void Serialization_FromPts_Really()
        {
            Assert.IsTrue(Data.Points.Import.Pts.PtsFormat != null);
            var filename = Config.TEST_FILE_NAME_PTS;

            if (!File.Exists(filename))
            {
                Assert.Ignore($"File not found: {filename}");
            }
            Console.WriteLine($"filename: {filename}");

            string id = null;

            var dbDiskLocation = Path.Combine(Path.GetTempPath(), "teststore_" + Guid.NewGuid());

            using (var storageA = PointSetTests.CreateDiskStorage(dbDiskLocation))
            {
                var config = ImportConfig.Default
                             .WithStorage(storageA)
                             .WithKey("test")
                             .WithOctreeSplitLimit(5000)
                ;
                var pointset = PointCloud.Import(filename, config);
                pointset.Root.Value.ForEachNode(true, cell =>
                {
                    var pointcount = cell.Positions?.Value.Length ?? 0;
                    Assert.IsTrue(pointcount > 0);
                    Assert.IsTrue(cell.Positions.Value.Length == pointcount);
                });

                id = pointset.Id;
            }

            using (var storageB = PointSetTests.CreateDiskStorage(dbDiskLocation))
            {
                var pointset = storageB.GetPointSet(id);
                pointset.Root.Value.ForEachNode(true, cell =>
                {
                    var pointcount = cell.Positions?.Value.Length ?? 0;
                    Assert.IsTrue(pointcount > 0);
                    Assert.IsTrue(cell.Positions.Value.Length == pointcount);
                });
            }

            Directory.Delete(dbDiskLocation, true);
        }