mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:26:31 +00:00
fix bugs with UI for gps denied
This commit is contained in:
@@ -5,9 +5,11 @@ using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using Azaion.Common.DTO;
|
||||
using Azaion.Common.DTO.Config;
|
||||
using Azaion.Common.Events;
|
||||
using Azaion.Common.Extensions;
|
||||
using Azaion.CommonSecurity;
|
||||
using Azaion.CommonSecurity.DTO;
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
@@ -26,7 +28,8 @@ public class SatelliteDownloader(
|
||||
ILogger<SatelliteDownloader> logger,
|
||||
IOptions<MapConfig> mapConfig,
|
||||
IOptions<DirectoriesConfig> directoriesConfig,
|
||||
IHttpClientFactory httpClientFactory)
|
||||
IHttpClientFactory httpClientFactory,
|
||||
IMediator mediator)
|
||||
: ISatelliteDownloader
|
||||
{
|
||||
private const int INPUT_TILE_SIZE = 256;
|
||||
@@ -45,15 +48,19 @@ public class SatelliteDownloader(
|
||||
|
||||
public async Task GetTiles(double centerLat, double centerLon, double radiusM, int zoomLevel, CancellationToken token = default)
|
||||
{
|
||||
await mediator.Publish(new SetStatusTextEvent($"Завантажується супутникові зображення по координатах: центр: lat: {centerLat:F3} lon: {centerLon:F3} квадрат {radiusM}м * {radiusM}м, zoom: {zoomLevel}..."), token);
|
||||
//empty Satellite directory
|
||||
if (Directory.Exists(_satDirectory))
|
||||
Directory.Delete(_satDirectory, true);
|
||||
Directory.CreateDirectory(_satDirectory);
|
||||
|
||||
var downloadTilesResult = await DownloadTiles(centerLat, centerLon, radiusM, zoomLevel, token);
|
||||
await mediator.Publish(new SetStatusTextEvent("Завершено! Склеюється в 1 зображення..."), token);
|
||||
var image = ComposeTiles(downloadTilesResult.Tiles, token);
|
||||
if (image != null)
|
||||
await SplitToTiles(image, downloadTilesResult, token);
|
||||
if (image == null)
|
||||
return;
|
||||
await mediator.Publish(new SetStatusTextEvent("Розбиття на малі зображення для опрацювання..."), token);
|
||||
await SplitToTiles(image, downloadTilesResult, token);
|
||||
}
|
||||
|
||||
private async Task SplitToTiles(Image<Rgba32> image, DownloadTilesResult bounds, CancellationToken token = default)
|
||||
|
||||
Reference in New Issue
Block a user