Beispiel #1
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);
        }
Beispiel #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 public SubGridRequestsBase(ITRexTask tRexTask,
                            Guid siteModelID,
                            Guid requestID,
                            Guid trexNodeId,
                            GridDataType requestedGridDataType,
                            bool includeSurveyedSurfaceInformation,
                            ISubGridTreeBitMask prodDataMask,
                            ISubGridTreeBitMask surveyedSurfaceOnlyMask,
                            IFilterSet filters,
                            DesignOffset referenceDesign,
                            AreaControlSet areaControlSet,
                            Action <TSubGridsRequestArgument> customArgumentInitializer,
                            SubGridsRequestComputeStyle subGridsRequestComputeStyle) : this()
 {
     TRexTask                          = tRexTask;
     SiteModelID                       = siteModelID;
     RequestID                         = requestID;
     TRexNodeId                        = trexNodeId;
     RequestedGridDataType             = requestedGridDataType;
     IncludeSurveyedSurfaceInformation = includeSurveyedSurfaceInformation;
     ProdDataMask                      = prodDataMask;
     SurveyedSurfaceOnlyMask           = surveyedSurfaceOnlyMask;
     Filters                     = filters;
     ReferenceDesign             = referenceDesign;
     AreaControlSet              = areaControlSet;
     CustomArgumentInitializer   = customArgumentInitializer;
     SubGridsRequestComputeStyle = SubGridsRequestComputeStyle;
 }
Beispiel #3
0
        /// <summary>
        /// Constructs a cell profile analyzer that analyzes cells in a cell profile vector
        /// </summary>
        /// <param name="siteModel"></param>
        /// <param name="pDExistenceMap"></param>
        /// <param name="filterSet"></param>
        /// <param name="cellLiftBuilder"></param>
        /// <param name="overrides"></param>
        public CellProfileAnalyzer(ISiteModel siteModel,
                                   ISubGridTreeBitMask pDExistenceMap,
                                   IFilterSet filterSet,
                                   ICellLiftBuilder cellLiftBuilder,
                                   IOverrideParameters overrides,
                                   ILiftParameters liftParams)
            : base(siteModel, pDExistenceMap, filterSet, overrides, liftParams)
        {
            CellLiftBuilder = cellLiftBuilder;

            PassFilter = filterSet.Filters[0].AttributeFilter;
            if (PassFilter.HasElevationRangeFilter && PassFilter.ElevationRangeDesign.DesignID != Guid.Empty)
            {
                var design = siteModel.Designs.Locate(PassFilter.ElevationRangeDesign.DesignID);
                if (design == null)
                {
                    Log.LogError($"ElevationRangeDesign {PassFilter.ElevationRangeDesign.DesignID} is unknown in project {siteModel.ID}");
                }
                else
                {
                    PassFilterElevationRangeDesign = new DesignWrapper(PassFilter.ElevationRangeDesign, design);
                }
            }
            PassFilterAnnex = new CellPassAttributeFilterProcessingAnnex();
            CellFilter      = filterSet.Filters[0].SpatialFilter;
        }
Beispiel #4
0
 /// <summary>
 /// Constructor for the renderer
 /// </summary>
 public RenderOverlayTile(Guid dataModelId,
                          //AExternalDescriptor :TASNodeRequestDescriptor;
                          DisplayMode mode,
                          XYZ blPoint,
                          XYZ trPoint,
                          bool coordsAreGrid,
                          ushort nPixelsX,
                          ushort nPixelsY,
                          IFilterSet filters,
                          DesignOffset cutFillDesign,
                          IPlanViewPalette aColorPalettes,
                          Color representColor,
                          Guid requestingTRexNodeId,
                          ILiftParameters liftParams,
                          VolumeComputationType volumeType
                          )
 {
     DataModelID = dataModelId;
     // ExternalDescriptor = AExternalDescriptor
     Mode                 = mode;
     BLPoint              = blPoint;
     TRPoint              = trPoint;
     CoordsAreGrid        = coordsAreGrid;
     NPixelsX             = nPixelsX;
     NPixelsY             = nPixelsY;
     Filters              = filters;
     CutFillDesign        = cutFillDesign;
     ColorPalettes        = aColorPalettes;
     RepresentColor       = representColor;
     RequestingTRexNodeID = requestingTRexNodeId;
     LiftParams           = liftParams;
     VolumeType           = volumeType;
 }
