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
+22 -16
View File
@@ -31,12 +31,12 @@ public class DatasetExplorerEventHandler(
{ Key.V, PlaybackControlEnum.ValidateAnnotations},
};
public async Task Handle(DatasetExplorerControlEvent notification, CancellationToken cancellationToken)
public async Task Handle(DatasetExplorerControlEvent notification, CancellationToken token)
{
await HandleControl(notification.PlaybackControl, cancellationToken);
await HandleControl(notification.PlaybackControl, token);
}
public async Task Handle(KeyEvent keyEvent, CancellationToken cancellationToken)
public async Task Handle(KeyEvent keyEvent, CancellationToken token)
{
if (keyEvent.WindowEnum != WindowEnum.DatasetExplorer)
return;
@@ -52,11 +52,11 @@ public class DatasetExplorerEventHandler(
else
{
if (datasetExplorer.Switcher.SelectedIndex == 1 && _keysControlEnumDict.TryGetValue(key, out var value))
await HandleControl(value, cancellationToken);
await HandleControl(value, token);
}
}
private async Task HandleControl(PlaybackControlEnum controlEnum, CancellationToken cancellationToken = default)
private async Task HandleControl(PlaybackControlEnum controlEnum, CancellationToken token = default)
{
switch (controlEnum)
{
@@ -70,7 +70,8 @@ public class DatasetExplorerEventHandler(
.Select(x => new Detection(a.Name, x.GetLabel(datasetExplorer.ExplorerEditor.RenderSize)))
.ToList();
var index = datasetExplorer.ThumbnailsView.SelectedIndex;
await annotationService.SaveAnnotation(a.OriginalMediaName, a.Time, detections, token: cancellationToken);
var annotation = await annotationService.SaveAnnotation(a.OriginalMediaName, a.Time, detections, token: token);
await ValidateAnnotations([annotation], token);
await datasetExplorer.EditAnnotation(index + 1);
break;
case PlaybackControlEnum.RemoveSelectedAnns:
@@ -98,19 +99,24 @@ public class DatasetExplorerEventHandler(
var annotations = datasetExplorer.ThumbnailsView.SelectedItems.Cast<AnnotationThumbnail>()
.Select(x => x.Annotation)
.ToList();
await annotationService.ValidateAnnotations(annotations.Select(x => x.Name).ToList(), token: cancellationToken);
foreach (var ann in datasetExplorer.SelectedAnnotations.Where(x => annotations.Contains(x.Annotation)))
{
ann.Annotation.AnnotationStatus = AnnotationStatus.Validated;
if (datasetExplorer.SelectedAnnotationDict.TryGetValue(ann.Annotation.Name, out var value))
value.Annotation.AnnotationStatus = AnnotationStatus.Validated;
ann.UpdateUI();
}
await ValidateAnnotations(annotations, token);
break;
}
}
public Task Handle(AnnotationCreatedEvent notification, CancellationToken cancellationToken)
private async Task ValidateAnnotations(List<Annotation> annotations, CancellationToken token = default)
{
await annotationService.ValidateAnnotations(annotations.Select(x => x.Name).ToList(), token: token);
foreach (var ann in datasetExplorer.SelectedAnnotations.Where(x => annotations.Contains(x.Annotation)))
{
ann.Annotation.AnnotationStatus = AnnotationStatus.Validated;
if (datasetExplorer.SelectedAnnotationDict.TryGetValue(ann.Annotation.Name, out var value))
value.Annotation.AnnotationStatus = AnnotationStatus.Validated;
ann.UpdateUI();
}
}
public Task Handle(AnnotationCreatedEvent notification, CancellationToken token)
{
datasetExplorer.Dispatcher.Invoke(() =>
{
@@ -140,7 +146,7 @@ public class DatasetExplorerEventHandler(
return Task.CompletedTask;
}
public async Task Handle(AnnotationsDeletedEvent notification, CancellationToken cancellationToken)
public async Task Handle(AnnotationsDeletedEvent notification, CancellationToken token)
{
try
{