add editor, fix some bugs

WIP
This commit is contained in:
Alex Bezdieniezhnykh
2024-09-10 17:10:54 +03:00
parent b4bedb7520
commit 52371ace3a
16 changed files with 498 additions and 148 deletions
+23 -6
View File
@@ -1,6 +1,5 @@
using System.IO;
using System.Text;
using System.Windows.Media;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Size = System.Windows.Size;
@@ -11,21 +10,22 @@ namespace Azaion.Annotator.DTO;
public class Config
{
public const string ThumbnailPrefix = "_thumb";
public const string ThumbnailsCacheFile = "thumbnails.cache";
public string VideosDirectory { get; set; }
public string LabelsDirectory { get; set; }
public string ImagesDirectory { get; set; }
public string ResultsDirectory { get; set; }
public string ThumbnailsDirectory { get; set; }
public string UnknownImages { get; set; }
public List<AnnotationClass> AnnotationClasses { get; set; } = [];
private Dictionary<int, AnnotationClass>? _annotationClassesDict;
public Dictionary<int, AnnotationClass> AnnotationClassesDict => _annotationClassesDict ??= AnnotationClasses.ToDictionary(x => x.Id);
public Size WindowSize { get; set; }
public Point WindowLocation { get; set; }
public bool FullScreen { get; set; }
public WindowConfig MainWindowConfig { get; set; }
public WindowConfig DatasetExplorerConfig { get; set; }
public double LeftPanelWidth { get; set; }
public double RightPanelWidth { get; set; }
@@ -38,6 +38,13 @@ public class Config
public ThumbnailConfig ThumbnailConfig { get; set; }
}
public class WindowConfig
{
public Size WindowSize { get; set; }
public Point WindowLocation { get; set; }
public bool FullScreen { get; set; }
}
public class ThumbnailConfig
{
public Size Size { get; set; }
@@ -60,6 +67,7 @@ public class FileConfigRepository(ILogger<FileConfigRepository> logger) : IConfi
private const string DEFAULT_IMAGES_DIR = "images";
private const string DEFAULT_RESULTS_DIR = "results";
private const string DEFAULT_THUMBNAILS_DIR = "thumbnails";
private const string DEFAULT_UNKNOWN_IMG_DIR = "unknown";
private static readonly Size DefaultWindowSize = new(1280, 720);
private static readonly Point DefaultWindowLocation = new(100, 100);
@@ -82,9 +90,18 @@ public class FileConfigRepository(ILogger<FileConfigRepository> logger) : IConfi
ImagesDirectory = Path.Combine(exePath, DEFAULT_IMAGES_DIR),
ResultsDirectory = Path.Combine(exePath, DEFAULT_RESULTS_DIR),
ThumbnailsDirectory = Path.Combine(exePath, DEFAULT_THUMBNAILS_DIR),
UnknownImages = Path.Combine(exePath, DEFAULT_UNKNOWN_IMG_DIR),
WindowLocation = DefaultWindowLocation,
WindowSize = DefaultWindowSize,
MainWindowConfig = new WindowConfig
{
WindowSize = DefaultWindowSize,
WindowLocation = DefaultWindowLocation
},
DatasetExplorerConfig = new WindowConfig
{
WindowSize = DefaultWindowSize,
WindowLocation = DefaultWindowLocation
},
ShowHelpOnStart = true,
VideoFormats = DefaultVideoFormats,