Пример #1
0
        /// <summary>
        /// ScanSubGrids scans all sub grids at a requested level in the tree that
        /// intersect the given real world extent. Each sub grid that exists in the
        /// extent is passed to the OnProcessLeafSubGrid event for processing
        /// leafFunctor and nodeFunctor are delegate/events called when scanning
        /// leaf sub grids in the sub grid tree (or any other events where the
        /// a leaf sub grid needs to passed to a processor). A return result of False
        /// from a functor indicates the receiver of the event has requested the scanning process stop.
        /// </summary>
        /// <returns>A boolean indicating the ScanSubGrids operation was successful and not aborted by a functor</returns>
        public bool ScanSubGrids(BoundingIntegerExtent2D extent,
                                 Func <ISubGrid, bool> leafFunctor = null,
                                 Func <ISubGrid, SubGridProcessNodeSubGridResult> nodeFunctor = null)
        {
            // Allow the scanner to deal with the node sub grid and short circuit scanning here if desired
            if (nodeFunctor != null && nodeFunctor(this) == SubGridProcessNodeSubGridResult.TerminateProcessing)
            {
                return(false);
            }

            // Work out the on-the-ground cell extent needed to be scanned that this sub grid covers
            var scanMinX = Math.Max(originX, extent.MinX);
            var scanMinY = Math.Max(originY, extent.MinY);
            var scanMaxX = Math.Min(originX + AxialCellCoverageByThisSubGrid() - 1, extent.MaxX);
            var scanMaxY = Math.Min(originY + AxialCellCoverageByThisSubGrid() - 1, extent.MaxY);

            // Convert the on-the-ground cell indexes into sub grid indexes at this level in the sub grid tree
            GetSubGridCellIndex(scanMinX, scanMinY, out var subGridMinX, out var subGridMinY);
            GetSubGridCellIndex(scanMaxX, scanMaxY, out var subGridMaxX, subGridY: out var subGridMaxY);

            ForEachSubGrid(subGrid =>
            {
                if (leafFunctor != null && subGrid.IsLeafSubGrid()) // Leaf sub grids are passed to leafFunctor
                {
                    return(leafFunctor(subGrid) ? SubGridProcessNodeSubGridResult.OK : SubGridProcessNodeSubGridResult.TerminateProcessing);
                }

                // Node sub grids are descended into recursively to continue processing
                return(!((INodeSubGrid)subGrid).ScanSubGrids(extent, leafFunctor, nodeFunctor) ? SubGridProcessNodeSubGridResult.TerminateProcessing : SubGridProcessNodeSubGridResult.OK);
            },
                           subGridMinX, subGridMinY, subGridMaxX, subGridMaxY);

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Constructs the context of a pipelined processor based on the project, filters and other common criteria
        /// of pipelined requests
        /// </summary>
        /// <param name="overrideSpatialCellRestriction">A restriction on the cells that are returned via the query that intersects with the spatial selection filtering and criteria</param>
        public IPipelineProcessor NewInstance <TSubGridsRequestArgument>(Guid requestDescriptor,
                                                                         Guid dataModelID,
                                                                         GridDataType gridDataType,
                                                                         ISubGridsPipelinedReponseBase response,
                                                                         IFilterSet filters,
                                                                         DesignOffset cutFillDesign,
                                                                         ITRexTask task,
                                                                         ISubGridPipelineBase pipeline,
                                                                         IRequestAnalyser requestAnalyser,
                                                                         bool requireSurveyedSurfaceInformation,
                                                                         bool requestRequiresAccessToDesignFileExistenceMap,
                                                                         BoundingIntegerExtent2D overrideSpatialCellRestriction,
                                                                         ILiftParameters liftParams)
        {
            var pipelineProcessor = NewInstanceNoBuild <TSubGridsRequestArgument>
                                        (requestDescriptor, dataModelID, gridDataType, response, filters, cutFillDesign,
                                        task, pipeline, requestAnalyser, requireSurveyedSurfaceInformation, requestRequiresAccessToDesignFileExistenceMap,
                                        overrideSpatialCellRestriction, liftParams);

            if (!pipelineProcessor.Build())
            {
                Log.LogError($"Failed to build pipeline processor for request to model {dataModelID}");
                pipelineProcessor = null;
            }

            return(pipelineProcessor as IPipelineProcessor);
        }
Пример #3
0
        public void NewInstance()
        {
            var factory = new PipelineProcessorFactory();

            var processor = factory.NewInstance <SubGridsRequestArgument>(
                Guid.NewGuid(),
                Guid.NewGuid(),
                GridDataType.Height,
                new PatchRequestResponse(),
                new FilterSet(new CombinedFilter()),
                new DesignOffset(),
                DIContext.Obtain <Func <PipelineProcessorTaskStyle, ITRexTask> >()(PipelineProcessorTaskStyle.PatchExport),
                DIContext.Obtain <Func <PipelineProcessorPipelineStyle, ISubGridPipelineBase> >()(PipelineProcessorPipelineStyle.DefaultProgressive),
                DIContext.Obtain <IRequestAnalyser>(),
                false,
                false,
                BoundingIntegerExtent2D.Inverted(),
                new LiftParameters());

            processor.Should().BeNull("because there is no site model");

            // Configure the request analyser to return a single page of results.
//      processor.RequestAnalyser.SinglePageRequestNumber = 1;
//      processor.RequestAnalyser.SinglePageRequestSize = 10;
//      processor.RequestAnalyser.SubmitSinglePageOfRequests = true;

            // processor.Build().Should().BeFalse("because there is no sitemodel");
        }
Пример #4
0
        /// <summary>
        /// Constructs the context of a pipelined processor based on the project, filters and other common criteria
        /// of pipelined requests
        /// </summary>
        /// <param name="requestDescriptor"></param>
        /// <param name="dataModelID"></param>
        /// <param name="gridDataType"></param>
        /// <param name="response"></param>
        /// <param name="filters"></param>
        /// <param name="cutFillDesign"></param>
        /// <param name="task"></param>
        /// <param name="pipeline"></param>
        /// <param name="requestAnalyser"></param>
        /// <param name="requireSurveyedSurfaceInformation"></param>
        /// <param name="requestRequiresAccessToDesignFileExistenceMap"></param>
        /// <param name="overrideSpatialCellRestriction">A restriction on the cells that are returned via the query that intersects with the spatial selection filtering and criteria</param>
        /// <param name="liftParams"></param>
        public PipelineProcessor(Guid requestDescriptor,
                                 Guid dataModelID,
                                 GridDataType gridDataType,
                                 ISubGridsPipelinedReponseBase response,
                                 IFilterSet filters,
                                 DesignOffset cutFillDesign,
                                 ITRexTask task,
                                 ISubGridPipelineBase pipeline,
                                 IRequestAnalyser requestAnalyser,
                                 bool requireSurveyedSurfaceInformation,
                                 bool requestRequiresAccessToDesignFileExistenceMap,
                                 BoundingIntegerExtent2D overrideSpatialCellRestriction,
                                 ILiftParameters liftParams)
        {
            RequestDescriptor = requestDescriptor;
            DataModelID       = dataModelID;
            GridDataType      = gridDataType;
            Response          = response;
            Filters           = filters;
            CutFillDesign     = cutFillDesign;
            Task = task;

            Pipeline = pipeline;

            RequestAnalyser = requestAnalyser;

            RequireSurveyedSurfaceInformation             = requireSurveyedSurfaceInformation;
            RequestRequiresAccessToDesignFileExistenceMap = requestRequiresAccessToDesignFileExistenceMap;

            OverrideSpatialCellRestriction = overrideSpatialCellRestriction;
            LiftParams = liftParams;
        }
Пример #5
0
        /// <summary>
        /// Constructor for the sub grid retriever helper
        /// </summary>
        /// <param name="siteModel">The project this sub gris is being retrieved from</param>
        /// <param name="gridDataType">The type of client grid data sub grids to be returned by this retriever</param>
        /// <param name="storageProxy">The Ignite storage proxy to be used when requesting data from the persistent store</param>
        /// <param name="filter">The TRex spatial and attribute filtering description for the request</param>
        /// <param name="filterAnnex">An annex of data related to cell by cell filtering where the attributes related to that cell may change from cell to cell</param>
        /// <param name="hasOverrideSpatialCellRestriction">The spatially selected cells are masked by a rectangular restriction boundary</param>
        /// <param name="overrideSpatialCellRestriction"></param>
        /// <param name="prepareGridForCacheStorageIfNoSieving">The cell coordinate bounding box restricting cells involved in the request</param>
        /// <param name="maxNumberOfPassesToReturn">The maximum number of passes in a cell in a sub grid that will be considered when processing the request</param>
        /// <param name="areaControlSet">The skip/step area control set for selection of cells with sub grids for processing. Cells not identified by the control set will return null values.</param>
        /// <param name="populationControl">The delegate responsible for populating events depended on for processing the request.</param>
        /// <param name="pDExistenceMap">The production data existence map for the project the request relates to</param>
        /// <param name="overrides">The set of overriding machine event values to use</param>
        /// <param name="liftParams">The set of layer/lift analysis parameters to use</param>
        public ProgressiveVolumesSubGridRetriever(ISiteModel siteModel,
                                                  GridDataType gridDataType,
                                                  IStorageProxy storageProxy,
                                                  ICombinedFilter filter,
                                                  ICellPassAttributeFilterProcessingAnnex filterAnnex,
                                                  bool hasOverrideSpatialCellRestriction,
                                                  BoundingIntegerExtent2D overrideSpatialCellRestriction,
                                                  bool prepareGridForCacheStorageIfNoSieving,
                                                  int maxNumberOfPassesToReturn,
                                                  AreaControlSet areaControlSet,
                                                  IFilteredValuePopulationControl populationControl,
                                                  ISubGridTreeBitMask pDExistenceMap,
                                                  IOverrideParameters overrides,
                                                  ILiftParameters liftParams)
            : base(siteModel, gridDataType, filter, filterAnnex,
                   hasOverrideSpatialCellRestriction, overrideSpatialCellRestriction, prepareGridForCacheStorageIfNoSieving, maxNumberOfPassesToReturn,
                   storageProxy, areaControlSet, populationControl, pDExistenceMap, overrides, liftParams)
        {
            // Clear any time element from the supplied filter. Time constraints ar derived from the startDate and endDate parameters
            filter.AttributeFilter.HasTimeFilter = false;

            // Clear any instruction in the filter to extract the earliest value - this has no meaning in progressive calculations
            filter.AttributeFilter.ReturnEarliestFilteredCellPass = false;

            // Remove any first/last/highest/lowest aspect from the filter - this has no meaning in progressive calculations
            filter.AttributeFilter.HasElevationTypeFilter = false;

            // Remove any machine filtering - the intent here is to examine volume progression over time, machine breakdowns don't make sense at this point
            filter.AttributeFilter.HasMachineFilter = false;
        }
Пример #6
0
        private ProgressiveVolumesSubGridRetriever MakeANewRetriever(ISiteModel siteModel)
        {
            var retriever = new ProgressiveVolumesSubGridRetriever
                                (siteModel,
                                GridDataType.ProgressiveVolumes,
                                siteModel.PrimaryStorageProxy,
                                new CombinedFilter(),
                                new CellPassAttributeFilterProcessingAnnex(),
                                false,
                                BoundingIntegerExtent2D.Inverted(),
                                true,
                                int.MaxValue,
                                new AreaControlSet(),
                                new FilteredValuePopulationControl(),
                                new SubGridTreeBitMask(),
                                new OverrideParameters(),
                                new LiftParameters()
                                );

            retriever.StartDate = new DateTime(2020, 1, 1, 0, 0, 0);
            retriever.EndDate   = new DateTime(2020, 1, 1, 1, 0, 0);
            retriever.Interval  = new TimeSpan(0, 10, 0);

            return(retriever);
        }
Пример #7
0
        public void Assign(ICellSpatialFilter source)
        {
            if (source.Fence != null)
            {
                Fence = new Fence();
                Fence.Assign(source.Fence);
            }

            if (source.AlignmentFence != null)
            {
                AlignmentFence = new Fence(); // contains alignment boundary to help speed up filtering on alignment files
                AlignmentFence.Assign(source.AlignmentFence);
            }

            PositionX      = source.PositionX;
            PositionY      = source.PositionY;
            PositionRadius = source.PositionRadius;
            IsSquare       = source.IsSquare;
            OverrideSpatialCellRestriction = new BoundingIntegerExtent2D(source.OverrideSpatialCellRestriction);
            StartStation  = source.StartStation;
            EndStation    = source.EndStation;
            LeftOffset    = source.LeftOffset;
            RightOffset   = source.RightOffset;
            CoordsAreGrid = source.CoordsAreGrid;
            IsSpatial     = source.IsSpatial;
            IsPositional  = source.IsPositional;
            IsDesignMask  = source.IsDesignMask;
            SurfaceDesignMaskDesignUid   = source.SurfaceDesignMaskDesignUid;
            IsAlignmentMask              = source.IsAlignmentMask;
            AlignmentDesignMaskDesignUID = source.AlignmentDesignMaskDesignUID;
        }
Пример #8
0
        /// <summary>
        /// Primary method called to begin analytics computation
        /// </summary>
        public bool ComputeAnalytics(BaseAnalyticsResponse response)
        {
            using var processor = DIContext.Obtain <IPipelineProcessorFactory>().NewInstanceNoBuild <SubGridsRequestArgument>(
                      RequestDescriptor,
                      SiteModel.ID,
                      RequestedGridDataType,
                      response,
                      Filters,
                      CutFillDesign,
                      DIContext.Obtain <Func <PipelineProcessorTaskStyle, ITRexTask> >()(PipelineProcessorTaskStyle.AggregatedPipelined),
                      DIContext.Obtain <Func <PipelineProcessorPipelineStyle, ISubGridPipelineBase> >()(PipelineProcessorPipelineStyle.DefaultAggregative),
                      DIContext.Obtain <IRequestAnalyser>(),
                      IncludeSurveyedSurfaces,
                      CutFillDesign?.DesignID != Guid.Empty,
                      BoundingIntegerExtent2D.Inverted(),
                      LiftParams
                      );

            // Assign the provided aggregator into the pipelined sub grid task
            ((IAggregatedPipelinedSubGridTask)processor.Task).Aggregator = Aggregator;

            if (!processor.Build())
            {
                Log.LogError($"Failed to build pipeline processor for request to model {SiteModel.ID}");
                return(false);
            }

            processor.Process();

            return(response.ResultStatus == RequestErrorStatus.OK);
        }
Пример #9
0
        public void Area()
        {
            var bound = new BoundingIntegerExtent2D(0, 0, 100, 100);

            bound.SizeX.Should().Be(100);
            bound.SizeY.Should().Be(100);
            bound.Area().Should().Be(10000);
        }
Пример #10
0
        public void Inverted()
        {
            var bound = new BoundingIntegerExtent2D(0, 0, 100, 100);

            bound.SetInverted();

            bound.Should().BeEquivalentTo(new BoundingIntegerExtent2D(int.MaxValue, int.MaxValue, int.MinValue, int.MinValue));
        }
Пример #11
0
        public void Expand()
        {
            var bound = new BoundingIntegerExtent2D(0, 0, 100, 100);

            bound.Expand(1);
            bound.Should().BeEquivalentTo(new BoundingIntegerExtent2D(-1, -1, 101, 101));
            bound.Expand(-1);
            bound.Should().BeEquivalentTo(new BoundingIntegerExtent2D(0, 0, 100, 100));
        }
Пример #12
0
        /// <summary>
        /// Executor that implements requesting and rendering sub grid information to create the rendered tile
        /// </summary>
        /// <returns></returns>
        public async Task <bool> ExecuteAsync()
        {
            Log.LogInformation($"Performing Execute for DataModel:{DataModelID}, Mode={Mode}, RequestingNodeID={RequestingTRexNodeID}");

            ApplicationServiceRequestStatistics.Instance.NumSubgridPageRequests.Increment();

            Guid RequestDescriptor = Guid.NewGuid();

            using (var processor = DIContext.Obtain <IPipelineProcessorFactory>().NewInstanceNoBuild <SubGridsRequestArgument>(
                       RequestDescriptor,
                       DataModelID,
                       // Patch requests always want time with height information
                       Mode == DisplayMode.Height ? GridDataType.HeightAndTime : GridDataFromModeConverter.Convert(Mode),
                       PatchSubGridsResponse,
                       Filters,
                       CutFillDesign,
                       DIContext.Obtain <Func <PipelineProcessorTaskStyle, ITRexTask> >()(PipelineProcessorTaskStyle.PatchExport),
                       DIContext.Obtain <Func <PipelineProcessorPipelineStyle, ISubGridPipelineBase> >()(PipelineProcessorPipelineStyle.DefaultProgressive),
                       DIContext.Obtain <IRequestAnalyser>(),
                       Rendering.Utilities.DisplayModeRequireSurveyedSurfaceInformation(Mode) &&
                       Rendering.Utilities.FilterRequireSurveyedSurfaceInformation(Filters),
                       Rendering.Utilities.RequestRequiresAccessToDesignFileExistenceMap(Mode, CutFillDesign),
                       BoundingIntegerExtent2D.Inverted(),
                       LiftParams))
            {
                // Set the surface TRexTask parameters for progressive processing
                processor.Task.TRexNodeID = RequestingTRexNodeID;

                // Configure the request analyser to return a single page of results.
                processor.RequestAnalyser.SinglePageRequestNumber    = DataPatchPageNumber;
                processor.RequestAnalyser.SinglePageRequestSize      = DataPatchPageSize;
                processor.RequestAnalyser.SubmitSinglePageOfRequests = true;

                if (!processor.Build())
                {
                    Log.LogError($"Failed to build pipeline processor for request to model {DataModelID}");
                    return(false);
                }

                // If this is the first page requested then count the total number of patches required for all sub grids to be returned
                if (DataPatchPageNumber == 0)
                {
                    PatchSubGridsResponse.TotalNumberOfPagesToCoverFilteredData =
                        (int)Math.Truncate(Math.Ceiling(processor.RequestAnalyser.CountOfSubGridsThatWillBeSubmitted() / (double)DataPatchPageSize));
                }

                processor.Process();

                if (PatchSubGridsResponse.ResultStatus == RequestErrorStatus.OK)
                {
                    PatchSubGridsResponse.SubGrids = ((PatchTask)processor.Task).PatchSubGrids;
                }

                return(true);
            }
        }
Пример #13
0
        public void Offset()
        {
            var bound = new BoundingIntegerExtent2D(0, 0, 100, 100);

            bound.Offset(1, 2);
            bound.Should().BeEquivalentTo(new BoundingIntegerExtent2D(1, 2, 101, 102));

            bound.Offset(-1, -2);
            bound.Should().BeEquivalentTo(new BoundingIntegerExtent2D(0, 0, 100, 100));
        }
Пример #14
0
        public void Creation()
        {
            var bound = new BoundingIntegerExtent2D();

            bound.IsValidExtent.Should().Be(true);
            bound.MinX.Should().Be(0);
            bound.MinY.Should().Be(0);
            bound.MaxX.Should().Be(0);
            bound.MaxY.Should().Be(0);
        }
Пример #15
0
        public void Assign()
        {
            var bound = new BoundingIntegerExtent2D(1, 1, 100, 100);

            var bound2 = new BoundingIntegerExtent2D();

            bound2.Assign(bound);

            bound2.Should().BeEquivalentTo(bound);
        }
Пример #16
0
        public void IsValidExtent()
        {
            var bound = new BoundingIntegerExtent2D();

            bound.IsValidExtent.Should().BeTrue();

            bound.MinX = 100;

            bound.IsValidExtent.Should().BeFalse();
        }
Пример #17
0
        public void Creation2()
        {
            var bound = new BoundingIntegerExtent2D(1, 2, 3, 4);

            bound.IsValidExtent.Should().Be(true);
            bound.MinX.Should().Be(1);
            bound.MinY.Should().Be(2);
            bound.MaxX.Should().Be(3);
            bound.MaxY.Should().Be(4);
        }
Пример #18
0
        /// <summary>
        /// An extension method providing a ToBinary() semantic to BoundingIntegerExtent2D
        /// </summary>
        public static void ToBinary(this BoundingIntegerExtent2D item, IBinaryRawWriter writer)
        {
            const byte VERSION_NUMBER = 1;

            VersionSerializationHelper.EmitVersionByte(writer, VERSION_NUMBER);

            writer.WriteInt(item.MinX);
            writer.WriteInt(item.MinY);
            writer.WriteInt(item.MaxX);
            writer.WriteInt(item.MaxY);
        }
Пример #19
0
        /// <summary>
        /// Computes the bounding extent of the cells (bits) in the sub grid that are set to 1 (true)
        /// </summary>
        public BoundingIntegerExtent2D ComputeCellsExtents()
        {
            BoundingIntegerExtent2D Result = Bits.ComputeCellsExtents();

            if (Result.IsValidExtent)
            {
                Result.Offset((int)OriginX, (int)OriginY);
            }

            return(Result);
        }
Пример #20
0
        public void Test_Equals()
        {
            var bound  = new BoundingIntegerExtent2D(0, 0, 100, 100);
            var bound2 = new BoundingIntegerExtent2D(0, 0, 100, 100);
            var bound3 = new BoundingIntegerExtent2D(0, 0, 101, 101);

            bound.Equals((object)bound2).Should().BeTrue();
            bound.Equals((object)bound3).Should().BeFalse();

            bound.Equals(bound2).Should().BeTrue();
            bound.Equals(bound3).Should().BeFalse();
        }
Пример #21
0
        public void Test_SubGridTree_FullCellExtent()
        {
            ISubGridTree tree = new SubGridTree(SubGridTreeConsts.SubGridTreeLevels, 1.0, new SubGridFactory <NodeSubGrid, LeafSubGrid>());

            BoundingIntegerExtent2D extent = tree.FullCellExtent();

            // Cell extents cover the non-negative (upper-right quadrant) cartesian coordinates that are used to address
            // the possible cell locations in a sub grid tree in the range (0, 0) -> (2^20, 2^30) where
            // tree.IndexOriginOffset should be 2^29
            Assert.True(extent.MinX == 0 && extent.MinY == 0 &&
                        extent.MaxX == (2 * tree.IndexOriginOffset) && extent.MaxY == (2 * tree.IndexOriginOffset),
                        "Cell grid extents are not the expected size");
        }
Пример #22
0
        public void Include()
        {
            var bound = new BoundingIntegerExtent2D(0, 0, 0, 0);

            bound.Include(0, 1000);
            bound.Should().BeEquivalentTo(new BoundingIntegerExtent2D(0, 0, 0, 1000));
            bound.Include(1000, 0);
            bound.Should().BeEquivalentTo(new BoundingIntegerExtent2D(0, 0, 1000, 1000));
            bound.Include(0, -1000);
            bound.Should().BeEquivalentTo(new BoundingIntegerExtent2D(0, -1000, 1000, 1000));
            bound.Include(-1000, 0);
            bound.Should().BeEquivalentTo(new BoundingIntegerExtent2D(-1000, -1000, 1000, 1000));
        }
Пример #23
0
        /// <summary>
        /// Calculates the integer bounding rectangle within the bit mask sub grid that encloses all bits that
        /// are set to 1 (true)
        /// </summary>
        private BoundingIntegerExtent2D ComputeCellsExtents()
        {
            var SubGridCellsExtents = new BoundingIntegerExtent2D();

            SubGridCellsExtents.SetInverted();

            ScanAllSubGrids(x =>
            {
                SubGridCellsExtents.Include(((SubGridTreeLeafBitmapSubGrid)x).ComputeCellsExtents());
                return(true);
            });

            return(SubGridCellsExtents);
        }
Пример #24
0
        /// <summary>
        /// An extension method providing a ToBinary() semantic to BoundingIntegerExtent2D
        /// </summary>
        public static BoundingIntegerExtent2D FromBinary(this BoundingIntegerExtent2D item, IBinaryRawReader reader)
        {
            const byte VERSION_NUMBER = 1;

            var version = VersionSerializationHelper.CheckVersionByte(reader, VERSION_NUMBER);

            if (version == 1)
            {
                item.MinX = reader.ReadInt();
                item.MinY = reader.ReadInt();
                item.MaxX = reader.ReadInt();
                item.MaxY = reader.ReadInt();
            }

            return(item);
        }
Пример #25
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
        }
