Ejemplo n.º 1
0
        public virtual void Initialise()
        {
            // Todo: Only first filter in filter set is currently used for surface & alignment mask designs or surveyed surface restriction driven by date range
            var PassFilter = FilterSet.Filters[0].AttributeFilter;
            var CellFilter = FilterSet.Filters[0].SpatialFilter;

            if (CellFilter.SurfaceDesignMaskDesignUid != Guid.Empty)
            {
                SurfaceDesignMaskDesign = SiteModel.Designs.Locate(CellFilter.SurfaceDesignMaskDesignUid);
                if (SurfaceDesignMaskDesign == null)
                {
                    throw new ArgumentException($"Design {CellFilter.SurfaceDesignMaskDesignUid} not found in project {SiteModel.ID}");
                }
            }

            if (SiteModel.SurveyedSurfaces?.Count > 0)
            {
                // Filter out any surveyed surfaces which don't match current filter (if any)
                // - realistically, this is time filters we're thinking of here

                FilteredSurveyedSurfaces = DIContext.Obtain <ISurveyedSurfaces>();

                SiteModel.SurveyedSurfaces?.FilterSurveyedSurfaceDetails(PassFilter.HasTimeFilter, PassFilter.StartTime,
                                                                         PassFilter.EndTime, PassFilter.ExcludeSurveyedSurfaces(), FilteredSurveyedSurfaces,
                                                                         PassFilter.SurveyedSurfaceExclusionList);

                if (FilteredSurveyedSurfaces?.Count == 0)
                {
                    FilteredSurveyedSurfaces = null;
                }
            }

            // Instantiate a single instance of the argument object for the surface elevation patch requests to obtain composite
            // elevation sub grids and populate it with the common elements for this set of sub grids being requested.
            SurfaceElevationPatchArg = new SurfaceElevationPatchArgument
                                           (siteModelID:  SiteModel.ID,
                                           oTGCellBottomLeftX: int.MaxValue,
                                           oTGCellBottomLeftY: int.MaxValue,
                                           cellSize: SiteModel.CellSize,
                                           includedSurveyedSurfaces: FilteredSurveyedSurfaces,
                                           surveyedSurfacePatchType: SurveyedSurfacePatchType.CompositeElevations,
                                           processingMap: new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Filled));

            var _cache   = DIContext.Obtain <ITRexSpatialMemoryCache>();
            var _context = _cache?.LocateOrCreateContext(SiteModel.ID, GridDataType.SurveyedSurfaceHeightAndTime, SurfaceElevationPatchArg.CacheFingerprint());

            SurfaceElevationPatchRequest = SurfaceElevationPatchRequestFactory(_cache, _context);
        }