68 lines
1.3 KiB
C#

using System.Text.Json.Serialization;
namespace EnvelopeGenerator.Web.Models;
public record Annotation
{
public required string Name { get; init; }
#region Bound Annotation
public string? HorBoundAnnotName { get; init; }
public string? VerBoundAnnotName { get; init; }
#endregion
#region Layout
internal double _left = default;
internal double _top = default;
internal double _width = default;
internal double _height = default;
public double Left
{
get => _left;
init => _left = value;
}
public double Top
{
get => _top;
init => _top = value;
}
public double Width
{
get => _width;
init => _width = value;
}
public double Height
{
get => _height;
init => _height = value;
}
#endregion
#region Pos
public double PosX => Left + (HorBoundAnnot?.HorBoundary ?? 0);
public double PosY => Top + (VerBoundAnnot?.VerBoundary ?? 0);
#endregion
#region Boundary
public double HorBoundary => Left + Width;
public double VerBoundary => Top + Height;
#endregion
#region BoundAnnot
[JsonIgnore]
public Annotation? HorBoundAnnot { get; set; }
[JsonIgnore]
public Annotation? VerBoundAnnot { get; set; }
#endregion
};