refactor(AnnotationParams): vereinfacht

This commit is contained in:
Developer 02
2025-03-20 17:01:13 +01:00
parent 036e1f68a8
commit 210ce072f8

View File

@@ -19,9 +19,6 @@ public class AnnotationParams
return annotation is not null;
}
[JsonIgnore]
public IEnumerable<string> Names => _annots.Select(annot => annot.Name);
public required IEnumerable<Annotation> Annotations
{
get => _annots;
@@ -33,20 +30,20 @@ public class AnnotationParams
foreach (var annot in _annots)
annot.Default = DefaultAnnotation;
foreach (var name in Names)
foreach (var annot in _annots)
{
#region set bound annotations
// horizontal
if (this[name].HorBoundAnnotName is string horBoundAnnotName)
if (annot.HorBoundAnnotName is string horBoundAnnotName)
if (TryGet(horBoundAnnotName, out var horBoundAnnot))
this[name].HorBoundAnnot = horBoundAnnot;
annot.HorBoundAnnot = horBoundAnnot;
else
throw new InvalidOperationException($"{horBoundAnnotName} added as bound anotation. However, it is not defined.");
// vertical
if (this[name].VerBoundAnnotName is string verBoundAnnotName)
if (annot.VerBoundAnnotName is string verBoundAnnotName)
if (TryGet(verBoundAnnotName, out var verBoundAnnot))
this[name].VerBoundAnnot = verBoundAnnot;
annot.VerBoundAnnot = verBoundAnnot;
else
throw new InvalidOperationException($"{verBoundAnnotName} added as bound anotation. However, it is not defined.");
#endregion