/// <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)); }
/// <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; }
/// <summary> /// Executor that implements requesting and rendering sub grid information to create the cell datum /// </summary> public async Task <CellDatumResponse_ClusterCompute> ExecuteAsync(CellDatumRequestArgument_ClusterCompute arg, SubGridSpatialAffinityKey key) { Log.LogInformation($"Performing Execute for DataModel:{arg.ProjectID}, Mode={arg.Mode}"); var result = new CellDatumResponse_ClusterCompute { ReturnCode = CellDatumReturnCode.UnexpectedError }; var siteModel = DIContext.Obtain <ISiteModels>().GetSiteModel(arg.ProjectID); if (siteModel == null) { Log.LogError($"Failed to locate site model {arg.ProjectID}"); return(result); } IDesignWrapper cutFillDesign = null; if (arg.ReferenceDesign != null && arg.ReferenceDesign.DesignID != Guid.Empty) { var design = siteModel.Designs.Locate(arg.ReferenceDesign.DesignID); if (design == null) { throw new ArgumentException($"Design {arg.ReferenceDesign.DesignID} not a recognized design in project {arg.ProjectID}"); } cutFillDesign = new DesignWrapper(arg.ReferenceDesign, design); } await GetProductionData(siteModel, cutFillDesign, result, arg); return(result); }
/// <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(); }
/// <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; }
private StationOffsetRow ExtractRequiredValues(IDesignWrapper cutFillDesignWrapper, StationOffsetPoint point, ClientCellProfileLeafSubgrid clientGrid, int cellX, int cellY) { clientGrid.CalculateWorldOrigin(out double subgridWorldOriginX, out double subgridWorldOriginY); var cell = clientGrid.Cells[cellX, cellY]; var result = new StationOffsetRow(point.Station, point.Offset, cell.CellYOffset + subgridWorldOriginY, cell.CellXOffset + subgridWorldOriginX); (IClientHeightLeafSubGrid designHeights, DesignProfilerRequestResult errorCode)getDesignHeightsResult = (null, DesignProfilerRequestResult.UnknownError); if (requestArgument.ReferenceDesign != null && requestArgument.ReferenceDesign.DesignID != Guid.Empty) { getDesignHeightsResult = cutFillDesignWrapper.Design.GetDesignHeightsViaLocalCompute(siteModel, cutFillDesignWrapper.Offset, clientGrid.OriginAsCellAddress(), clientGrid.CellSize); if (getDesignHeightsResult.errorCode != DesignProfilerRequestResult.OK || getDesignHeightsResult.designHeights == null) { string errorMessage; if (getDesignHeightsResult.errorCode == DesignProfilerRequestResult.NoElevationsInRequestedPatch) { errorMessage = "StationOffset Report. Call to RequestDesignElevationPatch failed due to no elevations in requested patch."; Log.LogInformation(errorMessage); } else { errorMessage = $"StationOffset Report. Call to RequestDesignElevationPatch failed due to no TDesignProfilerRequestResult return code {getDesignHeightsResult.errorCode}."; Log.LogWarning(errorMessage); } } } if (cell.PassCount == 0) // Nothing for us to do, as cell is not in our areaControlSet... { return(result); } result.Elevation = requestArgument.ReportElevation ? cell.Height : Consts.NullHeight; result.CutFill = (requestArgument.ReportCutFill && (getDesignHeightsResult.designHeights != null) && getDesignHeightsResult.designHeights.Cells[cellX, cellY] != Consts.NullHeight) ? cell.Height - getDesignHeightsResult.designHeights.Cells[cellX, cellY] : Consts.NullHeight; // CCV is equiv to CMV in this instance result.Cmv = (short)(requestArgument.ReportCmv ? cell.LastPassValidCCV : CellPassConsts.NullCCV); result.Mdp = (short)(requestArgument.ReportMdp ? cell.LastPassValidMDP : CellPassConsts.NullMDP); result.PassCount = (short)(requestArgument.ReportPassCount ? cell.PassCount : CellPassConsts.NullPassCountValue); result.Temperature = (short)(requestArgument.ReportTemperature ? cell.LastPassValidTemperature : CellPassConsts.NullMaterialTemperatureValue); return(result); }
/// <summary> /// Gets the production data values for the requested cell /// </summary> private async Task GetProductionData(ISiteModel siteModel, IDesignWrapper cutFillDesign, CellDatumResponse_ClusterCompute result, CellDatumRequestArgument_ClusterCompute arg) { var existenceMap = siteModel.ExistenceMap; var utilities = DIContext.Obtain <IRequestorUtilities>(); var requestors = utilities.ConstructRequestors(null, siteModel, arg.Overrides, arg.LiftParams, utilities.ConstructRequestorIntermediaries(siteModel, arg.Filters, true, GridDataType.CellProfile), AreaControlSet.CreateAreaControlSet(), existenceMap); // Get the sub grid relative cell location int cellX = arg.OTGCellX & SubGridTreeConsts.SubGridLocalKeyMask; int cellY = arg.OTGCellY & SubGridTreeConsts.SubGridLocalKeyMask; // Reach into the sub-grid request layer and retrieve an appropriate sub-grid var cellOverrideMask = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled); cellOverrideMask.SetBit(cellX, cellY); requestors[0].CellOverrideMask = cellOverrideMask; // using the cell address get the index of cell in clientGrid var thisSubGridOrigin = new SubGridCellAddress(arg.OTGCellX, arg.OTGCellY); var requestSubGridInternalResult = requestors[0].RequestSubGridInternal(thisSubGridOrigin, true, true); if (requestSubGridInternalResult.requestResult != ServerRequestResult.NoError) { if (requestSubGridInternalResult.requestResult == ServerRequestResult.SubGridNotFound) { result.ReturnCode = CellDatumReturnCode.NoValueFound; } else { Log.LogError($"Request for sub grid {thisSubGridOrigin} request failed with code {requestSubGridInternalResult.requestResult}"); } return; } var cell = ((ClientCellProfileLeafSubgrid)requestSubGridInternalResult.clientGrid).Cells[cellX, cellY]; if (cell.PassCount > 0) // Cell is not in our areaControlSet... { await ExtractRequiredValue(cutFillDesign, cell, result, arg); result.TimeStampUTC = cell.LastPassTime; } }
/// <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); }
/// <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); } }
/// <summary> /// Calculates a cut/fill sub grid from a production data elevation sub grid and an elevation sub grid computed from a referenced design, /// replacing the elevations in the first sub grid with the resulting cut fill values /// </summary> public static (bool executionResult, DesignProfilerRequestResult profilerRequestResult) ComputeCutFillSubGrid(ISiteModel siteModel, IClientLeafSubGrid SubGrid, IDesignWrapper designWrapper) { (bool executionResult, DesignProfilerRequestResult profilerRequestResult)result = (false, DesignProfilerRequestResult.UnknownError); if (designWrapper?.Design == null) { return(result); } var getDesignHeightsResult = designWrapper.Design.GetDesignHeightsViaLocalCompute(siteModel, designWrapper.Offset, SubGrid.OriginAsCellAddress(), SubGrid.CellSize); result.profilerRequestResult = getDesignHeightsResult.errorCode; if (result.profilerRequestResult != DesignProfilerRequestResult.OK && result.profilerRequestResult != DesignProfilerRequestResult.NoElevationsInRequestedPatch) { _log.LogError($"Design profiler sub grid elevation request for {SubGrid.OriginAsCellAddress()} failed with error {result.profilerRequestResult}"); return(result); } ComputeCutFillSubGrid((IClientHeightLeafSubGrid)SubGrid, getDesignHeightsResult.designHeights); result.executionResult = true; return(result); }
/// <summary> /// For each point in the list, get the sub grid and extract productionData at the station/offset i.e pointOfInterest /// This could be optimized to get any poi from each sub grid before disposal /// </summary> private StationOffsetReportRequestResponse_ClusterCompute GetProductionData() { var result = new StationOffsetReportRequestResponse_ClusterCompute { ResultStatus = RequestErrorStatus.Unknown }; IDesignWrapper cutFillDesignWrapper = null; if (requestArgument.ReferenceDesign != null && requestArgument.ReferenceDesign.DesignID != Guid.Empty) { var cutFillDesign = siteModel.Designs.Locate(requestArgument.ReferenceDesign.DesignID); if (cutFillDesign == null) { throw new ArgumentException($"Design {requestArgument.ReferenceDesign.DesignID} not a recognized design in project {requestArgument.ProjectID}"); } cutFillDesignWrapper = new DesignWrapper(requestArgument.ReferenceDesign, cutFillDesign); } var existenceMap = siteModel.ExistenceMap; var utilities = DIContext.Obtain <IRequestorUtilities>(); var requestors = utilities.ConstructRequestors(null, siteModel, requestArgument.Overrides, requestArgument.LiftParams, utilities.ConstructRequestorIntermediaries(siteModel, requestArgument.Filters, true, GridDataType.CellProfile), AreaControlSet.CreateAreaControlSet(), existenceMap); // Obtain the primary partition map to allow this request to determine the elements it needs to process bool[] primaryPartitionMap = ImmutableSpatialAffinityPartitionMap.Instance().PrimaryPartitions(); SubGridTreeBitmapSubGridBits cellOverrideMask = new SubGridTreeBitmapSubGridBits(SubGridBitsCreationOptions.Unfilled); foreach (var point in requestArgument.Points) { // Determine the on-the-ground cell siteModel.Grid.CalculateIndexOfCellContainingPosition(point.Easting, point.Northing, out int OTGCellX, out int OTGCellY); var thisSubGridOrigin = new SubGridCellAddress(OTGCellX, OTGCellY); if (!primaryPartitionMap[thisSubGridOrigin.ToSpatialPartitionDescriptor()]) { continue; } // Get the sub grid relative cell location int cellX = OTGCellX & SubGridTreeConsts.SubGridLocalKeyMask; int cellY = OTGCellY & SubGridTreeConsts.SubGridLocalKeyMask; // Reach into the sub-grid request layer and retrieve an appropriate sub-grid cellOverrideMask.Clear(); cellOverrideMask.SetBit(cellX, cellY); requestors[0].CellOverrideMask = cellOverrideMask; // using the cell address get the index of cell in clientGrid var requestSubGridInternalResult = requestors[0].RequestSubGridInternal( thisSubGridOrigin, true, true); if (requestSubGridInternalResult.requestResult != ServerRequestResult.NoError) { Log.LogError($"Request for sub grid {thisSubGridOrigin} request failed with code {result}"); result.StationOffsetRows.Add(new StationOffsetRow(point.Station, point.Offset, point.Northing, point.Easting)); continue; } var hydratedPoint = ExtractRequiredValues(cutFillDesignWrapper, point, requestSubGridInternalResult.clientGrid as ClientCellProfileLeafSubgrid, cellX, cellY); result.StationOffsetRows.Add(hydratedPoint); } result.ResultStatus = RequestErrorStatus.OK; return(result); }
/// <summary> /// Executes the profiler logic in the cluster compute context where each cluster node processes its fraction of the work and returns the /// results to the application service context /// </summary> public async Task <ProfileRequestResponse <T> > ExecuteAsync() { LiftParams.CCVSummaryTypes |= CCVSummaryTypes.Compaction; LiftParams.MDPSummaryTypes |= MDPSummaryTypes.Compaction; ProfileRequestResponse <T> Response = null; try { var ProfileCells = new List <T>(INITIAL_PROFILE_LIST_SIZE); try { // Note: Start/end point lat/lon fields have been converted into grid local coordinate system by this point if (NEECoords.Length > 1) { Log.LogInformation($"#In#: DataModel {ProjectID}, Vertices:{NEECoords[0]} -> {NEECoords[1]}"); } else { Log.LogWarning($"#In#: DataModel {ProjectID}, Note! vertices list has insufficient vertices (min of 2 required)"); } SiteModel = DIContext.Obtain <ISiteModels>().GetSiteModel(ProjectID); if (SiteModel == null) { Log.LogWarning($"Failed to locate site model {ProjectID}"); return(Response = new ProfileRequestResponse <T> { ResultStatus = RequestErrorStatus.NoSuchDataModel }); } // Obtain the sub grid existence map for the project var ProdDataExistenceMap = SiteModel.ExistenceMap; var PopulationControl = new FilteredValuePopulationControl(); PopulationControl.PreparePopulationControl(ProfileTypeRequired, LiftParams, Filters.Filters[0].AttributeFilter); IDesignWrapper designWrapper = null; if (Design != null && Design.DesignID != Guid.Empty) { var design = SiteModel.Designs.Locate(Design.DesignID); if (design == null) { throw new ArgumentException($"Design {Design.DesignID} is unknown in project {SiteModel.ID}"); } designWrapper = new DesignWrapper(Design, design); } Log.LogInformation("Creating IProfileBuilder"); var Profiler = DIContext.Obtain <IProfilerBuilder <T> >(); if (Profiler == null) { Log.LogWarning($"Failed to create IProfileBuilder via DI"); return(Response = new ProfileRequestResponse <T> { ResultStatus = RequestErrorStatus.FailedOnRequestProfile }); } Profiler.Configure(ProfileStyle, SiteModel, ProdDataExistenceMap, ProfileTypeRequired, Filters, designWrapper, PopulationControl, new CellPassFastEventLookerUpper(SiteModel), VolumeType, Overrides, LiftParams); Log.LogInformation("Building cell profile"); if (Profiler.CellProfileBuilder.Build(NEECoords, ProfileCells)) { SetupForCellPassStackExamination(Filters.Filters[0].AttributeFilter); Log.LogInformation("Building lift profile"); if (Profiler.CellProfileAnalyzer.Analyze(ProfileCells, CellPassIterator)) { Log.LogInformation("Lift profile building succeeded"); // Remove null cells in the profiles list. NUll cells are defined by cells with null CellLastHeight. // All duplicate null cells will be replaced by a by single null cell entry var ThinnedProfileCells = ProfileCells.Where((x, i) => i == 0 || !ProfileCells[i].IsNull() || (ProfileCells[i].IsNull() && !ProfileCells[i - 1].IsNull())).ToList(); Response = new ProfileRequestResponse <T> { ProfileCells = ThinnedProfileCells, ResultStatus = RequestErrorStatus.OK }; return(Response); } Log.LogInformation("Lift profile building failed"); } } finally { Log.LogInformation($"#Out# Execute: DataModel {ProjectID} complete for profile line. #Result#:{Response?.ResultStatus ?? RequestErrorStatus.Exception} with {Response?.ProfileCells?.Count ?? 0} vertices"); } } catch (Exception E) { Log.LogError(E, "Execute: Exception:"); } return(new ProfileRequestResponse <T>()); }
InitialiseFilterContext(ISiteModel siteModel, ICellPassAttributeFilter passFilter, ICellPassAttributeFilterProcessingAnnex passFilterAnnex, ProfileCell profileCell, IDesignWrapper passFilterElevRangeDesign) { (bool executionResult, DesignProfilerRequestResult filterDesignErrorCode)result = (false, DesignProfilerRequestResult.UnknownError); // If the elevation range filter uses a design then the design elevations // for the sub grid need to be calculated and supplied to the filter if (passFilter.HasElevationRangeFilter && passFilterElevRangeDesign != null) { var getDesignHeightsResult = passFilterElevRangeDesign.Design.GetDesignHeightsViaLocalCompute(siteModel, passFilterElevRangeDesign.Offset, new SubGridCellAddress(profileCell.OTGCellX, profileCell.OTGCellY), siteModel.CellSize); result.filterDesignErrorCode = getDesignHeightsResult.errorCode; if (result.filterDesignErrorCode != DesignProfilerRequestResult.OK || getDesignHeightsResult.designHeights == null) { if (result.filterDesignErrorCode == DesignProfilerRequestResult.NoElevationsInRequestedPatch) { _log.LogInformation( "Lift filter by design. Call to RequestDesignElevationPatch failed due to no elevations in requested patch."); } else { _log.LogWarning( $"Lift filter by design. Call to RequestDesignElevationPatch failed due to no TDesignProfilerRequestResult return code {result.filterDesignErrorCode}."); } return(result); } passFilterAnnex.InitializeElevationRangeFilter(passFilter, getDesignHeightsResult.designHeights.Cells); } result.executionResult = true; return(result); }
/// <summary> /// Gets the required datum from the cell according to the requested display mode /// </summary> private async Task ExtractRequiredValue(IDesignWrapper cutFillDesign, ClientCellProfileLeafSubgridRecord cell, CellDatumResponse_ClusterCompute result, CellDatumRequestArgument_ClusterCompute arg) { var success = false; int intValue; switch (arg.Mode) { case DisplayMode.Height: result.Value = cell.Height; success = result.Value != CellPassConsts.NullHeight; break; case DisplayMode.CCV: case DisplayMode.CompactionCoverage: result.Value = cell.LastPassValidCCV; success = result.Value != CellPassConsts.NullCCV; break; case DisplayMode.CCVPercent: case DisplayMode.CCVSummary: case DisplayMode.CCVPercentSummary: result.Value = 0; // default - no value... intValue = arg.Overrides.OverrideMachineCCV ? arg.Overrides.OverridingMachineCCV : cell.TargetCCV; if (intValue != 0) { success = cell.LastPassValidCCV != CellPassConsts.NullCCV && intValue != CellPassConsts.NullCCV; if (success) { result.Value = ((double)cell.LastPassValidCCV / intValue) * 100; } } break; case DisplayMode.PassCount: result.Value = cell.PassCount; success = result.Value != CellPassConsts.NullPassCountValue; break; case DisplayMode.PassCountSummary: result.Value = 0; // default - no value... if (arg.Overrides.OverrideTargetPassCount) { if (cell.PassCount > arg.Overrides.OverridingTargetPassCountRange.Max) { intValue = arg.Overrides.OverridingTargetPassCountRange.Max; } else if (cell.PassCount < arg.Overrides.OverridingTargetPassCountRange.Min) { intValue = arg.Overrides.OverridingTargetPassCountRange.Min; } else { intValue = cell.PassCount; } } else { intValue = cell.TargetPassCount; } if (intValue != 0) { success = cell.PassCount != CellPassConsts.NullPassCountValue; if (success) { result.Value = ((double)cell.PassCount / intValue) * 100; } } break; case DisplayMode.CutFill: result.Value = cell.Height; if (cutFillDesign != null) { var designSpotHeightResult = await cutFillDesign.Design.GetDesignSpotHeight(arg.ProjectID, cutFillDesign.Offset, arg.NEECoords.X, arg.NEECoords.Y); if (designSpotHeightResult.errorCode == DesignProfilerRequestResult.OK && designSpotHeightResult.spotHeight != CellPassConsts.NullHeight) { result.Value = result.Value - designSpotHeightResult.spotHeight; success = true; } } break; case DisplayMode.TemperatureSummary: case DisplayMode.TemperatureDetail: result.Value = cell.LastPassValidTemperature; success = cell.LastPassValidTemperature != CellPassConsts.NullMaterialTemperatureValue; if (success) { result.Value = cell.LastPassValidTemperature / 10.0; // temp is stored a int a 1 point precision } break; case DisplayMode.MDP: result.Value = cell.LastPassValidMDP; success = result.Value != CellPassConsts.NullMDP; break; case DisplayMode.MDPSummary: case DisplayMode.MDPPercent: case DisplayMode.MDPPercentSummary: result.Value = 0; // default - no value... intValue = arg.Overrides.OverrideMachineMDP ? arg.Overrides.OverridingMachineMDP : cell.TargetMDP; if (intValue != 0) { success = cell.LastPassValidMDP != CellPassConsts.NullMDP && intValue != CellPassConsts.NullMDP; if (success) { result.Value = ((double)cell.LastPassValidMDP / intValue) * 100; } } break; case DisplayMode.MachineSpeed: result.Value = cell.MachineSpeed; success = cell.MachineSpeed != Consts.NullMachineSpeed; break; case DisplayMode.CCVPercentChange: case DisplayMode.CMVChange: result.Value = cell.CCVChange; success = cell.CCVChange != CellPassConsts.NullCCV; break; case DisplayMode.Latency: case DisplayMode.RMV: case DisplayMode.Frequency: case DisplayMode.Amplitude: case DisplayMode.Moisture: case DisplayMode.GPSMode: case DisplayMode.VolumeCoverage: break; } result.ReturnCode = success ? CellDatumReturnCode.ValueFound : CellDatumReturnCode.NoValueFound; }
/// <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; }