Beispiel #5
0
 /// <summary>
 /// Creates a new builder responsible for determining a vector of cells that are crossed by a profile line
 /// </summary>
 public ICellProfileBuilder <T> NewCellProfileBuilder(ISiteModel siteModel,
                                                      IFilterSet filterSet,
                                                      IDesignWrapper cutFillDesignWrapper,
                                                      bool slicerToolUsed)
 {
     return(new CellProfileBuilder <T>(siteModel, filterSet, cutFillDesignWrapper, slicerToolUsed));
 }
Beispiel #6
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;
        }
Beispiel #7
0
 /// <summary>
 /// Creates a new builder responsible for processing cell pass, layer and other information for single cells in a profile
 /// </summary>
 public ICellLiftBuilder NewCellLiftBuilder(ISiteModel siteModel,
                                            GridDataType gridDataType,
                                            IFilteredValuePopulationControl populationControl,
                                            IFilterSet filterSet,
                                            ICellPassFastEventLookerUpper cellPassFastEventLookerUpper)
 {
     return(new CellLiftBuilder(siteModel, gridDataType, populationControl, filterSet, cellPassFastEventLookerUpper));
 }
Beispiel #8
0
 /// <summary>
 /// Determines if the supplied filter supports the inclusion of surveyed surface information in the request results
 /// </summary>
 public static bool FilterRequireSurveyedSurfaceInformation(IFilterSet filters)
 {
     return(filters == null ||
            !filters.Filters.Any(x => x.AttributeFilter.HasVibeStateFilter ||
                                 x.AttributeFilter.HasDesignFilter ||
                                 x.AttributeFilter.HasMachineDirectionFilter ||
                                 x.AttributeFilter.HasMachineFilter ||
                                 x.AttributeFilter.HasGPSAccuracyFilter));
 }
Beispiel #9
0
 public CellPassesRequestArgument_ApplicationService(Guid siteModelId,
                                                     bool coordsAreGrid,
                                                     XYZ point,
                                                     IFilterSet filters)
 {
     ProjectID     = siteModelId;
     CoordsAreGrid = coordsAreGrid;
     Point         = point;
     Filters       = filters;
 }
Beispiel #10
0
 public QuantizedMeshRequestArgument(Guid projectUid, int x, int y, int z, IFilterSet filters, int displayMode, bool hasLighting)
 {
     // todo whats needed
     ProjectID   = projectUid;
     X           = x;
     Y           = y;
     Z           = z;
     Filters     = filters;
     DisplayMode = displayMode;
     HasLighting = hasLighting;
 }
Beispiel #11
0
        /// <summary>
        /// Creates a CellProfile builder given a list of coordinates defining the path to profile and a container to place the resulting cells into
        /// </summary>
        /// <param name="siteModel"></param>
        /// <param name="filterSet"></param>
        /// <param name="cutFillDesignWrapper"></param>
        /// <param name="slicerToolUsed"></param>
        public CellProfileBuilder(ISiteModel siteModel,
                                  IFilterSet filterSet,
                                  IDesignWrapper cutFillDesignWrapper,
                                  bool slicerToolUsed)
        {
            SiteModel            = siteModel;
            CellFilter           = filterSet?.Filters[0].SpatialFilter;
            CutFillDesignWrapper = cutFillDesignWrapper;
            SlicerToolUsed       = slicerToolUsed;

            Initialise();
        }
Beispiel #12
0
 public CellPassesRequestArgument_ClusterCompute(Guid siteModelID,
                                                 XYZ neeCoords,
                                                 int otgCellX,
                                                 int otgCellY,
                                                 IFilterSet filters)
 {
     ProjectID = siteModelID;
     NEECoords = neeCoords;
     OTGCellX  = otgCellX;
     OTGCellY  = otgCellY;
     Filters   = filters;
 }
 private void Intersect(FilterSet result, IFilterSet filtered, ref bool inited)
 {
     if (inited)
     {
         result.IntersectWith(filtered);
     }
     else
     {
         result.Add(filtered);
         inited = true;
     }
 }
