Пример #1
0
        public void CacheFingerprint_EmptyArgument()
        {
            var    arg = new SurfaceElevationPatchArgument();
            Action act = () => arg.CacheFingerprint();

            act.Should().Throw <Exception>();
        }
Пример #2
0
        public void CacheFingerprint_PopulatedArgument()
        {
            Guid id  = Guid.NewGuid();
            var  arg = new SurfaceElevationPatchArgument(id, 1, 2, 3.0, SurveyedSurfacePatchType.EarliestSingleElevation,
                                                         SubGridTreeBitmapSubGridBits.FullMask, new TRex.SurveyedSurfaces.SurveyedSurfaces
            {
                new TRex.SurveyedSurfaces.SurveyedSurface(Guid.NewGuid(), new DesignDescriptor(Guid.NewGuid(), "Folder", "FileName"), DateTime.UtcNow, BoundingWorldExtent3D.Full())
            });

            arg.CacheFingerprint().Should().NotBeNullOrEmpty();
        }
Пример #3
0
        public void FromToBinary()
        {
            Guid id  = Guid.NewGuid();
            var  arg = new SurfaceElevationPatchArgument(id, 1, 2, 3.0, SurveyedSurfacePatchType.EarliestSingleElevation,
                                                         SubGridTreeBitmapSubGridBits.FullMask, new TRex.SurveyedSurfaces.SurveyedSurfaces
            {
                new TRex.SurveyedSurfaces.SurveyedSurface(Guid.NewGuid(), new DesignDescriptor(Guid.NewGuid(), "Folder", "FileName"), DateTime.UtcNow, BoundingWorldExtent3D.Full())
            });

            TestBinarizable_ReaderWriterHelper.RoundTripSerialise(arg);
        }
Пример #4
0
        public void SetOTGBottomLeftLocation()
        {
            var arg = new SurfaceElevationPatchArgument();

            arg.OTGCellBottomLeftX.Should().Be(0);
            arg.OTGCellBottomLeftY.Should().Be(0);

            arg.SetOTGBottomLeftLocation(10, 11);
            arg.OTGCellBottomLeftX.Should().Be(10);
            arg.OTGCellBottomLeftY.Should().Be(11);
        }
Пример #5
0
        public void Creation()
        {
            Guid id  = Guid.NewGuid();
            var  arg = new SurfaceElevationPatchArgument(id, 1, 2, 3.0, SurveyedSurfacePatchType.EarliestSingleElevation,
                                                         SubGridTreeBitmapSubGridBits.FullMask, new TRex.SurveyedSurfaces.SurveyedSurfaces
            {
                new TRex.SurveyedSurfaces.SurveyedSurface(Guid.NewGuid(), new DesignDescriptor(Guid.NewGuid(), "Folder", "FileName"), DateTime.UtcNow, BoundingWorldExtent3D.Full())
            });

            arg.Should().NotBeNull();
            arg.CellSize.Should().Be(3.0);
            arg.IncludedSurveyedSurfaces.Length.Should().Be(1);
            arg.OTGCellBottomLeftX.Should().Be(1);
            arg.OTGCellBottomLeftY.Should().Be(2);
            arg.ProcessingMap.Should().BeEquivalentTo(SubGridTreeBitmapSubGridBits.FullMask);
            arg.SiteModelID.Should().NotBeEmpty();
            arg.SurveyedSurfacePatchType.Should().Be(SurveyedSurfacePatchType.EarliestSingleElevation);
        }
Пример #6
0
        public void Test_ToString()
        {
            var arg = new SurfaceElevationPatchArgument();

            arg.ToString().Should().Match("*SiteModel:*OTGOriginBL*CellSize*SurfacePatchType*");
        }
Пример #7
0
        /// <summary>
        /// Annotates height information with elevations from surveyed surfaces
        /// </summary>
        private ServerRequestResult PerformHeightAnnotation()
        {
            if (!_haveComputedSpatialFilterMaskAndClientProdDataMap)
            {
                // At this point, the prod data map will be empty. Fill it here so the filter has something to filter against...
                _clientGrid.ProdDataMap.Fill();
            }

            if (!_haveComputedSpatialFilterMaskAndClientProdDataMap && (ComputeSpatialFilterMaskAndClientProdDataMap() != ServerRequestResult.NoError))
            {
                ClientLeafSubGridFactory.ReturnClientSubGrid(ref _clientGrid);
                return(ServerRequestResult.FilterInitialisationFailure);
            }

            if ((_filteredSurveyedSurfaces?.Count ?? 0) == 0)
            {
                return(ServerRequestResult.NoError);
            }

            var result = ServerRequestResult.NoError;

            // TODO: Add Debug_SwitchOffCompositeSurfaceGenerationFromSurveyedSurfaces to configuration
            // if <config>.Debug_SwitchOffCompositeSurfaceGenerationFromSurveyedSurfaces then Exit;

            if (!_clientGrid.UpdateProcessingMapForSurveyedSurfaces(_processingMap, _filteredSurveyedSurfaces as IList, _returnEarliestFilteredCellPass))
            {
                return(ServerRequestResult.NoError);
            }

            if (_processingMap.IsEmpty())
            {
                return(result);
            }

            try
            {
                // Hand client grid details, a mask of cells we need surveyed surface elevations for, and a temp grid to the Design Profiler

                // Instantiate an argument object for the surface elevation patch request. We always want to request all surface elevations to
                // promote cacheability.
                var surfaceElevationPatchArg = new SurfaceElevationPatchArgument
                {
                    SiteModelID              = _siteModel.ID,
                    OTGCellBottomLeftX       = _clientGrid.OriginX,
                    OTGCellBottomLeftY       = _clientGrid.OriginY,
                    CellSize                 = _siteModel.CellSize,
                    IncludedSurveyedSurfaces = _filteredSurveyedSurfacesAsGuidArray,
                    SurveyedSurfacePatchType = _surveyedSurfacePatchType,
                    ProcessingMap            = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Filled)
                };

                if (!(_surfaceElevationPatchRequest.Execute(surfaceElevationPatchArg) is ClientHeightAndTimeLeafSubGrid surfaceElevations))
                {
                    return(result);
                }

                // Construct the elevation range filter lambda
                Func <int, int, float, bool> elevationRangeFilterLambda = null;
                if (_filter.AttributeFilter.HasElevationRangeFilter)
                {
                    elevationRangeFilterLambda = ApplyElevationRangeFilter;
                }

                if (!_clientGrid.PerformHeightAnnotation(_processingMap, _filteredSurveyedSurfaces as IList, _returnEarliestFilteredCellPass, surfaceElevations, elevationRangeFilterLambda))
                {
                    return(ServerRequestResult.SubGridHeightAnnotationFailed);
                }

                result = ServerRequestResult.NoError;
            }
            finally
            {
                // TODO: Use client sub grid pool...
                //    PSNodeImplInstance.RequestProcessor.RepatriateClientGrid(TICSubGridTreeLeafSubGridBase(SurfaceElevations));
            }

            return(result);
        }