Пример #1
0
        public void Serialization_Complex()
        {
            var arg = new SimpleVolumesRequestArgument
            {
                CutTolerance            = 0.05,
                FillTolerance           = 0.01,
                AdditionalSpatialFilter = new CombinedFilter(),
                ExternalDescriptor      = Guid.NewGuid(),
                Filters    = new FilterSet(new CombinedFilter()),
                LiftParams = new LiftParameters(),
                OriginatingIgniteNodeId = Guid.NewGuid(),
                Overrides  = new OverrideParameters(),
                ProjectID  = Guid.NewGuid(),
                BaseDesign = new DesignOffset(Guid.NewGuid(), 1.23),
                TopDesign  = new DesignOffset(Guid.NewGuid(), 1.33),
                VolumeType = VolumeComputationType.BetweenDesignAndFilter
            };

            var writer = new TestBinaryWriter();

            arg.ToBinary(writer);

            var cp2 = new SimpleVolumesRequestArgument();

            cp2.FromBinary(new TestBinaryReader(writer._stream.BaseStream as MemoryStream));

            arg.Should().BeEquivalentTo(cp2);
        }
Пример #2
0
        public async Task <SimpleVolumesResponse> ExecuteAsync(SimpleVolumesRequestArgument arg)
        {
            var request = new SimpleVolumesRequest_ClusterCompute();

            _log.LogInformation("Executing SimpleVolumesRequestComputeFunc_ApplicationService.ExecuteAsync()");

            // Calculate the volumes and convert the grid bounding rectangle into WGS 84 lat/long to return to the caller.
            return(ConvertBoundaryFromGridToWGS84(arg.ProjectID, await request.ExecuteAsync(arg)));
        }
Пример #3
0
        public void Serialization_Null()
        {
            var arg = new SimpleVolumesRequestArgument();

            var writer = new TestBinaryWriter();

            arg.ToBinary(writer);

            var cp2 = new SimpleVolumesRequestArgument();

            cp2.FromBinary(new TestBinaryReader(writer._stream.BaseStream as MemoryStream));

            arg.Should().BeEquivalentTo(cp2);
        }
Пример #4
0
        public async Task FilterToFilter_TwoFilters_WithIntermediary()
        {
            AddApplicationGridRouting();
            AddClusterComputeGridRouting();

            var tagFiles  = Directory.GetDirectories(@"C:\Temp\Tonsasenfiles").Where(x => x.Contains("2005")).SelectMany(Directory.GetFiles).Take(500).ToArray();
            var siteModel = DITAGFileAndSubGridRequestsFixture.BuildModel(tagFiles, out _);

            var request = new SimpleVolumesRequest_ApplicationService();

            var arg = new SimpleVolumesRequestArgument
            {
                ProjectID  = siteModel.ID,
                VolumeType = VolumeComputationType.Between2Filters,
                BaseFilter = new CombinedFilter
                {
                    AttributeFilter =
                    {
                        ReturnEarliestFilteredCellPass = false,
                        HasTimeFilter = true,
                        StartTime     = Consts.MIN_DATETIME_AS_UTC,
                        EndTime       = DateTime.SpecifyKind(new DateTime(2020, 5, 3, 0, 0, 0), DateTimeKind.Utc)
                    }
                },
                TopFilter = new CombinedFilter
                {
                    AttributeFilter =
                    {
                        ReturnEarliestFilteredCellPass = false,
                        HasTimeFilter = true,
                        StartTime     = DateTime.SpecifyKind(new DateTime(2020, 5, 3,  0,  0,  0), DateTimeKind.Utc),
                        EndTime       = DateTime.SpecifyKind(new DateTime(2020, 5, 9, 23, 59, 59), DateTimeKind.Utc)
                    }
                },
                BaseDesign    = new DesignOffset(),
                TopDesign     = new DesignOffset(),
                CutTolerance  = 0.001,
                FillTolerance = 0.001
            };

            var response = await request.ExecuteAsync(arg);

            _log.LogInformation($"Volume result = Cut:{response.Cut} CutArea:{response.CutArea} Fill:{response.Fill} FillArea:{response.FillArea}, TotalArea:{response.TotalCoverageArea}");

            // Volume result = Cut:574.2604204345703 CutArea: 10261.9276 Fill: 1016.5434415893552 FillArea: 12337.410000000002, TotalArea: 35233.3772

            //CheckDefaultFilterToFilterSingleTAGFileResponse(response);
        }
Пример #5
0
        public void Test_SimpleVolumesRequestArgument()
        {
            ICombinedFilter FromFilter = new CombinedFilter
            {
                AttributeFilter = new CellPassAttributeFilter
                {
                    ReturnEarliestFilteredCellPass = true,
                    HasElevationTypeFilter         = true,
                    ElevationType = ElevationType.First
                },

                SpatialFilter = new CellSpatialFilter
                {
                    CoordsAreGrid = true,
                    IsSpatial     = true,
                    Fence         = new Fence(BoundingWorldExtent3D.Inverted())
                }
            };

            CombinedFilter ToFilter = new CombinedFilter()
            {
                AttributeFilter = new CellPassAttributeFilter()
                {
                    ReturnEarliestFilteredCellPass = false,
                    HasElevationTypeFilter         = true,
                    ElevationType = ElevationType.Last
                },

                SpatialFilter = FromFilter.SpatialFilter
            };
            var argument = new SimpleVolumesRequestArgument()
            {
                ProjectID     = Guid.NewGuid(),
                VolumeType    = VolumeComputationType.Between2Filters,
                BaseFilter    = FromFilter,
                TopFilter     = ToFilter,
                BaseDesign    = new DesignOffset(Guid.NewGuid(), 1.5),
                TopDesign     = new DesignOffset(Guid.NewGuid(), -0.5),
                CutTolerance  = CUT_TOLERANCE,
                FillTolerance = FILL_TOLERANCE
            };

            SimpleBinarizableInstanceTester.TestClass(argument, "Custom SimpleVolumesRequestArgument not same after round trip serialisation");
        }
Пример #6
0
        public void Test_SimpleVolumesRequestArgument_Creation()
        {
            var arg = new SimpleVolumesRequestArgument();

            Assert.NotNull(arg);
        }