Ejemplo n.º 1
0
        protected override async Task <ContractExecutionResult> ProcessAsyncEx <T>(T item)
        {
            var request = item as PatchDataRequest;

            if (request == null)
            {
                ThrowRequestTypeCastException <PatchRequest>();
            }

            var siteModel = GetSiteModel(request?.ProjectUid);

            var filter1 = ConvertFilter(request?.Filter, siteModel);
            var filter2 = ConvertFilter(request?.Filter2, siteModel);

            var req = new PatchRequest();

            var result = await req.ExecuteAndConvertToResult(new PatchRequestArgument
            {
                ProjectID       = siteModel.ID,
                Filters         = new FilterSet(new[] { filter1, filter2 }),
                Mode            = request.Mode,
                DataPatchNumber = request.PatchNumber,
                DataPatchSize   = request.PatchSize,
                Overrides       = AutoMapperUtility.Automapper.Map <OverrideParameters>(request.Overrides),
                LiftParams      = ConvertLift(request.LiftSettings, request.Filter?.LayerType)
            });

            result.CellSize = siteModel.CellSize;

            return(new PatchDataResult(result.ConstructResultData()));
        }
Ejemplo n.º 2
0
        public async Task PatchResult_ConstructResultData()
        {
            AddApplicationGridRouting();
            AddClusterComputeGridRouting();

            var siteModel = BuildModelForSingleCellPatch(HEIGHT_INCREMENT_0_5);

            var request = new PatchRequest();
            var result  = await request.ExecuteAndConvertToResult(SimplePatchRequestArgument(siteModel.ID));

            var bytes = result.ConstructResultData();

            bytes.Should().NotBeNull();
        }
Ejemplo n.º 3
0
        public async Task ExecuteAndConvertToResult()
        {
            AddApplicationGridRouting();
            AddClusterComputeGridRouting();

            var siteModel = BuildModelForSingleCellPatch(HEIGHT_INCREMENT_0_5);

            var request = new PatchRequest();
            var result  = await request.ExecuteAndConvertToResult(SimplePatchRequestArgument(siteModel.ID));

            result.Should().NotBeNull();
            result.Patch.Should().NotBeNull();
            result.Patch.Length.Should().Be(1);

            result.Patch[0].ElevationOrigin.Should().Be(5.5f);
            result.Patch[0].Data[0, 0].ElevationOffset.Should().Be(0);
        }
Ejemplo n.º 4
0
        public async Task Test_PatchRequest_ExecuteAndConvert_SingleTAGFileSiteModel()
        {
            AddApplicationGridRouting();
            AddClusterComputeGridRouting();

            var tagFiles = new[]
            {
                Path.Combine(TestHelper.CommonTestDataPath, "TestTAGFile.tag"),
            };

            var siteModel = DITAGFileAndSubGridRequestsFixture.BuildModel(tagFiles, out _);
            var request   = new PatchRequest();
            var result    = await request.ExecuteAndConvertToResult(SimplePatchRequestArgument(siteModel.ID));

            result.Should().NotBeNull();
            result.Patch.Should().NotBeNull();
            result.Patch.Length.Should().Be(12);
            Math.Round(result.Patch[0].SubGridOriginX, 4).Should().Be(537667.84);
            Math.Round(result.Patch[0].SubGridOriginY, 4).Should().Be(5427390.08);
            Math.Round(result.Patch[0].ElevationOrigin, 4).Should().Be(41.397);
            result.Patch[0].TimeOrigin.Should().Be(1361929472);

            result.Patch[0].Data[13, 26].ElevationOffset.Should().Be(uint.MaxValue);
            result.Patch[0].Data[13, 26].TimeOffset.Should().Be(uint.MaxValue);
            result.Patch[0].Data[13, 27].ElevationOffset.Should().Be(59);
            result.Patch[0].Data[13, 27].TimeOffset.Should().Be(48000000);
            result.Patch[0].Data[13, 28].ElevationOffset.Should().Be(63);
            result.Patch[0].Data[13, 28].TimeOffset.Should().Be(50000000);

            Math.Round(result.Patch[1].SubGridOriginX, 4).Should().Be(537667.84);
            Math.Round(result.Patch[1].SubGridOriginY, 4).Should().Be(5427400.96);
            Math.Round(result.Patch[1].ElevationOrigin, 4).Should().Be(41.451);
            result.Patch[1].TimeOrigin.Should().Be(4237436768);

            Math.Round(result.Patch[2].SubGridOriginX, 4).Should().Be(537667.84);
            Math.Round(result.Patch[2].SubGridOriginY, 4).Should().Be(5427411.84);
            Math.Round(result.Patch[2].ElevationOrigin, 4).Should().Be(41.505);
            result.Patch[2].TimeOrigin.Should().Be(7369472);
        }