Пример #26
0
 /// <summary>
 /// Constructor for the sub grid retriever helper
 /// </summary>
 /// <param name="siteModel">The project this sub gris is being retrieved from</param>
 /// <param name="gridDataType">The type of client grid data sub grids to be returned by this retriever</param>
 /// <param name="storageProxy">The Ignite storage proxy to be used when requesting data from the persistent store</param>
 /// <param name="filter">The TRex spatial and attribute filtering description for the request</param>
 /// <param name="filterAnnex">An annex of data related to cell by cell filtering where the attributes related to that cell may change from cell to cell</param>
 /// <param name="hasOverrideSpatialCellRestriction">The spatially selected cells are masked by a rectangular restriction boundary</param>
 /// <param name="overrideSpatialCellRestriction"></param>
 /// <param name="prepareGridForCacheStorageIfNoSieving">The cell coordinate bounding box restricting cells involved in the request</param>
 /// <param name="maxNumberOfPassesToReturn">The maximum number of passes in a cell in a sub grid that will be considered when processing the request</param>
 /// <param name="areaControlSet">The skip/step area control set for selection of cells with sub grids for processing. Cells not identified by the control set will return null values.</param>
 /// <param name="populationControl">The delegate responsible for populating events depended on for processing the request.</param>
 /// <param name="pDExistenceMap">The production data existence map for the project the request relates to</param>
 /// <param name="overrides">The set of overriding machine event values to use</param>
 /// <param name="liftParams">The set of layer/lift analysis parameters to use</param>
 public SubGridRetriever(ISiteModel siteModel,
                         GridDataType gridDataType,
                         IStorageProxy storageProxy,
                         ICombinedFilter filter,
                         ICellPassAttributeFilterProcessingAnnex filterAnnex,
                         bool hasOverrideSpatialCellRestriction,
                         BoundingIntegerExtent2D overrideSpatialCellRestriction,
                         bool prepareGridForCacheStorageIfNoSieving,
                         int maxNumberOfPassesToReturn,
                         AreaControlSet areaControlSet,
                         IFilteredValuePopulationControl populationControl,
                         ISubGridTreeBitMask pDExistenceMap,
                         IOverrideParameters overrides,
                         ILiftParameters liftParams)
     : base(siteModel, gridDataType, filter, filterAnnex,
            hasOverrideSpatialCellRestriction, overrideSpatialCellRestriction, prepareGridForCacheStorageIfNoSieving, maxNumberOfPassesToReturn,
            storageProxy, areaControlSet, populationControl, pDExistenceMap, overrides, liftParams)
 {
 }
