public void Initialise(ILoggerFactory loggerFactory, ILogger logger, #if RAPTOR IASNodeClient raptorClient, ITagProcessor tagProcessor, #endif IConfigurationStore configStore, List <FileData> fileList, ICompactionProfileResultHelper profileResultHelper, ITRexTagFileProxy tRexTagFileProxy, ITRexCompactionDataProxy trexCompactionDataProxy, IFileImportProxy fileImportProxy, IHeaderDictionary customHeaders, string customerUid, string userId) { this.loggerFactory = loggerFactory; this.log = logger; #if RAPTOR this.raptorClient = raptorClient; this.tagProcessor = tagProcessor; #endif this.configStore = configStore; this.fileList = fileList; this.profileResultHelper = profileResultHelper; this.tRexTagFileProxy = tRexTagFileProxy; this.trexCompactionDataProxy = trexCompactionDataProxy; this.fileImportProxy = fileImportProxy; this.customHeaders = customHeaders; this.customerUid = customerUid; this.userId = userId; }
/// <summary> /// Calculate the elevations for cut-fill or summary volumes cells from the design surface. /// </summary> /// <param name="projectId">Legacy project ID</param> /// <param name="ProjectUid">Project's unique identifier</param> /// <param name="settings">Project settings</param> /// <param name="startLatDegrees">The start latitude of the slicer line in decimal degrees</param> /// <param name="startLonDegrees">The start longitude of the slicer line in decimal degrees</param> /// <param name="endLatDegrees">The end latitude of the slicer line in decimal degrees</param> /// <param name="endLonDegrees">The end longitude of the slicer line in decimal degrees</param> /// <param name="design">The design surface descriptor</param> /// <param name="profileResultHelper">Utility class to do the work</param> /// <param name="slicerProductionDataResult">The slicer profile results containing the production data profiles</param> /// <param name="type">The type of profile, either cut-fill or summary volumes</param> /// <param name="volumeCalcType">Summary volumes calculation type</param> private async Task FindCutFillElevations( long projectId, Guid ProjectUid, CompactionProjectSettings settings, double startLatDegrees, double startLonDegrees, double endLatDegrees, double endLonDegrees, DesignDescriptor design, ICompactionProfileResultHelper profileResultHelper, CompactionProfileResult <CompactionProfileDataResult> slicerProductionDataResult, string type, VolumeCalcType volumeCalcType) { //Get design profile var slicerDesignProfileRequest = requestFactory.Create <DesignProfileRequestHelper>(r => r .ProjectId(projectId) .ProjectUid(ProjectUid) .Headers(this.CustomHeaders) .ProjectSettings(settings) .DesignDescriptor(design)) .CreateDesignProfileRequest(startLatDegrees, startLonDegrees, endLatDegrees, endLonDegrees); slicerDesignProfileRequest.Validate(); var slicerDesignResult = await WithServiceExceptionTryExecuteAsync(() => RequestExecutorContainerFactory .Build <CompactionDesignProfileExecutor>(LoggerFactory, #if RAPTOR RaptorClient, #endif configStore : ConfigStore, trexCompactionDataProxy : TRexCompactionDataProxy, customHeaders : CustomHeaders, userId : GetUserId(), fileImportProxy : FileImportProxy) .ProcessAsync(slicerDesignProfileRequest) ); //Find the cut-fill elevations for the cell stations from the design vertex elevations profileResultHelper.FindCutFillElevations(slicerProductionDataResult, (CompactionProfileResult <CompactionProfileVertex>)slicerDesignResult, type, volumeCalcType); }
public async Task <CompactionProfileResult <CompactionProfileDataResult> > GetProfileProductionDataSlicer( [FromServices] ICompactionProfileResultHelper profileResultHelper, [FromQuery] Guid projectUid, [FromQuery] double startLatDegrees, [FromQuery] double startLonDegrees, [FromQuery] double endLatDegrees, [FromQuery] double endLonDegrees, [FromQuery] Guid?filterUid, [FromQuery] Guid?cutfillDesignUid, [FromQuery] Guid?volumeBaseUid, [FromQuery] Guid?volumeTopUid, [FromQuery] VolumeCalcType?volumeCalcType, [FromQuery] bool explicitFilters = false) { Log.LogInformation("GetProfileProductionDataSlicer: " + Request.QueryString); var projectId = GetLegacyProjectId(projectUid); var settings = GetProjectSettingsTargets(projectUid); var filter = GetCompactionFilter(projectUid, filterUid); var cutFillDesign = GetAndValidateDesignDescriptor(projectUid, cutfillDesignUid, OperationType.Profiling); Task <FilterResult> baseFilter = null; Task <FilterResult> topFilter = null; Task <DesignDescriptor> volumeDesign = null; if (volumeCalcType.HasValue) { switch (volumeCalcType.Value) { case VolumeCalcType.GroundToGround: baseFilter = GetCompactionFilter(projectUid, volumeBaseUid); topFilter = GetCompactionFilter(projectUid, volumeTopUid); await Task.WhenAll(projectId, settings, filter, cutFillDesign, baseFilter, topFilter); break; case VolumeCalcType.GroundToDesign: baseFilter = GetCompactionFilter(projectUid, volumeBaseUid); volumeDesign = GetAndValidateDesignDescriptor(projectUid, volumeTopUid, OperationType.Profiling); await Task.WhenAll(projectId, settings, filter, cutFillDesign, baseFilter, volumeDesign); break; case VolumeCalcType.DesignToGround: volumeDesign = GetAndValidateDesignDescriptor(projectUid, volumeBaseUid, OperationType.Profiling); topFilter = GetCompactionFilter(projectUid, volumeTopUid); await Task.WhenAll(projectId, settings, filter, cutFillDesign, volumeDesign, topFilter); break; } } //Get production data profile var slicerProductionDataProfileRequest = requestFactory.Create <ProductionDataProfileRequestHelper>(r => r .ProjectId(projectId.Result) .ProjectUid(projectUid) .Headers(CustomHeaders) .ProjectSettings(settings.Result) .Filter(filter.Result) .DesignDescriptor(cutFillDesign.Result)) .SetBaseFilter(baseFilter?.Result) .SetTopFilter(topFilter?.Result) .SetVolumeCalcType(volumeCalcType) .SetVolumeDesign(volumeDesign?.Result) .CreateProductionDataProfileRequest(startLatDegrees, startLonDegrees, endLatDegrees, endLonDegrees, explicitFilters); slicerProductionDataProfileRequest.Validate(); var slicerProductionDataResult = await WithServiceExceptionTryExecuteAsync(() => RequestExecutorContainerFactory.Build <CompactionProfileExecutor>(LoggerFactory, #if RAPTOR RaptorClient, #endif configStore : ConfigStore, profileResultHelper : profileResultHelper, trexCompactionDataProxy : TRexCompactionDataProxy, customHeaders : CustomHeaders) .ProcessAsync(slicerProductionDataProfileRequest)) as CompactionProfileResult <CompactionProfileDataResult>; if (cutFillDesign.Result != null) { await FindCutFillElevations(projectId.Result, projectUid, settings.Result, startLatDegrees, startLonDegrees, endLatDegrees, endLonDegrees, cutFillDesign.Result, profileResultHelper, slicerProductionDataResult, CompactionDataPoint.CUT_FILL, VolumeCalcType.None); } if (volumeDesign?.Result != null && (volumeCalcType == VolumeCalcType.DesignToGround || volumeCalcType == VolumeCalcType.GroundToDesign)) { await FindCutFillElevations(projectId.Result, projectUid, settings.Result, startLatDegrees, startLonDegrees, endLatDegrees, endLonDegrees, volumeDesign.Result, profileResultHelper, slicerProductionDataResult, CompactionDataPoint.SUMMARY_VOLUMES, volumeCalcType.Value); } return(slicerProductionDataResult); }
public async Task <CompactionProfileResult <CompactionDesignProfileResult> > GetProfileDesignSlicer( [FromServices] ICompactionProfileResultHelper profileResultHelper, [FromQuery] Guid projectUid, [FromQuery] double startLatDegrees, [FromQuery] double startLonDegrees, [FromQuery] double endLatDegrees, [FromQuery] double endLonDegrees, [FromQuery] Guid[] importedFileUid, [FromQuery] Guid?filterUid = null) { Log.LogInformation("GetProfileDesignSlicer: " + Request.QueryString); if (importedFileUid.Length == 0) { throw new ServiceException(HttpStatusCode.BadRequest, new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError, "At least one importedFileUid must be specified")); } var projectId = GetLegacyProjectId(projectUid); var settings = GetProjectSettingsTargets(projectUid); var filter = GetCompactionFilter(projectUid, filterUid); await Task.WhenAll(projectId, settings, filter); var results = new Dictionary <Guid, CompactionProfileResult <CompactionProfileVertex> >(); foreach (var impFileUid in importedFileUid) { try { var designDescriptor = await GetAndValidateDesignDescriptor(projectUid, impFileUid, OperationType.Profiling); var profileRequest = requestFactory.Create <DesignProfileRequestHelper>(r => r .ProjectId(projectId.Result) .ProjectUid(projectUid) .Headers(CustomHeaders) .ProjectSettings(settings.Result) .Filter(filter.Result) .DesignDescriptor(designDescriptor)) .CreateDesignProfileRequest(startLatDegrees, startLonDegrees, endLatDegrees, endLonDegrees); profileRequest.Validate(); var slicerDesignResult = await WithServiceExceptionTryExecuteAsync(() => RequestExecutorContainerFactory .Build <CompactionDesignProfileExecutor>(LoggerFactory, #if RAPTOR RaptorClient, #endif configStore : ConfigStore, trexCompactionDataProxy : TRexCompactionDataProxy, customHeaders : CustomHeaders, userId : GetUserId(), fileImportProxy : FileImportProxy) .ProcessAsync(profileRequest) ); results.Add(impFileUid, (CompactionProfileResult <CompactionProfileVertex>)slicerDesignResult); } catch (ServiceException) { Log.LogDebug($"File {impFileUid} doesn't support operation {OperationType.Profiling} or is not found"); } } var transformedResult = profileResultHelper.ConvertProfileResult(results); profileResultHelper.AddSlicerEndPoints(transformedResult); return(transformedResult); }
/// <summary> /// Builds this instance for specified executor type. /// </summary> /// <typeparam name="TExecutor">The type of the executor.</typeparam> public static TExecutor Build <TExecutor>(ILoggerFactory logger, #if RAPTOR IASNodeClient raptorClient = null, ITagProcessor tagProcessor = null, #endif IConfigurationStore configStore = null, List <FileData> fileList = null, ICompactionProfileResultHelper profileResultHelper = null, ITRexTagFileProxy tRexTagFileProxy = null, ITRexCompactionDataProxy trexCompactionDataProxy = null, IFileImportProxy fileImportProxy = null, IHeaderDictionary customHeaders = null, string customerUid = null, string userId = null) where TExecutor : RequestExecutorContainer, new() { ILogger log = null; if (logger != null) { log = logger.CreateLogger <TExecutor>(); } var executor = new TExecutor(); executor.Initialise( logger, log, #if RAPTOR raptorClient, tagProcessor, #endif configStore, fileList, profileResultHelper, tRexTagFileProxy, trexCompactionDataProxy, fileImportProxy, customHeaders, customerUid, userId); return(executor); }