Beispiel #14
0
 /// <summary>
 /// Constructs a profile lift builder that analyzes cells in a cell profile vector
 /// </summary>
 public SummaryVolumesCellProfileAnalyzer(ISiteModel siteModel,
                                          ISubGridTreeBitMask pDExistenceMap,
                                          IFilterSet filterSet,
                                          IDesignWrapper referenceDesignWrapper,
                                          ICellLiftBuilder cellLiftBuilder,
                                          VolumeComputationType volumeType,
                                          IOverrideParameters overrides,
                                          ILiftParameters liftParams)
     : base(siteModel, pDExistenceMap, filterSet, overrides, liftParams)
 {
     svDesignWrapper = referenceDesignWrapper;
     VolumeType      = volumeType;
 }
Beispiel #15
0
 public CSVExportRequestArgument(Guid siteModelUid, IFilterSet filters,
                                 string fileName, CoordType coordType, OutputTypes outputType, CSVExportUserPreferences userPreferences,
                                 List <CSVExportMappedMachine> mappedMachines, bool restrictOutputSize, bool rawDataAsDBase)
 {
     ProjectID          = siteModelUid;
     Filters            = filters;
     FileName           = fileName;
     CoordType          = coordType;
     OutputType         = outputType;
     UserPreferences    = userPreferences;
     MappedMachines     = mappedMachines;
     RestrictOutputSize = restrictOutputSize;
     RawDataAsDBase     = rawDataAsDBase;
 }
Beispiel #16
0
 /// <summary>
 /// Constructor for the renderer accepting all parameters necessary for its operation
 /// </summary>
 public TINSurfaceExportExecutor(
     Guid dataModelId,
     IFilterSet filters,
     double tolerance,
     Guid requestingTRexNodeId,
     ILiftParameters liftParams
     )
 {
     _dataModelId         = dataModelId;
     _filters             = filters;
     _tolerance           = tolerance;
     RequestingTRexNodeID = requestingTRexNodeId;
     _liftParams          = liftParams;
 }
Beispiel #17
0
        /// <summary>
        /// Constructs a profile lift builder that analyzes cells in a cell profile vector
        /// </summary>
        public CellProfileAnalyzerBase(ISiteModel siteModel,
                                       ISubGridTreeBitMask pDExistenceMap,
                                       IFilterSet filterSet,
                                       IOverrideParameters overrides,
                                       ILiftParameters liftParams)
        {
            SiteModel      = siteModel;
            PDExistenceMap = pDExistenceMap;
            FilterSet      = filterSet;
            Overrides      = overrides;
            LiftParams     = liftParams;

            Initialise();
        }
Beispiel #18
0
 /// <summary>
 /// Constructs the profile analysis executor
 /// </summary>
 public ComputeProfileExecutor_ClusterCompute(ProfileStyle profileStyle, Guid projectID, GridDataType profileTypeRequired, XYZ[] nEECoords, IFilterSet filters,
                                              // externalRequestDescriptor: TASNodeRequestDescriptor;
                                              DesignOffset design, bool returnAllPassesAndLayers, VolumeComputationType volumeType, IOverrideParameters overrides, ILiftParameters liftParams)
 {
     ProfileStyle        = profileStyle;
     ProjectID           = projectID;
     ProfileTypeRequired = profileTypeRequired;
     NEECoords           = nEECoords;
     Filters             = filters;
     Design     = design;
     VolumeType = volumeType;
     Overrides  = overrides;
     LiftParams = liftParams;
 }
Beispiel #19
0
 public CellDatumRequestArgument_ApplicationService(
     Guid siteModelID,
     DisplayMode mode,
     bool coordsAreGrid,
     XYZ point,
     IFilterSet filters,
     DesignOffset referenceDesign,
     IOverrideParameters overrides)
 {
     ProjectID       = siteModelID;
     Mode            = mode;
     CoordsAreGrid   = coordsAreGrid;
     Point           = point;
     Filters         = filters;
     ReferenceDesign = referenceDesign;
     Overrides       = overrides;
 }
