Пример #1
0
        public void SubGridForCaching_IgnoresFilterMask_WithPartialNonOverlappingOverrideMaskRetriction()
        {
            var siteModel = BuildModelForSubGridRequest();

            var retriever = new SubGridRetriever(siteModel,
                                                 GridDataType.Height,
                                                 siteModel.PrimaryStorageProxy,
                                                 new CombinedFilter(),
                                                 new CellPassAttributeFilterProcessingAnnex(),
                                                 true, // Has override mask
                                                 BoundingIntegerExtent2D.Inverted(),
                                                 true, // prepareGridForCacheStorageIfNoSieving
                                                 1000,
                                                 AreaControlSet.CreateAreaControlSet(),
                                                 new FilteredValuePopulationControl(),
                                                 siteModel.ExistenceMap,
                                                 new OverrideParameters(),
                                                 new LiftParameters()
                                                 );

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGridEx
                                 (GridDataType.Height, SubGridTreeConsts.DefaultCellSize, SubGridTreeConsts.SubGridTreeLevels,
                                 SubGridTreeConsts.DefaultIndexOriginOffset, SubGridTreeConsts.DefaultIndexOriginOffset);

            var overrideMask = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled);

            overrideMask[10, 10] = true; // This does not overlap the filter but should still return a result

            var result = retriever.RetrieveSubGrid(clientGrid, overrideMask, out var seiveFilterInUse,
                                                   () =>
            {
                clientGrid.FilterMap.Clear();
                clientGrid.FilterMap[0, 0] = true;

                clientGrid.ProdDataMap.Fill();

                return(ServerRequestResult.NoError);
            });

            result.Should().Be(ServerRequestResult.NoError);
            seiveFilterInUse.Should().BeFalse();
            clientGrid.FilterMap.CountBits().Should().Be(1);  // Only asking for the one cell...
            clientGrid.CountNonNullCells().Should().Be(1024); // All cells should be returned
        }
Пример #2
0
        public ISubGridRetriever Instance(ISubGridsRequestArgument subGridsRequestArgument,
                                          ISiteModel siteModel,
                                          GridDataType gridDataType,
                                          IStorageProxy storageProxy,
                                          ICombinedFilter filter,
                                          ICellPassAttributeFilterProcessingAnnex filterAnnex,
                                          bool hasOverrideSpatialCellRestriction,
                                          BoundingIntegerExtent2D overrideSpatialCellRestriction,
                                          int maxNumberOfPassesToReturn,
                                          AreaControlSet areaControlSet,
                                          IFilteredValuePopulationControl populationControl,
                                          ISubGridTreeBitMask pdExistenceMap,
                                          ITRexSpatialMemoryCacheContext[] subGridCacheContexts,
                                          IOverrideParameters overrides,
                                          ILiftParameters liftParams)
        {
            if (gridDataType == GridDataType.ProgressiveVolumes)
            {
                var retriever = new ProgressiveVolumesSubGridRetriever(siteModel,
                                                                       gridDataType,
                                                                       storageProxy,
                                                                       filter,
                                                                       filterAnnex,
                                                                       hasOverrideSpatialCellRestriction,
                                                                       overrideSpatialCellRestriction,
                                                                       subGridCacheContexts != null,
                                                                       maxNumberOfPassesToReturn,
                                                                       areaControlSet,
                                                                       populationControl,
                                                                       pdExistenceMap,
                                                                       overrides,
                                                                       liftParams);

                if (subGridsRequestArgument is IProgressiveVolumesSubGridsRequestArgument argument)
                {
                    retriever.StartDate = argument.StartDate;
                    retriever.EndDate   = argument.EndDate;
                    retriever.Interval  = argument.Interval;
                }
                else
                {
                    throw new ArgumentException($"Argument passed to sub grid retriever factory for progressive volumes retriever construction is not an expected type: {subGridsRequestArgument.GetType()}");
                }

                return(retriever);
            }
            else
            {
                var retriever = new SubGridRetriever(siteModel,
                                                     gridDataType,
                                                     storageProxy,
                                                     filter,
                                                     filterAnnex,
                                                     hasOverrideSpatialCellRestriction,
                                                     overrideSpatialCellRestriction,
                                                     subGridCacheContexts != null,
                                                     maxNumberOfPassesToReturn,
                                                     areaControlSet,
                                                     populationControl,
                                                     pdExistenceMap,
                                                     overrides,
                                                     liftParams);

                return(retriever);
            }
        }