示例#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
        /// <summary>
        /// Calculates an elevation sub grid for a designated sub grid on this design
        /// </summary>
        public async Task <(IClientHeightLeafSubGrid designHeights, DesignProfilerRequestResult errorCode)> GetDesignHeightsViaDesignElevationService(
            Guid siteModelId,
            double offset,
            SubGridCellAddress originCellAddress,
            double cellSize)
        {
            // Query the DesignProfiler service to get the patch of elevations calculated
            var elevPatchRequest = new DesignElevationPatchRequest();

            var response = await elevPatchRequest.ExecuteAsync(new CalculateDesignElevationPatchArgument
            {
                CellSize        = cellSize,
                ReferenceDesign = new DesignOffset(DesignDescriptor.DesignID, offset),
                OriginX         = originCellAddress.X,
                OriginY         = originCellAddress.Y,
                ProjectID       = siteModelId
            });

            return(response.Heights, response.CalcResult);
        }
示例#3
0
        public void Test_DesignElevationPatchRequest_Creation()
        {
            var request = new DesignElevationPatchRequest();

            request.Should().NotBeNull();
        }