Beispiel #20
0
        /// <summary>
        /// Constructs the set of filters that will be used to derive the set of production data sub grids.
        /// </summary>
        public static IFilterSet ConstructFilters(IFilterSet filterSet, VolumeComputationType volumeType)
        {
            if (volumeType == VolumeComputationType.None)
            {
                return(filterSet);
            }

            // If the volume calculation is between two filters then handle appropriately...
            if (volumeType == VolumeComputationType.Between2Filters)
            {
                var baseFilter = filterSet.Filters[0];
                var topFilter  = filterSet.Filters[1];

                // Determine if intermediary filter/surface behaviour is required to support summary volumes
                var intermediaryFilterRequired = volumeType == VolumeComputationType.Between2Filters &&
                                                 baseFilter.AttributeFilter.HasTimeFilter && baseFilter.AttributeFilter.StartTime == Consts.MIN_DATETIME_AS_UTC && // 'From' has As-At Time filter
                                                 !baseFilter.AttributeFilter.ReturnEarliestFilteredCellPass &&                                                     // Want latest cell pass in 'from'
                                                 topFilter.AttributeFilter.HasTimeFilter && topFilter.AttributeFilter.StartTime != Consts.MIN_DATETIME_AS_UTC &&   // 'To' has time-range filter with latest
                                                 !topFilter.AttributeFilter.ReturnEarliestFilteredCellPass;                                                        // Want latest cell pass in 'to'

                if (intermediaryFilterRequired)
                {
                    // Create and use the intermediary filter. The intermediary filter
                    // is created from the Top filter, with the return earliest flag set to true
                    var intermediaryFilter = new CombinedFilter();
                    intermediaryFilter.AttributeFilter.Assign(topFilter.AttributeFilter);
                    intermediaryFilter.AttributeFilter.ReturnEarliestFilteredCellPass = true;
                    intermediaryFilter.SpatialFilter.Assign(topFilter.SpatialFilter);

                    return(new FilterSet(new[] { baseFilter, intermediaryFilter, topFilter }));
                }
            }

            else if (volumeType == VolumeComputationType.BetweenDesignAndFilter)
            {
                return(new FilterSet(filterSet.Filters[1]));
            }

            else if (volumeType == VolumeComputationType.BetweenFilterAndDesign)
            {
                return(new FilterSet(filterSet.Filters[0]));
            }

            return(filterSet);
        }
Beispiel #21
0
        } = new LiftParameters();                                           // Stage three todo

        /// <summary>
        /// Constructor for the renderer accepting all parameters necessary for its operation
        /// </summary>
        public QMTileExecutor(Guid dataModelUid,
                              IFilterSet filters,
                              int x,
                              int y,
                              int z,
                              int displayMode,
                              bool hasLighting,
                              Guid requestingTRexNodeId
                              )
        {
            DataModelUid         = dataModelUid;
            Filters              = filters;
            TileX                = x;
            TileY                = y;
            TileZ                = z;
            DisplayMode          = displayMode;
            HasLighting          = hasLighting;
            RequestingTRexNodeID = requestingTRexNodeId;
        }
Beispiel #22
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);
 }
Beispiel #23
0
 public CellDatumRequestArgument_ClusterCompute(
     Guid siteModelID,
     DisplayMode mode,
     XYZ neeCoords,
     int otgCellX,
     int otgCellY,
     IFilterSet filters,
     DesignOffset referenceDesign,
     IOverrideParameters overrides,
     ILiftParameters liftParams)
 {
     ProjectID       = siteModelID;
     Mode            = mode;
     NEECoords       = neeCoords;
     OTGCellX        = otgCellX;
     OTGCellY        = otgCellY;
     Filters         = filters;
     ReferenceDesign = referenceDesign;
     Overrides       = overrides;
     LiftParams      = liftParams;
 }
Beispiel #24
0
        /// <summary>
        /// Configures a new profile builder that provides the three core builders used in profiling: construction of cell vector from profile line,
        /// profile analysis orchestration and per cell layer/statistics calculation
        /// </summary>
        public void Configure(ProfileStyle profileStyle,
                              ISiteModel siteModel,
                              ISubGridTreeBitMask productionDataExistenceMap,
                              GridDataType gridDataType,
                              IFilterSet filterSet,
                              IDesignWrapper referenceDesignWrapper,
                              IFilteredValuePopulationControl PopulationControl,
                              ICellPassFastEventLookerUpper CellPassFastEventLookerUpper,
                              VolumeComputationType volumeType,
                              IOverrideParameters overrides,
                              ILiftParameters liftParams,
                              bool slicerToolUsed = true)
        {
            CellLiftBuilder = factory.NewCellLiftBuilder(siteModel, gridDataType, PopulationControl, filterSet, CellPassFastEventLookerUpper);

            CellProfileBuilder = factory.NewCellProfileBuilder(siteModel, filterSet, referenceDesignWrapper, slicerToolUsed);

            CellProfileAnalyzer = factory.NewCellProfileAnalyzer(
                profileStyle, siteModel, productionDataExistenceMap, filterSet,
                referenceDesignWrapper, CellLiftBuilder, volumeType, overrides, liftParams);
        }
