Exemple #1
0
        public void TestRealVolumeDiff()
        {
            CsvDataSource csvDataSource = new CsvDataSource();
            CsvOptions    csvOptions    = (CsvOptions)csvDataSource.GetDefaultOptions();

            csvOptions.FileName  = Path.Combine(TestDir, "depthvalues.csv");
            csvOptions.GridStep  = "200 m";
            csvOptions.Separator = " ";

            DefaultTriangulation triangulation = new DefaultTriangulation();

            SourceSurface surfaceTop             = csvDataSource.GetSurface(csvOptions);
            var           triangulatedSurfaceTop = triangulation.GetTriangulatedSurface(surfaceTop, triangulation.GetDefaultOptions());

            SourceSurfaceMover mover = new SourceSurfaceMover();
            var moverOptions         = (SourceSurfaceMoverOptions)mover.GetDefaultOptions();

            moverOptions.Z = "100 m";
            SourceSurface surfaceBottom             = mover.GetModifiedSurface(surfaceTop, moverOptions);
            var           triangulatedSurfaceBottom = triangulation.GetTriangulatedSurface(surfaceBottom, triangulation.GetDefaultOptions());

            IVolumeService service = new VolumeService();

            var topVolume    = service.GetVolumeUnderSurface(triangulatedSurfaceTop, 10000);
            var bottomVolume = service.GetVolumeUnderSurface(triangulatedSurfaceBottom, 10000);

            var diff = (int)(topVolume - bottomVolume);

            Assert.AreEqual(200 * 200 * 100 * 15 * 25, diff);
        }
Exemple #2
0
        public void TestSurfaceMover()
        {
            var points = new Point3D[]
            {
                new Point3D(0, 0, 1), new Point3D(100, 0, 2), new Point3D(200, 0, 3), new Point3D(0, 100, 4), new Point3D(100, 100, 5), new Point3D(200, 100, 6)
            };

            SourceSurface surface = new SourceSurface(points);

            SourceSurfaceMover        mover   = new SourceSurfaceMover();
            SourceSurfaceMoverOptions options = (SourceSurfaceMoverOptions)mover.GetDefaultOptions();

            options.X = "10 m";
            options.Y = "8 m";
            options.Z = "3 m";

            var newSurface = mover.GetModifiedSurface(surface, options);

            for (var index = 0; index < points.Length; index++)
            {
                var point = points[index];
                Assert.True(new Point3D(point.X + 10, point.Y + 8, point.Z + 3).AreEqual(newSurface.Points[index]));
            }
        }