fix re-send new batch to gps denied

todo: clear folders, consider better center point to fetch next batch from satellite provider
This commit is contained in:
Alex Bezdieniezhnykh
2025-05-30 11:03:00 +03:00
parent b345137f16
commit 1b6c440dcc
6 changed files with 21 additions and 19 deletions
+2 -6
View File
@@ -376,8 +376,7 @@ public class AnnotatorEventHandler(
mainWindow.Dispatcher.Invoke(() => mainWindow.Dispatcher.Invoke(() =>
{ {
mainWindow.StatusHelp.Text = e.Text; mainWindow.StatusHelp.Text = e.Text;
if (e.Color.HasValue) mainWindow.StatusHelp.Foreground = e.IsError ? Brushes.Red : Brushes.White;
mainWindow.StatusHelp.Foreground = new SolidColorBrush(e.Color.Value);
}); });
return Task.CompletedTask; return Task.CompletedTask;
} }
@@ -389,10 +388,7 @@ public class AnnotatorEventHandler(
var mapMatcher = mainWindow.MapMatcherComponent; var mapMatcher = mainWindow.MapMatcherComponent;
var marker = new GMapMarker(new PointLatLng(e.Latitude, e.Longitude)); var marker = new GMapMarker(new PointLatLng(e.Latitude, e.Longitude));
var ann = mapMatcher.Annotations[e.Index]; var ann = mapMatcher.Annotations[e.Index];
marker.Shape = new CircleVisual(marker, Brushes.Blue) marker.Shape = new CircleVisual(marker, size: 14, text: e.Image, background: Brushes.Blue);
{
Text = e.Image
};
mapMatcher.SatelliteMap.Markers.Add(marker); mapMatcher.SatelliteMap.Markers.Add(marker);
ann.Lat = e.Latitude; ann.Lat = e.Latitude;
ann.Lon = e.Longitude; ann.Lon = e.Longitude;
+3 -3
View File
@@ -11,7 +11,7 @@ namespace Azaion.Annotator.Controls
{ {
public readonly GMapMarker Marker; public readonly GMapMarker Marker;
public CircleVisual(GMapMarker m, Brush background) public CircleVisual(GMapMarker m, int size, string text, Brush background)
{ {
ShadowEffect = new DropShadowEffect(); ShadowEffect = new DropShadowEffect();
Marker = m; Marker = m;
@@ -22,14 +22,14 @@ namespace Azaion.Annotator.Controls
MouseLeave += CircleVisual_MouseLeave; MouseLeave += CircleVisual_MouseLeave;
Loaded += OnLoaded; Loaded += OnLoaded;
Text = "?"; Text = text;
StrokeArrow.EndLineCap = PenLineCap.Triangle; StrokeArrow.EndLineCap = PenLineCap.Triangle;
StrokeArrow.LineJoin = PenLineJoin.Round; StrokeArrow.LineJoin = PenLineJoin.Round;
RenderTransform = _scale; RenderTransform = _scale;
Width = Height = 22; Width = Height = size;
FontSize = Width / 1.55; FontSize = Width / 1.55;
Background = background; Background = background;
+2 -3
View File
@@ -1,10 +1,9 @@
using System.Windows.Media;
using MediatR; using MediatR;
namespace Azaion.Common.Events; namespace Azaion.Common.Events;
public class SetStatusTextEvent(string text, Color? color = null) : INotification public class SetStatusTextEvent(string text, bool isError = false) : INotification
{ {
public string Text { get; set; } = text; public string Text { get; set; } = text;
public Color? Color { get; set; } = color; public bool IsError { get; set; } = isError;
} }
+1 -1
View File
@@ -65,7 +65,7 @@ public class GpsMatcherService(IGpsMatcherClient gpsMatcherClient, ISatelliteDow
.ToDictionary(x => x.Filename, x => x.Index); .ToDictionary(x => x.Filename, x => x.Index);
await satelliteTileDownloader.GetTiles(_currentLat, _currentLon, SATELLITE_RADIUS_M, ZOOM_LEVEL, _detectToken); await satelliteTileDownloader.GetTiles(_currentLat, _currentLon, SATELLITE_RADIUS_M, ZOOM_LEVEL, _detectToken);
gpsMatcherClient.StartMatching(new StartMatchingEvent await gpsMatcherClient.StartMatching(new StartMatchingEvent
{ {
ImagesCount = POINTS_COUNT, ImagesCount = POINTS_COUNT,
Latitude = _currentLat, Latitude = _currentLat,
+9 -2
View File
@@ -1,5 +1,6 @@
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using Azaion.Common.Events;
using Azaion.CommonSecurity; using Azaion.CommonSecurity;
using Azaion.CommonSecurity.DTO; using Azaion.CommonSecurity.DTO;
using MediatR; using MediatR;
@@ -12,7 +13,7 @@ namespace Azaion.Common.Services;
public interface IGpsMatcherClient : IDisposable public interface IGpsMatcherClient : IDisposable
{ {
void StartMatching(StartMatchingEvent startEvent); Task StartMatching(StartMatchingEvent startEvent);
void Stop(); void Stop();
} }
@@ -121,9 +122,15 @@ public class GpsMatcherClient : IGpsMatcherClient
} }
} }
public void StartMatching(StartMatchingEvent e) public async Task StartMatching(StartMatchingEvent e)
{ {
_requestSocket.SendFrame(e.ToString()); _requestSocket.SendFrame(e.ToString());
_requestSocket.TryReceiveFrameString(TimeSpan.FromMilliseconds(300), out var response);
if (response != "OK")
{
_logger.LogError(response);
await _mediator.Publish(new SetStatusTextEvent(response, true));
}
} }
public void Stop() => _requestSocket.SendFrame("STOP"); public void Stop() => _requestSocket.SendFrame("STOP");
+4 -4
View File
@@ -33,8 +33,8 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Azaion.Common\Azaion.Common.csproj" /> <ProjectReference Include="..\Azaion.Common\Azaion.Common.csproj" />
<ProjectReference Include="..\dummy\Azaion.Annotator\Azaion.Annotator.csproj" /> <ProjectReference Include="..\Azaion.Annotator\Azaion.Annotator.csproj" />
<ProjectReference Include="..\dummy\Azaion.Dataset\Azaion.Dataset.csproj" /> <ProjectReference Include="..\Azaion.Dataset\Azaion.Dataset.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -62,8 +62,8 @@
<Target Name="PostBuild" AfterTargets="Build"> <Target Name="PostBuild" AfterTargets="Build">
<MakeDir Directories="$(TargetDir)dummy" /> <MakeDir Directories="$(TargetDir)dummy" />
<Move SourceFiles="$(TargetDir)Azaion.Annotator.dll" DestinationFolder="$(TargetDir)dummy" /> <Copy SourceFiles="$(TargetDir)Azaion.Annotator.dll" DestinationFolder="$(TargetDir)dummy" />
<Move SourceFiles="$(TargetDir)Azaion.Dataset.dll" DestinationFolder="$(TargetDir)dummy" /> <Copy SourceFiles="$(TargetDir)Azaion.Dataset.dll" DestinationFolder="$(TargetDir)dummy" />
<Exec Command="postbuild.cmd $(ConfigurationName) stage" /> <Exec Command="postbuild.cmd $(ConfigurationName) stage" />
</Target> </Target>