Beispiel #25
0
 /// <summary>
 /// Constructor for the renderer accepting all parameters necessary for its operation
 /// </summary>
 public PatchExecutor(
     Guid dataModelID,
     //AExternalDescriptor :TASNodeRequestDescriptor;
     DisplayMode mode,
     IFilterSet filters,
     DesignOffset cutFillDesign,
     Guid requestingTRexNodeId,
     int dataPatchPageNumber,
     int dataPatchPageSize,
     ILiftParameters liftParams
     )
 {
     DataModelID = dataModelID;
     // ExternalDescriptor = AExternalDescriptor
     Mode                 = mode;
     Filters              = filters;
     CutFillDesign        = cutFillDesign;
     RequestingTRexNodeID = requestingTRexNodeId;
     DataPatchPageNumber  = dataPatchPageNumber;
     DataPatchPageSize    = dataPatchPageSize;
     LiftParams           = liftParams;
 }
Beispiel #26
0
 public TileRenderRequestArgument(Guid siteModelId,
                                  DisplayMode mode,
                                  IPlanViewPalette palette,
                                  BoundingWorldExtent3D extents,
                                  bool coordsAreGrid,
                                  ushort pixelsX,
                                  ushort pixelsY,
                                  IFilterSet filters,
                                  DesignOffset referenceDesign,
                                  VolumeComputationType volumeType)
 {
     ProjectID       = siteModelId;
     Mode            = mode;
     Palette         = palette;
     Extents         = extents;
     CoordsAreGrid   = coordsAreGrid;
     PixelsX         = pixelsX;
     PixelsY         = pixelsY;
     Filters         = filters;
     ReferenceDesign = referenceDesign;
     VolumeType      = volumeType;
 }
Beispiel #27
0
        private void ConfigurePipeline(SubGridPipelineAggregative <SubGridsRequestArgument, SimpleVolumesResponse> PipeLine)
        {
            //PipeLine.TimeToLiveSeconds := VLPDSvcLocations.VLPDPSNode_VolumePipelineTTLSeconds;
            PipeLine.RequestDescriptor = RequestDescriptor;
            //PipeLine.ExternalDescriptor := FExternalDescriptor;

            PipeLine.DataModelID = SiteModel.ID;

            Log.LogDebug($"Volume calculation extents for DM={SiteModel.ID}, Request={RequestDescriptor}: {Extents}");

            PipeLine.OverallExistenceMap     = OverallExistenceMap;
            PipeLine.ProdDataExistenceMap    = ProdDataExistenceMap;
            PipeLine.DesignSubGridOverlayMap = DesignSubgridOverlayMap;

            // Initialise a request analyzer to provide to the pipeline
            PipeLine.RequestAnalyser          = DIContext.Obtain <IRequestAnalyser>();
            PipeLine.RequestAnalyser.Pipeline = PipeLine;
            PipeLine.RequestAnalyser.WorldExtents.Assign(Extents);

            PipeLine.LiftParams = LiftParams;

            // Construct and assign the filter set into the pipeline
            IFilterSet FilterSet = FilterUtilities.ConstructFilters(new FilterSet(BaseFilter, TopFilter), VolumeType);

            if (FilterSet.Filters.Length == 3)
            {
                PipeLine.SubGridsRequestComputeStyle = SubGridsRequestComputeStyle.SimpleVolumeThreeWayCoalescing;
            }
            PipeLine.FilterSet    = FilterSet;
            PipeLine.GridDataType = GridDataType.Height;

            if (FilteredTopSurveyedSurfaces.Count > 0 || FilteredBaseSurveyedSurfaces.Count > 0)
            {
                PipeLine.IncludeSurveyedSurfaceInformation = true;
            }
        }