Пример #27
0
        protected SubGridRetrieverBase(ISiteModel siteModel,
                                       GridDataType gridDataType,
                                       ICombinedFilter filter,
                                       ICellPassAttributeFilterProcessingAnnex filterAnnex,
                                       bool hasOverrideSpatialCellRestriction,
                                       BoundingIntegerExtent2D overrideSpatialCellRestriction,
                                       bool prepareGridForCacheStorageIfNoSieving,
                                       int maxNumberOfPassesToReturn,
                                       IStorageProxy storageProxy,
                                       AreaControlSet areaControlSet,
                                       IFilteredValuePopulationControl populationControl,
                                       ISubGridTreeBitMask pDExistenceMap,
                                       IOverrideParameters overrides,
                                       ILiftParameters liftParams)
        {
            _segmentIterator  = null;
            _cellPassIterator = null;

            _siteModel    = siteModel;
            _gridDataType = gridDataType;
            _filter       = filter;
            _filterAnnex  = filterAnnex;
            _hasOverrideSpatialCellRestriction     = hasOverrideSpatialCellRestriction;
            _overrideSpatialCellRestriction        = overrideSpatialCellRestriction;
            _prepareGridForCacheStorageIfNoSieving = prepareGridForCacheStorageIfNoSieving;
            _maxNumberOfPassesToReturn             = maxNumberOfPassesToReturn;
            _storageProxy      = storageProxy;
            _populationControl = populationControl;
            _areaControlSet    = areaControlSet;
            _pdExistenceMap    = pDExistenceMap;
            _overrides         = overrides;
            _liftParams        = liftParams;

            // Create and configure the assignment context which is used to contain a filtered pass and
            // its attendant machine events and target values prior to assignment to the client sub grid.
            _assignmentContext = new FilteredValueAssignmentContext {
                Overrides = overrides, LiftParams = liftParams
            };

            _filter.AttributeFilter.SiteModel = siteModel;

            _canUseGlobalLatestCells = _filter.AttributeFilter.LastRecordedCellPassSatisfiesFilter;
        }
