refactor(AnnotationParams): vereinfacht
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user