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