Пример #28
0
 /// <summary>
 /// Constructs the context of a pipelined processor based on the project, filters and other common criteria
 /// of pipelined requests, but does not perform the build action on the pipeline processor
 /// </summary>
 /// <param name="overrideSpatialCellRestriction">A restriction on the cells that are returned via the query that intersects with the spatial selection filtering and criteria</param>
 public IPipelineProcessor NewInstanceNoBuild <TSubGridsRequestArgument>(Guid requestDescriptor,
                                                                         Guid dataModelID,
                                                                         GridDataType gridDataType,
                                                                         ISubGridsPipelinedReponseBase response,
                                                                         IFilterSet filters,
                                                                         DesignOffset cutFillDesign,
                                                                         ITRexTask task,
                                                                         ISubGridPipelineBase pipeline,
                                                                         IRequestAnalyser requestAnalyser,
                                                                         bool requireSurveyedSurfaceInformation,
                                                                         bool requestRequiresAccessToDesignFileExistenceMap,
                                                                         BoundingIntegerExtent2D overrideSpatialCellRestriction,
                                                                         ILiftParameters liftParams)
 {
     return(new PipelineProcessor <TSubGridsRequestArgument>
                (requestDescriptor, dataModelID, gridDataType, response, filters, cutFillDesign,
                task, pipeline, requestAnalyser, requireSurveyedSurfaceInformation, requestRequiresAccessToDesignFileExistenceMap,
                overrideSpatialCellRestriction, liftParams) as IPipelineProcessor);
 }
