switcher dataset explorer

lat lon -> geopoint
correct location for gps if small keypoints number
This commit is contained in:
Alex Bezdieniezhnykh
2025-06-23 20:47:28 +03:00
parent ad1e39268c
commit f58dd3d04f
31 changed files with 469 additions and 192 deletions
+2 -11
View File
@@ -51,7 +51,6 @@ public partial class Annotator
private readonly TimeSpan _thresholdBefore = TimeSpan.FromMilliseconds(50);
private readonly TimeSpan _thresholdAfter = TimeSpan.FromMilliseconds(150);
private static readonly Guid SaveConfigTaskId = Guid.NewGuid();
public ObservableCollection<MediaFileInfo> AllMediaFiles { get; set; } = new();
public ObservableCollection<MediaFileInfo> FilteredMediaFiles { get; set; } = new();
@@ -223,10 +222,6 @@ public partial class Annotator
Volume.ValueChanged += (_, newValue) =>
_mediator.Publish(new VolumeChangedEvent((int)newValue));
SizeChanged += (_, _) => SaveUserSettings();
LocationChanged += (_, _) => SaveUserSettings();
StateChanged += (_, _) => SaveUserSettings();
DgAnnotations.MouseDoubleClick += (sender, args) =>
{
var dgRow = ItemsControl.ContainerFromElement((DataGrid)sender, (args.OriginalSource as DependencyObject)!) as DataGridRow;
@@ -283,11 +278,7 @@ public partial class Annotator
_appConfig.UIConfig.LeftPanelWidth = MainGrid.ColumnDefinitions.FirstOrDefault()!.Width.Value;
_appConfig.UIConfig.RightPanelWidth = MainGrid.ColumnDefinitions.LastOrDefault()!.Width.Value;
ThrottleExt.Throttle(() =>
{
_configUpdater.Save(_appConfig);
return Task.CompletedTask;
}, SaveConfigTaskId, TimeSpan.FromSeconds(5));
_configUpdater.Save(_appConfig);
}
private void ShowTimeAnnotations(TimeSpan time)
@@ -589,7 +580,7 @@ public partial class Annotator
private void SoundDetections(object sender, RoutedEventArgs e)
{
throw new NotImplementedException();
_logger.LogInformation("To be implemented");
}
}
+20 -11
View File
@@ -42,7 +42,7 @@ public class AnnotatorEventHandler(
INotificationHandler<AnnotationsDeletedEvent>,
INotificationHandler<AnnotationAddedEvent>,
INotificationHandler<SetStatusTextEvent>,
INotificationHandler<GPSMatcherResultEvent>
INotificationHandler<GPSMatcherResultProcessedEvent>
{
private const int STEP = 20;
private const int LARGE_STEP = 5000;
@@ -378,20 +378,29 @@ public class AnnotatorEventHandler(
return Task.CompletedTask;
}
public Task Handle(GPSMatcherResultEvent e, CancellationToken cancellationToken)
public Task Handle(GPSMatcherResultProcessedEvent e, CancellationToken cancellationToken)
{
mainWindow.Dispatcher.Invoke(() =>
{
var mapMatcher = mainWindow.MapMatcherComponent;
var marker = new GMapMarker(new PointLatLng(e.Latitude, e.Longitude));
var ann = mapMatcher.Annotations[e.Index];
marker.Shape = new CircleVisual(marker, size: 14, text: e.Image, background: Brushes.Blue);
mapMatcher.SatelliteMap.Markers.Add(marker);
ann.Lat = e.Latitude;
ann.Lon = e.Longitude;
mapMatcher.SatelliteMap.Position = new PointLatLng(e.Latitude, e.Longitude);
mapMatcher.SatelliteMap.ZoomAndCenterMarkers(null);
var ann = mainWindow.MapMatcherComponent.Annotations[e.Index];
AddMarker(e.GeoPoint, e.Image, Brushes.Blue);
if (e.ProcessedGeoPoint != e.GeoPoint)
AddMarker(e.ProcessedGeoPoint, $"{e.Image}: corrected", Brushes.DarkViolet);
ann.Lat = e.GeoPoint.Lat;
ann.Lon = e.GeoPoint.Lon;
});
return Task.CompletedTask;
}
private void AddMarker(GeoPoint point, string text, SolidColorBrush color)
{
var map = mainWindow.MapMatcherComponent;
var pointLatLon = new PointLatLng(point.Lat, point.Lon);
var marker = new GMapMarker(pointLatLon);
marker.Shape = new CircleVisual(marker, size: 14, text: text, background: color);
map.SatelliteMap.Markers.Add(marker);
map.SatelliteMap.Position = pointLatLon;
map.SatelliteMap.ZoomAndCenterMarkers(null);
}
}
+4 -7
View File
@@ -103,10 +103,8 @@ public partial class MapMatcher : UserControl
OriginalMediaName = x.Name
})).ToDictionary(x => x.i, x => x.Item2);
var initialLat = double.Parse(TbLat.Text);
var initialLon = double.Parse(TbLon.Text);
await _gpsMatcherService.RunGpsMatching(dir.FullName, initialLat, initialLon);
var initialLatLon = new GeoPoint(double.Parse(TbLat.Text), double.Parse(TbLon.Text));
await _gpsMatcherService.RunGpsMatching(dir.FullName, initialLatLon);
}
private async void TestGps(object sender, RoutedEventArgs e)
@@ -114,8 +112,7 @@ public partial class MapMatcher : UserControl
if (string.IsNullOrEmpty(TbGpsMapFolder.Text))
return;
var initialLat = double.Parse(TbLat.Text);
var initialLon = double.Parse(TbLon.Text);
await _gpsMatcherService.RunGpsMatching(TbGpsMapFolder.Text, initialLat, initialLon);
var initialLatLon = new GeoPoint(double.Parse(TbLat.Text), double.Parse(TbLon.Text));
await _gpsMatcherService.RunGpsMatching(TbGpsMapFolder.Text, initialLatLon);
}
}