32 lines
1.2 KiB
C#
32 lines
1.2 KiB
C#
namespace EnvelopeGenerator.Web.Models;
|
|
|
|
public class AnnotationParams
|
|
{
|
|
private readonly Dictionary<string, Annotation> _annots = new();
|
|
|
|
public required Dictionary<string, Annotation> Annots
|
|
{
|
|
get => _annots;
|
|
init
|
|
{
|
|
// set bound annotations
|
|
foreach (var name in _annots.Keys)
|
|
{
|
|
// horizontal
|
|
if (_annots[name].HorBoundAnnotName is string horBoundAnnotName)
|
|
if (_annots.TryGetValue(horBoundAnnotName, out var horBoundAnnot))
|
|
_annots[name].HorBoundAnnot = horBoundAnnot;
|
|
else
|
|
throw new InvalidOperationException($"{horBoundAnnotName} added as bound anotation. However, it is not defined.");
|
|
|
|
// vertical
|
|
if (_annots[name].VerBoundAnnotName is string verBoundAnnotName)
|
|
if (_annots.TryGetValue(verBoundAnnotName, out var verBoundAnnot))
|
|
_annots[name].VerBoundAnnot = verBoundAnnot;
|
|
else
|
|
throw new InvalidOperationException($"{verBoundAnnotName} added as bound anotation. However, it is not defined.");
|
|
}
|
|
}
|
|
}
|
|
}
|