Exemplo n.º 1
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;
        }
Exemplo n.º 2
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));
 }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
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)
 {
 }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
            }
        }
Exemplo n.º 7
0
        public static void PopulateFilteredValues(IProductionEventLists values,
                                                  IFilteredValuePopulationControl PopulationControl,
                                                  ref FilteredPassData filteredPass)
        {
            // todo bool UseMachineRMVThreshold;
            // todo short OverrideRMVJumpThreshold;

            if (values == null)
            {
                Log.LogError($"MachineTargetValues supplied to PopulateFilteredValues is null. PopulationControl = {PopulationControl.GetFlags():X}");
                return;
            }

            DateTime _Time = filteredPass.FilteredPass.Time;

            if (PopulationControl.WantsTargetCCVValues)
            {
                filteredPass.TargetValues.TargetCCV = values.TargetCCVStateEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullCCV);
            }

            if (PopulationControl.WantsTargetMDPValues)
            {
                filteredPass.TargetValues.TargetMDP = values.TargetMDPStateEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullMDP);
            }

            if (PopulationControl.WantsTargetCCAValues)
            {
                filteredPass.TargetValues.TargetCCA = values.TargetCCAStateEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullCCATarget);
            }

            if (PopulationControl.WantsTargetPassCountValues)
            {
                filteredPass.TargetValues.TargetPassCount = values.TargetPassCountStateEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullPassCountValue);
            }

            if (PopulationControl.WantsTargetLiftThicknessValues)
            {
                filteredPass.TargetValues.TargetLiftThickness = values.TargetLiftThicknessStateEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullOverridingTargetLiftThicknessValue);
            }

            // Design Name...
            if (PopulationControl.WantsEventDesignNameValues)
            {
                filteredPass.EventValues.EventDesignNameID = values.MachineDesignNameIDStateEvents.GetValueAtDate(_Time, out _, Common.Consts.kNoDesignNameID);
            }

            // Vibration State...
            if (PopulationControl.WantsEventVibrationStateValues)
            {
                filteredPass.EventValues.EventVibrationState = values.VibrationStateEvents.GetValueAtDate(_Time, out _, VibrationState.Invalid);

                if (filteredPass.EventValues.EventVibrationState != VibrationState.On)
                {
                    filteredPass.FilteredPass.SetFieldsForVibeStateOff();
                }
            }

            // Auto Vibration State...
            if (PopulationControl.WantsEventAutoVibrationStateValues)
            {
                filteredPass.EventValues.EventAutoVibrationState =
                    values.AutoVibrationStateEvents.GetValueAtDate(_Time, out _, AutoVibrationState.Unknown);
            }

            // IC Flags...
            if (PopulationControl.WantsEventICFlagsValues)
            {
                filteredPass.EventValues.EventFlags = values.ICFlagsStateEvents.GetValueAtDate(_Time, out _, 0);
            }

            // Machine Gear...
            if (PopulationControl.WantsEventMachineGearValues)
            {
                filteredPass.EventValues.EventMachineGear = values.MachineGearStateEvents.GetValueAtDate(_Time, out _, MachineGear.Null);
            }

            // RMV Jump Threshold...
            if (PopulationControl.WantsEventMachineCompactionRMVJumpThreshold)
            {
                filteredPass.EventValues.EventMachineRMVThreshold = values.RMVJumpThresholdEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullRMV);

                // TODO: PopulationControl.WantsEventMachineCompactionRMVJumpThreshold does not honour global RMV override values

                /*
                 * if TICSiteModel(Owner).GetMachineRMVOverrideState(filteredPass.FilteredPass.InternalSiteModelMachineIndex,
                 * UseMachineRMVThreshold, OverrideRMVJumpThreshold))
                 * {
                 * if (UseMachineRMVThreshold)
                 *  filteredPass.EventValues.EventMachineRMVThreshold = values.RMVJumpThresholdEvents.GetValueAtDate(_Time, out _);
                 * else
                 *  filteredPass.EventValues.EventMachineRMVThreshold = OverrideRMVJumpThreshold;
                 * }
                 */
            }

            // Machine Automatic States...
            if (PopulationControl.WantsEventMachineAutomaticsValues)
            {
                filteredPass.EventValues.EventMachineAutomatics =
                    values.MachineAutomaticsStateEvents.GetValueAtDate(_Time, out _, AutomaticsType.Unknown);
            }

            if (PopulationControl.WantsEventMapResetValues)
            {
                throw new NotImplementedException("PopulationControl.WantsEventMapResetValues not implemented");

                /*
                 * filteredPass.EventValues.MapReset_DesignNameID = values.?????.GetValueAtDate(_Time, out int _);
                 * // LocateClosestPreviousMapResetAtDate(MachineTargetValues, _Time, MapReset_PriorDate, MapReset_DesignNameID);
                 */
            }

            if (PopulationControl.WantsEventElevationMappingModeValues)
            {
                filteredPass.EventValues.EventElevationMappingMode =
                    values.ElevationMappingModeStateEvents.GetValueAtDate(_Time, out _, ElevationMappingMode.LatestElevation);
            }

            if (PopulationControl.WantsEventInAvoidZoneStateValues)
            {
                throw new NotImplementedException("PopulationControl.WantsEventInAvoidZoneStateValues not implemented");
            }

            if (PopulationControl.WantsEventGPSAccuracyValues)
            {
                GPSAccuracyAndTolerance value = values.GPSAccuracyAndToleranceStateEvents.GetValueAtDate(_Time, out _, NullGPSAccuracyAndTolerance);

                filteredPass.EventValues.GPSAccuracy  = value.GPSAccuracy;
                filteredPass.EventValues.GPSTolerance = value.GPSTolerance;
            }

            if (PopulationControl.WantsEventPositioningTechValues)
            {
                filteredPass.EventValues.PositioningTechnology = values.PositioningTechStateEvents.GetValueAtDate(_Time, out _, PositioningTech.Unknown);
            }

            if (PopulationControl.WantsTempWarningLevelMinValues)
            {
                filteredPass.TargetValues.TempWarningLevelMin = values.TargetMinMaterialTemperature.GetValueAtDate(_Time, out _, CellPassConsts.NullMaterialTemperatureValue);
                filteredPass.TargetValues.TempWarningLevelMax = values.TargetMaxMaterialTemperature.GetValueAtDate(_Time, out _, CellPassConsts.NullMaterialTemperatureValue);
            }

            if (PopulationControl.WantsLayerIDValues)
            {
                filteredPass.EventValues.LayerID = values.LayerIDStateEvents.GetValueAtDate(_Time, out _, CellPassConsts.NullLayerID);
            }
        }