Пример #29
0
        public void Includes()
        {
            var bound = new BoundingIntegerExtent2D(1, 1, 100, 100);

            bound.Includes(101, 101).Should().BeFalse();
            bound.Includes(0, 0).Should().BeFalse();

            // Int version
            bound.Includes(1, 1).Should().BeTrue();
            bound.Includes(1, 100).Should().BeTrue();
            bound.Includes(100, 100).Should().BeTrue();
            bound.Includes(100, 1).Should().BeTrue();

            // UInt version
            bound.Includes(1U, 1U).Should().BeTrue();
            bound.Includes(1U, 100U).Should().BeTrue();
            bound.Includes(100U, 100U).Should().BeTrue();
            bound.Includes(100U, 1U).Should().BeTrue();
        }
Пример #30
0
        public void Test_SubGridTreeBitmapSubGridBitsTests_ComputeCellsExtents()
        {
            // Test extents for empty, full and arbitrary masks
            SubGridTreeBitmapSubGridBits bits = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Filled);

            BoundingIntegerExtent2D boundsFull = bits.ComputeCellsExtents();

            Assert.True(boundsFull.Equals(new BoundingIntegerExtent2D(0, 0, SubGridTreeConsts.SubGridTreeDimensionMinus1, SubGridTreeConsts.SubGridTreeDimensionMinus1)),
                        "ComputeCellsExtents is incorrect for full grid");

            bits.Clear();
            BoundingIntegerExtent2D boundsClear = bits.ComputeCellsExtents();

            Assert.False(boundsClear.IsValidExtent, "ComputeCellsExtents is incorrect for clear grid");

            bits.SetBit(1, 1);
            BoundingIntegerExtent2D bounds11 = bits.ComputeCellsExtents();

            Assert.True(bounds11.Equals(new BoundingIntegerExtent2D(1, 1, 1, 1)), "ComputeCellsExtents is incorrect for grid with bit set at (1, 1)");
        }