mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 18:36:32 +00:00
fix bugs with UI for gps denied
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
using System.IO;
|
||||
using Azaion.CommonSecurity;
|
||||
using Azaion.CommonSecurity.DTO;
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
||||
namespace Azaion.Common.Services;
|
||||
|
||||
@@ -11,12 +9,11 @@ public interface IGpsMatcherService
|
||||
{
|
||||
Task RunGpsMatching(string userRouteDir, double initialLatitude, double initialLongitude, CancellationToken detectToken = default);
|
||||
void StopGpsMatching();
|
||||
Task SetGpsResult(GPSMatcherResultEvent result, CancellationToken detectToken = default);
|
||||
Task FinishGPS(GPSMatcherFinishedEvent notification, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public class GpsMatcherService(IGpsMatcherClient gpsMatcherClient, ISatelliteDownloader satelliteTileDownloader, IOptions<DirectoriesConfig> dirConfig)
|
||||
: IGpsMatcherService,
|
||||
INotificationHandler<GPSMatcherResultEvent>,
|
||||
INotificationHandler<GPSMatcherFinishedEvent>
|
||||
public class GpsMatcherService(IGpsMatcherClient gpsMatcherClient, ISatelliteDownloader satelliteTileDownloader, IOptions<DirectoriesConfig> dirConfig) : IGpsMatcherService
|
||||
{
|
||||
private readonly DirectoriesConfig _dirConfig = dirConfig.Value;
|
||||
private const int ZOOM_LEVEL = 18;
|
||||
@@ -63,7 +60,7 @@ public class GpsMatcherService(IGpsMatcherClient gpsMatcherClient, ISatelliteDow
|
||||
{
|
||||
var filename = Path.GetFileName(fullName);
|
||||
File.Copy(Path.Combine(_userRouteDir, filename), Path.Combine(_routeDir, filename));
|
||||
return new { Filename = filename, Index = startIndex + index };
|
||||
return new { Filename = Path.GetFileNameWithoutExtension(fullName), Index = startIndex + index };
|
||||
})
|
||||
.ToDictionary(x => x.Filename, x => x.Index);
|
||||
|
||||
@@ -83,16 +80,16 @@ public class GpsMatcherService(IGpsMatcherClient gpsMatcherClient, ISatelliteDow
|
||||
gpsMatcherClient.Stop();
|
||||
}
|
||||
|
||||
public Task Handle(GPSMatcherResultEvent result, CancellationToken cancellationToken)
|
||||
public async Task SetGpsResult(GPSMatcherResultEvent result, CancellationToken detectToken = default)
|
||||
{
|
||||
_currentIndex = _currentRouteImages[result.Image];
|
||||
_currentRouteImages.Remove(result.Image);
|
||||
_currentLat = result.Latitude;
|
||||
_currentLon = result.Longitude;
|
||||
_currentIndex = _currentRouteImages[result.Image];
|
||||
return Task.CompletedTask;
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async Task Handle(GPSMatcherFinishedEvent notification, CancellationToken cancellationToken)
|
||||
public async Task FinishGPS(GPSMatcherFinishedEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_currentRouteImages.Count == 0 && _currentIndex < _allRouteImages.Count)
|
||||
await StartMatchingRound(_currentIndex);
|
||||
|
||||
Reference in New Issue
Block a user