Beispiel #28
0
        /// <summary>
        /// Creates a new builder responsible for analyzing profile information for a cell or cells identified along a profile line
        /// </summary>
        public ICellProfileAnalyzer <T> NewCellProfileAnalyzer(ProfileStyle profileStyle,
                                                               ISiteModel siteModel,
                                                               ISubGridTreeBitMask pDExistenceMap,
                                                               IFilterSet filterSet,
                                                               IDesignWrapper referenceDesignWrapper,
                                                               ICellLiftBuilder cellLiftBuilder,
                                                               VolumeComputationType volumeComputationType,
                                                               IOverrideParameters overrides,
                                                               ILiftParameters liftParams)
        {
            switch (profileStyle)
            {
            case ProfileStyle.CellPasses:
                return(DIContext.Obtain <Func <ISiteModel, ISubGridTreeBitMask, IFilterSet, ICellLiftBuilder, IOverrideParameters, ILiftParameters, ICellProfileAnalyzer <T> > >()
                           (siteModel, pDExistenceMap, filterSet, cellLiftBuilder, overrides, liftParams));

            case ProfileStyle.SummaryVolume:
                return(DIContext.Obtain <Func <ISiteModel, ISubGridTreeBitMask, IFilterSet, IDesignWrapper, ICellLiftBuilder, VolumeComputationType, IOverrideParameters, ILiftParameters, ICellProfileAnalyzer <T> > >()
                           (siteModel, pDExistenceMap, filterSet, referenceDesignWrapper, cellLiftBuilder, volumeComputationType, overrides, liftParams));

            default:
                throw new ArgumentOutOfRangeException(nameof(profileStyle), profileStyle, null);
            }
        }
Beispiel #29
0
 public void IntersectWith(IFilterSet set)
 {
     _data.And(set.GetBitArray());
 }
