コード例 #1
0
        public async Task <CompactionDetailPaletteResult> GetElevationPalette(
            [FromQuery] Guid projectUid,
            [FromQuery] Guid?filterUid)
        {
            Log.LogInformation("GetElevationPalette: " + Request.QueryString);

            var projectSettingsTask       = GetProjectSettingsTargets(projectUid);
            var projectSettingsColorsTask = GetProjectSettingsColors(projectUid);

            var filterTask    = GetCompactionFilter(projectUid, filterUid);
            var projectIdTask = GetLegacyProjectId(projectUid);

            await Task.WhenAll(projectSettingsTask, filterTask, projectIdTask);

            var elevExtents = await elevProxy.GetElevationRange(projectIdTask.Result, projectUid, filterTask.Result, projectSettingsTask.Result, CustomHeaders, GetUserId());

            var compactionPalette = SettingsManager.CompactionPalette(DisplayMode.Height, elevExtents, projectSettingsTask.Result, projectSettingsColorsTask.Result);

            DetailPalette elevationPalette = null;

            if (compactionPalette != null)
            {
                var colorValues = compactionPalette.Select(t => ColorValue.CreateColorValue(t.Color, t.Value)).ToList();

                elevationPalette = DetailPalette.CreateDetailPalette(colorValues,
                                                                     compactionPalette[compactionPalette.Count - 1].Color, compactionPalette[0].Color);
            }

            return(CompactionDetailPaletteResult.CreateCompactionDetailPaletteResult(elevationPalette));
        }
コード例 #2
0
        public async Task <CompactionDetailPaletteResult> GetCCAPalette(
            [FromQuery] Guid projectUid,
            [FromQuery] Guid filterUid)
        {
            Log.LogInformation($"{nameof(GetCCAPalette)}: " + Request.QueryString);

            var filterTask    = GetCompactionFilter(projectUid, filterUid);
            var projectIdTask = GetLegacyProjectId(projectUid);

            await Task.WhenAll(filterTask, projectIdTask);

            //Quickest for now to use old Landfill executor
            var filter = filterTask.Result;

            if (filter?.ContributingMachines?.Count != 1)
            {
                throw new ServiceException(HttpStatusCode.BadRequest,
                                           new ContractExecutionResult(ContractExecutionStatesEnum.ValidationError,
                                                                       "CCA palette requires one and only one machine filter"));
            }
            var machine = filter.ContributingMachines[0];
            var request = CCAColorPaletteRequest.CreateCCAColorPaletteRequest(projectIdTask.Result, machine.AssetId, filter.StartUtc, filter.EndUtc, filter.LayerNumber, projectUid, machine.AssetUid);

            request.Validate();
            var palette = await RequestExecutorContainerFactory.Build <CCAColorPaletteExecutor>(LoggerFactory,
#if RAPTOR
                                                                                                RaptorClient,
#endif
                                                                                                configStore : ConfigStore,
                                                                                                trexCompactionDataProxy : TRexCompactionDataProxy,
                                                                                                userId : GetUserId(), fileImportProxy : FileImportProxy).ProcessAsync(request) as CCAColorPaletteResult;

            return(CompactionDetailPaletteResult.CreateCompactionDetailPaletteResult(
                       DetailPalette.CreateDetailPalette(
                           palette.Palettes.Select(x => ColorValue.CreateColorValue(x.Color, x.Value)).ToList(),
                           0, null)));//black for too thick
        }