Exemplo n.º 8
0
        public void Initialise(IFilteredValuePopulationControl populationControl)
        {
            TrackingUseMachineRMVThreshold   = false;
            TrackingOverrideRMVJumpThreshold = CellPassConsts.NullRMV;

            if (populationControl.WantsTargetCCVValues)
            {
                TargetCCV          = CellPassConsts.NullCCV;
                TargetCCV_Tracking = new SiteModelMachineTargetValueTrackingState <short>(MachineTargetValues, ProductionEventType.TargetCCV);
            }

            if (populationControl.WantsTargetMDPValues)
            {
                TargetMDP          = CellPassConsts.NullMDP;
                TargetMDP_Tracking = new SiteModelMachineTargetValueTrackingState <short>(MachineTargetValues, ProductionEventType.TargetMDP);
            }

            if (populationControl.WantsTargetCCAValues)
            {
                TargetCCA          = CellPassConsts.NullCCA;
                TargetCCA_Tracking = new SiteModelMachineTargetValueTrackingState <byte>(MachineTargetValues, ProductionEventType.TargetCCA);
            }

            if (populationControl.WantsTargetPassCountValues)
            {
                TargetPassCount          = 0; // kICNullPassCountValue;
                TargetPassCount_Tracking = new SiteModelMachineTargetValueTrackingState <ushort>(MachineTargetValues, ProductionEventType.TargetPassCount);
            }

            if (populationControl.WantsTargetLiftThicknessValues)
            {
                TargetLiftThickness          = CellPassConsts.NullHeight;
                TargetLiftThickness_Tracking = new SiteModelMachineTargetValueTrackingState <float>(MachineTargetValues, ProductionEventType.TargetLiftThickness);
            }

            /* TODO map reset events not included
             * if (populationControl.WantsEventMapResetValues)
             * {
             * EventMapResetPriorDate = 0;
             * EventMapResetDesignID = kNoDesignNameID;
             * EventMapReset_Tracking.Initialise();
             * }
             */

            if (populationControl.WantsEventDesignNameValues)
            {
                EventDesignNameID          = Consts.kNoDesignNameID;
                EventDesignNameID_Tracking = new SiteModelMachineTargetValueTrackingState <int>(MachineTargetValues, ProductionEventType.DesignChange);
            }

            if (populationControl.WantsEventVibrationStateValues)
            {
                EventVibrationState          = VibrationState.Invalid;
                EventVibrationState_Tracking = new SiteModelMachineTargetValueTrackingState <VibrationState>(MachineTargetValues, ProductionEventType.VibrationStateChange);
            }

            if (populationControl.WantsEventAutoVibrationStateValues)
            {
                EventAutoVibrationState          = AutoVibrationState.Unknown;
                EventAutoVibrationState_Tracking = new SiteModelMachineTargetValueTrackingState <AutoVibrationState>(MachineTargetValues, ProductionEventType.AutoVibrationStateChange);
            }

            if (populationControl.WantsEventElevationMappingModeValues)
            {
                ElevationMappingModeState          = ElevationMappingMode.LatestElevation;
                ElevationMappingModeState_Tracking = new SiteModelMachineTargetValueTrackingState <ElevationMappingMode>(MachineTargetValues, ProductionEventType.ElevationMappingModeStateChange);
            }

            if (populationControl.WantsEventICFlagsValues)
            {
                EventICFlag          = 0;
                EventICFlag_Tracking = new SiteModelMachineTargetValueTrackingState <byte>(MachineTargetValues, ProductionEventType.ICFlagsChange);
            }

            if (populationControl.WantsEventMachineGearValues)
            {
                EventMachineGear          = MachineGear.Null;
                EventMachineGear_Tracking = new SiteModelMachineTargetValueTrackingState <MachineGear>(MachineTargetValues, ProductionEventType.MachineGearChange);
            }

            if (populationControl.WantsEventMachineCompactionRMVJumpThreshold)
            {
                EventMachineRMVThreshold          = CellPassConsts.NullRMV;
                EventMachineRMVThreshold_Tracking = new SiteModelMachineTargetValueTrackingState <short>(MachineTargetValues, ProductionEventType.MachineRMVJumpValueChange);
            }

            if (populationControl.WantsEventMachineAutomaticsValues)
            {
                EventMachineAutomatics          = AutomaticsType.Unknown;
                EventMachineAutomatics_Tracking = new SiteModelMachineTargetValueTrackingState <AutomaticsType>(MachineTargetValues, ProductionEventType.MachineAutomaticsChange);
            }

            if (populationControl.WantsEventGPSAccuracyValues)
            {
                GPSAccuracyAndTolerance   = new GPSAccuracyAndTolerance(GPSAccuracy.Unknown, CellPassConsts.NullGPSTolerance);
                GPSAccuracyState_Tracking = new SiteModelMachineTargetValueTrackingState <GPSAccuracyAndTolerance>(MachineTargetValues, ProductionEventType.GPSAccuracyChange);
            }

            if (populationControl.WantsEventPositioningTechValues)
            {
                PositioningTechState          = PositioningTech.Unknown;
                PositioningTechState_Tracking = new SiteModelMachineTargetValueTrackingState <PositioningTech>(MachineTargetValues, ProductionEventType.PositioningTech);
            }

            if (populationControl.WantsTempWarningLevelMinValues)
            {
                TempWarningLevelMin          = CellPassConsts.NullMaterialTemperatureValue;
                TempWarningLevelMin_Tracking = new SiteModelMachineTargetValueTrackingState <ushort>(MachineTargetValues, ProductionEventType.TempWarningLevelMinChange);
            }

            if (populationControl.WantsTempWarningLevelMaxValues)
            {
                TempWarningLevelMax          = CellPassConsts.NullMaterialTemperatureValue;
                TempWarningLevelMax_Tracking = new SiteModelMachineTargetValueTrackingState <ushort>(MachineTargetValues, ProductionEventType.TempWarningLevelMaxChange);
            }

            if (populationControl.WantsLayerIDValues)
            {
                EventLayerID          = CellPassConsts.NullLayerID;
                EventLayerID_Tracking = new SiteModelMachineTargetValueTrackingState <ushort>(MachineTargetValues, ProductionEventType.LayerID);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Constructor that accepts the common parameters around a set of sub grids the requester will be asked to process
        /// and initializes the requester state ready to start processing individual sub grid requests.
        /// </summary>
        public void Initialize(ISubGridsRequestArgument subGridsRequestArgument,
                               ISiteModel siteModel,
                               GridDataType gridDataType,
                               IStorageProxy storageProxy,
                               ICombinedFilter filter,
                               bool hasOverrideSpatialCellRestriction,
                               BoundingIntegerExtent2D overrideSpatialCellRestriction,
                               int maxNumberOfPassesToReturn,
                               AreaControlSet areaControlSet,
                               IFilteredValuePopulationControl populationControl,
                               ISubGridTreeBitMask pdExistenceMap,
                               ITRexSpatialMemoryCache subGridCache,
                               ITRexSpatialMemoryCacheContext[] subGridCacheContexts,
                               ISurveyedSurfaces filteredSurveyedSurfaces,
                               ISurfaceElevationPatchRequest surfaceElevationPatchRequest,
                               IOverrideParameters overrides,
                               ILiftParameters liftParams)
        {
            _siteModel    = siteModel;
            _gridDataType = gridDataType;
            _filter       = filter;

            _hasOverrideSpatialCellRestriction = hasOverrideSpatialCellRestriction;
            _overrideSpatialCellRestriction    = overrideSpatialCellRestriction;

            _retriever = DIContext.Obtain <ISubGridRetrieverFactory>().Instance(subGridsRequestArgument,
                                                                                siteModel,
                                                                                gridDataType,
                                                                                storageProxy,
                                                                                filter,
                                                                                _filterAnnex,
                                                                                hasOverrideSpatialCellRestriction,
                                                                                overrideSpatialCellRestriction,
                                                                                maxNumberOfPassesToReturn,
                                                                                areaControlSet,
                                                                                populationControl,
                                                                                pdExistenceMap,
                                                                                subGridCacheContexts,
                                                                                overrides,
                                                                                liftParams);

            _returnEarliestFilteredCellPass = _filter.AttributeFilter.ReturnEarliestFilteredCellPass;
            _processingMap = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled);

            _surfaceElevationPatchRequest = surfaceElevationPatchRequest;

            _subGridCache         = subGridCache;
            _subGridCacheContexts = subGridCacheContexts;

            _surveyedSurfacePatchType = _filter.AttributeFilter.ReturnEarliestFilteredCellPass ? SurveyedSurfacePatchType.EarliestSingleElevation : SurveyedSurfacePatchType.LatestSingleElevation;

            _filteredSurveyedSurfaces = filteredSurveyedSurfaces;
            _filteredSurveyedSurfaces?.SortChronologically(_surveyedSurfacePatchType == SurveyedSurfacePatchType.LatestSingleElevation);
            _filteredSurveyedSurfacesAsGuidArray = _filteredSurveyedSurfaces?.Select(x => x.ID).ToArray() ?? new Guid[0];

            var elevRangeDesignFilter = _filter.AttributeFilter.ElevationRangeDesign;

            if (elevRangeDesignFilter.DesignID != Guid.Empty)
            {
                var design = _siteModel.Designs.Locate(elevRangeDesignFilter.DesignID);
                if (design == null)
                {
                    _log.LogError($"ElevationRangeDesign {elevRangeDesignFilter.DesignID} is unknown in project {siteModel.ID}");
                }
                else
                {
                    _elevationRangeDesign = new DesignWrapper(elevRangeDesignFilter, design);
                }
            }

            if (_filter.SpatialFilter.IsDesignMask)
            {
                _surfaceDesignMaskDesign = _siteModel.Designs.Locate(_filter.SpatialFilter.SurfaceDesignMaskDesignUid);
            }

            _filter.AttributeFilter.SiteModel = _siteModel;
        }