Esempio n. 1
0
        public void Test_ElevationAggregator_ProcessResult_WithAggregation()
        {
            var aggregator = new ElevationStatisticsAggregator();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.Height) as ClientHeightLeafSubGrid;

            clientGrid.FillWithTestPattern();

            var dLength = clientGrid.Cells.Length;

            aggregator.CellSize = TestConsts.CELL_SIZE;

            IClientLeafSubGrid[][] subGrids = new[] { new[] { clientGrid } };

            aggregator.ProcessSubGridResult(subGrids);

            // Other aggregator...
            var otherAggregator = new ElevationStatisticsAggregator();

            otherAggregator.CellSize = TestConsts.CELL_SIZE;

            otherAggregator.ProcessSubGridResult(subGrids);

            aggregator.AggregateWith(otherAggregator);

            Assert.True(aggregator.CellsScanned == dLength * 2, "Invalid value for CellsScanned.");
            Assert.True(aggregator.CellsUsed == dLength * 2, "Invalid value for CellsUsed.");
            Assert.True(Math.Abs(aggregator.CoverageArea - 2 * dLength * Math.Pow(aggregator.CellSize, 2)) < Consts.TOLERANCE_AREA, "Invalid value for CoverageArea.");
            Assert.True(Math.Abs(aggregator.MinElevation) < Consts.TOLERANCE_HEIGHT, "Invalid value for MinElevation.");
            Assert.True(Math.Abs(aggregator.MaxElevation - MAX_ELEVATION) < Consts.TOLERANCE_HEIGHT, "Invalid value for MaxElevation.");
        }
Esempio n. 2
0
        public void Test_ElevationStatisticsAggregator_Creation()
        {
            var aggregator = new ElevationStatisticsAggregator();

            Assert.True(aggregator.SiteModelID == Guid.Empty, "Invalid initial value for SiteModelID.");
            Assert.True(aggregator.CellSize < Consts.TOLERANCE_DIMENSION, "Invalid initial value for CellSize.");
            Assert.True(Math.Abs(aggregator.MinElevation - Consts.MAX_ELEVATION) < Consts.TOLERANCE_HEIGHT, "Invalid initial value for MinElevation.");
            Assert.True(Math.Abs(aggregator.MaxElevation - Consts.MIN_ELEVATION) < Consts.TOLERANCE_HEIGHT, "Invalid initial value for MaxElevation.");
            Assert.True(aggregator.CellsUsed == 0, "Invalid initial value for CellsUsed.");
            Assert.True(aggregator.CellsScanned == 0, "Invalid initial value for CellsScanned.");
            Assert.True(!aggregator.BoundingExtents.IsValidPlanExtent, "Aggregator BoundingExtents should be inverted.");
        }
Esempio n. 3
0
        public void Test_ElevationStatisticsAggregator_ProcessResult_NoAggregation()
        {
            var aggregator = new ElevationStatisticsAggregator();

            var clientGrid = new ClientHeightLeafSubGrid();

            clientGrid.FillWithTestPattern();

            var dLength = clientGrid.Cells.Length;

            aggregator.CellSize = TestConsts.CELL_SIZE;

            IClientLeafSubGrid[][] subGrids = new[] { new[] { clientGrid } };

            aggregator.ProcessSubGridResult(subGrids);

            Assert.True(aggregator.CellsScanned == dLength, "Invalid value for CellsScanned.");
            Assert.True(aggregator.CellsUsed == dLength, "Invalid value for CellsUsed.");
            Assert.True(Math.Abs(aggregator.CoverageArea - dLength * Math.Pow(aggregator.CellSize, 2)) < Consts.TOLERANCE_AREA, "Invalid value for CoverageArea.");
            Assert.True(Math.Abs(aggregator.MinElevation) < Consts.TOLERANCE_HEIGHT, "Invalid value for MinElevation.");
            Assert.True(Math.Abs(aggregator.MaxElevation - MAX_ELEVATION) < Consts.TOLERANCE_HEIGHT, "Invalid value for MaxElevation.");
        }