Example #1
0
        public async Task TileExecutor_EmptySiteModel()
        {
            AddRoutings();

            var siteModel = DITAGFileAndSubGridRequestsWithIgniteFixture.NewEmptyModel();

            var request = new TRexTileRequest
                          (
                siteModel.ID,
                DisplayMode.Height,
                null, //List<ColorPalette> palettes,
                null, //new DesignDescriptor(0, FileDescriptor.EmptyFileDescriptor, 0),
                new FilterResult(),
                new FilterResult(),
                null, //new BoundingBox2DLatLon boundingBoxLatLon,
                new BoundingBox2DGrid(0, 0, 100, 100),
                256,
                256,
                null,
                null,
                VolumesType.None);

            request.Validate();

            var executor = RequestExecutorContainer
                           .Build <TileExecutor>(DIContext.Obtain <IConfigurationStore>(),
                                                 DIContext.Obtain <ILoggerFactory>(),
                                                 DIContext.Obtain <IServiceExceptionHandler>());
            var result = await executor.ProcessAsync(request) as TileResult;

            result.Should().NotBeNull();
            result?.Code.Should().Be(ContractExecutionStatesEnum.ExecutedSuccessfully);
            result?.TileData.Should().NotBeNull();
        }
Example #2
0
        public async Task <FileResult> GetTile([FromBody] TRexTileRequest request)
        {
            Log.LogInformation($"{nameof(GetTile)}: {JsonConvert.SerializeObject(request)}");

            request.Validate();
            ValidateFilterMachines(nameof(GetTile), request.ProjectUid, request.Filter1);
            ValidateFilterMachines(nameof(GetTile), request.ProjectUid, request.Filter2);

            var tileResult = await WithServiceExceptionTryExecuteAsync(() =>
                                                                       RequestExecutorContainer
                                                                       .Build <TileExecutor>(ConfigStore, LoggerFactory, ServiceExceptionHandler)
                                                                       .ProcessAsync(request)) as TileResult;

            if (tileResult?.TileData == null)
            {
                tileResult = TileResult.EmptyTile(WebMercatorProjection.TILE_SIZE, WebMercatorProjection.TILE_SIZE);
            }

            return(new FileStreamResult(new MemoryStream(tileResult.TileData), ContentTypeConstants.ImagePng));
        }