Example #1
0
        /// <summary>
        /// Computes a geometric profile across the design given a series of vertices describing the path to be profiled.
        /// </summary>
        public async Task <(List <XYZS> profile, DesignProfilerRequestResult errorCode)> ComputeProfile(Guid projectUid, WGS84Point startPoint, WGS84Point endPoint, double cellSize, double offset, bool arePositionsGrid)
        {
            // Query the DesignProfiler service to get the patch of elevations calculated
            try
            {
                var profileRequest = new DesignProfileRequest();
                var arg            = new CalculateDesignProfileArgument
                {
                    ProjectID        = projectUid,
                    CellSize         = cellSize,
                    StartPoint       = startPoint,
                    EndPoint         = endPoint,
                    PositionsAreGrid = arePositionsGrid,
                    ReferenceDesign  =
                    {
                        DesignID = DesignDescriptor.DesignID,
                        Offset   = offset
                    }
                };

                var profileResult = await profileRequest.ExecuteAsync(arg);

                return(profileResult.Profile, profileResult.RequestResult);
            }
            catch
            {
                return(null, DesignProfilerRequestResult.UnknownError);
            }
        }
Example #2
0
        [InlineData(247645, 193072, 247680, 193054, 3, 0)] // Profile line between two adjacent triangles, one edge crossed.
        public async Task Test_DesignProfileRequest_OverTTM_NoFilter(double startX, double startY, double endX, double endY, int expectedPointCount, int resultIndex)
        {
            const double EPSILON = 0.001;

            AddDesignProfilerGridRouting();

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

            var request  = new DesignProfileRequest();
            var response = await request.ExecuteAsync(new CalculateDesignProfileArgument
            {
                ProjectID        = siteModel.ID,
                CellSize         = SubGridTreeConsts.DefaultCellSize,
                ReferenceDesign  = referenceDesign,
                Filters          = new FilterSet(new CombinedFilter()),
                StartPoint       = new WGS84Point(startX, startY),
                EndPoint         = new WGS84Point(endX, endY),
                TRexNodeID       = Guid.NewGuid(),
                PositionsAreGrid = true
            });

            response.RequestResult.Should().Be(DesignProfilerRequestResult.OK);
            response.Profile.Count.Should().Be(expectedPointCount);

            var profile = DesignProfileResult(resultIndex);

            response.Profile.Count.Should().Be(profile.Length);

            for (int i = 0; i < response.Profile.Count - 1; i++)
            {
                profile[i].X.Should().BeApproximately(response.Profile[i].X, EPSILON);
                profile[i].Y.Should().BeApproximately(response.Profile[i].Y, EPSILON);
                profile[i].Z.Should().BeApproximately(response.Profile[i].Z, EPSILON);
                profile[i].Station.Should().BeApproximately(response.Profile[i].Station, EPSILON);
            }
        }