示例#1
0
        [InlineData(247680.000 + 100, 193054.000, Consts.NullDouble, 100.1, false)] // Outside of surface so returns NullDouble
        public async Task Test_DesignElevationPatchRequest_WithOffset(double spotX, double spotY, double expectedHeight, double offset, bool patchExists)
        {
            AddDesignProfilerGridRouting();

            var siteModel       = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel();
            var designUid       = DITAGFileAndSubGridRequestsWithIgniteFixture.AddDesignToSiteModel(ref siteModel, TestHelper.CommonTestDataPath, "Bug36372.ttm", false);
            var referenceDesign = new DesignOffset(designUid, 0);

            // Get the cell location of the probe position. Note that the request will return the sub grid
            // that contains this cell, so the origin location of the sub grid may not be the same as the cell location
            //
            siteModel.Grid.CalculateIndexOfCellContainingPosition(spotX, spotY, out int cellX, out int cellY);

            var request  = new DesignElevationPatchRequest();
            var argument = new CalculateDesignElevationPatchArgument
            {
                ProjectID       = siteModel.ID,
                ReferenceDesign = referenceDesign,
                CellSize        = siteModel.CellSize,
                Filters         = new FilterSet(new CombinedFilter()),
                OriginX         = cellX,
                OriginY         = cellY
            };

            var response = await request.ExecuteAsync(argument);

            response.Should().NotBeNull();
            response.CalcResult.Should().Be(patchExists ? DesignProfilerRequestResult.OK : DesignProfilerRequestResult.NoElevationsInRequestedPatch);

            if (patchExists)
            {
                response.Heights.CellSize.Should().Be(siteModel.CellSize);
                response.Heights.GridDataType.Should().Be(GridDataType.Height);
                response.Heights.Level.Should().Be(siteModel.Grid.NumLevels);
                response.Heights.OriginX.Should().Be((int)(cellX & ~SubGridTreeConsts.SubGridLocalKeyMask));
                response.Heights.OriginY.Should().Be((int)(cellY & ~SubGridTreeConsts.SubGridLocalKeyMask));
                response.Heights.Owner.Should().BeNull();
                response.Heights.Parent.Should().BeNull();
                response.Heights.Cells.Should().NotBeNull();
            }
            else
            {
                response.Heights.Should().BeNull();
            }

            if (patchExists)
            {
                // Check a request with an offset provides the expected answer
                argument.ReferenceDesign.Offset = offset;

                var response2 = await request.ExecuteAsync(argument);

                response2.Should().NotBeNull();
                response2.CalcResult.Should().Be(DesignProfilerRequestResult.OK);
                response2.Heights.Should().NotBeNull();

                response2.Heights.ForEach((x, y) => response2.Heights.Cells[x, y].Should().BeApproximately((float)(response.Heights.Cells[x, y] + offset), TestHelper.ALLOWED_HEIGHT_TOLERANCE_AS_FLOAT));
            }
        }
示例#2
0
        public void Test_CalculateDesignElevationPatchArgument()
        {
            var argument = new CalculateDesignElevationPatchArgument()
            {
                ProjectID       = Guid.NewGuid(),
                Filters         = new FilterSet(new CombinedFilter()),
                CellSize        = TestConsts.CELL_SIZE,
                ReferenceDesign = new DesignOffset(),
                OriginX         = 12345,
                OriginY         = 67890
            };

            SimpleBinarizableInstanceTester.TestClass(argument, "Custom CalculateDesignElevationPatchArgument not same after round trip serialisation");
        }
示例#3
0
        public void Test_CalculateDesignElevationPatchArgument()
        {
            var argument = new CalculateDesignElevationPatchArgument
            {
                ProjectID       = Guid.NewGuid(),
                CellSize        = 0.34,
                OriginX         = 1234,
                OriginY         = 2345,
                Filters         = null,
                ReferenceDesign = new DesignOffset(Guid.NewGuid(), 999.9),
                TRexNodeID      = Guid.NewGuid()
            };

            SimpleBinarizableInstanceTester.TestClass(argument, "Custom CalculateDesignElevationPatchArgument not same after round trip serialisation");
        }