mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:36:31 +00:00
add gps matcher service
This commit is contained in:
@@ -26,6 +26,8 @@
|
|||||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||||
<PackageReference Include="SkiaSharp" Version="2.88.9" />
|
<PackageReference Include="SkiaSharp" Version="2.88.9" />
|
||||||
|
<PackageReference Include="System.Data.SQLite" Version="1.0.119" />
|
||||||
|
<PackageReference Include="System.Data.SQLite.EF6" Version="1.0.119" />
|
||||||
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.21" />
|
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.21" />
|
||||||
<PackageReference Include="WindowsAPICodePack" Version="7.0.4" />
|
<PackageReference Include="WindowsAPICodePack" Version="7.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace Azaion.Annotator.Controls
|
|||||||
|
|
||||||
public CircleVisual(GMapMarker m, Brush background)
|
public CircleVisual(GMapMarker m, Brush background)
|
||||||
{
|
{
|
||||||
|
ShadowEffect = new DropShadowEffect();
|
||||||
Marker = m;
|
Marker = m;
|
||||||
Marker.ZIndex = 100;
|
Marker.ZIndex = 100;
|
||||||
|
|
||||||
@@ -161,14 +162,11 @@ namespace Azaion.Annotator.Controls
|
|||||||
|
|
||||||
public double? Angle
|
public double? Angle
|
||||||
{
|
{
|
||||||
get
|
get => _angle;
|
||||||
{
|
|
||||||
return _angle;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!Angle.HasValue || !value.HasValue ||
|
if (!_angle.HasValue || !value.HasValue ||
|
||||||
Angle.HasValue && value.HasValue && Math.Abs(_angle.Value - value.Value) > 11)
|
Angle.HasValue && Math.Abs(_angle.Value - value.Value) > 11)
|
||||||
{
|
{
|
||||||
_angle = value;
|
_angle = value;
|
||||||
IsChanged = true;
|
IsChanged = true;
|
||||||
@@ -211,14 +209,12 @@ namespace Azaion.Annotator.Controls
|
|||||||
|
|
||||||
public virtual Visual Child
|
public virtual Visual Child
|
||||||
{
|
{
|
||||||
get
|
get => _child;
|
||||||
{
|
|
||||||
return _child;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_child != value)
|
if (_child == value)
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (_child != null)
|
if (_child != null)
|
||||||
{
|
{
|
||||||
RemoveLogicalChild(_child);
|
RemoveLogicalChild(_child);
|
||||||
@@ -237,7 +233,6 @@ namespace Azaion.Annotator.Controls
|
|||||||
InvalidateVisual();
|
InvalidateVisual();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public bool UpdateVisual(bool forceUpdate)
|
public bool UpdateVisual(bool forceUpdate)
|
||||||
{
|
{
|
||||||
@@ -259,8 +254,7 @@ namespace Azaion.Annotator.Controls
|
|||||||
|
|
||||||
var square = new DrawingVisualFx();
|
var square = new DrawingVisualFx();
|
||||||
|
|
||||||
using (var dc = square.RenderOpen())
|
using var dc = square.RenderOpen();
|
||||||
{
|
|
||||||
dc.DrawEllipse(null,
|
dc.DrawEllipse(null,
|
||||||
Stroke,
|
Stroke,
|
||||||
new Point(Width / 2, Height / 2),
|
new Point(Width / 2, Height / 2),
|
||||||
@@ -287,7 +281,6 @@ namespace Azaion.Annotator.Controls
|
|||||||
|
|
||||||
dc.DrawEllipse(Background, null, new Point(Width / 2, Height / 2), Width / 2, Height / 2);
|
dc.DrawEllipse(Background, null, new Point(Width / 2, Height / 2), Width / 2, Height / 2);
|
||||||
dc.DrawText(_fText, new Point(Width / 2 - _fText.Width / 2, Height / 2 - _fText.Height / 2));
|
dc.DrawText(_fText, new Point(Width / 2 - _fText.Width / 2, Height / 2 - _fText.Height / 2));
|
||||||
}
|
|
||||||
|
|
||||||
return square;
|
return square;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ namespace Azaion.Annotator.Controls;
|
|||||||
|
|
||||||
public partial class MapMatcher : UserControl
|
public partial class MapMatcher : UserControl
|
||||||
{
|
{
|
||||||
private AppConfig _appConfig;
|
private AppConfig _appConfig = null!;
|
||||||
List<MediaFileInfo> _allMediaFiles;
|
List<MediaFileInfo> _allMediaFiles = new();
|
||||||
private Dictionary<int, Annotation> _annotations;
|
private Dictionary<int, Annotation> _annotations = new();
|
||||||
private string _currentDir;
|
private string _currentDir = null!;
|
||||||
private IGpsMatcherService _gpsMatcherService;
|
private IGpsMatcherService _gpsMatcherService = null!;
|
||||||
|
|
||||||
public MapMatcher()
|
public MapMatcher()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
<PackageReference Include="Polly" Version="8.5.2" />
|
<PackageReference Include="Polly" Version="8.5.2" />
|
||||||
<PackageReference Include="RabbitMQ.Stream.Client" Version="1.8.9" />
|
<PackageReference Include="RabbitMQ.Stream.Client" Version="1.8.9" />
|
||||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
|
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
|
||||||
|
<PackageReference Include="Stub.System.Data.SQLite.Core.NetStandard" Version="1.0.119" />
|
||||||
|
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.119" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
|
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
public class MapConfig
|
public class MapConfig
|
||||||
{
|
{
|
||||||
public string Service { get; set; }
|
public string Service { get; set; } = null!;
|
||||||
public string ApiKey { get; set; }
|
public string ApiKey { get; set; } = null!;
|
||||||
}
|
}
|
||||||
@@ -5,12 +5,12 @@ using System.IO;
|
|||||||
public class GpsMatchResult
|
public class GpsMatchResult
|
||||||
{
|
{
|
||||||
public int Index { get; set; }
|
public int Index { get; set; }
|
||||||
public string Image { get; set; }
|
public string Image { get; set; } = null!;
|
||||||
public double Latitude { get; set; }
|
public double Latitude { get; set; }
|
||||||
public double Longitude { get; set; }
|
public double Longitude { get; set; }
|
||||||
public int Keypoints { get; set; }
|
public int KeyPoints { get; set; }
|
||||||
public int Rotation { get; set; }
|
public int Rotation { get; set; }
|
||||||
public string MatchType { get; set; }
|
public string MatchType { get; set; } = null!;
|
||||||
|
|
||||||
public static List<GpsMatchResult> ReadFromCsv(string csvFilePath)
|
public static List<GpsMatchResult> ReadFromCsv(string csvFilePath)
|
||||||
{
|
{
|
||||||
@@ -35,7 +35,7 @@ public class GpsMatchResult
|
|||||||
Image = GetFilename(values[0]),
|
Image = GetFilename(values[0]),
|
||||||
Latitude = double.Parse(values[1]),
|
Latitude = double.Parse(values[1]),
|
||||||
Longitude = double.Parse(values[2]),
|
Longitude = double.Parse(values[2]),
|
||||||
Keypoints = int.Parse(values[3]),
|
KeyPoints = int.Parse(values[3]),
|
||||||
Rotation = int.Parse(values[4]),
|
Rotation = int.Parse(values[4]),
|
||||||
MatchType = values[5]
|
MatchType = values[5]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public partial class App
|
|||||||
private IMediator _mediator = null!;
|
private IMediator _mediator = null!;
|
||||||
private FormState _formState = null!;
|
private FormState _formState = null!;
|
||||||
|
|
||||||
private InferenceExternalClient _inferenceClient = null!;
|
private IInferenceClient _inferenceClient = null!;
|
||||||
private IResourceLoader _resourceLoader = null!;
|
private IResourceLoader _resourceLoader = null!;
|
||||||
private IAuthProvider _authProvider = null!;
|
private IAuthProvider _authProvider = null!;
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ public partial class App
|
|||||||
{
|
{
|
||||||
new ConfigUpdater().CheckConfig();
|
new ConfigUpdater().CheckConfig();
|
||||||
var secureAppConfig = ReadSecureAppConfig();
|
var secureAppConfig = ReadSecureAppConfig();
|
||||||
_inferenceClient = new InferenceExternalClient(new OptionsWrapper<InferenceClientConfig>(secureAppConfig.InferenceClientConfig));
|
_inferenceClient = new InferenceClient(new OptionsWrapper<InferenceClientConfig>(secureAppConfig.InferenceClientConfig));
|
||||||
_resourceLoader = new ResourceLoader(_inferenceClient);
|
_resourceLoader = new ResourceLoader(_inferenceClient);
|
||||||
_authProvider = new AuthProvider(_inferenceClient);
|
_authProvider = new AuthProvider(_inferenceClient);
|
||||||
|
|
||||||
@@ -168,8 +168,8 @@ public partial class App
|
|||||||
|
|
||||||
services.ConfigureSection<InferenceClientConfig>(context.Configuration);
|
services.ConfigureSection<InferenceClientConfig>(context.Configuration);
|
||||||
services.ConfigureSection<GpsDeniedClientConfig>(context.Configuration);
|
services.ConfigureSection<GpsDeniedClientConfig>(context.Configuration);
|
||||||
services.AddKeyedSingleton<IExternalClient>(SecurityConstants.EXTERNAL_INFERENCE_PATH, _inferenceClient);
|
services.AddSingleton<IInferenceClient>(_inferenceClient);
|
||||||
services.AddKeyedSingleton<IExternalClient, GpsDeniedExternalClient>(SecurityConstants.EXTERNAL_GPS_DENIED_PATH);
|
services.AddSingleton<IGpsMatcherClient, GpsMatcherClient>();
|
||||||
services.AddSingleton<IResourceLoader>(_resourceLoader);
|
services.AddSingleton<IResourceLoader>(_resourceLoader);
|
||||||
services.AddSingleton<IAuthProvider>(_authProvider);
|
services.AddSingleton<IAuthProvider>(_authProvider);
|
||||||
services.AddSingleton<IInferenceService, InferenceService>();
|
services.AddSingleton<IInferenceService, InferenceService>();
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||||
<PackageReference Include="SharpVectors" Version="1.8.4.2" />
|
<PackageReference Include="SharpVectors" Version="1.8.4.2" />
|
||||||
<PackageReference Include="SharpVectors.Wpf" Version="1.8.4.2" />
|
<PackageReference Include="SharpVectors.Wpf" Version="1.8.4.2" />
|
||||||
|
<PackageReference Include="System.Data.SQLite" Version="1.0.119" />
|
||||||
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.21" />
|
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.21" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ public partial class MainSuite
|
|||||||
private readonly IDbFactory _dbFactory;
|
private readonly IDbFactory _dbFactory;
|
||||||
private readonly Dictionary<WindowEnum, Window> _openedWindows = new();
|
private readonly Dictionary<WindowEnum, Window> _openedWindows = new();
|
||||||
private readonly IResourceLoader _resourceLoader;
|
private readonly IResourceLoader _resourceLoader;
|
||||||
private readonly IEnumerable<IExternalClient> _externalClients;
|
private readonly IInferenceClient _inferenceClient;
|
||||||
|
private readonly IGpsMatcherClient _gpsMatcherClient;
|
||||||
private static readonly Guid SaveConfigTaskId = Guid.NewGuid();
|
private static readonly Guid SaveConfigTaskId = Guid.NewGuid();
|
||||||
|
|
||||||
public MainSuite(IOptions<AppConfig> appConfig,
|
public MainSuite(IOptions<AppConfig> appConfig,
|
||||||
@@ -36,8 +37,8 @@ public partial class MainSuite
|
|||||||
IGalleryService galleryService,
|
IGalleryService galleryService,
|
||||||
IDbFactory dbFactory,
|
IDbFactory dbFactory,
|
||||||
IResourceLoader resourceLoader,
|
IResourceLoader resourceLoader,
|
||||||
[FromKeyedServices(SecurityConstants.EXTERNAL_INFERENCE_PATH)] IExternalClient inferenceClient,
|
IInferenceClient inferenceClient,
|
||||||
[FromKeyedServices(SecurityConstants.EXTERNAL_GPS_DENIED_PATH)] IExternalClient gpsClient)
|
IGpsMatcherClient gpsMatcherClient)
|
||||||
{
|
{
|
||||||
_configUpdater = configUpdater;
|
_configUpdater = configUpdater;
|
||||||
_modules = modules;
|
_modules = modules;
|
||||||
@@ -45,7 +46,9 @@ public partial class MainSuite
|
|||||||
_galleryService = galleryService;
|
_galleryService = galleryService;
|
||||||
_dbFactory = dbFactory;
|
_dbFactory = dbFactory;
|
||||||
_resourceLoader = resourceLoader;
|
_resourceLoader = resourceLoader;
|
||||||
_externalClients = [inferenceClient, gpsClient];
|
_inferenceClient = inferenceClient;
|
||||||
|
_gpsMatcherClient = gpsMatcherClient;
|
||||||
|
|
||||||
_appConfig = appConfig.Value;
|
_appConfig = appConfig.Value;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Loaded += OnLoaded;
|
Loaded += OnLoaded;
|
||||||
@@ -120,8 +123,9 @@ public partial class MainSuite
|
|||||||
if (_openedWindows.Any())
|
if (_openedWindows.Any())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var client in _externalClients)
|
_inferenceClient.Stop();
|
||||||
client.Stop();
|
_gpsMatcherClient.Stop();
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
};
|
};
|
||||||
window.Show();
|
window.Show();
|
||||||
|
|||||||
Reference in New Issue
Block a user