using Newtonsoft.Json;
//using OpenCvSharp;
namespace DaJiaoYan.Models
{
public class TestTemplate
{
private const string V2 = "v2";
public enum TemplateVersion
{
V1, V2
}
// {
// "barcodeRect": {
// "height": 394,
// "width": 631,
// "x": 953,
// "y": 411
// },
// "card_size_type": 4,
// "missedRect": {
// "height": 20,
// "width": 56,
// "x": 702,
// "y": 234
// },
// "nameRect": {
// "height": 292,
// "width": 492,
// "x": 251,
// "y": 233
// },
// "numberRect": {
// "height": 154,
// "width": 670,
// "x": 839,
// "y": 272
// },
// "temp_height": 2004,
// "temp_rect": {
// "height": 26,
// "width": 48,
// "x": 125,
// "y": 126
// },
// "temp_width": 2937
//}
[JsonProperty(PropertyName = "barcodeRect", NullValueHandling = NullValueHandling.Ignore)]
public Rect BarcodeRect { get; set; }
[JsonProperty(PropertyName = "card_size_type")]
public Enumerates.CardSizeType CardSizeType { get; set; }
[JsonProperty(PropertyName = "missedRect", NullValueHandling = NullValueHandling.Ignore)]
public Rect MissedRect { get; set; }
[JsonProperty(PropertyName = "nameRect", NullValueHandling = NullValueHandling.Ignore)]
public Rect NameRect { get; set; }
[JsonProperty(PropertyName = "numberRect", NullValueHandling = NullValueHandling.Ignore)]
public Rect NumberRect { get; set; }
//[JsonProperty(PropertyName = "temp_rect", NullValueHandling = NullValueHandling.Ignore)]
public TemplateRect TemplateRect { get; set; }
///
/// 锚点内宽度
///
[JsonProperty(PropertyName = "temp_width", NullValueHandling = NullValueHandling.Ignore)]
public int TemplateWidth { get; set; }
///
/// 锚点内高度
///
[JsonProperty(PropertyName = "temp_height", NullValueHandling = NullValueHandling.Ignore)]
public int TemplateHeight { get; set; }
///
/// 锚点宽度
///
[JsonProperty(PropertyName = "anchor_width", NullValueHandling = NullValueHandling.Ignore)]
public int AnchorWidth { get; set; }
///
/// 锚点高度
///
[JsonProperty(PropertyName = "anchor_height", NullValueHandling = NullValueHandling.Ignore)]
public int AnchorHeight { get; set; }
///
/// 版本
///
[JsonProperty(PropertyName = "version", NullValueHandling = NullValueHandling.Ignore)]
public string Version { get; set; }
//[JsonProperty(PropertyName = "Version", NullValueHandling = NullValueHandling.Ignore), JsonConverter(typeof(StringEnumConverter))]
///
/// 当前模版信息
///
public TemplateVersion ParsedVersion
{
get
{
return string.Equals(Version, V2, System.StringComparison.OrdinalIgnoreCase) ? TemplateVersion.V2 : TemplateVersion.V1;
}
set
{
Version = value == TemplateVersion.V2 ? "v2" : "";
}
}
///
/// 模版dpi
///
public int Dpi { get; set; }
[JsonProperty(PropertyName = "answer_sheet")]
public TestAnswerSheet[] AnswerSheets { get; set; }
}
}