Beispiel #30
0
        /// <summary>
        /// Builds the pipeline configured per the supplied state ready to execute the request
        /// </summary>
        public bool Build()
        {
            // Todo: This method is left as async as a reminder that the GetExistenveMap workflows could either be async (as they
            // potentially read from the persistent store), and/or they couild be cached in the site model designs/surveyed surfaces contexts
            // See Jira CCSSSCON-1481
            try
            {
                var stopWatch = Stopwatch.StartNew();

                // Ensure the task is initialised with the request descriptor
                Task.RequestDescriptor = RequestDescriptor;

                // Ensure the Task grid data type matches the pipeline processor
                Task.GridDataType = GridDataType;

                // Introduce the task and the pipeline to each other
                Pipeline.PipelineTask = Task;
                Task.PipeLine         = Pipeline;

                (Pipeline as ISubGridPipelineBase <TSubGridsRequestArgument>).CustomArgumentInitializer = CustomArgumentInitializer;

                if ((Filters?.Filters?.Length ?? 0) == 0)
                {
                    _log.LogError($"Filters supplied to pipeline processor is null or empty, replacing with single default filter");
                    Filters = new FilterSet(new CombinedFilter());
                }

                // Construct an aggregated set of excluded surveyed surfaces for the filters used in the query
                foreach (var filter in Filters.Filters)
                {
                    if (filter != null && SurveyedSurfaceExclusionList.Length > 0)
                    {
                        SurveyedSurfaceExclusionList = new Guid[filter.AttributeFilter.SurveyedSurfaceExclusionList.Length];
                        Array.Copy(filter.AttributeFilter.SurveyedSurfaceExclusionList, SurveyedSurfaceExclusionList,
                                   SurveyedSurfaceExclusionList.Length);
                    }
                }

                // Get the SiteModel for the request
                SiteModel = DIContext.Obtain <ISiteModels>().GetSiteModel(DataModelID);
                if (SiteModel == null)
                {
                    Response.ResultStatus = RequestErrorStatus.NoSuchDataModel;
                    return(false);
                }

                SpatialExtents = SiteModel.GetAdjustedDataModelSpatialExtents(SurveyedSurfaceExclusionList);

                if (!SpatialExtents.IsValidPlanExtent)
                {
                    Response.ResultStatus = RequestErrorStatus.FailedToRequestDatamodelStatistics; // Or there was no data in the model
                    return(false);
                }

                // Get the current production data existence map from the site model
                ProdDataExistenceMap = SiteModel.ExistenceMap;

                // Obtain the sub grid existence map for the project
                // Retrieve the existence map for the datamodel
                OverallExistenceMap = new SubGridTreeSubGridExistenceBitMask {
                    CellSize = SubGridTreeConsts.SubGridTreeDimension * SiteModel.CellSize
                };

                if (RequireSurveyedSurfaceInformation)
                {
                    // Obtain local reference to surveyed surfaces (lock free access)
                    var localSurveyedSurfaces = SiteModel.SurveyedSurfaces;

                    if (localSurveyedSurfaces != null)
                    {
                        // Construct two filtered surveyed surface lists to act as a rolling pair used as arguments
                        // to the ProcessSurveyedSurfacesForFilter method
                        var filterSurveyedSurfaces   = DIContext.Obtain <ISurveyedSurfaces>();
                        var filteredSurveyedSurfaces = DIContext.Obtain <ISurveyedSurfaces>();

                        SurveyedSurfacesExcludedViaTimeFiltering = Filters.Filters.Length > 0;

                        foreach (var filter in Filters.Filters)
                        {
                            if (!localSurveyedSurfaces.ProcessSurveyedSurfacesForFilter(DataModelID, filter,
                                                                                        filteredSurveyedSurfaces, filterSurveyedSurfaces, OverallExistenceMap))
                            {
                                Response.ResultStatus = RequestErrorStatus.FailedToRequestSubgridExistenceMap;
                                return(false);
                            }

                            SurveyedSurfacesExcludedViaTimeFiltering &= filterSurveyedSurfaces.Count == 0;
                        }
                    }
                }

                OverallExistenceMap.SetOp_OR(ProdDataExistenceMap);

                foreach (var filter in Filters.Filters)
                {
                    if (filter != null)
                    {
                        if (!DesignFilterUtilities.ProcessDesignElevationsForFilter(SiteModel, filter, OverallExistenceMap))
                        {
                            Response.ResultStatus = RequestErrorStatus.NoDesignProvided;
                            return(false);
                        }

                        Response.ResultStatus = FilterUtilities.PrepareFilterForUse(filter, DataModelID);
                        if (Response.ResultStatus != RequestErrorStatus.OK)
                        {
                            _log.LogInformation($"PrepareFilterForUse failed: Datamodel={DataModelID}");
                            return(false);
                        }
                    }
                }

                // Adjust the extents we have been given to encompass the spatial extent of the supplied filters (if any)
                Filters.ApplyFilterAndSubsetBoundariesToExtents(SpatialExtents);

                // If this request involves a relationship with a design then ensure the existence map
                // for the design is loaded in to memory to allow the request pipeline to confine
                // sub grid requests that overlay the actual design
                if (RequestRequiresAccessToDesignFileExistenceMap)
                {
                    if (CutFillDesign == null || CutFillDesign.DesignID == Guid.Empty)
                    {
                        _log.LogError($"No design provided to cut fill, summary volume or thickness overlay render request for datamodel {DataModelID}");
                        Response.ResultStatus = RequestErrorStatus.NoDesignProvided;
                        return(false);
                    }

                    DesignSubGridOverlayMap = GetExistenceMaps().GetSingleExistenceMap(DataModelID, Consts.EXISTENCE_MAP_DESIGN_DESCRIPTOR, CutFillDesign.DesignID);

                    if (DesignSubGridOverlayMap == null)
                    {
                        _log.LogError($"Failed to request sub grid overlay index for design {CutFillDesign.DesignID} in datamodel {DataModelID}");
                        Response.ResultStatus = RequestErrorStatus.NoDesignProvided;
                        return(false);
                    }

                    DesignSubGridOverlayMap.CellSize = SubGridTreeConsts.SubGridTreeDimension * SiteModel.CellSize;
                }

                // Impose the final restriction on the spatial extents from the client context
                SpatialExtents.Intersect(OverrideSpatialExtents);

                // Introduce the Request analyzer to the pipeline and spatial extents it requires
                RequestAnalyser.Pipeline     = Pipeline;
                RequestAnalyser.WorldExtents = SpatialExtents;

                ConfigurePipeline();

                _log.LogInformation($"Pipeline processor build phase completed in {stopWatch.Elapsed}");

                return(true);
            }
            catch (Exception e)
            {
                _log.LogError(e, "Exception occurred in pipeline builder");
                throw;
            }
        }